From 9620511b86eb6453517e3b7a35b17a8d8d0eeb5c Mon Sep 17 00:00:00 2001 From: Enrique Artal Date: Wed, 12 Apr 2023 15:39:22 +0200 Subject: [PATCH 001/423] Add documentation Change _standard_lift_Tietze for braids --- src/doc/en/reference/groups/index.rst | 1 + src/sage/groups/artin.py | 33 ++++++++++++++++---- src/sage/groups/braid.py | 45 ++++++++++++++------------- 3 files changed, 52 insertions(+), 27 deletions(-) diff --git a/src/doc/en/reference/groups/index.rst b/src/doc/en/reference/groups/index.rst index e3df953c29a..48670ca514a 100644 --- a/src/doc/en/reference/groups/index.rst +++ b/src/doc/en/reference/groups/index.rst @@ -18,6 +18,7 @@ Groups sage/groups/braid sage/groups/cubic_braid sage/groups/indexed_free_group + sage/groups/artin sage/groups/raag sage/groups/cactus_group sage/groups/group_exp diff --git a/src/sage/groups/artin.py b/src/sage/groups/artin.py index 0e91205c8e1..31143630daa 100644 --- a/src/sage/groups/artin.py +++ b/src/sage/groups/artin.py @@ -103,20 +103,41 @@ def coxeter_group_element(self, W=None): Return the corresponding Coxeter group element under the natural projection. + INPUT: + + - W -- (default: ``None``) It may be ``G = SymmetricGroup(n)`` if ``self.parent()`` + is either an Artin group of type ``['A', n-1]`` or ``BraidGroup(n)`` to obtain an + element of ``G`` instead a ``Standard Permutation``. + OUTPUT: - A permutation. + An element of the Coxeter group or an elemento of a symmetric group. EXAMPLES:: - sage: A. = ArtinGroup(['B',3]) + sage: B. = ArtinGroup(['B',3]) sage: b = s1 * s2 / s3 / s2 - sage: b.coxeter_group_element() + sage: b1 = b.coxeter_group_element(); b1 [ 1 -1 0] [ 2 -1 0] [ a -a 1] sage: b.coxeter_group_element().reduced_word() [1, 2, 3, 2] + sage: A. = ArtinGroup(['A',3]) + sage: c = s1 * s2 *s3 + sage: c1 = c.coxeter_group_element(); c1 + [4, 1, 2, 3] + sage: c1.reduced_word() + [3, 2, 1] + sage: c.coxeter_group_element(W=SymmetricGroup(4)) + (1,4,3,2) + sage: A. = BraidGroup(4) + sage: c = s1 * s2 *s3 + sage: c.coxeter_group_element() + [4, 1, 2, 3] + sage: c.coxeter_group_element(W=SymmetricGroup(4)) + (1,4,3,2) + """ if W is None: W = self.parent().coxeter_group() @@ -208,7 +229,7 @@ def left_normal_form(self): sage: B = BraidGroup(4) sage: b = B([1, 2, 3, -1, 2, -3]) sage: b.left_normal_form() - (s0^-1*s1^-1*s2^-1*s0^-1*s1^-1*s0^-1, s0*s1*s2*s1*s0, s0*s2*s1) + (s0^-1*s1^-1*s0^-1*s2^-1*s1^-1*s0^-1, s0*s1*s2*s1*s0, s0*s2*s1) sage: c = B([1]) sage: c.left_normal_form() (1, s0) @@ -649,7 +670,7 @@ def _standard_lift(self, w): sage: B = BraidGroup(5) sage: P = Permutation([5, 3, 1, 2, 4]) sage: B._standard_lift(P) - s0*s1*s0*s2*s1*s3 + s0*s1*s2*s3*s0*s1 """ return self(self._standard_lift_Tietze(w)) @@ -711,7 +732,7 @@ def delta(self): sage: B = BraidGroup(5) sage: B.delta() - s0*s1*s0*s2*s1*s0*s3*s2*s1*s0 + s0*s1*s2*s3*s0*s1*s2*s0*s1*s0 """ return self._standard_lift(self._coxeter_group.long_element()) diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index 67f1f8e4dd9..fad7e5e8bb3 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -1492,7 +1492,7 @@ def left_normal_form(self, algorithm='libbraiding'): (1,) sage: b = B([-2, 2, -4, -4, 4, -5, -1, 4, -1, 1]) sage: L1 = b.left_normal_form(); L1 - (s0^-1*s1^-1*s2^-1*s3^-1*s4^-1*s0^-1*s1^-1*s2^-1*s3^-1*s0^-1*s1^-1*s2^-1*s0^-1*s1^-1*s0^-1, + (s0^-1*s1^-1*s0^-1*s2^-1*s1^-1*s0^-1*s3^-1*s2^-1*s1^-1*s0^-1*s4^-1*s3^-1*s2^-1*s1^-1*s0^-1, s0*s2*s1*s0*s3*s2*s1*s0*s4*s3*s2*s1, s3) sage: L1 == b.left_normal_form() @@ -1500,8 +1500,8 @@ def left_normal_form(self, algorithm='libbraiding'): sage: B([1]).left_normal_form(algorithm='artin') (1, s0) sage: B([-3]).left_normal_form(algorithm='artin') - (s0^-1*s1^-1*s2^-1*s3^-1*s4^-1*s0^-1*s1^-1*s2^-1*s3^-1*s0^-1*s1^-1*s2^-1*s0^-1*s1^-1*s0^-1, - s0*s1*s0*s2*s1*s3*s2*s1*s0*s4*s3*s2*s1*s0) + (s0^-1*s1^-1*s0^-1*s2^-1*s1^-1*s0^-1*s3^-1*s2^-1*s1^-1*s0^-1*s4^-1*s3^-1*s2^-1*s1^-1*s0^-1, + s0*s1*s2*s3*s4*s0*s1*s2*s3*s1*s2*s0*s1*s0) sage: B = BraidGroup(3) sage: B([1,2,-1]).left_normal_form() (s0^-1*s1^-1*s0^-1, s1*s0, s0*s1) @@ -2732,7 +2732,7 @@ def _standard_lift_Tietze(self, p): OUTPUT: - The lexicographically smallest word that represents the braid, + A shortest word that represents the braid, in Tietze list form. EXAMPLES:: @@ -2740,22 +2740,25 @@ def _standard_lift_Tietze(self, p): sage: B = BraidGroup(5) sage: P = Permutation([5, 3, 1, 2, 4]) sage: B._standard_lift_Tietze(P) - (1, 2, 1, 3, 2, 4) - """ - if not p.length(): - return () - pl = p - l = [] - while pl.length(): - i = 1 - while i < max(pl): - if pl(i) > pl(i+1): - l.append(i) - pl = self._coxeter_group.simple_reflection(i) * pl - i = 1 - else: - i += 1 - return tuple(l) + (1, 2, 3, 4, 1, 2) + """ + G = SymmetricGroup(self.strands()) + pl = G(p) + return tuple(pl.reduced_word()) + # if not p.length(): + # return () + # pl = p + # l = [] + # while pl.length(): + # i = 1 + # while i < max(pl): + # if pl(i) > pl(i+1): + # l.append(i) + # pl = self._coxeter_group.simple_reflection(i) * pl + # i = 1 + # else: + # i += 1 + # return tuple(l) @cached_method def _links_gould_representation(self, symbolics=False): @@ -3364,7 +3367,7 @@ def _element_from_libbraiding(self, nf): sage: B = BraidGroup(5) sage: B._element_from_libbraiding([[-2], [2, 1], [1, 2], [2, 1]]) - (s0^-1*s1^-1*s2^-1*s3^-1*s0^-1*s1^-1*s2^-1*s0^-1*s1^-1*s0^-1)^2*s1*s0^2*s1^2*s0 + (s0^-1*s1^-1*s0^-1*s2^-1*s1^-1*s0^-1*s3^-1*s2^-1*s1^-1*s0^-1)^2*s1*s0^2*s1^2*s0 sage: B._element_from_libbraiding([[0]]) 1 """ From ee97fe6826e9c06fe129798f8f7bedc5cafdbed3 Mon Sep 17 00:00:00 2001 From: Enrique Artal Date: Wed, 12 Apr 2023 17:16:02 +0200 Subject: [PATCH 002/423] Define the braid of a either a permutation or an element in the symmetric group --- src/sage/groups/braid.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index fad7e5e8bb3..bc19e5992f3 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -76,8 +76,10 @@ from sage.categories.groups import Groups from sage.groups.free_group import FreeGroup, is_FreeGroup from sage.groups.perm_gps.permgroup_named import SymmetricGroup +from sage.groups.perm_gps.permgroup_named import SymmetricGroupElement from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing from sage.matrix.constructor import identity_matrix, matrix +from sage.combinat.permutation import Permutation from sage.combinat.permutation import Permutations from sage.combinat.subset import Subsets from sage.categories.action import Action @@ -2678,7 +2680,14 @@ def _element_constructor_(self, x): sage: B = BraidGroup(4) sage: B([1, 2, 3]) # indirect doctest s0*s1*s2 - """ + sage: p = Permutation([3,1,2,4]); B(p) + s0*s1 + sage: q = SymmetricGroup(4)((1,2)); B(q) + s0 + """ + if not isinstance(x, (tuple, list)): + if isinstance(x, (SymmetricGroupElement, Permutation)): + x = self._standard_lift_Tietze(x) return self.element_class(self, x) def an_element(self): From bf34d0349c278c1356faf8e825fe138d395af4d7 Mon Sep 17 00:00:00 2001 From: Enrique Artal Date: Thu, 13 Apr 2023 09:18:25 +0200 Subject: [PATCH 003/423] More examples --- src/sage/groups/artin.py | 17 +++++++++++++---- src/sage/groups/braid.py | 16 ++++++++++++---- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/sage/groups/artin.py b/src/sage/groups/artin.py index 31143630daa..6fe9dca0e66 100644 --- a/src/sage/groups/artin.py +++ b/src/sage/groups/artin.py @@ -111,7 +111,7 @@ def coxeter_group_element(self, W=None): OUTPUT: - An element of the Coxeter group or an elemento of a symmetric group. + An element of the Coxeter group or an element of a symmetric group. EXAMPLES:: @@ -132,12 +132,21 @@ def coxeter_group_element(self, W=None): sage: c.coxeter_group_element(W=SymmetricGroup(4)) (1,4,3,2) sage: A. = BraidGroup(4) - sage: c = s1 * s2 *s3 - sage: c.coxeter_group_element() + sage: c = s1 * s2 * s3^-1 + sage: c0 = c.coxeter_group_element(); c0 [4, 1, 2, 3] - sage: c.coxeter_group_element(W=SymmetricGroup(4)) + sage: c1 = c.coxeter_group_element(W=SymmetricGroup(4)); c1 (1,4,3,2) + From an element of the Coxeter group it is possible to recover + the image by the standard section to the Artin group. + + sage: B(b1) + s1*s2*s3*s2 + sage: A(c0) + s1*s2*s3 + sage: A(c0) == A(c1) + True """ if W is None: W = self.parent().coxeter_group() diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index bc19e5992f3..acc68ede200 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -441,18 +441,26 @@ def permutation(self, W=None): OUTPUT: - The image of ``self`` under the natural projection map to ``W``. + The image of ``self`` under the natural projection map to ``W`` + as either a standard permutation or an element of a symmetric group. EXAMPLES:: sage: B. = BraidGroup() sage: S = SymmetricGroup(4) sage: b = s0*s1/s2/s1 - sage: b.permutation(W=S) + sage: c0 = b.permutation(W=S) (1,4,2) - sage: c = b.permutation(W=Permutations(4)); c + sage: c1 = b.permutation(W=Permutations(4)); c1 [4, 1, 3, 2] - sage: c == b.permutation() + sage: c1 == b.permutation() + True + + From a permutation it is also possible to recover the permutation braid. + + sage: B(c0) + s0*s1*s2*s1 + sage: B(c0) == B(c1) True """ return self.coxeter_group_element(W) From d42091c1b46e5aa1145c6954aaa03f115b563cd3 Mon Sep 17 00:00:00 2001 From: Enrique Artal Date: Thu, 13 Apr 2023 13:35:06 +0200 Subject: [PATCH 004/423] test error --- src/sage/groups/braid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index acc68ede200..fd0cb91d77d 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -449,7 +449,7 @@ def permutation(self, W=None): sage: B. = BraidGroup() sage: S = SymmetricGroup(4) sage: b = s0*s1/s2/s1 - sage: c0 = b.permutation(W=S) + sage: c0 = b.permutation(W=S); c0 (1,4,2) sage: c1 = b.permutation(W=Permutations(4)); c1 [4, 1, 3, 2] From 55894dc0bc51b2574092aced37fb0e47221db5f3 Mon Sep 17 00:00:00 2001 From: Enrique Artal Date: Fri, 14 Apr 2023 15:28:41 +0200 Subject: [PATCH 005/423] New methods for braids --- src/sage/groups/braid.py | 121 ++++++++++++++++++++++++++++++++++----- 1 file changed, 106 insertions(+), 15 deletions(-) diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index fd0cb91d77d..c27f07ded89 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -67,28 +67,31 @@ # https://www.gnu.org/licenses/ ############################################################################## -from sage.rings.integer import Integer -from sage.rings.integer_ring import IntegerRing -from sage.misc.lazy_attribute import lazy_attribute -from sage.misc.lazy_import import lazy_import -from sage.misc.cachefunc import cached_method -from sage.misc.misc_c import prod +from sage.categories.action import Action from sage.categories.groups import Groups -from sage.groups.free_group import FreeGroup, is_FreeGroup -from sage.groups.perm_gps.permgroup_named import SymmetricGroup -from sage.groups.perm_gps.permgroup_named import SymmetricGroupElement -from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing -from sage.matrix.constructor import identity_matrix, matrix from sage.combinat.permutation import Permutation from sage.combinat.permutation import Permutations from sage.combinat.subset import Subsets -from sage.categories.action import Action +from sage.features import PythonModule +from sage.groups.artin import FiniteTypeArtinGroup, FiniteTypeArtinGroupElement +from sage.groups.finitely_presented import FinitelyPresentedGroup +from sage.groups.finitely_presented import GroupMorphismWithGensImages +from sage.groups.free_group import FreeGroup, is_FreeGroup +from sage.functions.generalized import sign +from sage.groups.perm_gps.permgroup_named import SymmetricGroup +from sage.groups.perm_gps.permgroup_named import SymmetricGroupElement from sage.knots.knot import Knot +from sage.libs.gap.libgap import libgap +from sage.matrix.constructor import identity_matrix, matrix +from sage.misc.lazy_attribute import lazy_attribute +from sage.misc.lazy_import import lazy_import +from sage.misc.cachefunc import cached_method +from sage.misc.misc_c import prod +from sage.rings.integer import Integer +from sage.rings.integer_ring import IntegerRing +from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing from sage.sets.set import Set -from sage.groups.finitely_presented import FinitelyPresentedGroup -from sage.groups.artin import FiniteTypeArtinGroup, FiniteTypeArtinGroupElement from sage.structure.richcmp import richcmp, rich_to_bool -from sage.features import PythonModule lazy_import('sage.libs.braiding', @@ -3417,6 +3420,94 @@ def mirror_involution(self): gens_mirr = [~g for g in self.gens()] return self.hom(gens_mirr, check=False) + def presentation2gens(self, isomorphisms=False): + """ + Construct an isomorphic group to ``gens`` with only two generators + + INPUT: + + - ``isomorphism`` -- boolean (default ``False``). If ``True`` an isomorphism + from ``self`` and the isomorphic group and its inverse are provided + + EXAMPLES: + + sage: B = BraidGroup(3) + sage: B.presentation2gens() + Finitely presented group < x0, x1 | x1^3*x0^-2 > + sage: B = BraidGroup(4) + sage: G, hom1, hom2 = B.presentation2gens(isomorphisms=True) + sage: G + Finitely presented group < x0, x1 | x1^4*x0^-3, x0*x1*x0*x1^-2*x0^-1*x1^3*x0^-1*x1^-2 > + sage: hom1(B.gen(0)) + x0*x1^-1 + sage: hom1(B.gen(1)) + x1*x0*x1^-2 + sage: hom1(B.gen(2)) + x1^2*x0*x1^-3 + sage: all(hom2(hom1(a)) == a for a in B.gens()) + True + sage: all(hom2(a) == B.one() for a in G.relations()) + True + """ + n = self.strands() + F = FreeGroup(2, "x") + rel = [n * (2,)+ (n - 1) * (-1,)] + rel += [(1,) + (j - 1) * (2,) + (1,) + j * (-2,) + (-1,) + (j + 1) * (2,) + (-1,) + j * (-2,) + for j in range(2, n - 1)] + G = F / rel + if not isomorphisms: + return G + a1 = (1, -2) + L1 = [j * (2,) + a1 + j * (-2,) for j in range(n - 1)] + h1 = self.hom(codomain=G, im_gens=[G(a) for a in L1], check=False) + a2 = tuple(range(1, n)) + L2 = [(1,) + a2, a2] + h2 = G.hom(codomain=self, im_gens=[self(a) for a in L2], check=False) + return (G, h1, h2) + + def epimorphisms(self, H): + r""" + Return the epimorphisms from ``self`` to ``H``, up to automorphism of `H` passing + through the presentation of two gens for ``self`` + + INPUT: + + - `H` -- Another group + + EXAMPLES:: + + sage: B = BraidGroup(5) + sage: B.epimorphisms(SymmetricGroup(5)) + [Generic morphism: + From: Braid group on 5 strands + To: Symmetric group of order 5! as a permutation group + Defn: s0 |--> (1,5) + s1 |--> (4,5) + s2 |--> (3,4) + s3 |--> (2,3)] + + ALGORITHM: + + Uses libgap's GQuotients function. + """ + G, hom1, hom2 = self.presentation2gens(isomorphisms=True) + from sage.misc.misc_c import prod + HomSpace = self.Hom(H) + G0g = libgap(self) + Gg = libgap(G) + Hg = libgap(H) + gquotients = Gg.GQuotients(Hg) + hom1g = libgap.GroupHomomorphismByImagesNC(G0g,Gg,[libgap(hom1(u)) for u in self.gens()]) + g0quotients = [hom1g * h for h in gquotients] + res = [] + # the following closure is needed to attach a specific value of quo to + # each function in the different morphisms + fmap = lambda tup: (lambda a: H(prod(tup[abs(i)-1]**sign(i) for i in a.Tietze()))) + for quo in g0quotients: + tup = tuple(H(quo.ImageElm(i.gap()).sage()) for i in self.gens()) + fhom = GroupMorphismWithGensImages(HomSpace, fmap(tup)) + res.append(fhom) + return res def BraidGroup(n=None, names='s'): """ From 3e771a621a57770a899532d2d0d7e3274034e0eb Mon Sep 17 00:00:00 2001 From: Enrique Artal Date: Fri, 14 Apr 2023 15:34:07 +0200 Subject: [PATCH 006/423] Erratas --- src/sage/groups/braid.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index c27f07ded89..fe28e634ba1 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -3427,7 +3427,7 @@ def presentation2gens(self, isomorphisms=False): INPUT: - ``isomorphism`` -- boolean (default ``False``). If ``True`` an isomorphism - from ``self`` and the isomorphic group and its inverse are provided + from ``self`` and the isomorphic group and its inverse are provided EXAMPLES: @@ -3451,7 +3451,7 @@ def presentation2gens(self, isomorphisms=False): """ n = self.strands() F = FreeGroup(2, "x") - rel = [n * (2,)+ (n - 1) * (-1,)] + rel = [n * (2,) + (n - 1) * (-1,)] rel += [(1,) + (j - 1) * (2,) + (1,) + j * (-2,) + (-1,) + (j + 1) * (2,) + (-1,) + j * (-2,) for j in range(2, n - 1)] G = F / rel From b6b1febb7ba11545c79c36735c3401111cba3c19 Mon Sep 17 00:00:00 2001 From: Enrique Artal Date: Mon, 24 Apr 2023 14:15:05 +0200 Subject: [PATCH 007/423] Allow gfortran13 --- build/pkgs/gfortran/spkg-configure.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/pkgs/gfortran/spkg-configure.m4 b/build/pkgs/gfortran/spkg-configure.m4 index 1a2d6ba767c..d2841f740aa 100644 --- a/build/pkgs/gfortran/spkg-configure.m4 +++ b/build/pkgs/gfortran/spkg-configure.m4 @@ -86,8 +86,8 @@ SAGE_SPKG_CONFIGURE([gfortran], [ # Install our own gfortran if the system-provided one is older than gcc-4.8. SAGE_SHOULD_INSTALL_GFORTRAN([$FC is version $GFORTRAN_VERSION, which is quite old]) ], - [1[[3-9]].*], [ - # Install our own gfortran if the system-provided one is newer than 12.x. + [1[[4-9]].*], [ + # Install our own gfortran if the system-provided one is newer than 13.x. # See https://github.com/sagemath/sage/issues/29456, https://github.com/sagemath/sage/issues/31838 SAGE_MUST_INSTALL_GFORTRAN([$FC is version $GFORTRAN_VERSION, which is too recent for this version of Sage]) ]) From d3064e8be17aebcee87cad0365058b59f93423ac Mon Sep 17 00:00:00 2001 From: Gerald Teschl Date: Wed, 5 Jul 2023 13:39:18 +0200 Subject: [PATCH 008/423] Added exponential and gamma distribution --- .../probability/probability_distribution.pyx | 74 +++++++++++++++++-- 1 file changed, 68 insertions(+), 6 deletions(-) diff --git a/src/sage/probability/probability_distribution.pyx b/src/sage/probability/probability_distribution.pyx index 4e27a861f6e..1ddc1b00ce2 100644 --- a/src/sage/probability/probability_distribution.pyx +++ b/src/sage/probability/probability_distribution.pyx @@ -46,8 +46,7 @@ import sage.rings.real_double from sage.modules.free_module_element import vector # TODO: Add more distributions available in gsl -# available but not currently wrapped are exponential, laplace, cauchy, landau, gamma, -# gamma, beta logistic. +# available but not currently wrapped are laplace, cauchy, landau, logistic. cdef enum: uniform @@ -61,6 +60,8 @@ cdef enum: exppow weibull beta + exponential + gamma cdef class ProbabilityDistribution: """ @@ -495,6 +496,33 @@ cdef class RealDistribution(ProbabilityDistribution): sage: T.cum_distribution_function(1) 1.0 + The exponential distribution has one parameter ``mu``:: + + sage: mu = 2 + sage: T = RealDistribution('exponential', mu) + sage: s = T.get_random_element() + sage: 0 <= s + True + sage: s.parent() + Real Double Field + sage: T.distribution_function(0) + 0.0 + + The gamma distribution has two parameters ``a`` and ``b``:: + + sage: a = 2 + sage: b = 2 + sage: T = RealDistribution('gamma', [a, b]) + sage: s = T.get_random_element() + sage: 0 <= s + True + sage: s.parent() + Real Double Field + sage: T.distribution_function(0) + 0.0 + sage: T.cum_distribution_function(1) + 1.0 + The weibull distribution has two parameters ``a`` and ``b``:: sage: a = 1 @@ -676,7 +704,11 @@ cdef class RealDistribution(ProbabilityDistribution): result = gsl_ran_weibull(self.r, self.parameters[0], self.parameters[1]) elif self.distribution_type == beta: result = gsl_ran_beta(self.r, self.parameters[0], self.parameters[1]) - else: + elif self.distribution_type == exponential: + result = gsl_ran_exponential(self.r, self.parameters[0]) + elif self.distribution_type == gamma: + result = gsl_ran_gamma(self.r, self.parameters[0], self.parameters[1]) + else: raise TypeError("Not a supported probability distribution") return sage.rings.real_double.RDF(result) @@ -723,7 +755,6 @@ cdef class RealDistribution(ProbabilityDistribution): self.parameters[1] = float(parameters[1]) self.distribution_type = pareto elif name == 'rayleigh': - self.distribution_type = rayleigh try: float(parameters) except Exception: @@ -804,7 +835,26 @@ cdef class RealDistribution(ProbabilityDistribution): self.parameters[0] = float(parameters[0]) self.parameters[1] = float(parameters[1]) self.distribution_type = beta - else: + elif name == 'exponential': + try: + float(parameters) + except Exception: + raise TypeError("exponential distribution requires parameter mu coercible to float") + self.parameters = sig_malloc(sizeof(double)) + self.parameters[0] = float(parameters) + self.distribution_type = exponential + elif name == 'gamma': + if len(parameters) != 2: + raise TypeError("gamma distribution requires two real parameters") + try: + map(float, parameters) + except Exception: + raise TypeError("gamma distribution requires real parameters") + self.parameters = sig_malloc(sizeof(double)*2) + self.parameters[0] = float(parameters[0]) + self.parameters[1] = float(parameters[1]) + self.distribution_type = gamma + else: raise TypeError("Not a supported probability distribution") self.name = name @@ -869,6 +919,10 @@ cdef class RealDistribution(ProbabilityDistribution): return sage.rings.real_double.RDF(gsl_ran_weibull_pdf(x, self.parameters[0], self.parameters[1])) elif self.distribution_type == beta: return sage.rings.real_double.RDF(gsl_ran_beta_pdf(x, self.parameters[0], self.parameters[1])) + elif self.distribution_type == exponential: + return sage.rings.real_double.RDF(gsl_ran_exponential_pdf(x, self.parameters[0])) + elif self.distribution_type == gamma: + return sage.rings.real_double.RDF(gsl_ran_gamma_pdf(x, self.parameters[0], self.parameters[1])) else: raise TypeError("Not a supported probability distribution") @@ -905,7 +959,11 @@ cdef class RealDistribution(ProbabilityDistribution): return sage.rings.real_double.RDF(gsl_cdf_weibull_P(x, self.parameters[0], self.parameters[1])) elif self.distribution_type == beta: return sage.rings.real_double.RDF(gsl_cdf_beta_P(x, self.parameters[0], self.parameters[1])) - else: + elif self.distribution_type == exponential: + return sage.rings.real_double.RDF(gsl_cdf_exponential_P(x, self.parameters[0]])) + elif self.distribution_type == gamma: + return sage.rings.real_double.RDF(gsl_cdf_gamma_P(x, self.parameters[0], self.parameters[1])) + else: raise TypeError("Not a supported probability distribution") def cum_distribution_function_inv(self, x): @@ -942,6 +1000,10 @@ cdef class RealDistribution(ProbabilityDistribution): return sage.rings.real_double.RDF(gsl_cdf_weibull_Pinv(x, self.parameters[0], self.parameters[1])) elif self.distribution_type == beta: return sage.rings.real_double.RDF(gsl_cdf_beta_Pinv(x, self.parameters[0], self.parameters[1])) + elif self.distribution_type == exponential: + return sage.rings.real_double.RDF(gsl_cdf_exponential_Pinv(x, self.parameters[0])) + elif self.distribution_type == gamma: + return sage.rings.real_double.RDF(gsl_cdf_gamma_Pinv(x, self.parameters[0], self.parameters[1])) else: raise TypeError("Not a supported probability distribution") From e5edc6473e44c183170e6be941e123faa34d81f6 Mon Sep 17 00:00:00 2001 From: Gerald Teschl Date: Wed, 5 Jul 2023 13:42:25 +0200 Subject: [PATCH 009/423] Update probability_distribution.pyx --- src/sage/probability/probability_distribution.pyx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/probability/probability_distribution.pyx b/src/sage/probability/probability_distribution.pyx index 1ddc1b00ce2..8fa55b44dfb 100644 --- a/src/sage/probability/probability_distribution.pyx +++ b/src/sage/probability/probability_distribution.pyx @@ -706,9 +706,9 @@ cdef class RealDistribution(ProbabilityDistribution): result = gsl_ran_beta(self.r, self.parameters[0], self.parameters[1]) elif self.distribution_type == exponential: result = gsl_ran_exponential(self.r, self.parameters[0]) - elif self.distribution_type == gamma: + elif self.distribution_type == gamma: result = gsl_ran_gamma(self.r, self.parameters[0], self.parameters[1]) - else: + else: raise TypeError("Not a supported probability distribution") return sage.rings.real_double.RDF(result) @@ -854,7 +854,7 @@ cdef class RealDistribution(ProbabilityDistribution): self.parameters[0] = float(parameters[0]) self.parameters[1] = float(parameters[1]) self.distribution_type = gamma - else: + else: raise TypeError("Not a supported probability distribution") self.name = name @@ -963,7 +963,7 @@ cdef class RealDistribution(ProbabilityDistribution): return sage.rings.real_double.RDF(gsl_cdf_exponential_P(x, self.parameters[0]])) elif self.distribution_type == gamma: return sage.rings.real_double.RDF(gsl_cdf_gamma_P(x, self.parameters[0], self.parameters[1])) - else: + else: raise TypeError("Not a supported probability distribution") def cum_distribution_function_inv(self, x): From 90603da019638dc32f3a463792d55983143e9159 Mon Sep 17 00:00:00 2001 From: Gerald Teschl Date: Wed, 5 Jul 2023 13:44:28 +0200 Subject: [PATCH 010/423] Update probability_distribution.pyx --- src/sage/probability/probability_distribution.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/probability/probability_distribution.pyx b/src/sage/probability/probability_distribution.pyx index 8fa55b44dfb..fe08e9a5f16 100644 --- a/src/sage/probability/probability_distribution.pyx +++ b/src/sage/probability/probability_distribution.pyx @@ -843,7 +843,7 @@ cdef class RealDistribution(ProbabilityDistribution): self.parameters = sig_malloc(sizeof(double)) self.parameters[0] = float(parameters) self.distribution_type = exponential - elif name == 'gamma': + elif name == 'gamma': if len(parameters) != 2: raise TypeError("gamma distribution requires two real parameters") try: @@ -854,7 +854,7 @@ cdef class RealDistribution(ProbabilityDistribution): self.parameters[0] = float(parameters[0]) self.parameters[1] = float(parameters[1]) self.distribution_type = gamma - else: + else: raise TypeError("Not a supported probability distribution") self.name = name From 4c8c0d0dcc3bacc5d515d1f6f4b5017d281d0ae7 Mon Sep 17 00:00:00 2001 From: Gerald Teschl Date: Wed, 5 Jul 2023 13:46:47 +0200 Subject: [PATCH 011/423] Update probability_distribution.pyx --- src/sage/probability/probability_distribution.pyx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/sage/probability/probability_distribution.pyx b/src/sage/probability/probability_distribution.pyx index fe08e9a5f16..ed45990cedb 100644 --- a/src/sage/probability/probability_distribution.pyx +++ b/src/sage/probability/probability_distribution.pyx @@ -520,8 +520,6 @@ cdef class RealDistribution(ProbabilityDistribution): Real Double Field sage: T.distribution_function(0) 0.0 - sage: T.cum_distribution_function(1) - 1.0 The weibull distribution has two parameters ``a`` and ``b``:: From 2fa0be2c652883749e40e9cd5b03c1125d2748a5 Mon Sep 17 00:00:00 2001 From: OP5642 Date: Thu, 6 Jul 2023 01:12:18 +0200 Subject: [PATCH 012/423] Removed rename_vertices argument in disjoint_union --- src/sage/topology/simplicial_complex.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/sage/topology/simplicial_complex.py b/src/sage/topology/simplicial_complex.py index c7f76fbe4bf..d693ce016f3 100644 --- a/src/sage/topology/simplicial_complex.py +++ b/src/sage/topology/simplicial_complex.py @@ -1991,23 +1991,12 @@ def suspension(self, n=1, is_mutable=True): rename_vertices=True) return self.suspension(1, is_mutable).suspension(int(n-1), is_mutable) - def disjoint_union(self, right, rename_vertices=True, is_mutable=True): + def disjoint_union(self, right, is_mutable=True): """ The disjoint union of this simplicial complex with another one. :param right: the other simplicial complex (the right-hand factor) - :param rename_vertices: If this is True, the vertices in the - disjoint union will be renamed by the formula: vertex "v" - in the left-hand factor --> vertex "Lv" in the disjoint - union, vertex "w" in the right-hand factor --> vertex "Rw" - in the disjoint union. If this is false, this tries to - construct the disjoint union without renaming the vertices; - this will cause problems if the two factors have any - vertices with names in common. - - :type rename_vertices: boolean; optional, default True - EXAMPLES:: sage: S1 = simplicial_complexes.Sphere(1) From a6892d4d2ab6320df94c889de84ba77da0d1ea23 Mon Sep 17 00:00:00 2001 From: OP5642 Date: Sun, 9 Jul 2023 11:22:45 +0200 Subject: [PATCH 013/423] Deprecated the rename_vertices parameter --- src/sage/topology/simplicial_complex.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/sage/topology/simplicial_complex.py b/src/sage/topology/simplicial_complex.py index d693ce016f3..1db5dd8148c 100644 --- a/src/sage/topology/simplicial_complex.py +++ b/src/sage/topology/simplicial_complex.py @@ -1991,12 +1991,23 @@ def suspension(self, n=1, is_mutable=True): rename_vertices=True) return self.suspension(1, is_mutable).suspension(int(n-1), is_mutable) - def disjoint_union(self, right, is_mutable=True): + def disjoint_union(self, right, rename_vertices=None, is_mutable=True): """ The disjoint union of this simplicial complex with another one. :param right: the other simplicial complex (the right-hand factor) + :param rename_vertices: If this is True, the vertices in the + disjoint union will be renamed by the formula: vertex "v" + in the left-hand factor --> vertex "Lv" in the disjoint + union, vertex "w" in the right-hand factor --> vertex "Rw" + in the disjoint union. If this is false, this tries to + construct the disjoint union without renaming the vertices; + this will cause problems if the two factors have any + vertices with names in common. + + :type rename_vertices: boolean; optional, default True + EXAMPLES:: sage: S1 = simplicial_complexes.Sphere(1) @@ -2004,6 +2015,10 @@ def disjoint_union(self, right, is_mutable=True): sage: S1.disjoint_union(S2).homology() # optional - sage.modules {0: Z, 1: Z, 2: Z} """ + if rename_vertices is not None: + from sage.misc.superseded import deprecation + deprecation(35907, 'the "rename_vertices" argument is deprecated') + facets = [] for f in self._facets: facets.append(tuple(["L" + str(v) for v in f])) From 089da87d9f332046effeeed7add919da4c20aa04 Mon Sep 17 00:00:00 2001 From: Gerald Teschl Date: Wed, 12 Jul 2023 11:35:47 +0200 Subject: [PATCH 014/423] Update probability_distribution.pyx --- src/sage/probability/probability_distribution.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/probability/probability_distribution.pyx b/src/sage/probability/probability_distribution.pyx index ed45990cedb..81966188dc3 100644 --- a/src/sage/probability/probability_distribution.pyx +++ b/src/sage/probability/probability_distribution.pyx @@ -958,7 +958,7 @@ cdef class RealDistribution(ProbabilityDistribution): elif self.distribution_type == beta: return sage.rings.real_double.RDF(gsl_cdf_beta_P(x, self.parameters[0], self.parameters[1])) elif self.distribution_type == exponential: - return sage.rings.real_double.RDF(gsl_cdf_exponential_P(x, self.parameters[0]])) + return sage.rings.real_double.RDF(gsl_cdf_exponential_P(x, self.parameters[0])) elif self.distribution_type == gamma: return sage.rings.real_double.RDF(gsl_cdf_gamma_P(x, self.parameters[0], self.parameters[1])) else: From 9947a8b15900b9f9d4adfe881ca586ecc2616579 Mon Sep 17 00:00:00 2001 From: Enrique Artal Date: Mon, 24 Jul 2023 18:42:11 +0200 Subject: [PATCH 015/423] some typos --- src/sage/groups/artin.py | 31 ++++---- src/sage/groups/braid.py | 150 ++++++++++++++++++++------------------- 2 files changed, 94 insertions(+), 87 deletions(-) diff --git a/src/sage/groups/artin.py b/src/sage/groups/artin.py index 6fe9dca0e66..2a1178914ab 100644 --- a/src/sage/groups/artin.py +++ b/src/sage/groups/artin.py @@ -12,7 +12,7 @@ - Travis Scrimshaw (2018-02-05): Initial version """ -#**************************************************************************** +# **************************************************************************** # Copyright (C) 2018 Travis Scrimshaw # # This program is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # http://www.gnu.org/licenses/ -#***************************************************************************** +# ***************************************************************************** from sage.misc.cachefunc import cached_method from sage.groups.free_group import FreeGroup @@ -47,6 +47,7 @@ class ArtinGroupElement(FinitelyPresentedGroupElement): sage: A((1, 2, -3, -2)) s1*s2*s3^-1*s2^-1 """ + def _latex_(self): r""" Return a LaTeX representation of ``self``. @@ -151,13 +152,15 @@ def coxeter_group_element(self, W=None): if W is None: W = self.parent().coxeter_group() s = W.simple_reflections() - I = W.index_set() - return W.prod(s[I[abs(i)-1]] for i in self.Tietze()) + In = W.index_set() + return W.prod(s[In[abs(i)-1]] for i in self.Tietze()) + class FiniteTypeArtinGroupElement(ArtinGroupElement): """ An element of a finite-type Artin group. """ + def _richcmp_(self, other, op): """ Compare ``self`` and ``other``. @@ -287,11 +290,11 @@ def _left_normal_form_coxeter(self): delta = 0 Delta = self.parent().coxeter_group().long_element() sr = self.parent().coxeter_group().simple_reflections() - l = self.Tietze() - if l == (): + tz = self.Tietze() + if tz == (): return (0,) form = [] - for i in l: + for i in tz: if i > 0: form.append(sr[i]) else: @@ -324,6 +327,7 @@ def _left_normal_form_coxeter(self): delta -= 1 return tuple([-delta] + form) + class ArtinGroup(FinitelyPresentedGroup): r""" An Artin group. @@ -466,13 +470,13 @@ def __init__(self, coxeter_matrix, names): free_group = FreeGroup(names) rels = [] # Generate the relations based on the Coxeter graph - I = coxeter_matrix.index_set() - for ii,i in enumerate(I): - for j in I[ii+1:]: - m = coxeter_matrix[i,j] + In = coxeter_matrix.index_set() + for ii, i in enumerate(In): + for j in In[ii+1:]: + m = coxeter_matrix[i, j] if m == Infinity: # no relation continue - elt = [i,j]*m + elt = [i, j] * m for ind in range(m, 2*m): elt[ind] = -elt[ind] rels.append(free_group(elt)) @@ -640,7 +644,7 @@ def some_elements(self): rank = self.coxeter_matrix().rank() elements_list = [self.gen(0)] elements_list.append(self.prod(self.gens())) - elements_list.append(elements_list[-1] ** min(rank,3)) + elements_list.append(elements_list[-1] ** min(rank, 3)) return elements_list def _standard_lift_Tietze(self, w): @@ -725,6 +729,7 @@ class FiniteTypeArtinGroup(ArtinGroup): sage: GF = F.cayley_graph(elements=ball(F, 4), generators=F.gens()); GF Digraph on 40 vertices """ + def delta(self): r""" Return the `\Delta` element of ``self``. diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index 84008d32f40..823f6849448 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -93,7 +93,6 @@ from sage.sets.set import Set from sage.structure.richcmp import richcmp, rich_to_bool - lazy_import('sage.libs.braiding', ['leftnormalform', 'rightnormalform', 'centralizer', 'supersummitset', 'greatestcommondivisor', 'leastcommonmultiple', 'conjugatingbraid', 'ultrasummitset', @@ -117,6 +116,7 @@ class Braid(FiniteTypeArtinGroupElement): sage: B((1, 2, -3, -2)) s0*s1*s2^-1*s1^-1 """ + def _richcmp_(self, other, op): """ Compare ``self`` and ``other`` @@ -877,8 +877,8 @@ def links_gould_polynomial(self, varnames=None, use_symbolics=False): varnames = 't0, t1' rep = self.parent()._links_gould_representation(symbolics=use_symbolics) - l = len(rep) - mu = rep[l-1] # quantum trace factor + ln = len(rep) + mu = rep[ln - 1] # quantum trace factor M = mu * self.links_gould_matrix(symbolics=use_symbolics) d1, d2 = M.dimensions() e = d1//4 @@ -886,13 +886,13 @@ def links_gould_polynomial(self, varnames=None, use_symbolics=False): R = LaurentPolynomialRing(ZZ, varnames) # partial quantum trace according to I. Marin section 2.5 - part_trace = matrix(B, 4, 4, lambda i, j: sum(M[e*i+ k, e*j+k] for k in range(e))) - ptemp = part_trace[0,0] # part_trace == psymb*M.parent().one() + part_trace = matrix(B, 4, 4, lambda i, j: sum(M[e * i + k, e * j + k] for k in range(e))) + ptemp = part_trace[0, 0] # part_trace == psymb*M.parent().one() if use_symbolics: v1, v2 = R.variable_names() pstr = str(ptemp._sympy_().simplify()) pstr = pstr.replace('t0', v1).replace('t1', v2) - F = R.fraction_field() # to make coercion work + F = R.fraction_field() # to make coercion work return R(F(pstr)) else: ltemp = ptemp.lift().constant_coefficient() @@ -1522,9 +1522,9 @@ def left_normal_form(self, algorithm='libbraiding'): (s0*s1*s0,) """ if algorithm == 'libbraiding': - l = leftnormalform(self) + lnf = leftnormalform(self) B = self.parent() - return tuple([B.delta()**l[0][0]] + [B(b) for b in l[1:]] ) + return tuple([B.delta()**lnf[0][0]] + [B(b) for b in lnf[1:]]) elif algorithm == 'artin': return FiniteTypeArtinGroupElement.left_normal_form.f(self) raise ValueError("invalid algorithm") @@ -1565,11 +1565,11 @@ def _left_normal_form_coxeter(self): delta = 0 Delta = self.parent()._coxeter_group.long_element() sr = self.parent()._coxeter_group.simple_reflections() - l = self.Tietze() - if not l: + tz = self.Tietze() + if not tz: return (0,) form = [] - for i in l: + for i in tz: if i > 0: form.append(sr[i]) else: @@ -1617,9 +1617,9 @@ def right_normal_form(self): sage: b.right_normal_form() (s1*s0, s0*s2, 1) """ - l = rightnormalform(self) + rnf = rightnormalform(self) B = self.parent() - return tuple([B(b) for b in l[:-1]] + [B.delta()**l[-1][0]]) + return tuple([B(b) for b in rnf[:-1]] + [B.delta()**rnf[-1][0]]) def centralizer(self): """ @@ -1633,9 +1633,9 @@ def centralizer(self): [s1*s0*s2*s1, s0*s2] """ - l = centralizer(self) + c = centralizer(self) B = self.parent() - return [B._element_from_libbraiding(b) for b in l] + return [B._element_from_libbraiding(b) for b in c] def super_summit_set(self): """ @@ -1652,9 +1652,9 @@ def super_summit_set(self): s0^-1*s1^-1*s0^-2*s1^-1*s0*s1^3*s0] """ - l = supersummitset(self) + sss = supersummitset(self) B = self.parent() - return [B._element_from_libbraiding(b) for b in l] + return [B._element_from_libbraiding(b) for b in sss] def gcd(self, other): """ @@ -1755,13 +1755,13 @@ def conjugating_braid(self, other): sage: c.conjugating_braid(b) is None True """ - l = conjugatingbraid(self, other) - if not l: + cb = conjugatingbraid(self, other) + if not cb: return None else: B = self.parent() - l[0][0] %= 2 - return B._element_from_libbraiding(l) + cb[0][0] %= 2 + return B._element_from_libbraiding(cb) def is_conjugated(self, other): """ @@ -1782,8 +1782,8 @@ def is_conjugated(self, other): sage: c.is_conjugated(b) False """ - l = conjugatingbraid(self, other) - return bool(l) + cb = conjugatingbraid(self, other) + return bool(cb) def pure_conjugating_braid(self, other): r""" @@ -1870,7 +1870,7 @@ def pure_conjugating_braid(self, other): if p3 not in S.subgroup(LP): return None P = p3.word_problem(list(LP), display=False, as_list=True) - b1 = prod(LP[S(a)] ** b for a,b in P) + b1 = prod(LP[S(a)] ** b for a, b in P) b0 = b1 * b0 n0 = len(b0.Tietze()) L = leftnormalform(b0) @@ -2125,12 +2125,11 @@ def deformed_burau_matrix(self, variab='q'): n = self.strands() m = len(self.Tietze()) from sage.algebras.free_algebra import FreeAlgebra - alg = FreeAlgebra(R, m*3, [f'{s}p_{i}' - for i in range(m) if self.Tietze()[i] > 0 - for s in 'bca'] - + [f'{s}m_{i}' - for i in range(m) if self.Tietze()[i] < 0 - for s in 'bca']) + alg = FreeAlgebra(R, m*3, + [f'{s}p_{i}' for i in range(m) if self.Tietze()[i] > 0 + for s in 'bca'] + + [f'{s}m_{i}' for i in range(m) if self.Tietze()[i] < 0 + for s in 'bca']) gen_indices = ([i for i in range(m) if self.Tietze()[i] > 0] + [i for i in range(m) if self.Tietze()[i] < 0]) @@ -2294,6 +2293,7 @@ class RightQuantumWord: q*cp_1*ap_1 + q^2*bp_1*cm_0*am_0*bm_2 reduced from ap_1*cp_1 + q^3*bm_2*bp_1*am_0*cm_0 """ + def __init__(self, words): r""" Initialize ``self``. @@ -2482,8 +2482,8 @@ def eps_monom(q_tuple): ret_q *= prod(prod(1 - q**(N - 1 - q_tuple[3*i + 1] - h) for h in range(q_tuple[3*i + 2])) for i in range(self._minus_begin//3)) - ret_q *= prod(prod(1 - q**(q_tuple[3*j + 1] + l + 1 - N) - for l in range(q_tuple[3*j + 2])) + ret_q *= prod(prod(1 - q**(q_tuple[3*j + 1] + k + 1 - N) + for k in range(q_tuple[3*j + 2])) for j in range(self._minus_begin//3, len(q_tuple)//3)) return ret_q @@ -2811,7 +2811,7 @@ def _links_gould_representation(self, symbolics=False): """ from sage.matrix.constructor import matrix n = self.strands() - d = 4 # dimension of the natural module + d = 4 # dimension of the natural module from sage.matrix.special import diagonal_matrix if symbolics: from sage.symbolic.ring import SR as BR @@ -2828,7 +2828,7 @@ def _links_gould_representation(self, symbolics=False): LR = LaurentPolynomialRing(ZZ, 's0r, s1r') PR = PolynomialRing(LR, 'Yr') s0r, s1r, Yr = PR.gens_dict_recursive().values() - pqr = Yr**2 + (s0r**2-1)*(s1r**2 -1) + pqr = Yr**2 + (s0r**2-1)*(s1r**2 - 1) BR = PR.quotient_ring(pqr) s0 = BR(s0r) s1 = BR(s1r) @@ -2842,12 +2842,12 @@ def _links_gould_representation(self, symbolics=False): if n == 2: # R-Matrix taken from I. Marin R = matrix(BR, {(0, 0): t0, (1, 4): s0, (2, 8): s0, (3, 12): 1, - (4, 1): s0, (4, 4): t0 - 1, (5, 5): -1, (6, 6): t0*t1 - 1, - (6, 9): -s0*s1, (6, 12): -Y*s0*s1, (7, 13): s1, (8, 2): s0, - (8, 8): t0 - 1, (9, 6): -s0*s1, (9, 12): Y, (10, 10): -1, - (11, 14): s1, (12, 3): 1, (12, 6): -Y*s0*s1, (12, 9): Y, - (12, 12): -(t0 - 1)*(t1 - 1), (13, 7): s1, (13, 13): t1 - 1, - (14, 11): s1, (14, 14): t1 - 1, (15, 15): t1}, sparse=sparse) + (4, 1): s0, (4, 4): t0 - 1, (5, 5): -1, (6, 6): t0*t1 - 1, + (6, 9): -s0*s1, (6, 12): -Y*s0*s1, (7, 13): s1, (8, 2): s0, + (8, 8): t0 - 1, (9, 6): -s0*s1, (9, 12): Y, (10, 10): -1, + (11, 14): s1, (12, 3): 1, (12, 6): -Y*s0*s1, (12, 9): Y, + (12, 12): -(t0 - 1)*(t1 - 1), (13, 7): s1, (13, 13): t1 - 1, + (14, 11): s1, (14, 14): t1 - 1, (15, 15): t1}, sparse=sparse) RI = (~t0 + ~t1)*(1 + R) - ~t0*~t1*(R + R**2) - 1 # quantum trace operator on two fold tensor space @@ -2924,58 +2924,58 @@ def _LKB_matrix_(self, braid, variab): for i in braid[1:]: A = A*self._LKB_matrix_((i,), variab) return A - l = list(Set(range(n)).subsets(2)) + n2 = list(Set(range(n)).subsets(2)) R = LaurentPolynomialRing(IntegerRing(), variab) q = R.gens()[0] t = R.gens()[1] if not braid: - return identity_matrix(R, len(l), sparse=True) - A = matrix(R, len(l), sparse=True) + return identity_matrix(R, len(n2), sparse=True) + A = matrix(R, len(n2), sparse=True) if braid[0] > 0: i = braid[0]-1 - for m in range(len(l)): - j = min(l[m]) - k = max(l[m]) + for m in range(len(n2)): + j = min(n2[m]) + k = max(n2[m]) if i == j-1: - A[l.index(Set([i, k])), m] = q - A[l.index(Set([i, j])), m] = q*q-q - A[l.index(Set([j, k])), m] = 1-q + A[n2.index(Set([i, k])), m] = q + A[n2.index(Set([i, j])), m] = q*q-q + A[n2.index(Set([j, k])), m] = 1-q elif i == j and not j == k-1: - A[l.index(Set([j, k])), m] = 0 - A[l.index(Set([j+1, k])), m] = 1 + A[n2.index(Set([j, k])), m] = 0 + A[n2.index(Set([j+1, k])), m] = 1 elif k-1 == i and not k-1 == j: - A[l.index(Set([j, i])), m] = q - A[l.index(Set([j, k])), m] = 1-q - A[l.index(Set([i, k])), m] = (1-q)*q*t + A[n2.index(Set([j, i])), m] = q + A[n2.index(Set([j, k])), m] = 1-q + A[n2.index(Set([i, k])), m] = (1-q)*q*t elif i == k: - A[l.index(Set([j, k])), m] = 0 - A[l.index(Set([j, k+1])), m] = 1 + A[n2.index(Set([j, k])), m] = 0 + A[n2.index(Set([j, k+1])), m] = 1 elif i == j and j == k-1: - A[l.index(Set([j, k])), m] = -t*q*q + A[n2.index(Set([j, k])), m] = -t*q*q else: - A[l.index(Set([j, k])), m] = 1 + A[n2.index(Set([j, k])), m] = 1 return A else: i = -braid[0]-1 - for m in range(len(l)): - j = min(l[m]) - k = max(l[m]) + for m in range(len(n2)): + j = min(n2[m]) + k = max(n2[m]) if i == j-1: - A[l.index(Set([j-1, k])), m] = 1 + A[n2.index(Set([j-1, k])), m] = 1 elif i == j and not j == k-1: - A[l.index(Set([j+1, k])), m] = q**(-1) - A[l.index(Set([j, k])), m] = 1-q**(-1) - A[l.index(Set([j, j+1])), m] = t**(-1)*q**(-1)-t**(-1)*q**(-2) + A[n2.index(Set([j+1, k])), m] = q**(-1) + A[n2.index(Set([j, k])), m] = 1-q**(-1) + A[n2.index(Set([j, j+1])), m] = t**(-1)*q**(-1)-t**(-1)*q**(-2) elif k-1 == i and not k-1 == j: - A[l.index(Set([j, k-1])), m] = 1 + A[n2.index(Set([j, k-1])), m] = 1 elif i == k: - A[l.index(Set([j, k+1])), m] = q**(-1) - A[l.index(Set([j, k])), m] = 1-q**(-1) - A[l.index(Set([k, k+1])), m] = -q**(-1)+q**(-2) + A[n2.index(Set([j, k+1])), m] = q**(-1) + A[n2.index(Set([j, k])), m] = 1-q**(-1) + A[n2.index(Set([k, k+1])), m] = -q**(-1)+q**(-2) elif i == j and j == k-1: - A[l.index(Set([j, k])), m] = -t**(-1)*q**(-2) + A[n2.index(Set([j, k])), m] = -t**(-1)*q**(-2) else: - A[l.index(Set([j, k])), m] = 1 + A[n2.index(Set([j, k])), m] = 1 return A def dimension_of_TL_space(self, drain_size): @@ -3422,7 +3422,7 @@ def mirror_involution(self): def presentation2gens(self, isomorphisms=False): """ - Construct an isomorphic group to ``gens`` with only two generators + Construct an isomorphic group to ``self``, braid group, with only two generators INPUT: @@ -3497,7 +3497,7 @@ def epimorphisms(self, H): Gg = libgap(G) Hg = libgap(H) gquotients = Gg.GQuotients(Hg) - hom1g = libgap.GroupHomomorphismByImagesNC(G0g,Gg,[libgap(hom1(u)) for u in self.gens()]) + hom1g = libgap.GroupHomomorphismByImagesNC(G0g, Gg, [libgap(hom1(u)) for u in self.gens()]) g0quotients = [hom1g * h for h in gquotients] res = [] # the following closure is needed to attach a specific value of quo to @@ -3509,6 +3509,7 @@ def epimorphisms(self, H): res.append(fhom) return res + def BraidGroup(n=None, names='s'): """ Construct a Braid Group @@ -3518,7 +3519,7 @@ def BraidGroup(n=None, names='s'): - ``n`` -- integer or ``None`` (default). The number of strands. If not specified the ``names`` are counted and the group is assumed to have one more strand than generators. - ++ - ``names`` -- string or list/tuple/iterable of strings (default: ``'x'``). The generator names or name prefix. @@ -3637,6 +3638,7 @@ class group of the punctured disk. sage: A(x1^-1, s1) x1*x2^-1*x1^-1 """ + def __init__(self, G, M): """ TESTS:: From ab331d90e0588c7d3caad8af87825f35198819d1 Mon Sep 17 00:00:00 2001 From: Enrique Manuel Artal Bartolo Date: Thu, 27 Jul 2023 09:15:51 +0200 Subject: [PATCH 016/423] Update src/sage/groups/artin.py Co-authored-by: Travis Scrimshaw --- src/sage/groups/artin.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/sage/groups/artin.py b/src/sage/groups/artin.py index 2a1178914ab..c0eb903379a 100644 --- a/src/sage/groups/artin.py +++ b/src/sage/groups/artin.py @@ -106,9 +106,7 @@ def coxeter_group_element(self, W=None): INPUT: - - W -- (default: ``None``) It may be ``G = SymmetricGroup(n)`` if ``self.parent()`` - is either an Artin group of type ``['A', n-1]`` or ``BraidGroup(n)`` to obtain an - element of ``G`` instead a ``Standard Permutation``. + - ``W`` -- (default: ``self.parent().coxeter_group()``) the image Coxeter group OUTPUT: From 4c8375598c74858ab9b8dfe154283f58f22da4e3 Mon Sep 17 00:00:00 2001 From: Enrique Manuel Artal Bartolo Date: Thu, 27 Jul 2023 09:18:50 +0200 Subject: [PATCH 017/423] Update src/sage/groups/artin.py Co-authored-by: Travis Scrimshaw --- src/sage/groups/artin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/groups/artin.py b/src/sage/groups/artin.py index c0eb903379a..065c51eaa78 100644 --- a/src/sage/groups/artin.py +++ b/src/sage/groups/artin.py @@ -138,7 +138,7 @@ def coxeter_group_element(self, W=None): (1,4,3,2) From an element of the Coxeter group it is possible to recover - the image by the standard section to the Artin group. + the image by the standard section to the Artin group:: sage: B(b1) s1*s2*s3*s2 From 0807d57efc6e3c2630916e3e06c7771a6f98ae73 Mon Sep 17 00:00:00 2001 From: Enrique Manuel Artal Bartolo Date: Thu, 27 Jul 2023 09:30:31 +0200 Subject: [PATCH 018/423] Update src/sage/groups/braid.py Co-authored-by: Travis Scrimshaw --- src/sage/groups/braid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index 823f6849448..dbbf8d5f1de 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -459,7 +459,7 @@ def permutation(self, W=None): sage: c1 == b.permutation() True - From a permutation it is also possible to recover the permutation braid. + From a permutation it is also possible to recover the permutation braid:: sage: B(c0) s0*s1*s2*s1 From 80e2c3e4e63ade88eb146773c6dc871455927d4e Mon Sep 17 00:00:00 2001 From: Enrique Manuel Artal Bartolo Date: Thu, 27 Jul 2023 09:32:35 +0200 Subject: [PATCH 019/423] Update src/sage/groups/braid.py Co-authored-by: Travis Scrimshaw --- src/sage/groups/braid.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index dbbf8d5f1de..11eb5283879 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -3420,9 +3420,9 @@ def mirror_involution(self): gens_mirr = [~g for g in self.gens()] return self.hom(gens_mirr, check=False) - def presentation2gens(self, isomorphisms=False): - """ - Construct an isomorphic group to ``self``, braid group, with only two generators + def presentation_two_generators(self, isomorphisms=False): + r""" + Construct a finitely presented group isomorphic to ``self`` with only two generators. INPUT: From d08bc14982bbf5e3d6106e34c6f9503dcd027244 Mon Sep 17 00:00:00 2001 From: Enrique Artal Date: Thu, 27 Jul 2023 10:46:29 +0200 Subject: [PATCH 020/423] changes from the review --- src/sage/groups/artin.py | 8 +++---- src/sage/groups/braid.py | 47 +++++++++++++++++++--------------------- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/sage/groups/artin.py b/src/sage/groups/artin.py index 065c51eaa78..9f3bccaf0a0 100644 --- a/src/sage/groups/artin.py +++ b/src/sage/groups/artin.py @@ -110,7 +110,7 @@ def coxeter_group_element(self, W=None): OUTPUT: - An element of the Coxeter group or an element of a symmetric group. + An element of the Coxeter group ``W``. EXAMPLES:: @@ -468,9 +468,9 @@ def __init__(self, coxeter_matrix, names): free_group = FreeGroup(names) rels = [] # Generate the relations based on the Coxeter graph - In = coxeter_matrix.index_set() - for ii, i in enumerate(In): - for j in In[ii+1:]: + I = coxeter_matrix.index_set() + for ii, i in enumerate(I): + for j in I[ii + 1:]: m = coxeter_matrix[i, j] if m == Infinity: # no relation continue diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index 11eb5283879..26315341bf3 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -444,8 +444,7 @@ def permutation(self, W=None): OUTPUT: - The image of ``self`` under the natural projection map to ``W`` - as either a standard permutation or an element of a symmetric group. + The image of ``self`` under the natural projection map to ``W``. EXAMPLES:: @@ -1335,8 +1334,6 @@ def _annular_khovanov_complex_cached(self, qagrad, ring=None): sage: B = BraidGroup(3) sage: B([1,2,1,2])._annular_khovanov_complex_cached((5,-1)).homology() {1: Z, 2: Z, 3: 0} - - """ from sage.homology.chain_complex import ChainComplex if ring is None: @@ -2123,18 +2120,19 @@ def deformed_burau_matrix(self, variab='q'): """ R = LaurentPolynomialRing(IntegerRing(), variab) n = self.strands() - m = len(self.Tietze()) + tz = self.Tietze() + m = len(tz) from sage.algebras.free_algebra import FreeAlgebra alg = FreeAlgebra(R, m*3, - [f'{s}p_{i}' for i in range(m) if self.Tietze()[i] > 0 + [f'{s}p_{i}' for i in range(m) if tz[i] > 0 for s in 'bca'] - + [f'{s}m_{i}' for i in range(m) if self.Tietze()[i] < 0 + + [f'{s}m_{i}' for i in range(m) if tz[i] < 0 for s in 'bca']) - gen_indices = ([i for i in range(m) if self.Tietze()[i] > 0] - + [i for i in range(m) if self.Tietze()[i] < 0]) + gen_indices = ([i for i in range(m) if tz[i] > 0] + + [i for i in range(m) if tz[i] < 0]) M = identity_matrix(alg, n) - for k, i in enumerate(self.Tietze()): + for k, i in enumerate(tz): A = identity_matrix(alg, n) gen_index = gen_indices.index(k) b, c, a = alg.gens()[3*gen_index:3*gen_index+3] @@ -2293,7 +2291,6 @@ class RightQuantumWord: q*cp_1*ap_1 + q^2*bp_1*cm_0*am_0*bm_2 reduced from ap_1*cp_1 + q^3*bm_2*bp_1*am_0*cm_0 """ - def __init__(self, words): r""" Initialize ``self``. @@ -2828,7 +2825,7 @@ def _links_gould_representation(self, symbolics=False): LR = LaurentPolynomialRing(ZZ, 's0r, s1r') PR = PolynomialRing(LR, 'Yr') s0r, s1r, Yr = PR.gens_dict_recursive().values() - pqr = Yr**2 + (s0r**2-1)*(s1r**2 - 1) + pqr = Yr**2 + (s0r**2 - 1) * (s1r**2 - 1) BR = PR.quotient_ring(pqr) s0 = BR(s0r) s1 = BR(s1r) @@ -2932,7 +2929,7 @@ def _LKB_matrix_(self, braid, variab): return identity_matrix(R, len(n2), sparse=True) A = matrix(R, len(n2), sparse=True) if braid[0] > 0: - i = braid[0]-1 + i = braid[0] - 1 for m in range(len(n2)): j = min(n2[m]) k = max(n2[m]) @@ -3426,16 +3423,16 @@ def presentation_two_generators(self, isomorphisms=False): INPUT: - - ``isomorphism`` -- boolean (default ``False``). If ``True`` an isomorphism - from ``self`` and the isomorphic group and its inverse are provided + - ``isomorphism`` -- boolean (default ``False``); if ``True``, then an isomorphism + from ``self`` and the isomorphic group and its inverse is also returned EXAMPLES: sage: B = BraidGroup(3) - sage: B.presentation2gens() + sage: B.presentation_two_generators() Finitely presented group < x0, x1 | x1^3*x0^-2 > sage: B = BraidGroup(4) - sage: G, hom1, hom2 = B.presentation2gens(isomorphisms=True) + sage: G, hom1, hom2 = B.presentation_two_generators(isomorphisms=True) sage: G Finitely presented group < x0, x1 | x1^4*x0^-3, x0*x1*x0*x1^-2*x0^-1*x1^3*x0^-1*x1^-2 > sage: hom1(B.gen(0)) @@ -3468,11 +3465,12 @@ def presentation_two_generators(self, isomorphisms=False): def epimorphisms(self, H): r""" Return the epimorphisms from ``self`` to ``H``, up to automorphism of `H` passing - through the presentation of two gens for ``self`` + through the :meth:`two generator presentation + ` of ``self``. INPUT: - - `H` -- Another group + - `H` -- another group EXAMPLES:: @@ -3482,15 +3480,15 @@ def epimorphisms(self, H): From: Braid group on 5 strands To: Symmetric group of order 5! as a permutation group Defn: s0 |--> (1,5) - s1 |--> (4,5) - s2 |--> (3,4) - s3 |--> (2,3)] + s1 |--> (4,5) + s2 |--> (3,4) + s3 |--> (2,3)] ALGORITHM: Uses libgap's GQuotients function. """ - G, hom1, hom2 = self.presentation2gens(isomorphisms=True) + G, hom1, hom2 = self.presentation_two_generators(isomorphisms=True) from sage.misc.misc_c import prod HomSpace = self.Hom(H) G0g = libgap(self) @@ -3519,7 +3517,7 @@ def BraidGroup(n=None, names='s'): - ``n`` -- integer or ``None`` (default). The number of strands. If not specified the ``names`` are counted and the group is assumed to have one more strand than generators. -+ + - ``names`` -- string or list/tuple/iterable of strings (default: ``'x'``). The generator names or name prefix. @@ -3638,7 +3636,6 @@ class group of the punctured disk. sage: A(x1^-1, s1) x1*x2^-1*x1^-1 """ - def __init__(self, G, M): """ TESTS:: From 5e8d22a97ec4ff4e2a4ef565cb0c7605465d7e86 Mon Sep 17 00:00:00 2001 From: Enrique Artal Date: Thu, 27 Jul 2023 10:53:15 +0200 Subject: [PATCH 021/423] use combinations from itertools --- src/sage/groups/braid.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index 26315341bf3..e08ba9e7f91 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -67,6 +67,7 @@ # https://www.gnu.org/licenses/ ############################################################################## +from itertools import combinations from sage.categories.action import Action from sage.categories.groups import Groups from sage.combinat.permutation import Permutation @@ -2921,7 +2922,7 @@ def _LKB_matrix_(self, braid, variab): for i in braid[1:]: A = A*self._LKB_matrix_((i,), variab) return A - n2 = list(Set(range(n)).subsets(2)) + n2 = [set(X) for X in combinations(range(n), 2)] R = LaurentPolynomialRing(IntegerRing(), variab) q = R.gens()[0] t = R.gens()[1] From d88bc3815c0901bfdeaa3e4a31107c084199f614 Mon Sep 17 00:00:00 2001 From: Antonio Rojas Date: Mon, 31 Jul 2023 08:37:36 +0200 Subject: [PATCH 022/423] Fix tests with gmp 6.3 --- src/sage/ext/memory.pyx | 12 ++++++------ src/sage/rings/integer.pyx | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sage/ext/memory.pyx b/src/sage/ext/memory.pyx index 1de6dedab82..c5b16168d04 100644 --- a/src/sage/ext/memory.pyx +++ b/src/sage/ext/memory.pyx @@ -3,14 +3,14 @@ Low-level memory allocation functions TESTS: -Check that a ``MemoryError`` is raised if we try to allocate a +Check that an error is raised if we try to allocate a ridiculously large integer, see :trac:`15363`:: - sage: 2^(2^63-3) - Traceback (most recent call last): - ... - OverflowError: exponent must be at most 2147483647 # 32-bit - RuntimeError: Aborted # 64-bit + sage: try: + ....: 2^(2^63-3) + ....: except (OverflowError, RuntimeError, FloatingPointError): + ....: print ('Overflow error') + Overflow error AUTHORS: diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index 2cd080ddafa..090ab59cb28 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -6654,7 +6654,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): sage: try: ....: print('Possible error output from gmp', flush=True) ....: 1 << (2^60) - ....: except (MemoryError, OverflowError, RuntimeError): + ....: except (MemoryError, OverflowError, RuntimeError, FloatingPointError): ....: pass ....: else: ....: print("Failed to raise exception") From b86f00f3cfe2aca5c260ed0b7b6210584b11973c Mon Sep 17 00:00:00 2001 From: dcoudert Date: Wed, 2 Aug 2023 15:45:45 +0200 Subject: [PATCH 023/423] some care in src/sage/graphs/planarity.pyx --- src/sage/graphs/planarity.pyx | 83 ++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/src/sage/graphs/planarity.pyx b/src/sage/graphs/planarity.pyx index 839039a2bde..588f60ab176 100644 --- a/src/sage/graphs/planarity.pyx +++ b/src/sage/graphs/planarity.pyx @@ -72,17 +72,19 @@ def is_planar(g, kuratowski=False, set_pos=False, set_embedding=False, circular= vertices. In fact, to try to track down a segfault, we do it twice. :: - sage: import networkx.generators.atlas # long time # optional - networkx - sage: atlas_graphs = [Graph(i) for i in networkx.generators.atlas.graph_atlas_g()] # long time # optional - networkx - sage: a = [i for i in [1..1252] if atlas_graphs[i].is_planar()] # long time # optional - networkx - sage: b = [i for i in [1..1252] if atlas_graphs[i].is_planar()] # long time # optional - networkx - sage: a == b # long time # optional - networkx + sage: # long time, needs networkx + sage: import networkx.generators.atlas + sage: atlas_graphs = [Graph(i) for i in networkx.generators.atlas.graph_atlas_g()] + sage: a = [i for i in [1..1252] if atlas_graphs[i].is_planar()] + sage: b = [i for i in [1..1252] if atlas_graphs[i].is_planar()] + sage: a == b True There were some problems with ``set_pos`` stability in the past, so let's check if this runs without exception:: - sage: for i, g in enumerate(atlas_graphs): # long time # optional - networkx + sage: # long time, needs networkx + sage: for i, g in enumerate(atlas_graphs): ....: if (not g.is_connected() or i == 0): ....: continue ....: _ = g.is_planar(set_embedding=True, set_pos=True) @@ -116,16 +118,15 @@ def is_planar(g, kuratowski=False, set_pos=False, set_embedding=False, circular= if set_embedding: g._embedding = {u: [v], v: [u]} if set_pos: - g._pos = {u: [0, 0], v: [0, 1]} + g._pos = {u: (0, 0), v: (0, 1)} return (True, None) if kuratowski else True # Create to and from mappings to relabel vertices to the set {1,...,n} # (planarity 3 uses 1-based array indexing, with 0 representing NIL) cdef int i cdef list listto = list(g) - cdef dict ffrom = {vvv: i + 1 for i, vvv in enumerate(listto)} - cdef dict to = {i + 1: vvv for i, vvv in enumerate(listto)} - g.relabel(ffrom) + cdef dict ffrom = {vvv: i for i, vvv in enumerate(listto, start=1)} + cdef dict to = {i: vvv for i, vvv in enumerate(listto, start=1)} cdef graphP theGraph theGraph = gp_New() @@ -134,7 +135,7 @@ def is_planar(g, kuratowski=False, set_pos=False, set_embedding=False, circular= if status != OK: raise RuntimeError("gp_InitGraph status is not ok") for u, v in g.edge_iterator(labels=False): - status = gp_AddEdge(theGraph, u, 0, v, 0) + status = gp_AddEdge(theGraph, ffrom[u], 0, ffrom[v], 0) if status == NOTOK: raise RuntimeError("gp_AddEdge status is not ok") elif status == NONEMBEDDABLE: @@ -146,15 +147,16 @@ def is_planar(g, kuratowski=False, set_pos=False, set_embedding=False, circular= break status = gp_Embed(theGraph, EMBEDFLAGS_PLANAR) - gp_SortVertices(theGraph) - - # Use to and from mappings to relabel vertices back from the set {1,...,n} - g.relabel(to) if status == NOTOK: raise RuntimeError("status is not ok") - elif status == NONEMBEDDABLE: + + gp_SortVertices(theGraph) + + if status == NONEMBEDDABLE: # Kuratowski subgraph isolator + if not kuratowski: + return False g_dict = {} from sage.graphs.graph import Graph for i in range(1, theGraph.N + 1): @@ -165,29 +167,30 @@ def is_planar(g, kuratowski=False, set_pos=False, set_embedding=False, circular= j = theGraph.E[j].link[1] if linked_list: g_dict[to[i]] = linked_list - G = Graph(g_dict) gp_Free(&theGraph) - if kuratowski: - return (False, G) - else: - return False - else: - if set_pos or set_embedding: - emb_dict = {} - for i in range(1, theGraph.N + 1): - linked_list = [] - j = theGraph.V[i].link[1] - while j: - linked_list.append(to[theGraph.E[j].neighbor]) - j = theGraph.E[j].link[1] - emb_dict[to[i]] = linked_list - if set_embedding: - g._embedding = emb_dict - if set_pos: - g.layout(layout='planar', save_pos=True, on_embedding=emb_dict) + G = g.__class__(data=g_dict, weighted=g._weighted, + loops=g.allows_loops(), + multiedges=g.allows_multiple_edges(), + name="Kuratowski subgraph of (%s)" % g.name()) + if g.get_pos(): + G.set_pos({u: g._pos[u] for u in g_dict.keys()}) + return (False, G) + + if set_pos or set_embedding: + emb_dict = {} + for i in range(1, theGraph.N + 1): + linked_list = [] + j = theGraph.V[i].link[1] + while j: + linked_list.append(to[theGraph.E[j].neighbor]) + j = theGraph.E[j].link[1] + emb_dict[to[i]] = linked_list + if set_embedding: + g._embedding = emb_dict + if set_pos: + g.layout(layout='planar', save_pos=True, on_embedding=emb_dict) - gp_Free(&theGraph) - if kuratowski: - return (True, None) - else: - return True + gp_Free(&theGraph) + if kuratowski: + return (True, None) + return True From 53c9f818aecd17e8771d0be28129e42b49dc9fa4 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Wed, 2 Aug 2023 16:59:36 +0200 Subject: [PATCH 024/423] fix issue #35152 --- src/sage/graphs/generic_graph.py | 86 ++++++++++++++++++++++++-------- src/sage/graphs/planarity.pyx | 3 +- 2 files changed, 66 insertions(+), 23 deletions(-) diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index a083ed43e5e..edba5820ffd 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -5382,18 +5382,56 @@ def is_planar(self, on_embedding=None, kuratowski=False, set_embedding=False, se ... NotImplementedError: cannot compute with embeddings of multiple-edged or looped graphs + sage: G.is_planar(set_embedding=True) + Traceback (most recent call last): + ... + NotImplementedError: cannot compute with embeddings of + multiple-edged or looped graphs + sage: G.is_planar(kuratowski=True) + (True, None) sage: G.is_planar(set_pos=True) + sage: sorted(G.get_pos().items()) + [(0, [0, 0]), (1, [0, 1])] + + Digraphs with multiple edges or loops or pairs of opposite arcs are + partially supported (:trac:`35152`):: + + sage: D = digraphs.Complete(3) + sage: D.is_planar() + True + sage: D.is_planar(set_pos=True) + sage: sorted(D.get_pos().items()) + [(0, [0, 1]), (1, [1, 1]), (2, [1, 0])] + sage: D.is_planar(on_embedding={}) + Traceback (most recent call last): + ... + NotImplementedError: cannot compute with embeddings of + digraphs with pairs of opposite arcs + sage: D.is_planar(set_embedding=True) + Traceback (most recent call last): + ... + NotImplementedError: cannot compute with embeddings of + digraphs with pairs of opposite arcs + sage: D.is_planar(kuratowski=True) + (True, None) + sage: D.allow_multiple_edges(True) + sage: D.add_edges(D.edges(sort=False)) + sage: D.add_edges((u, u) for u in D) + sage: D.is_planar() + True + sage: D.is_planar(kuratowski=True) + (True, None) + sage: D.is_planar(set_pos=True) + sage: D.is_planar(set_embedding=True) Traceback (most recent call last): ... NotImplementedError: cannot compute with embeddings of multiple-edged or looped graphs - sage: G.is_planar(set_embedding=True) + sage: D.is_planar(on_embedding={}) Traceback (most recent call last): ... NotImplementedError: cannot compute with embeddings of multiple-edged or looped graphs - sage: G.is_planar(kuratowski=True) - (True, None) :: @@ -5454,31 +5492,35 @@ def is_planar(self, on_embedding=None, kuratowski=False, set_embedding=False, se if self.order() > 4 and self.size() > 3 * self.order() - 6: return False - if self.has_multiple_edges() or self.has_loops(): - if set_embedding or (on_embedding is not None) or set_pos: + if set_embedding or (on_embedding is not None): + # So far, working with embeddings is not working properly when a + # (di)graph has multiple edges or loops, or when a digraph has pairs + # of opposite arcs + if self.has_multiple_edges() or self.has_loops(): raise NotImplementedError("cannot compute with embeddings of multiple-edged or looped graphs") - else: - return self.to_simple().is_planar(kuratowski=kuratowski) + elif (self.is_directed() and + any(self.has_edge(v, u) for u, v in self.edge_iterator(labels=False))): + raise NotImplementedError("cannot compute with embeddings of digraphs with pairs of opposite arcs") if on_embedding is not None: self._check_embedding_validity(on_embedding, boolean=False) return (0 == self.genus(minimal=False, set_embedding=False, on_embedding=on_embedding)) + + # We take the underlying undirected and simple graph + G = self.to_simple(to_undirected=True, immutable=False) + # And check if it is planar + from sage.graphs.planarity import is_planar + planar = is_planar(G, kuratowski=kuratowski, set_pos=set_pos, set_embedding=set_embedding) + if kuratowski: + bool_result = planar[0] else: - from sage.graphs.planarity import is_planar - G = self.to_undirected() - if hasattr(G, '_immutable'): - G = copy(G) - planar = is_planar(G, kuratowski=kuratowski, set_pos=set_pos, set_embedding=set_embedding) - if kuratowski: - bool_result = planar[0] - else: - bool_result = planar - if bool_result: - if set_pos: - self._pos = G._pos - if set_embedding: - self._embedding = G._embedding - return planar + bool_result = planar + if bool_result: + if set_pos: + self._pos = G._pos + if set_embedding: + self._embedding = G._embedding + return planar def is_circular_planar(self, on_embedding=None, kuratowski=False, set_embedding=True, boundary=None, diff --git a/src/sage/graphs/planarity.pyx b/src/sage/graphs/planarity.pyx index 588f60ab176..743ae79a978 100644 --- a/src/sage/graphs/planarity.pyx +++ b/src/sage/graphs/planarity.pyx @@ -99,6 +99,7 @@ def is_planar(g, kuratowski=False, set_pos=False, set_embedding=False, circular= ....: assert (hasattr(G, '_pos') and G._pos is not None) == set_pos, (set_embedding, set_pos) """ + g._scream_if_not_simple() if circular is not None: from sage.misc.superseded import deprecation deprecation(33759, 'the circular argument of is_planar is deprecated and has no effect') @@ -118,7 +119,7 @@ def is_planar(g, kuratowski=False, set_pos=False, set_embedding=False, circular= if set_embedding: g._embedding = {u: [v], v: [u]} if set_pos: - g._pos = {u: (0, 0), v: (0, 1)} + g._pos = {u: [0, 0], v: [0, 1]} return (True, None) if kuratowski else True # Create to and from mappings to relabel vertices to the set {1,...,n} From 5ffa61b82549c1183b0db1c78b27c670fd836f6d Mon Sep 17 00:00:00 2001 From: dcoudert Date: Thu, 3 Aug 2023 16:58:03 +0200 Subject: [PATCH 025/423] PR 36021: avoid conflict with # 36026 --- src/sage/graphs/planarity.pyx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/sage/graphs/planarity.pyx b/src/sage/graphs/planarity.pyx index 743ae79a978..f14891e2314 100644 --- a/src/sage/graphs/planarity.pyx +++ b/src/sage/graphs/planarity.pyx @@ -72,19 +72,17 @@ def is_planar(g, kuratowski=False, set_pos=False, set_embedding=False, circular= vertices. In fact, to try to track down a segfault, we do it twice. :: - sage: # long time, needs networkx - sage: import networkx.generators.atlas - sage: atlas_graphs = [Graph(i) for i in networkx.generators.atlas.graph_atlas_g()] - sage: a = [i for i in [1..1252] if atlas_graphs[i].is_planar()] - sage: b = [i for i in [1..1252] if atlas_graphs[i].is_planar()] - sage: a == b + sage: import networkx.generators.atlas # long time # optional - networkx + sage: atlas_graphs = [Graph(i) for i in networkx.generators.atlas.graph_atlas_g()] # long time # optional - networkx + sage: a = [i for i in [1..1252] if atlas_graphs[i].is_planar()] # long time # optional - networkx + sage: b = [i for i in [1..1252] if atlas_graphs[i].is_planar()] # long time # optional - networkx + sage: a == b # long time # optional - networkx True There were some problems with ``set_pos`` stability in the past, so let's check if this runs without exception:: - sage: # long time, needs networkx - sage: for i, g in enumerate(atlas_graphs): + sage: for i, g in enumerate(atlas_graphs): # long time # optional - networkx ....: if (not g.is_connected() or i == 0): ....: continue ....: _ = g.is_planar(set_embedding=True, set_pos=True) From eea1b1a0ec1b4f6d53f820c9ea6f2923f7afeedf Mon Sep 17 00:00:00 2001 From: dcoudert Date: Mon, 14 Aug 2023 14:03:54 +0200 Subject: [PATCH 026/423] PR #36021: fix doctests in generic_graph.py --- src/sage/graphs/generic_graph.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 0fa13868394..574ddd8b5ab 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -5399,7 +5399,8 @@ def is_planar(self, on_embedding=None, kuratowski=False, set_embedding=False, se sage: k43 = graphs.CompleteBipartiteGraph(4, 3) sage: result = k43.is_planar(kuratowski=True); result - (False, Graph on 6 vertices) + (False, + Kuratowski subgraph of (Complete bipartite graph of order 4+3): Graph on 6 vertices) sage: result[1].is_isomorphic(graphs.CompleteBipartiteGraph(3, 3)) True @@ -5421,6 +5422,7 @@ def is_planar(self, on_embedding=None, kuratowski=False, set_embedding=False, se sage: G.is_planar(kuratowski=True) (True, None) sage: G.is_planar(set_pos=True) + True sage: sorted(G.get_pos().items()) [(0, [0, 0]), (1, [0, 1])] @@ -5431,6 +5433,7 @@ def is_planar(self, on_embedding=None, kuratowski=False, set_embedding=False, se sage: D.is_planar() True sage: D.is_planar(set_pos=True) + True sage: sorted(D.get_pos().items()) [(0, [0, 1]), (1, [1, 1]), (2, [1, 0])] sage: D.is_planar(on_embedding={}) @@ -5447,12 +5450,14 @@ def is_planar(self, on_embedding=None, kuratowski=False, set_embedding=False, se (True, None) sage: D.allow_multiple_edges(True) sage: D.add_edges(D.edges(sort=False)) + sage: D.allow_loops(True) sage: D.add_edges((u, u) for u in D) sage: D.is_planar() True sage: D.is_planar(kuratowski=True) (True, None) sage: D.is_planar(set_pos=True) + True sage: D.is_planar(set_embedding=True) Traceback (most recent call last): ... @@ -5633,7 +5638,7 @@ def is_circular_planar(self, on_embedding=None, kuratowski=False, sage: g439.is_circular_planar(boundary=[1, 2, 3, 4]) False sage: g439.is_circular_planar(kuratowski=True, boundary=[1, 2, 3, 4]) - (False, Graph on 8 vertices) + (False, Kuratowski subgraph of (): Graph on 8 vertices) sage: g439.is_circular_planar(kuratowski=True, boundary=[1, 2, 3]) (True, None) sage: g439.get_embedding() From 41deb4edc6489b338a0d1b9f44fe5c654178b175 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Mon, 14 Aug 2023 14:05:14 +0200 Subject: [PATCH 027/423] PR #36021: fix doctest warning in sage/graphs/generators/smallgraphs.py --- src/sage/graphs/generators/smallgraphs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/graphs/generators/smallgraphs.py b/src/sage/graphs/generators/smallgraphs.py index bb73e4c487e..a090eb3f73d 100644 --- a/src/sage/graphs/generators/smallgraphs.py +++ b/src/sage/graphs/generators/smallgraphs.py @@ -912,7 +912,7 @@ def Balaban11Cage(embedding=1): sage: g3 = graphs.Balaban11Cage(embedding=3) # needs networkx sage: g1.show(figsize=[10,10]) # long time # needs sage.plot sage: g2.show(figsize=[10,10]) # long time # needs networkx sage.plot - sage: g3.show(figsize=[10,10]) # long time # needs sage.plot + sage: g3.show(figsize=[10,10]) # long time # needs networkx sage.plot Proof that the embeddings are the same graph:: From df02347e3a328d2fbfb58ed350e78a40d2755b2c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 27 Jun 2023 17:28:22 -0700 Subject: [PATCH 028/423] sage.schemes: ./sage -fixdoctests --long --distribution 'sagemath-modules' --only-tags --probe=sage.rings.finite_rings --overwrite src/sage/schemes/{generic,affine,*projective}/*.py --- src/sage/schemes/affine/affine_homset.py | 4 +- src/sage/schemes/affine/affine_morphism.py | 32 ++--- src/sage/schemes/affine/affine_point.py | 24 ++-- .../schemes/affine/affine_rational_point.py | 22 +-- src/sage/schemes/affine/affine_space.py | 52 +++---- src/sage/schemes/affine/affine_subscheme.py | 8 +- src/sage/schemes/generic/algebraic_scheme.py | 106 +++++++------- src/sage/schemes/generic/ambient_space.py | 14 +- src/sage/schemes/generic/divisor_group.py | 22 +-- src/sage/schemes/generic/homset.py | 12 +- src/sage/schemes/generic/morphism.py | 12 +- src/sage/schemes/generic/scheme.py | 14 +- src/sage/schemes/generic/spec.py | 10 +- src/sage/schemes/product_projective/homset.py | 4 +- src/sage/schemes/product_projective/point.py | 52 +++---- .../product_projective/rational_point.py | 16 +-- src/sage/schemes/product_projective/space.py | 68 ++++----- .../schemes/product_projective/subscheme.py | 12 +- .../schemes/projective/projective_homset.py | 6 +- .../schemes/projective/projective_morphism.py | 66 ++++----- .../schemes/projective/projective_point.py | 52 +++---- .../projective/projective_rational_point.py | 18 +-- .../schemes/projective/projective_space.py | 130 +++++++++--------- .../projective/projective_subscheme.py | 42 +++--- 24 files changed, 397 insertions(+), 401 deletions(-) diff --git a/src/sage/schemes/affine/affine_homset.py b/src/sage/schemes/affine/affine_homset.py index 8c70602ad79..4b7a3547361 100644 --- a/src/sage/schemes/affine/affine_homset.py +++ b/src/sage/schemes/affine/affine_homset.py @@ -211,8 +211,8 @@ def points(self, **kwds): EXAMPLES: The bug reported at #11526 is fixed:: sage: A2 = AffineSpace(ZZ, 2) - sage: F = GF(3) # optional - sage.rings.finite_rings - sage: A2(F).points() # optional - sage.rings.finite_rings + sage: F = GF(3) + sage: A2(F).points() [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)] :: diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index d16d5ec37fc..d601e12351d 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -653,10 +653,10 @@ def as_dynamical_system(self): :: - 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 + sage: A. = AffineSpace(GF(5), 1) + sage: H = End(A) + sage: f = H([x^2]) + sage: type(f.as_dynamical_system()) # optional - sage.rings.finite_rings sage.schemes :: @@ -699,7 +699,7 @@ 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.global_height() + sage: f.global_height() # optional - sage.symbolic 15.4877354584971 :: @@ -717,7 +717,7 @@ def global_height(self, prec=None): sage: A. = AffineSpace(ZZ, 1) sage: H = Hom(A, A) sage: f = H([7*x^2 + 1513]) - sage: f.global_height() + sage: f.global_height() # optional - sage.symbolic 7.32184971378836 :: @@ -726,7 +726,7 @@ def global_height(self, prec=None): sage: B. = AffineSpace(QQ, 2) sage: H = Hom(A, B) sage: f = H([1/3*x^2 + 10, 7*x^3]) - sage: f.global_height() + sage: f.global_height() # optional - sage.symbolic 3.40119738166216 :: @@ -735,7 +735,7 @@ def global_height(self, prec=None): sage: A. = AffineSpace(QQ, 1) sage: H = Hom(P, A) sage: f = H([1/1331*x^2 + 4000*y]) - sage: f.global_height() + sage: f.global_height() # optional - sage.symbolic 15.4877354584971 """ return self.homogenize(0).global_height(prec=prec) @@ -1329,18 +1329,18 @@ def _fast_eval(self, x): EXAMPLES:: - 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 + 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]) [2, 1, 2] :: - 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 + 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]) [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 e0cdab543fe..c237d376189 100644 --- a/src/sage/schemes/affine/affine_point.py +++ b/src/sage/schemes/affine/affine_point.py @@ -358,13 +358,13 @@ def intersection_multiplicity(self, X): EXAMPLES:: - 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: 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) # optional - sage.rings.finite_rings 2 - sage: Q2 = X([4,6]) # optional - sage.rings.finite_rings + sage: Q2 = X([4,6]) sage: Q2.intersection_multiplicity(Y) # optional - sage.rings.finite_rings 1 @@ -419,21 +419,21 @@ def __hash__(self): EXAMPLES:: - sage: P. = AffineSpace(GF(5), 3) # optional - sage.rings.finite_rings - sage: hash(P(2, 1, 2)) # optional - sage.rings.finite_rings + sage: P. = AffineSpace(GF(5), 3) + sage: hash(P(2, 1, 2)) 57 :: - 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 + sage: P. = AffineSpace(GF(7), 3) + sage: X = P.subscheme(x^2 - y^2) + sage: hash(X(1, 1, 2)) 106 :: - sage: P. = AffineSpace(GF(13), 2) # optional - sage.rings.finite_rings - sage: hash(P(3, 4)) # optional - sage.rings.finite_rings + sage: P. = AffineSpace(GF(13), 2) + sage: hash(P(3, 4)) 55 :: diff --git a/src/sage/schemes/affine/affine_rational_point.py b/src/sage/schemes/affine/affine_rational_point.py index 91ec84ffeab..271864fe2af 100644 --- a/src/sage/schemes/affine/affine_rational_point.py +++ b/src/sage/schemes/affine/affine_rational_point.py @@ -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)) # optional - sage.rings.finite_rings - sage: enum_affine_finite_field(A(GF(2))) # optional - sage.rings.finite_rings + sage: A. = AffineSpace(4, GF(2)) + sage: enum_affine_finite_field(A(GF(2))) [(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), @@ -250,13 +250,13 @@ def enum_affine_finite_field(X): EXAMPLES:: sage: from sage.schemes.affine.affine_rational_point import enum_affine_finite_field - 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: 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: 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 + sage: C = A.subscheme([w^2 + x + 4, y*z*x - 6]) + sage: enum_affine_finite_field(C(F)) [(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), @@ -269,9 +269,9 @@ def enum_affine_finite_field(X): :: - 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)) + sage: S = A.subscheme(x + y) + sage: enum_affine_finite_field(S) [(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 2c8ebf0f39a..87f63d3cedf 100644 --- a/src/sage/schemes/affine/affine_space.py +++ b/src/sage/schemes/affine/affine_space.py @@ -77,7 +77,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) # optional - sage.rings.finite_rings + sage: AffineSpace(5, names='x')/GF(17) Affine Space of dimension 5 over Finite Field of size 17 The default base ring is `\ZZ`:: @@ -87,10 +87,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'] # optional - sage.rings.finite_rings - sage: A = AffineSpace(R); A # optional - sage.rings.finite_rings + sage: R = GF(7)['x, y, z'] + sage: A = AffineSpace(R); A Affine Space of dimension 3 over Finite Field of size 7 - sage: A.coordinate_ring() is R # optional - sage.rings.finite_rings + sage: A.coordinate_ring() is R True TESTS:: @@ -205,15 +205,15 @@ def __iter__(self): EXAMPLES:: - 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: FF = FiniteField(3) + sage: AA = AffineSpace(FF, 0) + 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 + sage: AA = AffineSpace(FF, 1, 'Z') + sage: [ x for x in AA ] [(0), (1), (2)] - sage: AA. = AffineSpace(FF, 2) # optional - sage.rings.finite_rings - sage: [ x for x in AA ] # optional - sage.rings.finite_rings + sage: AA. = AffineSpace(FF, 2) + sage: [ x for x in AA ] [(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)) # optional - sage.rings.finite_rings - sage: A.rational_points() # optional - sage.rings.finite_rings + sage: A = AffineSpace(1, GF(3)) + sage: A.rational_points() [(0), (1), (2)] 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)) # optional - sage.rings.finite_rings + sage: AffineSpace(2, ZZ).rational_points(GF(2)) [(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) # optional - sage.rings.finite_rings + sage: AffineSpace(1, GF(3)).rational_points(ZZ) Traceback (most recent call last): ... TypeError: second argument (= Integer Ring) must be a finite field @@ -633,7 +633,7 @@ 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)) # optional - sage.rings.finite_rings + sage: AQ.change_ring(GF(5)) Affine Space of dimension 3 over Finite Field of size 5 :: @@ -983,9 +983,9 @@ def _point(self, *args, **kwds): TESTS:: - 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 + sage: P2. = AffineSpace(3, GF(3)) + sage: point_homset = P2._point_homset(Spec(GF(3)), P2) + sage: P2._point(point_homset, [1, 2, 3]) (1, 2, 0) """ return SchemeMorphism_point_affine_field(*args, **kwds) @@ -998,8 +998,8 @@ def _morphism(self, *args, **kwds): TESTS:: - 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 + sage: P2. = AffineSpace(3, GF(3)) + sage: P2._morphism(P2.Hom(P2), [x, y, z]) 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) @@ -1236,9 +1236,9 @@ def _point(self, *args, **kwds): TESTS:: - 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 + sage: P2. = AffineSpace(3, GF(3)) + sage: point_homset = P2._point_homset(Spec(GF(3)), P2) + sage: P2._point(point_homset, [1, 2, 3]) (1, 2, 0) """ return SchemeMorphism_point_affine_finite_field(*args, **kwds) @@ -1251,8 +1251,8 @@ def _morphism(self, *args, **kwds): TESTS:: - 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 + sage: P2. = AffineSpace(3, GF(3)) + sage: P2._morphism(P2.Hom(P2), [x, y, z]) 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 a5a1c661c74..889dfcef084 100644 --- a/src/sage/schemes/affine/affine_subscheme.py +++ b/src/sage/schemes/affine/affine_subscheme.py @@ -454,10 +454,10 @@ def multiplicity(self, P): :: - 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 + sage: A. = AffineSpace(GF(23), 5) + 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]) + sage: C.multiplicity(Q) # optional - sage.rings.finite_rings 3 :: diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index c1434b7c5b4..706ee27fab1 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -319,9 +319,9 @@ def ambient_space(self): EXAMPLES:: - 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 + sage: A. = AffineSpace(2, GF(5)) + sage: S = A.subscheme([]) + sage: S.ambient_space() Affine Space of dimension 2 over Finite Field of size 5 sage: P. = ProjectiveSpace(2, ZZ) @@ -429,19 +429,17 @@ def embedding_morphism(self): A couple more examples:: - sage: patch1 = P1xP1.affine_patch(1) - sage: patch1 + sage: patch1 = P1xP1.affine_patch(1); patch1 # optional - sage.geometry.polyhedron 2-d affine toric variety - sage: patch1.embedding_morphism() + sage: patch1.embedding_morphism() # optional - sage.geometry.polyhedron sage.libs.singular 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] - sage: subpatch = P1.affine_patch(1) - sage: subpatch + sage: subpatch = P1.affine_patch(1); subpatch # optional - sage.geometry.polyhedron sage.libs.singular Closed subscheme of 2-d affine toric variety defined by: -y + 1 - sage: subpatch.embedding_morphism() + sage: subpatch.embedding_morphism() # optional - sage.geometry.polyhedron sage.libs.singular Scheme morphism: From: Closed subscheme of 2-d affine toric variety defined by: -y + 1 To: Closed subscheme of 2-d CPR-Fano toric variety covered @@ -506,9 +504,9 @@ def ngens(self): EXAMPLES:: - 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 + sage: A. = AffineSpace(2, GF(5)) + sage: S = A.subscheme([]) + sage: S.ngens() 2 sage: P. = ProjectiveSpace(2, ZZ) sage: S = P.subscheme([x - y, x - z]) @@ -546,18 +544,18 @@ def _homset(self, *args, **kwds): EXAMPLES:: - sage: P1. = toric_varieties.P1() - sage: type(P1.Hom(P1)) + sage: P1. = toric_varieties.P1() # optional - sage.geometry.polyhedron + sage: type(P1.Hom(P1)) # optional - sage.geometry.polyhedron - sage: X = P1.subscheme(x - y) - sage: type(X.Hom(X)) + sage: X = P1.subscheme(x - y) # optional - sage.geometry.polyhedron + sage: type(X.Hom(X)) # optional - sage.geometry.polyhedron :: - sage: P1xP1 = toric_varieties.P1xP1() - sage: P1 = toric_varieties.P1() - sage: P1xP1._homset(P1xP1, P1) + sage: P1xP1 = toric_varieties.P1xP1() # optional - sage.geometry.polyhedron + sage: P1 = toric_varieties.P1() # optional - sage.geometry.polyhedron + sage: P1xP1._homset(P1xP1, P1) # optional - sage.geometry.polyhedron 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 @@ -778,17 +776,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)) # 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 + 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]) True - sage: U.point([2,4]) # optional - sage.rings.finite_rings + sage: U.point([2,4]) (2, 4) - sage: U._check_satisfies_equations(_) # optional - sage.rings.finite_rings + sage: U._check_satisfies_equations(_) True - sage: U._check_satisfies_equations([1, 1]) # optional - sage.rings.finite_rings + sage: U._check_satisfies_equations([1, 1]) Traceback (most recent call last): ... TypeError: Coordinates [1, 1] do not define a point on Quasi-affine @@ -797,7 +795,7 @@ def _check_satisfies_equations(self, v): x^2 - y and Y is defined by: x - y - sage: U._check_satisfies_equations([1, 0]) # optional - sage.rings.finite_rings + sage: U._check_satisfies_equations([1, 0]) Traceback (most recent call last): ... TypeError: Coordinates [1, 0] do not define a point on Quasi-affine @@ -845,11 +843,11 @@ def rational_points(self, **kwds): EXAMPLES:: - 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 + 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() [(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), @@ -998,13 +996,13 @@ def base_extend(self, R): EXAMPLES:: - 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: P. = ProjectiveSpace(2, GF(11)) + sage: S = P.subscheme([x^2 - y*z]) 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) # optional - sage.rings.finite_rings + sage: S.base_extend(ZZ) Traceback (most recent call last): ... ValueError: no natural map from the base ring (=Finite Field of size 11) @@ -1040,19 +1038,17 @@ def _latex_(self): EXAMPLES:: - 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 + sage: P. = ProjectiveSpace(2, GF(11)) + sage: S = P.subscheme([x^2 - y*z]); S # optional - sage.libs.singular Closed subscheme of Projective Space of dimension 2 over Finite Field of size 11 defined by: x^2 - y*z - sage: S._latex_() # optional - sage.rings.finite_rings + sage: S._latex_() # optional - sage.libs.singular '\\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]) # optional - sage.rings.finite_rings - sage: S # optional - sage.rings.finite_rings + sage: S = P.subscheme([x^2 - y*z, x^5]); S # optional - sage.libs.singular 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_() # optional - sage.rings.finite_rings + sage: S._latex_() # optional - sage.libs.singular '\\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()) @@ -1067,19 +1063,17 @@ def _repr_(self): EXAMPLES:: - 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 + sage: P. = ProjectiveSpace(2, GF(11)) + sage: S = P.subscheme([x^2 - y*z]); S # optional - sage.libs.singular Closed subscheme of Projective Space of dimension 2 over Finite Field of size 11 defined by: x^2 - y*z - sage: S._repr_() # optional - sage.rings.finite_rings + sage: S._repr_() # optional - sage.libs.singular '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]) # optional - sage.rings.finite_rings - sage: S # optional - sage.rings.finite_rings + sage: S = P.subscheme([x^2 - y*z, x^5]); S # optional - sage.libs.singular 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_() # optional - sage.rings.finite_rings + sage: S._repr_() # optional - sage.libs.singular '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()) @@ -1296,8 +1290,8 @@ def is_irreducible(self): :: - sage: A. = AffineSpace(GF(17), 4) # optional - sage.rings.finite_rings - sage: X = A.subscheme([ # optional - sage.rings.finite_rings + 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 ....: ]) @@ -1793,10 +1787,10 @@ def rational_points(self, **kwds): The class of hyperelliptic curves does not (yet) support desingularization of the places at infinity into two 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 + sage: FF = FiniteField(7) + sage: P. = PolynomialRing(FiniteField(7)) + sage: C = HyperellipticCurve(x^8 + x + 1) # optional - sage.rings.finite_rings sage.schemes + sage: C.rational_points() # optional - sage.rings.finite_rings sage.schemes [(0 : 1 : 0), (0 : 1 : 1), (0 : 6 : 1), (2 : 0 : 1), (4 : 0 : 1), (6 : 1 : 1), (6 : 6 : 1)] diff --git a/src/sage/schemes/generic/ambient_space.py b/src/sage/schemes/generic/ambient_space.py index 9b7b11feb74..b0ae7fe4ec5 100644 --- a/src/sage/schemes/generic/ambient_space.py +++ b/src/sage/schemes/generic/ambient_space.py @@ -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)) # optional - sage.rings.finite_rings + sage: PQ.base_extend(GF(5)) 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)) # optional - sage.rings.finite_rings - sage: A.ambient_space() # optional - sage.rings.finite_rings + sage: A = AffineSpace(2, GF(3)) + sage: A.ambient_space() 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)) # optional - sage.rings.finite_rings - sage: A.identity_morphism() # optional - sage.rings.finite_rings + sage: A = AffineSpace(2, GF(3)) + sage: A.identity_morphism() 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)) # optional - sage.rings.finite_rings - sage: P.gens() # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(2, GF(5)) + sage: P.gens() (x, y, z) """ return self.coordinate_ring().gens() diff --git a/src/sage/schemes/generic/divisor_group.py b/src/sage/schemes/generic/divisor_group.py index dfcb699d457..d066ba84633 100644 --- a/src/sage/schemes/generic/divisor_group.py +++ b/src/sage/schemes/generic/divisor_group.py @@ -209,10 +209,10 @@ def _an_element_(self): EXAMPLES:: - sage: A. = AffineSpace(2, CC) - sage: C = Curve(y^2 - x^9 - x) + sage: A. = AffineSpace(2, CC) # optional - sage.rings.real_mpfr + sage: C = Curve(y^2 - x^9 - x) # optional - sage.rings.real_mpfr sage: from sage.schemes.generic.divisor_group import DivisorGroup - sage: DivisorGroup(C).an_element() # indirect test + sage: DivisorGroup(C).an_element() # indirect test # optional - sage.rings.real_mpfr 0 """ return self._scheme.divisor([], base_ring=self.base_ring(), check=False, reduce=False) @@ -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)) # optional - sage.rings.finite_rings + 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:: @@ -251,15 +251,15 @@ def _element_constructor_(self, x, check=True, reduce=True): EXAMPLES:: - sage: A. = AffineSpace(2, CC) - sage: C = Curve(y^2 - x^9 - x) - sage: DivZZ=C.divisor_group(ZZ) - sage: DivQQ=C.divisor_group(QQ) - sage: DivQQ( DivQQ.an_element() ) # indirect test + sage: A. = AffineSpace(2, CC) # optional - sage.rings.real_mpfr + sage: C = Curve(y^2 - x^9 - x) # optional - sage.rings.real_mpfr + sage: DivZZ = C.divisor_group(ZZ) # optional - sage.rings.real_mpfr + sage: DivQQ = C.divisor_group(QQ) # optional - sage.rings.real_mpfr + sage: DivQQ(DivQQ.an_element()) # indirect test # optional - sage.rings.real_mpfr 0 - sage: DivZZ( DivZZ.an_element() ) # indirect test + sage: DivZZ(DivZZ.an_element()) # indirect test # optional - sage.rings.real_mpfr 0 - sage: DivQQ( DivZZ.an_element() ) # indirect test + sage: DivQQ(DivZZ.an_element()) # indirect test # optional - sage.rings.real_mpfr 0 """ if isinstance(x, Divisor_curve): diff --git a/src/sage/schemes/generic/homset.py b/src/sage/schemes/generic/homset.py index 5e88b3ceef5..208aa902d91 100644 --- a/src/sage/schemes/generic/homset.py +++ b/src/sage/schemes/generic/homset.py @@ -632,16 +632,16 @@ def _element_constructor_(self, *v, **kwds): EXAMPLES:: sage: A2 = AffineSpace(ZZ, 2) - sage: F = GF(3) # optional - sage.rings.finite_rings - sage: F_points = A2(F); type(F_points) # optional - sage.rings.finite_rings + sage: F = GF(3) + sage: F_points = A2(F); type(F_points) - sage: F_points([2,5]) # optional - sage.rings.finite_rings + sage: F_points([2,5]) (2, 2) - sage: P2 = ProjectiveSpace(GF(3), 2) # optional - sage.rings.finite_rings + sage: P2 = ProjectiveSpace(GF(3), 2) 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 = P2(F) + sage: type(F_points) sage: F_points([4,2*a]) # optional - sage.rings.finite_rings (1 : 2*a : 1) diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index 086c2960755..43215ec3ac6 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -1373,7 +1373,7 @@ def change_ring(self, R, check=True): sage: P. = ProjectiveSpace(ZZ, 1) sage: H = Hom(P, P) sage: f = H([3*x^2, y^2]) - sage: f.change_ring(GF(3)) # optional - sage.rings.finite_rings + sage: f.change_ring(GF(3)) 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) @@ -1382,7 +1382,7 @@ 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)) # optional - sage.rings.finite_rings + sage: f.change_ring(GF(3)) 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) @@ -1393,7 +1393,7 @@ def change_ring(self, R, check=True): sage: X = P.subscheme([5*x^2 - y^2]) sage: H = Hom(X, X) sage: f = H([x, y]) - sage: f.change_ring(GF(3)) # optional - sage.rings.finite_rings + sage: f.change_ring(GF(3)) 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) @@ -1764,8 +1764,8 @@ def __init__(self, X): TESTS:: - sage: A = AffineSpace(2, GF(3)) # optional - sage.rings.finite_rings - sage: A.identity_morphism().defining_polynomials() # optional - sage.rings.finite_rings + sage: A = AffineSpace(2, GF(3)) + sage: A.identity_morphism().defining_polynomials() (x0, x1) """ super().__init__(X) @@ -1969,7 +1969,7 @@ def change_ring(self, R, check=True): sage: P. = ProjectiveSpace(ZZ, 2) sage: X = P.subscheme(x^2 - y^2) - sage: X(23,23,1).change_ring(GF(13)) # optional - sage.rings.finite_rings + sage: X(23,23,1).change_ring(GF(13)) (10 : 10 : 1) :: diff --git a/src/sage/schemes/generic/scheme.py b/src/sage/schemes/generic/scheme.py index 3b039697814..52780ef4127 100644 --- a/src/sage/schemes/generic/scheme.py +++ b/src/sage/schemes/generic/scheme.py @@ -226,7 +226,7 @@ def __call__(self, *args): 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)) # optional - sage.rings.finite_rings + sage: A(GF(7)) Traceback (most recent call last): ... ValueError: There must be a natural map S --> R, but @@ -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)) # optional - sage.rings.finite_rings + sage: P.point_homset(GF(11)) 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)) # optional - sage.rings.finite_rings + sage: P.point_homset(GF(11)) Traceback (most recent call last): ... ValueError: There must be a natural map S --> R, but @@ -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) # optional - sage.rings.finite_rings + sage: A/GF(7) Affine Space of dimension 3 over Finite Field of size 7 """ return self.base_extend(Y) @@ -672,7 +672,7 @@ def count_points(self, n): EXAMPLES:: - sage: P. = PolynomialRing(GF(3)) # optional - sage.rings.finite_rings + sage: P. = PolynomialRing(GF(3)) 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] @@ -734,8 +734,8 @@ def zeta_series(self, n, t): EXAMPLES:: - sage: P. = PolynomialRing(GF(3)) # optional - sage.rings.finite_rings - sage: C = HyperellipticCurve(x^3 + x^2 + 1) # optional - sage.rings.finite_rings + sage: P. = PolynomialRing(GF(3)) + sage: C = HyperellipticCurve(x^3 + x^2 + 1) # optional - sage.rings.finite_rings sage.schemes sage: R. = PowerSeriesRing(Integers()) 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) diff --git a/src/sage/schemes/generic/spec.py b/src/sage/schemes/generic/spec.py index 60f46664e31..965958a13c6 100644 --- a/src/sage/schemes/generic/spec.py +++ b/src/sage/schemes/generic/spec.py @@ -170,11 +170,11 @@ def _apply_functor_to_morphism(self, f): EXAMPLES:: sage: from sage.schemes.generic.spec import SpecFunctor - 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 + sage: F = SpecFunctor(GF(7)) + sage: A. = GF(7)[] + sage: B. = GF(7)[] + sage: f = A.hom((t^2, t^3)) + sage: Spec(f) 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/product_projective/homset.py b/src/sage/schemes/product_projective/homset.py index 91af8105def..ff05f539b1e 100644 --- a/src/sage/schemes/product_projective/homset.py +++ b/src/sage/schemes/product_projective/homset.py @@ -134,8 +134,8 @@ def points(self, **kwds): :: - sage: P. = ProductProjectiveSpaces([2, 1], GF(3)) # optional - sage.rings.finite_rings - sage: P(P.base_ring()).points() # optional - sage.rings.finite_rings + sage: P. = ProductProjectiveSpaces([2, 1], GF(3)) + sage: P(P.base_ring()).points() [(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), diff --git a/src/sage/schemes/product_projective/point.py b/src/sage/schemes/product_projective/point.py index 09cd0225209..82b8ea4fcc0 100644 --- a/src/sage/schemes/product_projective/point.py +++ b/src/sage/schemes/product_projective/point.py @@ -69,15 +69,15 @@ def __init__(self, parent, polys, check=True): :: - 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 + sage: T = ProductProjectiveSpaces([2, 2, 2], GF(5), 'x') + sage: T.point([1, 2, 3, 4, 5, 6, 7, 8, 9]) (2 : 4 : 1 , 4 : 0 : 1 , 3 : 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 + sage: T. = ProductProjectiveSpaces([1, 1], GF(5)) + sage: X = T.subscheme([x - y, z - 2*w]) + sage: X([1, 1, 2, 1]) (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') # 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 + sage: T = ProductProjectiveSpaces([2, 2, 2], GF(5), 'x') + sage: P = T([1, 0, 1, 1, 0, 0, 0, 0, 1]) + sage: P[1] (1 : 0 : 0) - sage: P[1].codomain() # optional - sage.rings.finite_rings + sage: P[1].codomain() Projective Space of dimension 2 over Finite Field of size 5 - sage: P[1][0] # optional - sage.rings.finite_rings + sage: P[1][0] 1 """ return self._points[i] @@ -173,26 +173,26 @@ def _richcmp_(self, right, op): EXAMPLES:: - 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 + 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 True :: - 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 + 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 True :: - 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 + 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 True """ #needed for Digraph @@ -281,10 +281,10 @@ def __hash__(self): :: - 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 + sage: PP = ProductProjectiveSpaces(GF(7), [1, 1, 1]) + sage: hash(PP([4, 1, 5, 4, 6, 1])) == hash((4, 1, 5, 4, 6, 1)) False - sage: hash(PP([4, 1, 5, 4, 6, 1])) == hash((4, 1, 3, 1, 6, 1)) # optional - sage.rings.finite_rings + sage: hash(PP([4, 1, 5, 4, 6, 1])) == hash((4, 1, 3, 1, 6, 1)) True """ R = self.codomain().base_ring() @@ -410,7 +410,7 @@ def change_ring(self, R, **kwds): sage: T. = ProductProjectiveSpaces([1, 1, 1], ZZ) sage: P = T.point([5, 3, 15, 4, 2, 6]) - sage: P.change_ring(GF(3)) # optional - sage.rings.finite_rings + sage: P.change_ring(GF(3)) (1 : 0 , 0 : 1 , 1 : 0) """ check = kwds.get('check', True) diff --git a/src/sage/schemes/product_projective/rational_point.py b/src/sage/schemes/product_projective/rational_point.py index d9cda05b8e2..3177c951545 100644 --- a/src/sage/schemes/product_projective/rational_point.py +++ b/src/sage/schemes/product_projective/rational_point.py @@ -27,11 +27,11 @@ Product projective over finite field:: - 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: P1. = ProductProjectiveSpaces([1, 1], GF(7)) + sage: X = P1.subscheme([2*x + 3*y]) sage: from sage.schemes.product_projective.rational_point import \ enum_product_projective_finite_field - sage: enum_product_projective_finite_field(X) # optional - sage.rings.finite_rings + sage: enum_product_projective_finite_field(X) [(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)] @@ -261,10 +261,10 @@ def enum_product_projective_finite_field(X): EXAMPLES:: - sage: PP. = ProductProjectiveSpaces([1, 1], GF(3)) # optional - sage.rings.finite_rings + sage: PP. = ProductProjectiveSpaces([1, 1], GF(3)) sage: from sage.schemes.product_projective.rational_point import \ enum_product_projective_finite_field - sage: enum_product_projective_finite_field(PP) # optional - sage.rings.finite_rings + sage: enum_product_projective_finite_field(PP) [(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)) # optional - sage.rings.finite_rings - sage: X = PP.subscheme([x0^2 + 2*x1^2]) # optional - sage.rings.finite_rings + sage: PP. = ProductProjectiveSpaces([1, 1], GF(17)) + sage: X = PP.subscheme([x0^2 + 2*x1^2]) sage: from sage.schemes.product_projective.rational_point import \ enum_product_projective_finite_field - sage: len(enum_product_projective_finite_field(X)) # optional - sage.rings.finite_rings + sage: len(enum_product_projective_finite_field(X)) 36 """ if is_Scheme(X): diff --git a/src/sage/schemes/product_projective/space.py b/src/sage/schemes/product_projective/space.py index c17524ed163..6dd0b237965 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') # optional - sage.rings.finite_rings + sage: ProductProjectiveSpaces([2, 2], GF(7), 'y') Product of projective spaces P^2 x P^2 over Finite Field of size 7 :: @@ -508,10 +508,10 @@ def dimension_absolute(self): EXAMPLES:: - sage: T. = ProductProjectiveSpaces([2, 2], GF(17)) # optional - sage.rings.finite_rings - sage: T.dimension_absolute() # optional - sage.rings.finite_rings + sage: T. = ProductProjectiveSpaces([2, 2], GF(17)) + sage: T.dimension_absolute() 4 - sage: T.dimension() # optional - sage.rings.finite_rings + sage: T.dimension() 4 """ base = self.base_scheme() @@ -543,10 +543,10 @@ def dimension_absolute_components(self): EXAMPLES:: - sage: T. = ProductProjectiveSpaces([2, 2], GF(17)) # optional - sage.rings.finite_rings - sage: T.dimension_absolute_components() # optional - sage.rings.finite_rings + sage: T. = ProductProjectiveSpaces([2, 2], GF(17)) + sage: T.dimension_absolute_components() [2, 2] - sage: T.dimension_components() # optional - sage.rings.finite_rings + sage: T.dimension_components() [2, 2] """ base = self.base_scheme() @@ -564,8 +564,8 @@ def num_components(self): EXAMPLES:: - sage: T = ProductProjectiveSpaces([1, 1, 1], GF(5), 'x') # optional - sage.rings.finite_rings - sage: T.num_components() # optional - sage.rings.finite_rings + sage: T = ProductProjectiveSpaces([1, 1, 1], GF(5), 'x') + sage: T.num_components() 3 """ return len(self._components) @@ -581,8 +581,8 @@ def ngens(self): EXAMPLES:: - sage: T = ProductProjectiveSpaces([1, 1, 1], GF(5), 'x') # optional - sage.rings.finite_rings - sage: T.ngens() # optional - sage.rings.finite_rings + sage: T = ProductProjectiveSpaces([1, 1, 1], GF(5), 'x') + sage: T.ngens() 6 """ return sum([P.ngens() for P in self._components]) @@ -722,9 +722,9 @@ def _validate(self, polynomials): :: - 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 + sage: R. = PolynomialRing(GF(5)) + sage: T. = ProductProjectiveSpaces([2, 1], QQ) + sage: T._validate([t, t, t, w^2, u^2]) 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)) # 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 + sage: R. = PolynomialRing(GF(7)) + sage: T. = ProductProjectiveSpaces([2, 1], R) + sage: T._check_satisfies_equations([1 + t, 1, 0, 0, 1]) True :: @@ -837,24 +837,24 @@ def subscheme(self, X): EXAMPLES:: - 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 + 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: x - y, z - w - sage: X.defining_polynomials() # optional - sage.rings.finite_rings + sage: X.defining_polynomials() [x - y, z - w] - sage: I = X.defining_ideal(); I # optional - sage.rings.finite_rings + sage: I = X.defining_ideal(); I 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 + sage: X.base_ring() Finite Field of size 5 - sage: X.base_scheme() # optional - sage.rings.finite_rings + sage: X.base_scheme() Spectrum of Finite Field of size 5 - sage: X.structure_morphism() # optional - sage.rings.finite_rings + sage: X.structure_morphism() 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 @@ -884,7 +884,7 @@ def change_ring(self, R): EXAMPLES:: sage: T. = ProductProjectiveSpaces([2, 2], QQ) - sage: T.change_ring(GF(17)) # optional - sage.rings.finite_rings + sage: T.change_ring(GF(17)) 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] @@ -1103,8 +1103,8 @@ def _point_homset(self, *args, **kwds): EXAMPLES:: - 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 + sage: P. = ProductProjectiveSpaces([1, 1], GF(5)) + sage: P._point_homset(Spec(GF(5)), P) Set of rational points of Product of projective spaces P^1 x P^1 over Finite Field of size 5 """ @@ -1225,8 +1225,8 @@ def _point(self, *args, **kwds): EXAMPLES:: - sage: P = ProductProjectiveSpaces([1, 2], GF(11)) # optional - sage.rings.finite_rings - sage: P([3, 7, 4, 5, 9]) # optional - sage.rings.finite_rings + sage: P = ProductProjectiveSpaces([1, 2], GF(11)) + sage: P([3, 7, 4, 5, 9]) (2 : 1 , 9 : 3 : 1) """ return ProductProjectiveSpaces_point_finite_field(*args, **kwds) @@ -1237,8 +1237,8 @@ def __iter__(self): EXAMPLES:: - sage: P = ProductProjectiveSpaces([2, 1], GF(3)) # optional - sage.rings.finite_rings - sage: [x for x in P] # optional - sage.rings.finite_rings + sage: P = ProductProjectiveSpaces([2, 1], GF(3)) + sage: [x for x in P] [(0 : 0 : 1 , 0 : 1), (0 : 1 : 1 , 0 : 1), (0 : 2 : 1 , 0 : 1), @@ -1270,8 +1270,8 @@ def rational_points(self, F=None): EXAMPLES:: - sage: P = ProductProjectiveSpaces([1, 1], GF(5)) # optional - sage.rings.finite_rings - sage: P.rational_points() # optional - sage.rings.finite_rings + sage: P = ProductProjectiveSpaces([1, 1], GF(5)) + sage: P.rational_points() [(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), @@ -1281,7 +1281,7 @@ def rational_points(self, F=None): :: - sage: P = ProductProjectiveSpaces([1, 1], GF(2)) # optional - sage.rings.finite_rings + sage: P = ProductProjectiveSpaces([1, 1], GF(2)) 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), diff --git a/src/sage/schemes/product_projective/subscheme.py b/src/sage/schemes/product_projective/subscheme.py index 1678ab2f472..5612fdab77a 100644 --- a/src/sage/schemes/product_projective/subscheme.py +++ b/src/sage/schemes/product_projective/subscheme.py @@ -432,13 +432,13 @@ def multiplicity(self, P): :: - 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 + 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) # optional - sage.libs.singular sage.rings.finite_rings 1 - sage: Q2 = PP([1,0,1,0,0]) # optional - sage.rings.finite_rings - sage: X.multiplicity(Q2) # optional - sage.rings.finite_rings + sage: Q2 = PP([1,0,1,0,0]) + sage: X.multiplicity(Q2) # optional - sage.libs.singular sage.rings.finite_rings 4 """ PP = self.ambient_space() diff --git a/src/sage/schemes/projective/projective_homset.py b/src/sage/schemes/projective/projective_homset.py index c4aa79b9f7a..8f6a4568a6c 100644 --- a/src/sage/schemes/projective/projective_homset.py +++ b/src/sage/schemes/projective/projective_homset.py @@ -129,9 +129,9 @@ def points(self, **kwds): :: - 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 + sage: P1 = ProjectiveSpace(GF(2), 1) + sage: F. = GF(4, 'a') # optional - sage.rings.finite_rings + sage: P1(F).points() # optional - sage.libs.singular sage.rings.finite_rings [(0 : 1), (1 : 0), (1 : 1), (a : 1), (a + 1 : 1)] :: diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index ddbaa072962..99f6ebe14cb 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -565,8 +565,8 @@ def __ne__(self, right): 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)) # optional - sage.rings.finite_rings - sage: f != g # optional - sage.rings.finite_rings + sage: g = f.change_ring(GF(7)) + sage: f != g True :: @@ -701,10 +701,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) + sage: H = End(P) + sage: f = H([x^2, y^2]) + sage: type(f.as_dynamical_system()) # optional - sage.rings.finite_rings sage.schemes :: @@ -768,10 +768,10 @@ 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: 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 # 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 @@ -832,10 +832,10 @@ 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: 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 # 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 @@ -1269,11 +1269,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)) + 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() # optional - sage.libs.singular sage.rings.finite_rings True Map that is not morphism on projective space, but is over a subscheme:: @@ -1319,7 +1319,7 @@ def global_height(self, 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.global_height() + sage: f.global_height() # optional - sage.symbolic 20.8348429892146 :: @@ -1327,7 +1327,7 @@ def global_height(self, 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.global_height(prec=11) + sage: f.global_height(prec=11) # optional - sage.symbolic 20.8 :: @@ -1335,7 +1335,7 @@ def global_height(self, prec=None): sage: P. = ProjectiveSpace(ZZ, 2) sage: H = Hom(P, P) sage: f = H([4*x^2 + 100*y^2, 210*x*y, 10000*z^2]); - sage: f.global_height() + sage: f.global_height() # optional - sage.symbolic 8.51719319141624 :: @@ -1364,25 +1364,25 @@ def global_height(self, prec=None): sage: A. = ProjectiveSpace(QQ, 1) sage: H = Hom(P, A) sage: f = H([1/1331*x^2 + 4000*y*z, y^2]) - sage: f.global_height() + sage: f.global_height() # optional - sage.symbolic 15.4877354584971 :: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([1/25*x^2 + 25/3*x*y + y^2, 1*y^2]) - sage: exp(f.global_height()) + sage: exp(f.global_height()) # optional - sage.symbolic 625.000000000000 Scaling should not change the result:: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([1/25*x^2 + 25/3*x*y + y^2, 1*y^2]) - sage: f.global_height() + sage: f.global_height() # optional - sage.symbolic 6.43775164973640 sage: c = 10000 sage: f.scale_by(c) - sage: f.global_height() + sage: f.global_height() # optional - sage.symbolic 6.43775164973640 """ K = self.domain().base_ring() @@ -2083,7 +2083,7 @@ def reduce_base_field(self): :: - sage: K. = GF(5) # optional - sage.rings.finite_rings + sage: K. = GF(5) 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 @@ -2249,10 +2249,10 @@ def _fast_eval(self, x): EXAMPLES:: - 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 + 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]) [2, 1, 2] """ if self._is_prime_finite_field: @@ -2717,7 +2717,7 @@ def projective_degrees(self): EXAMPLES:: - sage: k = GF(11) # optional - sage.rings.finite_rings + sage: k = GF(11) 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 @@ -2759,7 +2759,7 @@ def degree(self): EXAMPLES:: - sage: k = GF(11) # optional - sage.rings.finite_rings + sage: k = GF(11) 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 diff --git a/src/sage/schemes/projective/projective_point.py b/src/sage/schemes/projective/projective_point.py index 05675ce2cc6..22a47c2480e 100644 --- a/src/sage/schemes/projective/projective_point.py +++ b/src/sage/schemes/projective/projective_point.py @@ -655,16 +655,16 @@ def dehomogenize(self,n): :: - 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 + sage: P. = ProjectiveSpace(GF(5), 2) + sage: Q = P(1, 3, 1) + sage: Q.dehomogenize(0) # optional - sage.libs.singular (3, 1) :: - 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 + sage: P. = ProjectiveSpace(GF(5), 2) + sage: Q = P(1, 3, 0) + sage: Q.dehomogenize(2) # optional - sage.libs.singular Traceback (most recent call last): ... ValueError: can...t dehomogenize at 0 coordinate @@ -696,14 +696,14 @@ def global_height(self, prec=None): sage: P. = ProjectiveSpace(QQ, 2) sage: Q = P.point([4, 4, 1/30]) - sage: Q.global_height() + sage: Q.global_height() # optional - sage.symbolic 4.78749174278205 :: sage: P. = ProjectiveSpace(ZZ, 2) sage: Q = P([4, 1, 30]) - sage: Q.global_height() + sage: Q.global_height() # optional - sage.symbolic 3.40119738166216 :: @@ -732,7 +732,7 @@ def global_height(self, prec=None): 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() # optional - sage.symbolic 3.17805383034795 sage: x = polygen(QQ, 'x') @@ -1012,10 +1012,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) + sage: F = DynamicalSystem([x^2 - 2*y^2, y^2, z^2]) # optional - sage.rings.finite_rings sage.schemes + sage: Q = P(1, 1, 1) + sage: Q.is_preperiodic(F, return_period=True) # optional - sage.rings.finite_rings sage.schemes (1, 1) TESTS:: @@ -1098,9 +1098,9 @@ 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[0].parent() # optional - sage.rings.finite_rings + sage: P = ProjectiveSpace(1, GF(7)) + sage: Q = P([2, 1]) + sage: Q[0].parent() Finite Field of size 7 :: @@ -1192,10 +1192,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) + sage: Q = P.point([GF(5)(1), GF(5)(3), GF(5)(0)], False); Q (1 : 3 : 0) - sage: Q.normalize_coordinates(); Q # optional - sage.rings.finite_rings + sage: Q.normalize_coordinates(); Q (2 : 1 : 0) :: @@ -1384,21 +1384,21 @@ def __hash__(self): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings - sage: hash(P(2, 1, 2)) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(5), 2) + sage: hash(P(2, 1, 2)) 41 :: - 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 + sage: P. = ProjectiveSpace(GF(7), 2) + sage: X = P.subscheme(x^2 - y^2) + sage: hash(X(1, 1, 2)) 81 :: - sage: P. = ProjectiveSpace(GF(13), 1) # optional - sage.rings.finite_rings - sage: hash(P(3, 4)) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(13), 1) + sage: hash(P(3, 4)) 17 :: diff --git a/src/sage/schemes/projective/projective_rational_point.py b/src/sage/schemes/projective/projective_rational_point.py index b0244869d07..0ab98a08484 100644 --- a/src/sage/schemes/projective/projective_rational_point.py +++ b/src/sage/schemes/projective/projective_rational_point.py @@ -247,26 +247,28 @@ def enum_projective_finite_field(X): 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))) # optional - sage.rings.finite_rings + sage: F = GF(53) + sage: P. = ProjectiveSpace(2, F) + sage: len(enum_projective_finite_field(P(F))) 2863 sage: 53^2 + 53 + 1 2863 :: - 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 + sage: F = GF(9, 'a') # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(2,F) + sage: C = Curve(X^3 - Y^3 + Z^2*Y) # optional - sage.rings.finite_rings sage.schemes + sage: enum_projective_finite_field(C(F)) # optional - sage.rings.finite_rings sage.schemes [(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) # 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 + sage: F = GF(5) + sage: P2F. = ProjectiveSpace(2, F) + sage: enum_projective_finite_field(P2F) [(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), diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index eae8dd26fec..60ecfe4c65a 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -170,7 +170,7 @@ def ProjectiveSpace(n, R=None, names=None): :: - sage: ProjectiveSpace(5)/GF(17) # optional - sage.rings.finite_rings + sage: ProjectiveSpace(5)/GF(17) Projective Space of dimension 5 over Finite Field of size 17 The default base ring is `\ZZ`. @@ -184,12 +184,12 @@ def ProjectiveSpace(n, R=None, names=None): :: - sage: R = GF(7)['x,y,z'] # optional - sage.rings.finite_rings - sage: P = ProjectiveSpace(R); P # optional - sage.rings.finite_rings + sage: R = GF(7)['x,y,z'] + sage: P = ProjectiveSpace(R); P Projective Space of dimension 2 over Finite Field of size 7 - sage: P.coordinate_ring() # optional - sage.rings.finite_rings + sage: P.coordinate_ring() Multivariate Polynomial Ring in x, y, z over Finite Field of size 7 - sage: P.coordinate_ring() is R # optional - sage.rings.finite_rings + sage: P.coordinate_ring() is R True :: @@ -622,9 +622,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') # 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 + sage: P = ProjectiveSpace(GF(5), 2, names='x') + sage: pt = P([1, 1, 1]) + sage: P._linear_system_as_kernel(0, pt, 3) # optional - sage.modules [1] [0] [0] @@ -635,10 +635,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') # 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 + sage: P = ProjectiveSpace(GF(5), 2, names='x') + sage: pt = P([1, 1, 1]) + sage: M = P._linear_system_as_kernel(2, pt, 0) # optional - sage.modules + sage: [M.nrows(), M.ncols()] # optional - sage.modules [0, 6] The base ring does not need to be a field or even an integral domain. @@ -656,10 +656,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) # 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 + 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) Traceback (most recent call last): ... TypeError: at least one component of pt=[3, 3, 0] must be equal to 1 @@ -735,8 +735,8 @@ def _morphism(self, *args, **kwds): TESTS:: - 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 + sage: P2. = ProjectiveSpace(2, GF(3)) + sage: P2._morphism(P2.Hom(P2), [x,y,z]) 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) @@ -765,8 +765,8 @@ def _point_homset(self, *args, **kwds): TESTS:: - sage: P2. = ProjectiveSpace(2, GF(3)) # optional - sage.rings.finite_rings - sage: P2._point_homset(Spec(GF(3)), P2) # optional - sage.rings.finite_rings + sage: P2. = ProjectiveSpace(2, GF(3)) + sage: P2._point_homset(Spec(GF(3)), P2) Set of rational points of Projective Space of dimension 2 over Finite Field of size 3 """ return SchemeHomset_points_projective_ring(*args, **kwds) @@ -829,9 +829,9 @@ def _point(self, *args, **kwds): TESTS:: - 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 + sage: P2. = ProjectiveSpace(2, GF(3)) + sage: point_homset = P2._point_homset(Spec(GF(3)), P2) + sage: P2._point(point_homset, [1,2,3]) (2 : 1 : 0) """ return SchemeMorphism_point_projective_ring(*args, **kwds) @@ -915,7 +915,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)) # optional - sage.rings.finite_rings + sage: PQ.change_ring(GF(5)) Projective Space of dimension 2 over Finite Field of size 5 :: @@ -1334,9 +1334,9 @@ def Lattes_map(self, E, m): TESTS:: - 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 + sage: P. = ProjectiveSpace(GF(37), 1) + sage: E = EllipticCurve([1, 1]) # optional - sage.rings.finite_rings sage.schemes + sage: f = P.Lattes_map(E, 2); f # optional - sage.rings.finite_rings sage.schemes 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) @@ -1495,7 +1495,7 @@ def veronese_embedding(self, d, CS=None, order='lex'): EXAMPLES:: sage: P. = ProjectiveSpace(QQ, 1) - sage: vd = P.veronese_embedding(4, order='invlex') + sage: vd = P.veronese_embedding(4, order='invlex') # optional - sage.combinat sage: vd Scheme morphism: From: Projective Space of dimension 1 over Rational Field @@ -1507,7 +1507,7 @@ def veronese_embedding(self, d, CS=None, order='lex'): sage: P. = ProjectiveSpace(QQ, 2) sage: Q. = ProjectiveSpace(QQ, 5) - sage: vd = P.veronese_embedding(2, Q) + sage: vd = P.veronese_embedding(2, Q) # optional - sage.combinat sage: vd Scheme morphism: From: Projective Space of dimension 2 over Rational Field @@ -1586,10 +1586,10 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr :: - 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 + 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) # optional - sage.modules [10 4] [10 1] @@ -1852,10 +1852,10 @@ def hyperplane_transformation_matrix(self, plane_1, plane_2): :: - 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 + 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) # optional - sage.modules [1 0 0] [1 1 0] [1 1 1] @@ -1976,9 +1976,9 @@ def is_linearly_independent(self, points, n=None): :: - 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 + 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) # optional - sage.modules True :: @@ -2054,8 +2054,8 @@ def _point_homset(self, *args, **kwds): TESTS:: - sage: P2. = ProjectiveSpace(2, GF(3)) # optional - sage.rings.finite_rings - sage: P2._point_homset(Spec(GF(3)), P2) # optional - sage.rings.finite_rings + sage: P2. = ProjectiveSpace(2, GF(3)) + sage: P2._point_homset(Spec(GF(3)), P2) Set of rational points of Projective Space of dimension 2 over Finite Field of size 3 """ return SchemeHomset_points_projective_field(*args, **kwds) @@ -2068,9 +2068,9 @@ def _point(self, *args, **kwds): TESTS:: - 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 + sage: P2. = ProjectiveSpace(2, GF(3)) + sage: point_homset = P2._point_homset(Spec(GF(3)), P2) + sage: P2._point(point_homset, [1,2,3]) (2 : 1 : 0) """ return SchemeMorphism_point_projective_field(*args, **kwds) @@ -2083,8 +2083,8 @@ def _morphism(self, *args, **kwds): TESTS:: - 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 + sage: P2. = ProjectiveSpace(2, GF(3)) + sage: P2._morphism(P2.Hom(P2), [x,y,z]) 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) @@ -2138,8 +2138,8 @@ def subscheme_from_Chow_form(self, Ch, dim): :: - 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: P. = ProjectiveSpace(GF(7), 3) + sage: X = P.subscheme([x3^2 + x1*x2, x2 - x0]) 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 @@ -2262,9 +2262,9 @@ def _point(self, *args, **kwds): TESTS:: - 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 + sage: P2. = ProjectiveSpace(2, GF(3)) + sage: point_homset = P2._point_homset(Spec(GF(3)), P2) + sage: P2._point(point_homset, [1,2,3]) (2 : 1 : 0) """ return SchemeMorphism_point_projective_finite_field(*args, **kwds) @@ -2277,8 +2277,8 @@ def _morphism(self, *args, **kwds): TESTS:: - 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 + sage: P2. = ProjectiveSpace(2, GF(3)) + sage: P2._morphism(P2.Hom(P2), [x,y,z]) 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) @@ -2297,15 +2297,15 @@ def __iter__(self): EXAMPLES:: - 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 + sage: FF = FiniteField(3) + sage: PP = ProjectiveSpace(0, FF) + sage: [ x for x in PP ] [(1)] - sage: PP = ProjectiveSpace(1, FF) # optional - sage.rings.finite_rings - sage: [ x for x in PP ] # optional - sage.rings.finite_rings + sage: PP = ProjectiveSpace(1, FF) + sage: [ x for x in PP ] [(0 : 1), (1 : 1), (2 : 1), (1 : 0)] - sage: PP = ProjectiveSpace(2, FF) # optional - sage.rings.finite_rings - sage: [ x for x in PP ] # optional - sage.rings.finite_rings + sage: PP = ProjectiveSpace(2, FF) + sage: [ x for x in PP ] [(0 : 0 : 1), (0 : 1 : 1), (0 : 2 : 1), @@ -2348,8 +2348,8 @@ def rational_points(self, F=None): EXAMPLES:: - sage: P = ProjectiveSpace(1, GF(3)) # optional - sage.rings.finite_rings - sage: P.rational_points() # optional - sage.rings.finite_rings + sage: P = ProjectiveSpace(1, GF(3)) + sage: P.rational_points() [(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), @@ -2371,8 +2371,8 @@ def rational_points_dictionary(self): EXAMPLES:: - sage: P1 = ProjectiveSpace(GF(7), 1, 'x') # optional - sage.rings.finite_rings - sage: P1.rational_points_dictionary() # optional - sage.rings.finite_rings + sage: P1 = ProjectiveSpace(GF(7), 1, 'x') + sage: P1.rational_points_dictionary() {(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 e6caf19ba74..8dc53d89bd6 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -310,9 +310,9 @@ def _best_affine_patch(self, point): TESTS:: - 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 + sage: F = GF(3) + sage: P. = ProjectiveSpace(F, 2) + sage: S._best_affine_patch([0,1,2]) 2 """ point = list(point) @@ -950,10 +950,10 @@ def dual(self): An example over a finite field:: - 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 + 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() # optional - sage.libs.singular 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 @@ -1025,9 +1025,9 @@ def degree(self): sage: X.degree() 7 - 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 + sage: P. = ProjectiveSpace(GF(13), 3) + sage: X = P.subscheme([y^3 - w^3, x + 7*z]) + sage: X.degree() # optional - sage.libs.singular sage.rings.finite_rings 3 sage: P. = ProjectiveSpace(QQ, 4) @@ -1055,14 +1055,14 @@ def intersection_multiplicity(self, X, P): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(5), 2) 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 + sage: Q1 = P([0,1,0]) + sage: C.intersection_multiplicity(D, Q1) # optional - sage.libs.singular sage.rings.finite_rings 4 - sage: Q2 = P([0,0,1]) # optional - sage.rings.finite_rings - sage: C.intersection_multiplicity(D, Q2) # optional - sage.rings.finite_rings + sage: Q2 = P([0,0,1]) + sage: C.intersection_multiplicity(D, Q2) # optional - sage.libs.singular sage.rings.finite_rings 6 :: @@ -1145,10 +1145,10 @@ def multiplicity(self, P): :: - sage: P. = ProjectiveSpace(GF(29), 3) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(29), 3) 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 + sage: Q = P([3,0,0,1]) + sage: C.multiplicity(Q) # optional - sage.libs.singular sage.rings.finite_rings 8 """ if self.base_ring() not in Fields(): @@ -1295,9 +1295,9 @@ def Chow_form(self): EXAMPLES:: - 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 + sage: P. = ProjectiveSpace(GF(17), 3) + sage: X = P.subscheme([x3 + x1, x2 - x0, x2 - x3]) + sage: X.Chow_form() # optional - sage.libs.singular sage.rings.finite_rings t0 - t1 + t2 + t3 :: From 129f7c1cf9f942add97059a1dec9b7873cd5a212 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 29 Jun 2023 19:46:24 -0700 Subject: [PATCH 029/423] ./sage -fixdoctests --only-tags src/sage/schemes/projective/projective_space.py --- .../schemes/projective/projective_space.py | 241 +++++++++--------- 1 file changed, 121 insertions(+), 120 deletions(-) diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index 60ecfe4c65a..087b60df508 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -24,7 +24,7 @@ sage: X = ProjectiveSpace(5)/QQ; X Projective Space of dimension 5 over Rational Field - sage: X/CC + sage: X/CC # needs sage.rings.real_mpfr 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 @@ -59,7 +59,7 @@ Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x + y + z, x + y - z - sage: V.dimension() + sage: V.dimension() # needs sage.libs.singular 0 AUTHORS: @@ -141,7 +141,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')) # optional - sage.rings.finite_rings + sage: is_ProjectiveSpace(ProjectiveSpace(5, GF(9, 'alpha'), names='x')) # needs sage.rings.finite_rings True sage: is_ProjectiveSpace(Spec(ZZ)) False @@ -194,7 +194,7 @@ def ProjectiveSpace(n, R=None, names=None): :: - sage: ProjectiveSpace(3, Zp(5), 'y') # optional - sage.rings.padics + sage: ProjectiveSpace(3, Zp(5), 'y') # needs sage.rings.padics Projective Space of dimension 3 over 5-adic Ring with capped relative precision 20 :: @@ -204,8 +204,7 @@ def ProjectiveSpace(n, R=None, names=None): :: - sage: PS. = ProjectiveSpace(1, CC) - sage: PS + sage: PS. = ProjectiveSpace(1, CC); PS # needs sage.rings.real_mpfr Projective Space of dimension 1 over Complex Field with 53 bits of precision :: @@ -337,7 +336,7 @@ def __init__(self, n, R=ZZ, names=None): EXAMPLES:: - sage: ProjectiveSpace(3, Zp(5), 'y') # optional - sage.rings.padics + sage: ProjectiveSpace(3, Zp(5), 'y') # needs sage.rings.padics Projective Space of dimension 3 over 5-adic Ring with capped relative precision 20 """ AmbientSpace.__init__(self, n, R) @@ -419,7 +418,7 @@ def coordinate_ring(self): EXAMPLES:: - sage: ProjectiveSpace(3, GF(19^2,'alpha'), 'abcd').coordinate_ring() # optional - sage.rings.finite_rings + sage: ProjectiveSpace(3, GF(19^2,'alpha'), 'abcd').coordinate_ring() # needs sage.rings.finite_rings Multivariate Polynomial Ring in a, b, c, d over Finite Field in alpha of size 19^2 :: @@ -590,7 +589,7 @@ def _latex_(self): TESTS:: - sage: ProjectiveSpace(3, Zp(5), 'y')._latex_() # optional - sage.rings.padics + sage: ProjectiveSpace(3, Zp(5), 'y')._latex_() # needs sage.rings.padics '{\\mathbf P}_{\\Bold{Z}_{5}}^3' """ return "{\\mathbf P}_{%s}^%s" % (latex(self.base_ring()), @@ -624,7 +623,7 @@ def _linear_system_as_kernel(self, d, pt, m): sage: P = ProjectiveSpace(GF(5), 2, names='x') sage: pt = P([1, 1, 1]) - sage: P._linear_system_as_kernel(0, pt, 3) # optional - sage.modules + sage: P._linear_system_as_kernel(0, pt, 3) # needs sage.modules [1] [0] [0] @@ -637,8 +636,8 @@ def _linear_system_as_kernel(self, d, pt, m): sage: P = ProjectiveSpace(GF(5), 2, names='x') sage: pt = P([1, 1, 1]) - sage: M = P._linear_system_as_kernel(2, pt, 0) # optional - sage.modules - sage: [M.nrows(), M.ncols()] # optional - sage.modules + sage: M = P._linear_system_as_kernel(2, pt, 0) # needs sage.modules + sage: [M.nrows(), M.ncols()] # needs sage.modules [0, 6] The base ring does not need to be a field or even an integral domain. @@ -647,7 +646,7 @@ def _linear_system_as_kernel(self, d, pt, m): sage: R = Zmod(4) sage: P = ProjectiveSpace(R, 2, names='x') sage: pt = [R(1), R(3), R(0)] - sage: P._linear_system_as_kernel(3, pt, 2) + sage: P._linear_system_as_kernel(3, pt, 2) # needs sage.modules [1 3 0 1 0 0 3 0 0 0] [0 1 0 2 0 0 3 0 0 0] [0 0 1 0 3 0 0 1 0 0] @@ -673,7 +672,7 @@ def _linear_system_as_kernel(self, d, pt, m): 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) # needs sage.modules [ 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] @@ -847,7 +846,7 @@ def _repr_(self): TESTS:: - sage: ProjectiveSpace(3, Zp(5), 'y')._repr_() # optional - sage.rings.padics + sage: ProjectiveSpace(3, Zp(5), 'y')._repr_() # needs 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()) @@ -920,9 +919,9 @@ def change_ring(self, R): :: - 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 + sage: K. = QuadraticField(2) # needs sage.rings.number_field + sage: P = ProjectiveSpace(K, 2, 't') # needs sage.rings.number_field + sage: P.change_ring(K.embeddings(QQbar)[0]) # needs sage.rings.number_field Projective Space of dimension 2 over Algebraic Field """ if isinstance(R, Map): @@ -964,9 +963,9 @@ def subscheme(self, X): 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 - sage: I.groebner_basis() + sage: I.groebner_basis() # needs sage.libs.singular [x*y^2, y^2*z, x*z^2] - sage: X.dimension() + sage: X.dimension() # needs sage.libs.singular 0 sage: X.base_ring() Rational Field @@ -1025,59 +1024,59 @@ def points_of_bounded_height(self, **kwds): :: sage: u = QQ['u'].0 - 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 + sage: P. = ProjectiveSpace(NumberField(u^2 - 2, 'v'), 2) # needs sage.rings.number_field + sage: len(list(P.points_of_bounded_height(bound=2))) # needs sage.rings.number_field 265 :: - 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 + sage: CF. = CyclotomicField(3) # needs sage.rings.number_field + sage: R. = CF[] # needs sage.rings.number_field + sage: L. = CF.extension(x^3 + 2) # needs sage.rings.number_field + sage: Q. = ProjectiveSpace(L, 1) # needs sage.rings.number_field + sage: sorted(list(Q.points_of_bounded_height(bound=1))) # needs 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) # 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 + sage: F. = NumberField(x^4 - 8*x^2 + 3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(F, 2) # needs sage.rings.number_field + sage: all(exp(p.global_height()) <= 1 # needs sage.rings.number_field sage.symbolic ....: for p in P.points_of_bounded_height(bound=1)) True :: - 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 + sage: K. = CyclotomicField(3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: len(list(P.points_of_bounded_height(bound=1))) # needs sage.rings.number_field 57 :: sage: u = QQ['u'].0 - 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 + sage: K. = NumberField(u^2 - 2) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: len(list(P.points_of_bounded_height(bound=2))) # needs sage.rings.number_field 24 :: sage: R. = QQ[] - 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 + sage: K. = NumberField(x^4 - 8*x^2 + 3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: len(list(P.points_of_bounded_height(bound=2))) # needs sage.rings.number_field 108 :: sage: R. = QQ[] - 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 + sage: K. = NumberField(x^5 + x^3 + 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: L = P.points_of_bounded_height(bound=1.2) # needs sage.rings.number_field + sage: len(list(L)) # needs sage.rings.number_field 109 :: @@ -1326,8 +1325,8 @@ def Lattes_map(self, E, m): EXAMPLES:: sage: P. = ProjectiveSpace(QQ, 1) - sage: E = EllipticCurve(QQ,[-1, 0]) - sage: P.Lattes_map(E, 2) + sage: E = EllipticCurve(QQ,[-1, 0]) # needs sage.schemes + sage: P.Lattes_map(E, 2) # needs sage.schemes Dynamical System of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y) to (1/4*x^4 + 1/2*x^2*y^2 + 1/4*y^4 : x^3*y - x*y^3) @@ -1335,8 +1334,8 @@ def Lattes_map(self, E, m): TESTS:: sage: P. = ProjectiveSpace(GF(37), 1) - sage: E = EllipticCurve([1, 1]) # optional - sage.rings.finite_rings sage.schemes - sage: f = P.Lattes_map(E, 2); f # optional - sage.rings.finite_rings sage.schemes + sage: E = EllipticCurve([1, 1]) # needs sage.rings.finite_rings sage.schemes + sage: f = P.Lattes_map(E, 2); f # needs sage.rings.finite_rings sage.schemes 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) @@ -1405,7 +1404,7 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): EXAMPLES:: sage: P. = ProjectiveSpace(QQ, 1) - sage: P.chebyshev_polynomial(5, 'first') + sage: P.chebyshev_polynomial(5, 'first') # needs sage.symbolic 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) @@ -1413,7 +1412,7 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): :: sage: P. = ProjectiveSpace(QQ, 1) - sage: P.chebyshev_polynomial(3, 'second') + sage: P.chebyshev_polynomial(3, 'second') # needs sage.symbolic 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) @@ -1421,7 +1420,7 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): :: sage: P. = ProjectiveSpace(QQ, 1) - sage: P.chebyshev_polynomial(3, 2) + sage: P.chebyshev_polynomial(3, 2) # needs sage.symbolic Traceback (most recent call last): ... ValueError: keyword 'kind' must have a value of either 'first' or 'second' @@ -1429,7 +1428,7 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): :: sage: P. = ProjectiveSpace(QQ, 1) - sage: P.chebyshev_polynomial(-4, 'second') + sage: P.chebyshev_polynomial(-4, 'second') # needs sage.symbolic Traceback (most recent call last): ... ValueError: first parameter 'n' must be a non-negative integer @@ -1437,7 +1436,7 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): :: sage: P = ProjectiveSpace(QQ, 2, 'x') - sage: P.chebyshev_polynomial(2) + sage: P.chebyshev_polynomial(2) # needs sage.symbolic Traceback (most recent call last): ... TypeError: projective space must be of dimension 1 @@ -1445,7 +1444,7 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): :: sage: P. = ProjectiveSpace(QQ, 1) - sage: P.chebyshev_polynomial(3, monic=True) + sage: P.chebyshev_polynomial(3, monic=True) # needs sage.symbolic Dynamical System of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y) to (x^3 - 3*x*y^2 : y^3) @@ -1454,7 +1453,7 @@ 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.chebyshev_polynomial(4, monic=True) # needs sage.symbolic 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 @@ -1495,8 +1494,8 @@ def veronese_embedding(self, d, CS=None, order='lex'): EXAMPLES:: sage: P. = ProjectiveSpace(QQ, 1) - sage: vd = P.veronese_embedding(4, order='invlex') # optional - sage.combinat - sage: vd + sage: vd = P.veronese_embedding(4, order='invlex') # needs sage.combinat + sage: vd # needs sage.combinat Scheme morphism: From: Projective Space of dimension 1 over Rational Field To: Projective Space of dimension 4 over Rational Field @@ -1507,14 +1506,14 @@ def veronese_embedding(self, d, CS=None, order='lex'): sage: P. = ProjectiveSpace(QQ, 2) sage: Q. = ProjectiveSpace(QQ, 5) - sage: vd = P.veronese_embedding(2, Q) # optional - sage.combinat - sage: vd + sage: vd = P.veronese_embedding(2, Q) # needs sage.combinat + sage: vd # needs sage.combinat Scheme morphism: From: Projective Space of dimension 2 over Rational Field To: Projective Space of dimension 5 over Rational Field Defn: Defined on coordinates by sending (x : y : z) to (x^2 : x*y : x*z : y^2 : y*z : z^2) - sage: vd(P.subscheme([])) + sage: vd(P.subscheme([])) # needs sage.combinat sage.libs.singular Closed subscheme of Projective Space of dimension 5 over Rational Field defined by: -u^2 + t*v, @@ -1577,11 +1576,11 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr 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 + sage: m = P1.point_transformation_matrix(points_source, points_target); m # needs sage.modules [ -13/59 -128/59 -25/59] [538/177 8/59 26/177] [ -45/59 -196/59 1] - sage: [m*points_source[i] == points_target[i] for i in range(4)] + sage: [m*points_source[i] == points_target[i] for i in range(4)] # needs sage.modules [True, True, True, True] :: @@ -1589,7 +1588,7 @@ 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) # optional - sage.modules + sage: P.point_transformation_matrix(points_source, points_target) # needs sage.modules [10 4] [10 1] @@ -1598,7 +1597,7 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr sage: P. = ProjectiveSpace(QQ, 1) sage: points_source = [P([-6, -4]), P([1, 4]), P([3, 2])] sage: points_target = [P([-1, 2]), P([0, 2]), P([-7, -3])] - sage: P.point_transformation_matrix(points_source, points_target) + sage: P.point_transformation_matrix(points_source, points_target) # needs sage.modules Traceback (most recent call last): ... ValueError: source points not independent @@ -1609,7 +1608,7 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr sage: P. = ProjectiveSpace(R, 1) 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) + sage: P.point_transformation_matrix(points_source, points_target) # needs sage.modules [ (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] @@ -1618,7 +1617,8 @@ 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.point_transformation_matrix(points_source, points_target) # abs tol 1e-13 + sage: P1.point_transformation_matrix(points_source, # abs tol 1e-13 # needs sage.modules + ....: points_target) [-0.0619047619047597 -0.609523809523810 -0.119047619047621] [ 0.853968253968253 0.0380952380952380 0.0412698412698421] [ -0.214285714285712 -0.933333333333333 0.280952380952379] @@ -1628,7 +1628,7 @@ 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.point_transformation_matrix(points_source, points_target) + sage: P1.point_transformation_matrix(points_source, points_target) # needs sage.modules [ -39 -384 -75] [ 538 24 26] [-135 -588 177] @@ -1638,7 +1638,8 @@ 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.point_transformation_matrix(points_source, points_target, normalize=False) + sage: P1.point_transformation_matrix(points_source, points_target, # needs sage.modules + ....: normalize=False) [-13/30 -64/15 -5/6] [269/45 4/15 13/45] [ -3/2 -98/15 59/30] @@ -1649,7 +1650,7 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr sage: P. = ProjectiveSpace(R, 1) 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) + sage: P.point_transformation_matrix(points_source, points_target) # needs sage.modules [ -48*t - 84 12*t + 21] [96*t^2 + 28*t + 420 -144*t^2 + 318*t] @@ -1658,7 +1659,7 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr sage: P. = ProjectiveSpace(QQ, 1) sage: points_source = [P([-6, -1]), P([1, 4]), P([3, 2])] sage: points_target = [P([-1, 2]), P([0, 2]), P([-2, 4])] - sage: P.point_transformation_matrix(points_source, points_target) + sage: P.point_transformation_matrix(points_source, points_target) # needs sage.modules Traceback (most recent call last): ... ValueError: target points not independent @@ -1668,7 +1669,7 @@ 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.point_transformation_matrix(points_source, points_target) + sage: P.point_transformation_matrix(points_source, points_target) # needs sage.modules Traceback (most recent call last): ... ValueError: incorrect number of points in source, need 4 points @@ -1678,7 +1679,7 @@ 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.point_transformation_matrix(points_source, points_target) + sage: P.point_transformation_matrix(points_source, points_target) # needs sage.modules Traceback (most recent call last): ... ValueError: incorrect number of points in target, need 4 points @@ -1689,7 +1690,7 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr 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) + sage: P.point_transformation_matrix(points_source, points_target) # needs sage.modules Traceback (most recent call last): ... ValueError: source points not in self @@ -1700,7 +1701,7 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr 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) + sage: P.point_transformation_matrix(points_source, points_target) # needs sage.modules Traceback (most recent call last): ... ValueError: target points not in self @@ -1710,7 +1711,8 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr 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, # needs sage.modules + ....: normalize=True) [ 0 -2 0] [-2 0 0] [ 0 1 1] @@ -1786,10 +1788,10 @@ def hyperplane_transformation_matrix(self, plane_1, plane_2): sage: P. = ProjectiveSpace(QQ, 1) sage: plane1 = P.subscheme(x) sage: plane2 = P.subscheme(y) - sage: m = P.hyperplane_transformation_matrix(plane1, plane2); m + sage: m = P.hyperplane_transformation_matrix(plane1, plane2); m # needs sage.modules [0 1] [1 0] - sage: plane2(m*P((0,1))) + sage: plane2(m*P((0,1))) # needs sage.modules (1 : 0) :: @@ -1797,7 +1799,7 @@ def hyperplane_transformation_matrix(self, plane_1, plane_2): sage: P. = ProjectiveSpace(QQ, 3) sage: plane1 = P.subscheme(x + 2*y + z) sage: plane2 = P.subscheme(2*x + y + z) - sage: P.hyperplane_transformation_matrix(plane1, plane2) + sage: P.hyperplane_transformation_matrix(plane1, plane2) # needs sage.modules [1 0 0 0] [0 4 0 0] [0 0 2 0] @@ -1808,18 +1810,17 @@ def hyperplane_transformation_matrix(self, plane_1, plane_2): sage: P. = ProjectiveSpace(ZZ, 1) sage: plane1 = P.subscheme(x + y) sage: plane2 = P.subscheme(y) - sage: P.hyperplane_transformation_matrix(plane1, plane2) + sage: P.hyperplane_transformation_matrix(plane1, plane2) # needs sage.modules [-1 0] [ 1 1] :: - 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 + sage: K. = CyclotomicField(3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: plane1 = P.subscheme(x - 2*v*y + z) # needs sage.rings.number_field + sage: plane2 = P.subscheme(x + v*y + v*z) # needs sage.rings.number_field + sage: m = P.hyperplane_transformation_matrix(plane1, plane2); m # needs sage.modules sage.rings.number_field [ v 0 0] [ 0 -2*v 0] [ 0 0 1] @@ -1827,11 +1828,11 @@ def hyperplane_transformation_matrix(self, plane_1, plane_2): :: sage: R. = QQ[] - 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 + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 3) # needs sage.rings.number_field + sage: plane1 = P.subscheme(k*x + 2*k*y + z) # needs sage.rings.number_field + sage: plane2 = P.subscheme(7*k*x + y + 9*z) # needs sage.rings.number_field + sage: m = P.hyperplane_transformation_matrix(plane1, plane2); m # needs sage.modules sage.rings.number_field [ 1 0 0 0] [ 0 14*k 0 0] [ 0 0 7/9 0] @@ -1839,15 +1840,15 @@ def hyperplane_transformation_matrix(self, plane_1, plane_2): :: - 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 + sage: K. = CyclotomicField(3) # needs sage.rings.number_field + sage: R. = K[] # needs sage.rings.number_field + sage: F. = K.extension(t^5 + 2) # needs sage.rings.number_field + sage: G. = F.absolute_field() # needs sage.rings.number_field + sage: P. = ProjectiveSpace(G, 2) # needs sage.rings.number_field + sage: plane1 = P.subscheme(x - 2*u*y + z) # needs sage.rings.number_field + sage: plane2 = P.subscheme(x + u*y + z) # needs sage.rings.number_field + sage: m = P.hyperplane_transformation_matrix(plane1, plane2) # needs sage.modules sage.rings.number_field + sage: plane2(m*P((2*u, 1, 0))) # needs sage.modules sage.rings.number_field (-u : 1 : 0) :: @@ -1855,7 +1856,7 @@ def hyperplane_transformation_matrix(self, plane_1, plane_2): 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) # optional - sage.modules + sage: P.hyperplane_transformation_matrix(plane1, plane2) # needs sage.modules [1 0 0] [1 1 0] [1 1 1] @@ -1866,7 +1867,7 @@ def hyperplane_transformation_matrix(self, plane_1, plane_2): sage: P. = ProjectiveSpace(R, 2) sage: plane1 = P.subscheme(x + 9*t*y + z) sage: plane2 = P.subscheme(x + z) - sage: P.hyperplane_transformation_matrix(plane1, plane2) + sage: P.hyperplane_transformation_matrix(plane1, plane2) # needs sage.modules [ 1 9*t 0] [ 1 0 0] [ 0 0 1] @@ -1876,7 +1877,7 @@ def hyperplane_transformation_matrix(self, plane_1, plane_2): sage: P. = ProjectiveSpace(QQ, 1) sage: plane1 = P.subscheme(x^2) sage: plane2 = P.subscheme(y) - sage: P.hyperplane_transformation_matrix(plane1, plane2) + sage: P.hyperplane_transformation_matrix(plane1, plane2) # needs sage.modules Traceback (most recent call last): ... ValueError: plane_1 must be defined by a single degree 1 equation @@ -1971,14 +1972,14 @@ def is_linearly_independent(self, points, n=None): sage: P. = ProjectiveSpace(QQ, 2) sage: points = [P((1, 0, 1)), P((1, 2, 1)), P((1, 3, 4))] - sage: P.is_linearly_independent(points) + sage: P.is_linearly_independent(points) # needs sage.modules True :: 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) # optional - sage.modules + sage: P.is_linearly_independent(points, 2) # needs sage.modules True :: @@ -1986,7 +1987,7 @@ def is_linearly_independent(self, points, n=None): 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: P.is_linearly_independent(points, 3) + sage: P.is_linearly_independent(points, 3) # needs sage.modules False :: @@ -1994,28 +1995,28 @@ 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: P.is_linearly_independent(points, 3) + sage: P.is_linearly_independent(points, 3) # needs sage.modules True :: - 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 + sage: K. = CyclotomicField(3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: points = [P((k, k^2, 1)), P((0, k, 1)), P((1, 0, 4)), P((0, 0, 1))] # needs sage.rings.number_field + sage: P.is_linearly_independent(points, 3) # needs sage.modules sage.rings.number_field True :: sage: P. = ProjectiveSpace(QQ, 1) sage: points = [P((1, 0)), P((1, 1))] - sage: P.is_linearly_independent(points) + sage: P.is_linearly_independent(points) # needs sage.modules True TESTS:: sage: points = [P(1, 0), P(1, 1), P(2, 1)] - sage: P.is_linearly_independent(points, 5) + sage: P.is_linearly_independent(points, 5) # needs sage.modules Traceback (most recent call last): ... ValueError: n must be a non negative integer not greater than the length of points @@ -2119,7 +2120,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) # needs sage.libs.gap Closed subscheme of Projective Space of dimension 4 over Rational Field defined by: -5*z0*z1 + z2^2 + z3^2 @@ -2128,7 +2129,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: P.subscheme_from_Chow_form(H, 1) + sage: P.subscheme_from_Chow_form(H, 1) # needs sage.libs.gap Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: -z1 + z3, @@ -2140,9 +2141,9 @@ 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 # optional - sage.rings.finite_rings + sage: Ch = X.Chow_form(); Ch # needs 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 + sage: Y = P.subscheme_from_Chow_form(Ch, 1); Y # needs sage.libs.gap sage.rings.finite_rings Closed subscheme of Projective Space of dimension 3 over Finite Field of size 7 defined by: x1*x2 + x3^2, @@ -2153,8 +2154,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() # optional - sage.rings.finite_rings - sage: I.saturation(I.ring().ideal(list(I.ring().gens())))[0] # optional - sage.rings.finite_rings + sage: I = Y.defining_ideal() # needs sage.libs.gap sage.rings.finite_rings + sage: I.saturation(I.ring().ideal(list(I.ring().gens())))[0] # needs sage.libs.gap 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 """ @@ -2214,7 +2215,7 @@ def curve(self, F): EXAMPLES:: sage: P. = ProjectiveSpace(QQ, 2) - sage: P.curve([y^2 - x*z]) + sage: P.curve([y^2 - x*z]) # needs sage.schemes Projective Plane Curve over Rational Field defined by y^2 - x*z """ from sage.schemes.curves.constructor import Curve @@ -2233,7 +2234,7 @@ def line_through(self, p, q): sage: P3. = ProjectiveSpace(3, QQ) sage: p1 = P3(1, 2, 3, 4) sage: p2 = P3(4, 3, 2, 1) - sage: P3.line_through(p1, p2) + sage: P3.line_through(p1, p2) # needs sage.schemes 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 @@ -2351,7 +2352,7 @@ def rational_points(self, F=None): sage: P = ProjectiveSpace(1, GF(3)) sage: P.rational_points() [(0 : 1), (1 : 1), (2 : 1), (1 : 0)] - sage: P.rational_points(GF(3^2, 'b')) # optional - sage.rings.finite_rings + sage: P.rational_points(GF(3^2, 'b')) # needs 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)] """ From 9794b7150ac1c2daf46141951a6e6c08238dfebd Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 29 Jun 2023 19:52:11 -0700 Subject: [PATCH 030/423] sage.schemes: Update # needs --- src/sage/schemes/generic/divisor_group.py | 6 +++--- src/sage/schemes/projective/projective_space.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sage/schemes/generic/divisor_group.py b/src/sage/schemes/generic/divisor_group.py index d066ba84633..1a6cc6ca6b6 100644 --- a/src/sage/schemes/generic/divisor_group.py +++ b/src/sage/schemes/generic/divisor_group.py @@ -229,9 +229,9 @@ def base_extend(self, R): 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: A. = AffineSpace(2, CC) # optional - sage.rings.real_mpfr + sage: C = Curve(y^2 - x^9 - x) # optional - sage.rings.real_mpfr + sage: DivisorGroup(C, ZZ).base_extend(QQ) is DivisorGroup(C, QQ) # optional - sage.rings.real_mpfr True """ if self.base_ring().has_coerce_map_from(R): diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index 087b60df508..a0791ba9557 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -2120,7 +2120,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) # needs sage.libs.gap + 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 @@ -2129,7 +2129,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: P.subscheme_from_Chow_form(H, 1) # needs sage.libs.gap + sage: P.subscheme_from_Chow_form(H, 1) Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: -z1 + z3, @@ -2143,7 +2143,7 @@ def subscheme_from_Chow_form(self, Ch, dim): sage: X = P.subscheme([x3^2 + x1*x2, x2 - x0]) sage: Ch = X.Chow_form(); Ch # needs 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 # needs sage.libs.gap sage.rings.finite_rings + sage: Y = P.subscheme_from_Chow_form(Ch, 1); Y # needs sage.rings.finite_rings Closed subscheme of Projective Space of dimension 3 over Finite Field of size 7 defined by: x1*x2 + x3^2, @@ -2154,8 +2154,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() # needs sage.libs.gap sage.rings.finite_rings - sage: I.saturation(I.ring().ideal(list(I.ring().gens())))[0] # needs sage.libs.gap sage.rings.finite_rings + sage: I = Y.defining_ideal() # needs sage.rings.finite_rings + sage: I.saturation(I.ring().ideal(list(I.ring().gens())))[0] # needs 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 """ From 465ac196f6964f02f8f8106e02d27612f4b69147 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 29 Jun 2023 20:01:42 -0700 Subject: [PATCH 031/423] src/sage/schemes/product_projective/space.py: Update # needs --- src/sage/schemes/product_projective/space.py | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/sage/schemes/product_projective/space.py b/src/sage/schemes/product_projective/space.py index 6dd0b237965..17a5580ebb0 100644 --- a/src/sage/schemes/product_projective/space.py +++ b/src/sage/schemes/product_projective/space.py @@ -848,7 +848,7 @@ def subscheme(self, X): sage: I = X.defining_ideal(); I 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 + sage: X.dimension() # needs sage.rings.finite_rings 0 sage: X.base_ring() Finite Field of size 5 @@ -977,7 +977,7 @@ def segre_embedding(self, PP=None, var='u'): EXAMPLES:: sage: X. = ProductProjectiveSpaces(ZZ, [2, 2]) - sage: phi = X.segre_embedding(); phi + sage: phi = X.segre_embedding(); phi # needs sage.libs.singular 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 @@ -990,8 +990,8 @@ def segre_embedding(self, PP=None, var='u'): :: - sage: T = ProductProjectiveSpaces([1, 2], CC, 'z') - sage: T.segre_embedding() + sage: T = ProductProjectiveSpaces([1, 2], CC, 'z') # needs sage.rings.real_mpfr + sage: T.segre_embedding() # needs sage.libs.singular sage.rings.real_mpfr Scheme morphism: From: Product of projective spaces P^1 x P^2 over Complex Field with 53 bits of precision @@ -1004,7 +1004,7 @@ def segre_embedding(self, PP=None, var='u'): :: sage: T = ProductProjectiveSpaces([1, 2, 1], QQ, 'z') - sage: T.segre_embedding() + sage: T.segre_embedding() # needs sage.libs.singular 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 @@ -1088,9 +1088,9 @@ def _point(self, *args, **kwds): EXAMPLES:: sage: u = QQ['u'].0 - 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 + sage: K = NumberField(u^2 - 2, 'v') # needs sage.rings.number_field + sage: P = ProductProjectiveSpaces([1, 2], K, 'x') # needs sage.rings.number_field + sage: P([1, 3, u, 1, 1]) # needs sage.rings.number_field (1/3 : 1 , v : 1 : 1) """ return ProductProjectiveSpaces_point_field(*args, **kwds) @@ -1163,8 +1163,8 @@ def points_of_bounded_height(self, **kwds): :: 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 + sage: P = ProductProjectiveSpaces([1, 1], NumberField(u^2 - 2, 'v')) # needs sage.rings.number_field + sage: sorted(list(P.points_of_bounded_height(bound=1.5))) # needs 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), @@ -1282,7 +1282,7 @@ def rational_points(self, F=None): :: sage: P = ProductProjectiveSpaces([1, 1], GF(2)) - sage: P.rational_points(GF(2^2, 'a')) # optional - sage.rings.finite_rings + sage: P.rational_points(GF(2^2, 'a')) # needs 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), From 63eef51bb1cdf0e0d58908b2fba31a6a89f60aa4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 30 Jun 2023 17:46:06 -0700 Subject: [PATCH 032/423] Update # optional/needs --- src/sage/schemes/projective/projective_space.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index a0791ba9557..e04539a841f 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -658,7 +658,7 @@ def _linear_system_as_kernel(self, d, pt, m): 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: P._linear_system_as_kernel(3, pt, 2) # needs sage.modules Traceback (most recent call last): ... TypeError: at least one component of pt=[3, 3, 0] must be equal to 1 @@ -2120,7 +2120,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) # needs sage.modules Closed subscheme of Projective Space of dimension 4 over Rational Field defined by: -5*z0*z1 + z2^2 + z3^2 @@ -2129,7 +2129,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: P.subscheme_from_Chow_form(H, 1) + sage: P.subscheme_from_Chow_form(H, 1) # needs sage.modules Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: -z1 + z3, From fcf3f7c9cdec83bb458fb791d207bf03d8ca019e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 1 Jul 2023 15:42:59 -0700 Subject: [PATCH 033/423] More optional / # needs --- src/sage/schemes/affine/affine_point.py | 6 +++--- src/sage/schemes/product_projective/homset.py | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/sage/schemes/affine/affine_point.py b/src/sage/schemes/affine/affine_point.py index c237d376189..88f74efee2a 100644 --- a/src/sage/schemes/affine/affine_point.py +++ b/src/sage/schemes/affine/affine_point.py @@ -158,9 +158,9 @@ def __hash__(self): :: - sage: A. = AffineSpace(CC, 3) - sage: pt = A([1, 2, -i]) - sage: hash(pt) == hash(tuple(pt)) + sage: A. = AffineSpace(CC, 3) # optional - sage.rings.real_mpfr + sage: pt = A([1, 2, -i]) # optional - sage.rings.real_mpfr sage.symbolic + sage: hash(pt) == hash(tuple(pt)) # optional - sage.rings.real_mpfr sage.symbolic True """ diff --git a/src/sage/schemes/product_projective/homset.py b/src/sage/schemes/product_projective/homset.py index ff05f539b1e..9bd1fd4277b 100644 --- a/src/sage/schemes/product_projective/homset.py +++ b/src/sage/schemes/product_projective/homset.py @@ -104,7 +104,7 @@ def points(self, **kwds): sage: P. = ProductProjectiveSpaces([1, 1], QQ) sage: X = P.subscheme([x - y, z^2 - 2*w^2]) - sage: X(P.base_ring()).points() + sage: X(P.base_ring()).points() # optional - sage.libs.singular [] :: @@ -113,7 +113,7 @@ def points(self, **kwds): 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 + sage: sorted(X(P.base_ring()).points()) # optional - sage.libs.singular sage.rings.number_field [(-1 : 1 , -v : 1), (-1 : 1 , v : 1), (1 : 1 , -v : 1), (1 : 1 , v : 1)] :: @@ -121,7 +121,7 @@ def points(self, **kwds): sage: u = QQ['u'].0 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 + sage: P(K).points(bound=1) # optional - sage.libs.singular 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), @@ -135,7 +135,7 @@ def points(self, **kwds): :: sage: P. = ProductProjectiveSpaces([2, 1], GF(3)) - sage: P(P.base_ring()).points() + sage: P(P.base_ring()).points() # optional - sage.libs.singular [(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), @@ -154,7 +154,7 @@ def points(self, **kwds): sage: PP. = ProductProjectiveSpaces([2, 1], QQ) sage: X = PP.subscheme([x + y, u*u - v*u]) - sage: X.rational_points(bound=2) + sage: X.rational_points(bound=2) # optional - sage.libs.singular [(-2 : 2 : 1 , 0 : 1), (-2 : 2 : 1 , 1 : 1), (-1 : 1 : 0 , 0 : 1), @@ -176,7 +176,7 @@ def points(self, **kwds): 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')) + sage: len(X.rational_points(bound=1, algorithm='enumerate')) # optional - sage.libs.singular 232 """ B = kwds.pop('bound', 0) From a4013636535676b3bba3a8779cd576c695c8c8f3 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 2 Jul 2023 01:02:55 -0700 Subject: [PATCH 034/423] sage.schemes: Update # optional / # needs --- src/sage/schemes/affine/affine_homset.py | 6 +- src/sage/schemes/elliptic_curves/Qcurves.py | 86 +- .../schemes/elliptic_curves/cardinality.py | 2 +- src/sage/schemes/elliptic_curves/cm.py | 30 +- .../schemes/elliptic_curves/constructor.py | 76 +- .../elliptic_curves/ell_curve_isogeny.py | 1315 ++++++++--------- src/sage/schemes/elliptic_curves/ell_field.py | 487 +++--- .../elliptic_curves/ell_finite_field.py | 2 +- .../schemes/elliptic_curves/ell_generic.py | 464 +++--- .../elliptic_curves/ell_modular_symbols.py | 4 +- .../elliptic_curves/ell_number_field.py | 2 +- src/sage/schemes/elliptic_curves/ell_point.py | 1029 ++++++------- .../elliptic_curves/ell_rational_field.py | 20 +- src/sage/schemes/elliptic_curves/ell_wp.py | 46 +- .../schemes/elliptic_curves/formal_group.py | 26 +- src/sage/schemes/elliptic_curves/heegner.py | 8 +- src/sage/schemes/elliptic_curves/height.py | 260 ++-- .../schemes/elliptic_curves/hom_composite.py | 318 ++-- .../schemes/elliptic_curves/hom_frobenius.py | 2 +- .../schemes/elliptic_curves/isogeny_class.py | 2 +- .../elliptic_curves/isogeny_small_degree.py | 320 ++-- .../schemes/elliptic_curves/lseries_ell.py | 20 +- .../modular_parametrization.py | 10 +- .../schemes/elliptic_curves/period_lattice.py | 474 +++--- .../schemes/elliptic_curves/saturation.py | 2 +- .../elliptic_curves/weierstrass_morphism.py | 94 +- src/sage/schemes/generic/divisor_group.py | 9 +- src/sage/schemes/generic/morphism.py | 2 +- .../schemes/projective/projective_homset.py | 1 + 29 files changed, 2557 insertions(+), 2560 deletions(-) diff --git a/src/sage/schemes/affine/affine_homset.py b/src/sage/schemes/affine/affine_homset.py index 4b7a3547361..77e647edd16 100644 --- a/src/sage/schemes/affine/affine_homset.py +++ b/src/sage/schemes/affine/affine_homset.py @@ -253,9 +253,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() + sage: A. = AffineSpace(CDF, 2) # optional - sage.rings.complex_double + sage: E = A.subscheme([x1^2 + x2^2 + x1*x2, x1 + x2]) # optional - sage.libs.singular sage.rings.complex_double + sage: E(A.base_ring()).points() # optional - sage.libs.singular sage.rings.complex_double verbose 0 (...: affine_homset.py, points) Warning: computations in the numerical fields are inexact;points may be computed partially or incorrectly. diff --git a/src/sage/schemes/elliptic_curves/Qcurves.py b/src/sage/schemes/elliptic_curves/Qcurves.py index df577822cc2..c9ad15fa9ed 100644 --- a/src/sage/schemes/elliptic_curves/Qcurves.py +++ b/src/sage/schemes/elliptic_curves/Qcurves.py @@ -130,10 +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])) # 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 + sage: K. = NumberField(R([3, 0, -5, 0, 1])) # needs sage.rings.number_field + sage: E = EllipticCurve([K([-3,-4,1,1]), K([4,-1,-1,0]), K([-2,0,1,0]), # needs 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 + sage: is_Q_curve(E, certificate=True, verbose=True) # needs 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] @@ -143,10 +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])) # optional - sage.rings.number_field - sage: E = EllipticCurve([K([0,1]), K([-1,-1]), K([0,0]), # optional - sage.rings.number_field + sage: K. = NumberField(R([-10, 0, 1])) # needs sage.rings.number_field + sage: E = EllipticCurve([K([0,1]), K([-1,-1]), K([0,0]), # needs sage.rings.number_field ....: K([-236,40]), K([-1840,464])]) - sage: is_Q_curve(E, certificate=True, verbose=True) # optional - sage.rings.number_field + sage: is_Q_curve(E, certificate=True, verbose=True) # needs 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 @@ -158,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])) # 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 + sage: K. = NumberField(R([-1, -1, 1])) # needs sage.rings.number_field + sage: E = EllipticCurve([K([1,0]), K([-1,0]), K([0,1]), K([0,-2]), K([0,1])]) # needs sage.rings.number_field + sage: is_Q_curve(E, certificate=True, verbose=True) # needs 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}) @@ -170,14 +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])) # 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 + sage: K. = NumberField(R([1, 0, -4, 0, 1])) # needs sage.rings.number_field + sage: E = EllipticCurve([K([-2,-4,1,1]), K([0,1,0,0]), K([0,1,0,0]), # needs 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 + sage: flag, cert = is_Q_curve(E, certificate=True) # needs sage.rings.number_field + sage: flag # needs sage.rings.number_field True - sage: cert # optional - sage.rings.number_field + sage: cert # needs 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 @@ -187,12 +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]), # optional - sage.rings.number_field + sage: E = EllipticCurve([K([0,-3,0,1]), K([1,4,0,-1]), K([0,0,0,0]), # needs 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 + sage: flag, cert = is_Q_curve(E, certificate=True) # needs sage.rings.number_field + sage: flag # needs sage.rings.number_field True - sage: cert # optional - sage.rings.number_field + sage: cert # needs sage.rings.number_field {'CM': 0, 'N': 2, 'core_degs': [1, 2], @@ -202,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]]) # optional - sage.rings.finite_rings - sage: is_Q_curve(E) # optional - sage.rings.finite_rings + sage: E = EllipticCurve([GF(5)(t) for t in [2,3,5,7,11]]) # needs sage.rings.finite_rings + sage: is_Q_curve(E) # needs sage.rings.finite_rings Traceback (most recent call last): ... TypeError: Elliptic Curve defined by ... must be an elliptic curve @@ -431,10 +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])) # 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 + sage: K. = NumberField(R([3, 0, -5, 0, 1])) # needs sage.rings.number_field + sage: E = EllipticCurve([K([-3,-4,1,1]), K([4,-1,-1,0]), K([-2,0,1,0]), # needs 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 + sage: Step4Test(E, 100, verbose=True) # needs sage.rings.number_field No: inconsistency at the 2 ordinary primes dividing 13 - Frobenius discriminants mod squares: [-3, -1] (False, 13) @@ -444,11 +444,11 @@ 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])) # optional - sage.rings.number_field - sage: E = EllipticCurve([K([1,-3,0,1,0,0]), K([5,-3,-6,1,1,0]), + sage: K. = NumberField(R([-3, 0, 9, 0, -6, 0, 1])) # needs sage.rings.number_field + sage: E = EllipticCurve([K([1,-3,0,1,0,0]), K([5,-3,-6,1,1,0]), # needs sage.rings.number_field ....: 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) + sage: Step4Test(E, 100, verbose=True) # needs sage.rings.number_field (True, 0) """ from sage.arith.misc import primes @@ -509,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) # optional - sage.rings.number_field - sage: conjugacy_test([K(3), a]) # optional - sage.rings.number_field + sage: K. = QuadraticField(2) # needs sage.rings.number_field + sage: conjugacy_test([K(3), a]) # needs sage.rings.number_field [x - 3] - sage: conjugacy_test([K(3), 3 + a]) # optional - sage.rings.number_field + sage: conjugacy_test([K(3), 3 + a]) # needs sage.rings.number_field [x - 3] - sage: conjugacy_test([3 + a]) # optional - sage.rings.number_field + sage: conjugacy_test([3 + a]) # needs sage.rings.number_field [] - sage: conjugacy_test([3 + a, 3 - a]) # optional - sage.rings.number_field + sage: conjugacy_test([3 + a, 3 - a]) # needs sage.rings.number_field [x^2 - 6*x + 7] - 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: x = polygen(QQ) # needs sage.rings.number_field + sage: f = x^3 - 3 # needs sage.rings.number_field + sage: K. = f.splitting_field() # needs sage.rings.number_field + sage: js = f.roots(K, multiplicities=False) # needs sage.rings.number_field + sage: conjugacy_test(js) # needs sage.rings.number_field [] - 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: f = x^4 - 3 # needs sage.rings.number_field + sage: K. = NumberField(f) # needs sage.rings.number_field + sage: js = f.roots(K, multiplicities=False) # needs sage.rings.number_field + sage: conjugacy_test(js) # needs sage.rings.number_field [] - 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: K. = f.splitting_field() # needs sage.rings.number_field + sage: js = f.roots(K, multiplicities=False) # needs sage.rings.number_field + sage: conjugacy_test(js) # needs 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 2a73de71a50..d871355c20a 100644 --- a/src/sage/schemes/elliptic_curves/cardinality.py +++ b/src/sage/schemes/elliptic_curves/cardinality.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.finite_rings +# sage.doctest: needs sage.rings.finite_rings """ Specific algorithms to compute cardinality of elliptic curves over a finite field diff --git a/src/sage/schemes/elliptic_curves/cm.py b/src/sage/schemes/elliptic_curves/cm.py index f70f20a69d7..fdf3cd63d66 100644 --- a/src/sage/schemes/elliptic_curves/cm.py +++ b/src/sage/schemes/elliptic_curves/cm.py @@ -350,25 +350,25 @@ def cm_j_invariants(K, proof=None): Over imaginary quadratic fields there are no more than over `QQ`:: - sage: cm_j_invariants(QuadraticField(-1, 'i')) # optional - sage.rings.number_field + sage: cm_j_invariants(QuadraticField(-1, 'i')) # needs 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'))) # optional - sage.rings.number_field + sage: len(cm_j_invariants(QuadraticField(5, 'a'))) # needs sage.rings.number_field 31 Over number fields K of many higher degrees this also works:: sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field - sage: cm_j_invariants(K) # optional - sage.rings.number_field + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: cm_j_invariants(K) # needs 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) # optional - sage.rings.number_field - sage: len(cm_j_invariants(K)) # optional - sage.rings.number_field + sage: K. = NumberField(x^4 - 2) # needs sage.rings.number_field + sage: len(cm_j_invariants(K)) # needs sage.rings.number_field 23 """ return sorted(j for D, f, j in cm_j_invariants_and_orders(K, proof=proof)) @@ -400,7 +400,7 @@ def cm_j_invariants_and_orders(K, proof=None): Over an imaginary quadratic field there are no more than over `QQ`:: - sage: cm_j_invariants_and_orders(QuadraticField(-1, 'i')) # optional - sage.rings.number_field + sage: cm_j_invariants_and_orders(QuadraticField(-1, 'i')) # needs 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), @@ -408,9 +408,9 @@ 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) # optional - sage.rings.number_field + sage: v = cm_j_invariants_and_orders(QuadraticField(5,'a')); len(v) # needs sage.rings.number_field 31 - sage: [(D, f) for D, f, j in v if j not in QQ] # optional - sage.rings.number_field + sage: [(D, f) for D, f, j in v if j not in QQ] # needs 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)] @@ -418,8 +418,8 @@ def cm_j_invariants_and_orders(K, proof=None): Over number fields K of many higher degrees this also works:: sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field - sage: cm_j_invariants_and_orders(K) # optional - sage.rings.number_field + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: cm_j_invariants_and_orders(K) # needs 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), @@ -920,12 +920,12 @@ def is_cm_j_invariant(j, algorithm='CremonaSutherland', method=None): sage: is_cm_j_invariant(8000) (True, (-8, 1)) - sage: K. = QuadraticField(5) # optional - sage.rings.number_field - sage: is_cm_j_invariant(282880*a + 632000) # optional - sage.rings.number_field + sage: K. = QuadraticField(5) # needs sage.rings.number_field + sage: is_cm_j_invariant(282880*a + 632000) # needs sage.rings.number_field (True, (-20, 1)) sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: is_cm_j_invariant(31710790944000*a^2 + 39953093016000*a + 50337742902000) # needs 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 ca210ca6e2b..205cafbc9e8 100644 --- a/src/sage/schemes/elliptic_curves/constructor.py +++ b/src/sage/schemes/elliptic_curves/constructor.py @@ -115,9 +115,9 @@ class EllipticCurveFactory(UniqueFactory): We create curves over a finite field as follows:: - sage: EllipticCurve([GF(5)(0),0,1,-1,0]) # optional - sage.rings.finite_rings + sage: EllipticCurve([GF(5)(0),0,1,-1,0]) # needs 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]) # optional - sage.rings.finite_rings + sage: EllipticCurve(GF(5), [0, 0,1,-1,0]) # needs 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 @@ -159,8 +159,8 @@ 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)[] # optional - sage.rings.finite_rings - sage: EllipticCurve(x^3 + x^2 + 2 - y^2 - y*x) # optional - sage.rings.finite_rings + sage: R. = GF(5)[] # needs sage.rings.finite_rings + sage: EllipticCurve(x^3 + x^2 + 2 - y^2 - y*x) # needs 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:: @@ -178,13 +178,13 @@ class EllipticCurveFactory(UniqueFactory): 1728 '32a2' - sage: E = EllipticCurve(j=GF(5)(2)); E; E.j_invariant() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(j=GF(5)(2)); E; E.j_invariant() # needs 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) # optional - sage.rings.finite_rings + sage: EllipticCurve(GF(144169), j=1728) # needs 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 @@ -231,10 +231,10 @@ class EllipticCurveFactory(UniqueFactory): We create a curve and a point over ``QQbar`` (see :trac:`6879`):: - sage: E = EllipticCurve(QQbar, [0,1]) # optional - sage.rings.number_field - sage: E(0) # optional - sage.rings.number_field + sage: E = EllipticCurve(QQbar, [0,1]) # needs sage.rings.number_field + sage: E(0) # needs sage.rings.number_field (0 : 1 : 0) - sage: E.base_field() # optional - sage.rings.number_field + sage: E.base_field() # needs sage.rings.number_field Algebraic Field sage: E = EllipticCurve(RR, [1,2]); E; E.base_field() @@ -245,7 +245,7 @@ class EllipticCurveFactory(UniqueFactory): 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 + sage: E = EllipticCurve(QQbar, [5,6]); E; E.base_field() # needs sage.rings.number_field Elliptic Curve defined by y^2 = x^3 + 5*x + 6 over Algebraic Field Algebraic Field @@ -256,7 +256,7 @@ class EllipticCurveFactory(UniqueFactory): ... ValueError: First parameter (if present) must be a ring when j is specified - sage: EllipticCurve(GF(5), j=3/5) # optional - sage.rings.finite_rings + sage: EllipticCurve(GF(5), j=3/5) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: First parameter must be a ring containing 3/5 @@ -265,9 +265,9 @@ class EllipticCurveFactory(UniqueFactory): constructed has type :class:`EllipticCurve_field`. Otherwise it is :class:`EllipticCurve_generic`. See :trac:`9816` :: - sage: E = EllipticCurve([QQbar(1), 3]); E # optional - sage.rings.number_field + sage: E = EllipticCurve([QQbar(1), 3]); E # needs sage.rings.number_field Elliptic Curve defined by y^2 = x^3 + x + 3 over Algebraic Field - sage: type(E) # optional - sage.rings.number_field + sage: type(E) # needs sage.rings.number_field sage: E = EllipticCurve([RR(1), 3]); E @@ -276,13 +276,13 @@ class EllipticCurveFactory(UniqueFactory): sage: type(E) - sage: E = EllipticCurve([SR(i),i]); E # optional - sage.symbolic + sage: E = EllipticCurve([SR(i),i]); E # needs sage.symbolic Elliptic Curve defined by y^2 = x^3 + I*x + I over Symbolic Ring - sage: type(E) # optional - sage.symbolic + sage: type(E) # needs sage.symbolic - sage: E.category() # optional - sage.symbolic + sage: E.category() # needs sage.symbolic Category of schemes over Symbolic Ring - sage: SR in Fields() # optional - sage.symbolic + sage: SR in Fields() # needs sage.symbolic True sage: F = FractionField(PolynomialRing(QQ,'t')) @@ -389,17 +389,17 @@ def create_key_and_extra_args(self, x=None, y=None, j=None, minimal_twist=True, TESTS:: - sage: var('x', 'y', 'v', 'w') + sage: var('x', 'y', 'v', 'w') # needs sage.symbolic (x, y, v, w) - sage: EllipticCurve(y^2 + y > x^3 + x - 9) + sage: EllipticCurve(y^2 + y > x^3 + x - 9) # needs sage.symbolic Traceback (most recent call last): ... ValueError: no symbolic relations other than equalities are allowed - sage: E = EllipticCurve(y^2 + y == x^3 + x - 9) - sage: E is EllipticCurve(y^2 + y - ( x^3 + x - 9 )) + sage: E = EllipticCurve(y^2 + y == x^3 + x - 9) # needs sage.symbolic + sage: E is EllipticCurve(y^2 + y - ( x^3 + x - 9 )) # needs sage.symbolic True sage: R. = QQ[] - sage: E is EllipticCurve(y^2 + y - ( x^3 + x - 9 )) + sage: E is EllipticCurve(y^2 + y - ( x^3 + x - 9 )) # needs sage.symbolic True """ R = None @@ -461,8 +461,8 @@ def create_object(self, version, key, **kwds): EXAMPLES:: - 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 + sage: E = EllipticCurve.create_object(0, (GF(3), (1, 2, 0, 1, 2))) # needs sage.rings.finite_rings + sage: type(E) # needs sage.rings.finite_rings .. NOTE:: @@ -1019,10 +1019,10 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): An example over a finite field, using a flex:: - 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 + sage: K = GF(17) # needs sage.rings.finite_rings + sage: R. = K[] # needs sage.rings.finite_rings + sage: cubic = 2*x^3 + 3*y^3 + 4*z^3 # needs sage.rings.finite_rings + sage: EllipticCurve_from_cubic(cubic, [0,3,1]) # needs 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 @@ -1032,10 +1032,10 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): An example in characteristic 3:: - 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 + sage: K = GF(3) # needs sage.rings.finite_rings + sage: R. = K[] # needs sage.rings.finite_rings + sage: cubic = x^3 + y^3 + z^3 + x*y*z # needs sage.rings.finite_rings + sage: EllipticCurve_from_cubic(cubic, [0,1,-1]) # needs 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 @@ -1045,10 +1045,10 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): An example over a number field, using a non-flex and where there are no rational flexes:: - 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 + sage: K. = QuadraticField(-3) # needs sage.rings.number_field + sage: R. = K[] # needs sage.rings.number_field + sage: cubic = 2*x^3 + 3*y^3 + 5*z^3 # needs sage.rings.number_field + sage: EllipticCurve_from_cubic(cubic, [1,1,-1]) # needs 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 @@ -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) # optional - sage.rings.finite_rings - sage: projective_point([F(4), F(8), F(2)]) # optional - sage.rings.finite_rings + sage: F = GF(11) # needs sage.rings.finite_rings + sage: projective_point([F(4), F(8), F(2)]) # needs sage.rings.finite_rings [4, 8, 2] """ from sage.rings.integer import GCD_list diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index e5e35f2a139..ea6b9f1b559 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -13,21 +13,21 @@ The usual way to create and work with isogenies is illustrated with the following example:: - 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 + sage: k = GF(11) # needs sage.rings.finite_rings + sage: E = EllipticCurve(k, [1,1]) # needs sage.rings.finite_rings + sage: Q = E(6,5) # needs sage.rings.finite_rings + sage: phi = E.isogeny(Q) # needs sage.rings.finite_rings + sage: phi # needs 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) # optional - sage.rings.finite_rings - sage: phi(P) # optional - sage.rings.finite_rings + sage: P = E(4,5) # needs sage.rings.finite_rings + sage: phi(P) # needs sage.rings.finite_rings (10 : 0 : 1) - sage: phi.codomain() # optional - sage.rings.finite_rings + sage: phi.codomain() # needs 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 + sage: phi.rational_maps() # needs 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 @@ -127,32 +127,32 @@ def _isogeny_determine_algorithm(E, kernel): This helper function will be implicitly called by the following examples:: - 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 + sage: R. = GF(5)[] # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(5), [0,0,0,1,0]) # indirect doctest # needs sage.rings.finite_rings We can construct the same isogeny from a kernel polynomial:: - sage: phi = EllipticCurveIsogeny(E, x + 3) # indirect doctest # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x + 3) # indirect doctest # needs sage.rings.finite_rings or from a list of coefficients of a kernel polynomial:: - sage: phi == EllipticCurveIsogeny(E, [3,1]) # indirect doctest # optional - sage.rings.finite_rings + sage: phi == EllipticCurveIsogeny(E, [3,1]) # indirect doctest # needs sage.rings.finite_rings True or from a rational point which generates the kernel:: - sage: phi == EllipticCurveIsogeny(E, E((2,0))) # indirect doctest # optional - sage.rings.finite_rings + sage: phi == EllipticCurveIsogeny(E, E((2,0))) # indirect doctest # needs 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) # optional - sage.rings.finite_rings + sage: _isogeny_determine_algorithm(E, x + 3) # needs sage.rings.finite_rings 'kohel' - sage: _isogeny_determine_algorithm(E, [3, 1]) # optional - sage.rings.finite_rings + sage: _isogeny_determine_algorithm(E, [3, 1]) # needs sage.rings.finite_rings 'kohel' - sage: _isogeny_determine_algorithm(E, E((2,0))) # optional - sage.rings.finite_rings + sage: _isogeny_determine_algorithm(E, E((2,0))) # needs sage.rings.finite_rings 'velu' """ kernel_is_list = isinstance(kernel, list) @@ -194,24 +194,24 @@ 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]) # 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 + sage: E = EllipticCurve(GF(7), [1,0,1,0,1]) # needs sage.rings.finite_rings + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: isogeny_codomain_from_kernel(E, [4,1]) # needs 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 + sage: (EllipticCurveIsogeny(E, [4,1]).codomain() # needs 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 + sage: isogeny_codomain_from_kernel(E, x^3 + x^2 + 4*x + 3) # needs 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 + sage: isogeny_codomain_from_kernel(E, x^3 + 2*x^2 + 4*x + 3) # needs 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 + sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: kernel_list = [E((15,10)), E((10,3)), E((6,5))] # needs sage.rings.finite_rings + sage: isogeny_codomain_from_kernel(E, kernel_list) # needs 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 @@ -219,7 +219,7 @@ def isogeny_codomain_from_kernel(E, kernel, degree=None): Test deprecation warning for obsolete argument:: - sage: isogeny_codomain_from_kernel(E, kernel_list, degree=4) # optional - sage.rings.finite_rings + sage: isogeny_codomain_from_kernel(E, kernel_list, degree=4) # needs sage.rings.finite_rings doctest:warning ... DeprecationWarning: The "degree" argument to isogeny_codomain_from_kernel() does nothing and will be removed. @@ -265,15 +265,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]) # 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 + sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((1,2)) ) # needs sage.rings.finite_rings + sage: phi.codomain() # needs 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 # 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 + sage: v = phi._EllipticCurveIsogeny__v # needs sage.rings.finite_rings + sage: w = phi._EllipticCurveIsogeny__w # needs sage.rings.finite_rings + sage: compute_codomain_formula(E, v, w) == phi.codomain() # needs sage.rings.finite_rings True """ a1, a2, a3, a4, a6 = E.a_invariants() @@ -302,18 +302,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]) # optional - sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, [9,1]); phi # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, [9,1]); phi # needs 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() # 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 + sage: a1,a2,a3,a4,a6 = E.a_invariants() # needs sage.rings.finite_rings + sage: x0 = -9 # needs sage.rings.finite_rings + sage: y0 = -(a1*x0 + a3)/2 # needs sage.rings.finite_rings + sage: compute_vw_kohel_even_deg1(x0, y0, a1, a2, a4) # needs sage.rings.finite_rings (18, 9) """ v = 3*x0**2 + 2*a2*x0 + a4 - a1*y0 @@ -340,18 +340,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]) # 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 + sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: R. = GF(19)[] # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x^3 + 7*x^2 + 15*x + 12); phi # needs 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() # 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 + sage: b2,b4 = E.b2(), E.b4() # needs sage.rings.finite_rings + sage: s1, s2, s3 = -7, 15, -12 # needs sage.rings.finite_rings + sage: compute_vw_kohel_even_deg3(b2, b4, s1, s2, s3) # needs sage.rings.finite_rings (4, 7) """ temp1 = s1**2 - 2*s2 @@ -381,18 +381,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]) # 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 + sage: E = EllipticCurve(GF(19), [18,17,16,15,14]) # needs sage.rings.finite_rings + sage: R. = GF(19)[] # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x^3 + 14*x^2 + 3*x + 11); phi # needs 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() # 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 + sage: b2,b4,b6 = E.b2(), E.b4(), E.b6() # needs sage.rings.finite_rings + sage: s1,s2,s3 = -14,3,-11 # needs sage.rings.finite_rings + sage: compute_vw_kohel_odd(b2,b4,b6,s1,s2,s3,3) # needs sage.rings.finite_rings (7, 1) """ v = 6*(s1**2 - 2*s2) + b2*s1 + n*b4 @@ -419,26 +419,26 @@ 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]) # 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 + sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, [9,1]) # needs sage.rings.finite_rings + sage: phi.codomain() == isogeny_codomain_from_kernel(E, [9,1]) # needs sage.rings.finite_rings True - sage: compute_codomain_kohel(E, [9,1]) # optional - sage.rings.finite_rings + sage: compute_codomain_kohel(E, [9,1]) # needs 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 + sage: R. = GF(19)[] # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(19), [18,17,16,15,14]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x^3 + 14*x^2 + 3*x + 11) # needs sage.rings.finite_rings + sage: phi.codomain() == isogeny_codomain_from_kernel(E, x^3 + 14*x^2 + 3*x + 11) # needs sage.rings.finite_rings True - sage: compute_codomain_kohel(E, x^3 + 14*x^2 + 3*x + 11) # optional - sage.rings.finite_rings + sage: compute_codomain_kohel(E, x^3 + 14*x^2 + 3*x + 11) # needs 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 + sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x^3 + 7*x^2 + 15*x + 12) # needs sage.rings.finite_rings + sage: isogeny_codomain_from_kernel(E, x^3 + 7*x^2 + 15*x + 12) == phi.codomain() # needs sage.rings.finite_rings True - sage: compute_codomain_kohel(E, x^3 + 7*x^2 + 15*x + 12) # optional - sage.rings.finite_rings + sage: compute_codomain_kohel(E, x^3 + 7*x^2 + 15*x + 12) # needs 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 @@ -529,13 +529,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]) # 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 + sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: R. = GF(19)[] # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x + 13) # needs sage.rings.finite_rings + sage: isogeny_codomain_from_kernel(E, x + 13) == phi.codomain() # needs 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) # optional - sage.rings.finite_rings + sage: two_torsion_part(E, x + 13) # needs sage.rings.finite_rings x + 13 """ x = psi.parent().gen() # NB psi is univariate but could be constant @@ -612,105 +612,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]) # optional - sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0)) ); phi # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,0,0,1,0]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0)) ); phi # needs 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 + sage: phi.degree() == 2 # needs sage.rings.finite_rings True - sage: phi.kernel_polynomial() # optional - sage.rings.finite_rings + sage: phi.kernel_polynomial() # needs sage.rings.finite_rings x - sage: phi.rational_maps() # optional - sage.rings.finite_rings + sage: phi.rational_maps() # needs sage.rings.finite_rings ((x^2 + 1)/x, (x^2*y - y)/x^2) - sage: phi == loads(dumps(phi)) # known bug # optional - sage.rings.finite_rings + sage: phi == loads(dumps(phi)) # known bug # needs 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]) # 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 + sage: E = EllipticCurve(GF(2^4,'alpha'), [0,0,1,0,1]) # needs sage.rings.finite_rings + sage: P = E((1,1)) # needs sage.rings.finite_rings + sage: phi_v = EllipticCurveIsogeny(E, P); phi_v # needs 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 + sage: phi_ker_poly = phi_v.kernel_polynomial() # needs sage.rings.finite_rings + sage: phi_ker_poly # needs sage.rings.finite_rings x + 1 - sage: phi_k = EllipticCurveIsogeny(E, phi_ker_poly) # optional - sage.rings.finite_rings - sage: phi_k == phi_v # optional - sage.rings.finite_rings + sage: phi_k = EllipticCurveIsogeny(E, phi_ker_poly) # needs sage.rings.finite_rings + sage: phi_k == phi_v # needs sage.rings.finite_rings True - sage: phi_k.rational_maps() # optional - sage.rings.finite_rings + sage: phi_k.rational_maps() # needs 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() # optional - sage.rings.finite_rings + sage: phi_v.rational_maps() # needs 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 # optional - sage.rings.finite_rings + sage: phi_k.degree() == phi_v.degree() == 3 # needs sage.rings.finite_rings True - sage: phi_k.is_separable() # optional - sage.rings.finite_rings + sage: phi_k.is_separable() # needs sage.rings.finite_rings True - sage: phi_v(E(0)) # optional - sage.rings.finite_rings + sage: phi_v(E(0)) # needs sage.rings.finite_rings (0 : 1 : 0) - 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 + sage: alpha = E.base_field().gen() # needs sage.rings.finite_rings + sage: Q = E((0, alpha*(alpha + 1))) # needs sage.rings.finite_rings + sage: phi_v(Q) # needs sage.rings.finite_rings (1 : alpha^2 + alpha : 1) - sage: phi_v(P) == phi_k(P) # optional - sage.rings.finite_rings + sage: phi_v(P) == phi_k(P) # needs sage.rings.finite_rings True - sage: phi_k(P) == phi_v.codomain()(0) # optional - sage.rings.finite_rings + sage: phi_k(P) == phi_v.codomain()(0) # needs 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]) # 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 + sage: E = EllipticCurve(GF((3,2)), [0,0,0,1,1]) # needs sage.rings.finite_rings + sage: ker_poly = E.division_polynomial(2) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, ker_poly); phi # needs 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 + sage: P1,P2,P3 = filter(bool, E(0).division_points(2)) # needs sage.rings.finite_rings + sage: phi(P1) # needs sage.rings.finite_rings (0 : 1 : 0) - sage: phi(P2) # optional - sage.rings.finite_rings + sage: phi(P2) # needs sage.rings.finite_rings (0 : 1 : 0) - sage: phi(P3) # optional - sage.rings.finite_rings + sage: phi(P3) # needs sage.rings.finite_rings (0 : 1 : 0) - sage: phi.degree() # optional - sage.rings.finite_rings + sage: phi.degree() # needs 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]) # 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 + sage: E = EllipticCurve(GF(17), [11, 11, 4, 12, 10]) # needs sage.rings.finite_rings + sage: phi_v = EllipticCurveIsogeny(E, E(0)) # needs sage.rings.finite_rings + sage: phi_v.degree() # needs sage.rings.finite_rings 1 - sage: phi_v.rational_maps() # optional - sage.rings.finite_rings + sage: phi_v.rational_maps() # needs sage.rings.finite_rings (x, y) - sage: E == phi_v.codomain() # optional - sage.rings.finite_rings + sage: E == phi_v.codomain() # needs sage.rings.finite_rings True - sage: P = E.random_point() # optional - sage.rings.finite_rings - sage: phi_v(P) == P # optional - sage.rings.finite_rings + sage: P = E.random_point() # needs sage.rings.finite_rings + sage: phi_v(P) == P # needs sage.rings.finite_rings True - 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 + sage: E = EllipticCurve(GF(31), [23, 1, 22, 7, 18]) # needs sage.rings.finite_rings + sage: phi_k = EllipticCurveIsogeny(E, [1]); phi_k # needs 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 + sage: phi_k.degree() # needs sage.rings.finite_rings 1 - sage: phi_k.rational_maps() # optional - sage.rings.finite_rings + sage: phi_k.rational_maps() # needs sage.rings.finite_rings (x, y) - sage: phi_k.codomain() == E # optional - sage.rings.finite_rings + sage: phi_k.codomain() == E # needs sage.rings.finite_rings True - sage: phi_k.kernel_polynomial() # optional - sage.rings.finite_rings + sage: phi_k.kernel_polynomial() # needs sage.rings.finite_rings 1 - sage: P = E.random_point(); P == phi_k(P) # optional - sage.rings.finite_rings + sage: P = E.random_point(); P == phi_k(P) # needs sage.rings.finite_rings True Vélu and Kohel also work in characteristic `0`:: @@ -770,36 +770,36 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: E = EllipticCurve('11a1') sage: P_list = E.torsion_points() sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2* x^2 - 40*x - 158) # needs sage.rings.number_field + sage: EK = E.change_ring(K) # needs sage.rings.number_field + sage: P_list = [EK(P) for P in P_list] # needs sage.rings.number_field + sage: phi_v = EllipticCurveIsogeny(EK, P_list); phi_v # needs 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 + sage: P = EK((alpha/2,-1/2)) # needs sage.rings.number_field + sage: phi_v(P) # needs sage.rings.number_field (122/121*alpha^2 + 1633/242*alpha - 3920/121 : -1/2 : 1) - sage: ker_poly = phi_v.kernel_polynomial() # optional - sage.rings.number_field - sage: ker_poly # optional - sage.rings.number_field + sage: ker_poly = phi_v.kernel_polynomial() # needs sage.rings.number_field + sage: ker_poly # needs sage.rings.number_field x^2 - 21*x + 80 - sage: phi_k = EllipticCurveIsogeny(EK, ker_poly); phi_k # optional - sage.rings.number_field + sage: phi_k = EllipticCurveIsogeny(EK, ker_poly); phi_k # needs 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 + sage: phi_v == phi_k # needs sage.rings.number_field True - sage: phi_k(P) == phi_v(P) # optional - sage.rings.number_field + sage: phi_k(P) == phi_v(P) # needs sage.rings.number_field True - sage: phi_k == phi_v # optional - sage.rings.number_field + sage: phi_k == phi_v # needs sage.rings.number_field True - sage: phi_k.degree() # optional - sage.rings.number_field + sage: phi_k.degree() # needs sage.rings.number_field 5 - sage: phi_v.is_separable() # optional - sage.rings.number_field + sage: phi_v.is_separable() # needs sage.rings.number_field True The following example shows how to specify an isogeny from domain @@ -844,16 +844,16 @@ class EllipticCurveIsogeny(EllipticCurveHom): Here an example of a construction of a endomorphisms with cyclic kernel on a CM-curve:: - 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 + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [1,0]) # needs sage.rings.number_field + sage: RK. = K[] # needs sage.rings.number_field + sage: f = X^2 - 2/5*i + 1/5 # needs sage.rings.number_field + sage: phi= E.isogeny(f) # needs sage.rings.number_field + sage: isom = phi.codomain().isomorphism_to(E) # needs sage.rings.number_field + sage: phi = isom * phi # needs sage.rings.number_field + sage: phi.codomain() == phi.domain() # needs sage.rings.number_field True - sage: phi.rational_maps() # optional - sage.rings.number_field + sage: phi.rational_maps() # needs 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))) @@ -868,21 +868,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]) # optional - sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, [17, 1]) # optional - sage.rings.finite_rings - sage: phi.domain() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(31), [1,0,0,1,2]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, [17, 1]) # needs sage.rings.finite_rings + sage: phi.domain() # needs 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() # optional - sage.rings.finite_rings + sage: phi.codomain() # needs 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)) # optional - sage.rings.finite_rings - sage: phi = E.isogeny([E(0), E((0,1)), E((0,-1))]); phi # optional - sage.rings.finite_rings + sage: E = EllipticCurve(j=GF(7)(0)) # needs sage.rings.finite_rings + sage: phi = E.isogeny([E(0), E((0,1)), E((0,-1))]); phi # needs 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 + sage: phi2 = phi * phi; phi2 # needs 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 @@ -890,16 +890,16 @@ class EllipticCurveIsogeny(EllipticCurveHom): Examples over relative number fields used not to work (see :trac:`16779`):: sage: pol26 = hilbert_class_polynomial(-4*26) - sage: F = NumberField(pol26,'a') # long time # optional - sage.rings.number_field - sage: pol = F.optimized_representation()[0].polynomial() # long time # optional - sage.rings.number_field - sage: K. = NumberField(pol) # long time # optional - sage.rings.number_field - sage: j = pol26.roots(K)[0][0] # long time # optional - sage.rings.number_field - sage: E = EllipticCurve(j=j) # long time # optional - sage.rings.number_field - sage: L. = K.extension(x^2 + 26) # long time # optional - sage.rings.number_field - sage: EL = E.change_ring(L) # long time # optional - sage.rings.number_field - sage: iso2 = EL.isogenies_prime_degree(2); len(iso2) # long time # optional - sage.rings.number_field + sage: F = NumberField(pol26,'a') # long time # needs sage.rings.number_field + sage: pol = F.optimized_representation()[0].polynomial() # long time, needs sage.rings.number_field + sage: K. = NumberField(pol) # long time # needs sage.rings.number_field + sage: j = pol26.roots(K)[0][0] # long time # needs sage.rings.number_field + sage: E = EllipticCurve(j=j) # long time # needs sage.rings.number_field + sage: L. = K.extension(x^2 + 26) # long time # needs sage.rings.number_field + sage: EL = E.change_ring(L) # long time # needs sage.rings.number_field + sage: iso2 = EL.isogenies_prime_degree(2); len(iso2) # long time # needs sage.rings.number_field 1 - sage: iso3 = EL.isogenies_prime_degree(3); len(iso3) # long time # optional - sage.rings.number_field + sage: iso3 = EL.isogenies_prime_degree(3); len(iso3) # long time # needs sage.rings.number_field 2 Examples over function fields used not to work (see :trac:`11327`):: @@ -1015,15 +1015,15 @@ def __init__(self, E, kernel, codomain=None, degree=None, model=None, check=True EXAMPLES:: - 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 + sage: E = EllipticCurve(GF(2), [0,0,1,0,1]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, [1,1]); phi # needs 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]) # 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 + sage: E = EllipticCurve(GF(31), [0,0,0,1,0]) # needs sage.rings.finite_rings + sage: P = E((2,17)) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, P); phi # needs 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 @@ -1124,8 +1124,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()) # optional - sage.rings.number_field - sage: phi._eval(P).curve() # optional - sage.rings.number_field + sage: P = E.change_ring(QQbar).lift_x(QQbar.random_element()) # needs sage.rings.number_field + sage: phi._eval(P).curve() # needs sage.rings.number_field Elliptic Curve defined by y^2 = x^3 + (-4)*x over Algebraic Field :: @@ -1133,8 +1133,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) # optional - sage.rings.number_field - sage: {psi._eval(P).curve() for P in Ps} # optional - sage.rings.number_field + sage: Ps = E.change_ring(GF(419**2))(0).division_points(5) # needs sage.rings.number_field + sage: {psi._eval(P).curve() for P in Ps} # needs 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): @@ -1174,28 +1174,28 @@ def _call_(self, P): EXAMPLES:: - 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 + sage: E = EllipticCurve(GF(17), [1, 9, 5, 4, 3]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, [6,13,1]) # needs sage.rings.finite_rings + sage: phi(E((1,0))) # needs sage.rings.finite_rings (15 : 13 : 1) - 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 + sage: E = EllipticCurve(GF(23), [0,0,0,1,0]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings + sage: phi(E((1,5))) # needs sage.rings.finite_rings (2 : 0 : 1) - 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 + sage: E = EllipticCurve(QQ, [0,0,0,3,0]) # needs sage.rings.finite_rings + sage: P = E((1,2)) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, [0,1]) # needs sage.rings.finite_rings + sage: phi(P) # needs sage.rings.finite_rings (4 : -4 : 1) - sage: phi(-P) # optional - sage.rings.finite_rings + sage: phi(-P) # needs sage.rings.finite_rings (4 : 4 : 1) - 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 + sage: E = EllipticCurve(GF(17), [0,-1,0,-3,-1]) # needs sage.rings.finite_rings + sage: Q = E((16,0)) # needs sage.rings.finite_rings + sage: tau = E.isogeny([Q], E) # needs sage.rings.finite_rings + sage: tau(Q) # needs sage.rings.finite_rings (0 : 1 : 0) TESTS: @@ -1203,38 +1203,38 @@ def _call_(self, P): Tests for :trac:`10888`:: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^2 + 3) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [7,0]) # needs sage.rings.number_field + sage: phi = E.isogeny(E(0,0)) # needs sage.rings.number_field + sage: P = E(-3,4*th) # needs sage.rings.number_field + sage: phi(P) # needs sage.rings.number_field (-16/3 : 8/9*th : 1) - 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 + sage: Q = phi(P) # needs sage.rings.number_field + sage: phihat = phi.dual() # needs sage.rings.number_field + sage: phihat(Q) # needs 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)) # 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 + sage: E = EllipticCurve(j=GF(7)(0)) # needs sage.rings.finite_rings + sage: phi = E.isogeny([E(0), E((0,1)), E((0,-1))]) # needs sage.rings.finite_rings + sage: phi(E.points()[0]) # needs sage.rings.finite_rings (0 : 1 : 0) - sage: phi2 = phi * phi # optional - sage.rings.finite_rings - sage: phi2(E.points()[0]) # optional - sage.rings.finite_rings + sage: phi2 = phi * phi # needs sage.rings.finite_rings + sage: phi2(E.points()[0]) # needs sage.rings.finite_rings (0 : 1 : 0) Coercion works fine with :meth:`_call_` (added for :trac:`16238`):: - 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 + sage: K. = NumberField(x^2 + 3) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [7,0]) # needs sage.rings.number_field + sage: E2 = EllipticCurve(K, [5,0]) # needs sage.rings.number_field + sage: phi = E.isogeny(E(0)) # needs sage.rings.number_field + sage: phi(E2(0)) # needs sage.rings.number_field (0 : 1 : 0) - sage: E2(20,90) # optional - sage.rings.number_field + sage: E2(20,90) # needs sage.rings.number_field (20 : 90 : 1) - sage: phi(E2(20,90)) # optional - sage.rings.number_field + sage: phi(E2(20,90)) # needs sage.rings.number_field Traceback (most recent call last): ... TypeError: (20 : 90 : 1) fails to convert into the map's domain @@ -1243,12 +1243,12 @@ def _call_(self, P): Check that copying the order over works:: - 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 + sage: E = EllipticCurve(GF(431), [1,0]) # needs sage.rings.finite_rings + sage: P, = E.gens() # needs sage.rings.finite_rings + sage: Q = 2^99*P; Q.order() # needs sage.rings.finite_rings 27 - sage: phi = E.isogeny(3^99*P) # optional - sage.rings.finite_rings - sage: phi(Q)._order # optional - sage.rings.finite_rings + sage: phi = E.isogeny(3^99*P) # needs sage.rings.finite_rings + sage: phi(Q)._order # needs sage.rings.finite_rings 27 Test for :trac:`35983`:: @@ -1326,11 +1326,11 @@ def __getitem__(self, i): sage: phi[1] y - 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 + sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings + sage: phi[0] # needs sage.rings.finite_rings (x^2 + 3)/x - sage: phi[1] # optional - sage.rings.finite_rings + sage: phi[1] # needs sage.rings.finite_rings (x^2*y - 3*y)/x^2 """ return self.rational_maps()[i] @@ -1347,9 +1347,9 @@ def __iter__(self): x y - 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 + sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings + sage: for c in phi: print(c) # needs sage.rings.finite_rings (x^2 + 3)/x (x^2*y - 3*y)/x^2 """ @@ -1365,19 +1365,19 @@ def __neg__(self): The following examples inherently exercise this function:: - 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 + sage: E = EllipticCurve(j=GF(17)(0)) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((-1,0)) ) # needs sage.rings.finite_rings + sage: negphi = -phi # needs sage.rings.finite_rings + sage: phi(E((0,1))) + negphi(E((0,1))) == 0 # needs sage.rings.finite_rings True - 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 + sage: E = EllipticCurve(j=GF(19)(1728)) # needs sage.rings.finite_rings + sage: R. = GF(19)[] # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x) # needs sage.rings.finite_rings + sage: negphi = -phi # needs sage.rings.finite_rings + sage: phi(E((3,7))) + negphi(E((3,12))) == phi(2*E((3,7))) # needs sage.rings.finite_rings True - sage: negphi(E((18,6))) # optional - sage.rings.finite_rings + sage: negphi(E((18,6))) # needs sage.rings.finite_rings (17 : 0 : 1) sage: R. = QQ[] @@ -1392,31 +1392,30 @@ def __neg__(self): sage: phi(P) + negphi(P) == 0 True - 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 + sage: E = EllipticCurve(GF(23), [0,0,0,1,0]) # needs sage.rings.finite_rings + sage: f = E.torsion_polynomial(3)/3 # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f, E) # needs sage.rings.finite_rings + sage: phi.rational_maps() == E.multiplication_by_m(3) # needs sage.rings.finite_rings False - sage: negphi = -phi # optional - sage.rings.finite_rings - sage: negphi.rational_maps() == E.multiplication_by_m(3) # optional - sage.rings.finite_rings + sage: negphi = -phi # needs sage.rings.finite_rings + sage: negphi.rational_maps() == E.multiplication_by_m(3) # needs sage.rings.finite_rings True - 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 + sage: E = EllipticCurve(GF(17), [-2, 3, -5, 7, -11]) # needs sage.rings.finite_rings + sage: R. = GF(17)[] # needs sage.rings.finite_rings + sage: f = x+6 # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f); phi # needs 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 + sage: phi.rational_maps() # needs 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 + sage: negphi = -phi # needs sage.rings.finite_rings + sage: negphi # needs 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 + sage: negphi.rational_maps() # needs 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)) @@ -1432,14 +1431,14 @@ def __neg__(self): sage: ymap1 == -ymap2 - E.a1()*xmap2 - E.a3() True - 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 + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,0,1,0]) # needs sage.rings.number_field + sage: R. = K[] # needs sage.rings.number_field + sage: phi = EllipticCurveIsogeny(E, x - a) # needs sage.rings.number_field + sage: phi.rational_maps() # needs 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 # optional - sage.rings.number_field - sage: negphi.rational_maps() # optional - sage.rings.number_field + sage: negphi = -phi # needs sage.rings.number_field + sage: negphi.rational_maps() # needs 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) @@ -1456,9 +1455,9 @@ def _repr_(self): EXAMPLES:: - 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 + sage: E = EllipticCurve(GF(31), [1,0,1,1,0]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0)) ) # needs sage.rings.finite_rings + sage: phi._repr_() # needs 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]) @@ -1482,10 +1481,10 @@ def _latex_(self): sage: phi._latex_() '\\left( x , y \\right)' - 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 + sage: E = EllipticCurve(GF(17), [0,0,0,1,-1]) # needs sage.rings.finite_rings + sage: R. = GF(17)[] # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, X + 11) # needs sage.rings.finite_rings + sage: phi._latex_() # needs 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() @@ -1513,17 +1512,17 @@ def __clear_cached_values(self): sage: old_ratl_maps[1] == -phi.rational_maps()[1] True - 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: F = GF(127); R. = F[] # needs sage.rings.finite_rings + sage: E = EllipticCurve(j=F(1728)) # needs sage.rings.finite_rings + sage: f = x^5 + 43*x^4 + 97*x^3 + 81*x^2 + 42*x + 82 # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings + sage: old_ratl_maps = phi.rational_maps() # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: phi._set_post_isomorphism(WeierstrassIsomorphism(phi.codomain(), # optional - sage.rings.finite_rings + sage: phi._set_post_isomorphism(WeierstrassIsomorphism(phi.codomain(), # needs sage.rings.finite_rings ....: (-13,13,-13,13))) - sage: old_ratl_maps == phi.rational_maps() # optional - sage.rings.finite_rings + sage: old_ratl_maps == phi.rational_maps() # needs sage.rings.finite_rings False - sage: phi._EllipticCurveIsogeny__clear_cached_values() # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__clear_cached_values() # needs sage.rings.finite_rings """ self.__ratl_maps = None self.__dual = None @@ -1538,17 +1537,17 @@ def __perform_inheritance_housekeeping(self): The following examples will implicitly exercise this function:: - 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: E = EllipticCurve(GF(43), [2,3,5,7,11]) # needs sage.rings.finite_rings + sage: R. = GF(43)[]; f = x + 42 # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__perform_inheritance_housekeeping() # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - 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 + sage: E2 = phi.codomain() # needs sage.rings.finite_rings + sage: post_isom = WeierstrassIsomorphism(E2, (41, 37, 31, 29)) # needs sage.rings.finite_rings + sage: phi._set_post_isomorphism(post_isom) # needs sage.rings.finite_rings + sage: E1pr = WeierstrassIsomorphism(E, (-1, 2, -3, 4)).codomain() # needs sage.rings.finite_rings + sage: pre_isom = E1pr.isomorphism_to(E) # needs sage.rings.finite_rings + sage: phi._set_pre_isomorphism(pre_isom) # needs sage.rings.finite_rings """ EllipticCurveHom.__init__(self, self._domain, self._codomain) @@ -1559,31 +1558,31 @@ def __init_algebraic_structs(self, E): EXAMPLES:: - 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: E = EllipticCurve(j=GF(17)(0)) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((-1,0))) # needs sage.rings.finite_rings The constructor calls this function itself, so the fields it sets are already defined:: - sage: phi._domain # optional - sage.rings.finite_rings + sage: phi._domain # needs sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__base_field # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__base_field # needs sage.rings.finite_rings Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__poly_ring # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__poly_ring # needs sage.rings.finite_rings Univariate Polynomial Ring in x over Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__mpoly_ring # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__mpoly_ring # needs sage.rings.finite_rings Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Finite Field of size 17 Now, calling the initialization function does nothing more:: - sage: phi._EllipticCurveIsogeny__init_algebraic_structs(E) # optional - sage.rings.finite_rings - sage: phi._domain # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_algebraic_structs(E) # needs sage.rings.finite_rings + sage: phi._domain # needs sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__base_field # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__base_field # needs sage.rings.finite_rings Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__poly_ring # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__poly_ring # needs sage.rings.finite_rings Univariate Polynomial Ring in x over Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__mpoly_ring # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__mpoly_ring # needs sage.rings.finite_rings Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Finite Field of size 17 sage: E = EllipticCurve(QQ, [0,0,0,1,0]) @@ -1598,17 +1597,17 @@ def __init_algebraic_structs(self, E): sage: phi._EllipticCurveIsogeny__mpoly_ring Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Rational Field - 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 + sage: F = GF(19); R. = F[] # needs sage.rings.finite_rings + sage: E = EllipticCurve(j=GF(19)(0)) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_algebraic_structs(E) # needs sage.rings.finite_rings + sage: phi._domain # needs sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 19 - sage: phi._EllipticCurveIsogeny__base_field # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__base_field # needs sage.rings.finite_rings Finite Field of size 19 - sage: phi._EllipticCurveIsogeny__poly_ring # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__poly_ring # needs sage.rings.finite_rings Univariate Polynomial Ring in x over Finite Field of size 19 - sage: phi._EllipticCurveIsogeny__mpoly_ring # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__mpoly_ring # needs sage.rings.finite_rings Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Finite Field of size 19 """ self._domain = E @@ -1628,17 +1627,17 @@ def __compute_codomain(self): These examples inherently exercise this function:: - 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 + sage: E = EllipticCurve(j=GF(7)(1728)) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings + sage: phi.codomain() # needs 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() # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_codomain() # needs sage.rings.finite_rings - 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 + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x) # needs sage.rings.finite_rings + sage: phi.codomain() # needs 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() # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_codomain() # needs sage.rings.finite_rings """ if self.__algorithm == 'velu': self._codomain = self.__compute_codomain_via_velu() @@ -1661,14 +1660,14 @@ def __initialize_rational_maps(self, precomputed_maps=None): The following examples inherently exercise this function:: - 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 + sage: E = EllipticCurve(j=GF(7)(1728)) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings + sage: phi.rational_maps() # implicit doctest # needs sage.rings.finite_rings ((x^2 + 1)/x, (x^2*y - y)/x^2) - 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 + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x) # needs sage.rings.finite_rings + sage: phi.rational_maps() # implicit doctest # needs sage.rings.finite_rings ((x^2 + 1)/x, (x^2*y - y)/x^2) sage: E = EllipticCurve([1,2,3,4,5]) @@ -1717,9 +1716,9 @@ def __init_kernel_polynomial(self): The following examples inherently exercise this function:: - 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 + sage: E = EllipticCurve(j=GF(7)(1728)) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings + sage: phi.kernel_polynomial() # implicit doctest # needs sage.rings.finite_rings x """ if self.__kernel_polynomial is None: @@ -1735,16 +1734,16 @@ def __set_pre_isomorphism(self, domain, isomorphism): EXAMPLES:: - 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: E = EllipticCurve(GF(43), [2,3,5,7,11]) # needs sage.rings.finite_rings + sage: R. = GF(43)[]; f = x + 42 # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__perform_inheritance_housekeeping() # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - 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 + sage: E1pr = WeierstrassIsomorphism(E, (-1, 2, -3, 4)).codomain() # needs sage.rings.finite_rings + sage: pre_isom = E1pr.isomorphism_to(E) # needs sage.rings.finite_rings + sage: phi._set_pre_isomorphism(pre_isom) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__set_pre_isomorphism(E, WeierstrassIsomorphism(E, (-1, 3, -3, 4))) # needs sage.rings.finite_rings + sage: E == phi.domain() # needs sage.rings.finite_rings True """ self._domain = domain @@ -1779,14 +1778,14 @@ def __set_post_isomorphism(self, codomain, isomorphism): The following examples inherently exercise this function:: - 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: E = EllipticCurve(j=GF(7)(1728)) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - 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 + sage: E2 = phi.codomain() # needs sage.rings.finite_rings + sage: isom = WeierstrassIsomorphism(E2, (-1,2,-3,4)) # needs sage.rings.finite_rings + sage: phi._set_post_isomorphism(isom) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__set_post_isomorphism(E2, WeierstrassIsomorphism(phi.codomain(), (1,-2,3,-4))) # needs sage.rings.finite_rings + sage: E2 == phi.codomain() # needs sage.rings.finite_rings True """ self._codomain = codomain @@ -1815,20 +1814,20 @@ def __setup_post_isomorphism(self, codomain, model): The following examples inherently exercise this function:: - 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 + sage: E = EllipticCurve(j=GF(7)(1728)) # needs sage.rings.finite_rings + sage: E2 = EllipticCurve(GF(7), [0,0,0,5,0]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0)), E2); phi # needs 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 + sage: E3 = EllipticCurve(GF(7), [0,0,0,6,0]) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__setup_post_isomorphism(E3, None) # needs sage.rings.finite_rings + sage: phi # needs 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 + sage: EllipticCurveIsogeny(E, E(0,0), model='montgomery') # needs 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 @@ -1887,22 +1886,22 @@ 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]) # optional - sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0))); phi # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))); phi # needs 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 + sage: phi._EllipticCurveIsogeny__init_from_kernel_list([E(0), E((0,0))]) # needs 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 # 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 + sage: p = 12 * next_prime(2^180) * next_prime(2^194) - 1 # needs sage.rings.finite_rings + sage: F = FiniteField(p, proof=False) # needs sage.rings.finite_rings + sage: E = EllipticCurve([F(1), F(0)]) # needs sage.rings.finite_rings + sage: P = E(0).division_points(3)[1] # needs sage.rings.finite_rings + sage: EllipticCurveIsogeny(E, P) # needs sage.rings.finite_rings Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 461742260113997803268895001173557974278278194575766957660028841364655249961609425998827452443620996655395008156411 @@ -1949,13 +1948,13 @@ def __sort_kernel_list(self): The following example inherently exercises this function:: - 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 + sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # needs sage.rings.finite_rings + sage: P = E((4,2)) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, P); phi # needs 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 + sage: phi._EllipticCurveIsogeny__sort_kernel_list() # needs sage.rings.finite_rings """ a1, a2, a3, a4, _ = self._domain.a_invariants() @@ -2001,12 +2000,12 @@ def __compute_codomain_via_velu(self): The following example inherently exercises this function:: - 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 + sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # needs sage.rings.finite_rings + sage: P = E((4,2)) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, P) # needs sage.rings.finite_rings + sage: phi.codomain() # needs 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() # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_codomain_via_velu() # needs 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) @@ -2021,22 +2020,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]) # 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 + sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # needs sage.rings.finite_rings + sage: P = E((4,2)) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, P) # needs sage.rings.finite_rings + sage: Q = E((0,0)); phi(Q) # needs sage.rings.finite_rings (0 : 0 : 1) - sage: phi.rational_maps() # optional - sage.rings.finite_rings + sage: phi.rational_maps() # needs 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) # 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 + sage: F = GF(7) # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [0,0,0,1,0]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0)) ) # needs sage.rings.finite_rings + sage: Qvals = phi._EllipticCurveIsogeny__kernel_mod_sign[0] # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__velu_sum_helper(0, Qvals, 0, 0, F(5), F(5)) # needs sage.rings.finite_rings (3, 3) - 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 + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__velu_sum_helper(0, Qvals, 0, 0, x, y) # needs sage.rings.finite_rings (1/x, y/x^2) """ yQ, gxQ, gyQ, vQ, uQ = Qvalues @@ -2069,17 +2068,17 @@ def __compute_via_velu_numeric(self, xP, yP): The following example inherently exercises this function:: - 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 + sage: F = GF(7) # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [0,0,0,-1,0]) # needs sage.rings.finite_rings + sage: P = E((4,2)) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, P) # needs sage.rings.finite_rings + sage: Q = E((0,0)); phi(Q) # needs sage.rings.finite_rings (0 : 0 : 1) - sage: Q = E((-1,0)); phi(Q) # optional - sage.rings.finite_rings + sage: Q = E((-1,0)); phi(Q) # needs sage.rings.finite_rings (0 : 0 : 1) - sage: phi._EllipticCurveIsogeny__compute_via_velu_numeric(F(0), F(0)) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_via_velu_numeric(F(0), F(0)) # needs sage.rings.finite_rings (0, 0) - sage: phi._EllipticCurveIsogeny__compute_via_velu_numeric(F(-1), F(0)) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_via_velu_numeric(F(-1), F(0)) # needs sage.rings.finite_rings (0, 0) """ # first check if the point is in the kernel @@ -2096,18 +2095,18 @@ def __compute_via_velu(self, xP, yP): The following example inherently exercises this function:: - 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 + sage: F = GF(7) # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [0,0,0,-1,0]) # needs sage.rings.finite_rings + sage: P = E((4,2)) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, P) # needs sage.rings.finite_rings + sage: Q = E((0,0)); phi(Q) # needs sage.rings.finite_rings (0 : 0 : 1) - sage: phi.rational_maps() # optional - sage.rings.finite_rings + sage: phi.rational_maps() # needs 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)) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_via_velu(F(0), F(0)) # needs sage.rings.finite_rings (0, 0) - sage: R. = GF(7)[] # optional - sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__compute_via_velu(x, y) # optional - sage.rings.finite_rings + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_via_velu(x, y) # needs 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)) @@ -2115,24 +2114,24 @@ def __compute_via_velu(self, xP, yP): Check for :trac:`33214`:: - 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 + sage: z2 = GF(71^2).gen() # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(71^2), [5,5]) # needs sage.rings.finite_rings + sage: phi = E.isogeny(E.lift_x(0)) # needs sage.rings.finite_rings + sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism # needs sage.rings.finite_rings + sage: pre = WeierstrassIsomorphism(None, (z2,7,8,9), E) # needs sage.rings.finite_rings + sage: phi = phi * pre # needs sage.rings.finite_rings + sage: P = phi.domain()(1, 46*z2+49) # needs sage.rings.finite_rings + sage: phi(P) # indirect doctest # needs 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 # 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 + sage: fx,fy = phi.rational_maps() # indirect doctest # needs sage.rings.finite_rings + sage: R. = GF(71^2)[] # needs sage.rings.finite_rings + sage: E0, E2 = phi.domain(), phi.codomain() # needs sage.rings.finite_rings + sage: eqs = [EE.defining_polynomial()(x,y,1) for EE in (E0,E2)] # needs sage.rings.finite_rings + sage: eqs[1](fx,fy).numerator() % eqs[0] # needs sage.rings.finite_rings 0 """ if self.__pre_isomorphism is None: @@ -2162,12 +2161,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]) # 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 + sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # needs sage.rings.finite_rings + sage: P = E((4,2)) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, P) # needs sage.rings.finite_rings + sage: phi.rational_maps() # needs 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() # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__initialize_rational_maps_via_velu() # needs 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() @@ -2183,10 +2182,10 @@ def __init_kernel_polynomial_velu(self): The following example inherently exercises this function:: - 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 + sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # needs sage.rings.finite_rings + sage: P = E((4,2)) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, P) # needs sage.rings.finite_rings + sage: phi.kernel_polynomial() # implicit doctest # needs sage.rings.finite_rings x^2 + 2*x + 4 """ poly_ring, x = self.__poly_ring.objgen() @@ -2216,22 +2215,22 @@ def __init_from_kernel_polynomial(self, kernel_polynomial): These examples inherently exercise this private function:: - 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 + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x);phi # needs 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) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_from_kernel_polynomial(x) # needs 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 + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi # needs 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) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_from_kernel_polynomial(x+6) # needs sage.rings.finite_rings """ poly_ring = self.__poly_ring E = self._domain @@ -2317,39 +2316,39 @@ def __init_even_kernel_polynomial(self, E, psi_G): These examples inherently exercise this private function:: - 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 + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [-1,0]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x); phi # needs 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) # optional - sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) # optional - sage.rings.finite_rings + sage: psig = two_torsion_part(E,x) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) # needs sage.rings.finite_rings (x^3 + 6*x, (x^3 + x)*y, 6, 0, 1, 2) - 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 + sage: F = GF(2^4, 'alpha'); R. = F[] # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [1,1,0,1,0]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x); phi # needs 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) # optional - sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) # optional - sage.rings.finite_rings + sage: psig = two_torsion_part(E,x) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) # needs sage.rings.finite_rings (x^3 + x, (x^3 + x)*y + x^2, 1, 0, 1, 2) - 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 + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # needs sage.rings.finite_rings + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: f = x^3 + 6*x^2 + 1 # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f); phi # needs 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 + sage: psig = two_torsion_part(E,f) # needs sage.rings.finite_rings + sage: psig = two_torsion_part(E,f) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) # needs 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 + 4*x^8 + 2*x^7 + 4*x^3 + 2*x^2 + x + 6)*y, 1, 6, 3, 4) """ # check if the polynomial really divides the two_torsion_polynomial @@ -2434,36 +2433,36 @@ def __init_odd_kernel_polynomial(self, E, psi): These examples inherently exercise this private function:: - 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 + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi # needs 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: phi._EllipticCurveIsogeny__init_odd_kernel_polynomial(E, x+6) # optional - sage.rings.finite_rings + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_odd_kernel_polynomial(E, x+6) # needs sage.rings.finite_rings (x^3 + 5*x^2 + 3*x + 2, (x^3 + 4*x^2 + x)*y, 2, 6, 1, 3) - 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 + sage: F = GF(2^4, 'alpha'); R. = F[] # needs sage.rings.finite_rings + sage: alpha = F.gen() # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [1,1,F.gen(),F.gen()^2+1,1]) # needs sage.rings.finite_rings + sage: f = x + alpha^2 + 1 # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f); phi # needs 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 + sage: R. = F[] # needs sage.rings.finite_rings + sage: f = x + alpha^2 + 1 # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_odd_kernel_polynomial(E, f) # needs sage.rings.finite_rings (x^3 + (alpha^2 + 1)*x + alpha^3 + alpha^2 + alpha, (x^3 + (alpha^2 + 1)*x^2 + (alpha^2 + 1)*x + alpha)*y + (alpha^2 + alpha + 1)*x^2 + (alpha^2 + alpha)*x + alpha, alpha^2 + alpha + 1, alpha^3 + alpha^2 + alpha, 1, 3) - 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 + sage: E = EllipticCurve(j=-262537412640768000) # needs sage.rings.finite_rings + sage: f = E.isogenies_prime_degree()[0].kernel_polynomial() # needs sage.rings.finite_rings + sage: f.degree() # needs sage.rings.finite_rings 81 - sage: E.isogeny(kernel=f, check=False) # optional - sage.rings.finite_rings + sage: E.isogeny(kernel=f, check=False) # needs 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 @@ -2536,19 +2535,19 @@ def __compute_omega_fast(self, E, psi, psi_pr, phi, phi_pr): These examples inherently exercise this private function:: - 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 + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi # needs 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 + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: psi = phi._EllipticCurveIsogeny__psi # needs sage.rings.finite_rings + sage: psi_pr = psi.derivative() # needs sage.rings.finite_rings + sage: fi = phi._EllipticCurveIsogeny__phi # needs sage.rings.finite_rings + sage: fi_pr = fi.derivative() # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_omega_fast(E, psi, psi_pr, fi, fi_pr) # needs sage.rings.finite_rings (x^3 + 4*x^2 + x)*y """ a1 = E.a1() @@ -2586,32 +2585,32 @@ 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[] # 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 + sage: F = GF(2^4, 'alpha'); R. = F[] # needs sage.rings.finite_rings + sage: alpha = F.gen() # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [1, 1, F.gen(), F.gen()^2+1, 1]) # needs sage.rings.finite_rings + sage: f = x + alpha^2 + 1 # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f); phi # needs 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 + sage: R. = F[] # needs sage.rings.finite_rings + sage: psi = phi._EllipticCurveIsogeny__psi # needs sage.rings.finite_rings + sage: psi_pr = psi.derivative() # needs sage.rings.finite_rings + sage: fi = phi._EllipticCurveIsogeny__phi # needs sage.rings.finite_rings + sage: fi_pr = fi.derivative() # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_omega_general(E, psi, psi_pr, fi, fi_pr) # needs sage.rings.finite_rings (x^3 + (alpha^2 + 1)*x^2 + (alpha^2 + 1)*x + alpha)*y + (alpha^2 + alpha + 1)*x^2 + (alpha^2 + alpha)*x + alpha A bug fixed in :trac:`7907`:: - 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 # optional - sage.rings.finite_rings + sage: F = GF(128,'a') # needs sage.rings.finite_rings + sage: a = F.gen() # needs sage.rings.finite_rings + sage: E = EllipticCurve([1,0,0,0,(a**6+a**4+a**2+a)]) # needs sage.rings.finite_rings + sage: x = polygen(F) # needs 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 # needs 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 + sage: E.isogeny(ker) # needs 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 @@ -2668,16 +2667,16 @@ def __compute_via_kohel_numeric(self, xP, yP): These examples inherently exercise this private function:: - 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 + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) # needs sage.rings.finite_rings + sage: P = E((0,1)); phi(P) # needs sage.rings.finite_rings (2 : 0 : 1) - sage: P = E((1,1)); phi(P) # optional - sage.rings.finite_rings + sage: P = E((1,1)); phi(P) # needs sage.rings.finite_rings (0 : 1 : 0) - sage: phi._EllipticCurveIsogeny__compute_via_kohel_numeric(0, 1) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_via_kohel_numeric(0, 1) # needs sage.rings.finite_rings (2, 0) - sage: phi._EllipticCurveIsogeny__compute_via_kohel_numeric(1, 1) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_via_kohel_numeric(1, 1) # needs sage.rings.finite_rings () """ # first check if the point is in the kernel @@ -2694,17 +2693,17 @@ def __compute_via_kohel(self, xP, yP): These examples inherently exercise this private function:: - 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 + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) # needs sage.rings.finite_rings + sage: P = E((0,1)); phi(P) # needs sage.rings.finite_rings (2 : 0 : 1) - sage: phi.rational_maps() # optional - sage.rings.finite_rings + sage: phi.rational_maps() # needs 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) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_via_kohel(0,1) # needs sage.rings.finite_rings (2, 0) - sage: R. = GF(7)[] # optional - sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__compute_via_kohel(x,y) # optional - sage.rings.finite_rings + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_via_kohel(x,y) # needs 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) @@ -2723,12 +2722,12 @@ def __initialize_rational_maps_via_kohel(self): These examples inherently exercise this private function:: - 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 + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) # needs sage.rings.finite_rings + sage: phi.rational_maps() # needs 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() # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__initialize_rational_maps_via_kohel() # needs 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() @@ -2747,12 +2746,12 @@ def __compute_codomain_via_kohel(self): These examples inherently exercise this private function:: - 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 + sage: R. = GF(7)[] # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) # needs sage.rings.finite_rings + sage: phi.codomain() # needs 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() # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_codomain_via_kohel() # needs 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) @@ -2780,9 +2779,9 @@ def rational_maps(self): sage: phi.rational_maps() (x, y) - 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 + sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings + sage: phi.rational_maps() # needs sage.rings.finite_rings ((x^2 + 3)/x, (x^2*y - 3*y)/x^2) """ self.__initialize_rational_maps() @@ -2807,9 +2806,9 @@ def x_rational_map(self): sage: phi.x_rational_map() x - 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 + sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings + sage: phi.x_rational_map() # needs sage.rings.finite_rings (x^2 + 3)/x """ self.__initialize_rational_maps() @@ -2828,13 +2827,13 @@ def scaling_factor(self): EXAMPLES:: - 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 + sage: E = EllipticCurve(GF(257^2), [0,1]) # needs sage.rings.finite_rings + sage: phi = E.isogeny(E.lift_x(240)) # needs sage.rings.finite_rings + sage: phi.degree() # needs sage.rings.finite_rings 43 - sage: phi.scaling_factor() # optional - sage.rings.finite_rings + sage: phi.scaling_factor() # needs sage.rings.finite_rings 1 - sage: phi.dual().scaling_factor() # optional - sage.rings.finite_rings + sage: phi.dual().scaling_factor() # needs sage.rings.finite_rings 43 ALGORITHM: The "inner" isogeny is normalized by construction, @@ -2864,14 +2863,14 @@ def kernel_polynomial(self): sage: phi.kernel_polynomial() x^2 - 21*x + 80 - 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 + sage: E = EllipticCurve(GF(17), [1,-1,1,-1,1]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, [1]) # needs sage.rings.finite_rings + sage: phi.kernel_polynomial() # needs sage.rings.finite_rings 1 - 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 + sage: E = EllipticCurve(GF(31), [0,0,0,3,0]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, [0,3,0,1]) # needs sage.rings.finite_rings + sage: phi.kernel_polynomial() # needs sage.rings.finite_rings x^3 + 3*x """ if self.__kernel_polynomial is None: @@ -2887,9 +2886,9 @@ def is_separable(self): EXAMPLES:: - 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 + sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings + sage: phi.is_separable() # needs sage.rings.finite_rings True :: @@ -2910,45 +2909,45 @@ def _set_pre_isomorphism(self, preWI): TESTS:: - 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 + sage: E = EllipticCurve(GF(31), [1,1,0,1,-1]) # needs sage.rings.finite_rings + sage: R. = GF(31)[] # needs sage.rings.finite_rings + sage: f = x^3 + 9*x^2 + x + 30 # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings + sage: Epr = E.short_weierstrass_model() # needs sage.rings.finite_rings + sage: isom = Epr.isomorphism_to(E) # needs sage.rings.finite_rings + sage: phi._set_pre_isomorphism(isom) # needs sage.rings.finite_rings + sage: phi.rational_maps() # needs 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 + sage: phi(Epr((0,22))) # needs sage.rings.finite_rings (13 : 21 : 1) - sage: phi(Epr((3,7))) # optional - sage.rings.finite_rings + sage: phi(Epr((3,7))) # needs sage.rings.finite_rings (14 : 17 : 1) - 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 + sage: E = EllipticCurve(GF(29), [0,0,0,1,0]) # needs sage.rings.finite_rings + sage: R. = GF(29)[] # needs sage.rings.finite_rings + sage: f = x^2 + 5 # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings + sage: phi # needs 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)) # 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 + sage: inv_isom = WeierstrassIsomorphism(E, (1,-2,5,10)) # needs sage.rings.finite_rings + sage: Epr = inv_isom.codomain() # needs sage.rings.finite_rings + sage: isom = Epr.isomorphism_to(E) # needs sage.rings.finite_rings + sage: phi._set_pre_isomorphism(isom) # needs sage.rings.finite_rings + sage: phi # needs 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 + sage: phi(Epr((12,1))) # needs sage.rings.finite_rings (26 : 0 : 1) - sage: phi(Epr((2,9))) # optional - sage.rings.finite_rings + sage: phi(Epr((2,9))) # needs sage.rings.finite_rings (0 : 0 : 1) - sage: phi(Epr((21,12))) # optional - sage.rings.finite_rings + sage: phi(Epr((21,12))) # needs sage.rings.finite_rings (3 : 0 : 1) - sage: phi.rational_maps()[0] # optional - sage.rings.finite_rings + sage: phi.rational_maps()[0] # needs 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') @@ -2998,26 +2997,26 @@ def _set_post_isomorphism(self, postWI): TESTS:: - 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: E = EllipticCurve(j=GF(31)(0)) # needs sage.rings.finite_rings + sage: R. = GF(31)[] # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x+18) # needs 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))) # optional - sage.rings.finite_rings - sage: phi # optional - sage.rings.finite_rings + sage: phi._set_post_isomorphism(WeierstrassIsomorphism(phi.codomain(), (6,8,10,12))) # needs sage.rings.finite_rings + sage: phi # needs 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 + sage: E = EllipticCurve(j=GF(47)(0)) # needs sage.rings.finite_rings + sage: f = E.torsion_polynomial(3)/3 # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings + sage: E2 = phi.codomain() # needs sage.rings.finite_rings + sage: post_isom = E2.isomorphism_to(E) # needs sage.rings.finite_rings + sage: phi._set_post_isomorphism(post_isom) # needs sage.rings.finite_rings + sage: phi.rational_maps() == E.multiplication_by_m(3) # needs sage.rings.finite_rings False - sage: phi = -phi # optional - sage.rings.finite_rings - sage: phi.rational_maps() == E.multiplication_by_m(3) # optional - sage.rings.finite_rings + sage: phi = -phi # needs sage.rings.finite_rings + sage: phi.rational_maps() == E.multiplication_by_m(3) # needs sage.rings.finite_rings True sage: R. = QQ[] @@ -3083,49 +3082,49 @@ def dual(self): sage: (Xm, Ym) == E.multiplication_by_m(5) True - 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 + sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) # needs sage.rings.finite_rings + sage: R. = GF(37)[] # needs sage.rings.finite_rings + sage: f = x^3 + x^2 + 28*x + 33 # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings + sage: phi_hat = phi.dual() # needs sage.rings.finite_rings + sage: phi_hat.codomain() == phi.domain() # needs sage.rings.finite_rings True - sage: phi_hat.domain() == phi.codomain() # optional - sage.rings.finite_rings + sage: phi_hat.domain() == phi.codomain() # needs sage.rings.finite_rings True - 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 + sage: (X, Y) = phi.rational_maps() # needs sage.rings.finite_rings + sage: (Xhat, Yhat) = phi_hat.rational_maps() # needs sage.rings.finite_rings + sage: Xm = Xhat.subs(x=X, y=Y) # needs sage.rings.finite_rings + sage: Ym = Yhat.subs(x=X, y=Y) # needs sage.rings.finite_rings + sage: (Xm, Ym) == E.multiplication_by_m(7) # needs sage.rings.finite_rings True - 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 + sage: E = EllipticCurve(GF(31), [0,0,0,1,8]) # needs sage.rings.finite_rings + sage: R. = GF(31)[] # needs sage.rings.finite_rings + sage: f = x^2 + 17*x + 29 # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings + sage: phi_hat = phi.dual() # needs sage.rings.finite_rings + sage: phi_hat.codomain() == phi.domain() # needs sage.rings.finite_rings True - sage: phi_hat.domain() == phi.codomain() # optional - sage.rings.finite_rings + sage: phi_hat.domain() == phi.codomain() # needs sage.rings.finite_rings True - 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 + sage: (X, Y) = phi.rational_maps() # needs sage.rings.finite_rings + sage: (Xhat, Yhat) = phi_hat.rational_maps() # needs sage.rings.finite_rings + sage: Xm = Xhat.subs(x=X, y=Y) # needs sage.rings.finite_rings + sage: Ym = Yhat.subs(x=X, y=Y) # needs sage.rings.finite_rings + sage: (Xm, Ym) == E.multiplication_by_m(5) # needs sage.rings.finite_rings True Inseparable duals should be computed correctly:: - 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 + sage: z2 = GF(71^2).gen() # needs sage.rings.finite_rings + sage: E = EllipticCurve(j=57*z2+51) # needs sage.rings.finite_rings + sage: E.isogeny(3*E.lift_x(0)).dual() # needs 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() # optional - sage.rings.finite_rings + sage: E.isogeny(E.lift_x(0)).dual() # needs 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 @@ -3135,11 +3134,11 @@ def dual(self): ...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)) # 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 + sage: phi = E.isogeny(E.lift_x(0)) # needs sage.rings.finite_rings + sage: pre = ~WeierstrassIsomorphism(phi.domain(), (z2,2,3,4)) # needs sage.rings.finite_rings + sage: post = WeierstrassIsomorphism(phi.codomain(), (5,6,7,8)) # needs sage.rings.finite_rings + sage: phi = post * phi * pre # needs sage.rings.finite_rings + sage: phi.dual() # needs 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) @@ -3153,9 +3152,9 @@ def dual(self): Test for :trac:`23928`:: - 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 + sage: E = EllipticCurve(j=GF(431**2)(4)) # needs sage.rings.finite_rings + sage: phi = E.isogeny(E.lift_x(0)) # needs sage.rings.finite_rings + sage: phi.dual() # needs 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 @@ -3167,34 +3166,34 @@ def dual(self): sage: phi.dual().dual() == phi True - 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 + sage: k = GF(103) # needs sage.rings.finite_rings + sage: E = EllipticCurve(k,[11,11]) # needs sage.rings.finite_rings + sage: phi = E.isogeny(E(4,4)) # needs sage.rings.finite_rings + sage: phi # needs 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 # optional - sage.rings.finite_rings - sage: phi.dual().dual() == phi # optional - sage.rings.finite_rings + sage: phi = WeierstrassIsomorphism(phi.codomain(),(5,0,1,2)) * phi # needs sage.rings.finite_rings + sage: phi.dual().dual() == phi # needs sage.rings.finite_rings True - 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 + sage: E = EllipticCurve(GF(103),[1,0,0,1,-1]) # needs sage.rings.finite_rings + sage: phi = E.isogeny(E(60,85)) # needs sage.rings.finite_rings + sage: phi.dual() # needs 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) # 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 + sage: k. = QuadraticField(2) # needs sage.rings.number_field + sage: E = EllipticCurve(k, [-3*s*(4 + 5*s), 2*s*(2 + 14*s + 11*s^2)]) # needs sage.rings.number_field + sage: phi = E.isogenies_prime_degree(3)[0] # needs sage.rings.number_field + sage: (-phi).dual() == -phi.dual() # needs sage.rings.number_field True - sage: phi._EllipticCurveIsogeny__clear_cached_values() # forget the dual # optional - sage.rings.number_field - sage: -phi.dual() == (-phi).dual() # optional - sage.rings.number_field + sage: phi._EllipticCurveIsogeny__clear_cached_values() # forget the dual # needs sage.rings.number_field + sage: -phi.dual() == (-phi).dual() # needs sage.rings.number_field True """ if self.__base_field.characteristic() in (2, 3): @@ -3286,19 +3285,19 @@ def _composition_impl(left, right): EXAMPLES:: - 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 + sage: E = EllipticCurve(GF(127), [5,2]) # needs sage.rings.finite_rings + sage: phi = E.isogeny(E.lift_x(47)); E2 = phi.codomain() # needs sage.rings.finite_rings + sage: iso1 = E.change_weierstrass_model(1,1,1,1).isomorphism_to(E) # needs sage.rings.finite_rings + sage: iso2 = E2.isomorphism_to(E2.change_weierstrass_model(39,0,0,0)) # needs sage.rings.finite_rings + sage: phi * iso1 # indirect doctest # needs 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 + sage: iso2 * phi # indirect doctest # needs 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 + sage: iso2 * phi * iso1 # indirect doctest # needs 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 @@ -3308,7 +3307,7 @@ def _composition_impl(left, right): 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) # optional - sage.rings.finite_rings + sage: phi._composition_impl(iso1, iso1**-1) # needs sage.rings.finite_rings NotImplemented """ if isinstance(left, WeierstrassIsomorphism) and isinstance(right, EllipticCurveIsogeny): @@ -3363,22 +3362,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]) # 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 + sage: E = EllipticCurve(GF(97), [1,0,1,1,0]) # needs sage.rings.finite_rings + sage: R. = GF(97)[]; f = x^5 + 27*x^4 + 61*x^3 + 58*x^2 + 28*x + 21 # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings + sage: E2 = phi.codomain() # needs sage.rings.finite_rings + sage: isom1, isom2, E1pr, E2pr, ker_poly = compute_sequence_of_maps(E, E2, 11) # needs sage.rings.finite_rings + sage: compute_isogeny_stark(E1pr, E2pr, 11) # needs 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]) # 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 + sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) # needs sage.rings.finite_rings + sage: R. = GF(37)[] # needs sage.rings.finite_rings + sage: f = (x + 14) * (x + 30) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings + sage: E2 = phi.codomain() # needs sage.rings.finite_rings + sage: compute_isogeny_stark(E, E2, 5) # needs sage.rings.finite_rings x^4 + 14*x^3 + x^2 + 34*x + 21 - sage: f**2 # optional - sage.rings.finite_rings + sage: f**2 # needs sage.rings.finite_rings x^4 + 14*x^3 + x^2 + 34*x + 21 sage: E = EllipticCurve(QQ, [0,0,0,1,0]) @@ -3460,11 +3459,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)) # 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 + sage: q = next_prime(randrange(3,10^3)) # needs sage.rings.finite_rings + sage: e = randrange(1,5) # needs sage.rings.finite_rings + sage: R = GF(q^e,'a')['x'] # needs sage.rings.finite_rings + sage: f = R.random_element(randrange(10,100)).monic() # needs sage.rings.finite_rings + sage: split_kernel_polynomial(f) == f.radical() # needs sage.rings.finite_rings doctest:warning ... DeprecationWarning: ... True @@ -3504,40 +3503,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]) # 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 + sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) # needs sage.rings.finite_rings + sage: R. = GF(37)[] # needs sage.rings.finite_rings + sage: f = (x + 14) * (x + 30) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings + sage: E2 = phi.codomain() # needs sage.rings.finite_rings + sage: compute_isogeny_kernel_polynomial(E, E2, 5) # needs sage.rings.finite_rings x^2 + 7*x + 13 - sage: f # optional - sage.rings.finite_rings + sage: f # needs sage.rings.finite_rings x^2 + 7*x + 13 sage: R. = QQ[] - 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 + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,0,1,0]) # needs sage.rings.number_field + sage: E2 = EllipticCurve(K, [0,0,0,16,0]) # needs sage.rings.number_field + sage: compute_isogeny_kernel_polynomial(E, E2, 4) # needs 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]) # 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: E = EllipticCurve(GF(37), [0,0,0,1,8]) # needs sage.rings.finite_rings + sage: R. = GF(37)[] # needs sage.rings.finite_rings + sage: f = (x + 10) * (x + 12) * (x + 16) # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings + sage: E2 = phi.codomain() # needs 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 # optional - sage.rings.finite_rings + sage: ker_poly = compute_isogeny_stark(E, E2, 7); ker_poly # needs 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() # optional - sage.rings.finite_rings + sage: ker_poly.factor() # needs sage.rings.finite_rings (x + 10)^2 * (x + 12)^2 * (x + 16)^2 - sage: poly = ker_poly.radical(); poly # optional - sage.rings.finite_rings + sage: poly = ker_poly.radical(); poly # needs sage.rings.finite_rings x^3 + x^2 + 28*x + 33 - sage: poly.factor() # optional - sage.rings.finite_rings + sage: poly.factor() # needs sage.rings.finite_rings (x + 10) * (x + 12) * (x + 16) """ if algorithm == 'starks': @@ -3585,11 +3584,11 @@ 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]) # 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 + sage: E = EllipticCurve(GF(83), [1,0,1,1,0]) # needs sage.rings.finite_rings + sage: R. = GF(83)[]; f = x + 24 # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings + sage: E2 = phi.codomain() # needs sage.rings.finite_rings + sage: compute_intermediate_curves(E, E2) # needs 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: @@ -3606,10 +3605,10 @@ def compute_intermediate_curves(E1, E2): Via: (u,r,s,t) = (1, 7, 42, 42)) sage: R. = QQ[] - 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 + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,0,1,0]) # needs sage.rings.number_field + sage: E2 = EllipticCurve(K, [0,0,0,16,0]) # needs sage.rings.number_field + sage: compute_intermediate_curves(E, E2) # needs 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 @@ -3696,10 +3695,10 @@ def compute_sequence_of_maps(E1, E2, ell): 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) # 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 + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,0,1,0]) # needs sage.rings.number_field + sage: E2 = EllipticCurve(K, [0,0,0,16,0]) # needs sage.rings.number_field + sage: compute_sequence_of_maps(E, E2, 4) # needs 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), @@ -3712,11 +3711,11 @@ def compute_sequence_of_maps(E1, E2, ell): over Number Field in i with defining polynomial x^2 + 1, x^3 + x) - 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 + sage: E = EllipticCurve(GF(97), [1,0,1,1,0]) # needs sage.rings.finite_rings + sage: R. = GF(97)[]; f = x^5 + 27*x^4 + 61*x^3 + 58*x^2 + 28*x + 21 # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings + sage: E2 = phi.codomain() # needs sage.rings.finite_rings + sage: compute_sequence_of_maps(E, E2, 11) # needs 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 diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index 3c359e3de03..6d6d67a81db 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -48,8 +48,8 @@ def genus(self): EXAMPLES:: - sage: E = EllipticCurve(GF(3), [0, -1, 0, -346, 2652]) # optional - sage.rings.finite_rings - sage: E.genus() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(3), [0, -1, 0, -346, 2652]) # needs sage.rings.finite_rings + sage: E.genus() # needs sage.rings.finite_rings 1 sage: R = FractionField(QQ['z']) @@ -98,52 +98,52 @@ def quadratic_twist(self, D=None): EXAMPLES:: - sage: E = EllipticCurve([GF(1103)(1), 0, 0, 107, 340]); E # optional - sage.rings.finite_rings + sage: E = EllipticCurve([GF(1103)(1), 0, 0, 107, 340]); E # needs 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 + sage: F = E.quadratic_twist(-1); F # needs 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 + sage: E.is_isomorphic(F) # needs sage.rings.finite_rings False - sage: E.is_isomorphic(F, GF(1103^2,'a')) # optional - sage.rings.finite_rings + sage: E.is_isomorphic(F, GF(1103^2,'a')) # needs sage.rings.finite_rings True A characteristic 2 example:: - 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 + sage: E = EllipticCurve(GF(2), [1,0,1,1,1]) # needs sage.rings.finite_rings + sage: E1 = E.quadratic_twist(1) # needs sage.rings.finite_rings + sage: E.is_isomorphic(E1) # needs sage.rings.finite_rings False - sage: E.is_isomorphic(E1, GF(4,'a')) # optional - sage.rings.finite_rings + sage: E.is_isomorphic(E1, GF(4,'a')) # needs sage.rings.finite_rings True Over finite fields, the twisting parameter may be omitted:: - 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 + sage: k. = GF(2^10) # needs sage.rings.finite_rings + sage: E = EllipticCurve(k, [a^2,a,1,a+1,1]) # needs sage.rings.finite_rings + sage: Et = E.quadratic_twist() # needs sage.rings.finite_rings + sage: Et # random (only determined up to isomorphism) # needs 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 + sage: E.is_isomorphic(Et) # needs sage.rings.finite_rings False - sage: E.j_invariant() == Et.j_invariant() # optional - sage.rings.finite_rings + sage: E.j_invariant() == Et.j_invariant() # needs sage.rings.finite_rings True - 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 + sage: p = next_prime(10^10) # needs sage.rings.finite_rings + sage: k = GF(p) # needs sage.rings.finite_rings + sage: E = EllipticCurve(k, [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: Et = E.quadratic_twist() # needs sage.rings.finite_rings + sage: Et # random (only determined up to isomorphism) # needs 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 + sage: E.is_isomorphic(Et) # needs sage.rings.finite_rings False - 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 + sage: k2 = GF(p^2,'a') # needs sage.rings.finite_rings + sage: E.change_ring(k2).is_isomorphic(Et.change_ring(k2)) # needs sage.rings.finite_rings True """ K = self.base_ring() @@ -210,8 +210,8 @@ def two_torsion_rank(self): sage: E = EllipticCurve('11a1') sage: E.two_torsion_rank() 0 - 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 + sage: K. = QQ.extension(E.division_polynomial(2).monic()) # needs sage.rings.number_field + sage: E.base_extend(K).two_torsion_rank() # needs sage.rings.number_field 1 sage: E.reduction(53).two_torsion_rank() 2 @@ -222,8 +222,8 @@ def two_torsion_rank(self): sage: E.two_torsion_rank() 1 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 + sage: K. = QQ.extension(f) # needs sage.rings.number_field + sage: E.base_extend(K).two_torsion_rank() # needs sage.rings.number_field 2 :: @@ -249,15 +249,15 @@ def quartic_twist(self, D): EXAMPLES:: - sage: E = EllipticCurve_from_j(GF(13)(1728)); E # optional - sage.rings.finite_rings + sage: E = EllipticCurve_from_j(GF(13)(1728)); E # needs 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 # optional - sage.rings.finite_rings + sage: E1 = E.quartic_twist(2); E1 # needs 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) # optional - sage.rings.finite_rings + sage: E.is_isomorphic(E1) # needs sage.rings.finite_rings False - sage: E.is_isomorphic(E1, GF(13^2,'a')) # optional - sage.rings.finite_rings + sage: E.is_isomorphic(E1, GF(13^2,'a')) # needs sage.rings.finite_rings False - sage: E.is_isomorphic(E1, GF(13^4,'a')) # optional - sage.rings.finite_rings + sage: E.is_isomorphic(E1, GF(13^4,'a')) # needs sage.rings.finite_rings True """ K = self.base_ring() @@ -292,17 +292,17 @@ def sextic_twist(self, D): EXAMPLES:: - sage: E = EllipticCurve_from_j(GF(13)(0)); E # optional - sage.rings.finite_rings + sage: E = EllipticCurve_from_j(GF(13)(0)); E # needs 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 # optional - sage.rings.finite_rings + sage: E1 = E.sextic_twist(2); E1 # needs sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 11 over Finite Field of size 13 - sage: E.is_isomorphic(E1) # optional - sage.rings.finite_rings + sage: E.is_isomorphic(E1) # needs sage.rings.finite_rings False - sage: E.is_isomorphic(E1, GF(13^2,'a')) # optional - sage.rings.finite_rings + sage: E.is_isomorphic(E1, GF(13^2,'a')) # needs sage.rings.finite_rings False - sage: E.is_isomorphic(E1, GF(13^4,'a')) # optional - sage.rings.finite_rings + sage: E.is_isomorphic(E1, GF(13^4,'a')) # needs sage.rings.finite_rings False - sage: E.is_isomorphic(E1, GF(13^6,'a')) # optional - sage.rings.finite_rings + sage: E.is_isomorphic(E1, GF(13^6,'a')) # needs sage.rings.finite_rings True """ K = self.base_ring() @@ -377,40 +377,40 @@ def is_quadratic_twist(self, other): :: - 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 + sage: F = GF(101) # needs sage.rings.finite_rings + sage: E1 = EllipticCurve(F, [4,7]) # needs sage.rings.finite_rings + sage: E2 = E1.quadratic_twist() # needs sage.rings.finite_rings + sage: D = E1.is_quadratic_twist(E2); D != 0 # needs sage.rings.finite_rings True - 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 + sage: F = GF(101) # needs sage.rings.finite_rings + sage: E1 = EllipticCurve(F, [4,7]) # needs sage.rings.finite_rings + sage: E2 = E1.quadratic_twist() # needs sage.rings.finite_rings + sage: D = E1.is_quadratic_twist(E2) # needs sage.rings.finite_rings + sage: E1.quadratic_twist(D).is_isomorphic(E2) # needs sage.rings.finite_rings True - sage: E1.is_isomorphic(E2) # optional - sage.rings.finite_rings + sage: E1.is_isomorphic(E2) # needs sage.rings.finite_rings False - 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 + sage: F2 = GF(101^2,'a') # needs sage.rings.finite_rings + sage: E1.change_ring(F2).is_isomorphic(E2.change_ring(F2)) # needs sage.rings.finite_rings True A characteristic 3 example:: - 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 + sage: F = GF(3^5,'a') # needs sage.rings.finite_rings + sage: E1 = EllipticCurve_from_j(F(1)) # needs sage.rings.finite_rings + sage: E2 = E1.quadratic_twist(-1) # needs sage.rings.finite_rings + sage: D = E1.is_quadratic_twist(E2); D != 0 # needs sage.rings.finite_rings True - sage: E1.quadratic_twist(D).is_isomorphic(E2) # optional - sage.rings.finite_rings + sage: E1.quadratic_twist(D).is_isomorphic(E2) # needs sage.rings.finite_rings True :: - 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 + sage: E1 = EllipticCurve_from_j(F(0)) # needs sage.rings.finite_rings + sage: E2 = E1.quadratic_twist() # needs sage.rings.finite_rings + sage: D = E1.is_quadratic_twist(E2); D # needs sage.rings.finite_rings 1 - sage: E1.is_isomorphic(E2) # optional - sage.rings.finite_rings + sage: E1.is_isomorphic(E2) # needs sage.rings.finite_rings True """ from sage.schemes.elliptic_curves.ell_generic import is_EllipticCurve @@ -496,11 +496,11 @@ def is_quartic_twist(self, other): EXAMPLES:: - 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 + sage: E = EllipticCurve_from_j(GF(13)(1728)) # needs sage.rings.finite_rings + sage: E1 = E.quartic_twist(2) # needs sage.rings.finite_rings + sage: D = E.is_quartic_twist(E1); D!=0 # needs sage.rings.finite_rings True - sage: E.quartic_twist(D).is_isomorphic(E1) # optional - sage.rings.finite_rings + sage: E.quartic_twist(D).is_isomorphic(E1) # needs sage.rings.finite_rings True :: @@ -565,11 +565,11 @@ def is_sextic_twist(self, other): EXAMPLES:: - 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 + sage: E = EllipticCurve_from_j(GF(13)(0)) # needs sage.rings.finite_rings + sage: E1 = E.sextic_twist(2) # needs sage.rings.finite_rings + sage: D = E.is_sextic_twist(E1); D != 0 # needs sage.rings.finite_rings True - sage: E.sextic_twist(D).is_isomorphic(E1) # optional - sage.rings.finite_rings + sage: E.sextic_twist(D).is_isomorphic(E1) # needs sage.rings.finite_rings True :: @@ -650,51 +650,51 @@ def descend_to(self, K, f=None): :: - sage: F. = QuadraticField(23) # optional - sage.rings.number_field + sage: F. = QuadraticField(23) # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: G. = F.extension(x^3 + 5) # optional - sage.rings.number_field - 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 + sage: G. = F.extension(x^3 + 5) # needs sage.rings.number_field + sage: E = EllipticCurve(j=1728*b).change_ring(G) # needs sage.rings.number_field + sage: EF = E.descend_to(F); EF # needs 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 + sage: all(Ei.change_ring(G).is_isomorphic(E) for Ei in EF) # needs sage.rings.number_field True :: - 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 + sage: L. = NumberField(x^4 - 7) # needs sage.rings.number_field + sage: K. = NumberField(x^2 - 7, embedding=a^2) # needs sage.rings.number_field + sage: E = EllipticCurve([a^6, 0]) # needs sage.rings.number_field + sage: EK = E.descend_to(K); EK # needs 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 + sage: all(Ei.change_ring(L).is_isomorphic(E) for Ei in EK) # needs sage.rings.number_field True :: - 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 + sage: K. = QuadraticField(17) # needs sage.rings.number_field + sage: E = EllipticCurve(j=2*a) # needs sage.rings.number_field + sage: E.descend_to(QQ) # needs sage.rings.number_field [] TESTS: Check that :trac:`16456` is fixed:: - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve('11a1').quadratic_twist(2) # needs sage.rings.number_field + sage: EK = E.change_ring(K) # needs sage.rings.number_field + sage: EK2 = EK.change_weierstrass_model((a,a,a,a+1)) # needs sage.rings.number_field + sage: EK2.descend_to(QQ) # needs sage.rings.number_field [Elliptic Curve defined by y^2 = x^3 + x^2 - 41*x - 199 over Rational Field] - 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 + sage: k. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve(k,[0,0,0,1,0]) # needs sage.rings.number_field + sage: E.descend_to(QQ) # needs 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] """ @@ -820,16 +820,16 @@ 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 # optional - sage.rings.number_field + sage: K. = E.division_field(2); K # needs sage.rings.number_field Number Field in b with defining polynomial x sage: E = EllipticCurve('14a1') - sage: K. = E.division_field(2); K # optional - sage.rings.number_field + sage: K. = E.division_field(2); K # needs 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 # optional - sage.rings.number_field + sage: K. = E.division_field(2); K # needs 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 # optional - sage.rings.number_field + sage: K. = E.division_field(2); K # needs 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 @@ -838,10 +838,10 @@ def division_field(self, l, names='t', map=False, **kwds): of it. :: sage: E = EllipticCurve('50a1') - sage: F. = E.division_polynomial(3).splitting_field(simplify_all=True); F # optional - sage.rings.number_field + sage: F. = E.division_polynomial(3).splitting_field(simplify_all=True); F # needs 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 + sage: K. = E.division_field(3, simplify_all=True); K # needs 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 @@ -849,75 +849,75 @@ def division_field(self, l, names='t', map=False, **kwds): 3-division polynomial remains the same, but the 3-division field becomes a quadratic extension:: - 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 + sage: E = E.quadratic_twist(5) # 50b3 # needs sage.rings.number_field + sage: F. = E.division_polynomial(3).splitting_field(simplify_all=True); F # needs 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 + sage: K. = E.division_field(3, simplify_all=True); K # needs 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] # optional - sage.rings.number_field - sage: E = E.base_extend(G).quadratic_twist(c); E # optional - sage.rings.number_field + sage: G.,_,_ = F.subfields(3)[0] # needs sage.rings.number_field + sage: E = E.base_extend(G).quadratic_twist(c); E # needs 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 + sage: K. = E.division_field(3, simplify_all=True); K # needs 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') # optional - sage.rings.number_field - sage: K. = E.division_field(2); K # optional - sage.rings.number_field + sage: E = EllipticCurve('11a1') # needs sage.rings.number_field + sage: K. = E.division_field(2); K # needs 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 + sage: K. = E.division_field(3); K # long time # needs sage.rings.number_field Number Field in b with defining polynomial x^48 ... - sage: K. = E.division_field(5); K # optional - sage.rings.number_field + sage: K. = E.division_field(5); K # needs 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) # optional - sage.rings.number_field + sage: E.division_field(5, 'b', simplify=False) # needs 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) # optional - sage.rings.number_field + sage: E.base_extend(K).torsion_subgroup() # long time # needs 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') # optional - sage.rings.number_field - sage: K. = E.division_field(3); K # optional - sage.rings.number_field + sage: E = EllipticCurve('27a1') # needs sage.rings.number_field + sage: K. = E.division_field(3); K # needs sage.rings.number_field Number Field in b with defining polynomial x^2 + 3*x + 9 - sage: K. = E.division_field(2); K # optional - sage.rings.number_field + sage: K. = E.division_field(2); K # needs 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 + sage: K. = E.division_field(2, simplify_all=True); K # needs 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) # optional - sage.rings.number_field + sage: K. = E.division_field(5); K # long time # needs 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) # optional - sage.rings.number_field + sage: K. = E.division_field(7); K # long time # needs 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) # 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 + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: E = EllipticCurve([0,0,0,0,i]) # needs sage.rings.number_field + sage: L. = E.division_field(2); L # needs 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 # optional - sage.rings.number_field + sage: L., phi = E.division_field(2, map=True); phi # needs 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) # optional - sage.rings.number_field - sage: L # optional - sage.rings.number_field + sage: L., phi = E.division_field(3, map=True) # needs sage.rings.number_field + sage: L # needs 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 + sage: phi # needs 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 ... @@ -925,8 +925,8 @@ def division_field(self, l, names='t', map=False, **kwds): Over a finite field:: - 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 + sage: E = EllipticCurve(GF(431^2), [1,0]) # needs sage.rings.finite_rings + sage: E.division_field(5, map=True) # needs sage.rings.finite_rings (Finite Field in t of size 431^4, Ring morphism: From: Finite Field in z2 of size 431^2 @@ -935,8 +935,8 @@ def division_field(self, l, names='t', map=False, **kwds): :: - 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 + sage: E = EllipticCurve(GF(433^2), [1,0]) # needs sage.rings.finite_rings + sage: K. = E.division_field(7); K # needs sage.rings.finite_rings Finite Field in v of size 433^16 .. SEEALSO:: @@ -974,20 +974,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)) # optional - sage.rings.finite_rings - sage: F. = GF(q) # optional - sage.rings.finite_rings - sage: while True: # optional - sage.rings.finite_rings + sage: q = next_prime_power(randrange(1, 10^9)) # needs sage.rings.finite_rings + sage: F. = GF(q) # needs sage.rings.finite_rings + sage: while True: # needs sage.rings.finite_rings ....: try: ....: E = EllipticCurve([F.random_element() for _ in range(5)]) ....: except ArithmeticError: ....: continue ....: break - 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 + sage: l = random_prime(8) # needs sage.rings.finite_rings + sage: K = E.division_field(l) # needs sage.rings.finite_rings + sage: n = E.cardinality(extension_degree=K.degree()//F.degree()) # needs sage.rings.finite_rings + sage: (l^2 if q%l else 0 + E.is_ordinary()).divides(n) # needs sage.rings.finite_rings True - sage: check(E, l, K) # long time # optional - sage.rings.finite_rings + sage: check(E, l, K) # long time # needs sage.rings.finite_rings AUTHORS: @@ -1161,11 +1161,11 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al EXAMPLES:: - 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 + sage: F = GF(2^5, 'alpha'); alpha = F.gen() # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [1,0,1,1,1]) # needs sage.rings.finite_rings + sage: R. = F[] # needs sage.rings.finite_rings + sage: phi = E.isogeny(x + 1) # needs sage.rings.finite_rings + sage: phi.rational_maps() # needs sage.rings.finite_rings ((x^2 + x + 1)/(x + 1), (x^2*y + x)/(x^2 + 1)) :: @@ -1181,22 +1181,22 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al :: - 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 + sage: E = EllipticCurve(GF(19),[1,1]) # needs sage.rings.finite_rings + sage: P = E(15,3); Q = E(2,12) # needs sage.rings.finite_rings + sage: (P.order(), Q.order()) # needs sage.rings.finite_rings (7, 3) - sage: phi = E.isogeny([P,Q]); phi # optional - sage.rings.finite_rings + sage: phi = E.isogeny([P,Q]); phi # needs 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 + sage: phi(E.random_point()) # all points defined over GF(19) are in the kernel # needs sage.rings.finite_rings (0 : 1 : 0) :: - 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 + sage: E = EllipticCurve(GF(2^32 - 5), [170246996, 2036646110]) # needs sage.rings.finite_rings + sage: P = E.lift_x(2) # needs sage.rings.finite_rings + sage: E.isogeny(P, algorithm="factored") # needs 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 @@ -1205,8 +1205,8 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al Not all polynomials define a finite subgroup (:trac:`6384`):: - 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 + sage: E = EllipticCurve(GF(31), [1,0,0,1,2]) # needs sage.rings.finite_rings + sage: phi = E.isogeny([14,27,4,1]) # needs 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 @@ -1226,10 +1226,10 @@ 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) # 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 + sage: K. = NumberField(x^2 - x - 1) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [-13392, -1080432]) # needs sage.rings.number_field + sage: R. = K[] # needs sage.rings.number_field + sage: phi = E.isogeny( (x-564)*(x - 396/5*a + 348/5) ) # needs 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 @@ -1238,10 +1238,10 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al We check that the cached order is correctly copied over:: - 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 + sage: E = EllipticCurve(GF(2^127-1), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: E.set_order(170141183460469231746191640949390434666) # needs sage.rings.finite_rings + sage: phi = E.isogeny(E.lift_x(77347718128277853096420969229987528666)) # needs sage.rings.finite_rings + sage: phi.codomain()._order # needs sage.rings.finite_rings 170141183460469231746191640949390434666 """ if algorithm is not None and degree is not None: @@ -1283,15 +1283,15 @@ def isogeny_codomain(self, kernel, degree=None): We check that the cached order is correctly copied over:: - 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 + sage: E = EllipticCurve(GF(2^127 - 1), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: E.set_order(170141183460469231746191640949390434666) # needs sage.rings.finite_rings + sage: E2 = E.isogeny_codomain(E.lift_x(77347718128277853096420969229987528666)) # needs sage.rings.finite_rings + sage: E2._order # needs sage.rings.finite_rings 170141183460469231746191640949390434666 Test deprecation warning for obsolete argument:: - sage: E.isogeny_codomain(E.lift_x(77347718128277853096420969229987528666), degree=11) # optional - sage.rings.finite_rings + sage: E.isogeny_codomain(E.lift_x(77347718128277853096420969229987528666), degree=11) # needs sage.rings.finite_rings doctest:warning ... DeprecationWarning: The "degree" argument to .isogeny_codomain() does nothing and will be removed. @@ -1336,8 +1336,8 @@ def isogenies_prime_degree(self, l=None, max_l=31): Examples over finite fields:: - 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 + sage: E = EllipticCurve(GF(next_prime(1000000)), [7,8]) # needs sage.rings.finite_rings + sage: E.isogenies_prime_degree(2) # needs 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, @@ -1347,22 +1347,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) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(3) # needs sage.rings.finite_rings [] - sage: E.isogenies_prime_degree(5) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(5) # needs sage.rings.finite_rings [] - sage: E.isogenies_prime_degree(7) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(7) # needs sage.rings.finite_rings [] - sage: E.isogenies_prime_degree(11) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(11) # needs sage.rings.finite_rings [] - sage: E.isogenies_prime_degree(13) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(13) # needs 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) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(max_l=13) # needs 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, @@ -1378,7 +1378,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 # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree() # Default limit of 31 # needs 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, @@ -1404,10 +1404,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]) # optional - sage.rings.finite_rings - sage: E.isogenies_prime_degree(3) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(17), [2,0]) # needs sage.rings.finite_rings + sage: E.isogenies_prime_degree(3) # needs sage.rings.finite_rings [] - sage: E.isogenies_prime_degree(2) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(2) # needs 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, @@ -1421,16 +1421,16 @@ 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]) # optional - sage.rings.finite_rings - sage: E.isogenies_prime_degree(max_l=3) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(13), [2,8]) # needs sage.rings.finite_rings + sage: E.isogenies_prime_degree(max_l=3) # needs 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, 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]) # optional - sage.rings.finite_rings - sage: E.isogenies_prime_degree(max_l=3) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(13^6), [2,8]) # needs sage.rings.finite_rings + sage: E.isogenies_prime_degree(max_l=3) # needs 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, @@ -1456,19 +1456,19 @@ def isogenies_prime_degree(self, l=None, max_l=31): If the degree equals the characteristic, we find only separable isogenies:: - sage: E = EllipticCurve(GF(13), [2,8]) # optional - sage.rings.finite_rings - sage: E.isogenies_prime_degree(13) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(13), [2,8]) # needs sage.rings.finite_rings + sage: E.isogenies_prime_degree(13) # needs 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]) # optional - sage.rings.finite_rings - sage: E.isogenies_prime_degree(5) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(5), [1,1]) # needs sage.rings.finite_rings + sage: E.isogenies_prime_degree(5) # needs 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) # 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 + sage: k. = GF(3^4) # needs sage.rings.finite_rings + sage: E = EllipticCurve(k, [0,1,0,0,a]) # needs sage.rings.finite_rings + sage: E.isogenies_prime_degree(3) # needs 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 @@ -1478,16 +1478,16 @@ def isogenies_prime_degree(self, l=None, max_l=31): In the supersingular case, there are no separable isogenies of degree equal to the characteristic:: - sage: E = EllipticCurve(GF(5), [0,1]) # optional - sage.rings.finite_rings - sage: E.isogenies_prime_degree(5) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(5), [0,1]) # needs sage.rings.finite_rings + sage: E.isogenies_prime_degree(5) # needs sage.rings.finite_rings [] An example over a rational function field:: - 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 + sage: R. = GF(5)[] # needs sage.rings.finite_rings + sage: K = R.fraction_field() # needs sage.rings.finite_rings + sage: E = EllipticCurve(K, [1, t^5]) # needs sage.rings.finite_rings + sage: E.isogenies_prime_degree(5) # needs 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 @@ -1497,9 +1497,9 @@ def isogenies_prime_degree(self, l=None, max_l=31): Examples over number fields (other than QQ):: sage: x = polygen(ZZ, 'x') - 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 + sage: QQroot2. = NumberField(x^2 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve(QQroot2, j=8000) # needs sage.rings.number_field + sage: E.isogenies_prime_degree() # needs 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 @@ -1516,16 +1516,16 @@ def isogenies_prime_degree(self, l=None, max_l=31): 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 + sage: E = EllipticCurve(QQroot2, [1,0,1,4, -6]); E # needs 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 + sage: E.isogenies_prime_degree(2) # needs 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) # optional - sage.rings.number_field + sage: E.isogenies_prime_degree(3) # needs 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 @@ -1539,9 +1539,9 @@ def isogenies_prime_degree(self, l=None, max_l=31): These are not implemented yet:: - sage: E = EllipticCurve(QQbar, [1,18]); E # optional - sage.rings.number_field + sage: E = EllipticCurve(QQbar, [1,18]); E # needs sage.rings.number_field Elliptic Curve defined by y^2 = x^3 + x + 18 over Algebraic Field - sage: E.isogenies_prime_degree() # optional - sage.rings.number_field + sage: E.isogenies_prime_degree() # needs sage.rings.number_field Traceback (most recent call last): ... NotImplementedError: This code could be implemented for QQbar, but has not been yet. @@ -1721,18 +1721,18 @@ def hasse_invariant(self): Some examples over larger fields:: - sage: EllipticCurve(GF(101), [0,0,0,0,1]).hasse_invariant() # optional - sage.rings.finite_rings + sage: EllipticCurve(GF(101), [0,0,0,0,1]).hasse_invariant() # needs sage.rings.finite_rings 0 - sage: EllipticCurve(GF(101), [0,0,0,1,1]).hasse_invariant() # optional - sage.rings.finite_rings + sage: EllipticCurve(GF(101), [0,0,0,1,1]).hasse_invariant() # needs sage.rings.finite_rings 98 - sage: EllipticCurve(GF(103), [0,0,0,0,1]).hasse_invariant() # optional - sage.rings.finite_rings + sage: EllipticCurve(GF(103), [0,0,0,0,1]).hasse_invariant() # needs sage.rings.finite_rings 20 - sage: EllipticCurve(GF(103), [0,0,0,1,1]).hasse_invariant() # optional - sage.rings.finite_rings + sage: EllipticCurve(GF(103), [0,0,0,1,1]).hasse_invariant() # needs sage.rings.finite_rings 17 - 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 + sage: F. = GF(107^2) # needs sage.rings.finite_rings + sage: EllipticCurve(F, [0,0,0,a,1]).hasse_invariant() # needs sage.rings.finite_rings 62*a + 75 - sage: EllipticCurve(F, [0,0,0,0,a]).hasse_invariant() # optional - sage.rings.finite_rings + sage: EllipticCurve(F, [0,0,0,0,a]).hasse_invariant() # needs sage.rings.finite_rings 0 Over fields of characteristic zero, the Hasse invariant is @@ -1793,16 +1793,15 @@ class of curves. If the j-invariant is not unique in the isogeny Ordinary curve over finite extension field of degree 2:: sage: x = polygen(ZZ, 'x') - 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 + sage: E = EllipticCurve(GF(59^2, "i", x^2 + 1), j=5) # needs sage.rings.finite_rings + sage: G = E.isogeny_ell_graph(5, directed=False, label_by_j=True); G # needs sage.graphs sage.rings.finite_rings Graph on 20 vertices - sage: G.vertices(sort=True) # optional - sage.graphs sage.rings.finite_rings + sage: G.vertices(sort=True) # needs sage.graphs sage.rings.finite_rings ['1', '12', ... 'i + 55'] - sage: G.edges(sort=True) # optional - sage.graphs sage.rings.finite_rings + sage: G.edges(sort=True) # needs sage.graphs sage.rings.finite_rings [('1', '28*i + 11', None), ('1', '31*i + 11', None), ... @@ -1810,26 +1809,24 @@ 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) # 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 + sage: E = EllipticCurve(GF(419), j=1728) # needs sage.rings.finite_rings + sage: G3 = E.isogeny_ell_graph(3, directed=False, label_by_j=True); G3 # needs sage.graphs sage.rings.finite_rings Graph on 27 vertices - sage: G3.vertices(sort=True) # optional - sage.graphs sage.rings.finite_rings + sage: G3.vertices(sort=True) # needs sage.graphs sage.rings.finite_rings ['0', '0*', ... '98*'] - sage: G3.edges(sort=True) # optional - sage.graphs sage.rings.finite_rings + sage: G3.edges(sort=True) # needs 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) # optional - sage.graphs sage.rings.finite_rings - sage: G5 # optional - sage.graphs sage.rings.finite_rings + sage: G5 = E.isogeny_ell_graph(5, directed=False, label_by_j=True); G5 # needs sage.graphs sage.rings.finite_rings Graph on 9 vertices - sage: G5.vertices(sort=True) # optional - sage.graphs sage.rings.finite_rings + sage: G5.vertices(sort=True) # needs sage.graphs sage.rings.finite_rings ['13', '13*', '407', '407*', '52', '62', '62*', '98', '98*'] - sage: G5.edges(sort=True) # optional - sage.graphs sage.rings.finite_rings + sage: G5.edges(sort=True) # needs sage.graphs sage.rings.finite_rings [('13', '52', None), ('13', '98', None), ... @@ -1837,32 +1834,30 @@ 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) # 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 + sage: K = GF(431^2, "i", x^2 + 1) # needs sage.rings.finite_rings + sage: E = EllipticCurve(K, j=0) # needs sage.rings.finite_rings + sage: E.is_supersingular() # needs sage.rings.finite_rings True - 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 + sage: G = E.isogeny_ell_graph(2, directed=True, label_by_j=True); G # needs sage.graphs sage.rings.finite_rings Looped multi-digraph on 37 vertices - sage: G.vertices(sort=True) # optional - sage.graphs sage.rings.finite_rings + sage: G.vertices(sort=True) # needs sage.graphs sage.rings.finite_rings ['0', '102', ... '87*i + 190'] - sage: G.edges(sort=True) # optional - sage.graphs sage.rings.finite_rings + sage: G.edges(sort=True) # needs 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) # optional - sage.graphs sage.rings.finite_rings - sage: H # optional - sage.graphs sage.rings.finite_rings + sage: H = E.isogeny_ell_graph(2, directed=False, label_by_j=True); H # needs sage.graphs sage.rings.finite_rings Looped multi-graph on 37 vertices - sage: H.vertices(sort=True) # optional - sage.graphs sage.rings.finite_rings + sage: H.vertices(sort=True) # needs sage.graphs sage.rings.finite_rings ['0', '102', ... '87*i + 190'] - sage: H.edges(sort=True) # optional - sage.graphs sage.rings.finite_rings + sage: H.edges(sort=True) # needs sage.graphs sage.rings.finite_rings [('0', '125', None), ('102', '125', None), ... @@ -1870,27 +1865,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) # 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 + sage: K. = NumberField(x^2 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [1, 0, 1, 4, -6]) # needs sage.rings.number_field + sage: G2 = E.isogeny_ell_graph(2, directed=False) # needs sage.graphs sage.rings.number_field + sage: G2.vertices(sort=True) # needs 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) # optional - sage.graphs sage.rings.number_field + sage: G2.edges(sort=True) # needs 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) # optional - sage.graphs sage.rings.number_field - sage: G3.vertices(sort=True) # optional - sage.graphs sage.rings.number_field + sage: G3 = E.isogeny_ell_graph(3, directed=False) # needs sage.graphs sage.rings.number_field + sage: G3.vertices(sort=True) # needs 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) # optional - sage.graphs sage.rings.number_field + sage: G3.edges(sort=True) # needs 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)', @@ -1898,21 +1893,21 @@ class of curves. If the j-invariant is not unique in the isogeny TESTS:: - 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 + sage: E = EllipticCurve(GF(11), j=0) # needs sage.rings.finite_rings + sage: G0 = E.isogeny_ell_graph(2, directed=False) # needs sage.graphs sage.rings.finite_rings + sage: G0.is_directed() # needs sage.graphs sage.rings.finite_rings False - 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 + sage: G1 = E.isogeny_ell_graph(2, directed=True) # needs sage.graphs sage.rings.finite_rings + sage: G1.is_directed() # needs sage.graphs sage.rings.finite_rings 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 + sage: G2 = E.isogeny_ell_graph(2, label_by_j=False) # needs sage.graphs sage.rings.finite_rings + sage: G2.vertices(sort=True) # needs 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) # optional - sage.graphs sage.rings.finite_rings - sage: G3.vertices(sort=True) # optional - sage.graphs sage.rings.finite_rings + sage: G3 = E.isogeny_ell_graph(2, label_by_j=True) # needs sage.graphs sage.rings.finite_rings + sage: G3.vertices(sort=True) # needs sage.graphs sage.rings.finite_rings ['0', '0*', '1', '1*'] """ diff --git a/src/sage/schemes/elliptic_curves/ell_finite_field.py b/src/sage/schemes/elliptic_curves/ell_finite_field.py index a46d722fb51..98fb7d9936a 100644 --- a/src/sage/schemes/elliptic_curves/ell_finite_field.py +++ b/src/sage/schemes/elliptic_curves/ell_finite_field.py @@ -99,7 +99,7 @@ def plot(self, *args, **kwds): EXAMPLES:: sage: E = EllipticCurve(FiniteField(17), [0,1]) - sage: P = plot(E, rgbcolor=(0,0,1)) + sage: P = plot(E, rgbcolor=(0,0,1)) # needs sage.plot """ R = self.base_ring() if not R.is_prime_field(): diff --git a/src/sage/schemes/elliptic_curves/ell_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py index c7a4bb94e73..529dc803ce7 100644 --- a/src/sage/schemes/elliptic_curves/ell_generic.py +++ b/src/sage/schemes/elliptic_curves/ell_generic.py @@ -19,13 +19,13 @@ We construct an elliptic curve over an elaborate base ring:: sage: p, a, b = 97, 1, 3 - 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 + sage: R. = GF(p)[] # needs sage.rings.finite_rings + sage: S. = R[] # needs sage.rings.finite_rings + sage: T = S.fraction_field() # needs sage.rings.finite_rings + sage: E = EllipticCurve(T, [a, b]); E # needs 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 + sage: latex(E) # needs sage.rings.finite_rings y^2 = x^{3} + x + 3 AUTHORS: @@ -143,7 +143,7 @@ def __init__(self, K, ainvs): 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 # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [1,2,3,4,5]); E # needs 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 @@ -253,8 +253,8 @@ def _repr_(self): :: sage: R. = QQ['x'] - 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 + sage: K. = NumberField(x^3 - 17) # needs sage.rings.number_field + sage: EllipticCurve([a^2 - 3, -2/3*a + 3]) # needs 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 @@ -283,9 +283,9 @@ def _latex_(self): Check that :trac:`12524` is solved:: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^2 - x - 1) # needs sage.rings.number_field + sage: E = EllipticCurve([0, 0, phi, 27*phi - 43, -80*phi + 128]) # needs sage.rings.number_field + sage: E._latex_() # needs 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 @@ -324,11 +324,11 @@ def _magma_init_(self, 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 - sage.rings.finite_rings - sage: E._magma_init_(magma) # optional - magma # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(41), [2,5]) # needs sage.rings.finite_rings + sage: E._magma_init_(magma) # optional - magma # needs 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]) # optional - sage.rings.finite_rings - sage: magma(E) # optional - magma # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(25,'a'), [0,0,1,4,0]) # needs sage.rings.finite_rings + sage: magma(E) # optional - magma # needs 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 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 @@ -351,29 +351,29 @@ def _symbolic_(self, SR): :: sage: E = EllipticCurve('11a') - sage: E._symbolic_(SR) # optional - sage.symbolic + sage: E._symbolic_(SR) # needs sage.symbolic y^2 + y == x^3 - x^2 - 10*x - 20 - sage: E.torsion_subgroup().gens() # optional - sage.symbolic + sage: E.torsion_subgroup().gens() # needs sage.symbolic ((5 : 5 : 1),) We find the corresponding symbolic equality:: - sage: eqn = symbolic_expression(E); eqn # optional - sage.symbolic + sage: eqn = symbolic_expression(E); eqn # needs 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) # optional - sage.symbolic + sage: eqn(x=5, y=5) # needs sage.symbolic 30 == 30 - sage: bool(eqn(x=5, y=5)) # optional - sage.symbolic + sage: bool(eqn(x=5, y=5)) # needs sage.symbolic True We create a single expression:: - sage: F = eqn.lhs() - eqn.rhs(); F # optional - sage.symbolic + sage: F = eqn.lhs() - eqn.rhs(); F # needs sage.symbolic -x^3 + x^2 + y^2 + 10*x + y + 20 - sage: y = var('y') # optional - sage.symbolic - sage: F.solve(y) # optional - sage.symbolic + sage: y = var('y') # needs sage.symbolic + sage: F.solve(y) # needs 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] @@ -381,44 +381,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 # optional - sage.symbolic + sage: v = F.solve(y)[0].rhs(); v # needs sage.symbolic -1/2*sqrt(4*x^3 - 4*x^2 - 40*x - 79) - 1/2 - sage: v = v.function(x) # optional - sage.symbolic - sage: v(3) # optional - sage.symbolic + sage: v = v.function(x) # needs sage.symbolic + sage: v(3) # needs sage.symbolic -1/2*sqrt(-127) - 1/2 - sage: v(7) # optional - sage.symbolic + sage: v(7) # needs sage.symbolic -1/2*sqrt(817) - 1/2 - sage: v(-7) # optional - sage.symbolic + sage: v(-7) # needs sage.symbolic -1/2*sqrt(-1367) - 1/2 - sage: v(sqrt(2)) # optional - sage.symbolic + sage: v(sqrt(2)) # needs 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 # optional - sage.symbolic + sage: E2 = E.change_ring(SR); E2 # needs 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 + sage: P = E2.point((3, v(3), 1), check=False) # the check=False option doesn't verify that y^2 = f(x) # needs sage.symbolic + sage: P # needs sage.symbolic (3 : -1/2*sqrt(-127) - 1/2 : 1) - sage: P + P # optional - sage.symbolic + sage: P + P # needs 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 # optional - sage.symbolic + sage: w = E2.point((pi,v(pi),1), check=False); w # needs 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() # optional - sage.symbolic + sage: x, y, z = w; ((y^2 + y) - (x^3 - x^2 - 10*x - 20)).expand() # needs sage.symbolic 0 - sage: 2*w # optional - sage.symbolic + sage: 2*w # needs 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)) # optional - sage.symbolic + sage: x, y, z = 2*w; temp = ((y^2 + y) - (x^3 - x^2 - 10*x - 20)) # needs sage.symbolic This is a point on the curve:: - sage: bool(temp == 0) # optional - sage.symbolic + sage: bool(temp == 0) # needs sage.symbolic True """ a = [SR(x) for x in self.a_invariants()] @@ -438,15 +438,15 @@ def __contains__(self, P): True sage: (1,3) in E False - sage: E = EllipticCurve([GF(7)(0), 1]) # optional - sage.rings.finite_rings - sage: [0,0] in E # optional - sage.rings.finite_rings + sage: E = EllipticCurve([GF(7)(0), 1]) # needs sage.rings.finite_rings + sage: [0,0] in E # needs sage.rings.finite_rings False - sage: [0,8] in E # optional - sage.rings.finite_rings + sage: [0,8] in E # needs sage.rings.finite_rings True - sage: P = E(0,8) # optional - sage.rings.finite_rings - sage: P # optional - sage.rings.finite_rings + sage: P = E(0,8) # needs sage.rings.finite_rings + sage: P # needs sage.rings.finite_rings (0 : 1 : 1) - sage: P in E # optional - sage.rings.finite_rings + sage: P in E # needs sage.rings.finite_rings True """ if not isinstance(P, ell_point.EllipticCurvePoint): @@ -496,10 +496,10 @@ def __call__(self, *args, **kwds): We create points on an elliptic curve over a prime finite field:: - sage: E = EllipticCurve([GF(7)(0), 1]) # optional - sage.rings.finite_rings - sage: E([2,3]) # optional - sage.rings.finite_rings + sage: E = EllipticCurve([GF(7)(0), 1]) # needs sage.rings.finite_rings + sage: E([2,3]) # needs sage.rings.finite_rings (2 : 3 : 1) - sage: E([0,0]) # optional - sage.rings.finite_rings + sage: E([0,0]) # needs sage.rings.finite_rings Traceback (most recent call last): ... TypeError: Coordinates [0, 0, 1] do not define a point @@ -508,19 +508,19 @@ def __call__(self, *args, **kwds): 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() # optional - sage.rings.number_field - sage: E = EllipticCurve([a, a]) # optional - sage.rings.number_field - sage: E # optional - sage.rings.number_field + sage: K = NumberField(x**3 + x + 1, 'a'); a = K.gen() # needs sage.rings.number_field + sage: E = EllipticCurve([a, a]) # needs sage.rings.number_field + sage: E # needs 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 + sage: E = EllipticCurve([K(1), 1]) # needs sage.rings.number_field + sage: E # needs 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 + sage: P = E([a,0,1]) # needs sage.rings.number_field + sage: P # needs sage.rings.number_field (a : 0 : 1) - sage: P + P # optional - sage.rings.number_field + sage: P + P # needs sage.rings.number_field (0 : 1 : 0) Another example involving p-adics:: @@ -528,12 +528,12 @@ def __call__(self, *args, **kwds): sage: E = EllipticCurve('37a1') sage: P = E([0,0]); P (0 : 0 : 1) - sage: R = pAdicField(3, 20) # optional - sage.rings.padics - sage: Ep = E.base_extend(R); Ep # optional - sage.rings.padics + sage: R = pAdicField(3, 20) # needs sage.rings.padics + sage: Ep = E.base_extend(R); Ep # needs 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) + sage: Ep(P) # needs sage.rings.padics (0 : 0 : 1 + O(3^20)) Constructing points from the torsion subgroup (which is an abstract @@ -622,14 +622,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)) # 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 + sage: E11 = E.change_ring(GF(11)) # needs sage.rings.finite_rings + sage: S = E11._reduce_point(R, 11) # needs sage.rings.finite_rings + sage: E11(S) # needs sage.rings.finite_rings (0 : 1 : 0) The 0 point reduces as expected:: - sage: E11._reduce_point(E(0), 11) # optional - sage.rings.finite_rings + sage: E11._reduce_point(E(0), 11) # needs sage.rings.finite_rings (0 : 1 : 0) Note that one need not explicitly call @@ -690,9 +690,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)) # optional - sage.rings.finite_rings + sage: F = GF(32,'a') # needs sage.rings.finite_rings + sage: E = EllipticCurve(F,[1,0,0,0,1]) # needs 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)) # needs sage.rings.finite_rings True """ K = self.base_ring() @@ -772,9 +772,9 @@ def lift_x(self, x, all=False, extend=False): 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 # optional - sage.rings.number_field + sage: P = E.lift_x(3, extend=True); P # needs sage.rings.number_field (3 : -y - 1 : 1) - sage: P.curve() # optional - sage.rings.number_field + sage: P.curve() # needs 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 @@ -798,19 +798,19 @@ 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 # optional - sage.rings.number_field + sage: P = E.lift_x(0, extend=True); P # needs sage.rings.number_field (0 : -y : 1) - sage: P.curve() # optional - sage.rings.number_field + sage: P.curve() # needs 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 # optional - sage.rings.finite_rings + sage: E = EllipticCurve('37a').change_ring(GF(17)); E # needs 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) # optional - sage.rings.finite_rings + sage: E.lift_x(7) # needs sage.rings.finite_rings (7 : 5 : 1) - sage: E.lift_x(3) # optional - sage.rings.finite_rings + sage: E.lift_x(3) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: No point with x-coordinate 3 on @@ -819,7 +819,7 @@ def lift_x(self, x, all=False, extend=False): Note that there is only one lift with `x`-coordinate 10 in `E(\GF{17})`:: - sage: E.lift_x(10, all=True) # optional - sage.rings.finite_rings + sage: E.lift_x(10, all=True) # needs sage.rings.finite_rings [(10 : 8 : 1)] We can lift over more exotic rings too. If the supplied x @@ -827,19 +827,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 # optional - sage.rings.padics + sage: P = E.lift_x(pAdicField(17, 5)(6)); P # needs sage.rings.padics (6 + O(17^5) : 14 + O(17^5) : 1 + O(17^5)) - sage: P.curve() # optional - sage.rings.padics + sage: P.curve() # needs 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 (1 + t : -1 - 2*t + t^2 - 5*t^3 + 21*t^4 + O(t^5) : 1) - 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 + sage: K. = GF(16) # needs sage.rings.finite_rings + sage: P = E.change_ring(K).lift_x(a^3); P # needs sage.rings.finite_rings (a^3 : a^3 + a : 1) - sage: P.curve() # optional - sage.rings.finite_rings + sage: P.curve() # needs 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):: @@ -864,9 +864,9 @@ def lift_x(self, x, all=False, extend=False): Check that :trac:`30297` is fixed:: - 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 + sage: K = Qp(5) # needs sage.rings.padics + sage: E = EllipticCurve([K(0), K(1)]) # needs sage.rings.padics + sage: E.lift_x(1, extend=True) # needs sage.rings.padics (1 + O(5^20) : y + O(5^20) : 1 + O(5^20)) AUTHORS: @@ -876,10 +876,10 @@ def lift_x(self, x, all=False, extend=False): TESTS:: - 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 = EllipticCurve('37a').short_weierstrass_model().change_ring(GF(17)) # needs sage.rings.finite_rings + sage: E.lift_x(3, all=True) # needs sage.rings.finite_rings [] - sage: E.lift_x(7, all=True) # optional - sage.rings.finite_rings + sage: E.lift_x(7, all=True) # needs sage.rings.finite_rings [(7 : 3 : 1), (7 : 14 : 1)] Check determinism:: @@ -972,8 +972,8 @@ def _point_homset(self, *args, **kwds): EXAMPLES:: - 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 + sage: E = EllipticCurve(GF(5),[1,1]) # needs sage.rings.finite_rings + sage: E._point_homset(Spec(GF(5^10,'a'), GF(5)), E) # needs 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 @@ -1018,8 +1018,8 @@ 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]) # optional - sage.rings.finite_rings - sage: E._EllipticCurve_generic__is_over_RationalField() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(5),[1,1]) # needs sage.rings.finite_rings + sage: E._EllipticCurve_generic__is_over_RationalField() # needs sage.rings.finite_rings False """ return isinstance(self.base_ring(), RationalField) @@ -1062,8 +1062,8 @@ def a_invariants(self): sage: E.a_invariants() (0, 0, 0, 0, 1) - sage: E = EllipticCurve([GF(7)(3),5]) # optional - sage.rings.finite_rings - sage: E.a_invariants() # optional - sage.rings.finite_rings + sage: E = EllipticCurve([GF(7)(3),5]) # needs sage.rings.finite_rings + sage: E.a_invariants() # needs sage.rings.finite_rings (0, 0, 0, 3, 5) TESTS:: @@ -1308,8 +1308,8 @@ def discriminant(self): sage: E.discriminant() -161051 - sage: E = EllipticCurve([GF(7)(2),1]) # optional - sage.rings.finite_rings - sage: E.discriminant() # optional - sage.rings.finite_rings + sage: E = EllipticCurve([GF(7)(2),1]) # needs sage.rings.finite_rings + sage: E.discriminant() # needs sage.rings.finite_rings 1 """ b2, b4, b6, b8 = self.b_invariants() @@ -1336,8 +1336,8 @@ def j_invariant(self): sage: E.j_invariant() 1728 - sage: E = EllipticCurve([GF(7)(2),1]) # optional - sage.rings.finite_rings - sage: E.j_invariant() # optional - sage.rings.finite_rings + sage: E = EllipticCurve([GF(7)(2),1]) # needs sage.rings.finite_rings + sage: E.j_invariant() # needs sage.rings.finite_rings 1 """ c4, _ = self.c_invariants() @@ -1360,9 +1360,9 @@ def base_extend(self, R): EXAMPLES:: - sage: E = EllipticCurve(GF(5), [1,1]); E # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(5), [1,1]); E # needs 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 # optional - sage.rings.finite_rings + sage: E1 = E.base_extend(GF(125,'a')); E1 # needs sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field in a of size 5^3 TESTS: @@ -1370,24 +1370,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)) # optional - sage.rings.finite_rings - sage: E.cardinality() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(j=GF(7)(5)) # needs sage.rings.finite_rings + sage: E.cardinality() # needs sage.rings.finite_rings 10 - sage: EE = E.base_extend(GF(7^2)) # optional - sage.rings.finite_rings - sage: EE._order # optional - sage.rings.finite_rings + sage: EE = E.base_extend(GF(7^2)) # needs sage.rings.finite_rings + sage: EE._order # needs sage.rings.finite_rings 60 Changing to a smaller field should not cache orders:: - 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 + sage: EE = EllipticCurve(j=GF(7^3)(6)) # needs sage.rings.finite_rings + sage: hasattr(EE.change_ring(GF(7)), '_order') # needs sage.rings.finite_rings False Changing to a field of different characteristic should not cache orders:: - sage: Elift = E.change_ring(QQ) # optional - sage.rings.finite_rings - sage: hasattr(Elift, '_order') # optional - sage.rings.finite_rings + sage: Elift = E.change_ring(QQ) # needs sage.rings.finite_rings + sage: hasattr(Elift, '_order') # needs sage.rings.finite_rings False """ E = constructor.EllipticCurve([R(a) for a in self.a_invariants()]) @@ -1408,14 +1408,14 @@ def change_ring(self, R): EXAMPLES:: - 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([roots[0]], F4) # optional - sage.rings.finite_rings - sage: E = EllipticCurve(F2, [1,a]); E # optional - sage.rings.finite_rings + sage: F2 = GF(5^2,'a'); a = F2.gen() # needs sage.rings.finite_rings + sage: F4 = GF(5^4,'b'); b = F4.gen() # needs sage.rings.finite_rings + sage: roots = a.charpoly().roots(ring=F4, multiplicities=False) # needs sage.rings.finite_rings + sage: h = F2.hom([roots[0]], F4) # needs sage.rings.finite_rings + sage: E = EllipticCurve(F2, [1,a]); E # needs 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 + sage: E.change_ring(h) # needs 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 """ @@ -1427,8 +1427,8 @@ def base_ring(self): EXAMPLES:: - sage: E = EllipticCurve(GF(49, 'a'), [3,5]) # optional - sage.rings.finite_rings - sage: E.base_ring() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(49, 'a'), [3,5]) # needs sage.rings.finite_rings + sage: E.base_ring() # needs sage.rings.finite_rings Finite Field in a of size 7^2 :: @@ -1660,12 +1660,12 @@ def division_polynomial_0(self, n, x=None): An example to illustrate the relationship with torsion points:: - sage: F = GF(11) # optional - sage.rings.finite_rings - sage: E = EllipticCurve(F, [0, 2]); E # optional - sage.rings.finite_rings + sage: F = GF(11) # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [0, 2]); E # needs 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 # optional - sage.rings.finite_rings + sage: f = E.division_polynomial_0(5); f # needs sage.rings.finite_rings 5*x^12 + x^9 + 8*x^6 + 4*x^3 + 7 - sage: f.factor() # optional - sage.rings.finite_rings + sage: f.factor() # needs 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) @@ -1673,10 +1673,10 @@ def division_polynomial_0(self, n, x=None): `E` are in `\GF{11^2}`, and therefore the `y`-coordinates are in `\GF{11^4}`:: - 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 + sage: K = GF(11^4, 'a') # needs sage.rings.finite_rings + sage: X = E.change_ring(K) # needs sage.rings.finite_rings + sage: f = X.division_polynomial_0(5) # needs sage.rings.finite_rings + sage: x_coords = f.roots(multiplicities=False); x_coords # needs 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, @@ -1693,7 +1693,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: # optional - sage.rings.finite_rings + sage: for x in x_coords: # needs sage.rings.finite_rings ....: assert X.lift_x(x).order() == 5 The roots of the polynomial are the `x`-coordinates of the points `P` @@ -1783,10 +1783,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]) # optional - sage.rings.finite_rings - sage: E.two_division_polynomial() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(3^2,'a'), [1,1,1,1,1]) # needs sage.rings.finite_rings + sage: E.two_division_polynomial() # needs sage.rings.finite_rings x^3 + 2*x^2 + 2 - sage: E.two_division_polynomial().roots() # optional - sage.rings.finite_rings + sage: E.two_division_polynomial().roots() # needs sage.rings.finite_rings [(2, 1), (2*a, 1), (a + 2, 1)] """ return self.division_polynomial_0(-1,x) @@ -2096,11 +2096,11 @@ def _multiple_x_numerator(self, n, x=None): Check for :trac:`33156`:: - 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 + sage: E = EllipticCurve(GF(65537), [5,5]) # needs sage.rings.finite_rings + sage: R. = E.base_field()[] # needs sage.rings.finite_rings + sage: E._multiple_x_numerator(5, x=R.quotient(x^2).gen()) # needs sage.rings.finite_rings 10220*xbar + 42539 - sage: E._multiple_x_numerator(5) # optional - sage.rings.finite_rings + sage: E._multiple_x_numerator(5) # needs sage.rings.finite_rings x^25 + 65037*x^23 + 55137*x^22 + ... + 813*x^2 + 10220*x + 42539 """ n = Integer(n).abs() @@ -2192,11 +2192,11 @@ def _multiple_x_denominator(self, n, x=None): Check for :trac:`33156`:: - 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 + sage: E = EllipticCurve(GF(65537), [5,5]) # needs sage.rings.finite_rings + sage: R. = E.base_field()[] # needs sage.rings.finite_rings + sage: E._multiple_x_denominator(5, x=R.quotient(x^2).gen()) # needs sage.rings.finite_rings 52039*xbar + 56726 - sage: E._multiple_x_denominator(5) # optional - sage.rings.finite_rings + sage: E._multiple_x_denominator(5) # needs sage.rings.finite_rings 25*x^24 + 3100*x^22 + 19000*x^21 + ... + 24111*x^2 + 52039*x + 56726 """ n = Integer(n).abs() @@ -2315,14 +2315,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) # 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 + sage: p = next_prime(2^30-41) # needs sage.rings.finite_rings + sage: a = GF(p)(1) # needs sage.rings.finite_rings + sage: b = GF(p)(1) # needs sage.rings.finite_rings + sage: E = EllipticCurve([a, b]) # needs sage.rings.finite_rings + sage: P = E.random_point() # needs sage.rings.finite_rings + sage: my_eval = lambda f,P: [fi(P[0],P[1]) for fi in f] # needs sage.rings.finite_rings + sage: f = E.multiplication_by_m(2) # needs sage.rings.finite_rings + sage: assert(E(eval(f,P)) == 2*P) # needs sage.rings.finite_rings """ # Coerce the input m to be an integer m = Integer(m) @@ -2407,15 +2407,15 @@ def multiplication_by_m_isogeny(self, m): Tests for :trac:`32490`:: - 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 + sage: E = EllipticCurve(QQbar, [1,0]) # needs sage.rings.number_field + sage: E.multiplication_by_m_isogeny(1).rational_maps() # needs sage.rings.number_field (x, y) :: - 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 + sage: E = EllipticCurve_from_j(GF(31337).random_element()) # needs sage.rings.finite_rings + sage: P = E.random_point() # needs sage.rings.finite_rings + sage: [E.multiplication_by_m_isogeny(m)(P) == m*P for m in (1,2,3,5,7,9)] # needs sage.rings.finite_rings [True, True, True, True, True, True] :: @@ -2501,15 +2501,15 @@ def frobenius_isogeny(self, n=1): EXAMPLES:: - 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 + sage: z3, = GF(13^3).gens() # needs sage.rings.finite_rings + sage: E = EllipticCurve([z3, z3^2]) # needs sage.rings.finite_rings + sage: E.frobenius_isogeny() # needs 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 - sage: E.frobenius_isogeny(3) # optional - sage.rings.finite_rings + sage: E.frobenius_isogeny(3) # needs 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 @@ -2562,8 +2562,8 @@ def isomorphism_to(self, other): We can also handle injections to different base rings:: sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 7) # optional - sage.rings.number_field - sage: E.isomorphism_to(E.change_ring(K)) # optional - sage.rings.number_field + sage: K. = NumberField(x^3 - 7) # needs sage.rings.number_field + sage: E.isomorphism_to(E.change_ring(K)) # needs 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 @@ -2605,8 +2605,8 @@ def automorphisms(self, field=None): We can also find automorphisms defined over extension fields:: sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 + 3) # adjoin roots of unity # optional - sage.rings.number_field - sage: E.automorphisms(K) # optional - sage.rings.number_field + sage: K. = NumberField(x^2 + 3) # adjoin roots of unity # needs sage.rings.number_field + sage: E.automorphisms(K) # needs 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), @@ -2628,7 +2628,7 @@ def automorphisms(self, field=None): :: - sage: [len(EllipticCurve_from_j(GF(q,'a')(0)).automorphisms()) # optional - sage.rings.finite_rings + sage: [len(EllipticCurve_from_j(GF(q,'a')(0)).automorphisms()) # needs sage.rings.finite_rings ....: for q in [2,4,3,9,5,25,7,49]] [2, 24, 2, 12, 2, 6, 6, 6] @@ -2638,19 +2638,19 @@ def automorphisms(self, field=None): sage: p = random_prime(100) sage: k = randrange(1,30) - sage: F. = GF((p,k)) # optional - sage.rings.finite_rings - sage: while True: # optional - sage.rings.finite_rings + sage: F. = GF((p,k)) # needs sage.rings.finite_rings + sage: while True: # needs sage.rings.finite_rings ....: try: ....: E = EllipticCurve(list((F^5).random_element())) ....: except ArithmeticError: ....: continue ....: break - sage: Aut = E.automorphisms() # optional - sage.rings.finite_rings - sage: Aut[0] == E.scalar_multiplication(1) # optional - sage.rings.finite_rings + sage: Aut = E.automorphisms() # needs sage.rings.finite_rings + sage: Aut[0] == E.scalar_multiplication(1) # needs sage.rings.finite_rings True - sage: Aut[1] == E.scalar_multiplication(-1) # optional - sage.rings.finite_rings + sage: Aut[1] == E.scalar_multiplication(-1) # needs sage.rings.finite_rings True - sage: sorted(Aut) == Aut # optional - sage.rings.finite_rings + sage: sorted(Aut) == Aut # needs sage.rings.finite_rings True """ if field is not None: @@ -2689,11 +2689,11 @@ def isomorphisms(self, other, field=None): We can also find isomorphisms defined over extension fields:: - 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 = EllipticCurve(GF(7), [0,0,0,1,1]) # needs sage.rings.finite_rings + sage: F = EllipticCurve(GF(7), [0,0,0,1,-1]) # needs sage.rings.finite_rings + sage: E.isomorphisms(F) # needs sage.rings.finite_rings [] - sage: E.isomorphisms(F, GF(49,'a')) # optional - sage.rings.finite_rings + sage: E.isomorphisms(F, GF(49,'a')) # needs 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 @@ -2821,28 +2821,28 @@ def short_weierstrass_model(self, complete_cube=True): :: - 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 + sage: E = EllipticCurve(GF(3), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: E.short_weierstrass_model(complete_cube=False) # needs 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() # optional - sage.rings.finite_rings + sage: E.short_weierstrass_model() # needs 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]) # optional - sage.rings.finite_rings - sage: E.short_weierstrass_model() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(3), [0,2,1,2,1]) # needs sage.rings.finite_rings + sage: E.short_weierstrass_model() # needs 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) # optional - sage.rings.finite_rings + sage: E.short_weierstrass_model(complete_cube=False) # needs 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 + sage: E.short_weierstrass_model(complete_cube=False).is_isomorphic(E) # needs sage.rings.finite_rings True """ from . import constructor @@ -2915,22 +2915,22 @@ def montgomery_model(self, twisted=False, morphism=False): EXAMPLES:: - sage: E = EllipticCurve(QQbar, '11a1') # optional - sage.rings.number_field - sage: E.montgomery_model() # optional - sage.rings.number_field + sage: E = EllipticCurve(QQbar, '11a1') # needs sage.rings.number_field + sage: E.montgomery_model() # needs 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]) # optional - sage.rings.finite_rings - sage: E.montgomery_model() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(431^2), [7,7]) # needs sage.rings.finite_rings + sage: E.montgomery_model() # needs 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) # optional - sage.rings.finite_rings + sage: E.montgomery_model(morphism=True) # needs 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: @@ -2943,8 +2943,8 @@ def montgomery_model(self, twisted=False, morphism=False): Not all elliptic curves have a Montgomery model over their field of definition:: - sage: E = EllipticCurve(GF(257), [1,1]) # optional - sage.rings.finite_rings - sage: E.montgomery_model() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(257), [1,1]) # needs sage.rings.finite_rings + sage: E.montgomery_model() # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Elliptic Curve defined by y^2 = x^3 + x + 1 @@ -2952,8 +2952,8 @@ def montgomery_model(self, twisted=False, morphism=False): :: - sage: E = EllipticCurve(GF(257), [10,10]) # optional - sage.rings.finite_rings - sage: E.montgomery_model() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(257), [10,10]) # needs sage.rings.finite_rings + sage: E.montgomery_model() # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Elliptic Curve defined by y^2 = x^3 + 10*x + 10 @@ -2963,7 +2963,7 @@ def montgomery_model(self, twisted=False, morphism=False): admit a *twisted* Montgomery model, which can be computed by passing ``twisted=True``:: - sage: E.montgomery_model(twisted=True) # optional - sage.rings.finite_rings + sage: E.montgomery_model(twisted=True) # needs 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 @@ -2977,8 +2977,8 @@ 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) # optional - sage.rings.finite_rings - sage: f # optional - sage.rings.finite_rings + sage: C, f = E.montgomery_model(twisted=True, morphism=True) # needs sage.rings.finite_rings + sage: f # needs sage.rings.finite_rings Scheme morphism: From: Elliptic Curve defined by y^2 = x^3 + 10*x + 10 over Finite Field of size 257 @@ -2986,7 +2986,7 @@ def montgomery_model(self, twisted=False, morphism=False): 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 # optional - sage.rings.finite_rings + sage: g = f.inverse(); g # needs 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 @@ -2994,39 +2994,39 @@ def montgomery_model(self, twisted=False, morphism=False): 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) # 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 + sage: P = C(70, 8) # needs sage.rings.finite_rings + sage: Q = C(17, 17) # needs sage.rings.finite_rings + sage: P + Q # this doesn't work... # needs sage.rings.finite_rings Traceback (most recent call last): ... TypeError: unsupported operand parent(s) for +: ... - sage: f(g(P) + g(Q)) # ...but this does # optional - sage.rings.finite_rings + sage: f(g(P) + g(Q)) # ...but this does # needs 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) # 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 + sage: F. = GF(257^2) # needs sage.rings.finite_rings + sage: C_ = C.change_ring(F) # needs sage.rings.finite_rings + sage: g_ = g.change_ring(F) # needs sage.rings.finite_rings + sage: g_(P).order() # needs sage.rings.finite_rings 12 - sage: T = C_(-7 * z2 - 57, 31 * z2 - 52, 1) # optional - sage.rings.finite_rings - sage: g_(T).order() # optional - sage.rings.finite_rings + sage: T = C_(-7 * z2 - 57, 31 * z2 - 52, 1) # needs sage.rings.finite_rings + sage: g_(T).order() # needs sage.rings.finite_rings 12 - sage: g_(P).weil_pairing(g_(T), 12) # optional - sage.rings.finite_rings + sage: g_(P).weil_pairing(g_(T), 12) # needs 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_ # optional - sage.rings.finite_rings + sage: C_ = E.change_ring(F).montgomery_model(); C_ # needs 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 + sage: h = C.defining_polynomial().change_ring(F); h # needs 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()) # optional - sage.rings.finite_rings + sage: C_.is_isomorphic(EllipticCurve_from_cubic(h).codomain()) # needs sage.rings.finite_rings True .. SEEALSO:: @@ -3137,28 +3137,28 @@ def plot(self, xmin=None, xmax=None, components='both', **args): EXAMPLES:: sage: E = EllipticCurve([0, -1]) - sage: plot(E, rgbcolor=hue(0.7)) # optional - sage.plot + sage: plot(E, rgbcolor=hue(0.7)) # needs sage.plot Graphics object consisting of 1 graphics primitive sage: E = EllipticCurve('37a') - sage: plot(E) # optional - sage.plot + sage: plot(E) # needs sage.plot Graphics object consisting of 2 graphics primitives - sage: plot(E, xmin=25, xmax=26) # optional - sage.plot + sage: plot(E, xmin=25, xmax=26) # needs 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') # optional - sage.plot + sage: E.plot(components='bounded') # needs sage.plot Graphics object consisting of 1 graphics primitive - sage: E.plot(components='unbounded') # optional - sage.plot + sage: E.plot(components='unbounded') # needs 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') # optional - sage.plot + sage: E.plot(components='bounded') # needs sage.plot Traceback (most recent call last): ... ValueError: no bounded component for this curve @@ -3166,7 +3166,7 @@ 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() # optional - sage.plot + sage: E.plot() # needs sage.plot Traceback (most recent call last): ... NotImplementedError: plotting of curves over Complex Field @@ -3351,17 +3351,17 @@ def _p_primary_torsion_basis(self, p, m=None): sage: E._p_primary_torsion_basis(5) [[(5 : -6 : 1), 1]] sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^4 + x^3 + 11*x^2 + 41*x + 101) # needs sage.rings.number_field + sage: EK = E.base_extend(K) # needs sage.rings.number_field + sage: EK._p_primary_torsion_basis(5) # long time # needs 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)) # optional - sage.rings.finite_rings - sage: EF._p_primary_torsion_basis(5) # optional - sage.rings.finite_rings + sage: EF = E.change_ring(GF(101)) # needs sage.rings.finite_rings + sage: EF._p_primary_torsion_basis(5) # needs sage.rings.finite_rings [[(0 : 13 : 1), 1], [(5 : 5 : 1), 1]] - 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 + sage: F. = CyclotomicField(21) # needs sage.rings.number_field + sage: E = EllipticCurve([2, -z^7, -z^7, 0, 0]) # needs sage.rings.number_field + sage: E._p_primary_torsion_basis(7,2) # long time # needs 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]] @@ -3372,8 +3372,8 @@ def _p_primary_torsion_basis(self, p, m=None): 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 + sage: E = EllipticCurve(GF(10^60+3201), [0,a,0,b,0]) # needs sage.rings.finite_rings + sage: [t[1] for t in E._p_primary_torsion_basis(2)] # long time, needs sage.rings.finite_rings [16, 1] """ p = Integer(p) @@ -3527,17 +3527,17 @@ def pari_curve(self): EXAMPLES:: sage: E = EllipticCurve([RR(0), RR(0), RR(1), RR(-1), RR(0)]) - sage: e = E.pari_curve() # optional - sage.libs.pari - sage: type(e) # optional - sage.libs.pari + sage: e = E.pari_curve() # needs sage.libs.pari + sage: type(e) # needs sage.libs.pari <... 'cypari2.gen.Gen'> - sage: e.type() # optional - sage.libs.pari + sage: e.type() # needs sage.libs.pari 't_VEC' - sage: e.disc() # optional - sage.libs.pari + sage: e.disc() # needs sage.libs.pari 37.0000000000000 Over a finite field:: - sage: EllipticCurve(GF(41), [2,5]).pari_curve() # optional - sage.libs.pari sage.rings.finite_rings + sage: EllipticCurve(GF(41), [2,5]).pari_curve() # needs 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), @@ -3546,19 +3546,19 @@ def pari_curve(self): Over a `p`-adic field:: - 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 + sage: Qp = pAdicField(5, prec=3) # needs sage.libs.pari sage.rings.padics + sage: E = EllipticCurve(Qp, [3, 4]) # needs sage.libs.pari sage.rings.padics + sage: E.pari_curve() # needs 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 + sage: E.j_invariant() # needs sage.libs.pari sage.rings.padics 3*5^-1 + O(5) Over a number field:: - 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 + sage: K. = QuadraticField(2) # needs sage.libs.pari sage.rings.number_field + sage: E = EllipticCurve([1,a]) # needs sage.libs.pari sage.rings.number_field + sage: E.pari_curve() # needs 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), @@ -3572,10 +3572,10 @@ def pari_curve(self): PARI no longer requires that the `j`-invariant has negative `p`-adic valuation:: - 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 + sage: E = EllipticCurve(Qp,[1, 1]) # needs sage.libs.pari sage.rings.padics + sage: E.j_invariant() # the j-invariant is a p-adic integer # needs sage.libs.pari sage.rings.padics 2 + 4*5^2 + O(5^3) - sage: E.pari_curve() # optional - sage.libs.pari sage.rings.padics + sage: E.pari_curve() # needs 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]] """ @@ -3596,12 +3596,12 @@ def __pari__(self): EXAMPLES:: sage: E = EllipticCurve('11a1') - sage: pari(E) # optional - sage.libs.pari + sage: pari(E) # needs 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__() # optional - sage.libs.pari sage.rings.finite_rings + sage: EllipticCurve(GF(2), [0,0,1,1,1]).__pari__() # needs 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 11c0bc4b978..4fcffc01dab 100644 --- a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py +++ b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py @@ -129,8 +129,8 @@ def modular_symbol_space(E, sign, base_ring, bound=None): sage: from sage.schemes.elliptic_curves.ell_modular_symbols import modular_symbol_space sage: E = EllipticCurve('11a1') - sage: M = modular_symbol_space(E, -1, GF(37)) # optional - sage.rings.finite_rings - sage: M # optional - sage.rings.finite_rings + sage: M = modular_symbol_space(E, -1, GF(37)) # needs sage.rings.finite_rings + sage: M # needs 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 """ diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py index e01d7436d94..54777488572 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 @@ -# sage.doctest: optional - sage.rings.number_field +# sage.doctest: needs sage.rings.number_field r""" Elliptic curves over number fields diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py index 0b6d93a117a..4e612fe6c66 100644 --- a/src/sage/schemes/elliptic_curves/ell_point.py +++ b/src/sage/schemes/elliptic_curves/ell_point.py @@ -32,36 +32,36 @@ An example over a number field:: - 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [1,0,0,0,-1]) # needs sage.rings.number_field + sage: P = E(0,i); P # needs sage.rings.number_field (0 : i : 1) - sage: P.order() # optional - sage.rings.number_field + sage: P.order() # needs sage.rings.number_field +Infinity - sage: 101*P - 100*P == P # optional - sage.rings.number_field + sage: 101*P - 100*P == P # needs sage.rings.number_field True An example over a finite field:: - 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 + sage: K. = GF((101,3)) # needs sage.rings.finite_rings + sage: E = EllipticCurve(K, [1,0,0,0,-1]) # needs sage.rings.finite_rings + sage: P = E(40*a^2 + 69*a + 84 , 58*a^2 + 73*a + 45) # needs sage.rings.finite_rings + sage: P.order() # needs sage.rings.finite_rings 1032210 - sage: E.cardinality() # optional - sage.rings.finite_rings + sage: E.cardinality() # needs sage.rings.finite_rings 1032210 Arithmetic with a point over an extension of a finite field:: - sage: k. = GF((5,2)) # optional - sage.rings.finite_rings - sage: E = EllipticCurve(k,[1,0]); E # optional - sage.rings.finite_rings + sage: k. = GF((5,2)) # needs sage.rings.finite_rings + sage: E = EllipticCurve(k,[1,0]); E # needs 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]) # optional - sage.rings.finite_rings - sage: 5*P # optional - sage.rings.finite_rings + sage: P = E([a,2*a+4]) # needs sage.rings.finite_rings + sage: 5*P # needs sage.rings.finite_rings (2*a + 3 : 2*a : 1) - sage: P*5 # optional - sage.rings.finite_rings + sage: P*5 # needs sage.rings.finite_rings (2*a + 3 : 2*a : 1) - sage: P + P + P + P + P # optional - sage.rings.finite_rings + sage: P + P + P + P + P # needs sage.rings.finite_rings (2*a + 3 : 2*a : 1) :: @@ -169,7 +169,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 # optional - sage.rings.finite_rings + sage: E([GF(5)(0), 0]) # entries are coerced # needs sage.rings.finite_rings (0 : 0 : 1) sage: E(0.000, 0) @@ -189,13 +189,13 @@ class EllipticCurvePoint_field(SchemeMorphism_point_abelian_variety_field): Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,1,0,-160,308]) # needs sage.rings.number_field + sage: P = E(26, -120) # needs sage.rings.number_field + sage: Q = E(2+12*i, -36+48*i) # needs sage.rings.number_field + sage: P.order() == Q.order() == 4 # long time # needs sage.rings.number_field True - sage: 2*P == 2*Q # optional - sage.rings.number_field + sage: 2*P == 2*Q # needs sage.rings.number_field False :: @@ -231,14 +231,14 @@ class EllipticCurvePoint_field(SchemeMorphism_point_abelian_variety_field): sage: P = E(0,1) sage: P.domain() Spectrum of Rational Field - 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 + sage: K. = NumberField(x^2 - 3, 'a') # needs sage.rings.number_field + sage: P = E.base_extend(K)(1,a) # needs sage.rings.number_field + sage: P.domain() # needs sage.rings.number_field Spectrum of Number Field in a with defining polynomial x^2 - 3 - sage: P.codomain() # optional - sage.rings.number_field + sage: P.codomain() # needs 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() # optional - sage.rings.number_field + sage: P.codomain() == P.curve() # needs sage.rings.number_field True """ def __init__(self, curve, v, check=True): @@ -414,18 +414,18 @@ def __pari__(self): Try the same over a finite field:: - 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 + sage: E = EllipticCurve(GF(11), [0,0,0,3,0]) # needs sage.rings.finite_rings + sage: O = E(0) # needs sage.rings.finite_rings + sage: P = E.point([1,2]) # needs sage.rings.finite_rings + sage: O.__pari__() # needs sage.rings.finite_rings [0] - sage: P.__pari__() # optional - sage.rings.finite_rings + sage: P.__pari__() # needs 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) # optional - sage.rings.finite_rings + sage: pari(E).elladd(O, P) # needs sage.rings.finite_rings [Mod(1, 11), Mod(2, 11)] """ if self[2]: @@ -448,9 +448,9 @@ def scheme(self): sage: P.scheme() == P.curve() True sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^2 - 3,'a') # needs sage.rings.number_field + sage: P = E.base_extend(K)(1, a) # needs sage.rings.number_field + sage: P.scheme() # needs 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 """ @@ -606,7 +606,7 @@ def plot(self, **args): sage: E = EllipticCurve('389a') sage: P = E([-1,1]) - sage: P.plot(pointsize=30, rgbcolor=(1,0,0)) # optional - sage.plot + sage: P.plot(pointsize=30, rgbcolor=(1,0,0)) # needs sage.plot Graphics object consisting of 1 graphics primitive """ from sage.plot.point import point @@ -807,43 +807,43 @@ def is_divisible_by(self, m): A finite field example:: - sage: E = EllipticCurve(GF(101), [23,34]) # optional - sage.rings.finite_rings - sage: E.cardinality().factor() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(101), [23,34]) # needs sage.rings.finite_rings + sage: E.cardinality().factor() # needs sage.rings.finite_rings 2 * 53 - sage: Set([T.order() for T in E.points()]) # optional - sage.rings.finite_rings + sage: Set([T.order() for T in E.points()]) # needs sage.rings.finite_rings {1, 106, 2, 53} - sage: len([T for T in E.points() if T.is_divisible_by(2)]) # optional - sage.rings.finite_rings + sage: len([T for T in E.points() if T.is_divisible_by(2)]) # needs sage.rings.finite_rings 53 - sage: len([T for T in E.points() if T.is_divisible_by(3)]) # optional - sage.rings.finite_rings + sage: len([T for T in E.points() if T.is_divisible_by(3)]) # needs sage.rings.finite_rings 106 TESTS: This shows that the bug reported at :trac:`10076` is fixed:: - 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 + sage: K = QuadraticField(8,'a') # needs sage.rings.number_field + sage: E = EllipticCurve([K(0),0,0,-1,0]) # needs sage.rings.number_field + sage: P = E([-1,0]) # needs sage.rings.number_field + sage: P.is_divisible_by(2) # needs sage.rings.number_field False - sage: P.division_points(2) # optional - sage.rings.number_field + sage: P.division_points(2) # needs 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() # optional - sage.rings.number_field + sage: P.division_points(2, poly_only=True).roots() # needs sage.rings.number_field [(1/2*a - 1, 1), (-1/2*a - 1, 1)] - sage: tor = E.torsion_points(); len(tor) # optional - sage.rings.number_field + sage: tor = E.torsion_points(); len(tor) # needs sage.rings.number_field 8 - sage: [T.order() for T in tor] # optional - sage.rings.number_field + sage: [T.order() for T in tor] # needs sage.rings.number_field [2, 4, 4, 2, 1, 2, 4, 4] - sage: all(T.is_divisible_by(3) for T in tor) # optional - sage.rings.number_field + sage: all(T.is_divisible_by(3) for T in tor) # needs sage.rings.number_field True - sage: sorted(T for T in tor if T.is_divisible_by(2)) # optional - sage.rings.number_field + sage: sorted(T for T in tor if T.is_divisible_by(2)) # needs sage.rings.number_field [(0 : 1 : 0), (1 : 0 : 1)] - sage: sorted(Set([2*T for T in tor])) # optional - sage.rings.number_field + sage: sorted(Set([2*T for T in tor])) # needs sage.rings.number_field [(0 : 1 : 0), (1 : 0 : 1)] """ # Coerce the input m to an integer @@ -938,64 +938,65 @@ 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)) # 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 + sage: k. = GF((5,2)) # needs sage.rings.finite_rings + sage: E = EllipticCurve(k, [1,2+a,3,4*a,2]) # needs sage.rings.finite_rings + sage: P = E([3, 3*a+4]) # needs sage.rings.finite_rings + sage: factor(E.order()) # needs sage.rings.finite_rings 2 * 3^2 - sage: P.order() # optional - sage.rings.finite_rings + sage: P.order() # needs 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) # optional - sage.rings.finite_rings + sage: P.division_points(1) # needs 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) # optional - sage.rings.finite_rings + sage: P.division_points(2) # needs 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)] # optional - sage.rings.finite_rings + sage: [2*Q for Q in P.division_points(2)] # needs sage.rings.finite_rings [(3 : 3*a + 4 : 1), (3 : 3*a + 4 : 1)] Some other checks:: - sage: P.division_points(3) # optional - sage.rings.finite_rings + sage: P.division_points(3) # needs sage.rings.finite_rings [] - sage: P.division_points(4) # optional - sage.rings.finite_rings + sage: P.division_points(4) # needs sage.rings.finite_rings [(0 : 3*a + 2 : 1), (1 : 0 : 1)] - sage: P.division_points(5) # optional - sage.rings.finite_rings + sage: P.division_points(5) # needs 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 # optional - sage.rings.number_field + sage: x = polygen(ZZ, 'x') + sage: K. = NumberField(x^9 - 3*x^8 - 4*x^7 + 16*x^6 - 3*x^5 # needs 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 + sage: EK = E.base_extend(K) # needs sage.rings.number_field + sage: E(0).division_points(3) # needs sage.rings.number_field [(0 : 1 : 0), (5 : -10 : 1), (5 : 9 : 1)] - sage: EK(0).division_points(3) # optional - sage.rings.number_field + sage: EK(0).division_points(3) # needs sage.rings.number_field [(0 : 1 : 0), (5 : 9 : 1), (5 : -10 : 1)] - sage: E(0).division_points(9) # optional - sage.rings.number_field + sage: E(0).division_points(9) # needs sage.rings.number_field [(0 : 1 : 0), (5 : -10 : 1), (5 : 9 : 1)] - sage: EK(0).division_points(9) # optional - sage.rings.number_field + sage: EK(0).division_points(9) # needs 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) # 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 + sage: p = next_prime(1000000) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(p), 123, 456) # needs sage.rings.finite_rings + sage: pts = E(0).division_points(3) # needs sage.rings.finite_rings + sage: P = pts[1]; P # needs sage.rings.finite_rings (389063 : 124244 : 1) - sage: P._order # optional - sage.rings.finite_rings + sage: P._order # needs sage.rings.finite_rings 3 When we successfully divide a point known to have infinite @@ -1215,10 +1216,10 @@ def set_order(self, value=None, *, multiple=None, check=True): :: - sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 # optional - sage.rings.finite_rings - 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 + sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 # needs sage.rings.finite_rings + sage: G = E(5, 0) # needs sage.rings.finite_rings + sage: G.set_order(2) # needs sage.rings.finite_rings + sage: 2*G # needs sage.rings.finite_rings (0 : 1 : 0) sage: G = E(0, 6) # optional - sage.rings.finite_rings sage: G.set_order(multiple=12) # optional - sage.rings.finite_rings @@ -1234,14 +1235,14 @@ def set_order(self, value=None, *, multiple=None, 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) # optional - sage.rings.finite_rings + sage: F = GF(p) # needs sage.rings.finite_rings sage: A = p - 3 sage: B = 1093849038073734274511112390766805569936207598951683748994586394495953116150735016013708737573759623248592132296706313309438452531591012912142327488478985984 sage: q = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005449 - 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 + sage: E = EllipticCurve([F(A), F(B)]) # needs sage.rings.finite_rings + sage: G = E.random_point() # needs sage.rings.finite_rings + sage: G.set_order(q) # needs sage.rings.finite_rings + sage: G.order() * G # This takes practically no time. # needs sage.rings.finite_rings (0 : 1 : 0) sage: proof.arithmetic(prev_proof_state) # restore state @@ -1271,13 +1272,13 @@ def set_order(self, value=None, *, multiple=None, check=True): It is an error to pass a ``value`` equal to `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 + sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 # needs sage.rings.finite_rings + sage: G = E.random_point() # needs sage.rings.finite_rings + sage: G.set_order(0) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Value 0 illegal for point order - sage: G.set_order(1000) # optional - sage.rings.finite_rings + sage: G.set_order(1000) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Value 1000 illegal: outside max Hasse bound @@ -1286,9 +1287,9 @@ def set_order(self, value=None, *, multiple=None, 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 # 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 + sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 # needs sage.rings.finite_rings + sage: G = E(5, 0) # G has order 2 # needs sage.rings.finite_rings + sage: G.set_order(11) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Value 11 illegal: 11 * (5 : 0 : 1) is not the identity @@ -1296,10 +1297,10 @@ def set_order(self, value=None, *, multiple=None, check=True): However, ``set_order`` can be fooled. 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 # 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 + sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 # needs sage.rings.finite_rings + sage: G = E(5, 0) # G has order 2 # needs sage.rings.finite_rings + sage: G.set_order(8) # needs sage.rings.finite_rings + sage: G.order() # needs sage.rings.finite_rings 8 TESTS: @@ -1375,27 +1376,27 @@ def _line_(self, R, Q): EXAMPLES:: - 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 + sage: F. = GF((2,5)) # needs sage.rings.finite_rings + sage: E = EllipticCurve(F,[0,0,1,1,1]) # needs sage.rings.finite_rings + sage: P = E(a^4 + 1, a^3) # needs sage.rings.finite_rings + sage: Q = E(a^4, a^4 + a^3) # needs sage.rings.finite_rings + sage: O = E(0) # needs sage.rings.finite_rings + sage: P._line_(P,-2*P) == 0 # needs sage.rings.finite_rings True - sage: P._line_(Q,-(P+Q)) == 0 # optional - sage.rings.finite_rings + sage: P._line_(Q,-(P+Q)) == 0 # needs sage.rings.finite_rings True - sage: O._line_(O,Q) == F(1) # optional - sage.rings.finite_rings + sage: O._line_(O,Q) == F(1) # needs sage.rings.finite_rings True - sage: P._line_(O,Q) == a^4 - a^4 + 1 # optional - sage.rings.finite_rings + sage: P._line_(O,Q) == a^4 - a^4 + 1 # needs sage.rings.finite_rings True - sage: P._line_(13*P,Q) == a^4 # optional - sage.rings.finite_rings + sage: P._line_(13*P,Q) == a^4 # needs sage.rings.finite_rings True - sage: P._line_(P,Q) == a^4 + a^3 + a^2 + 1 # optional - sage.rings.finite_rings + sage: P._line_(P,Q) == a^4 + a^3 + a^2 + 1 # needs sage.rings.finite_rings True See :trac:`7116`:: - sage: P._line_ (Q,O) # optional - sage.rings.finite_rings + sage: P._line_ (Q,O) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Q must be nonzero. @@ -1453,106 +1454,106 @@ def _miller_(self, Q, n): EXAMPLES:: - 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 + sage: F. = GF((2,5)) # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [0,0,1,1,1]) # needs sage.rings.finite_rings + sage: P = E(a^4 + 1, a^3) # needs sage.rings.finite_rings + sage: Fx. = GF((2,(4*5))) # needs sage.rings.finite_rings + sage: Ex = EllipticCurve(Fx, [0,0,1,1,1]) # needs sage.rings.finite_rings + sage: phi = Hom(F,Fx)(F.gen().minpoly().roots(Fx)[0][0]) # needs sage.rings.finite_rings + sage: Px = Ex(phi(P.xy()[0]), phi(P.xy()[1])) # needs 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, # needs 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 + sage: Px._miller_(Qx,41) == b^17 + b^13 + b^12 + b^9 + b^8 + b^6 + b^4 + 1 # needs sage.rings.finite_rings True - sage: Qx._miller_(Px,41) == b^13 + b^10 + b^8 + b^7 + b^6 + b^5 # optional - sage.rings.finite_rings + sage: Qx._miller_(Px,41) == b^13 + b^10 + b^8 + b^7 + b^6 + b^5 # needs sage.rings.finite_rings True - sage: P._miller_(E(0),41) # optional - sage.rings.finite_rings + sage: P._miller_(E(0),41) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Q must be nonzero. An example of even order:: - 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 + sage: F. = GF((19,4)) # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [-1,0]) # needs sage.rings.finite_rings + sage: P = E(15*a^3 + 17*a^2 + 14*a + 13,16*a^3 + 7*a^2 + a + 18) # needs 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) # needs sage.rings.finite_rings + sage: x = P.weil_pairing(Q, 360) # needs sage.rings.finite_rings + sage: x^360 == F(1) # needs 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) # optional - sage.rings.finite_rings + sage: Px._miller_(2*Px, 41) # needs 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 # 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 + sage: q = 401; F = GF(q); a = 146; b = 400; k = 6 # needs sage.rings.finite_rings + sage: E = EllipticCurve([F(a), F(b)]) # needs sage.rings.finite_rings + sage: R. = F[] # needs sage.rings.finite_rings + sage: K. = GF(q^k, modulus=x^6 + 4*x^4 + 115*x^3 + 81*x^2 + 51*x + 3) # needs sage.rings.finite_rings + sage: EK = E.base_extend(K) # needs sage.rings.finite_rings + sage: P = E([F(338), F(227)]) # needs sage.rings.finite_rings + sage: Q_x = 333*a^5 + 391*a^4 + 160*a^3 + 335*a^2 + 71*a + 93 # needs sage.rings.finite_rings + sage: Q_y = 343*a^5 + 273*a^4 + 26*a^3 + 342*a^2 + 340*a + 210 # needs sage.rings.finite_rings + sage: Q = EK([Q_x, Q_y]) # needs sage.rings.finite_rings + sage: P._miller_(Q, 127) # needs 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]) # 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 + sage: E = EllipticCurve([GF(7)(0), 2]) # needs sage.rings.finite_rings + sage: P = E(5, 1); Q = E(0, 3); I = E(0) # needs sage.rings.finite_rings + sage: I._miller_(P, 1) # needs sage.rings.finite_rings 1 - sage: I._miller_(Q, 1) # optional - sage.rings.finite_rings + sage: I._miller_(Q, 1) # needs 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]) # 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 + sage: E = EllipticCurve([GF(7)(-1), 0]) # needs sage.rings.finite_rings + sage: P = E(0,0); Q = E(1, 0); # needs sage.rings.finite_rings + sage: P._miller_(P, 2) # needs sage.rings.finite_rings 0 - sage: Q._miller_(Q, 2) # optional - sage.rings.finite_rings + sage: Q._miller_(Q, 2) # needs sage.rings.finite_rings 0 - sage: P._miller_(Q, 2) # optional - sage.rings.finite_rings + sage: P._miller_(Q, 2) # needs sage.rings.finite_rings 1 - sage: Q._miller_(P, 2) # optional - sage.rings.finite_rings + sage: Q._miller_(P, 2) # needs sage.rings.finite_rings 6 A three-torsion example:: - 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 + sage: E = EllipticCurve([GF(7)(0), 2]) # needs sage.rings.finite_rings + sage: P = E(5, 1); Q = E(0, 3); # needs sage.rings.finite_rings + sage: P._miller_(Q, 3) # needs sage.rings.finite_rings 4 A 4-torsion example:: - 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 + sage: E = EllipticCurve([GF(7)(-1), 0]) # needs sage.rings.finite_rings + sage: P = E(5, 1); Q = E(4, 2) # needs sage.rings.finite_rings + sage: P._miller_(Q, 4) # needs sage.rings.finite_rings 3 A 5-torsion example:: - 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 + sage: E = EllipticCurve([GF(7)(-1), 4]) # needs sage.rings.finite_rings + sage: P = E(4, 1); Q = E(6, 5) # needs sage.rings.finite_rings + sage: P._miller_(Q, 5) # needs sage.rings.finite_rings 1 A 6-torsion example:: - 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 + sage: E = EllipticCurve([GF(7)(3), 1]) # needs sage.rings.finite_rings + sage: P = E(5, 1); Q = E(3, 3) # needs sage.rings.finite_rings + sage: P._miller_(Q, 6) # needs sage.rings.finite_rings 5 An example which is part of an ate pairing calculation. The trace of @@ -1560,13 +1561,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[] # 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: F = GF(p); R. = F[] # needs sage.rings.finite_rings + sage: E = EllipticCurve([F(A), F(B)]); P = E(369, 716) # needs sage.rings.finite_rings + sage: K. = GF(p^k, modulus=x^k+2); EK = E.base_extend(K) # needs sage.rings.finite_rings + sage: Qx = 1226*a^6 + 1778*a^5 + 660*a^4 + 1791*a^3 + 1750*a^2 + 867*a + 770 # needs sage.rings.finite_rings + sage: Qy = 1764*a^6 + 198*a^5 + 1206*a^4 + 406*a^3 + 1200*a^2 + 273*a + 1712 # needs sage.rings.finite_rings + sage: Q = EK(Qx, Qy) # needs sage.rings.finite_rings + sage: Q._miller_(P, t - 1) # needs sage.rings.finite_rings 1311*a^6 + 1362*a^5 + 1177*a^4 + 807*a^3 + 1331*a^2 + 1530*a + 1931 ALGORITHM: @@ -1634,66 +1635,66 @@ def weil_pairing(self, Q, n, algorithm=None): EXAMPLES:: - 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 + sage: F. = GF((2,5)) # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [0,0,1,1,1]) # needs sage.rings.finite_rings + sage: P = E(a^4 + 1, a^3) # needs sage.rings.finite_rings + sage: Fx. = GF((2, 4*5)) # needs sage.rings.finite_rings + sage: Ex = EllipticCurve(Fx, [0,0,1,1,1]) # needs sage.rings.finite_rings + sage: phi = Hom(F, Fx)(F.gen().minpoly().roots(Fx)[0][0]) # needs sage.rings.finite_rings + sage: Px = Ex(phi(P.xy()[0]), phi(P.xy()[1])) # needs sage.rings.finite_rings + sage: O = Ex(0) # needs 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, # needs 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 + sage: Px.weil_pairing(Qx, 41) == b^19 + b^15 + b^9 + b^8 + b^6 + b^4 + b^3 + b^2 + 1 # needs sage.rings.finite_rings True - sage: Px.weil_pairing(17*Px, 41) == Fx(1) # optional - sage.rings.finite_rings + sage: Px.weil_pairing(17*Px, 41) == Fx(1) # needs sage.rings.finite_rings True - sage: Px.weil_pairing(O, 41) == Fx(1) # optional - sage.rings.finite_rings + sage: Px.weil_pairing(O, 41) == Fx(1) # needs sage.rings.finite_rings True An error is raised if either point is not `n`-torsion:: - sage: Px.weil_pairing(O, 40) # optional - sage.rings.finite_rings + sage: Px.weil_pairing(O, 40) # needs 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() # optional - sage.rings.finite_rings - sage: P.order(), Q.order() # optional - sage.rings.finite_rings + sage: P, Q = EllipticCurve(GF((19,4),'a'), [-1,0]).gens() # needs sage.rings.finite_rings + sage: P.order(), Q.order() # needs sage.rings.finite_rings (360, 360) - sage: z = P.weil_pairing(Q, 360) # optional - sage.rings.finite_rings - sage: z.multiplicative_order() # optional - sage.rings.finite_rings + sage: z = P.weil_pairing(Q, 360) # needs sage.rings.finite_rings + sage: z.multiplicative_order() # needs sage.rings.finite_rings 360 An example over a number field:: - 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 + sage: E = EllipticCurve('11a1').change_ring(CyclotomicField(5)) # needs sage.rings.number_field + sage: P, Q = E.torsion_subgroup().gens() # needs sage.rings.number_field + sage: P, Q = (P.element(), Q.element()) # needs sage.rings.number_field + sage: (P.order(), Q.order()) # needs sage.rings.number_field (5, 5) - sage: P.weil_pairing(Q, 5) # optional - sage.rings.number_field + sage: P.weil_pairing(Q, 5) # needs sage.rings.number_field zeta5^2 - sage: Q.weil_pairing(P, 5) # optional - sage.rings.number_field + sage: Q.weil_pairing(P, 5) # needs sage.rings.number_field zeta5^3 TESTS: Check that the original Sage implementation still works:: - sage: GF(65537^2).inject_variables() # optional - sage.rings.finite_rings + sage: GF(65537^2).inject_variables() # needs sage.rings.finite_rings Defining z2 - 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 + sage: E = EllipticCurve(GF(65537^2), [0,1]) # needs sage.rings.finite_rings + sage: P = E(22, 28891) # needs sage.rings.finite_rings + sage: Q = E(-93, 40438*z2 + 31573) # needs sage.rings.finite_rings + sage: P.weil_pairing(Q, 7282, algorithm='sage') # needs sage.rings.finite_rings 19937*z2 + 65384 Passing an unknown ``algorithm=`` argument should fail:: - sage: P.weil_pairing(Q, 7282, algorithm='_invalid_') # optional - sage.rings.finite_rings + sage: P.weil_pairing(Q, 7282, algorithm='_invalid_') # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: unknown algorithm @@ -1812,82 +1813,82 @@ 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]) # optional - sage.rings.finite_rings - sage: P = E(33, 91); n = P.order(); n # optional - sage.rings.finite_rings + sage: p = 103; A = 1; B = 18; E = EllipticCurve(GF(p), [A, B]) # needs sage.rings.finite_rings + sage: P = E(33, 91); n = P.order(); n # needs sage.rings.finite_rings 19 - sage: k = GF(n)(p).multiplicative_order(); k # optional - sage.rings.finite_rings + sage: k = GF(n)(p).multiplicative_order(); k # needs sage.rings.finite_rings 6 - sage: P.tate_pairing(P, n, k) # optional - sage.rings.finite_rings + sage: P.tate_pairing(P, n, k) # needs sage.rings.finite_rings 1 - sage: Q = E(87, 51) # optional - sage.rings.finite_rings - sage: P.tate_pairing(Q, n, k) # optional - sage.rings.finite_rings + sage: Q = E(87, 51) # needs sage.rings.finite_rings + sage: P.tate_pairing(Q, n, k) # needs sage.rings.finite_rings 1 sage: set_random_seed(35) - sage: P.tate_pairing(P, n, k) # optional - sage.rings.finite_rings + sage: P.tate_pairing(P, n, k) # needs sage.rings.finite_rings 1 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:: - 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 + sage: K. = GF((p,k)) # needs sage.rings.finite_rings + sage: EK = E.base_extend(K); P = EK(P) # needs sage.rings.finite_rings + sage: Qx = 69*a^5 + 96*a^4 + 22*a^3 + 86*a^2 + 6*a + 35 # needs sage.rings.finite_rings + sage: Qy = 34*a^5 + 24*a^4 + 16*a^3 + 41*a^2 + 4*a + 40 # needs sage.rings.finite_rings + sage: Q = EK(Qx, Qy); # needs sage.rings.finite_rings Multiply by cofactor so Q has order n:: - 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 + sage: h = 551269674; Q = h*Q # needs sage.rings.finite_rings + sage: P = EK(P); P.tate_pairing(Q, n, k) # needs 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)) # 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 + sage: s = Integer(randrange(1,n)) # needs sage.rings.finite_rings + sage: ans1 = (s*P).tate_pairing(Q, n, k) # needs sage.rings.finite_rings + sage: ans2 = P.tate_pairing(s*Q, n, k) # needs sage.rings.finite_rings + sage: ans3 = P.tate_pairing(Q, n, k)^s # needs sage.rings.finite_rings + sage: ans1 == ans2 == ans3 # needs sage.rings.finite_rings True - sage: (ans1 != 1) and (ans1^n == 1) # optional - sage.rings.finite_rings + sage: (ans1 != 1) and (ans1^n == 1) # needs 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 # optional - sage.rings.finite_rings + sage: e = Integer((p^k-1)/n); e # needs sage.rings.finite_rings 62844857712 - sage: P.weil_pairing(Q, n)^e # optional - sage.rings.finite_rings + sage: P.weil_pairing(Q, n)^e # needs 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 # optional - sage.rings.finite_rings + sage: P.tate_pairing(Q, n, k) == P._miller_(Q, n)^e # needs sage.rings.finite_rings True - sage: Q.tate_pairing(P, n, k) == Q._miller_(P, n)^e # optional - sage.rings.finite_rings + sage: Q.tate_pairing(P, n, k) == Q._miller_(P, n)^e # needs sage.rings.finite_rings True - sage: P.tate_pairing(Q, n, k)/Q.tate_pairing(P, n, k) # optional - sage.rings.finite_rings + sage: P.tate_pairing(Q, n, k)/Q.tate_pairing(P, n, k) # needs 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)) # 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 + sage: F. = GF((2,5)) # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [0,0,1,1,1]) # needs sage.rings.finite_rings + sage: P = E(a^4 + 1, a^3) # needs sage.rings.finite_rings + sage: Fx. = GF((2,4*5)) # needs sage.rings.finite_rings + sage: Ex = EllipticCurve(Fx,[0,0,1,1,1]) # needs sage.rings.finite_rings + sage: phi = Hom(F, Fx)(F.gen().minpoly().roots(Fx)[0][0]) # needs sage.rings.finite_rings + sage: Px = Ex(phi(P.xy()[0]), phi(P.xy()[1])) # needs 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, # needs 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 + sage: Px.tate_pairing(Qx, n=41, k=4) # needs 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 # optional - sage.rings.finite_rings + sage: num = Px.tate_pairing(Qx, n=41, k=4, q=32); num # needs 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 # optional - sage.rings.finite_rings + sage: den = Qx.tate_pairing(Px, n=41, k=4, q=32); den # needs 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 # optional - sage.rings.finite_rings + sage: e = Integer((32^4-1)/41); e # needs sage.rings.finite_rings 25575 - sage: Px.weil_pairing(Qx, 41)^e == num/den # optional - sage.rings.finite_rings + sage: Px.weil_pairing(Qx, 41)^e == num/den # needs sage.rings.finite_rings True .. NOTE:: @@ -1969,63 +1970,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]) # 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 + sage: F = GF(p); E = EllipticCurve(F, [A, B]) # needs sage.rings.finite_rings + sage: R. = F[]; K. = GF((p,k), modulus=x^k+2) # needs sage.rings.finite_rings + sage: EK = E.base_extend(K) # needs sage.rings.finite_rings + sage: P = EK(3050, 5371); Q = EK(6908*a^4, 3231*a^3) # needs sage.rings.finite_rings + sage: P.ate_pairing(Q, n, k, t) # needs 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)) # 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 + sage: s = Integer(randrange(1, n)) # needs sage.rings.finite_rings + sage: (s*P).ate_pairing(Q, n, k, t) == P.ate_pairing(s*Q, n, k, t) # needs sage.rings.finite_rings True - sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s # optional - sage.rings.finite_rings + sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s # needs 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]) # 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 + sage: F = GF(p); E = EllipticCurve(F, [A, B]) # needs sage.rings.finite_rings + sage: R. = F[]; K. = GF((p,k), modulus=x^k+2) # needs sage.rings.finite_rings + sage: EK = E.base_extend(K) # needs sage.rings.finite_rings + sage: P = EK(1583, 1734) # needs sage.rings.finite_rings + sage: Qx = 1729*a^6+1767*a^5+245*a^4+980*a^3+1592*a^2+1883*a+722 # needs sage.rings.finite_rings + sage: Qy = 1299*a^6+1877*a^5+1030*a^4+1513*a^3+1457*a^2+309*a+1636 # needs sage.rings.finite_rings + sage: Q = EK(Qx, Qy) # needs sage.rings.finite_rings + sage: P.ate_pairing(Q, n, k, t) # needs 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)) # 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 + sage: s = Integer(randrange(1, n)) # needs sage.rings.finite_rings + sage: (s*P).ate_pairing(Q, n, k, t) == P.ate_pairing(s*Q, n, k, t) # needs sage.rings.finite_rings True - sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s # optional - sage.rings.finite_rings + sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s # needs 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]) # 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 + sage: F = GF(p); E = EllipticCurve(F, [A, B]) # needs sage.rings.finite_rings + sage: R. = F[]; K. = GF((p,k), modulus=x^k+2) # needs sage.rings.finite_rings + sage: EK = E.base_extend(K) # needs sage.rings.finite_rings + sage: P = EK(369, 716) # needs sage.rings.finite_rings + sage: Qx = 1226*a^6+1778*a^5+660*a^4+1791*a^3+1750*a^2+867*a+770 # needs sage.rings.finite_rings + sage: Qy = 1764*a^6+198*a^5+1206*a^4+406*a^3+1200*a^2+273*a+1712 # needs sage.rings.finite_rings + sage: Q = EK(Qx, Qy) # needs sage.rings.finite_rings + sage: P.ate_pairing(Q, n, k, t) # needs 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)) # 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 + sage: s = Integer(randrange(1, n)) # needs sage.rings.finite_rings + sage: (s*P).ate_pairing(Q, n, k, t) == P.ate_pairing(s*Q, n, k, t) # needs sage.rings.finite_rings True - sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s # optional - sage.rings.finite_rings + sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s # needs 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 # 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 + sage: c = (k*p^(k-1)).mod(n); T = t - 1 # needs sage.rings.finite_rings + sage: N = gcd(T^k - 1, p^k - 1) # needs sage.rings.finite_rings + sage: s = Integer(N/n) # needs sage.rings.finite_rings + sage: L = Integer((T^k - 1)/N) # needs sage.rings.finite_rings + sage: M = (L*s*c.inverse_mod(n)).mod(n) # needs sage.rings.finite_rings + sage: P.ate_pairing(Q, n, k, t) == Q.tate_pairing(P, n, k)^M # needs sage.rings.finite_rings True An example where we have to pass the base field size (and we again have @@ -2033,47 +2034,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) # 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 + sage: q = 2^5; F. = GF(q) # needs sage.rings.finite_rings + sage: n = 41; k = 4; t = -8 # needs sage.rings.finite_rings + sage: E = EllipticCurve(F,[0,0,1,1,1]) # needs sage.rings.finite_rings + sage: P = E(a^4 + 1, a^3) # needs sage.rings.finite_rings + sage: Fx. = GF(q^k) # needs sage.rings.finite_rings + sage: Ex = EllipticCurve(Fx, [0,0,1,1,1]) # needs sage.rings.finite_rings + sage: phi = Hom(F, Fx)(F.gen().minpoly().roots(Fx)[0][0]) # needs sage.rings.finite_rings + sage: Px = Ex(phi(P.xy()[0]), phi(P.xy()[1])) # needs 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, # needs 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 + sage: Qx = Ex(Qx[0]^q, Qx[1]^q) - Qx # ensure Qx is in ker(pi - q) # needs sage.rings.finite_rings + sage: Px.ate_pairing(Qx, n, k, t) # needs 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) # optional - sage.rings.finite_rings + sage: Px.ate_pairing(Qx, n, k, t, q) # needs 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) # optional - sage.rings.finite_rings + sage: (s*Px).ate_pairing(Qx, n, k, t, q) == Px.ate_pairing(s*Qx, n, k, t, q) # needs sage.rings.finite_rings True - sage: Px.ate_pairing(s*Qx, n, k, t, q) == Px.ate_pairing(Qx, n, k, t, q)^s # optional - sage.rings.finite_rings + sage: Px.ate_pairing(s*Qx, n, k, t, q) == Px.ate_pairing(Qx, n, k, t, q)^s # needs sage.rings.finite_rings True - 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 + sage: c = (k*q^(k-1)).mod(n); T = t - 1 # needs sage.rings.finite_rings + sage: N = gcd(T^k - 1, q^k - 1) # needs sage.rings.finite_rings + sage: s = Integer(N/n) # needs sage.rings.finite_rings + sage: L = Integer((T^k - 1)/N) # needs sage.rings.finite_rings + sage: M = (L*s*c.inverse_mod(n)).mod(n) # needs sage.rings.finite_rings + sage: Px.ate_pairing(Qx, n, k, t, q) == Qx.tate_pairing(Px, n, k, q)^M # needs 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 # 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 + sage: p = 29; A = 1; B = 0; n = 5; k = 2; t = 10 # needs sage.rings.finite_rings + sage: F = GF(p); R. = F[] # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [A, B]); # needs sage.rings.finite_rings + sage: K. = GF((p,k), modulus=x^k+2); EK = E.base_extend(K) # needs sage.rings.finite_rings + sage: P = EK(13, 8); Q = EK(13, 21) # needs sage.rings.finite_rings + sage: P.ate_pairing(Q, n, k, t) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Point (13 : 21 : 1) not in Ker(pi - q) @@ -2081,11 +2082,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[] # 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 + sage: F = GF(p); R. = F[] # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [A, B]); # needs sage.rings.finite_rings + sage: K. = GF((p,k), modulus=x^k+2); EK = E.base_extend(K) # needs sage.rings.finite_rings + sage: P = EK(14, 10*a); Q = EK(13, 21) # needs sage.rings.finite_rings + sage: P.ate_pairing(Q, n, k, t) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: This point (14 : 10*a : 1) is not in Ker(pi - 1) @@ -2155,7 +2156,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 # optional - sage.rings.finite_rings + sage: E([GF(5)(0), 0]) # entries are coerced # needs sage.rings.finite_rings (0 : 0 : 1) sage: E(0.000, 0) @@ -2340,21 +2341,21 @@ def is_on_identity_component(self, embedding=None): An example over a field with two real embeddings:: - 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 + sage: L. = QuadraticField(2) # needs sage.rings.number_field + sage: E = EllipticCurve(L, [0,1,0,a,a]) # needs sage.rings.number_field + sage: P = E(-1,0) # needs sage.rings.number_field + sage: [P.is_on_identity_component(e) for e in L.embeddings(RR)] # needs sage.rings.number_field [False, True] We can check this as follows:: - sage: [e(E.discriminant()) > 0 for e in L.embeddings(RR)] # optional - sage.rings.number_field + sage: [e(E.discriminant()) > 0 for e in L.embeddings(RR)] # needs sage.rings.number_field [True, False] - 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 + sage: e = L.embeddings(RR)[0] # needs sage.rings.number_field + sage: E1 = EllipticCurve(RR, [e(ai) for ai in E.ainvs()]) # needs sage.rings.number_field + sage: e1, e2, e3 = E1.two_division_polynomial().roots(RR, # needs sage.rings.number_field ....: multiplicities=False) - sage: e1 < e2 < e3 and e(P[0]) < e3 # optional - sage.rings.number_field + sage: e1 < e2 < e3 and e(P[0]) < e3 # needs sage.rings.number_field True """ if self.is_zero(): # trivial case @@ -2426,21 +2427,21 @@ def has_good_reduction(self, P=None): :: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,1,0,-160,308]) # needs sage.rings.number_field + sage: P = E(26, -120) # needs sage.rings.number_field + sage: E.discriminant().support() # needs 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()] # optional - sage.rings.number_field + sage: [E.tamagawa_exponent(p) for p in E.discriminant().support()] # needs sage.rings.number_field [1, 4, 4, 4] - sage: P.has_good_reduction() # optional - sage.rings.number_field + sage: P.has_good_reduction() # needs sage.rings.number_field False - sage: (2*P).has_good_reduction() # optional - sage.rings.number_field + sage: (2*P).has_good_reduction() # needs sage.rings.number_field False - sage: (4*P).has_good_reduction() # optional - sage.rings.number_field + sage: (4*P).has_good_reduction() # needs sage.rings.number_field True TESTS: @@ -2448,14 +2449,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) # 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 + sage: K. = NumberField(x^2 + 47) # needs sage.rings.number_field + sage: EK = E.base_extend(K) # needs sage.rings.number_field + sage: T = EK(5, 5) # needs sage.rings.number_field + sage: P = EK(-2, -1/2*t - 1/2) # needs sage.rings.number_field + sage: p = K.ideal(11) # needs sage.rings.number_field + sage: T.has_good_reduction(p) # needs sage.rings.number_field False - sage: P.has_good_reduction(p) # optional - sage.rings.number_field + sage: P.has_good_reduction(p) # needs sage.rings.number_field True """ if self.is_zero(): # trivial case @@ -2537,22 +2538,22 @@ def reduction(self, p): :: sage: x = polygen(ZZ, 'x') - 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 + sage: F. = NumberField(x^2 + 5) # needs sage.rings.number_field + sage: E = EllipticCurve(F, [1,2,3,4,0]) # needs sage.rings.number_field + sage: Q = E(98, 931) # needs sage.rings.number_field + sage: Q.reduction(a) # needs sage.rings.number_field (3 : 1 : 1) - sage: Q.reduction(11) # optional - sage.rings.number_field + sage: Q.reduction(11) # needs sage.rings.number_field (10 : 7 : 1) :: - 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 + sage: F. = NumberField(x^3 + x^2 + 1) # needs sage.rings.number_field + sage: E = EllipticCurve(F, [a,2]) # needs sage.rings.number_field + sage: P = E(a, 1) # needs sage.rings.number_field + sage: P.reduction(F.ideal(5)) # needs sage.rings.number_field (abar : 1 : 1) - sage: P.reduction(F.ideal(a^2 - 4*a - 2)) # optional - sage.rings.number_field + sage: P.reduction(F.ideal(a^2 - 4*a - 2)) # needs sage.rings.number_field (abar : 1 : 1) """ P = self @@ -2666,20 +2667,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) # optional - sage.rings.number_field - sage: E = EllipticCurve([a, 4]); E # optional - sage.rings.number_field + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([a, 4]); E # needs 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 + sage: P = E((0,2)) # needs sage.rings.number_field + sage: P.height() # needs sage.rings.number_field 0.810463096585925 - sage: P.height(precision=100) # optional - sage.rings.number_field + sage: P.height(precision=100) # needs sage.rings.number_field 0.81046309658592536863991810577 - sage: P.height(precision=200) # optional - sage.rings.number_field + sage: P.height(precision=200) # needs sage.rings.number_field 0.81046309658592536863991810576865158896130286417155832378086 - sage: (2*P).height() / P.height() # optional - sage.rings.number_field + sage: (2*P).height() / P.height() # needs sage.rings.number_field 4.00000000000000 - sage: (100*P).height() / P.height() # optional - sage.rings.number_field + sage: (100*P).height() / P.height() # needs sage.rings.number_field 10000.0000000000 Setting ``normalised=False`` multiplies the height by the degree of `K`:: @@ -2690,12 +2691,12 @@ def height(self, precision=None, normalised=True, algorithm='pari'): 0.0511114082399688 sage: P.height(normalised=False) 0.0511114082399688 - 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 + sage: K. = CyclotomicField(5) # needs sage.rings.number_field + sage: EK = E.change_ring(K) # needs sage.rings.number_field + sage: PK = EK([0,0]) # needs sage.rings.number_field + sage: PK.height() # needs sage.rings.number_field 0.0511114082399688 - sage: PK.height(normalised=False) # optional - sage.rings.number_field + sage: PK.height(normalised=False) # needs sage.rings.number_field 0.204445632959875 Some consistency checks:: @@ -2705,31 +2706,31 @@ def height(self, precision=None, normalised=True, algorithm='pari'): sage: P.height() 1.36857250535393 - 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 + sage: EK = E.change_ring(QuadraticField(-3,'a')) # needs sage.rings.number_field + sage: PK = EK([-2,3,1]) # needs sage.rings.number_field + sage: PK.height() # needs sage.rings.number_field 1.36857250535393 - 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 + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,4,6*i,0]) # needs sage.rings.number_field + sage: Q = E.lift_x(-9/4); Q # needs sage.rings.number_field (-9/4 : 27/8*i - 4 : 1) - sage: Q.height() # optional - sage.rings.number_field + sage: Q.height() # needs sage.rings.number_field 2.69518560017909 - sage: (15*Q).height() / Q.height() # optional - sage.rings.number_field + sage: (15*Q).height() / Q.height() # needs sage.rings.number_field 225.000000000000 sage: E = EllipticCurve('37a') sage: P = E([0,-1]) sage: P.height() 0.0511114082399688 - 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 + sage: K. = QuadraticField(-7) # needs sage.rings.number_field + sage: ED = E.quadratic_twist(-7) # needs sage.rings.number_field + sage: Q = E.isomorphism_to(ED.change_ring(K))(P); Q # needs sage.rings.number_field (0 : -7/2*a - 1/2 : 1) - sage: Q.height() # optional - sage.rings.number_field + sage: Q.height() # needs sage.rings.number_field 0.0511114082399688 - sage: Q.height(precision=100) # optional - sage.rings.number_field + sage: Q.height(precision=100) # needs sage.rings.number_field 0.051111408239968840235886099757 An example to show that the bug at :trac:`5252` is fixed:: @@ -2764,17 +2765,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) # 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 + sage: K. = NumberField(x^2 - x - 1) # needs sage.rings.number_field + sage: v = [0, a + 1, 1, 28665*a - 46382, 2797026*a - 4525688] # needs sage.rings.number_field + sage: E = EllipticCurve(v) # needs sage.rings.number_field + sage: P = E([72*a - 509/5, -682/25*a - 434/25]) # needs sage.rings.number_field + sage: P.height() # needs sage.rings.number_field 1.38877711688727 - sage: (2*P).height()/P.height() # optional - sage.rings.number_field + sage: (2*P).height()/P.height() # needs sage.rings.number_field 4.00000000000000 - sage: (2*P).height(precision=100)/P.height(precision=100) # optional - sage.rings.number_field + sage: (2*P).height(precision=100)/P.height(precision=100) # needs sage.rings.number_field 4.0000000000000000000000000000 - sage: (2*P).height(precision=1000)/P.height(precision=1000) # optional - sage.rings.number_field + sage: (2*P).height(precision=1000)/P.height(precision=1000) # needs sage.rings.number_field 4.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 This shows that the bug reported at :trac:`13951` has been fixed:: @@ -2783,9 +2784,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')) # optional - sage.rings.number_field - sage: P2 = F([2,5]) # optional - sage.rings.number_field - sage: P2.height() # optional - sage.rings.number_field + sage: F = E.change_ring(QuadraticField(-3, 'a')) # needs sage.rings.number_field + sage: P2 = F([2,5]) # needs sage.rings.number_field + sage: P2.height() # needs sage.rings.number_field 1.06248137652528 """ if self.has_finite_order(): @@ -2860,27 +2861,27 @@ def archimedean_local_height(self, v=None, prec=None, weighted=False): Examples 1, 2, and 3 from [Sil1988]_:: - sage: K. = QuadraticField(-2) # optional - sage.rings.number_field - sage: E = EllipticCurve(K, [0,-1,1,0,0]); E # optional - sage.rings.number_field + sage: K. = QuadraticField(-2) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,-1,1,0,0]); E # needs 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 + sage: P = E.lift_x(2 + a); P # needs sage.rings.number_field (a + 2 : -2*a - 2 : 1) - sage: P.archimedean_local_height(K.places(prec=170)[0]) / 2 # optional - sage.rings.number_field + sage: P.archimedean_local_height(K.places(prec=170)[0]) / 2 # needs sage.rings.number_field 0.45754773287523276736211210741423654346576029814695 sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,4,6*i,0]); E # needs 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 + sage: P = E((0,0)) # needs sage.rings.number_field + sage: P.archimedean_local_height(K.places()[0]) / 2 # needs sage.rings.number_field 0.510184995162373 - sage: Q = E.lift_x(-9/4); Q # optional - sage.rings.number_field + sage: Q = E.lift_x(-9/4); Q # needs sage.rings.number_field (-9/4 : 27/8*i - 4 : 1) - sage: Q.archimedean_local_height(K.places()[0]) / 2 # optional - sage.rings.number_field + sage: Q.archimedean_local_height(K.places()[0]) / 2 # needs sage.rings.number_field 0.654445619529600 An example over the rational numbers:: @@ -2893,10 +2894,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) # 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, K(1), 0]) # needs sage.rings.number_field + sage: P = E(i, 0) # needs sage.rings.number_field + sage: P.archimedean_local_height() # needs sage.rings.number_field 0.346573590279973 TESTS: @@ -2904,34 +2905,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) # 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 + sage: K. = NumberField(x^2 - x - 1) # needs sage.rings.number_field + sage: v = [0, a + 1, 1, 28665*a - 46382, 2797026*a - 4525688] # needs sage.rings.number_field + sage: E = EllipticCurve(v) # needs sage.rings.number_field + sage: P = E([72*a - 509/5, -682/25*a - 434/25]) # needs sage.rings.number_field + sage: P.archimedean_local_height() # needs sage.rings.number_field -0.220660795546828 See :trac:`19276`:: - 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 + sage: K. = NumberField(x^2 - x - 104) # needs sage.rings.number_field + sage: E = EllipticCurve([1, a - 1, 1, -816765673272*a - 7931030674178, 1478955604013312315*a + 14361086227143654561]) # needs sage.rings.number_field + sage: P = E(5393511/49*a + 52372721/49 , -33896210324/343*a - 329141996591/343 ) # needs sage.rings.number_field + sage: P.height() # needs sage.rings.number_field 0.974232017827741 See :trac:`29966`:: - 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 + sage: K. = NumberField(x^3 - x^2 - 6*x + 2) # needs sage.rings.number_field + sage: E = EllipticCurve([1, -a^2 + 2*a + 4, 0, -6056450500590472699700624*a^2 - 11239394326797569935861742*a + 4241549693833829432516231, # needs 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 + sage: P = E([1033399668533*a^2 + 1917754693229*a - 723726883800 , 12536493059202326563*a^2 + 23264879148900575548*a - 8779756111574815918 , 1]) # needs sage.rings.number_field + sage: P.height() # needs sage.rings.number_field 0.297318833424763 - sage: (2*P).height() / P.height() # optional - sage.rings.number_field + sage: (2*P).height() / P.height() # needs sage.rings.number_field 4.00000000000000 - sage: P.height(200) # optional - sage.rings.number_field + sage: P.height(200) # needs sage.rings.number_field 0.29731883342476341806143743594519935578696537745294661858984 - sage: (2*P).height(200) / P.height(200) # optional - sage.rings.number_field + sage: (2*P).height(200) / P.height(200) # needs sage.rings.number_field 4.0000000000000000000000000000000000000000000000000000000000 """ from sage.rings.number_field.number_field import refine_embedding @@ -3090,27 +3091,27 @@ def non_archimedean_local_height(self, v=None, prec=None, Examples 2 and 3 from [Sil1988]_:: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,4,6*i,0]); E # needs 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 + sage: P = E((0,0)) # needs sage.rings.number_field + sage: P.non_archimedean_local_height(K.ideal(i+1)) # needs sage.rings.number_field -1/2*log(2) - sage: P.non_archimedean_local_height(K.ideal(3)) # optional - sage.rings.number_field + sage: P.non_archimedean_local_height(K.ideal(3)) # needs sage.rings.number_field 0 - sage: P.non_archimedean_local_height(K.ideal(1-2*i)) # optional - sage.rings.number_field + sage: P.non_archimedean_local_height(K.ideal(1-2*i)) # needs sage.rings.number_field 0 - sage: Q = E.lift_x(-9/4); Q # optional - sage.rings.number_field + sage: Q = E.lift_x(-9/4); Q # needs sage.rings.number_field (-9/4 : 27/8*i - 4 : 1) - sage: Q.non_archimedean_local_height(K.ideal(1+i)) # optional - sage.rings.number_field + sage: Q.non_archimedean_local_height(K.ideal(1+i)) # needs sage.rings.number_field 2*log(2) - sage: Q.non_archimedean_local_height(K.ideal(3)) # optional - sage.rings.number_field + sage: Q.non_archimedean_local_height(K.ideal(3)) # needs sage.rings.number_field 0 - sage: Q.non_archimedean_local_height(K.ideal(1-2*i)) # optional - sage.rings.number_field + sage: Q.non_archimedean_local_height(K.ideal(1-2*i)) # needs sage.rings.number_field 0 - sage: Q.non_archimedean_local_height() # optional - sage.rings.number_field + sage: Q.non_archimedean_local_height() # needs sage.rings.number_field 2*log(2) An example over the rational numbers:: @@ -3123,30 +3124,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) # 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, K(1), 0]) # needs sage.rings.number_field + sage: P = E(i, 0) # needs sage.rings.number_field + sage: P.non_archimedean_local_height() # needs sage.rings.number_field -1/2*log(2) TESTS:: - sage: Q.non_archimedean_local_height(prec=100) # optional - sage.rings.number_field + sage: Q.non_archimedean_local_height(prec=100) # needs sage.rings.number_field 1.3862943611198906188344642429 - sage: (3*Q).non_archimedean_local_height() # optional - sage.rings.number_field + sage: (3*Q).non_archimedean_local_height() # needs sage.rings.number_field 1/2*log(75923153929839865104) - 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 + sage: F. = NumberField(x^4 + 2*x^3 + 19*x^2 + 18*x + 288) # needs sage.rings.number_field + sage: F.ring_of_integers().basis() # needs 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() # optional - sage.rings.number_field + sage: F.class_number() # needs sage.rings.number_field 12 - 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 + sage: E = EllipticCurve('37a').change_ring(F) # needs sage.rings.number_field + sage: P = E((-a^2/6 - a/6 - 1, a)); P # needs sage.rings.number_field (-1/6*a^2 - 1/6*a - 1 : a : 1) - sage: P[0].is_integral() # optional - sage.rings.number_field + sage: P[0].is_integral() # needs sage.rings.number_field True - sage: P.non_archimedean_local_height() # optional - sage.rings.number_field + sage: P.non_archimedean_local_height() # needs sage.rings.number_field 0 This shows that the bug reported at :trac:`13951` has been fixed:: @@ -3334,24 +3335,24 @@ def elliptic_logarithm(self, embedding=None, precision=100, Examples over number fields:: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: embs = K.embeddings(CC) # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field + sage: Ls = [E.period_lattice(e) for e in embs] # needs sage.rings.number_field + sage: [L.real_flag for L in Ls] # needs sage.rings.number_field [0, 0, -1] - 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 + sage: P = E(-1,0) # order 2 # needs sage.rings.number_field + sage: [L.elliptic_logarithm(P) for L in Ls] # needs 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 ), + sage: E = EllipticCurve([-a^2 - a - 1, a^2 + a]) # needs sage.rings.number_field + sage: Ls = [E.period_lattice(e) for e in embs] # needs sage.rings.number_field + sage: pts = [E(2*a^2 - a - 1 , -2*a^2 - 2*a + 6 ), # needs sage.rings.number_field ....: 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 + sage: [[L.elliptic_logarithm(P) for P in pts] for L in Ls] # needs 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, @@ -3361,12 +3362,12 @@ def elliptic_logarithm(self, embedding=None, precision=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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0,0,0,9*i-10,21-i]) # needs sage.rings.number_field + sage: emb = K.embeddings(CC)[1] # needs sage.rings.number_field + sage: L = E.period_lattice(emb) # needs sage.rings.number_field + sage: P = E(2-i, 4+2*i) # needs sage.rings.number_field + sage: L.elliptic_logarithm(P, prec=100) # needs sage.rings.number_field 0.70448375537782208460499649302 - 0.79246725643650979858266018068*I """ from sage.rings.number_field.number_field import refine_embedding @@ -3484,30 +3485,30 @@ def padic_elliptic_logarithm(self, p, absprec=20): EXAMPLES:: sage: E = EllipticCurve([0,1,1,-2,0]) - sage: E(0).padic_elliptic_logarithm(3) # optional - sage.rings.padics + sage: E(0).padic_elliptic_logarithm(3) # needs sage.rings.padics 0 - sage: P = E(0, 0) # optional - sage.rings.padics - sage: P.padic_elliptic_logarithm(3) # optional - sage.rings.padics + sage: P = E(0, 0) # needs sage.rings.padics + sage: P.padic_elliptic_logarithm(3) # needs 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() # optional - sage.rings.padics + sage: P.padic_elliptic_logarithm(3).lift() # needs sage.rings.padics 660257522 - 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 + sage: P = E(-11/9, 28/27) # needs sage.rings.padics + sage: [(2*P).padic_elliptic_logarithm(p)/P.padic_elliptic_logarithm(p) for p in prime_range(20)] # long time, needs 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) # optional - sage.rings.padics + sage: [(3*P).padic_elliptic_logarithm(p)/P.padic_elliptic_logarithm(p) for p in prime_range(12)] # long time, needs 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) # optional - sage.rings.padics + sage: [(5*P).padic_elliptic_logarithm(p)/P.padic_elliptic_logarithm(p) for p in prime_range(12)] # long time, needs 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 # optional - sage.rings.padics + sage: P.padic_elliptic_logarithm(2) # default precision=20 # needs 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) # optional - sage.rings.padics + sage: P.padic_elliptic_logarithm(2, absprec=30) # needs 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) # optional - sage.rings.padics + sage: P.padic_elliptic_logarithm(2, absprec=40) # needs 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) """ @@ -3596,9 +3597,9 @@ def _magma_init_(self, magma): EXAMPLES:: - 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 + sage: E = EllipticCurve(GF(17), [1,-1]) # needs sage.rings.finite_rings + sage: P = E([13, 4]) # needs sage.rings.finite_rings + sage: P._magma_init_(magma) # optional - magma # needs 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) @@ -3612,14 +3613,14 @@ def _acted_upon_(self, other, side): EXAMPLES:: - sage: P = EllipticCurve(GF(65537), [2,2]).lift_x(6) # optional - sage.rings.finite_rings - sage: P.order().factor() # optional - sage.rings.finite_rings + sage: P = EllipticCurve(GF(65537), [2,2]).lift_x(6) # needs sage.rings.finite_rings + sage: P.order().factor() # needs sage.rings.finite_rings 2^2 * 3 * 37^2 - sage: getattr(74*P, '_order', None) # optional - sage.rings.finite_rings + sage: getattr(74*P, '_order', None) # needs sage.rings.finite_rings 222 - sage: getattr(P*4070, '_order', None) # optional - sage.rings.finite_rings + sage: getattr(P*4070, '_order', None) # needs sage.rings.finite_rings 222 - sage: getattr(506*P*37, '_order', None) # optional - sage.rings.finite_rings + sage: getattr(506*P*37, '_order', None) # needs sage.rings.finite_rings 222 """ k = ZZ(other) @@ -3702,14 +3703,14 @@ def discrete_log(self, Q, ord=None): EXAMPLES:: - 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 + sage: F = GF((3,6),'a') # needs sage.rings.finite_rings + sage: a = F.gen() # needs sage.rings.finite_rings + sage: E = EllipticCurve([0,1,1,a,a]) # needs sage.rings.finite_rings + sage: E.cardinality() # needs sage.rings.finite_rings 762 - 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 + sage: P = E.gens()[0] # needs sage.rings.finite_rings + sage: Q = 400*P # needs sage.rings.finite_rings + sage: P.discrete_log(Q) # needs sage.rings.finite_rings 400 TESTS: @@ -3719,16 +3720,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()) # 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 + sage: E = EllipticCurve(j=GF((p,e),'a').random_element()) # needs sage.rings.finite_rings + sage: P = E.random_point() # needs sage.rings.finite_rings + sage: Q = randrange(2**999) * P # needs sage.rings.finite_rings + sage: x = P.discrete_log(Q) # needs sage.rings.finite_rings + sage: x*P == Q # needs sage.rings.finite_rings True Doctest deprecation:: - sage: P.discrete_log(Q, ord=P.order()) # optional - sage.rings.finite_rings + sage: P.discrete_log(Q, ord=P.order()) # needs sage.rings.finite_rings doctest:warning ... DeprecationWarning: The "ord" argument to .discrete_log() is obsolete. ... @@ -3786,11 +3787,11 @@ def padic_elliptic_logarithm(self,Q, p): sage: p=235322474717419 sage: b=8856682 - 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 + sage: E = EllipticCurve(GF(p), [0, b]) # needs sage.rings.finite_rings + sage: P = E(200673830421813, 57025307876612) # needs sage.rings.finite_rings + sage: Q = E(40345734829479, 211738132651297) # needs sage.rings.finite_rings + sage: x = P.padic_elliptic_logarithm(Q, p) # needs sage.rings.finite_rings sage.rings.padics + sage: x * P == Q # needs sage.rings.finite_rings sage.rings.padics True TESTS: @@ -3800,11 +3801,11 @@ def padic_elliptic_logarithm(self,Q, p): sage: a = 49850651047495986645822557378918223 sage: b = 21049438014429831351540675253466229 sage: p = 54283205379427155782089046839411711 - 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 + sage: E = EllipticCurve(GF(p), [a, b]) # needs sage.rings.finite_rings + sage: P = E.random_point() # needs sage.rings.finite_rings + sage: Q = randrange(0, p-1) * P # needs sage.rings.finite_rings + sage: x = P.padic_elliptic_logarithm(Q, p) # needs sage.rings.finite_rings sage.rings.padics + sage: x*P == Q # needs sage.rings.finite_rings sage.rings.padics True """ E = self.curve() @@ -3852,9 +3853,9 @@ def has_finite_order(self): EXAMPLES:: - 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 + sage: E = EllipticCurve(GF(7), [1,3]) # needs sage.rings.finite_rings + sage: P = E.points()[3] # needs sage.rings.finite_rings + sage: P.has_finite_order() # needs sage.rings.finite_rings True """ return True @@ -3871,68 +3872,68 @@ def order(self): EXAMPLES:: - sage: k. = GF((5,5)) # optional - sage.rings.finite_rings - sage: E = EllipticCurve(k,[2,4]); E # optional - sage.rings.finite_rings + sage: k. = GF((5,5)) # needs sage.rings.finite_rings + sage: E = EllipticCurve(k,[2,4]); E # needs 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) # optional - sage.rings.finite_rings - sage: P.order() # optional - sage.rings.finite_rings + sage: P = E(3*a^4 + 3*a, 2*a + 1) # needs sage.rings.finite_rings + sage: P.order() # needs sage.rings.finite_rings 3227 - sage: Q = E(0,2) # optional - sage.rings.finite_rings - sage: Q.order() # optional - sage.rings.finite_rings + sage: Q = E(0,2) # needs sage.rings.finite_rings + sage: Q.order() # needs sage.rings.finite_rings 7 - sage: Q.additive_order() # optional - sage.rings.finite_rings + sage: Q.additive_order() # needs sage.rings.finite_rings 7 :: 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 + sage: E = EllipticCurve(GF(p), [1,1]) # needs sage.rings.finite_rings + sage: P = E(831623307675610677632782670796608848711856078, # needs sage.rings.finite_rings ....: 42295786042873366706573292533588638217232964) - sage: P.order() # optional - sage.rings.finite_rings + sage: P.order() # needs sage.rings.finite_rings 1427247692705959881058262545272474300628281448 - sage: P.order() == E.cardinality() # optional - sage.rings.finite_rings + sage: P.order() == E.cardinality() # needs sage.rings.finite_rings True The next example has `j(E)=0`:: sage: p = 33554501 - 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 + sage: F. = GF((p,2)) # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [0,1]) # needs sage.rings.finite_rings + sage: E.j_invariant() # needs sage.rings.finite_rings 0 - sage: P = E.random_point() # optional - sage.rings.finite_rings - sage: P.order() # random # optional - sage.rings.finite_rings + sage: P = E.random_point() # needs sage.rings.finite_rings + sage: P.order() # random # needs sage.rings.finite_rings 16777251 Similarly when `j(E)=1728`:: sage: p = 33554473 - 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 + sage: F. = GF((p,2)) # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [1,0]) # needs sage.rings.finite_rings + sage: E.j_invariant() # needs sage.rings.finite_rings 1728 - sage: P = E.random_point() # optional - sage.rings.finite_rings - sage: P.order() # random # optional - sage.rings.finite_rings + sage: P = E.random_point() # needs sage.rings.finite_rings + sage: P.order() # random # needs sage.rings.finite_rings 46912611635760 TESTS: Check that the order actually gets cached (:trac:`32786`):: - 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 + sage: E = EllipticCurve(GF(31337), [42,1]) # needs sage.rings.finite_rings + sage: P = E.lift_x(1) # needs sage.rings.finite_rings + sage: hasattr(P, '_order') # needs sage.rings.finite_rings False - sage: P.order() # optional - sage.rings.finite_rings + sage: P.order() # needs sage.rings.finite_rings 15649 - sage: P._order # optional - sage.rings.finite_rings + sage: P._order # needs sage.rings.finite_rings 15649 The curve order should also get cached as a side effect of computing a point order:: - sage: E._order # optional - sage.rings.finite_rings + sage: E._order # needs 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 765485f0374..167b6ace2fa 100644 --- a/src/sage/schemes/elliptic_curves/ell_rational_field.py +++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py @@ -4160,22 +4160,22 @@ def reduction(self,p): EXAMPLES:: sage: E = EllipticCurve('389a1') - sage: E.reduction(2) # optional - sage.rings.finite_rings + sage: E.reduction(2) # needs 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) # optional - sage.rings.finite_rings + sage: E.reduction(3) # needs 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) # optional - sage.rings.finite_rings + sage: E.reduction(5) # needs 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) # optional - sage.rings.finite_rings + sage: E.reduction(38) # needs sage.rings.finite_rings Traceback (most recent call last): ... AttributeError: p must be prime. - sage: E.reduction(389) # optional - sage.rings.finite_rings + sage: E.reduction(389) # needs 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) # optional - sage.rings.finite_rings + sage: E.reduction(5) # needs sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 5 """ p = Integer(p) @@ -4513,7 +4513,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)) # optional - sage.rings.number_field + sage: E.has_rational_cm(QuadraticField(-3)) # needs sage.rings.number_field True sage: E = EllipticCurve(j=8000) @@ -4527,7 +4527,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)) # optional - sage.rings.number_field + sage: E.has_rational_cm(QuadraticField(-2)) # needs sage.rings.number_field True The field need not be a number field provided that it is an @@ -4541,7 +4541,7 @@ 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)) # optional - sage.rings.finite_rings + sage: E.has_rational_cm(GF(2)) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Error in has_rational_cm: Finite Field of size 2 @@ -5229,7 +5229,7 @@ def isogeny_graph(self, order=None): 6 Elliptic Curve defined by y^2 + x*y = x^3 - 8125*x - 282568 over Rational Field 7 Elliptic Curve defined by y^2 + x*y = x^3 - 7930*x - 296725 over Rational Field 8 Elliptic Curve defined by y^2 + x*y = x^3 - 130000*x - 18051943 over Rational Field - sage: G.plot(edge_labels=True) + sage: G.plot(edge_labels=True) # needs sage.plot Graphics object consisting of 23 graphics primitives """ return self.isogeny_class(order=order).graph() diff --git a/src/sage/schemes/elliptic_curves/ell_wp.py b/src/sage/schemes/elliptic_curves/ell_wp.py index 462899d33f2..a4103bec501 100644 --- a/src/sage/schemes/elliptic_curves/ell_wp.py +++ b/src/sage/schemes/elliptic_curves/ell_wp.py @@ -91,34 +91,34 @@ 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) # 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 + sage: k = GF(11) # needs sage.rings.finite_rings + sage: E = EllipticCurve(k, [1,1]) # needs sage.rings.finite_rings + sage: E.weierstrass_p(prec=6, algorithm='fast') # needs sage.rings.finite_rings z^-2 + 2*z^2 + 3*z^4 + O(z^6) - sage: E.weierstrass_p(prec=7, algorithm='fast') # optional - sage.rings.finite_rings + sage: E.weierstrass_p(prec=7, algorithm='fast') # needs 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) # optional - sage.rings.finite_rings + sage: E.weierstrass_p(prec=8) # needs 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') # optional - sage.rings.finite_rings + sage: E.weierstrass_p(prec=8, algorithm='quadratic') # needs 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') # optional - sage.rings.finite_rings + sage: E.weierstrass_p(prec=8, algorithm='pari') # needs sage.rings.finite_rings z^-2 + 2*z^2 + 3*z^4 + 5*z^6 + O(z^8) - sage: E.weierstrass_p(prec=9) # optional - sage.rings.finite_rings + sage: E.weierstrass_p(prec=9) # needs 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") # optional - sage.rings.finite_rings + sage: E.weierstrass_p(prec=9, algorithm="quadratic") # needs 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') # optional - sage.rings.finite_rings + sage: E.weierstrass_p(prec=9, algorithm='pari') # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: for computing the Weierstrass p-function via pari, the @@ -126,7 +126,7 @@ def weierstrass_p(E, prec=20, algorithm=None): TESTS:: - sage: E.weierstrass_p(prec=4, algorithm='foo') # optional - sage.rings.finite_rings + sage: E.weierstrass_p(prec=4, algorithm='foo') # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: unknown algorithm for computing the Weierstrass p-function @@ -224,13 +224,13 @@ 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]) # optional - sage.rings.finite_rings - sage: E.weierstrass_p(algorithm='quadratic') # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(103), [1,2]) # needs sage.rings.finite_rings + sage: E.weierstrass_p(algorithm='quadratic') # needs 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) # optional - sage.rings.finite_rings + sage: compute_wp_quadratic(E.base_ring(), E.a4(), E.a6(), prec=10) # needs 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 @@ -283,8 +283,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) # optional - sage.rings.finite_rings - sage: compute_wp_fast(k, k(1), k(8), 5) # optional - sage.rings.finite_rings + sage: k = GF(37) # needs sage.rings.finite_rings + sage: compute_wp_fast(k, k(1), k(8), 5) # needs sage.rings.finite_rings z^-2 + 22*z^2 + 20*z^4 + O(z^5) """ R = PowerSeriesRing(k,'z',default_prec=m+5) @@ -330,15 +330,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) # 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 + sage: k = GF(17) # needs sage.rings.finite_rings + sage: R. = PowerSeriesRing(k) # needs 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) # needs sage.rings.finite_rings + sage: f = solve_linear_differential_system(a, b, c, alpha) # needs sage.rings.finite_rings + sage: f # needs 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 # optional - sage.rings.finite_rings + sage: a*f.derivative() + b*f - c # needs sage.rings.finite_rings O(x^7) - sage: f(0) == alpha # optional - sage.rings.finite_rings + sage: f(0) == alpha # needs 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 63ce58c74c6..3fd0ee34071 100644 --- a/src/sage/schemes/elliptic_curves/formal_group.py +++ b/src/sage/schemes/elliptic_curves/formal_group.py @@ -488,26 +488,26 @@ 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]) # optional - sage.rings.finite_rings - sage: ehat = e.formal() # optional - sage.rings.finite_rings - sage: ehat.group_law(3) # optional - sage.rings.finite_rings + sage: e = EllipticCurve(GF(7), [3, 4]) # needs sage.rings.finite_rings + sage: ehat = e.formal() # needs sage.rings.finite_rings + sage: ehat.group_law(3) # needs sage.rings.finite_rings t1 + t2 + O(t1, t2)^3 - sage: F = ehat.group_law(7); F # optional - sage.rings.finite_rings + sage: F = ehat.group_law(7); F # needs 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)[[]] # optional - sage.rings.finite_rings - sage: F(x, ehat.inverse()(x)) # optional - sage.rings.finite_rings + sage: R. = GF(7)[[]] # needs sage.rings.finite_rings + sage: F(x, ehat.inverse()(x)) # needs sage.rings.finite_rings 0 + O(x, y, z)^7 - sage: F(x, y) == F(y, x) # optional - sage.rings.finite_rings + sage: F(x, y) == F(y, x) # needs sage.rings.finite_rings True - sage: F(x, F(y, z)) == F(F(x, y), z) # optional - sage.rings.finite_rings + sage: F(x, F(y, z)) == F(F(x, y), z) # needs sage.rings.finite_rings True Let's ensure caching with changed precision is working:: - sage: e.formal_group().group_law(4) # optional - sage.rings.finite_rings + sage: e.formal_group().group_law(4) # needs sage.rings.finite_rings t1 + t2 + O(t1, t2)^4 Test for :trac:`9646`:: @@ -625,12 +625,12 @@ def mult_by_n(self, n, prec=10): TESTS:: - 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 + sage: F = EllipticCurve(GF(17), [1, 1]).formal_group() # needs sage.rings.finite_rings + sage: F.mult_by_n(10, 50) # long time # needs 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() # optional - sage.rings.finite_rings - sage: F.mult_by_n(100, 20) # optional - sage.rings.finite_rings + sage: F = EllipticCurve(GF(101), [1, 1]).formal_group() # needs sage.rings.finite_rings + sage: F.mult_by_n(100, 20) # needs sage.rings.finite_rings 100*t + O(t^20) sage: P. = PolynomialRing(ZZ, 5) diff --git a/src/sage/schemes/elliptic_curves/heegner.py b/src/sage/schemes/elliptic_curves/heegner.py index 75a356289f2..793c1652e53 100644 --- a/src/sage/schemes/elliptic_curves/heegner.py +++ b/src/sage/schemes/elliptic_curves/heegner.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.number_field +# sage.doctest: needs sage.rings.number_field r""" Heegner points on elliptic curves over the rational numbers @@ -2654,9 +2654,9 @@ def plot(self, *args, **kwds): EXAMPLES:: - sage: heegner_points(389,-7,5).plot(pointsize=50, rgbcolor='red') # optional - sage.plot + sage: heegner_points(389,-7,5).plot(pointsize=50, rgbcolor='red') # needs sage.plot Graphics object consisting of 12 graphics primitives - sage: heegner_points(53,-7,15).plot(pointsize=50, rgbcolor='purple') # optional - sage.plot + sage: heegner_points(53,-7,15).plot(pointsize=50, rgbcolor='purple') # needs sage.plot Graphics object consisting of 48 graphics primitives """ return sum(z.plot(*args, **kwds) for z in self) @@ -4285,7 +4285,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() # optional - sage.plot + sage: P.plot(prec=30, pointsize=50, rgbcolor='red') + E.plot() # needs sage.plot Graphics object consisting of 3 graphics primitives """ if self.conductor() != 1: diff --git a/src/sage/schemes/elliptic_curves/height.py b/src/sage/schemes/elliptic_curves/height.py index 506dc229f1d..de669ce4142 100644 --- a/src/sage/schemes/elliptic_curves/height.py +++ b/src/sage/schemes/elliptic_curves/height.py @@ -85,7 +85,7 @@ def __init__(self, endpoints): sage: from sage.schemes.elliptic_curves.height import UnionOfIntervals sage: UnionOfIntervals([0, 1]) ([0, 1]) - sage: UnionOfIntervals([-infinity, pi, 17, infinity]) # optional - sage.symbolic + sage: UnionOfIntervals([-infinity, pi, 17, infinity]) # needs sage.symbolic ([-Infinity, pi] U [17, +Infinity]) sage: UnionOfIntervals([]) () @@ -128,7 +128,7 @@ def intervals(self): sage: from sage.schemes.elliptic_curves.height import UnionOfIntervals sage: UnionOfIntervals(list(range(10))).intervals() [(0, 1), (2, 3), (4, 5), (6, 7), (8, 9)] - sage: UnionOfIntervals([-infinity, pi, 17, infinity]).intervals() + sage: UnionOfIntervals([-infinity, pi, 17, infinity]).intervals() # needs sage.symbolic [(-Infinity, pi), (17, +Infinity)] """ return list(zip(self._endpoints[::2], self._endpoints[1::2])) @@ -165,7 +165,7 @@ def __add__(left, right): ([0, 1/2] U [2, +Infinity]) sage: A + 1 ([1, 3/2] U [3, +Infinity]) - sage: pi + A + sage: pi + A # needs sage.symbolic ([pi, pi + 1/2] U [pi + 2, +Infinity]) sage: A + UnionOfIntervals([-infinity, -1]) ([-Infinity, -1] U [0, 1/2] U [2, +Infinity]) @@ -209,7 +209,7 @@ def __rmul__(self, other): sage: from sage.schemes.elliptic_curves.height import UnionOfIntervals sage: A = UnionOfIntervals([0, 1/2, 2, infinity]); A ([0, 1/2] U [2, +Infinity]) - sage: pi * A + sage: pi * A # needs sage.symbolic ([0, 1/2*pi] U [2*pi, +Infinity]) """ return self * other @@ -786,9 +786,9 @@ def __init__(self, E): An example over a number field:: - 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0,i,0,i,i]) # needs sage.rings.number_field + sage: EllipticCurveCanonicalHeight(E) # needs 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 @@ -798,8 +798,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]) # optional - sage.rings.finite_rings - sage: EllipticCurveCanonicalHeight(E) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,0,0,0,1]) # needs sage.rings.finite_rings + sage: EllipticCurveCanonicalHeight(E) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: EllipticCurveCanonicalHeight class can only be created @@ -884,12 +884,12 @@ def __call__(self, P): Over a number field other than `\QQ`:: - 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,0,1,-27]) # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field + sage: H.base_field() # needs sage.rings.number_field Number Field in i with defining polynomial x^2 + 1 with i = 1*I - sage: H((1, 5*i)) # optional - sage.rings.number_field + sage: H((1, 5*i)) # needs sage.rings.number_field 1.22257115164148 """ return self.E(P).height() @@ -913,16 +913,16 @@ def alpha(self, v, tol=0.01): Example 1 from [CPS2006]_:: - 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, 1 + 5*i, 3 + i]) # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field + sage: alpha = H.alpha(K.places()[0]) # needs sage.rings.number_field + sage: alpha # needs sage.rings.number_field 1.12272013439355 Compare with `\log(\epsilon_v)=0.344562...` in [CPS2006]_:: - sage: 3*alpha.log() # optional - sage.rings.number_field + sage: 3*alpha.log() # needs sage.rings.number_field 0.347263296676126 """ from sage.rings.polynomial.polynomial_ring import polygen @@ -984,29 +984,29 @@ def e_p(self, p): EXAMPLES:: - 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, 1 + 5*i, 3 + i]) # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field + sage: H.e_p(K.prime_above(2)) # needs sage.rings.number_field 2 - sage: H.e_p(K.prime_above(3)) # optional - sage.rings.number_field + sage: H.e_p(K.prime_above(3)) # needs sage.rings.number_field 10 - sage: H.e_p(K.prime_above(5)) # optional - sage.rings.number_field + sage: H.e_p(K.prime_above(5)) # needs sage.rings.number_field 9 - sage: E.conductor().norm().factor() # optional - sage.rings.number_field + sage: E.conductor().norm().factor() # needs sage.rings.number_field 2^10 * 20921 - sage: p1, p2 = K.primes_above(20921) # optional - sage.rings.number_field - sage: E.local_data(p1) # optional - sage.rings.number_field + sage: p1, p2 = K.primes_above(20921) # needs sage.rings.number_field + sage: E.local_data(p1) # needs sage.rings.number_field Local data at Fractional ideal (-40*i + 139): Reduction type: bad split multiplicative ... - sage: H.e_p(p1) # optional - sage.rings.number_field + sage: H.e_p(p1) # needs sage.rings.number_field 20920 - sage: E.local_data(p2) # optional - sage.rings.number_field + sage: E.local_data(p2) # needs sage.rings.number_field Local data at Fractional ideal (40*i + 139): Reduction type: good ... - sage: H.e_p(p2) # optional - sage.rings.number_field + sage: H.e_p(p2) # needs sage.rings.number_field 20815 """ kp = self.K.residue_field(p) @@ -1036,10 +1036,10 @@ def DE(self, n): EXAMPLES:: - 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, 1+5*i, 3+i]) # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field + sage: [H.DE(n) for n in srange(1,6)] # needs sage.rings.number_field [0, 2*log(5) + 2*log(2), 0, 2*log(13) + 2*log(5) + 4*log(2), 0] """ s = 0 @@ -1064,10 +1064,10 @@ def ME(self): EXAMPLES:: - 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, 1+5*i, 3+i]) # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field + sage: H.ME() # needs sage.rings.number_field 1 sage: E = EllipticCurve([0,0,0,0,1]) sage: E.height_function().ME() @@ -1103,13 +1103,13 @@ def B(self, n, mu): Example 10.2 from [Tho2010]_:: - 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: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0, 1-i, i, -i, 0]) # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field In [Tho2010]_ the value is given as 0.772:: - sage: RealField(12)( H.B(5, 0.01) ) # optional - sage.rings.number_field + sage: RealField(12)( H.B(5, 0.01) ) # needs sage.rings.number_field 0.777 """ K = self.K @@ -1163,20 +1163,20 @@ def psi(self, xi, v): An example over a number field:: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([0,0,0,0,a]) # needs sage.rings.number_field + sage: P = E.lift_x(1/3*a^2 + a + 5/3) # needs sage.rings.number_field + sage: v = K.real_places()[0] # needs sage.rings.number_field + sage: L = E.period_lattice(v) # needs sage.rings.number_field + sage: L(P) # needs sage.rings.number_field 3.51086196882538 - sage: L(P) / L.real_period() # optional - sage.rings.number_field + sage: L(P) / L.real_period() # needs sage.rings.number_field 0.867385122699931 - 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 + sage: xP = v(P.xy()[0]) # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field + sage: H.psi(xP, v) # needs sage.rings.number_field 0.867385122699931 - sage: H.psi(1.23, v) # optional - sage.rings.number_field + sage: H.psi(1.23, v) # needs sage.rings.number_field 0.785854718241495 """ if xi > 1e9: @@ -1219,11 +1219,11 @@ def S(self, xi1, xi2, v): An example over a number field:: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([0,0,0,0,a]) # needs sage.rings.number_field + sage: v = K.real_places()[0] # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field + sage: H.S(9, 10, v) # needs sage.rings.number_field ([0.078119444725347..., 0.082342373201640...] U [0.91765762679836..., 0.92188055527465...]) """ L = self.E.period_lattice(v) @@ -1271,14 +1271,14 @@ def Sn(self, xi1, xi2, n, v): An example over a number field:: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([0,0,0,0,a]) # needs sage.rings.number_field + sage: v = K.real_places()[0] # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field + sage: H.S(2, 3, v), H.Sn(2, 3, 1, v) # needs 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) # optional - sage.rings.number_field + sage: H.Sn(2, 3, 6, v) # needs 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) @@ -1325,19 +1325,19 @@ def real_intersection_is_empty(self, Bk, v): An example over a number field:: sage: x = polygen(ZZ, 'x') - 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: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([0,0,0,0,a]) # needs sage.rings.number_field + sage: v = K.real_places()[0] # needs sage.rings.number_field + sage: H = E.height_function() # needs 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) # optional - sage.rings.number_field + sage: H.real_intersection_is_empty([H.B(n,0.07) for n in srange(1,5)], v) # long time, needs sage.rings.number_field True - sage: H.real_intersection_is_empty([H.B(n,0.08) for n in srange(1,5)], v) # optional - sage.rings.number_field + sage: H.real_intersection_is_empty([H.B(n,0.08) for n in srange(1,5)], v) # needs sage.rings.number_field False """ return UnionOfIntervals.intersection([self.Sn(-B, B, k+1, v) for k,B in enumerate(Bk)]).is_empty() @@ -1396,10 +1396,10 @@ def wp_c(self, v): sage: H.wp_c(QQ.places()[0]) 2.68744508779950 - 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, 1 + 5*i, 3 + i]) # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field + sage: H.wp_c(K.places()[0]) # needs sage.rings.number_field 2.66213425640096 """ # Note that we normalise w1, w2 differently from [Tho2010]_! @@ -1676,10 +1676,10 @@ def complex_intersection_is_empty(self, Bk, v, verbose=False, use_half=True): EXAMPLES:: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([0,0,0,0,a]) # needs sage.rings.number_field + sage: v = K.complex_embeddings()[0] # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field The following two lines prove that the heights of non-torsion points on `E` with everywhere good reduction have canonical @@ -1687,18 +1687,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) # optional - sage.rings.number_field + sage: H.complex_intersection_is_empty([H.B(n,0.02) for n in [1,2,3]], v) # long time, needs sage.rings.number_field False - sage: H.complex_intersection_is_empty([H.B(n,0.02) for n in [1,2,3,4]], v) # optional - sage.rings.number_field + sage: H.complex_intersection_is_empty([H.B(n,0.02) for n in [1,2,3,4]], v) # needs 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) # optional - sage.rings.number_field + sage: H.complex_intersection_is_empty([H.B(n,0.03) for n in [1,2,3,4]], v) # long time, needs 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) # optional - sage.rings.number_field + sage: H.complex_intersection_is_empty([H.B(n,0.03) for n in [1..6]], v) # needs sage.rings.number_field True """ from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion @@ -1795,28 +1795,28 @@ def test_mu(self, mu, N, verbose=True): EXAMPLES:: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([0,0,0,0,a]) # needs sage.rings.number_field + sage: H = E.height_function() # needs 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 # optional - sage.rings.number_field + sage: P = E.gens(lim3=5)[0]; P # needs sage.rings.number_field (1/3*a^2 + a + 5/3 : -2*a^2 - 4/3*a - 5/3 : 1) - sage: P.height() # optional - sage.rings.number_field + sage: P.height() # needs sage.rings.number_field 1.68038085233673 - sage: P.has_good_reduction() # optional - sage.rings.number_field + sage: P.has_good_reduction() # needs 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) # optional - sage.rings.number_field + sage: H.test_mu(0.1, 5) # needs sage.rings.number_field B_1(0.100000000000000) = 1.51580969677387 B_2(0.100000000000000) = 0.932072561526720 True - sage: H.test_mu(0.2, 5) # optional - sage.rings.number_field + sage: H.test_mu(0.2, 5) # needs sage.rings.number_field B_1(0.200000000000000) = 2.04612906979932 B_2(0.200000000000000) = 3.09458988474327 B_3(0.200000000000000) = 27.6251108409484 @@ -1828,11 +1828,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() # optional - sage.rings.number_field + sage: (P.height()/0.1).sqrt() # needs sage.rings.number_field 4.09924487233530 - sage: P.division_points(2) # optional - sage.rings.number_field + sage: P.division_points(2) # needs sage.rings.number_field [] - sage: P.division_points(3) # optional - sage.rings.number_field + sage: P.division_points(3) # needs sage.rings.number_field [] """ # Compute the list of values `B_n(\mu)` for n in 1..N. If any @@ -1903,46 +1903,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) # 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, 91 - 26*i, -144 - 323*i]) # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field + sage: H.min_gr(0.1, 4) # long time # needs sage.rings.number_field 0.1621049443313762 Example 10.2 from [Tho2010]_:: - 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0, 1 - i, i, -i, 0]) # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field + sage: H.min_gr(0.01, 5) # long time # needs 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)) # optional - sage.rings.number_field - sage: P.has_good_reduction() # optional - sage.rings.number_field + sage: P = E((0,0)) # needs sage.rings.number_field + sage: P.has_good_reduction() # needs sage.rings.number_field True - sage: P.height() # optional - sage.rings.number_field + sage: P.height() # needs 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) # 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, -3*a - a^2, a^2]) # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field + sage: H.min_gr(0.1, 5) # long time # needs 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) # 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 + sage: K. = NumberField(x^2 - x - 1) # needs sage.rings.number_field + sage: E = EllipticCurve([phi + 1, -phi + 1, 1, 20*phi - 39, 196*phi + 237]) # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field + sage: H.min_gr(.1, 5, verbose=True) # long time # needs sage.rings.number_field B_1(1) = 1540.199246369678 ... halving mu to 0.25 and increasing n_max to 6 @@ -2024,34 +2024,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) # 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, 91 - 26*i, -144 - 323*i]) # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field + sage: H.min(0.1, 4) # long time # needs sage.rings.number_field 0.1621049443313762 Example 10.2 from [Tho2010]_:: - 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0, 1 - i, i, -i, 0]) # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field + sage: H.min(0.01, 5) # long time # needs 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)) # optional - sage.rings.number_field - sage: P.height() # optional - sage.rings.number_field + sage: P = E((0,0)) # needs sage.rings.number_field + sage: P.height() # needs 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) # 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, -3*a - a^2, a^2]) # needs sage.rings.number_field + sage: H = E.height_function() # needs sage.rings.number_field + sage: H.min(0.1, 5) # long time # needs sage.rings.number_field 0.0625 More examples over `\QQ`:: @@ -2065,8 +2065,8 @@ def min(self, tol, n_max, verbose=False): After base change the lower bound can decrease:: - 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 + sage: K. = QuadraticField(-5) # needs sage.rings.number_field + sage: E.change_ring(K).height_function().min(0.5, 10) # long time, needs 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 832fdd036dc..e6d3a0e5a79 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() # optional - sage.rings.finite_rings + sage: GF(p^2).inject_variables() # needs sage.rings.finite_rings Defining z2 - 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 + sage: E = EllipticCurve(GF(p^2), [1,0]) # needs sage.rings.finite_rings + sage: P = E.lift_x(31415926535897932384626433832795028841971 - z2) # needs sage.rings.finite_rings + sage: P.order().factor() # needs sage.rings.finite_rings 2^143 - sage: EllipticCurveHom_composite(E, P) # optional - sage.rings.finite_rings + sage: EllipticCurveHom_composite(E, P) # needs 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]) # optional - sage.rings.finite_rings - sage: P = E.lift_x(33); P.order() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(419), [0,1]) # needs sage.rings.finite_rings + sage: P = E.lift_x(33); P.order() # needs sage.rings.finite_rings 35 - sage: psi = EllipticCurveHom_composite(E, P); psi # optional - sage.rings.finite_rings + sage: psi = EllipticCurveHom_composite(E, P); psi # needs 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)) # optional - sage.rings.finite_rings + sage: psi(E.lift_x(11)) # needs sage.rings.finite_rings (352 : 346 : 1) - sage: psi.rational_maps() # optional - sage.rings.finite_rings + sage: psi.rational_maps() # needs 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() # optional - sage.rings.finite_rings + sage: psi.kernel_polynomial() # needs 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() # optional - sage.rings.finite_rings + sage: psi.dual() # needs 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() # optional - sage.rings.finite_rings + sage: psi.formal() # needs 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) # optional - sage.rings.finite_rings + sage: psi == EllipticCurveIsogeny(E, P) # needs sage.rings.finite_rings True We can easily obtain the individual factors of the composite map:: - sage: psi.factors() # optional - sage.rings.finite_rings + sage: psi.factors() # needs 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, @@ -101,16 +101,16 @@ def _eval_factored_isogeny(phis, P): EXAMPLES:: sage: from sage.schemes.elliptic_curves import hom_composite - 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 + sage: E = EllipticCurve(GF(419), [1,0]) # needs sage.rings.finite_rings + sage: Q = E(21, 8) # needs sage.rings.finite_rings + sage: phis = [] # needs sage.rings.finite_rings + sage: while len(phis) < 10: # needs 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 # optional - sage.rings.finite_rings + sage: R = hom_composite._eval_factored_isogeny(phis, Q); R # needs sage.rings.finite_rings (290 : 183 : 1) - sage: R in E # optional - sage.rings.finite_rings + sage: R in E # needs sage.rings.finite_rings True """ for phi in phis: @@ -165,31 +165,31 @@ def _compute_factored_isogeny_prime_power(P, l, n, split=.8): EXAMPLES:: sage: from sage.schemes.elliptic_curves import hom_composite - sage: E = EllipticCurve(GF(8191), [1,0]) # optional - sage.rings.finite_rings - sage: P = E.random_point() # optional - sage.rings.finite_rings - sage: (l,n), = P.order().factor() # optional - sage.rings.finite_rings - sage: phis = hom_composite._compute_factored_isogeny_prime_power(P, l, n) # optional - sage.rings.finite_rings - sage: hom_composite._eval_factored_isogeny(phis, P) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(8191), [1,0]) # needs sage.rings.finite_rings + sage: P = E.random_point() # needs sage.rings.finite_rings + sage: (l,n), = P.order().factor() # needs sage.rings.finite_rings + sage: phis = hom_composite._compute_factored_isogeny_prime_power(P, l, n) # needs sage.rings.finite_rings + sage: hom_composite._eval_factored_isogeny(phis, P) # needs sage.rings.finite_rings (0 : 1 : 0) - sage: [phi.degree() for phi in phis] == [l]*n # optional - sage.rings.finite_rings + sage: [phi.degree() for phi in phis] == [l]*n # needs sage.rings.finite_rings True All choices of ``split`` produce the same result, albeit not equally fast:: - sage: E = EllipticCurve(GF(2^127 - 1), [1,0]) # optional - sage.rings.finite_rings - sage: P, = E.gens() # optional - sage.rings.finite_rings - sage: (l,n), = P.order().factor() # optional - sage.rings.finite_rings - sage: phis = hom_composite._compute_factored_isogeny_prime_power(P,l,n) # optional - sage.rings.finite_rings - sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=0) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(2^127 - 1), [1,0]) # needs sage.rings.finite_rings + sage: P, = E.gens() # needs sage.rings.finite_rings + sage: (l,n), = P.order().factor() # needs sage.rings.finite_rings + sage: phis = hom_composite._compute_factored_isogeny_prime_power(P,l,n) # needs sage.rings.finite_rings + sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=0) # needs sage.rings.finite_rings True - sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=0.1) # optional - sage.rings.finite_rings + sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=0.1) # needs sage.rings.finite_rings True - sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=0.5) # optional - sage.rings.finite_rings + sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=0.5) # needs sage.rings.finite_rings True - sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=0.9) # optional - sage.rings.finite_rings + sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=0.9) # needs sage.rings.finite_rings True - sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=1) # optional - sage.rings.finite_rings + sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=1) # needs sage.rings.finite_rings True """ def rec(Q, k): @@ -223,12 +223,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]) # 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 + sage: E = EllipticCurve(GF(419), [1,0]) # needs sage.rings.finite_rings + sage: P = E(42, 321) # needs sage.rings.finite_rings + sage: phis = hom_composite._compute_factored_isogeny_single_generator(P) # needs sage.rings.finite_rings + sage: list(sorted(phi.degree() for phi in phis)) # needs sage.rings.finite_rings [2, 2, 3, 5, 7] - sage: hom_composite._eval_factored_isogeny(phis, P) # optional - sage.rings.finite_rings + sage: hom_composite._eval_factored_isogeny(phis, P) # needs sage.rings.finite_rings (0 : 1 : 0) """ phis = [] @@ -250,12 +250,12 @@ def _compute_factored_isogeny(kernel): EXAMPLES:: sage: from sage.schemes.elliptic_curves import hom_composite - 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 + sage: E = EllipticCurve(GF(419), [-1,0]) # needs sage.rings.finite_rings + sage: Ps = [E(41,99), E(41,-99), E(51,14), E(21,21), E(33,17)] # needs sage.rings.finite_rings + sage: phis = hom_composite._compute_factored_isogeny(Ps) # needs sage.rings.finite_rings + sage: [phi.degree() for phi in phis] # needs sage.rings.finite_rings [2, 3, 5, 7, 2] - sage: {hom_composite._eval_factored_isogeny(phis, P) for P in Ps} # optional - sage.rings.finite_rings + sage: {hom_composite._eval_factored_isogeny(phis, P) for P in Ps} # needs sage.rings.finite_rings {(0 : 1 : 0)} """ phis = [] @@ -285,8 +285,8 @@ 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]) # optional - sage.rings.finite_rings - sage: EllipticCurveHom_composite(E, E.lift_x(23)) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(419), [1,0]) # needs sage.rings.finite_rings + sage: EllipticCurveHom_composite(E, E.lift_x(23)) # needs 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 @@ -296,13 +296,13 @@ def __init__(self, E, kernel, codomain=None, model=None): The given kernel generators need not be independent:: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^2 - x - 5) # needs sage.rings.number_field + sage: E = EllipticCurve('210.b6').change_ring(K) # needs sage.rings.number_field + sage: E.torsion_subgroup() # needs 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()) # optional - sage.rings.number_field + sage: EllipticCurveHom_composite(E, E.torsion_points()) # needs 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 @@ -312,27 +312,27 @@ def __init__(self, E, kernel, codomain=None, model=None): TESTS:: - 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 + sage: E = EllipticCurve(GF(19), [1,0]) # needs sage.rings.finite_rings + sage: P = E.random_point() # needs sage.rings.finite_rings + sage: psi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings + sage: psi # random # needs 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) # optional - sage.rings.finite_rings + sage: EllipticCurveHom_composite(E, E.lift_x(3), codomain=E) # needs 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]) # 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 + sage: E = EllipticCurve(GF((2^127-1)^2), [1,0]) # needs sage.rings.finite_rings + sage: K = 2^30 * E.random_point() # needs sage.rings.finite_rings + sage: psi = EllipticCurveHom_composite(E, K, model='montgomery') # needs sage.rings.finite_rings + sage: psi.codomain().a_invariants() # needs sage.rings.finite_rings (0, ..., 0, 1, 0) """ if not isinstance(E, EllipticCurve_generic): @@ -416,11 +416,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]) # 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 + sage: E = EllipticCurve(GF(43), [1,0]) # needs sage.rings.finite_rings + sage: P, = E.gens() # needs sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings + sage: psi = EllipticCurveHom_composite.from_factors(phi.factors()) # needs sage.rings.finite_rings + sage: psi == phi # needs sage.rings.finite_rings True TESTS:: @@ -431,10 +431,10 @@ def from_factors(cls, maps, E=None, strict=True): :: - 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 + sage: E = EllipticCurve(GF(419), [1,0]) # needs sage.rings.finite_rings + sage: P, = E.gens() # needs sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings + sage: EllipticCurveHom_composite.from_factors(phi.factors()) == phi # needs sage.rings.finite_rings True """ maps = tuple(maps) @@ -469,21 +469,21 @@ def _call_(self, P): sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^2 - x - 5) # needs sage.rings.number_field + sage: E = EllipticCurve('210.b6').change_ring(K) # needs sage.rings.number_field + sage: psi = EllipticCurveHom_composite(E, E.torsion_points()) # needs sage.rings.number_field + sage: R = E.lift_x(15/4 * (a+3)) # needs sage.rings.number_field + sage: psi(R) # indirect doctest # needs sage.rings.number_field (1033648757/303450 : -58397496786187/1083316500*a + 54706287407197/2166633000 : 1) Check that copying the order over works:: - 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 + sage: E = EllipticCurve(GF(431), [1,0]) # needs sage.rings.finite_rings + sage: P, = E.gens() # needs sage.rings.finite_rings + sage: Q = 2^99*P; Q.order() # needs sage.rings.finite_rings 27 - sage: phi = E.isogeny(3^99*P, algorithm='factored') # optional - sage.rings.finite_rings - sage: phi(Q)._order # optional - sage.rings.finite_rings + sage: phi = E.isogeny(3^99*P, algorithm='factored') # needs sage.rings.finite_rings + sage: phi(Q)._order # needs sage.rings.finite_rings 27 """ return _eval_factored_isogeny(self._phis, P) @@ -505,8 +505,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) # optional - sage.rings.finite_rings - sage: {psi._eval(P).curve() for P in Ps} # optional - sage.rings.finite_rings + sage: Ps = E.change_ring(GF(419**2))(0).division_points(5) # needs sage.rings.finite_rings + sage: {psi._eval(P).curve() for P in Ps} # needs 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): @@ -526,14 +526,14 @@ def _repr_(self): TESTS:: sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - 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 + sage: E = EllipticCurve(GF(43), [1,0]) # needs sage.rings.finite_rings + sage: P, = E.gens() # needs sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings + sage: phi # indirect doctest # needs 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 # optional - sage.rings.finite_rings + sage: phi * phi * phi * phi * phi * phi * phi # indirect doctest # needs 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 @@ -557,10 +557,10 @@ def factors(self): EXAMPLES:: sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - 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 + sage: E = EllipticCurve(GF(43), [1,0]) # needs sage.rings.finite_rings + sage: P, = E.gens() # needs sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings + sage: phi.factors() # needs 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, @@ -585,32 +585,32 @@ 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]) # 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: E = EllipticCurve([i + 1, i, 0, -4, -6*i]) # needs sage.rings.number_field + sage: P,Q = E.lift_x(i - 5), E.lift_x(-4*i) # needs sage.rings.number_field + sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.number_field + sage: psi = phi.codomain().isogeny(phi(Q)) # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - 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 + sage: iso1 = WeierstrassIsomorphism(E, (-1, 0, -i - 1, 0)) # needs sage.rings.number_field + sage: iso2 = psi.codomain().isomorphism_to(E) # needs sage.rings.number_field + sage: psi * phi # indirect doctest # needs 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 # optional - sage.rings.number_field + sage: iso2 * EllipticCurveHom_composite.from_factors([phi, psi]) # indirect doctest # needs 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 # optional - sage.rings.number_field + sage: phi * iso1 # indirect doctest # needs 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 # optional - sage.rings.number_field + sage: iso2 * psi * phi * iso1 # indirect doctest # needs 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 @@ -648,25 +648,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]) # 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 + sage: E = EllipticCurve(QuadraticField(-3), [0,16]) # needs sage.rings.number_field + sage: P,Q = E.lift_x(0), E.lift_x(-4) # needs sage.rings.number_field + sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.number_field + sage: psi = phi.codomain().isogeny(phi(Q)) # needs sage.rings.number_field + sage: psi = psi.codomain().isomorphism_to(E) * psi # needs sage.rings.number_field + sage: comp = psi * phi # needs sage.rings.number_field + sage: mu = E.scalar_multiplication(phi.degree()) # needs sage.rings.number_field + sage: sum(a*comp == mu for a in E.automorphisms()) # needs sage.rings.number_field 1 :: - 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 + sage: E = EllipticCurve(GF(431**2), [1,0]) # needs sage.rings.finite_rings + sage: P,Q = E.gens() # needs sage.rings.finite_rings + sage: phi1 = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings + sage: phi2 = EllipticCurveHom_composite(phi1.codomain(), phi1(Q)) # needs sage.rings.finite_rings + sage: psi1 = EllipticCurveHom_composite(E, Q) # needs sage.rings.finite_rings + sage: psi2 = EllipticCurveHom_composite(psi1.codomain(), psi1(P)) # needs sage.rings.finite_rings + sage: phi2 * phi1 == psi2 * psi1 # needs sage.rings.finite_rings True """ if op != op_EQ: @@ -684,10 +684,10 @@ 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]) # 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 + sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: P = E.lift_x(7321) # needs sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings + sage: phi.rational_maps() # needs 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), @@ -700,17 +700,17 @@ def rational_maps(self): TESTS:: - 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 + sage: f = phi.codomain().defining_polynomial() # needs sage.rings.finite_rings + sage: g = E.defining_polynomial().subs({2:1}) # needs sage.rings.finite_rings + sage: f(*phi.rational_maps(), 1) % g # needs sage.rings.finite_rings 0 :: - sage: phi.rational_maps()[0].parent() # optional - sage.rings.finite_rings + sage: phi.rational_maps()[0].parent() # needs 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() # optional - sage.rings.finite_rings + sage: phi.rational_maps()[1].parent() # needs sage.rings.finite_rings Fraction Field of Multivariate Polynomial Ring in x, y over Finite Field of size 65537 """ @@ -727,15 +727,15 @@ 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]) # 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 + sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: P = E.lift_x(7321) # needs sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings + sage: phi.x_rational_map() == phi.rational_maps()[0] # needs sage.rings.finite_rings True TESTS:: - sage: phi.x_rational_map().parent() # optional - sage.rings.finite_rings + sage: phi.x_rational_map().parent() # needs sage.rings.finite_rings Fraction Field of Univariate Polynomial Ring in x over Finite Field of size 65537 """ @@ -751,15 +751,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]) # 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 + sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: P = E.lift_x(7321) # needs sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P); phi # needs 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() # optional - sage.rings.finite_rings + sage: phi.kernel_polynomial() # needs sage.rings.finite_rings x^4 + 46500*x^3 + 19556*x^2 + 7643*x + 15952 """ # shouldn't there be a better algorithm for this? @@ -773,23 +773,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]) # 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 + sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: P = E.lift_x(7321) # needs sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P); phi # needs 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 # optional - sage.rings.finite_rings + sage: psi = phi.dual(); psi # needs 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()) # optional - sage.rings.finite_rings + sage: psi * phi == phi.domain().scalar_multiplication(phi.degree()) # needs sage.rings.finite_rings True - sage: phi * psi == psi.domain().scalar_multiplication(psi.degree()) # optional - sage.rings.finite_rings + sage: phi * psi == psi.domain().scalar_multiplication(psi.degree()) # needs sage.rings.finite_rings True """ phis = (phi.dual() for phi in self._phis[::-1]) @@ -805,15 +805,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]) # 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 + sage: E = EllipticCurve(GF(7^2), [3,2]) # needs sage.rings.finite_rings + sage: P = E.lift_x(1) # needs sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P); phi # needs 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() # optional - sage.rings.finite_rings + sage: phi.is_separable() # needs sage.rings.finite_rings True """ return all(phi.is_separable() for phi in self._phis) @@ -827,15 +827,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]) # 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 + sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: P = E.lift_x(7321) # needs sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings + sage: phi.formal() # needs 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) # optional - sage.rings.finite_rings + sage: (phi.dual() * phi).formal(prec=5) # needs 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) """ @@ -859,16 +859,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]) # 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 + sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: P = E.lift_x(7321) # needs sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings + sage: phi = WeierstrassIsomorphism(phi.codomain(), [7,8,9,10]) * phi # needs sage.rings.finite_rings + sage: phi.formal() # needs 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() # optional - sage.rings.finite_rings + sage: phi.scaling_factor() # needs sage.rings.finite_rings 7 ALGORITHM: The scaling factor is multiplicative under @@ -891,15 +891,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)) # 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 + sage: E = EllipticCurve_from_j(GF(3).algebraic_closure()(0)) # needs sage.rings.finite_rings + sage: nu = EllipticCurveHom_composite.from_factors(E.automorphisms()) # needs sage.rings.finite_rings + sage: nu # needs 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() # optional - sage.rings.finite_rings + sage: nu.is_injective() # needs sage.rings.finite_rings True """ return all(phi.is_injective() for phi in self._phis) diff --git a/src/sage/schemes/elliptic_curves/hom_frobenius.py b/src/sage/schemes/elliptic_curves/hom_frobenius.py index b5f2b51d470..fb4496aedbb 100644 --- a/src/sage/schemes/elliptic_curves/hom_frobenius.py +++ b/src/sage/schemes/elliptic_curves/hom_frobenius.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.finite_rings +# sage.doctest: needs sage.rings.finite_rings r""" Frobenius isogenies of elliptic curves diff --git a/src/sage/schemes/elliptic_curves/isogeny_class.py b/src/sage/schemes/elliptic_curves/isogeny_class.py index 1588ecbe814..84404c28b76 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_class.py +++ b/src/sage/schemes/elliptic_curves/isogeny_class.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.number_field +# sage.doctest: needs sage.rings.number_field r""" Isogeny class of elliptic curves over number fields diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py index ceda9840aa2..86ccab0f2d2 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py @@ -751,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 # optional - sage.rings.number_field + sage: E = EllipticCurve(QQbar, [9,8]); E # needs sage.rings.number_field Elliptic Curve defined by y^2 = x^3 + 9*x + 8 over Algebraic Field - sage: isogenies_2(E) # not implemented # optional - sage.rings.number_field + sage: isogenies_2(E) # not implemented # needs sage.rings.number_field """ f2 = E.division_polynomial(2) x2 = sorted(f2.roots(multiplicities=False)) @@ -787,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]) # optional - sage.rings.finite_rings - sage: [phi.codomain().ainvs() for phi in isogenies_3(E)] # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(17), [1,1]) # needs sage.rings.finite_rings + sage: [phi.codomain().ainvs() for phi in isogenies_3(E)] # needs sage.rings.finite_rings [(0, 0, 0, 9, 7), (0, 0, 0, 0, 1)] - 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 + sage: E = EllipticCurve(GF(17^2,'a'), [1,1]) # needs sage.rings.finite_rings + sage: [phi.codomain().ainvs() for phi in isogenies_3(E)] # needs 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') @@ -850,8 +850,8 @@ def isogenies_5_0(E, minimal_models=True): 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 + sage: E = EllipticCurve(GF(13^2,'a'), [0,-3]) # needs sage.rings.finite_rings + sage: isogenies_5_0(E) # needs 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) @@ -878,9 +878,9 @@ def isogenies_5_0(E, minimal_models=True): over Finite Field in a of size 13^2] sage: x = polygen(QQ, 'x') - 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 + sage: K. = NumberField(x**6 - 320*x**3 - 320) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,1,0,0]) # needs sage.rings.number_field + sage: isogenies_5_0(E) # needs 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 @@ -955,8 +955,8 @@ def isogenies_5_1728(E, minimal_models=True): 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 + sage: E = EllipticCurve(GF(13), [11,0]) # needs sage.rings.finite_rings + sage: isogenies_5_1728(E) # needs 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, @@ -966,9 +966,9 @@ def isogenies_5_1728(E, minimal_models=True): An example of endomorphisms of degree 5:: - 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,0,1,0]) # needs sage.rings.number_field + sage: isogenies_5_1728(E) # needs 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 @@ -979,7 +979,7 @@ def isogenies_5_1728(E, minimal_models=True): 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 + sage: _[0].rational_maps() # needs 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 @@ -990,11 +990,11 @@ def isogenies_5_1728(E, minimal_models=True): An example of 5-isogenies over a number field:: sage: x = polygen(QQ, 'x') - 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 + sage: K. = NumberField(x**4 + 20*x**2 - 80) # needs sage.rings.number_field + sage: K(5).is_square() # necessary but not sufficient! # needs sage.rings.number_field True - sage: E = EllipticCurve(K, [0,0,0,1,0]) # optional - sage.rings.number_field - sage: isogenies_5_1728(E) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,0,1,0]) # needs sage.rings.number_field + sage: isogenies_5_1728(E) # needs 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 @@ -1008,14 +1008,14 @@ def isogenies_5_1728(E, minimal_models=True): See :trac:`19840`:: - 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, + sage: K. = NumberField(x^4 - 5*x^2 + 5) # needs sage.rings.number_field + sage: E = EllipticCurve([a^2 + a + 1, a^3 + a^2 + a + 1, a^2 + a, # needs sage.rings.number_field ....: 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 + sage: len(E.isogenies_prime_degree(5)) # needs 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)] # optional - sage.rings.number_field + sage: [phi.codomain().j_invariant() for phi in isogenies_5_1728(E)] # needs sage.rings.number_field [19691491018752*a^2 - 27212977933632, 19691491018752*a^2 - 27212977933632] """ F = E.base_field() @@ -1084,9 +1084,9 @@ 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) # 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 + sage: K. = QuadraticField(-3) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,1]) # needs sage.rings.number_field + sage: isogenies_7_0(E) # needs 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 @@ -1098,8 +1098,8 @@ def isogenies_7_0(E, minimal_models=True): 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]) # optional - sage.rings.finite_rings - sage: isogenies_7_0(E) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(13^2,'a'), [0,-3]) # needs sage.rings.finite_rings + sage: isogenies_7_0(E) # needs 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, @@ -1109,9 +1109,9 @@ def isogenies_7_0(E, minimal_models=True): Now some examples of 7-isogenies which are not endomorphisms:: - 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 + sage: K = GF(101) # needs sage.rings.finite_rings + sage: E = EllipticCurve(K, [0,1]) # needs sage.rings.finite_rings + sage: isogenies_7_0(E) # needs 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, @@ -1122,8 +1122,8 @@ 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')) # optional - sage.rings.number_field - sage: isogenies_7_0(E) # optional - sage.rings.number_field + sage: E = EllipticCurve('27a1').change_ring(QuadraticField(-3,'r')) # needs sage.rings.number_field + sage: isogenies_7_0(E) # needs 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 @@ -1136,10 +1136,10 @@ def isogenies_7_0(E, minimal_models=True): with defining polynomial x^2 + 3 with r = 1.732050807568878?*I] sage: x = polygen(QQ, 'x') - 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 + sage: K. = NumberField(x^6 + 1512*x^3 - 21168) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,1]) # needs sage.rings.number_field + sage: isogs = isogenies_7_0(E) # needs sage.rings.number_field + sage: [phi.codomain().a_invariants() for phi in isogs] # needs sage.rings.number_field [(0, 0, 0, @@ -1152,7 +1152,7 @@ def isogenies_7_0(E, minimal_models=True): -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] # optional - sage.rings.number_field + sage: [phi.codomain().j_invariant() for phi in isogs] # needs sage.rings.number_field [158428486656000/7*a^3 - 313976217600000, -158428486656000/7*a^3 - 34534529335296000] """ @@ -1219,8 +1219,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]) # optional - sage.rings.finite_rings - sage: isogenies_7_1728(E) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(47), [1, 0]) # needs sage.rings.finite_rings + sage: isogenies_7_1728(E) # needs 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, @@ -1231,11 +1231,11 @@ 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]) # optional - sage.rings.finite_rings - sage: isogenies_7_1728(E) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(53), [1, 0]) # needs sage.rings.finite_rings + sage: isogenies_7_1728(E) # needs sage.rings.finite_rings [] - 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 + sage: E = EllipticCurve(GF(53^2,'a'), [1, 0]) # needs sage.rings.finite_rings + sage: [iso.codomain().ainvs() for iso in isogenies_7_1728(E)] # needs 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)] @@ -1243,19 +1243,19 @@ def isogenies_7_1728(E, minimal_models=True): :: sage: x = polygen(QQ, 'x') - 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 + sage: K. = NumberField(x^8 + 84*x^6 - 1890*x^4 + 644*x^2 - 567) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [1, 0]) # needs sage.rings.number_field + sage: isogs = isogenies_7_1728(E) # needs sage.rings.number_field + sage: [phi.codomain().j_invariant() for phi in isogs] # needs 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 + sage: E1 = isogs[0].codomain() # needs sage.rings.number_field + sage: E2 = isogs[1].codomain() # needs sage.rings.number_field + sage: E1.is_isomorphic(E2) # needs sage.rings.number_field False - sage: E1.is_quadratic_twist(E2) # optional - sage.rings.number_field + sage: E1.is_quadratic_twist(E2) # needs sage.rings.number_field -1 """ if E.j_invariant() != 1728: @@ -1320,11 +1320,11 @@ def isogenies_13_0(E, minimal_models=True): Endomorphisms of degree 13 will exist when -3 is a square:: - sage: K. = QuadraticField(-3) # optional - sage.rings.number_field - sage: E = EllipticCurve(K, [0, r]); E # optional - sage.rings.number_field + sage: K. = QuadraticField(-3) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0, r]); E # needs 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) # optional - sage.rings.number_field + sage: isogenies_13_0(E) # needs 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 @@ -1335,7 +1335,7 @@ def isogenies_13_0(E, minimal_models=True): 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 + sage: isogenies_13_0(E)[0].rational_maps() # needs 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 @@ -1350,27 +1350,27 @@ def isogenies_13_0(E, minimal_models=True): An example of endomorphisms over a finite field:: - sage: K = GF(19^2,'a') # optional - sage.rings.finite_rings - sage: E = EllipticCurve(j=K(0)); E # optional - sage.rings.finite_rings + sage: K = GF(19^2,'a') # needs sage.rings.finite_rings + sage: E = EllipticCurve(j=K(0)); E # needs 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 + sage: isogenies_13_0(E) # needs 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() # optional - sage.rings.finite_rings + sage: isogenies_13_0(E)[0].rational_maps() # needs 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)) A previous implementation did not work in some characteristics:: - 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 + sage: K = GF(29) # needs sage.rings.finite_rings + sage: E = EllipticCurve(j=K(0)) # needs sage.rings.finite_rings + sage: isogenies_13_0(E) # needs 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, @@ -1380,20 +1380,20 @@ def isogenies_13_0(E, minimal_models=True): :: - sage: K = GF(101) # optional - sage.rings.finite_rings - sage: E = EllipticCurve(j=K(0)); E.ainvs() # optional - sage.rings.finite_rings + sage: K = GF(101) # needs sage.rings.finite_rings + sage: E = EllipticCurve(j=K(0)); E.ainvs() # needs sage.rings.finite_rings (0, 0, 0, 0, 1) - sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)] # optional - sage.rings.finite_rings + sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)] # needs 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) # optional - sage.rings.number_field - sage: E = EllipticCurve(j=K(0)); E.ainvs() # optional - sage.rings.number_field + sage: K. = NumberField(f) # needs sage.rings.number_field + sage: E = EllipticCurve(j=K(0)); E.ainvs() # needs sage.rings.number_field (0, 0, 0, 0, 1) - sage: len([phi.codomain().ainvs() # long time (4s) # optional - sage.rings.number_field + sage: len([phi.codomain().ainvs() # long time # needs sage.rings.number_field ....: for phi in isogenies_13_0(E)]) 2 """ @@ -1469,10 +1469,10 @@ 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) # optional - sage.rings.number_field - sage: E = EllipticCurve([0,0,0,i,0]); E.ainvs() # optional - sage.rings.number_field + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0,0,0,i,0]); E.ainvs() # needs sage.rings.number_field (0, 0, 0, i, 0) - sage: isogenies_13_1728(E) # optional - sage.rings.number_field + sage: isogenies_13_1728(E) # needs 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 @@ -1486,15 +1486,15 @@ def isogenies_13_1728(E, minimal_models=True): :: - 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 + sage: K = GF(83) # needs sage.rings.finite_rings + sage: E = EllipticCurve(K, [0,0,0,5,0]); E.ainvs() # needs sage.rings.finite_rings (0, 0, 0, 5, 0) - sage: isogenies_13_1728(E) # optional - sage.rings.finite_rings + sage: isogenies_13_1728(E) # needs sage.rings.finite_rings [] - 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 + sage: K = GF(89) # needs sage.rings.finite_rings + sage: E = EllipticCurve(K, [0,0,0,5,0]); E.ainvs() # needs sage.rings.finite_rings (0, 0, 0, 5, 0) - sage: isogenies_13_1728(E) # optional - sage.rings.finite_rings + sage: isogenies_13_1728(E) # needs 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, @@ -1504,9 +1504,9 @@ def isogenies_13_1728(E, minimal_models=True): :: - 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 + sage: K = GF(23) # needs sage.rings.finite_rings + sage: E = EllipticCurve(K, [1,0]) # needs sage.rings.finite_rings + sage: isogenies_13_1728(E) # needs 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, @@ -1519,9 +1519,9 @@ 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) # 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 + sage: K. = NumberField(f) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [1,0]) # needs sage.rings.number_field + sage: [phi.codomain().ainvs() # long time, needs sage.rings.number_field ....: for phi in isogenies_13_1728(E)] [(0, 0, @@ -1865,10 +1865,10 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): 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 + sage: K = QuadraticField(-295,'a') # needs sage.rings.number_field + sage: a = K.gen() # needs sage.rings.number_field + sage: E = EllipticCurve_from_j(-484650135/16777216*a + 4549855725/16777216) # needs sage.rings.number_field + sage: isogenies_prime_degree_genus_plus_0(E, 23) # needs sage.rings.number_field [Isogeny of degree 23 from Elliptic Curve defined by y^2 = x^3 + (-14460494784192904095/140737488355328*a+270742665778826768325/140737488355328)*x @@ -1881,10 +1881,10 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): 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 + sage: K = QuadraticField(-199,'a') # needs sage.rings.number_field + sage: a = K.gen() # needs sage.rings.number_field + sage: E = EllipticCurve_from_j(94743000*a + 269989875) # needs sage.rings.number_field + sage: isogenies_prime_degree_genus_plus_0(E, 29) # needs sage.rings.number_field [Isogeny of degree 29 from Elliptic Curve defined by y^2 = x^3 + (-153477413215038000*a+5140130723072965125)*x @@ -1897,10 +1897,10 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): 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 + sage: K = QuadraticField(253,'a') # needs sage.rings.number_field + sage: a = K.gen() # needs sage.rings.number_field + sage: E = EllipticCurve_from_j(208438034112000*a - 3315409892960000) # needs sage.rings.number_field + sage: isogenies_prime_degree_genus_plus_0(E, 31) # needs sage.rings.number_field [Isogeny of degree 31 from Elliptic Curve defined by y^2 = x^3 + (4146345122185433034677956608000*a-65951656549965037259634800640000)*x @@ -1913,8 +1913,8 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): 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 + sage: E = EllipticCurve_from_j(GF(5)(1)) # needs sage.rings.finite_rings + sage: isogenies_prime_degree_genus_plus_0(E, 41) # needs 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, @@ -1922,11 +1922,11 @@ 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') # 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 + sage: K = QuadraticField(5,'a') # needs sage.rings.number_field + sage: a = K.gen() # needs sage.rings.number_field + sage: E = EllipticCurve_from_j(184068066743177379840*a # needs sage.rings.number_field ....: - 411588709724712960000) - sage: isogenies_prime_degree_genus_plus_0(E, 47) # long time (2s) # optional - sage.rings.number_field + sage: isogenies_prime_degree_genus_plus_0(E, 47) # long time # needs sage.rings.number_field [Isogeny of degree 47 from Elliptic Curve defined by y^2 = x^3 + (454562028554080355857852049849975895490560*a-1016431595837124114668689286176511361024000)*x @@ -1939,9 +1939,9 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): 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: K = QuadraticField(-66827,'a') # needs sage.rings.number_field + sage: a = K.gen() # needs sage.rings.number_field + sage: E = EllipticCurve_from_j(-98669236224000*a + 4401720074240000) # needs 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 @@ -1955,8 +1955,8 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): 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 + sage: E = EllipticCurve_from_j(GF(13)(5)) # needs sage.rings.finite_rings + sage: isogenies_prime_degree_genus_plus_0(E, 71) # needs 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, @@ -1964,8 +1964,8 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): 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 + sage: E = EllipticCurve(GF(13), [0,1,1,1,0]) # needs sage.rings.finite_rings + sage: isogenies_prime_degree_genus_plus_0(E) # needs 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, @@ -2070,9 +2070,9 @@ 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) # 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 + sage: K. = NumberField(u^4 + 228*u^3 + 486*u^2 - 540*u + 225) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0, -121/5*a^3 - 20691/5*a^2 - 29403/5*a + 3267]) # needs sage.rings.number_field + sage: isogenies_prime_degree_genus_plus_0_j0(E, 11) # needs 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 @@ -2172,12 +2172,12 @@ 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 # optional - sage.rings.number_field + sage: K. = NumberField(u^6 - 522*u^5 - 10017*u^4 # needs 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 + sage: E = EllipticCurve(K, [-75295/1335852*a^5 + 13066735/445284*a^4 # needs 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 + sage: isogenies_prime_degree_genus_plus_0_j1728(E, 11) # needs 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 @@ -2198,9 +2198,9 @@ def isogenies_prime_degree_genus_plus_0_j1728(E, l, minimal_models=True): + (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 + sage: i = QuadraticField(-1,'i').gen() # needs sage.rings.number_field + sage: E = EllipticCurve([-1 - 2*i, 0]) # needs sage.rings.number_field + sage: isogenies_prime_degree_genus_plus_0_j1728(E, 17) # needs 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 @@ -2211,8 +2211,8 @@ def isogenies_prime_degree_genus_plus_0_j1728(E, l, minimal_models=True): 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 + sage: Emin = E.global_minimal_model() # needs sage.rings.number_field + sage: [(p, len(isogenies_prime_degree_genus_plus_0_j1728(Emin, p))) # needs sage.rings.number_field ....: for p in [17, 29, 41]] [(17, 2), (29, 2), (41, 2)] """ @@ -2346,13 +2346,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) # 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 + sage: F = GF(3) # needs sage.rings.finite_rings + sage: E = EllipticCurve(F, [0,0,0,-1,0]) # needs sage.rings.finite_rings + sage: f13 = E.division_polynomial(13) # needs sage.rings.finite_rings + sage: factors = [f for f, e in f13.factor()] # needs sage.rings.finite_rings + sage: all(f.degree() == 6 for f in factors) # needs sage.rings.finite_rings True - sage: [is_kernel_polynomial(E, 13, f) for f in factors] # optional - sage.rings.finite_rings + sage: [is_kernel_polynomial(E, 13, f) for f in factors] # needs sage.rings.finite_rings [True, True, False, @@ -2370,15 +2370,15 @@ def is_kernel_polynomial(E, m, f): See :trac:`22232`:: - 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 + sage: K = GF(47^2) # needs sage.rings.finite_rings + sage: E = EllipticCurve([0, K.gen()]) # needs sage.rings.finite_rings + sage: psi7 = E.division_polynomial(7) # needs sage.rings.finite_rings + sage: f = psi7.factor()[4][0] # needs sage.rings.finite_rings + sage: f # needs sage.rings.finite_rings x^3 + (7*z2 + 11)*x^2 + (25*z2 + 33)*x + 25*z2 - sage: f.divides(psi7) # optional - sage.rings.finite_rings + sage: f.divides(psi7) # needs sage.rings.finite_rings True - sage: is_kernel_polynomial(E, 7, f) # optional - sage.rings.finite_rings + sage: is_kernel_polynomial(E, 7, f) # needs sage.rings.finite_rings False """ m2 = m // 2 @@ -2444,15 +2444,15 @@ 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)) # optional - sage.rings.finite_rings - sage: isogenies_prime_degree_general(E, 7) # optional - sage.rings.finite_rings + sage: E = EllipticCurve_from_j(GF(2^6,'a')(1)) # needs sage.rings.finite_rings + sage: isogenies_prime_degree_general(E, 7) # needs 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 + sage: E = EllipticCurve_from_j(GF(3^12,'a')(2)) # needs sage.rings.finite_rings + sage: isogenies_prime_degree_general(E, 17) # needs 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 @@ -2503,7 +2503,7 @@ 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): # optional - sage.rings.finite_rings + sage: for l in prime_range(50): # needs sage.rings.finite_rings ....: E = EllipticCurve(GF(l),ainvs) ....: isogenies_prime_degree_general(E,l) [] @@ -2546,26 +2546,26 @@ def isogenies_prime_degree_general(E, l, minimal_models=True): factors of degree 6 each, but only two those are kernel polynomials:: - 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 + sage: F3 = GF(3) # needs sage.rings.finite_rings + sage: E = EllipticCurve(F3, [0,0,0,-1,0]) # needs sage.rings.finite_rings + sage: Psi13 = E.division_polynomial(13) # needs sage.rings.finite_rings + sage: len([f for f, e in Psi13.factor() if f.degree() == 6]) # needs sage.rings.finite_rings 14 - sage: len(E.isogenies_prime_degree(13)) # optional - sage.rings.finite_rings + sage: len(E.isogenies_prime_degree(13)) # needs 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)) # optional - sage.rings.finite_rings + sage: len(E.change_ring(GF(3^2,'a')).isogenies_prime_degree(13)) # needs sage.rings.finite_rings 14 See :trac:`18589`: the following example took 20s before, now only 4s:: - 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve(K,[0,0,0,1,0]) # needs sage.rings.number_field + sage: [phi.codomain().ainvs() # long time, needs 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)] @@ -2668,15 +2668,15 @@ 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)) # optional - sage.rings.finite_rings - sage: isogenies_prime_degree(E, 7) # optional - sage.rings.finite_rings + sage: E = EllipticCurve_from_j(GF(2^6,'a')(1)) # needs sage.rings.finite_rings + sage: isogenies_prime_degree(E, 7) # needs 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 + sage: E = EllipticCurve_from_j(GF(3^12,'a')(2)) # needs sage.rings.finite_rings + sage: isogenies_prime_degree(E, 17) # needs 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 @@ -2718,7 +2718,7 @@ 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): # optional - sage.rings.finite_rings + sage: for l in prime_range(50): # needs sage.rings.finite_rings ....: E = EllipticCurve(GF(l), ainvs) ....: isogenies_prime_degree(E, l) [] @@ -2770,17 +2770,17 @@ def isogenies_prime_degree(E, l, minimal_models=True): 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]) # optional - sage.rings.finite_rings - sage: E.isogenies_prime_degree(71) # fast # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(101), [-3440, 77658]) # needs sage.rings.finite_rings + sage: E.isogenies_prime_degree(71) # fast # needs sage.rings.finite_rings [] - sage: E.isogenies_prime_degree(73) # long time (2s) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(73) # long time # needs sage.rings.finite_rings [] Test that :trac:`32269` is fixed:: - 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 + sage: K = QuadraticField(-11) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,1,0,-117,-541]) # needs sage.rings.number_field + sage: E.isogenies_prime_degree(37) # long time # needs 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 diff --git a/src/sage/schemes/elliptic_curves/lseries_ell.py b/src/sage/schemes/elliptic_curves/lseries_ell.py index 45db560c861..b38638cfcb4 100644 --- a/src/sage/schemes/elliptic_curves/lseries_ell.py +++ b/src/sage/schemes/elliptic_curves/lseries_ell.py @@ -661,32 +661,32 @@ def deriv_at1(self, k=None, prec=None): EXAMPLES:: sage: E = EllipticCurve('37a') - sage: E.lseries().deriv_at1() + sage: E.lseries().deriv_at1() # needs sage.symbolic (0.3059866, 0.000801045) - sage: E.lseries().deriv_at1(100) + sage: E.lseries().deriv_at1(100) # needs sage.symbolic (0.3059997738340523018204836833216764744526377745903, 1.52493e-45) - sage: E.lseries().deriv_at1(1000) + sage: E.lseries().deriv_at1(1000) # needs sage.symbolic (0.305999773834052301820483683321676474452637774590771998..., 2.75031e-449) With less numerical precision, the error is bounded by numerical accuracy:: - sage: L,err = E.lseries().deriv_at1(100, prec=64) - sage: L,err + sage: L, err = E.lseries().deriv_at1(100, prec=64) # needs sage.symbolic + sage: L, err # needs sage.symbolic (0.305999773834052302, 5.55318e-18) - sage: parent(L) + sage: parent(L) # needs sage.symbolic Real Field with 64 bits of precision - sage: parent(err) + sage: parent(err) # needs sage.symbolic Real Field with 24 bits of precision and rounding RNDU Rank 2 and rank 3 elliptic curves:: sage: E = EllipticCurve('389a1') - sage: E.lseries().deriv_at1() + sage: E.lseries().deriv_at1() # needs sage.symbolic (0.0000000, 0.000000) sage: E = EllipticCurve((1, 0, 1, -131, 558)) # curve 59450i1 - sage: E.lseries().deriv_at1() + sage: E.lseries().deriv_at1() # needs sage.symbolic (-0.00010911444, 0.142428) - sage: E.lseries().deriv_at1(4000) + sage: E.lseries().deriv_at1(4000) # needs sage.symbolic (6.990...e-50, 1.31318e-43) """ sqrtN = sqrt(self.__E.conductor()) diff --git a/src/sage/schemes/elliptic_curves/modular_parametrization.py b/src/sage/schemes/elliptic_curves/modular_parametrization.py index 891a9e0142f..1352492e686 100644 --- a/src/sage/schemes/elliptic_curves/modular_parametrization.py +++ b/src/sage/schemes/elliptic_curves/modular_parametrization.py @@ -153,7 +153,7 @@ def __call__(self, z, prec=None): sage: E = EllipticCurve('37a') sage: phi = E.modular_parametrization() - sage: phi((sqrt(7)*I - 17)/74, 53) + sage: phi((sqrt(7)*I - 17)/74, 53) # needs sage.symbolic (...e-16 - ...e-16*I : ...e-16 + ...e-16*I : 1.00000000000000) Verify that the mapping is invariant under the action of `\Gamma_0(N)` @@ -214,12 +214,12 @@ def map_to_complex_numbers(self, z, prec=None): sage: E = EllipticCurve('37a'); phi = E.modular_parametrization() sage: x = polygen(ZZ, 'x') - sage: tau = (sqrt(7)*I - 17)/74 # optional - sage.symbolic - sage: z = phi.map_to_complex_numbers(tau); z # optional - sage.symbolic + sage: tau = (sqrt(7)*I - 17)/74 # needs sage.symbolic + sage: z = phi.map_to_complex_numbers(tau); z # needs sage.symbolic 0.929592715285395 - 1.22569469099340*I - sage: E.elliptic_exponential(z) + sage: E.elliptic_exponential(z) # needs sage.symbolic (...e-16 - ...e-16*I : ...e-16 + ...e-16*I : 1.00000000000000) - sage: phi(tau) + sage: phi(tau) # needs sage.symbolic (...e-16 - ...e-16*I : ...e-16 + ...e-16*I : 1.00000000000000) """ if prec is None: diff --git a/src/sage/schemes/elliptic_curves/period_lattice.py b/src/sage/schemes/elliptic_curves/period_lattice.py index 66a53cc571a..3cbad7097ab 100644 --- a/src/sage/schemes/elliptic_curves/period_lattice.py +++ b/src/sage/schemes/elliptic_curves/period_lattice.py @@ -17,13 +17,13 @@ EXAMPLES:: sage: x = polygen(ZZ, 'x') - 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: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field First we try a real embedding:: - sage: emb = K.embeddings(RealField())[0] # optional - sage.rings.number_field - sage: L = E.period_lattice(emb); L # optional - sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field + sage: L = E.period_lattice(emb); L # needs 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 +33,22 @@ The first basis period is real:: - sage: L.basis() # optional - sage.rings.number_field + sage: L.basis() # needs sage.rings.number_field (3.81452977217855, 1.90726488608927 + 1.34047785962440*I) - sage: L.is_real() # optional - sage.rings.number_field + sage: L.is_real() # needs 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() # optional - sage.rings.number_field + sage: L.normalised_basis() # needs sage.rings.number_field (1.90726488608927 - 1.34047785962440*I, -1.90726488608927 - 1.34047785962440*I) Next a complex embedding:: - sage: emb = K.embeddings(ComplexField())[0] # optional - sage.rings.number_field - sage: L = E.period_lattice(emb); L # optional - sage.rings.number_field + sage: emb = K.embeddings(ComplexField())[0] # needs sage.rings.number_field + sage: L = E.period_lattice(emb); L # needs 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 +60,21 @@ that `\tau = \omega_1/\omega_2` is in the fundamental region in the upper half plane:: - sage: w1, w2 = L.basis(); w1, w2 # optional - sage.rings.number_field + sage: w1, w2 = L.basis(); w1, w2 # needs sage.rings.number_field (-1.37588604166076 - 2.58560946624443*I, -2.10339907847356 + 0.428378776460622*I) - sage: L.is_real() # optional - sage.rings.number_field + sage: L.is_real() # needs sage.rings.number_field False - sage: tau = w1/w2; tau # optional - sage.rings.number_field + sage: tau = w1/w2; tau # needs sage.rings.number_field 0.387694505032876 + 1.30821088214407*I - sage: L.normalised_basis() # optional - sage.rings.number_field + sage: L.normalised_basis() # needs 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') # 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 + sage: E = EllipticCurve('37a') # needs sage.rings.number_field + sage: K. = QuadraticField(-7) # needs sage.rings.number_field + sage: EK = E.change_ring(K) # needs sage.rings.number_field + sage: EK.period_lattice(K.complex_embeddings()[0]) # needs 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 @@ -181,10 +181,10 @@ def __init__(self, E, embedding=None): :: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field + sage: L = PeriodLattice_ell(E, emb); L # needs 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: @@ -192,8 +192,8 @@ def __init__(self, E, embedding=None): To: Algebraic Real Field Defn: a |--> 1.259921049894873? - sage: emb = K.embeddings(ComplexField())[0] # optional - sage.rings.number_field - sage: L = PeriodLattice_ell(E, emb); L # optional - sage.rings.number_field + sage: emb = K.embeddings(ComplexField())[0] # needs sage.rings.number_field + sage: L = PeriodLattice_ell(E, emb); L # needs 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: @@ -204,11 +204,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) # 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field + sage: L = PeriodLattice_ell(E,emb) # needs sage.rings.number_field + sage: L == loads(dumps(L)) # needs sage.rings.number_field True """ # First we cache the elliptic curve with this period lattice: @@ -282,11 +282,11 @@ def __richcmp__(self, other, op): sage: from sage.schemes.elliptic_curves.period_lattice import PeriodLattice_ell sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field + sage: embs = K.embeddings(ComplexField()) # needs sage.rings.number_field + sage: L1, L2, L3 = [PeriodLattice_ell(E, e) for e in embs] # needs sage.rings.number_field + sage: L1 < L2 < L3 # needs sage.rings.number_field True """ if not isinstance(other, PeriodLattice_ell): @@ -313,10 +313,10 @@ def __repr__(self): :: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field + sage: L = E.period_lattice(emb); L # needs 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 @@ -439,20 +439,20 @@ def basis(self, prec=None, algorithm='sage'): :: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field + sage: L = E.period_lattice(emb) # needs sage.rings.number_field + sage: L.basis(64) # needs sage.rings.number_field (3.81452977217854509, 1.90726488608927255 + 1.34047785962440202*I) - 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 + sage: emb = K.embeddings(ComplexField())[0] # needs sage.rings.number_field + sage: L = E.period_lattice(emb) # needs sage.rings.number_field + sage: w1, w2 = L.basis(); w1, w2 # needs sage.rings.number_field (-1.37588604166076 - 2.58560946624443*I, -2.10339907847356 + 0.428378776460622*I) - sage: L.is_real() # optional - sage.rings.number_field + sage: L.is_real() # needs sage.rings.number_field False - sage: tau = w1/w2; tau # optional - sage.rings.number_field + sage: tau = w1/w2; tau # needs sage.rings.number_field 0.387694505032876 + 1.30821088214407*I """ # We divide into two cases: (1) Q, or a number field with a @@ -541,22 +541,22 @@ def normalised_basis(self, prec=None, algorithm='sage'): :: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field + sage: L = E.period_lattice(emb) # needs sage.rings.number_field + sage: L.normalised_basis(64) # needs sage.rings.number_field (1.90726488608927255 - 1.34047785962440202*I, -1.90726488608927255 - 1.34047785962440202*I) - 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 + sage: emb = K.embeddings(ComplexField())[0] # needs sage.rings.number_field + sage: L = E.period_lattice(emb) # needs sage.rings.number_field + sage: w1, w2 = L.normalised_basis(); w1, w2 # needs sage.rings.number_field (-1.37588604166076 - 2.58560946624443*I, -2.10339907847356 + 0.428378776460622*I) - sage: L.is_real() # optional - sage.rings.number_field + sage: L.is_real() # needs sage.rings.number_field False - sage: tau = w1/w2; tau # optional - sage.rings.number_field + sage: tau = w1/w2; tau # needs sage.rings.number_field 0.387694505032876 + 1.30821088214407*I """ w1, w2 = self.basis(prec=prec, algorithm=algorithm) @@ -595,24 +595,24 @@ def tau(self, prec=None, algorithm='sage'): :: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field + sage: L = E.period_lattice(emb) # needs sage.rings.number_field + sage: tau = L.tau(); tau # needs sage.rings.number_field -0.338718341018919 + 0.940887817679340*I - sage: tau.abs() # optional - sage.rings.number_field + sage: tau.abs() # needs sage.rings.number_field 1.00000000000000 - sage: -0.5 <= tau.real() <= 0.5 # optional - sage.rings.number_field + sage: -0.5 <= tau.real() <= 0.5 # needs sage.rings.number_field True - 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 + sage: emb = K.embeddings(ComplexField())[0] # needs sage.rings.number_field + sage: L = E.period_lattice(emb) # needs sage.rings.number_field + sage: tau = L.tau(); tau # needs sage.rings.number_field 0.387694505032876 + 1.30821088214407*I - sage: tau.abs() # optional - sage.rings.number_field + sage: tau.abs() # needs sage.rings.number_field 1.36444961115933 - sage: -0.5 <= tau.real() <= 0.5 # optional - sage.rings.number_field + sage: -0.5 <= tau.real() <= 0.5 # needs sage.rings.number_field True """ w1, w2 = self.normalised_basis(prec=prec, algorithm=algorithm) @@ -642,16 +642,16 @@ def _compute_periods_real(self, prec=None, algorithm='sage'): EXAMPLES:: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field + sage: embs = K.embeddings(CC) # needs sage.rings.number_field + sage: Ls = [E.period_lattice(e) for e in embs] # needs sage.rings.number_field + sage: [L.is_real() for L in Ls] # needs sage.rings.number_field [False, False, True] - sage: Ls[2]._compute_periods_real(100) # optional - sage.rings.number_field + sage: Ls[2]._compute_periods_real(100) # needs sage.rings.number_field (3.8145297721785450936365098936, 1.9072648860892725468182549468 + 1.3404778596244020196600112394*I) - sage: Ls[2]._compute_periods_real(100, algorithm='pari') # optional - sage.rings.number_field + sage: Ls[2]._compute_periods_real(100, algorithm='pari') # needs sage.rings.number_field (3.8145297721785450936365098936, 1.9072648860892725468182549468 - 1.3404778596244020196600112394*I) """ @@ -713,32 +713,32 @@ def _compute_periods_complex(self, prec=None, normalise=True): EXAMPLES:: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field + sage: embs = K.embeddings(CC) # needs sage.rings.number_field + sage: Ls = [E.period_lattice(e) for e in embs] # needs sage.rings.number_field + sage: [L.is_real() for L in Ls] # needs sage.rings.number_field [False, False, True] - sage: L = Ls[0] # optional - sage.rings.number_field - sage: w1,w2 = L._compute_periods_complex(100); w1,w2 # optional - sage.rings.number_field + sage: L = Ls[0] # needs sage.rings.number_field + sage: w1,w2 = L._compute_periods_complex(100); w1,w2 # needs sage.rings.number_field (-1.3758860416607626645495991458 - 2.5856094662444337042877901304*I, -2.1033990784735587243397865076 + 0.42837877646062187766760569686*I) - sage: tau = w1/w2; tau # optional - sage.rings.number_field + sage: tau = w1/w2; tau # needs sage.rings.number_field 0.38769450503287609349437509561 + 1.3082108821440725664008561928*I - sage: tau.real() # optional - sage.rings.number_field + sage: tau.real() # needs sage.rings.number_field 0.38769450503287609349437509561 - sage: tau.abs() # optional - sage.rings.number_field + sage: tau.abs() # needs sage.rings.number_field 1.3644496111593345713923386773 Without normalisation:: - sage: w1,w2 = L._compute_periods_complex(normalise=False); w1,w2 # optional - sage.rings.number_field + sage: w1,w2 = L._compute_periods_complex(normalise=False); w1,w2 # needs sage.rings.number_field (2.10339907847356 - 0.428378776460622*I, 0.727513036812796 - 3.01398824270506*I) - sage: tau = w1/w2; tau # optional - sage.rings.number_field + sage: tau = w1/w2; tau # needs sage.rings.number_field 0.293483964608883 + 0.627038168678760*I - sage: tau.real() # optional - sage.rings.number_field + sage: tau.real() # needs sage.rings.number_field 0.293483964608883 - sage: tau.abs() # > 1 # optional - sage.rings.number_field + sage: tau.abs() # > 1 # needs sage.rings.number_field 0.692321964451917 """ if prec is None: @@ -775,19 +775,19 @@ def is_real(self): :: - 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,0,i,2*i]) # needs sage.rings.number_field + sage: emb = K.embeddings(ComplexField())[0] # needs sage.rings.number_field + sage: L = E.period_lattice(emb) # needs sage.rings.number_field + sage: L.is_real() # needs sage.rings.number_field False :: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field + sage: [E.period_lattice(emb).is_real() for emb in K.embeddings(CC)] # needs sage.rings.number_field [False, False, True] ALGORITHM: @@ -860,11 +860,11 @@ def real_period(self, prec=None, algorithm='sage'): :: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field + sage: L = E.period_lattice(emb) # needs sage.rings.number_field + sage: L.real_period(64) # needs sage.rings.number_field 3.81452977217854509 """ if self.is_real(): @@ -922,11 +922,11 @@ def omega(self, prec=None, bsd_normalise=False): :: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field + sage: L = E.period_lattice(emb) # needs sage.rings.number_field + sage: L.omega(64) # needs sage.rings.number_field 3.81452977217854509 A complex example (taken from J.E.Cremona and E.Whitley, @@ -934,14 +934,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) # 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0,1-i,i,-i,0]) # needs sage.rings.number_field + sage: L = E.period_lattice(K.embeddings(CC)[0]) # needs sage.rings.number_field + sage: L.omega() # needs sage.rings.number_field 8.80694160502647 - sage: L.omega(prec=200) # optional - sage.rings.number_field + sage: L.omega(prec=200) # needs sage.rings.number_field 8.8069416050264741493250743632295462227858630765392114070032 - sage: L.omega(bsd_normalise=True) # optional - sage.rings.number_field + sage: L.omega(bsd_normalise=True) # needs sage.rings.number_field 17.6138832100529 """ if self.is_real(): @@ -980,11 +980,11 @@ def basis_matrix(self, prec=None, normalised=False): :: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field + sage: L = E.period_lattice(emb) # needs sage.rings.number_field + sage: L.basis_matrix(64) # needs sage.rings.number_field [ 3.81452977217854509 0.000000000000000000] [ 1.90726488608927255 1.34047785962440202] @@ -1105,14 +1105,14 @@ def curve(self): :: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field + sage: L = E.period_lattice(K.embeddings(RealField())[0]) # needs sage.rings.number_field + sage: L.curve() is E # needs sage.rings.number_field True - sage: L = E.period_lattice(K.embeddings(ComplexField())[0]) # optional - sage.rings.number_field - sage: L.curve() is E # optional - sage.rings.number_field + sage: L = E.period_lattice(K.embeddings(ComplexField())[0]) # needs sage.rings.number_field + sage: L.curve() is E # needs sage.rings.number_field True """ return self.E @@ -1135,19 +1135,19 @@ def ei(self): :: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field + sage: L = E.period_lattice(K.embeddings(RealField())[0]) # needs sage.rings.number_field + sage: x1,x2,x3 = L.ei() # needs sage.rings.number_field + sage: abs(x1.real()) + abs(x2.real()) < 1e-14 # needs sage.rings.number_field True - sage: x1.imag(), x2.imag(), x3 # optional - sage.rings.number_field + sage: x1.imag(), x2.imag(), x3 # needs sage.rings.number_field (-1.122462048309373?, 1.122462048309373?, -1.000000000000000?) :: - sage: L = E.period_lattice(K.embeddings(ComplexField())[0]) # optional - sage.rings.number_field - sage: L.ei() # optional - sage.rings.number_field + sage: L = E.period_lattice(K.embeddings(ComplexField())[0]) # needs sage.rings.number_field + sage: L.ei() # needs sage.rings.number_field [-1.000000000000000? + 0.?e-1...*I, -0.9720806486198328? - 0.561231024154687?*I, 0.9720806486198328? + 0.561231024154687?*I] @@ -1351,44 +1351,44 @@ def e_log_RC(self, xP, yP, prec=None, reduce=True): A number field example:: sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: E = EllipticCurve([0,0,0,0,a]) # needs sage.rings.number_field + sage: v = K.real_places()[0] # needs sage.rings.number_field + sage: L = E.period_lattice(v) # needs sage.rings.number_field + sage: P = E.lift_x(1/3*a^2 + a + 5/3) # needs sage.rings.number_field + sage: L(P) # needs sage.rings.number_field 3.51086196882538 - 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 + sage: xP, yP = [v(c) for c in P.xy()] # needs sage.rings.number_field + sage: L.e_log_RC(xP, yP) # needs 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()]) # 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 + sage: ER = EllipticCurve([v(ai) for ai in E.a_invariants()]) # needs sage.rings.number_field + sage: P = ER.lift_x(12.34) # needs sage.rings.number_field + sage: xP, yP = P.xy() # needs sage.rings.number_field + sage: xP, yP # needs sage.rings.number_field (12.3400000000000, -43.3628968710567) - sage: L.e_log_RC(xP, yP) # optional - sage.rings.number_field + sage: L.e_log_RC(xP, yP) # needs sage.rings.number_field 0.284656841192041 - 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 + sage: xP, yP = ER.lift_x(0).xy() # needs sage.rings.number_field + sage: L.e_log_RC(xP, yP) # needs sage.rings.number_field 1.34921304541057 Elliptic logs of complex points:: - 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 + sage: v = K.complex_embeddings()[0] # needs sage.rings.number_field + sage: L = E.period_lattice(v) # needs sage.rings.number_field + sage: P = E.lift_x(1/3*a^2 + a + 5/3) # needs sage.rings.number_field + sage: L(P) # needs sage.rings.number_field 1.68207104397706 - 1.87873661686704*I - 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 + sage: xP, yP = [v(c) for c in P.xy()] # needs sage.rings.number_field + sage: L.e_log_RC(xP, yP) # needs sage.rings.number_field 1.68207104397706 - 1.87873661686704*I - 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 + sage: EC = EllipticCurve([v(ai) for ai in E.a_invariants()]) # needs sage.rings.number_field + sage: xP, yP = EC.lift_x(0).xy() # needs sage.rings.number_field + sage: L.e_log_RC(xP, yP) # needs sage.rings.number_field 2.06711431204080 - 1.73451485683471*I """ if prec is None: @@ -1583,22 +1583,22 @@ def elliptic_logarithm(self, P, prec=None, reduce=True): Some complex examples, taken from the paper by Cremona and Thongjunthug:: - 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: a4 = 9*i - 10 # needs sage.rings.number_field + sage: a6 = 21 - i # needs sage.rings.number_field + sage: E = EllipticCurve([0,0,0,a4,a6]) # needs sage.rings.number_field + sage: e1 = 3 - 2*i; e2 = 1 + i; e3 = -4 + i # needs sage.rings.number_field + sage: emb = K.embeddings(CC)[1] # needs sage.rings.number_field + sage: L = E.period_lattice(emb) # needs sage.rings.number_field + sage: P = E(2 - i, 4 + 2*i) # needs 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 # optional - sage.rings.number_field + sage: z = L.elliptic_logarithm(P, prec=100); z # needs sage.rings.number_field 0.70448375537782208460499649302 - 0.79246725643650979858266018068*I - sage: L.coordinates(z) # optional - sage.rings.number_field + sage: L.coordinates(z) # needs sage.rings.number_field (0.46247636364807931766105406092, 0.79497588726808704200760395829) Using ``reduce=False`` this step can be omitted. In this case @@ -1606,76 +1606,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 # optional - sage.rings.number_field + sage: z = L.elliptic_logarithm(P, prec=100, reduce=False); z # needs sage.rings.number_field 0.57002153834710752778063503023 + 0.46476340520469798857457031393*I - sage: L.coordinates(z) # optional - sage.rings.number_field + sage: L.coordinates(z) # needs 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) # optional - sage.rings.number_field + sage: L.elliptic_logarithm(E(e1, 0), prec=100) # needs sage.rings.number_field 0.64607575874356525952487867052 + 0.22379609053909448304176885364*I - sage: L.elliptic_logarithm(E(e2, 0), prec=100) # optional - sage.rings.number_field + sage: L.elliptic_logarithm(E(e2, 0), prec=100) # needs sage.rings.number_field 0.71330686725892253793705940192 - 0.40481924028150941053684639367*I - sage: L.elliptic_logarithm(E(e3, 0), prec=100) # optional - sage.rings.number_field + sage: L.elliptic_logarithm(E(e3, 0), prec=100) # needs 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)) # optional - sage.rings.number_field + sage: L.coordinates(2*L.elliptic_logarithm(E(e1, 0), prec=100)) # needs sage.rings.number_field (1.0000000000000000000000000000, 0.00000000000000000000000000000) - sage: L.coordinates(2*L.elliptic_logarithm(E(e2, 0), prec=100)) # optional - sage.rings.number_field + sage: L.coordinates(2*L.elliptic_logarithm(E(e2, 0), prec=100)) # needs sage.rings.number_field (1.0000000000000000000000000000, 1.0000000000000000000000000000) - sage: L.coordinates(2*L.elliptic_logarithm(E(e3, 0), prec=100)) # optional - sage.rings.number_field + sage: L.coordinates(2*L.elliptic_logarithm(E(e3, 0), prec=100)) # needs sage.rings.number_field (0.00000000000000000000000000000, 1.0000000000000000000000000000) :: - 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 + sage: a4 = -78*i + 104 # needs sage.rings.number_field + sage: a6 = -216*i - 312 # needs sage.rings.number_field + sage: E = EllipticCurve([0,0,0,a4,a6]) # needs sage.rings.number_field + sage: emb = K.embeddings(CC)[1] # needs sage.rings.number_field + sage: L = E.period_lattice(emb) # needs sage.rings.number_field + sage: P = E(3 + 2*i, 14 - 7*i) # needs sage.rings.number_field + sage: L.elliptic_logarithm(P) # needs sage.rings.number_field 0.297147783912228 - 0.546125549639461*I - sage: L.coordinates(L.elliptic_logarithm(P)) # optional - sage.rings.number_field + sage: L.coordinates(L.elliptic_logarithm(P)) # needs sage.rings.number_field (0.628653378040238, 0.371417754610223) - 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 + sage: e1 = 1 + 3*i; e2 = -4 - 12*i; e3 = -e1 - e2 # needs sage.rings.number_field + sage: L.coordinates(L.elliptic_logarithm(E(e1, 0))) # needs sage.rings.number_field (0.500000000000000, 0.500000000000000) - sage: L.coordinates(L.elliptic_logarithm(E(e2, 0))) # optional - sage.rings.number_field + sage: L.coordinates(L.elliptic_logarithm(E(e2, 0))) # needs sage.rings.number_field (1.00000000000000, 0.500000000000000) - sage: L.coordinates(L.elliptic_logarithm(E(e3, 0))) # optional - sage.rings.number_field + sage: L.coordinates(L.elliptic_logarithm(E(e3, 0))) # needs sage.rings.number_field (0.500000000000000, 0.000000000000000) TESTS: See :trac:`10026` and :trac:`11767`:: - 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 + sage: K. = QuadraticField(2) # needs sage.rings.number_field + sage: E = EllipticCurve([0, -1, 1, -3*w - 4, 3*w + 4]) # needs sage.rings.number_field + sage: T = E.simon_two_descent(lim1=20, lim3=5, limtriv=20) # needs sage.rings.number_field + sage: P, Q = T[2] # needs sage.rings.number_field + sage: embs = K.embeddings(CC) # needs sage.rings.number_field + sage: Lambda = E.period_lattice(embs[0]) # needs sage.rings.number_field + sage: Lambda.elliptic_logarithm(P, 100) # needs sage.rings.number_field 4.7100131126199672766973600998 sage: R. = QQ[] - 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 + sage: K. = NumberField(x^2 + x + 5) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,1,-3,-5]) # needs sage.rings.number_field + sage: P = E([0,a]) # needs sage.rings.number_field + sage: Lambda = P.curve().period_lattice(K.embeddings(ComplexField(600))[0]) # needs sage.rings.number_field + sage: Lambda.elliptic_logarithm(P, prec=600) # needs sage.rings.number_field -0.842248166487739393375018008381693990800588864069506187033873183845246233548058477561706400464057832396643843146464236956684557207157300006542470428493573195030603817094900751609464 - 0.571366031453267388121279381354098224265947866751130917440598461117775339240176310729173301979590106474259885638797913383502735083088736326391919063211421189027226502851390118943491*I - 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 + sage: K. = QuadraticField(-5) # needs sage.rings.number_field + sage: E = EllipticCurve([1,1,a,a,0]) # needs sage.rings.number_field + sage: P = E(0, 0) # needs sage.rings.number_field + sage: L = P.curve().period_lattice(K.embeddings(ComplexField())[0]) # needs sage.rings.number_field + sage: L.elliptic_logarithm(P, prec=500) # needs sage.rings.number_field 1.17058357737548897849026170185581196033579563441850967539191867385734983296504066660506637438866628981886518901958717288150400849746892393771983141354 - 1.13513899565966043682474529757126359416758251309237866586896869548539516543734207347695898664875799307727928332953834601460994992792519799260968053875*I - sage: L.elliptic_logarithm(P, prec=1000) # optional - sage.rings.number_field + sage: L.elliptic_logarithm(P, prec=1000) # needs sage.rings.number_field 1.17058357737548897849026170185581196033579563441850967539191867385734983296504066660506637438866628981886518901958717288150400849746892393771983141354014895386251320571643977497740116710952913769943240797618468987304985625823413440999754037939123032233879499904283600304184828809773650066658885672885 - 1.13513899565966043682474529757126359416758251309237866586896869548539516543734207347695898664875799307727928332953834601460994992792519799260968053875387282656993476491590607092182964878750169490985439873220720963653658829712494879003124071110818175013453207439440032582917366703476398880865439217473*I """ if not P.curve() is self.E: @@ -1749,52 +1749,52 @@ def elliptic_exponential(self, z, to_curve=True): Examples over number fields:: sage: x = polygen(QQ) - 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 + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: embs = K.embeddings(CC) # needs sage.rings.number_field + sage: E = EllipticCurve('37a') # needs sage.rings.number_field + sage: EK = E.change_ring(K) # needs sage.rings.number_field + sage: Li = [EK.period_lattice(e) for e in embs] # needs sage.rings.number_field + sage: P = EK(-1, -1) # needs sage.rings.number_field + sage: Q = EK(a - 1, 1 - a^2) # needs sage.rings.number_field + sage: zi = [L.elliptic_logarithm(P) for L in Li] # needs sage.rings.number_field + sage: [c.real() for c in Li[0].elliptic_exponential(zi[0])] # needs sage.rings.number_field [-1.00000000000000, -1.00000000000000, 1.00000000000000] - sage: [c.real() for c in Li[0].elliptic_exponential(zi[1])] # optional - sage.rings.number_field + sage: [c.real() for c in Li[0].elliptic_exponential(zi[1])] # needs sage.rings.number_field [-1.00000000000000, -1.00000000000000, 1.00000000000000] - sage: [c.real() for c in Li[0].elliptic_exponential(zi[2])] # optional - sage.rings.number_field + sage: [c.real() for c in Li[0].elliptic_exponential(zi[2])] # needs sage.rings.number_field [-1.00000000000000, -1.00000000000000, 1.00000000000000] - 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 + sage: zi = [L.elliptic_logarithm(Q) for L in Li] # needs sage.rings.number_field + sage: Li[0].elliptic_exponential(zi[0]) # needs 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 + sage: [embs[0](c) for c in Q] # needs 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 + sage: Li[1].elliptic_exponential(zi[1]) # needs 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 + sage: [embs[1](c) for c in Q] # needs 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 + sage: [c.real() for c in Li[2].elliptic_exponential(zi[2])] # needs sage.rings.number_field [0.259921049894873, -0.587401051968199, 1.00000000000000] - sage: [embs[2](c) for c in Q] # optional - sage.rings.number_field + sage: [embs[2](c) for c in Q] # needs 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) # 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 + sage: K. = QuadraticField(-5) # needs sage.rings.number_field + sage: L = E.change_ring(K).period_lattice(K.places()[0]) # needs sage.rings.number_field + sage: L.elliptic_exponential(CDF(.1,.1)) # needs 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 + sage: L.elliptic_exponential(CDF(.1,.1), to_curve=False) # needs sage.rings.number_field (0.0000142854026029447 - 49.9960001066650*I, 500.040282501900 + 500.039711098263*I) @@ -1810,21 +1810,21 @@ def elliptic_exponential(self, z, to_curve=True): :: sage: E = EllipticCurve('37a') - 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 + sage: K. = QuadraticField(-5) # needs sage.rings.number_field + sage: L = E.change_ring(K).period_lattice(K.places()[0]) # needs sage.rings.number_field + sage: P = L.elliptic_exponential(0); P # needs sage.rings.number_field (0.000000000000000 : 1.00000000000000 : 0.000000000000000) - sage: P.parent() # optional - sage.rings.number_field + sage: P.parent() # needs 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 Very small `z` are handled properly (see :trac:`8820`):: - 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: E = EllipticCurve([0,0,0,a,0]) # needs sage.rings.number_field + sage: L = E.period_lattice(K.complex_embeddings()[0]) # needs sage.rings.number_field + sage: L.elliptic_exponential(1e-100) # needs sage.rings.number_field (0.000000000000000 : 1.00000000000000 : 0.000000000000000) The elliptic exponential of `z` is returned as (0 : 1 : 0) if @@ -1833,9 +1833,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() # optional - sage.rings.number_field + sage: L.elliptic_exponential((RealField(415)(1e-100))).is_zero() # needs sage.rings.number_field True - sage: L.elliptic_exponential((RealField(420)(1e-100))).is_zero() # optional - sage.rings.number_field + sage: L.elliptic_exponential((RealField(420)(1e-100))).is_zero() # needs sage.rings.number_field False """ C = z.parent() diff --git a/src/sage/schemes/elliptic_curves/saturation.py b/src/sage/schemes/elliptic_curves/saturation.py index c75972e7f02..095b5b1be12 100644 --- a/src/sage/schemes/elliptic_curves/saturation.py +++ b/src/sage/schemes/elliptic_curves/saturation.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.finite_rings sage.rings.number_field +# sage.doctest: needs sage.rings.finite_rings sage.rings.number_field r""" Saturation of Mordell-Weil groups of elliptic curves over number fields diff --git a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py index 16fd424bde6..4bdaed4f3c7 100644 --- a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py +++ b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py @@ -446,9 +446,9 @@ def __init__(self, E=None, urst=None, F=None): Check for :trac:`33215`:: sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - 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 + sage: E = EllipticCurve(GF(71^2), [5,5]) # needs sage.rings.finite_rings + sage: iso = WeierstrassIsomorphism(E, (1,2,3,4)) # needs sage.rings.finite_rings + sage: ~iso # indirect doctest # needs 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 @@ -456,7 +456,7 @@ def __init__(self, E=None, urst=None, F=None): Test for :trac:`33312`:: - sage: type(iso.degree()) # optional - sage.rings.finite_rings + sage: type(iso.degree()) # needs sage.rings.finite_rings """ from .ell_generic import is_EllipticCurve @@ -535,16 +535,16 @@ def _comparison_impl(left, right, op): sage: w1 == w2 False - 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 + sage: E = EllipticCurve_from_j(GF(7)(0)) # needs sage.rings.finite_rings + sage: F = E.change_weierstrass_model(2,3,4,5) # needs sage.rings.finite_rings + sage: a = E.isomorphisms(F) # needs sage.rings.finite_rings + sage: b = [w*a[0] for w in F.automorphisms()] # needs sage.rings.finite_rings + sage: b.sort() # needs sage.rings.finite_rings + sage: a == b # needs sage.rings.finite_rings True - 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 + sage: c = [a[0]*w for w in E.automorphisms()] # needs sage.rings.finite_rings + sage: c.sort() # needs sage.rings.finite_rings + sage: a == c # needs sage.rings.finite_rings True """ if not isinstance(left, WeierstrassIsomorphism) or not isinstance(right, WeierstrassIsomorphism): @@ -590,17 +590,17 @@ def _eval(self, P): EXAMPLES:: sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: E = EllipticCurve([i, 0]); E # optional - sage.rings.number_field + sage: E = EllipticCurve([i, 0]); E # needs 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 + sage: iso = WeierstrassIsomorphism(E, (i,1,2,3)) # needs sage.rings.number_field + sage: P = E.change_ring(QQbar).lift_x(QQbar.random_element()) # needs sage.rings.number_field + sage: Q = iso._eval(P) # needs sage.rings.number_field + sage: Q.curve() # needs 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 + sage: y = next(filter(bool, iter(QQbar.random_element, None))) # sample until nonzero # needs sage.rings.number_field + sage: iso._eval((0, y, 0)) == 0 # needs sage.rings.number_field True """ if self._domain.defining_polynomial()(*P): @@ -637,14 +637,14 @@ def __call__(self, P): Check that copying the order over works:: - 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 + sage: E = EllipticCurve(GF(431^2), [1,0]) # needs sage.rings.finite_rings + sage: i = next(a for a in E.automorphisms() if a^2 == -a^24) # needs sage.rings.finite_rings + sage: P,_ = E.gens() # needs sage.rings.finite_rings + sage: P._order # needs sage.rings.finite_rings 432 - sage: i(P)._order # optional - sage.rings.finite_rings + sage: i(P)._order # needs sage.rings.finite_rings 432 - sage: E(i(P))._order # optional - sage.rings.finite_rings + sage: E(i(P))._order # needs sage.rings.finite_rings 432 """ if P[2] == 0: @@ -768,11 +768,11 @@ def rational_maps(self): :: - 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 + sage: E = EllipticCurve(GF(65537), [1,1,1,1,1]) # needs sage.rings.finite_rings + sage: w = E.isomorphism_to(E.short_weierstrass_model()) # needs sage.rings.finite_rings + sage: f,g = w.rational_maps() # needs sage.rings.finite_rings + sage: P = E.random_point() # needs sage.rings.finite_rings + sage: w(P).xy() == (f(P.xy()), g(P.xy())) # needs sage.rings.finite_rings True TESTS: @@ -855,8 +855,8 @@ def is_separable(self): EXAMPLES:: - 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 + sage: E = EllipticCurve(GF(31337), [0,1]) # needs sage.rings.finite_rings + sage: {f.is_separable() for f in E.automorphisms()} # needs sage.rings.finite_rings {True} """ return True @@ -870,9 +870,9 @@ def dual(self): EXAMPLES:: sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - 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 + sage: E = EllipticCurve(QuadraticField(-3), [0,1]) # needs sage.rings.number_field + sage: w = WeierstrassIsomorphism(E, (CyclotomicField(3).gen(),0,0,0)) # needs sage.rings.number_field + sage: (w.dual() * w).rational_maps() # needs sage.rings.number_field (x, y) :: @@ -907,22 +907,22 @@ def __neg__(self): :: sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - 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 + sage: K. = QuadraticField(-3) # needs sage.rings.number_field + sage: E = EllipticCurve(K, [0,1]) # needs sage.rings.number_field + sage: w = WeierstrassIsomorphism(E, (CyclotomicField(3).gen(),0,0,0)) # needs sage.rings.number_field + sage: w.tuple() # needs sage.rings.number_field (1/2*a - 1/2, 0, 0, 0) - sage: (-w).tuple() # optional - sage.rings.number_field + sage: (-w).tuple() # needs sage.rings.number_field (-1/2*a + 1/2, 0, 0, 0) - sage: (-w)^3 == -(w^3) # optional - sage.rings.number_field + sage: (-w)^3 == -(w^3) # needs sage.rings.number_field True :: sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism, identity_morphism - 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 + sage: E = EllipticCurve(QuadraticField(-1), [1,0]) # needs sage.rings.number_field + sage: t = WeierstrassIsomorphism(E, (i,0,0,0)) # needs sage.rings.number_field + sage: -t^2 == identity_morphism(E) # needs sage.rings.number_field True """ a1,_,a3,_,_ = self._domain.a_invariants() @@ -943,8 +943,8 @@ def scaling_factor(self): EXAMPLES:: - 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 + sage: E = EllipticCurve(QQbar, [0,1]) # needs sage.rings.number_field + sage: all(f.scaling_factor() == f.formal()[1] for f in E.automorphisms()) # needs sage.rings.number_field True ALGORITHM: The scaling factor equals the `u` component of diff --git a/src/sage/schemes/generic/divisor_group.py b/src/sage/schemes/generic/divisor_group.py index 1a6cc6ca6b6..a4dc84b7967 100644 --- a/src/sage/schemes/generic/divisor_group.py +++ b/src/sage/schemes/generic/divisor_group.py @@ -210,9 +210,9 @@ def _an_element_(self): EXAMPLES:: sage: A. = AffineSpace(2, CC) # optional - sage.rings.real_mpfr - sage: C = Curve(y^2 - x^9 - x) # optional - sage.rings.real_mpfr + sage: C = Curve(y^2 - x^9 - x) # optional - sage.rings.real_mpfr sage.schemes sage: from sage.schemes.generic.divisor_group import DivisorGroup - sage: DivisorGroup(C).an_element() # indirect test # optional - sage.rings.real_mpfr + sage: DivisorGroup(C).an_element() # indirect test # optional - sage.rings.real_mpfr sage.schemes 0 """ return self._scheme.divisor([], base_ring=self.base_ring(), check=False, reduce=False) @@ -230,8 +230,8 @@ def base_extend(self, R): Divisor groups are unique:: sage: A. = AffineSpace(2, CC) # optional - sage.rings.real_mpfr - sage: C = Curve(y^2 - x^9 - x) # optional - sage.rings.real_mpfr - sage: DivisorGroup(C, ZZ).base_extend(QQ) is DivisorGroup(C, QQ) # optional - sage.rings.real_mpfr + sage: C = Curve(y^2 - x^9 - x) # optional - sage.rings.real_mpfr sage.schemes + sage: DivisorGroup(C, ZZ).base_extend(QQ) is DivisorGroup(C, QQ) # optional - sage.rings.real_mpfr sage.schemes True """ if self.base_ring().has_coerce_map_from(R): @@ -251,6 +251,7 @@ def _element_constructor_(self, x, check=True, reduce=True): EXAMPLES:: + sage: # needs sage.rings.real_mpfr sage.schemes sage: A. = AffineSpace(2, CC) # optional - sage.rings.real_mpfr sage: C = Curve(y^2 - x^9 - x) # optional - sage.rings.real_mpfr sage: DivZZ = C.divisor_group(ZZ) # optional - sage.rings.real_mpfr diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index 43215ec3ac6..d0493a01be4 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -1426,7 +1426,7 @@ def change_ring(self, R, check=True): 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) + sage: f.change_ring(RR) # optional - sage.rings.real_mpfr 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 diff --git a/src/sage/schemes/projective/projective_homset.py b/src/sage/schemes/projective/projective_homset.py index 8f6a4568a6c..d1681cfc850 100644 --- a/src/sage/schemes/projective/projective_homset.py +++ b/src/sage/schemes/projective/projective_homset.py @@ -160,6 +160,7 @@ def points(self, **kwds): :: + sage: # needs sage.rings.complex_double 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()) From 029dc4df87445f55d5e0a58d7a2c182183d51f1d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 2 Jul 2023 22:55:41 -0700 Subject: [PATCH 035/423] sage.{modular,schemes}: Add # needs --- src/sage/modular/cusps_nf.py | 13 ++++++---- .../modform_hecketriangle/analytic_type.py | 1 + .../modular/overconvergent/weightspace.py | 24 ++++++++++++------- .../modular/pollack_stevens/padic_lseries.py | 2 +- .../schemes/elliptic_curves/padic_lseries.py | 2 +- src/sage/schemes/elliptic_curves/padics.py | 2 +- .../hyperelliptic_padic_field.py | 1 + .../riemann_surfaces/riemann_surface.py | 8 +++++-- 8 files changed, 35 insertions(+), 18 deletions(-) diff --git a/src/sage/modular/cusps_nf.py b/src/sage/modular/cusps_nf.py index 7e8ffa6658c..8d8b580a74e 100644 --- a/src/sage/modular/cusps_nf.py +++ b/src/sage/modular/cusps_nf.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.rings.number_field r""" The set `\mathbb{P}^1(K)` of cusps of a number field `K` @@ -62,7 +63,7 @@ sage: Gamma0_NFCusps(N) [Cusp [0: 1] of Number Field in a with defining polynomial x^2 + 5, - Cusp [1: 3] of Number Field in a with defining polynomial x^2 + 5, + Cusp [1: 3] of Number Field in a with defining polynomial x^2 + 5, ...] """ # **************************************************************************** @@ -859,7 +860,7 @@ def ABmatrix(self): sage: M = alpha.ABmatrix() sage: M # random [-a^2 - a - 1, -3*a - 7, 8, -2*a^2 - 3*a + 4] - sage: M[0] == alpha.numerator() and M[2]==alpha.denominator() + sage: M[0] == alpha.numerator() and M[2] == alpha.denominator() True An AB-matrix associated to a cusp alpha will send Infinity to alpha: @@ -870,7 +871,7 @@ def ABmatrix(self): sage: M = alpha.ABmatrix() sage: (k.ideal(M[1], M[3])*alpha.ideal()).is_principal() True - sage: M[0] == alpha.numerator() and M[2]==alpha.denominator() + sage: M[0] == alpha.numerator() and M[2] == alpha.denominator() True sage: NFCusp(k, oo).apply(M) == alpha True @@ -1249,7 +1250,8 @@ def units_mod_ideal(I): sage: from sage.modular.cusps_nf import units_mod_ideal sage: k. = NumberField(x^3 + 11) sage: k.unit_group() - Unit group with structure C2 x Z of Number Field in a with defining polynomial x^3 + 11 + Unit group with structure C2 x Z of + Number Field in a with defining polynomial x^3 + 11 sage: I = k.ideal(5, a + 1) sage: units_mod_ideal(I) [1, @@ -1261,7 +1263,8 @@ def units_mod_ideal(I): sage: from sage.modular.cusps_nf import units_mod_ideal sage: k. = NumberField(x^4 - x^3 -21*x^2 + 17*x + 133) sage: k.unit_group() - Unit group with structure C6 x Z of Number Field in a with defining polynomial x^4 - x^3 - 21*x^2 + 17*x + 133 + Unit group with structure C6 x Z of + Number Field in a with defining polynomial x^4 - x^3 - 21*x^2 + 17*x + 133 sage: I = k.ideal(3) sage: U = units_mod_ideal(I) sage: all(U[j].is_unit() and (U[j] not in I) for j in range(len(U))) diff --git a/src/sage/modular/modform_hecketriangle/analytic_type.py b/src/sage/modular/modform_hecketriangle/analytic_type.py index 7b2618991df..0c809b3328c 100644 --- a/src/sage/modular/modform_hecketriangle/analytic_type.py +++ b/src/sage/modular/modform_hecketriangle/analytic_type.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.graphs r""" Analytic types of modular forms diff --git a/src/sage/modular/overconvergent/weightspace.py b/src/sage/modular/overconvergent/weightspace.py index 8f0ecc8b8c0..5cedff8a101 100644 --- a/src/sage/modular/overconvergent/weightspace.py +++ b/src/sage/modular/overconvergent/weightspace.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: optional - sage.rings.padics r""" The space of `p`-adic weights @@ -17,7 +17,8 @@ sage: W = pAdicWeightSpace(17) sage: W - Space of 17-adic weight-characters defined over 17-adic Field with capped relative precision 20 + Space of 17-adic weight-characters + defined over 17-adic Field with capped relative precision 20 sage: R. = QQ[] sage: L = Qp(17).extension(x^2 - 17, names='a'); L.rename('L') sage: W.base_extend(L) @@ -101,7 +102,8 @@ def WeightSpace_constructor(p, base_ring=None): EXAMPLES:: sage: pAdicWeightSpace(3) # indirect doctest - Space of 3-adic weight-characters defined over 3-adic Field with capped relative precision 20 + Space of 3-adic weight-characters + defined over 3-adic Field with capped relative precision 20 sage: pAdicWeightSpace(3, QQ) Space of 3-adic weight-characters defined over Rational Field sage: pAdicWeightSpace(10) @@ -248,11 +250,13 @@ def base_extend(self, R): sage: W = pAdicWeightSpace(3, QQ) sage: W.base_extend(Qp(3)) - Space of 3-adic weight-characters defined over 3-adic Field with capped relative precision 20 + Space of 3-adic weight-characters + defined over 3-adic Field with capped relative precision 20 sage: W.base_extend(IntegerModRing(12)) Traceback (most recent call last): ... - TypeError: No coercion map from 'Rational Field' to 'Ring of integers modulo 12' is defined + TypeError: No coercion map from 'Rational Field' + to 'Ring of integers modulo 12' is defined """ if R.has_coerce_map_from(self.base_ring()): return WeightSpace_constructor(self.prime(), R) @@ -356,7 +360,9 @@ def pAdicEisensteinSeries(self, ring, prec=20): sage: kappa = pAdicWeightSpace(3)(3, DirichletGroup(3,QQ).0) sage: kappa.pAdicEisensteinSeries(QQ[['q']], 20) - 1 - 9*q + 27*q^2 - 9*q^3 - 117*q^4 + 216*q^5 + 27*q^6 - 450*q^7 + 459*q^8 - 9*q^9 - 648*q^10 + 1080*q^11 - 117*q^12 - 1530*q^13 + 1350*q^14 + 216*q^15 - 1845*q^16 + 2592*q^17 + 27*q^18 - 3258*q^19 + O(q^20) + 1 - 9*q + 27*q^2 - 9*q^3 - 117*q^4 + 216*q^5 + 27*q^6 - 450*q^7 + 459*q^8 + - 9*q^9 - 648*q^10 + 1080*q^11 - 117*q^12 - 1530*q^13 + 1350*q^14 + 216*q^15 + - 1845*q^16 + 2592*q^17 + 27*q^18 - 3258*q^19 + O(q^20) """ if not self.is_even(): raise ValueError("Eisenstein series not defined for odd weight-characters") @@ -570,7 +576,8 @@ def chi(self): sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0^14) sage: kappa.chi() - Dirichlet character modulo 29 of conductor 29 mapping 2 |--> 28 + 28*29 + 28*29^2 + ... + O(29^20) + Dirichlet character modulo 29 of conductor 29 + mapping 2 |--> 28 + 28*29 + 28*29^2 + ... + O(29^20) """ return self._chi @@ -667,7 +674,8 @@ def Lvalue(self): sage: pAdicWeightSpace(7)(5, DirichletGroup(7, Qp(7)).0^4).Lvalue() 0 sage: pAdicWeightSpace(7)(6, DirichletGroup(7, Qp(7)).0^4).Lvalue() - 1 + 2*7 + 7^2 + 3*7^3 + 3*7^5 + 4*7^6 + 2*7^7 + 5*7^8 + 2*7^9 + 3*7^10 + 6*7^11 + 2*7^12 + 3*7^13 + 5*7^14 + 6*7^15 + 5*7^16 + 3*7^17 + 6*7^18 + O(7^19) + 1 + 2*7 + 7^2 + 3*7^3 + 3*7^5 + 4*7^6 + 2*7^7 + 5*7^8 + 2*7^9 + 3*7^10 + 6*7^11 + + 2*7^12 + 3*7^13 + 5*7^14 + 6*7^15 + 5*7^16 + 3*7^17 + 6*7^18 + O(7^19) """ if self._k > 0: return -self._chi.bernoulli(self._k) / self._k diff --git a/src/sage/modular/pollack_stevens/padic_lseries.py b/src/sage/modular/pollack_stevens/padic_lseries.py index 396a96af90e..748b5dc9993 100644 --- a/src/sage/modular/pollack_stevens/padic_lseries.py +++ b/src/sage/modular/pollack_stevens/padic_lseries.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.ring.padics r""" `p`-adic `L`-series attached to overconvergent eigensymbols diff --git a/src/sage/schemes/elliptic_curves/padic_lseries.py b/src/sage/schemes/elliptic_curves/padic_lseries.py index a6ac5c30af5..00f27d6e1fe 100644 --- a/src/sage/schemes/elliptic_curves/padic_lseries.py +++ b/src/sage/schemes/elliptic_curves/padic_lseries.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: optional - sage.rings.padics r""" `p`-adic `L`-functions of elliptic curves diff --git a/src/sage/schemes/elliptic_curves/padics.py b/src/sage/schemes/elliptic_curves/padics.py index 51f7cc3db90..6244c83cbab 100644 --- a/src/sage/schemes/elliptic_curves/padics.py +++ b/src/sage/schemes/elliptic_curves/padics.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.rings.padics # # All these methods are imported in EllipticCurve_rational_field, # so there is no reason to add this module to the documentation. diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py index 5111e08faf1..ad7428b1cb9 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.rings.padics """ Hyperelliptic curves over a `p`-adic field """ diff --git a/src/sage/schemes/riemann_surfaces/riemann_surface.py b/src/sage/schemes/riemann_surfaces/riemann_surface.py index 917de00d7b0..58027b94c4e 100644 --- a/src/sage/schemes/riemann_surfaces/riemann_surface.py +++ b/src/sage/schemes/riemann_surfaces/riemann_surface.py @@ -1,3 +1,4 @@ +# sage.doctest: needs scipy sage.graphs sage.groups r""" Riemann matrices and endomorphism rings of algebraic Riemann surfaces @@ -124,6 +125,7 @@ from sage.misc.cachefunc import cached_method from sage.misc.flatten import flatten from sage.misc.functional import numerical_approx +from sage.misc.lazy_import import lazy_import from sage.misc.misc_c import prod from sage.modules.free_module import VectorSpace from sage.modules.free_module_integer import IntegerLattice @@ -134,12 +136,13 @@ from sage.rings.infinity import Infinity from sage.rings.integer_ring import ZZ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing -from sage.rings.qqbar import number_field_elements_from_algebraics from sage.rings.rational_field import QQ from sage.rings.real_mpfr import RealField from sage.schemes.curves.constructor import Curve import sage.libs.mpmath.all as mpall +lazy_import('sage.rings.qqbar', 'number_field_elements_from_algebraics') + def voronoi_ghost(cpoints, n=6, CC=CDF): r""" @@ -2372,7 +2375,8 @@ def period_matrix(self): easier to test.:: sage: parent(M) - Full MatrixSpace of 3 by 6 dense matrices over Complex Field with 30 bits of precision + Full MatrixSpace of 3 by 6 dense matrices + over Complex Field with 30 bits of precision sage: M.rank() 3 From f5a7cbe000f2c06af145c151f3e2ced2f39fd28e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 3 Jul 2023 00:04:58 -0700 Subject: [PATCH 036/423] sage.schemes: Update # needs --- src/sage/schemes/curves/projective_curve.py | 590 +++++++++--------- src/sage/schemes/elliptic_curves/cm.py | 26 +- .../elliptic_curves/ell_finite_field.py | 99 ++- .../schemes/elliptic_curves/ell_local_data.py | 28 +- .../elliptic_curves/ell_padic_field.py | 8 +- 5 files changed, 417 insertions(+), 334 deletions(-) diff --git a/src/sage/schemes/curves/projective_curve.py b/src/sage/schemes/curves/projective_curve.py index b27ab071863..1e00d84918e 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) # 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 + sage: k = GF(2) + sage: P. = ProjectiveSpace(k, 2) + sage: C = Curve(x^2*z - y^3, P) # needs sage.rings.finite_rings + sage: C.genus() # needs sage.rings.finite_rings 0 - sage: C.function_field() # optional - sage.rings.finite_rings + sage: C.function_field() # needs 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() # optional - sage.rings.finite_rings + sage: C.closed_points() # needs sage.rings.finite_rings [Point (x, y), Point (y, z), Point (x + z, y + z)] - sage: C.closed_points(2) # optional - sage.rings.finite_rings + sage: C.closed_points(2) # needs sage.rings.finite_rings [Point (y^2 + y*z + z^2, x + z)] - sage: C.closed_points(3) # optional - sage.rings.finite_rings + sage: C.closed_points(3) # needs 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() # optional - sage.rings.finite_rings + sage: C.singular_closed_points() # needs sage.rings.finite_rings [Point (x, y)] - sage: p = _[0] # optional - sage.rings.finite_rings - sage: p.places() # a unibranch singularity, that is, a cusp # optional - sage.rings.finite_rings + sage: p = _[0] # needs sage.rings.finite_rings + sage: p.places() # a unibranch singularity, that is, a cusp # needs sage.rings.finite_rings [Place (1/y)] - sage: pls = _[0] # optional - sage.rings.finite_rings - sage: C.place_to_closed_point(pls) # optional - sage.rings.finite_rings + sage: pls = _[0] # needs sage.rings.finite_rings + sage: C.place_to_closed_point(pls) # needs 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) # 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 + sage: fx = C(x/z) # needs sage.rings.finite_rings + sage: fy = C(y/z) # needs sage.rings.finite_rings + sage: fx^2 - fy^3 # needs sage.rings.finite_rings 0 - sage: fx.divisor() # optional - sage.rings.finite_rings + sage: fx.divisor() # needs sage.rings.finite_rings 3*Place (1/y) - 3*Place (y) - sage: p, = fx.poles() # optional - sage.rings.finite_rings - sage: p # optional - sage.rings.finite_rings + sage: p, = fx.poles() # needs sage.rings.finite_rings + sage: p # needs sage.rings.finite_rings Place (y) - sage: C.place_to_closed_point(p) # optional - sage.rings.finite_rings + sage: C.place_to_closed_point(p) # needs sage.rings.finite_rings Point (y, z) - sage: _.rational_point() # optional - sage.rings.finite_rings + sage: _.rational_point() # needs sage.rings.finite_rings (1 : 0 : 0) - sage: _.closed_point() # optional - sage.rings.finite_rings + sage: _.closed_point() # needs sage.rings.finite_rings Point (y, z) - sage: _.place() # optional - sage.rings.finite_rings + sage: _.place() # needs sage.rings.finite_rings Place (y) Integral projective curves over `\QQ` @@ -188,16 +188,16 @@ class ProjectiveCurve(Curve_generic, AlgebraicScheme_subscheme_projective): EXAMPLES:: - 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 + 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 # needs 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) # 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 + sage: K. = CyclotomicField(11) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 3) # needs sage.rings.number_field + sage: C = Curve([y*w - u*z^2 - x^2, x*w - 3*u^2*z*w], P); C # needs 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 """ @@ -299,12 +299,12 @@ def projection(self, P=None, PS=None): EXAMPLES:: - 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 + sage: K. = CyclotomicField(3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 3) # needs sage.rings.number_field + sage: C = Curve([y*w - x^2, z*w^2 - a*x^3], P) # needs sage.rings.number_field + sage: L. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: proj1 = C.projection(PS=L) # needs sage.rings.number_field + sage: proj1 # needs 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 @@ -314,10 +314,10 @@ def projection(self, P=None, PS=None): (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) - sage: proj1[1].ambient_space() is L + sage: proj1[1].ambient_space() is L # needs sage.rings.number_field True - sage: proj2 = C.projection() - sage: proj2[1].ambient_space() is L + sage: proj2 = C.projection() # needs sage.rings.number_field + sage: proj2[1].ambient_space() is L # needs sage.rings.number_field False :: @@ -338,20 +338,20 @@ def projection(self, P=None, PS=None): :: - 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 + sage: P. = ProjectiveSpace(GF(2), 3) + sage: C = P.curve([(x - y)*(x - z)*(x - w)*(y - z)*(y - w), # needs sage.rings.finite_rings ....: x*y*z*w*(x + y + z + w)]) - sage: C.projection() # optional - sage.rings.finite_rings + sage: C.projection() # needs 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) # 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 + 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]) # needs sage.rings.finite_rings + sage: L. = ProjectiveSpace(GF(7), 3) + sage: C.projection(PS=L) # needs 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 @@ -360,8 +360,8 @@ def projection(self, P=None, PS=None): (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) # optional - sage.rings.finite_rings - sage: C.projection(PS=Q) # optional - sage.rings.finite_rings + sage: Q. = ProjectiveSpace(GF(7), 2) + sage: C.projection(PS=Q) # needs sage.rings.finite_rings Traceback (most recent call last): ... TypeError: (=Projective Space of dimension 2 over Finite Field of @@ -533,9 +533,9 @@ def plane_projection(self, PP=None): :: - 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 + 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]) # needs sage.rings.finite_rings + sage: C.plane_projection() # needs 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 @@ -548,9 +548,9 @@ def plane_projection(self, PP=None): :: - 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 + sage: P. = ProjectiveSpace(GF(17), 2) + sage: C = P.curve(x^2 - y*z - z^2) # needs sage.rings.finite_rings + sage: C.plane_projection() # needs sage.rings.finite_rings Traceback (most recent call last): ... TypeError: this curve is already a plane curve @@ -590,16 +590,16 @@ class ProjectivePlaneCurve(ProjectiveCurve): A projective plane curve defined over an algebraic closure of `\QQ`:: - 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 + sage: P. = ProjectiveSpace(QQbar, 2) # needs sage.rings.number_field + sage: set_verbose(-1) # suppress warnings for slow computation + sage: C = Curve([y*z - x^2 - QQbar.gen()*z^2], P); C # needs 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) # optional - sage.rings.finite_rings - sage: C = Curve([y^2*z - x*z^2 - z^3], P); C # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(5^2, 'v'), 2) # needs sage.rings.finite_rings + sage: C = Curve([y^2*z - x*z^2 - z^3], P); C # needs 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 """ @@ -644,18 +644,18 @@ def divisor_of_function(self, r): EXAMPLES:: - 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 + 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) # needs sage.rings.finite_rings + sage: K = FractionField(R) + sage: r = 1/x + sage: C.divisor_of_function(r) # not implemented # needs sage.rings.finite_rings [[-1, (0, 0, 1)]] - sage: r = 1/x^3 # optional - sage.rings.finite_rings - sage: C.divisor_of_function(r) # todo: not implemented !!!! # optional - sage.rings.finite_rings + sage: r = 1/x^3 + sage: C.divisor_of_function(r) # not implemented # needs sage.rings.finite_rings [[-3, (0, 0, 1)]] """ F = self.base_ring() @@ -690,12 +690,12 @@ def local_coordinates(self, pt, n): EXAMPLES:: - 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 + 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) # needs sage.rings.finite_rings + sage: pt = C([2,3,1]) # needs sage.rings.finite_rings + sage: C.local_coordinates(pt,9) # not implemented, needs 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] """ @@ -769,25 +769,25 @@ def plot(self, *args, **kwds): sage: R. = QQ[] sage: C = Curve(x^3 - y^2*z) - sage: C.plot() # optional - sage.plot + sage: C.plot() # needs sage.plot Graphics object consisting of 1 graphics primitive The other affine patches of the same curve:: - sage: C.plot(patch=0) # optional - sage.plot + sage: C.plot(patch=0) # needs sage.plot Graphics object consisting of 1 graphics primitive - sage: C.plot(patch=1) # optional - sage.plot + sage: C.plot(patch=1) # needs sage.plot Graphics object consisting of 1 graphics primitive An elliptic curve:: sage: E = EllipticCurve('101a') - sage: C = Curve(E) - sage: C.plot() # optional - sage.plot + sage: C = Curve(E) # needs sage.rings.number_field + sage: C.plot() # needs sage.plot Graphics object consisting of 1 graphics primitive - sage: C.plot(patch=0) # optional - sage.plot + sage: C.plot(patch=0) # needs sage.plot Graphics object consisting of 1 graphics primitive - sage: C.plot(patch=1) # optional - sage.plot + sage: C.plot(patch=1) # needs sage.plot Graphics object consisting of 1 graphics primitive A hyperelliptic curve:: @@ -795,11 +795,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() # optional - sage.plot + sage: C.plot() # needs sage.plot Graphics object consisting of 1 graphics primitive - sage: C.plot(patch=0) # optional - sage.plot + sage: C.plot(patch=0) # needs sage.plot Graphics object consisting of 1 graphics primitive - sage: C.plot(patch=1) # optional - sage.plot + sage: C.plot(patch=1) # needs sage.plot Graphics object consisting of 1 graphics primitive """ # if user has not specified a favorite affine patch, take the @@ -838,19 +838,19 @@ def is_singular(self, P=None): Over a finite field:: - 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 + sage: F = GF(19) + sage: P2. = ProjectiveSpace(F, 2) + sage: C = Curve(X^3 + Y^3 + Z^3) # needs sage.rings.finite_rings + sage: C.is_singular() # needs sage.rings.finite_rings False - sage: D = Curve(X^4 - X*Z^3) # optional - sage.rings.finite_rings - sage: D.is_singular() # optional - sage.rings.finite_rings + sage: D = Curve(X^4 - X*Z^3) # needs sage.rings.finite_rings + sage: D.is_singular() # needs sage.rings.finite_rings True - sage: E = Curve(X^5 + 19*Y^5 + Z^5) # optional - sage.rings.finite_rings - sage: E.is_singular() # optional - sage.rings.finite_rings + sage: E = Curve(X^5 + 19*Y^5 + Z^5) # needs sage.rings.finite_rings + sage: E.is_singular() # needs sage.rings.finite_rings True - sage: E = Curve(X^5 + 9*Y^5 + Z^5) # optional - sage.rings.finite_rings - sage: E.is_singular() # optional - sage.rings.finite_rings + sage: E = Curve(X^5 + 9*Y^5 + Z^5) # needs sage.rings.finite_rings + sage: E.is_singular() # needs sage.rings.finite_rings False Over `\CC`:: @@ -858,20 +858,20 @@ def is_singular(self, P=None): sage: F = CC sage: P2. = ProjectiveSpace(F, 2) sage: C = Curve(X) - sage: C.is_singular() + sage: C.is_singular() # needs sage.rings.function_field False sage: D = Curve(Y^2*Z - X^3) - sage: D.is_singular() + sage: D.is_singular() # needs sage.rings.function_field True sage: E = Curve(Y^2*Z - X^3 + Z^3) - sage: E.is_singular() + sage: E.is_singular() # needs sage.rings.function_field False Showing that :trac:`12187` is fixed:: - 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 + sage: F. = GF(2)[] + sage: G = Curve(X^2 + Y*Z) + sage: G.is_singular() # needs sage.rings.finite_rings False :: @@ -879,7 +879,7 @@ def is_singular(self, P=None): sage: P. = ProjectiveSpace(CC, 2) sage: C = Curve([y^4 - x^3*z], P) sage: Q = P([0,0,1]) - sage: C.is_singular() + sage: C.is_singular() # needs sage.rings.function_field True """ if P is None: @@ -929,15 +929,15 @@ def tangents(self, P, factor=True): EXAMPLES:: sage: set_verbose(-1) - 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 + sage: P. = ProjectiveSpace(QQbar, 2) # needs sage.rings.number_field + sage: C = Curve([x^3*y + 2*x^2*y^2 + x*y^3 + x^3*z # needs 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 + sage: Q = P([0,0,1]) # needs sage.rings.number_field + sage: C.tangents(Q) # needs 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 + sage: C.tangents(Q, factor=False) # needs sage.rings.number_field [6*x^3 + 42*x^2*y + 84*x*y^2 + 54*y^3] :: @@ -1009,15 +1009,15 @@ def is_ordinary_singularity(self, P): :: sage: R. = QQ[] - 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 + sage: K. = NumberField(a^2 - 3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs 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 # needs 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 + sage: Q = P([0,1,1]) + sage: C.is_ordinary_singularity(Q) # needs sage.rings.number_field True :: @@ -1070,9 +1070,9 @@ 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]) # optional - sage.rings.finite_rings - sage: C.quadratic_transform() # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(17), 2) + sage: C = P.curve([y^7*z^2 - 16*x^9 + x*y*z^7 + 2*z^9]) # needs sage.rings.finite_rings + sage: C.quadratic_transform() # needs 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 @@ -1137,15 +1137,15 @@ def excellent_position(self, Q): :: sage: R. = QQ[] - 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 + sage: K. = NumberField(a^2 - 3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs 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 # needs 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 + sage: Q = P([1,0,0]) + sage: C.excellent_position(Q) # needs sage.rings.number_field Scheme morphism: From: Projective Plane Curve over Number Field in b with defining polynomial a^2 - 3 @@ -1175,12 +1175,12 @@ def excellent_position(self, Q): :: sage: set_verbose(-1) - 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 + sage: a = QQbar(sqrt(2)) # needs sage.rings.number_field sage.symbolic + sage: P. = ProjectiveSpace(QQbar, 2) # needs sage.rings.number_field + sage: C = Curve([(-1/4*a)*x^3 + (-3/4*a)*x^2*y # needs sage.rings.number_field sage.symbolic ....: + (-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 + sage: Q = P([0,0,1]) + sage: C.excellent_position(Q) # needs sage.rings.number_field sage.symbolic Scheme morphism: From: Projective Plane Curve over Algebraic Field defined by (-0.3535533905932738?)*x^3 + (-1.060660171779822?)*x^2*y @@ -1332,10 +1332,10 @@ def ordinary_model(self): EXAMPLES:: sage: set_verbose(-1) - 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 + sage: K = QuadraticField(3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: C = Curve([x^5 - K.0*y*z^4], P) # needs sage.rings.number_field + sage: C.ordinary_model() # needs 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? @@ -1533,12 +1533,12 @@ def is_transverse(self, C, P): :: - 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 + sage: K = QuadraticField(-1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: C = Curve([y^2*z - K.0*x^3], P) # needs sage.rings.number_field + sage: D = Curve([z*x + y^2], P) # needs sage.rings.number_field + sage: Q = P([0,0,1]) + sage: C.is_transverse(D, Q) # needs sage.rings.number_field False :: @@ -1598,9 +1598,9 @@ def arithmetic_genus(self): :: - 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 + sage: P. = ProjectiveSpace(GF(7), 4) + sage: C = P.curve([t^3 - x*y*w, x^3 + y^3 + z^3, z - w]) # needs sage.rings.finite_rings + sage: C.arithmetic_genus() # needs sage.rings.finite_rings 10 """ if not self.is_irreducible(): @@ -1680,13 +1680,13 @@ def arithmetic_genus(self): EXAMPLES:: - 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 + sage: x,y,z = PolynomialRing(GF(5), 3, 'xyz').gens() + sage: C = Curve(y^2*z^7 - x^9 - x*z^8); C # needs 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 + sage: C.arithmetic_genus() # needs sage.rings.finite_rings 28 - sage: C.genus() # optional - sage.rings.finite_rings + sage: C.genus() # needs sage.rings.finite_rings 4 :: @@ -1721,15 +1721,15 @@ def fundamental_group(self): 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] # optional - sage.rings.number_field - sage: a # optional - sage.rings.number_field + sage: a = QQ[x](x^2 + 5).roots(QQbar)[0][0] # needs sage.rings.number_field + sage: a # needs sage.rings.number_field -2.236067977499790?*I - 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 + sage: F = NumberField(a.minpoly(), 'a', embedding=a) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(F, 2) # needs sage.rings.number_field + sage: F.inject_variables() # needs 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 = P.curve(x^2 + a * y^2) # needs sage.rings.number_field + sage: C.fundamental_group() # optional - sirocco, needs sage.rings.number_field Finitely presented group < x0 | > .. WARNING:: @@ -1802,7 +1802,7 @@ def rational_parameterization(self): sage: P. = ProjectiveSpace(QQ, 2) sage: C = Curve([x^2 + y^2 + z^2], P) - sage: C.rational_parameterization() # optional - sage.rings.number_field + sage: C.rational_parameterization() # needs sage.rings.number_field Scheme morphism: From: Projective Space of dimension 1 over Number Field in a with defining polynomial a^2 + 1 @@ -1862,62 +1862,62 @@ def rational_points_iterator(self): EXAMPLES:: - 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 + sage: F = GF(37) + sage: P2. = ProjectiveSpace(F, 2) + sage: C = Curve(X^7 + Y*X*Z^5*55 + Y^7*12) # needs sage.rings.finite_rings + sage: len(list(C.rational_points_iterator())) # needs sage.rings.finite_rings 37 :: - 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 + sage: F = GF(2) + sage: P2. = ProjectiveSpace(F, 2) + sage: C = Curve(X*Y*Z) # needs sage.rings.finite_rings + sage: a = C.rational_points_iterator() # needs sage.rings.finite_rings + sage: next(a) # needs sage.rings.finite_rings (1 : 0 : 0) - sage: next(a) # optional - sage.rings.finite_rings + sage: next(a) # needs sage.rings.finite_rings (0 : 1 : 0) - sage: next(a) # optional - sage.rings.finite_rings + sage: next(a) # needs sage.rings.finite_rings (1 : 1 : 0) - sage: next(a) # optional - sage.rings.finite_rings + sage: next(a) # needs sage.rings.finite_rings (0 : 0 : 1) - sage: next(a) # optional - sage.rings.finite_rings + sage: next(a) # needs sage.rings.finite_rings (1 : 0 : 1) - sage: next(a) # optional - sage.rings.finite_rings + sage: next(a) # needs sage.rings.finite_rings (0 : 1 : 1) - sage: next(a) # optional - sage.rings.finite_rings + sage: next(a) # needs sage.rings.finite_rings Traceback (most recent call last): ... StopIteration :: - 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 + sage: F = GF(3^2,'a') # needs sage.rings.finite_rings + sage: P2. = ProjectiveSpace(F, 2) + sage: C = Curve(X^3 + 5*Y^2*Z - 33*X*Y*X) # needs sage.rings.finite_rings + sage: b = C.rational_points_iterator() # needs sage.rings.finite_rings + sage: next(b) # needs sage.rings.finite_rings (0 : 1 : 0) - sage: next(b) # optional - sage.rings.finite_rings + sage: next(b) # needs sage.rings.finite_rings (0 : 0 : 1) - sage: next(b) # optional - sage.rings.finite_rings + sage: next(b) # needs sage.rings.finite_rings (2*a + 2 : a : 1) - sage: next(b) # optional - sage.rings.finite_rings + sage: next(b) # needs sage.rings.finite_rings (2 : a + 1 : 1) - sage: next(b) # optional - sage.rings.finite_rings + sage: next(b) # needs sage.rings.finite_rings (a + 1 : 2*a + 1 : 1) - sage: next(b) # optional - sage.rings.finite_rings + sage: next(b) # needs sage.rings.finite_rings (1 : 2 : 1) - sage: next(b) # optional - sage.rings.finite_rings + sage: next(b) # needs sage.rings.finite_rings (2*a + 2 : 2*a : 1) - sage: next(b) # optional - sage.rings.finite_rings + sage: next(b) # needs sage.rings.finite_rings (2 : 2*a + 2 : 1) - sage: next(b) # optional - sage.rings.finite_rings + sage: next(b) # needs sage.rings.finite_rings (a + 1 : a + 2 : 1) - sage: next(b) # optional - sage.rings.finite_rings + sage: next(b) # needs sage.rings.finite_rings (1 : 1 : 1) - sage: next(b) # optional - sage.rings.finite_rings + sage: next(b) # needs sage.rings.finite_rings Traceback (most recent call last): ... StopIteration @@ -1972,15 +1972,15 @@ def _points_via_singular(self, sort=True): EXAMPLES:: - 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 + 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 # needs 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() # optional - sage.rings.finite_rings + sage: C._points_via_singular() # needs 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 # optional - sage.rings.finite_rings + sage: C._points_via_singular(sort=False) # random # needs sage.rings.finite_rings [(0 : 1 : 0), (3 : 1 : 1), (3 : 4 : 1), (2 : 2 : 1), (0 : 0 : 1), (2 : 3 : 1)] @@ -2042,20 +2042,20 @@ def riemann_roch_basis(self, D): EXAMPLES:: - 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 + sage: R. = GF(2)[] + sage: f = x^3*y + y^3*z + x*z^3 + sage: C = Curve(f); pts = C.rational_points() # needs sage.rings.finite_rings + sage: D = C.divisor([ (4, pts[0]), (4, pts[2]) ]) # needs sage.rings.finite_rings + sage: C.riemann_roch_basis(D) # needs sage.rings.finite_rings [x/y, 1, z/y, z^2/y^2, z/x, z^2/(x*y)] :: - 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 + sage: R. = GF(5)[] + sage: f = x^7 + y^7 + z^7 + sage: C = Curve(f); pts = C.rational_points() # needs sage.rings.finite_rings + sage: D = C.divisor([ (3, pts[0]), (-1,pts[1]), (10, pts[5]) ]) # needs sage.rings.finite_rings + sage: C.riemann_roch_basis(D) # needs sage.rings.finite_rings [(-2*x + y)/(x + y), (-x + z)/(x + y)] .. NOTE:: @@ -2133,55 +2133,55 @@ def rational_points(self, algorithm="enum", sort=True): EXAMPLES:: - 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 + 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 # needs 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 + sage: C.rational_points() # needs 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) # optional - sage.rings.finite_rings - sage: C.rational_points() # optional - sage.rings.finite_rings + sage: C = Curve(x - y + z) # needs sage.rings.finite_rings + sage: C.rational_points() # needs 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) # optional - sage.rings.finite_rings - sage: C.rational_points('all') # optional - sage.rings.finite_rings + sage: C = Curve(x*z + z^2) + sage: C.rational_points('all') # needs 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) # 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 + sage: F = GF(7) + sage: P2. = ProjectiveSpace(F, 2) + sage: C = Curve(X^3 + Y^3 - Z^3) # needs sage.rings.finite_rings + sage: C.rational_points() # needs 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) # 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 + sage: F = GF(1237) # needs sage.rings.finite_rings + sage: P2. = ProjectiveSpace(F, 2) + sage: C = Curve(X^7 + 7*Y^6*Z + Z^4*X^2*Y*89) # needs sage.rings.finite_rings + sage: len(C.rational_points()) # needs sage.rings.finite_rings 1237 :: - 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 + sage: F = GF(2^6,'a') # needs sage.rings.finite_rings + sage: P2. = ProjectiveSpace(F, 2) + sage: C = Curve(X^5 + 11*X*Y*Z^3 + X^2*Y^3 - 13*Y^2*Z^3) # needs sage.rings.finite_rings + sage: len(C.rational_points()) # needs sage.rings.finite_rings 104 :: - 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 + sage: R. = GF(2)[] + sage: f = x^3*y + y^3*z + x*z^3 + sage: C = Curve(f); pts = C.rational_points() # needs sage.rings.finite_rings + sage: pts # needs sage.rings.finite_rings [(0 : 0 : 1), (0 : 1 : 0), (1 : 0 : 0)] """ @@ -2223,9 +2223,9 @@ def __init__(self, A, f): TESTS:: - 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 + sage: P. = ProjectiveSpace(GF(5), 2) + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings + sage: loads(dumps(C)) == C # needs sage.rings.finite_rings True """ super().__init__(A, f) @@ -2253,9 +2253,9 @@ def function_field(self): :: - 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 + sage: P. = ProjectiveSpace(GF(4), 2) # needs sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) # needs sage.rings.finite_rings + sage: C.function_field() # needs sage.rings.finite_rings Function field in z defined by z^5 + y*z^3 + y^5 + 1 """ return self._function_field @@ -2267,9 +2267,9 @@ def _genus(self): EXAMPLES:: - 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 + sage: P. = ProjectiveSpace(GF(4), 2) # needs sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) # needs sage.rings.finite_rings + sage: C.genus() # indirect doctest # needs sage.rings.finite_rings 1 """ return self._open_affine.genus() @@ -2280,13 +2280,13 @@ def __call__(self, *args): EXAMPLES:: - 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 + sage: P. = ProjectiveSpace(GF(4), 2) # needs sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) # needs sage.rings.finite_rings + sage: C(1,1,1) # needs sage.rings.finite_rings (1 : 1 : 1) - sage: C(y/z) # optional - sage.rings.finite_rings + sage: C(y/z) # needs sage.rings.finite_rings (y/(y^5 + 1))*z^4 + (y^2/(y^5 + 1))*z^2 - sage: C(GF(4^2)) # optional - sage.rings.finite_rings + sage: C(GF(4^2)) # needs 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 @@ -2305,11 +2305,11 @@ def function(self, f): EXAMPLES:: - 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 + sage: P. = ProjectiveSpace(GF(4), 2) # needs sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) # needs sage.rings.finite_rings + sage: f = C.function(x/y); f # needs sage.rings.finite_rings 1/y - sage: f.divisor() # optional - sage.rings.finite_rings + sage: f.divisor() # needs 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) @@ -2334,11 +2334,11 @@ def coordinate_functions(self, i=None): EXAMPLES:: - 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 + sage: P. = ProjectiveSpace(GF(4), 2) # needs sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) # needs sage.rings.finite_rings + sage: C.coordinate_functions(0) # needs sage.rings.finite_rings (y, z) - sage: C.coordinate_functions(1) # optional - sage.rings.finite_rings + sage: C.coordinate_functions(1) # needs sage.rings.finite_rings (1/y, 1/y*z) """ coords = self._coordinate_functions @@ -2354,9 +2354,9 @@ def _function_field(self): TESTS:: - 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 + sage: P. = ProjectiveSpace(GF(5), 2) + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings + sage: C._function_field # needs sage.rings.finite_rings Function field in z defined by z^8 + 4*y^2*z^7 + 1 """ return self._open_affine._function_field @@ -2368,9 +2368,9 @@ def _lift_to_function_field(self): TESTS:: - 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 + sage: P. = ProjectiveSpace(GF(5), 2) + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings + sage: C._lift_to_function_field # needs 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 @@ -2389,9 +2389,9 @@ def _coordinate_functions(self): TESTS:: - 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 + sage: P. = ProjectiveSpace(GF(5), 2) + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings + sage: C._coordinate_functions # needs sage.rings.finite_rings (1, y, z) """ # homogeneous coordinate functions @@ -2406,12 +2406,12 @@ def _singularities(self): TESTS:: - 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 + sage: P. = ProjectiveSpace(GF(5), 2) + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings + sage: C._singularities # needs 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) # optional - sage.rings.finite_rings - sage: D._singularities # optional - sage.rings.finite_rings + sage: D = Curve(x) # needs sage.rings.finite_rings + sage: D._singularities # needs sage.rings.finite_rings [] """ @@ -2466,9 +2466,9 @@ def singular_closed_points(self): :: - 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 + sage: P. = ProjectiveSpace(GF(5), 2) + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings + sage: C.singular_closed_points() # needs sage.rings.finite_rings [Point (x, z)] """ return [p[0] for p in self._singularities] @@ -2484,13 +2484,13 @@ def place_to_closed_point(self, place): EXAMPLES:: - 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 + sage: P. = ProjectiveSpace(GF(5), 2) + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings + sage: pls = C.places() # needs sage.rings.finite_rings + sage: C.place_to_closed_point(pls[-1]) # needs sage.rings.finite_rings Point (x - 2*z, y - 2*z) - sage: pls2 = C.places(2) # optional - sage.rings.finite_rings - sage: C.place_to_closed_point(pls2[0]) # optional - sage.rings.finite_rings + sage: pls2 = C.places(2) # needs sage.rings.finite_rings + sage: C.place_to_closed_point(pls2[0]) # needs sage.rings.finite_rings Point (y^2 + y*z + z^2, x + y) """ F = self.function_field() @@ -2584,9 +2584,9 @@ def places_on(self, point): :: - 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 + sage: P. = ProjectiveSpace(GF(5), 2) + sage: C = Curve(x^2*z - y^3) # needs sage.rings.finite_rings + sage: [C.places_on(p) for p in C.closed_points()] # needs sage.rings.finite_rings [[Place (1/y)], [Place (y)], [Place (y + 1)], @@ -2626,11 +2626,11 @@ class IntegralProjectiveCurve_finite_field(IntegralProjectiveCurve): EXAMPLES:: - 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 + sage: P. = ProjectiveSpace(GF(5), 2) + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings + sage: C.function_field() # needs sage.rings.finite_rings Function field in z defined by z^8 + 4*y^2*z^7 + 1 - sage: C.closed_points() # optional - sage.rings.finite_rings + sage: C.closed_points() # needs sage.rings.finite_rings [Point (x, z), Point (x, y), Point (x - 2*z, y + 2*z), @@ -2650,16 +2650,16 @@ def places(self, degree=1): EXAMPLES:: - 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 + sage: P. = ProjectiveSpace(GF(5), 2) + sage: C = Curve(x^2*z - y^3) # needs sage.rings.finite_rings + sage: C.places() # needs 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) # optional - sage.rings.finite_rings + sage: C.places(2) # needs sage.rings.finite_rings [Place (y^2 + 2), Place (y^2 + 3), Place (y^2 + y + 1), @@ -2684,10 +2684,10 @@ def closed_points(self, degree=1): EXAMPLES:: - 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 + sage: A. = AffineSpace(GF(9),2) # needs sage.rings.finite_rings + sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x-2) # needs sage.rings.finite_rings + sage: Cp = C.projective_closure() # needs sage.rings.finite_rings + sage: Cp.closed_points() # needs sage.rings.finite_rings [Point (x0, x1), Point (x0 + (-z2 - 1)*x2, x1), Point (x0 + (z2 + 1)*x2, x1), @@ -2731,10 +2731,10 @@ def L_polynomial(self, name='t'): EXAMPLES:: - 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 + sage: A. = AffineSpace(GF(3), 2) + sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x - 2) # needs sage.rings.finite_rings + sage: Cbar = C.projective_closure() # needs sage.rings.finite_rings + sage: Cbar.L_polynomial() # needs sage.rings.finite_rings 9*t^4 - 3*t^3 + t^2 - t + 1 """ @@ -2763,15 +2763,15 @@ def number_of_rational_points(self, r=1): EXAMPLES:: - 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 + sage: A. = AffineSpace(GF(3), 2) + sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x - 2) # needs sage.rings.finite_rings + sage: Cbar = C.projective_closure() # needs sage.rings.finite_rings + sage: Cbar.number_of_rational_points(3) # needs sage.rings.finite_rings 21 - sage: D = Cbar.change_ring(Cbar.base_ring().extension(3)) # optional - sage.rings.finite_rings - sage: D.base_ring() # optional - sage.rings.finite_rings + sage: D = Cbar.change_ring(Cbar.base_ring().extension(3)) # needs sage.rings.finite_rings + sage: D.base_ring() # needs sage.rings.finite_rings Finite Field in z3 of size 3^3 - sage: len(D.closed_points()) # optional - sage.rings.finite_rings + sage: len(D.closed_points()) # needs sage.rings.finite_rings 21 """ @@ -2806,12 +2806,12 @@ class IntegralProjectivePlaneCurve_finite_field(IntegralProjectiveCurve_finite_f EXAMPLES:: - 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 + sage: A. = AffineSpace(GF(9), 2) # needs sage.rings.finite_rings + sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x - 2) # needs sage.rings.finite_rings + sage: Cb = C.projective_closure() # needs sage.rings.finite_rings + sage: Cb.singular_closed_points() # needs sage.rings.finite_rings [Point (x0, x1)] - sage: Cb.function_field() # optional - sage.rings.finite_rings + sage: Cb.function_field() # needs 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 @@ -2835,7 +2835,7 @@ def Hasse_bounds(q, genus=1): sage: Hasse_bounds(2) (1, 5) - sage: Hasse_bounds(next_prime(10^30)) + sage: Hasse_bounds(next_prime(10^30)) # needs sage.libs.pari (999999999999998000000000000058, 1000000000000002000000000000058) """ if genus == 1: diff --git a/src/sage/schemes/elliptic_curves/cm.py b/src/sage/schemes/elliptic_curves/cm.py index fdf3cd63d66..ae70905d971 100644 --- a/src/sage/schemes/elliptic_curves/cm.py +++ b/src/sage/schemes/elliptic_curves/cm.py @@ -82,6 +82,7 @@ def hilbert_class_polynomial(D, algorithm=None): EXAMPLES:: + sage: # needs sage.libs.flint sage: hilbert_class_polynomial(-4) x - 1728 sage: hilbert_class_polynomial(-7) @@ -204,8 +205,10 @@ def is_HCP(f, check_monic_irreducible=True): sage: from sage.schemes.elliptic_curves.cm import is_HCP sage: D = -1856563 - sage: D.class_number() + sage: D.class_number() # optional - sage.libs.pari 100 + + sage: # optional - sage.libs.flint sage: H = hilbert_class_polynomial(D) sage: H.degree() 100 @@ -216,16 +219,19 @@ def is_HCP(f, check_monic_irreducible=True): Testing polynomials which are not HCPs is faster:: - sage: is_HCP(H+1) + sage: is_HCP(H+1) # optional - sage.libs.flint 0 TESTS:: + sage: # optional - sage.libs.flint sage: from sage.schemes.elliptic_curves.cm import is_HCP - sage: all(is_HCP(hilbert_class_polynomial(D))==D for D in srange(-4,-100,-1) if D.is_discriminant()) + sage: all(is_HCP(hilbert_class_polynomial(D)) == D + ....: for D in srange(-4,-100,-1) if D.is_discriminant()) True - sage: all(not is_HCP(hilbert_class_polynomial(D)+1) for D in srange(-4,-100,-1) if D.is_discriminant()) + sage: all(not is_HCP(hilbert_class_polynomial(D) + 1) + ....: for D in srange(-4,-100,-1) if D.is_discriminant()) True """ zero = ZZ(0) @@ -300,6 +306,7 @@ def OrderClassNumber(D0,h0,f): EXAMPLES:: + sage: # needs sage.libs.pari sage: from sage.schemes.elliptic_curves.cm import OrderClassNumber sage: D0 = -4 sage: h = D0.class_number() @@ -479,6 +486,7 @@ def cm_orders(h, proof=None): (-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: # needs sage.libs.pari 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), @@ -491,6 +499,7 @@ def cm_orders(h, proof=None): Any degree up to 100 is implemented, but may be slow:: + sage: # needs sage.libs.pari 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), @@ -738,6 +747,7 @@ def discriminants_with_bounded_class_number(hmax, B=None, proof=None): EXAMPLES:: + sage: # needs sage.libs.pari sage: from sage.schemes.elliptic_curves.cm import discriminants_with_bounded_class_number sage: v = discriminants_with_bounded_class_number(3) sage: sorted(v) @@ -932,11 +942,11 @@ def is_cm_j_invariant(j, algorithm='CremonaSutherland', method=None): sage: from sage.schemes.elliptic_curves.cm import is_cm_j_invariant sage: D = -1856563 - sage: H = hilbert_class_polynomial(D) - sage: H.degree() + sage: H = hilbert_class_polynomial(D) # needs sage.libs.flint + sage: H.degree() # needs sage.libs.flint 100 - sage: K. = NumberField(H) - sage: is_cm_j_invariant(j) + sage: K. = NumberField(H) # needs sage.libs.flint sage.rings.number_field + sage: is_cm_j_invariant(j) # needs sage.libs.flint sage.rings.number_field (True, (-1856563, 1)) TESTS:: diff --git a/src/sage/schemes/elliptic_curves/ell_finite_field.py b/src/sage/schemes/elliptic_curves/ell_finite_field.py index 98fb7d9936a..f3ef8eefb47 100644 --- a/src/sage/schemes/elliptic_curves/ell_finite_field.py +++ b/src/sage/schemes/elliptic_curves/ell_finite_field.py @@ -184,6 +184,7 @@ def points(self): :: + sage: # needs sage.rings.finite_rings sage: K = GF((p, 2),'a') sage: E = E.change_ring(K) sage: len(E.points()) @@ -195,7 +196,7 @@ def points(self): Note that the returned list is an immutable sorted Sequence:: - sage: w[0] = 9 + sage: w[0] = 9 # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: object is immutable; please change a copy instead. @@ -245,6 +246,7 @@ def count_points(self, n=1): :: + sage: # needs sage.rings.finite_rings sage: F. = GF(p^2) sage: E = EllipticCurve(F, [a,a]) sage: E.cardinality() @@ -309,6 +311,7 @@ def random_element(self): :: + sage: # needs sage.rings.finite_rings sage: k. = GF(7^5) sage: E = EllipticCurve(k,[2,4]) sage: P = E.random_element(); P # random @@ -320,9 +323,10 @@ def random_element(self): :: + sage: # needs sage.rings.finite_rings sage: k. = GF(2^5) sage: E = EllipticCurve(k,[a^2,a,1,a+1,1]) - sage: P = E.random_element();P # random + sage: P = E.random_element(); P # random (a^4 + a : a^4 + a^3 + a^2 : 1) sage: type(P) @@ -352,6 +356,7 @@ def random_element(self): sage: E.cardinality() 1 + sage: # needs sage.rings.finite_rings sage: F. = GF(4) sage: E = EllipticCurve(F, [0, 0, 1, 0, a]) sage: E.random_point() @@ -390,14 +395,14 @@ def trace_of_frobenius(self): sage: E = EllipticCurve(GF(101),[2,3]) sage: E.trace_of_frobenius() 6 - sage: E = EllipticCurve(GF(11^5,'a'),[2,5]) - sage: E.trace_of_frobenius() + sage: E = EllipticCurve(GF(11^5,'a'),[2,5]) # needs sage.rings.finite_rings + sage: E.trace_of_frobenius() # needs sage.rings.finite_rings 802 The following shows that the issue from :trac:`2849` is fixed:: - sage: E = EllipticCurve(GF(3^5,'a'),[-1,-1]) - sage: E.trace_of_frobenius() + sage: E = EllipticCurve(GF(3^5,'a'),[-1,-1]) # needs sage.rings.finite_rings + sage: E.trace_of_frobenius() # needs sage.rings.finite_rings -27 """ return 1 + self.base_field().order() - self.cardinality() @@ -437,6 +442,7 @@ def cardinality(self, algorithm=None, extension_degree=1): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: EllipticCurve(GF(4, 'a'), [1,2,3,4,5]).cardinality() 8 sage: k. = GF(3^3) @@ -446,12 +452,14 @@ def cardinality(self, algorithm=None, extension_degree=1): :: + sage: # needs sage.rings.finite_rings sage: l = [1, 1, 0, 2, 0] sage: EllipticCurve(k, l).cardinality() 38 An even bigger extension (which we check against Magma):: + sage: # needs sage.rings.finite_rings sage: EllipticCurve(GF(3^100, 'a'), [1,2,3,4,5]).cardinality() 515377520732011331036459693969645888996929981504 sage: magma.eval("Order(EllipticCurve([GF(3^100)|1,2,3,4,5]))") # optional - magma @@ -468,6 +476,7 @@ def cardinality(self, algorithm=None, extension_degree=1): The cardinality is cached:: + sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(3^100, 'a'), [1,2,3,4,5]) sage: E.cardinality() is E.cardinality() True @@ -475,6 +484,7 @@ def cardinality(self, algorithm=None, extension_degree=1): The following is very fast since the curve is actually defined over the prime field:: + sage: # needs sage.rings.finite_rings sage: k. = GF(11^100) sage: E1 = EllipticCurve(k, [3,3]) sage: N1 = E1.cardinality(algorithm="subfield"); N1 @@ -491,17 +501,20 @@ def cardinality(self, algorithm=None, extension_degree=1): We can count points over curves defined as a reduction:: + sage: # needs sage.rings.number_field sage: x = polygen(QQ) sage: K. = NumberField(x^2 + x + 1) sage: EK = EllipticCurve(K, [0, 0, w, 2, 1]) sage: E = EK.base_extend(K.residue_field(2)) sage: E - Elliptic Curve defined by y^2 + wbar*y = x^3 + 1 over Residue field in wbar of Fractional ideal (2) + Elliptic Curve defined by y^2 + wbar*y = x^3 + 1 + over Residue field in wbar of Fractional ideal (2) sage: E.cardinality() 7 sage: E = EK.base_extend(K.residue_field(w - 1)) sage: E.abelian_group() - Trivial group embedded in Abelian group of points on Elliptic Curve defined by y^2 + y = x^3 + 2*x + 1 over Residue field of Fractional ideal (w - 1) + Trivial group embedded in Abelian group of points on Elliptic Curve defined + by y^2 + y = x^3 + 2*x + 1 over Residue field of Fractional ideal (w - 1) :: @@ -510,7 +523,9 @@ def cardinality(self, algorithm=None, extension_degree=1): sage: k. = R.residue_field(pol) sage: E = EllipticCurve(R, [1, x]).base_extend(k) sage: E - Elliptic Curve defined by y^2 = x^3 + x + a over Residue field in a of Principal ideal (x^5 + x + 14) of Univariate Polynomial Ring in x over Finite Field of size 17 + Elliptic Curve defined by y^2 = x^3 + x + a + over Residue field in a of Principal ideal (x^5 + x + 14) + of Univariate Polynomial Ring in x over Finite Field of size 17 sage: E.cardinality() 1421004 @@ -532,6 +547,7 @@ def cardinality(self, algorithm=None, extension_degree=1): Check that a bug noted at :trac:`15667` is fixed:: + sage: # needs sage.rings.finite_rings sage: F. = GF(3^6) sage: EllipticCurve([a^5 + 2*a^3 + 2*a^2 + 2*a, a^4 + a^3 + 2*a + 1]).cardinality() 784 @@ -614,6 +630,7 @@ def frobenius_polynomial(self): For some supersingular curves, Frobenius is in Z and the polynomial is a square:: + sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(25,'a'),[0,0,0,0,1]) sage: E.frobenius_polynomial().factor() (x + 5)^2 @@ -640,6 +657,7 @@ def frobenius_order(self): For some supersingular curves, Frobenius is in Z and the Frobenius order is Z:: + sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(25,'a'),[0,0,0,0,1]) sage: R = E.frobenius_order() sage: R @@ -671,6 +689,7 @@ def frobenius(self): For some supersingular curves, Frobenius is in Z:: + sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(25,'a'),[0,0,0,0,1]) sage: E.frobenius() -5 @@ -688,6 +707,7 @@ def frobenius_endomorphism(self): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: F. = GF(11^4) sage: E = EllipticCurve([t,t]) sage: E.frobenius_endomorphism() @@ -709,6 +729,7 @@ def frobenius_discriminant(self): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: F. = GF(11^4) sage: E = EllipticCurve([t,t]) sage: E.frobenius_discriminant() @@ -736,6 +757,7 @@ def cardinality_pari(self): Since :trac:`16931`, this now works over finite fields which are not prime fields:: + sage: # needs sage.rings.finite_rings sage: k. = GF(7^3) sage: E = EllipticCurve_from_j(a) sage: E.cardinality_pari() @@ -747,7 +769,7 @@ def cardinality_pari(self): TESTS:: - sage: E.cardinality_pari().parent() + sage: E.cardinality_pari().parent() # needs sage.rings.finite_rings Integer Ring """ return Integer(self.__pari__().ellcard()) @@ -800,7 +822,9 @@ def gens(self): instead:: sage: E.abelian_group() - Additive abelian group isomorphic to Z/22 + Z/2 embedded in Abelian group of points on Elliptic Curve defined by y^2 = x^3 + 2*x + 5 over Finite Field of size 41 + Additive abelian group isomorphic to Z/22 + Z/2 + embedded in Abelian group of points on Elliptic Curve + defined by y^2 = x^3 + 2*x + 5 over Finite Field of size 41 sage: ab_gens = E.abelian_group().gens() sage: ab_gens == E.gens() True @@ -811,6 +835,7 @@ def gens(self): Examples with 1 and 0 generators:: + sage: # needs sage.rings.finite_rings sage: F. = GF(3^6) sage: E = EllipticCurve([a, a+1]) sage: pts = E.gens() @@ -818,6 +843,7 @@ def gens(self): 1 sage: pts[0].order() == E.cardinality() True + sage: E = EllipticCurve(GF(2), [0,0,1,1,1]) sage: E.gens() () @@ -825,6 +851,7 @@ def gens(self): This works over larger finite fields where :meth:`abelian_group` may be too expensive:: + sage: # needs sage.rings.finite_rings sage: k. = GF(5^60) sage: E = EllipticCurve([a, a]) sage: len(E.gens()) @@ -951,6 +978,7 @@ def abelian_group(self): :: + sage: # needs sage.rings.finite_rings sage: F. = GF(3^6,'a') sage: E = EllipticCurve([a^4 + a^3 + 2*a^2 + 2*a, 2*a^5 + 2*a^3 + 2*a^2 + 1]) sage: E.abelian_group() @@ -958,6 +986,7 @@ def abelian_group(self): :: + sage: # needs sage.rings.finite_rings sage: F. = GF(101^3,'a') sage: E = EllipticCurve([2*a^2 + 48*a + 27, 89*a^2 + 76*a + 24]) sage: E.abelian_group() @@ -987,6 +1016,7 @@ def abelian_group(self): This tests that the bug reported in :trac:`3926` has been fixed:: + sage: # needs sage.rings.number_field sage: K. = QuadraticField(-1) sage: OK = K.ring_of_integers() sage: P = K.factor(10007)[0][0] @@ -1038,6 +1068,7 @@ def torsion_basis(self, n): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(62207^2), [1,0]) sage: E.abelian_group() Additive abelian group isomorphic to Z/62208 + Z/62208 embedded in @@ -1121,6 +1152,7 @@ def is_isogenous(self, other, field=None, proof=True): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: E1 = EllipticCurve(GF(11^2,'a'),[2,7]); E1 Elliptic Curve defined by y^2 = x^3 + 2*x + 7 over Finite Field in a of size 11^2 sage: E1.is_isogenous(5) @@ -1130,6 +1162,7 @@ def is_isogenous(self, other, field=None, proof=True): sage: E1.is_isogenous(E1) True + sage: # needs sage.rings.finite_rings sage: E2 = EllipticCurve(GF(7^3,'b'),[3,1]); E2 Elliptic Curve defined by y^2 = x^3 + 3*x + 1 over Finite Field in b of size 7^3 sage: E1.is_isogenous(E2) @@ -1137,16 +1170,19 @@ def is_isogenous(self, other, field=None, proof=True): ... ValueError: The base fields must have the same characteristic. + sage: # needs sage.rings.finite_rings sage: E3 = EllipticCurve(GF(11^2,'c'),[4,3]); E3 Elliptic Curve defined by y^2 = x^3 + 4*x + 3 over Finite Field in c of size 11^2 sage: E1.is_isogenous(E3) False + sage: # needs sage.rings.finite_rings sage: E4 = EllipticCurve(GF(11^6,'d'),[6,5]); E4 Elliptic Curve defined by y^2 = x^3 + 6*x + 5 over Finite Field in d of size 11^6 sage: E1.is_isogenous(E4) True + sage: # needs sage.rings.finite_rings sage: E5 = EllipticCurve(GF(11^7,'e'),[4,2]); E5 Elliptic Curve defined by y^2 = x^3 + 4*x + 2 over Finite Field in e of size 11^7 sage: E1.is_isogenous(E5) @@ -1156,6 +1192,7 @@ def is_isogenous(self, other, field=None, proof=True): When the field is given:: + sage: # needs sage.rings.finite_rings sage: E1 = EllipticCurve(GF(13^2,'a'),[2,7]); E1 Elliptic Curve defined by y^2 = x^3 + 2*x + 7 over Finite Field in a of size 13^2 sage: E1.is_isogenous(5,GF(13^6,'f')) @@ -1664,10 +1701,12 @@ def twists(self): `j=0=1728`, when there are either 4 or 6 depending on whether the field has odd or even degree over `\GF{3}`:: + sage: # needs sage.rings.finite_rings sage: K = GF(3**5) sage: [E.ainvs() for E in EllipticCurve(j=K(1)).twists()] [(0, 1, 0, 0, 2), (0, z5, 0, 0, 2*z5^3)] + sage: # needs sage.rings.finite_rings sage: K = GF(3**5) sage: [E.ainvs() for E in EllipticCurve(j=K(0)).twists()] # random [(0, 0, 0, 1, 0), @@ -1675,10 +1714,12 @@ def twists(self): (0, 0, 0, 2, z5^4 + z5^3 + z5^2), (0, 0, 0, 2, 2*z5^4 + 2*z5^3 + 2*z5^2)] + sage: # needs sage.rings.finite_rings sage: K = GF(3**4) sage: [E.ainvs() for E in EllipticCurve(j=K(1)).twists()] [(0, 1, 0, 0, 2), (0, z4, 0, 0, 2*z4^3)] + sage: # needs sage.rings.finite_rings sage: K = GF(3**4) sage: [E.ainvs() for E in EllipticCurve(j=K(0)).twists()] # random [(0, 0, 0, 1, 0), @@ -1692,18 +1733,22 @@ def twists(self): `j=0=1728`, when there are either 3 or 7 depending on whether the field has odd or even degree over `\GF{2}`:: + sage: # needs sage.rings.finite_rings sage: K = GF(2**7) sage: [E.ainvs() for E in EllipticCurve(j=K(1)).twists()] [(1, 0, 0, 0, 1), (1, 1, 0, 0, 1)] + sage: # needs sage.rings.finite_rings sage: K = GF(2**7) sage: [E.ainvs() for E in EllipticCurve(j=K(0)).twists()] [(0, 0, 1, 0, 0), (0, 0, 1, 1, 0), (0, 0, 1, 1, 1)] + sage: # needs sage.rings.finite_rings sage: K = GF(2**8) sage: [E.ainvs() for E in EllipticCurve(j=K(1)).twists()] # random [(1, 0, 0, 0, 1), (1, z8^7 + z8^6 + z8^5 + z8^4 + z8^2 + z8, 0, 0, 1)] + sage: # needs sage.rings.finite_rings sage: K = GF(2**8) sage: [E.ainvs() for E in EllipticCurve(j=K(0)).twists()] # random [(0, 0, 1, 0, 0), @@ -1718,6 +1763,7 @@ def twists(self): Randomized check that we find all twists and there are no duplicates:: + sage: # needs sage.rings.finite_rings sage: p = next_prime(randrange(2,100)) sage: e = randrange(1,10) sage: F. = GF((p,e)) @@ -1799,7 +1845,7 @@ def curves_with_j_0(K): 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)) + sage: curves_with_j_0(GF(25)) # needs sage.rings.finite_rings [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, @@ -1858,7 +1904,7 @@ def curves_with_j_1728(K): 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)) + sage: curves_with_j_1728(GF(49)) # needs sage.rings.finite_rings [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, @@ -1908,6 +1954,7 @@ def curves_with_j_0_char2(K): In odd degree, there are three isomorphism classes all with representatives defined over `\GF{2}`:: sage: from sage.schemes.elliptic_curves.ell_finite_field import curves_with_j_0_char2 + sage: # needs sage.rings.finite_rings sage: K = GF(2**7) sage: curves = curves_with_j_0_char2(K) sage: len(curves) @@ -1917,17 +1964,19 @@ def curves_with_j_0_char2(K): Check that the curves are mutually non-isomorphic:: - sage: all((e1 == e2 or not e1.is_isomorphic(e2)) for e1 in curves for e2 in curves) + sage: all((e1 == e2 or not e1.is_isomorphic(e2)) # needs sage.rings.finite_rings + ....: for e1 in curves for e2 in curves) True Check that the weight formula holds:: - sage: sum(1/len(E.automorphisms()) for E in curves) == 1 + sage: sum(1/len(E.automorphisms()) for E in curves) == 1 # needs sage.rings.finite_rings True In even degree there are seven isomorphism classes:: sage: from sage.schemes.elliptic_curves.ell_finite_field import curves_with_j_0_char2 + sage: # needs sage.rings.finite_rings sage: K = GF(2**8) sage: curves = EllipticCurve(j=K(0)).twists() sage: len(curves) @@ -1943,12 +1992,13 @@ def curves_with_j_0_char2(K): Check that the twists are mutually non-isomorphic:: - sage: all((e1 == e2 or not e1.is_isomorphic(e2)) for e1 in curves for e2 in curves) + sage: all((e1 == e2 or not e1.is_isomorphic(e2)) # needs sage.rings.finite_rings + ....: for e1 in curves for e2 in curves) True Check that the weight formula holds:: - sage: sum(1/len(E.automorphisms()) for E in curves) == 1 + sage: sum(1/len(E.automorphisms()) for E in curves) == 1 # needs sage.rings.finite_rings True """ if not K.is_finite() or K.characteristic() != 2: @@ -1997,6 +2047,7 @@ def curves_with_j_0_char3(K): In odd degree, there are four isomorphism classes:: sage: from sage.schemes.elliptic_curves.ell_finite_field import curves_with_j_0_char3 + sage: # needs sage.rings.finite_rings sage: K = GF(3**5) sage: curves = curves_with_j_0_char3(K) sage: len(curves) @@ -2009,17 +2060,19 @@ def curves_with_j_0_char3(K): Check that the twists are mutually non-isomorphic:: - sage: all((e1 == e2 or not e1.is_isomorphic(e2)) for e1 in curves for e2 in curves) + sage: all((e1 == e2 or not e1.is_isomorphic(e2)) # needs sage.rings.finite_rings + ....: for e1 in curves for e2 in curves) True Check that the weight formula holds:: - sage: sum(1/len(E.automorphisms()) for E in curves) == 1 + sage: sum(1/len(E.automorphisms()) for E in curves) == 1 # needs sage.rings.finite_rings True In even degree, there are six isomorphism classes:: sage: from sage.schemes.elliptic_curves.ell_finite_field import curves_with_j_0_char3 + sage: # needs sage.rings.finite_rings sage: K = GF(3**4) sage: curves = EllipticCurve(j=K(0)).twists() sage: len(curves) @@ -2034,12 +2087,13 @@ def curves_with_j_0_char3(K): Check that the twists are mutually non-isomorphic:: - sage: all((e1 == e2 or not e1.is_isomorphic(e2)) for e1 in curves for e2 in curves) + sage: all((e1 == e2 or not e1.is_isomorphic(e2)) # needs sage.rings.finite_rings + ....: for e1 in curves for e2 in curves) True Check that the weight formula holds:: - sage: sum(1/len(E.automorphisms()) for E in curves) == 1 + sage: sum(1/len(E.automorphisms()) for E in curves) == 1 # needs sage.rings.finite_rings True """ if not K.is_finite() or K.characteristic() != 3: @@ -2258,7 +2312,8 @@ def is_j_supersingular(j, proof=True): sage: from sage.schemes.elliptic_curves.ell_finite_field import is_j_supersingular, supersingular_j_polynomials sage: [(p,[j for j in GF(p) if is_j_supersingular(j)]) for p in prime_range(30)] - [(2, [0]), (3, [0]), (5, [0]), (7, [6]), (11, [0, 1]), (13, [5]), (17, [0, 8]), (19, [7, 18]), (23, [0, 3, 19]), (29, [0, 2, 25])] + [(2, [0]), (3, [0]), (5, [0]), (7, [6]), (11, [0, 1]), (13, [5]), + (17, [0, 8]), (19, [7, 18]), (23, [0, 3, 19]), (29, [0, 2, 25])] sage: [j for j in GF(109) if is_j_supersingular(j)] [17, 41, 43] diff --git a/src/sage/schemes/elliptic_curves/ell_local_data.py b/src/sage/schemes/elliptic_curves/ell_local_data.py index 2b9bd9d2ab4..11a0e9db661 100644 --- a/src/sage/schemes/elliptic_curves/ell_local_data.py +++ b/src/sage/schemes/elliptic_curves/ell_local_data.py @@ -16,6 +16,7 @@ EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 + 1) sage: E = EllipticCurve([(2+i)^2, (2+i)^7]) @@ -45,6 +46,7 @@ Kodaira Symbol: II Tamagawa Number: 1 + sage: # needs sage.rings.number_field sage: EK = E.base_extend(K) sage: EK.local_data(1+i) Local data at Fractional ideal (i + 1): @@ -61,6 +63,8 @@ sage: E = EllipticCurve([0,8]) sage: E.is_minimal() True + + sage: # needs sage.rings.number_field sage: EK = E.base_extend(K) sage: da = EK.local_data(1+i) sage: da.minimal_model() @@ -120,7 +124,7 @@ class EllipticCurveLocalData(SageObject): - ``P`` -- a prime ideal of the field, or a prime integer if the field is `\QQ`. - - ``proof`` (bool)-- if True, only use provably correct + - ``proof`` (bool) -- if ``True``, only use provably correct methods (default controlled by global proof module). Note that the proof module is number_field, not elliptic_curves, since the functions that actually need the flag are in @@ -332,6 +336,7 @@ def minimal_model(self, reduce=True): To demonstrate the behaviour of the parameter ``reduce``:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^3 + x + 1) sage: E = EllipticCurve(K, [0, 0, a, 0, 1]) @@ -356,6 +361,7 @@ def minimal_model(self, reduce=True): :trac:`14476`:: + sage: # needs sage.rings.number_field 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, @@ -517,6 +523,7 @@ 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: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] @@ -536,6 +543,7 @@ 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: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] @@ -558,6 +566,7 @@ def has_bad_reduction(self): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] @@ -585,6 +594,7 @@ def has_multiplicative_reduction(self): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] @@ -607,6 +617,7 @@ def has_split_multiplicative_reduction(self): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] @@ -631,6 +642,7 @@ def has_nonsplit_multiplicative_reduction(self): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] @@ -653,6 +665,7 @@ def has_additive_reduction(self): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] @@ -695,16 +708,14 @@ def _tate(self, proof=None, globally=False): EXAMPLES (this raised a type error in sage prior to 4.4.4, see :trac:`7930`) :: + sage: # needs sage.rings.number_field sage: E = EllipticCurve('99d1') - sage: R. = QQ[] sage: K. = NumberField(X^3 + X^2 - 2*X - 1) sage: L. = NumberField(X^3 + X^2 - 36*X - 4) - sage: EK = E.base_extend(K) sage: toK = EK.torsion_order() sage: da = EK.local_data() # indirect doctest - sage: EL = E.base_extend(L) sage: da = EL.local_data() # indirect doctest @@ -712,6 +723,7 @@ def _tate(self, proof=None, globally=False): The following example shows that the bug at :trac:`9324` is fixed:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 - x + 6) sage: E = EllipticCurve([0,0,0,-53160*a-43995,-5067640*a+19402006]) @@ -720,14 +732,16 @@ def _tate(self, proof=None, globally=False): The following example shows that the bug at :trac:`9417` is fixed:: - sage: K. = NumberField(x^2+18*x+1) + sage: # needs sage.rings.number_field + sage: K. = NumberField(x^2 + 18*x + 1) sage: E = EllipticCurve(K, [0, -36, 0, 320, 0]) sage: E.tamagawa_number(K.ideal(2)) 4 This is to show that the bug :trac:`11630` is fixed. (The computation of the class group would produce a warning):: - sage: K. = NumberField(x^7-2*x+177) + sage: # needs sage.rings.number_field + sage: K. = NumberField(x^7 - 2*x + 177) sage: E = EllipticCurve([0,1,0,t,t]) sage: P = K.ideal(2,t^3 + t + 1) sage: E.local_data(P).kodaira_symbol() @@ -1141,6 +1155,8 @@ def check_prime(K, P): 3 sage: check_prime(QQ,ZZ.ideal(31)) 31 + + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 - 5) sage: check_prime(K, a) diff --git a/src/sage/schemes/elliptic_curves/ell_padic_field.py b/src/sage/schemes/elliptic_curves/ell_padic_field.py index 2ac42b1b7e7..ba796d1b75b 100644 --- a/src/sage/schemes/elliptic_curves/ell_padic_field.py +++ b/src/sage/schemes/elliptic_curves/ell_padic_field.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.rings.padics """ Elliptic curves over padic fields """ @@ -33,9 +34,10 @@ class EllipticCurve_padic_field(EllipticCurve_field, HyperellipticCurve_padic_fi EXAMPLES:: - sage: Qp=pAdicField(17) - sage: E=EllipticCurve(Qp,[2,3]); E - Elliptic Curve defined by y^2 = x^3 + (2+O(17^20))*x + (3+O(17^20)) over 17-adic Field with capped relative precision 20 + sage: Qp = pAdicField(17) + sage: E = EllipticCurve(Qp,[2,3]); E + Elliptic Curve defined by y^2 = x^3 + (2+O(17^20))*x + (3+O(17^20)) + over 17-adic Field with capped relative precision 20 sage: E == loads(dumps(E)) True """ From aeb3ced3812ebaea45c4a2514b23c1ad791f9214 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 3 Jul 2023 00:26:23 -0700 Subject: [PATCH 037/423] sage.schemes: Update # needs --- src/sage/schemes/curves/affine_curve.py | 1 + src/sage/schemes/curves/constructor.py | 1 + src/sage/schemes/curves/curve.py | 1 + src/sage/schemes/curves/point.py | 1 + src/sage/schemes/curves/zariski_vankampen.py | 1 + src/sage/schemes/cyclic_covers/charpoly_frobenius.py | 1 + 6 files changed, 6 insertions(+) diff --git a/src/sage/schemes/curves/affine_curve.py b/src/sage/schemes/curves/affine_curve.py index f74dcc36d25..87b8dcb56c9 100644 --- a/src/sage/schemes/curves/affine_curve.py +++ b/src/sage/schemes/curves/affine_curve.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.libs.singular r""" Affine curves diff --git a/src/sage/schemes/curves/constructor.py b/src/sage/schemes/curves/constructor.py index cb77c914047..78ae384ccb7 100644 --- a/src/sage/schemes/curves/constructor.py +++ b/src/sage/schemes/curves/constructor.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.libs.singular """ Curve constructor diff --git a/src/sage/schemes/curves/curve.py b/src/sage/schemes/curves/curve.py index eaab8e97067..bb2ce1495fc 100644 --- a/src/sage/schemes/curves/curve.py +++ b/src/sage/schemes/curves/curve.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.libs.singular """ Base class of curves diff --git a/src/sage/schemes/curves/point.py b/src/sage/schemes/curves/point.py index 0bfaeae3139..167b4071edc 100644 --- a/src/sage/schemes/curves/point.py +++ b/src/sage/schemes/curves/point.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.libs.singular """ Rational points of curves diff --git a/src/sage/schemes/curves/zariski_vankampen.py b/src/sage/schemes/curves/zariski_vankampen.py index 2edb29f365a..0111b5c7f2d 100644 --- a/src/sage/schemes/curves/zariski_vankampen.py +++ b/src/sage/schemes/curves/zariski_vankampen.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs sage.groups sage.rings.number_field r""" Zariski-Van Kampen method implementation diff --git a/src/sage/schemes/cyclic_covers/charpoly_frobenius.py b/src/sage/schemes/cyclic_covers/charpoly_frobenius.py index fc5cc3b1c3e..e28289e1d84 100644 --- a/src/sage/schemes/cyclic_covers/charpoly_frobenius.py +++ b/src/sage/schemes/cyclic_covers/charpoly_frobenius.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.rings.padics r""" Computation of the Frobenius polynomial using Newton's identities """ From 6fd00487750eadc616e186ff8014e8b3358ebc9a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 8 Jul 2023 11:43:43 -0700 Subject: [PATCH 038/423] src/sage/rings/polynomial/polynomial_ring.py: Use '# needs sage.libs.ntl' when GF2X is used --- src/sage/schemes/plane_conics/con_field.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/schemes/plane_conics/con_field.py b/src/sage/schemes/plane_conics/con_field.py index fa813565f7a..9ba15183074 100644 --- a/src/sage/schemes/plane_conics/con_field.py +++ b/src/sage/schemes/plane_conics/con_field.py @@ -195,7 +195,7 @@ def derivative_matrix(self): An example in characteristic `2`:: 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 + sage: c = Conic([t, 1, t^2, 1, 1, 0]); c # optional - sage.libs.ntl 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 @@ -601,7 +601,7 @@ def has_singular_point(self, point=False): (True, (a + 1 : 0 : 1)) sage: P. = GF(2)[] # optional - sage.rings.finite_rings - sage: C = Conic(P, [t,t,1]); C # optional - sage.rings.finite_rings + sage: C = Conic(P, [t,t,1]); C # optional - sage.rings.finite_rings sage.libs.ntl 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 From 855999953cc758d8ad65d19b1e5463819f994d75 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 12 Jul 2023 18:31:15 -0700 Subject: [PATCH 039/423] ./sage -fixdoctests --distribution sagemath-categories --probe all --only-tags src/sage/schemes --- src/sage/schemes/affine/affine_homset.py | 35 +- src/sage/schemes/affine/affine_morphism.py | 299 ++--- src/sage/schemes/affine/affine_point.py | 65 +- .../schemes/affine/affine_rational_point.py | 20 +- src/sage/schemes/affine/affine_space.py | 66 +- src/sage/schemes/affine/affine_subscheme.py | 93 +- .../schemes/berkovich/berkovich_cp_element.py | 768 ++++++------ src/sage/schemes/berkovich/berkovich_space.py | 220 ++-- src/sage/schemes/curves/affine_curve.py | 519 ++++---- src/sage/schemes/curves/closed_point.py | 216 ++-- src/sage/schemes/curves/constructor.py | 19 +- src/sage/schemes/curves/curve.py | 97 +- src/sage/schemes/curves/point.py | 143 ++- src/sage/schemes/curves/projective_curve.py | 117 +- src/sage/schemes/curves/zariski_vankampen.py | 8 +- src/sage/schemes/cyclic_covers/constructor.py | 16 +- .../cyclic_covers/cycliccover_generic.py | 36 +- src/sage/schemes/elliptic_curves/Qcurves.py | 20 +- src/sage/schemes/elliptic_curves/cm.py | 8 +- .../schemes/elliptic_curves/constructor.py | 45 +- .../elliptic_curves/descent_two_isogeny.pyx | 14 +- .../elliptic_curves/ell_curve_isogeny.py | 1113 +++++++++-------- src/sage/schemes/elliptic_curves/ell_field.py | 377 +++--- .../schemes/elliptic_curves/ell_generic.py | 163 +-- src/sage/schemes/elliptic_curves/ell_point.py | 573 +++++---- src/sage/schemes/elliptic_curves/ell_wp.py | 36 +- .../schemes/elliptic_curves/formal_group.py | 18 +- src/sage/schemes/elliptic_curves/height.py | 128 +- .../schemes/elliptic_curves/hom_composite.py | 279 +++-- .../elliptic_curves/isogeny_small_degree.py | 137 +- .../schemes/elliptic_curves/lseries_ell.py | 9 +- src/sage/schemes/elliptic_curves/padics.py | 13 +- .../schemes/elliptic_curves/period_lattice.py | 195 +-- .../elliptic_curves/period_lattice_region.pyx | 24 +- .../elliptic_curves/weierstrass_morphism.py | 71 +- src/sage/schemes/generic/algebraic_scheme.py | 283 +++-- src/sage/schemes/generic/ambient_space.py | 2 +- src/sage/schemes/generic/divisor.py | 87 +- src/sage/schemes/generic/divisor_group.py | 26 +- src/sage/schemes/generic/homset.py | 55 +- src/sage/schemes/generic/morphism.py | 182 +-- src/sage/schemes/generic/scheme.py | 55 +- src/sage/schemes/generic/spec.py | 8 +- .../hyperelliptic_curves/constructor.py | 49 +- .../hyperelliptic_curves/hyperelliptic_g2.py | 27 +- .../hyperelliptic_generic.py | 82 +- .../hyperelliptic_curves/invariants.py | 22 +- .../hyperelliptic_curves/jacobian_generic.py | 85 +- .../hyperelliptic_curves/jacobian_homset.py | 42 +- .../hyperelliptic_curves/jacobian_morphism.py | 265 ++-- .../schemes/hyperelliptic_curves/mestre.py | 24 +- .../schemes/jacobians/abstract_jacobian.py | 4 +- src/sage/schemes/plane_conics/con_field.py | 201 +-- .../con_rational_function_field.py | 32 +- src/sage/schemes/plane_conics/constructor.py | 16 +- src/sage/schemes/product_projective/homset.py | 22 +- .../schemes/product_projective/morphism.py | 43 +- src/sage/schemes/product_projective/point.py | 31 +- .../product_projective/rational_point.py | 10 +- .../schemes/product_projective/subscheme.py | 53 +- .../schemes/projective/proj_bdd_height.py | 48 +- .../schemes/projective/projective_homset.py | 77 +- .../schemes/projective/projective_morphism.py | 511 ++++---- .../schemes/projective/projective_point.py | 259 ++-- .../projective/projective_rational_point.py | 35 +- .../schemes/projective/projective_space.py | 55 +- .../projective/projective_subscheme.py | 186 +-- .../riemann_surfaces/riemann_surface.py | 8 +- src/sage/schemes/toric/chow_group.py | 2 +- src/sage/schemes/toric/fano_variety.py | 6 +- src/sage/schemes/toric/homset.py | 96 +- src/sage/schemes/toric/ideal.py | 2 +- src/sage/schemes/toric/library.py | 2 +- src/sage/schemes/toric/points.py | 329 ++--- src/sage/schemes/toric/toric_subscheme.py | 4 +- src/sage/schemes/toric/variety.py | 20 +- src/sage/schemes/toric/weierstrass_higher.py | 17 +- 77 files changed, 4876 insertions(+), 4447 deletions(-) diff --git a/src/sage/schemes/affine/affine_homset.py b/src/sage/schemes/affine/affine_homset.py index 77e647edd16..52ea3f83c85 100644 --- a/src/sage/schemes/affine/affine_homset.py +++ b/src/sage/schemes/affine/affine_homset.py @@ -228,23 +228,23 @@ def points(self, **kwds): :: sage: u = QQ['u'].0 - 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 + sage: K. = NumberField(u^2 + 3) # needs sage.rings.number_field + sage: A. = AffineSpace(K, 2) # needs sage.rings.number_field + sage: len(A(K).points(bound=2)) # needs sage.rings.number_field 1849 :: sage: A. = AffineSpace(QQ, 2) sage: E = A.subscheme([x^2 + y^2 - 1, y^2 - x^3 + x^2 + x - 1]) - sage: E(A.base_ring()).points() + sage: E(A.base_ring()).points() # needs sage.libs.singular [(-1, 0), (0, -1), (0, 1), (1, 0)] :: - sage: A. = AffineSpace(CC, 2) + sage: A. = AffineSpace(CC, 2) # needs sage.rings.real_mpfr sage: E = A.subscheme([y^3 - x^3 - x^2, x*y]) - sage: E(A.base_ring()).points() + sage: E(A.base_ring()).points() # needs sage.libs.singular sage.rings.real_mpfr verbose 0 (...: affine_homset.py, points) Warning: computations in the numerical fields are inexact;points may be computed partially or incorrectly. @@ -253,9 +253,9 @@ def points(self, **kwds): :: - sage: A. = AffineSpace(CDF, 2) # optional - sage.rings.complex_double - sage: E = A.subscheme([x1^2 + x2^2 + x1*x2, x1 + x2]) # optional - sage.libs.singular sage.rings.complex_double - sage: E(A.base_ring()).points() # optional - sage.libs.singular sage.rings.complex_double + sage: A. = AffineSpace(CDF, 2) # needs sage.rings.complex_double + sage: E = A.subscheme([x1^2 + x2^2 + x1*x2, x1 + x2]) # needs sage.libs.singular sage.rings.complex_double + sage: E(A.base_ring()).points() # needs sage.libs.singular sage.rings.complex_double verbose 0 (...: affine_homset.py, points) Warning: computations in the numerical fields are inexact;points may be computed partially or incorrectly. @@ -393,28 +393,29 @@ def numerical_points(self, F=None, **kwds): EXAMPLES:: - 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 + sage: # needs sage.rings.number_field + 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 [(-1.18738247880014, -0.558021142104134), (1.57693558184861, 1.30713548084184), (4.80659931965815, 37.0162574656220)] - sage: L[0].codomain() # optional - sage.rings.number_field + sage: L[0].codomain() Affine Space of dimension 2 over Real Field with 53 bits of precision :: sage: A. = AffineSpace(QQ, 2) sage: X = A.subscheme([y^2 - x^2 - 3*x, x^2 - 10*y]) - sage: len(X(QQ).numerical_points(F=ComplexField(100))) + sage: len(X(QQ).numerical_points(F=ComplexField(100))) # needs sage.libs.singular 4 :: sage: A. = AffineSpace(QQ, 2) sage: E = A.subscheme([30*x1^100 + 1000*x2^2 + 2000*x1*x2 + 1, x1 + x2]) - sage: len(E(A.base_ring()).numerical_points(F=CDF, zero_tolerance=1e-9)) + sage: len(E(A.base_ring()).numerical_points(F=CDF, zero_tolerance=1e-9)) # needs sage.libs.singular 100 TESTS:: @@ -430,7 +431,7 @@ def numerical_points(self, F=None, **kwds): sage: A. = AffineSpace(QQ, 2) sage: X = A.subscheme([y^2 - x^2 - 3*x, x^2 - 10*y]) - sage: X(QQ).numerical_points(F=CC, zero_tolerance=-1) + sage: X(QQ).numerical_points(F=CC, zero_tolerance=-1) # needs sage.libs.singular Traceback (most recent call last): ... ValueError: tolerance must be positive diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index d601e12351d..602b6c1ce58 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -156,8 +156,8 @@ def __init__(self, parent, polys, check=True): sage: A. = AffineSpace(QQ, 3) 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: u,v,w = X.coordinate_ring().gens() # needs sage.libs.singular + sage: H([u, v, u + v]) # needs sage.libs.singular 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) @@ -167,8 +167,8 @@ def __init__(self, parent, polys, check=True): sage: A. = AffineSpace(QQ, 3) 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]) + sage: u,v,w = X.coordinate_ring().gens() # needs sage.libs.singular + sage: H([u, v, (u+1)/v]) # needs sage.libs.singular Traceback (most recent call last): ... ArithmeticError: Division failed. The numerator is not a multiple of the denominator. @@ -249,13 +249,14 @@ def __call__(self, x, check=True): Defn: Defined on coordinates by sending (u, v) to (u + v, u*v) - 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 + sage: # needs sage.rings.finite_rings + sage: F. = GF(4) + sage: P = T(F)(1, a) + sage: h(P) (a + 1, a) - sage: h(P).domain() # optional - sage.rings.finite_rings + sage: h(P).domain() Spectrum of Finite Field in a of size 2^2 - sage: h.change_ring(F)(P) # optional - sage.rings.finite_rings + sage: h.change_ring(F)(P) (a + 1, a) """ from sage.schemes.affine.affine_point import SchemeMorphism_point_affine @@ -298,6 +299,7 @@ def __eq__(self, right): :: + sage: # needs sage.rings.real_mpfr sage: A. = AffineSpace(CC, 3) sage: H = End(A) sage: f = H([x^2 - CC.0*x*y + z*x, 1/z^2 - y^2, 5*x]) @@ -324,6 +326,7 @@ def __ne__(self, right): EXAMPLES:: + sage: # needs sage.rings.real_mpfr sage: A. = AffineSpace(RR, 2) sage: H = End(A) sage: f = H([x^2 - y, y^2]) @@ -458,6 +461,7 @@ def homogenize(self, n): :: + sage: # needs sage.rings.real_mpfr sage: A. = AffineSpace(CC, 2) sage: H = Hom(A, A) sage: f = H([(x^2-2)/(x*y), y^2 - x]) @@ -473,7 +477,7 @@ def homogenize(self, n): sage: X = A.subscheme([x - y^2]) sage: H = Hom(X, X) sage: f = H([9*y^2, 3*y]) - sage: f.homogenize(2) + sage: f.homogenize(2) # needs sage.libs.singular 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 @@ -503,11 +507,12 @@ def homogenize(self, n): :: - 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 + sage: # needs sage.rings.number_field + sage: R. = PolynomialRing(QQbar) + sage: A. = AffineSpace(R, 2) + sage: H = End(A) + sage: f = H([QQbar(sqrt(2))*x*y, a*x^2]) # needs sage.symbolic + sage: f.homogenize(2) # needs sage.libs.singular 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 @@ -534,10 +539,11 @@ def homogenize(self, n): :: - 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 + sage: # needs sage.rings.number_field + sage: A. = AffineSpace(QQbar, 1) + sage: H = End(A) + sage: f = H([2*z / (z^2 + 2*z + 3)]) + sage: f.homogenize(1) Scheme endomorphism of Projective Space of dimension 1 over Algebraic Field Defn: Defined on coordinates by sending (x0 : x1) to @@ -545,11 +551,12 @@ def homogenize(self, n): :: - 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 + sage: # needs sage.rings.number_field + sage: R. = QQbar[] + sage: A. = AffineSpace(R, 1) + sage: H = Hom(A, A) + sage: F = H([d*x^2 + c]) + sage: F.homogenize(1) 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 @@ -640,7 +647,7 @@ def as_dynamical_system(self): sage: A. = AffineSpace(ZZ, 3) sage: H = End(A) sage: f = H([x^2, y^2, z^2]) - sage: type(f.as_dynamical_system()) + sage: type(f.as_dynamical_system()) # needs sage.schemes :: @@ -648,7 +655,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: type(f.as_dynamical_system()) + sage: type(f.as_dynamical_system()) # needs sage.schemes :: @@ -656,15 +663,15 @@ 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()) # optional - sage.rings.finite_rings sage.schemes + sage: type(f.as_dynamical_system()) # needs sage.rings.finite_rings sage.schemes :: sage: P. = AffineSpace(RR, 2) - sage: f = DynamicalSystem([x^2 + y^2, y^2], P) - sage: g = f.as_dynamical_system() - sage: g is f + sage: f = DynamicalSystem([x^2 + y^2, y^2], P) # needs sage.schemes + sage: g = f.as_dynamical_system() # needs sage.schemes + sage: g is f # needs sage.schemes True """ from sage.dynamics.arithmetic_dynamics.generic_ds import DynamicalSystem @@ -699,17 +706,17 @@ 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.global_height() # optional - sage.symbolic + sage: f.global_height() # needs sage.symbolic 15.4877354584971 :: sage: R. = PolynomialRing(QQ) - 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 + sage: k. = NumberField(x^2 + 5) # needs sage.rings.number_field + sage: A. = AffineSpace(k, 2) # needs sage.rings.number_field + sage: H = Hom(A, A) + sage: f = H([13*w*x^2 + 4*y, 1/w*y^2]) # needs sage.rings.number_field + sage: f.global_height(prec=2) # needs sage.rings.number_field 4.0 :: @@ -717,7 +724,7 @@ def global_height(self, prec=None): sage: A. = AffineSpace(ZZ, 1) sage: H = Hom(A, A) sage: f = H([7*x^2 + 1513]) - sage: f.global_height() # optional - sage.symbolic + sage: f.global_height() # needs sage.symbolic 7.32184971378836 :: @@ -726,7 +733,7 @@ def global_height(self, prec=None): sage: B. = AffineSpace(QQ, 2) sage: H = Hom(A, B) sage: f = H([1/3*x^2 + 10, 7*x^3]) - sage: f.global_height() # optional - sage.symbolic + sage: f.global_height() # needs sage.symbolic 3.40119738166216 :: @@ -735,7 +742,7 @@ def global_height(self, prec=None): sage: A. = AffineSpace(QQ, 1) sage: H = Hom(P, A) sage: f = H([1/1331*x^2 + 4000*y]) - sage: f.global_height() # optional - sage.symbolic + sage: f.global_height() # needs sage.symbolic 15.4877354584971 """ return self.homogenize(0).global_height(prec=prec) @@ -761,7 +768,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.local_height(1331) + sage: f.local_height(1331) # needs sage.rings.real_mpfr 7.19368581839511 :: @@ -769,7 +776,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.local_height(2) + sage: f.local_height(2) # needs sage.rings.real_mpfr 2.77258872223978 :: @@ -777,17 +784,17 @@ 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.local_height(2, prec=2) + sage: f.local_height(2, prec=2) # needs sage.rings.real_mpfr 3.0 :: sage: R. = PolynomialRing(QQ) - 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 + sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field + sage: P. = AffineSpace(K, 2) # needs sage.rings.number_field + sage: H = Hom(P, P) + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) # needs sage.rings.number_field + sage: f.local_height(K.ideal(3)) # needs sage.rings.number_field 1.09861228866811 """ K = FractionField(self.domain().base_ring()) @@ -816,7 +823,7 @@ def local_height_arch(self, i, 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.local_height_arch(0) + sage: f.local_height_arch(0) # needs sage.rings.real_mpfr 5.34710753071747 :: @@ -824,17 +831,17 @@ def local_height_arch(self, i, 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.local_height_arch(0, prec=5) + sage: f.local_height_arch(0, prec=5) # needs sage.rings.real_mpfr 5.2 :: sage: R. = PolynomialRing(QQ) - 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 + sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field + sage: P. = AffineSpace(K, 2) # needs sage.rings.number_field + sage: H = Hom(P, P) + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) # needs sage.rings.number_field + sage: f.local_height_arch(1) # needs sage.rings.number_field 0.6931471805599453094172321214582 """ K = FractionField(self.domain().base_ring()) @@ -861,7 +868,7 @@ def jacobian(self): sage: A. = AffineSpace(QQ, 1) sage: H = End(A) sage: f = H([z^2 - 3/4]) - sage: f.jacobian() + sage: f.jacobian() # needs sage.modules [2*z] :: @@ -869,7 +876,7 @@ def jacobian(self): sage: A. = AffineSpace(QQ, 2) sage: H = End(A) sage: f = H([x^3 - 25*x + 12*y, 5*y^2*x - 53*y + 24]) - sage: f.jacobian() + sage: f.jacobian() # needs sage.modules [ 3*x^2 - 25 12] [ 5*y^2 10*x*y - 53] @@ -878,7 +885,7 @@ def jacobian(self): sage: A. = AffineSpace(ZZ, 2) sage: H = End(A) sage: f = H([(x^2 - x*y)/(1+y), (5+y)/(2+x)]) - sage: f.jacobian() + sage: f.jacobian() # needs sage.modules [ (2*x - y)/(y + 1) (-x^2 - x)/(y^2 + 2*y + 1)] [ (-y - 5)/(x^2 + 4*x + 4) 1/(x + 2)] """ @@ -904,7 +911,7 @@ def _matrix_times_polymap_(self, mat, h): sage: A. = AffineSpace(ZZ, 1) sage: H = Hom(A, A) sage: f = H([x^2 + 1]) - sage: matrix([[1,2], [0,1]]) * f + sage: matrix([[1,2], [0,1]]) * f # needs sage.modules Scheme endomorphism of Affine Space of dimension 1 over Integer Ring Defn: Defined on coordinates by sending (x) to (x^2 + 3) @@ -915,7 +922,7 @@ def _matrix_times_polymap_(self, mat, h): sage: A2 = AffineSpace(ZZ, 2) sage: H = Hom(A1, A2) sage: f = H([x^2 + 1, x^2 - 1]) - sage: matrix([[1,2,3], [0,1,2], [0,0,1]]) * f + sage: matrix([[1,2,3], [0,1,2], [0,0,1]]) * f # needs sage.modules Scheme morphism: From: Affine Space of dimension 1 over Integer Ring To: Affine Space of dimension 2 over Integer Ring @@ -948,7 +955,7 @@ def _polymap_times_matrix_(self, mat, h): sage: A. = AffineSpace(ZZ, 1) sage: H = Hom(A, A) sage: f = H([x^2 + 1]) - sage: f * matrix([[1,2], [0,1]]) + sage: f * matrix([[1,2], [0,1]]) # needs sage.modules Scheme endomorphism of Affine Space of dimension 1 over Integer Ring Defn: Defined on coordinates by sending (x) to (x^2 + 4*x + 5) @@ -959,7 +966,7 @@ def _polymap_times_matrix_(self, mat, h): sage: A2 = AffineSpace(ZZ, 2) sage: H = Hom(A1, A2) sage: f = H([x^2 + 1, x^2 - 1]) - sage: f * matrix([[1,2], [0,1]]) + sage: f * matrix([[1,2], [0,1]]) # needs sage.modules Scheme morphism: From: Affine Space of dimension 1 over Integer Ring To: Affine Space of dimension 2 over Integer Ring @@ -972,8 +979,8 @@ def _polymap_times_matrix_(self, mat, h): 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*f + sage: m = matrix([[1,1,1], [1,0,1], [0,0,1]]) # needs sage.modules + sage: m*f # needs sage.modules Scheme morphism: From: Affine Space of dimension 3 over Rational Field To: Affine Space of dimension 2 over Rational Field @@ -1053,25 +1060,27 @@ def weil_restriction(self): EXAMPLES:: - 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 + sage: # needs sage.rings.number_field + 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() 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) # 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 + sage: # needs sage.rings.number_field + 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) True """ if any(isinstance(f, FractionFieldElement) for f in self): @@ -1099,25 +1108,26 @@ def reduce_base_field(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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() 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 + sage: f2 = H2([x^2 + 4, 2*x]) + sage: f2.reduce_base_field() 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]) # optional - sage.rings.finite_rings - sage: f3.reduce_base_field() # optional - sage.rings.finite_rings + sage: f3 = H3([a^2 + t*b]) + sage: f3.reduce_base_field() 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 @@ -1125,23 +1135,25 @@ def reduce_base_field(self): :: - 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 + sage: # needs sage.rings.number_field + 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 Defn: Defined on coordinates by sending (x) to (x^2 + v) - sage: g.base_ring() is K # optional - sage.rings.number_field + sage: g.base_ring() is K True :: - 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 + sage: # needs sage.rings.number_field + sage: A. = AffineSpace(QQbar, 1) + sage: H = End(A) + sage: f = H([(QQbar(sqrt(2))*x^2 + 1/QQbar(sqrt(3))) / (5*x)]) # needs sage.symbolic + sage: f.reduce_base_field() # needs sage.symbolic 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 @@ -1150,10 +1162,10 @@ def reduce_base_field(self): :: sage: R. = PolynomialRing(QQ) - 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 + sage: A. = AffineSpace(QQbar, 1) # needs sage.rings.number_field + sage: H = End(A) # needs sage.rings.number_field + sage: f = H([QQbar(3^(1/3))*x^2 + QQbar(sqrt(-2))]) # needs sage.rings.number_field sage.symbolic + sage: f.reduce_base_field() # needs sage.rings.number_field sage.symbolic 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 @@ -1165,13 +1177,13 @@ def reduce_base_field(self): :: sage: R. = PolynomialRing(QQ) - 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 + sage: K. = NumberField(x^3 - x + 1, # needs sage.rings.number_field + ....: embedding=(x^3 + x + 1).roots(ring=CC)[0][0]) + sage: A. = AffineSpace(K, 1) # needs sage.rings.number_field + sage: A2. = AffineSpace(K, 2) # needs sage.rings.number_field + sage: H = Hom(A, A2) # needs sage.rings.number_field + sage: f = H([x^2 + a*x + 3, 5*x]) # needs sage.rings.number_field + sage: f.reduce_base_field() # needs 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? @@ -1181,21 +1193,23 @@ def reduce_base_field(self): :: - 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 + sage: # needs sage.rings.number_field + 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() 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) # 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 + sage: # needs sage.rings.finite_rings + 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 Defn: Defined on coordinates by sending (x) to @@ -1229,7 +1243,7 @@ def indeterminacy_locus(self): sage: A. = AffineSpace(QQ, 2) sage: H = End(A) sage: f = H([x - y, x^2 - y^2]) - sage: f.indeterminacy_locus() + sage: f.indeterminacy_locus() # needs sage.libs.singular Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: 1 @@ -1237,7 +1251,7 @@ def indeterminacy_locus(self): sage: A. = AffineSpace(QQ, 2) sage: f = A.hom([x, x/y], A) - sage: f.indeterminacy_locus() + sage: f.indeterminacy_locus() # needs sage.libs.singular Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: y """ @@ -1262,7 +1276,7 @@ def indeterminacy_points(self, F=None): sage: A. = AffineSpace(QQ, 2) sage: H = End(A) sage: f = H([x - y, x^2 - y^2]) - sage: f.indeterminacy_points() + sage: f.indeterminacy_points() # needs sage.libs.singular [] :: @@ -1270,7 +1284,7 @@ def indeterminacy_points(self, F=None): sage: A2. = AffineSpace(QQ, 2) sage: P2. = ProjectiveSpace(QQ, 2) sage: f = A2.hom([x*y, y, x], P2) - sage: f.indeterminacy_points() + sage: f.indeterminacy_points() # needs sage.libs.singular [(0, 0)] """ @@ -1299,20 +1313,20 @@ def image(self): sage: A1. = AffineSpace(QQ, 1) sage: A2. = AffineSpace(QQ, 2) sage: f = A2.hom([x + y], A1) - sage: f.image() + sage: f.image() # needs sage.libs.singular Closed subscheme of Affine Space of dimension 1 over Rational Field defined by: (no polynomials) sage: f = A2.hom([x, x], A2) - sage: f.image() + sage: f.image() # needs sage.libs.singular Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x - y sage: f = A2.hom([x^2, x^3], A2) - sage: f.image() + sage: f.image() # needs sage.libs.singular Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x^3 - y^2 sage: P2. = ProjectiveSpace(QQ, 2) sage: f = A2.hom([x, x^2, x^3], P2) - sage: f.image() + sage: f.image() # needs sage.libs.singular Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x1^2 - x0*x2 """ @@ -1376,7 +1390,7 @@ def representatives(self): sage: A2. = AffineSpace(QQ, 2) sage: X = A2.subscheme(0) sage: f = X.hom([x, x/y], A2) - sage: f.representatives() + sage: f.representatives() # needs sage.libs.singular [Scheme morphism: From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: 0 @@ -1389,7 +1403,7 @@ def representatives(self): sage: A1. = AffineSpace(QQ, 1) sage: X = A2.subscheme([x^2 - y^2 - y]) sage: f = X.hom([x/y], A1) - sage: f.representatives() + sage: f.representatives() # needs sage.libs.singular [Scheme morphism: From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x^2 - y^2 - y @@ -1400,8 +1414,8 @@ def representatives(self): 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)] - sage: g = _[1] - sage: g.representatives() + sage: g = _[1] # needs sage.libs.singular + sage: g.representatives() # needs sage.libs.singular [Scheme morphism: From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x^2 - y^2 - y @@ -1419,7 +1433,7 @@ def representatives(self): sage: P1. = ProjectiveSpace(QQ, 1) sage: X = A2.subscheme([x^2 - y^2 - y]) sage: f = X.hom([x, y], P1) - sage: f.representatives() + sage: f.representatives() # needs sage.libs.singular [Scheme morphism: From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x^2 - y^2 - y @@ -1465,7 +1479,7 @@ def indeterminacy_locus(self): sage: X = A2.subscheme(0) sage: A1. = AffineSpace(QQ, 1) sage: f = X.hom([x1/x2], A1) - sage: f.indeterminacy_locus() + sage: f.indeterminacy_locus() # needs sage.libs.singular Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x2 @@ -1475,17 +1489,17 @@ def indeterminacy_locus(self): sage: X = A2.subscheme(0) sage: P1. = ProjectiveSpace(QQ, 1) sage: f = X.hom([x1,x2], P1) - sage: L = f.indeterminacy_locus() - sage: L.rational_points() + sage: L = f.indeterminacy_locus() # needs sage.libs.singular + sage: L.rational_points() # needs sage.libs.singular [(0, 0)] :: sage: A2. = AffineSpace(QQ, 2) sage: X = A2.subscheme([x^2 - y^2 - y]) - sage: A1. = AffineSpace(QQ,1) + sage: A1. = AffineSpace(QQ, 1) sage: f = X.hom([x/y], A1) - sage: f.indeterminacy_locus() + sage: f.indeterminacy_locus() # needs sage.libs.singular Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: y, x @@ -1496,12 +1510,11 @@ def indeterminacy_locus(self): sage: X = A3.subscheme(x^2 - y*z - x) sage: A2. = AffineSpace(QQ, 2) sage: f = X.hom([y, y/x], A2) - sage: L = f.indeterminacy_locus() - sage: L + sage: L = f.indeterminacy_locus(); L # needs sage.libs.singular Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: x, y*z - sage: L.dimension() + sage: L.dimension() # needs sage.libs.singular 1 """ @@ -1529,7 +1542,7 @@ def is_morphism(self): 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() + sage: f.is_morphism() # needs sage.libs.singular True """ return self.indeterminacy_locus().dimension() < 0 @@ -1546,7 +1559,7 @@ def image(self): sage: A2. = AffineSpace(QQ, 2) sage: X = A2.subscheme(0) sage: f = X.hom([x + y], A1) - sage: f.image() + sage: f.image() # needs sage.libs.singular Closed subscheme of Affine Space of dimension 1 over Rational Field defined by: (no polynomials) @@ -1555,7 +1568,7 @@ def image(self): sage: A2. = AffineSpace(QQ, 2) sage: X = A2.subscheme([x*y^2 - y^3 - 1]) sage: f = X.hom([y, y/x], A2) - sage: f.image() + sage: f.image() # needs sage.libs.singular Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: -x^3*y + x^3 - y """ diff --git a/src/sage/schemes/affine/affine_point.py b/src/sage/schemes/affine/affine_point.py index 88f74efee2a..a30ae04e009 100644 --- a/src/sage/schemes/affine/affine_point.py +++ b/src/sage/schemes/affine/affine_point.py @@ -115,16 +115,16 @@ def _matrix_times_point_(self, mat, dom): sage: P = AffineSpace(QQ,2) sage: Q = P(1,2) - sage: m = matrix(ZZ, 3, 3, [0,1,1,0,0,1,1,1,1]) - sage: m*Q + sage: m = matrix(ZZ, 3, 3, [0,1,1,0,0,1,1,1,1]) # needs sage.modules + sage: m*Q # needs sage.modules (3/4, 1/4) :: sage: P = AffineSpace(QQ,1) sage: Q = P(0) - sage: m = matrix(RR, 2, 2, [0,1,1,0]) - sage: m*Q + sage: m = matrix(RR, 2, 2, [0,1,1,0]) # needs sage.modules + sage: m*Q # needs sage.modules Traceback (most recent call last): ... ValueError: resulting point not affine @@ -133,8 +133,8 @@ def _matrix_times_point_(self, mat, dom): sage: P = AffineSpace(QQ,2) sage: Q = P(1,1) - sage: m = matrix(RR, 2, 2, [0,1,1,0]) - sage: m*Q + sage: m = matrix(RR, 2, 2, [0,1,1,0]) # needs sage.modules + sage: m*Q # needs sage.modules Traceback (most recent call last): ... ValueError: matrix size is incompatible @@ -158,9 +158,9 @@ def __hash__(self): :: - sage: A. = AffineSpace(CC, 3) # optional - sage.rings.real_mpfr - sage: pt = A([1, 2, -i]) # optional - sage.rings.real_mpfr sage.symbolic - sage: hash(pt) == hash(tuple(pt)) # optional - sage.rings.real_mpfr sage.symbolic + sage: A. = AffineSpace(CC, 3) # needs sage.rings.real_mpfr + sage: pt = A([1, 2, -i]) # needs sage.rings.real_mpfr sage.symbolic + sage: hash(pt) == hash(tuple(pt)) # needs sage.rings.real_mpfr sage.symbolic True """ @@ -183,22 +183,22 @@ def global_height(self, prec=None): sage: P. = AffineSpace(QQ, 2) sage: Q = P(41, 1/12) - sage: Q.global_height() + sage: Q.global_height() # needs sage.rings.real_mpfr 3.71357206670431 :: sage: P = AffineSpace(ZZ, 4, 'x') sage: Q = P(3, 17, -51, 5) - sage: Q.global_height() + sage: Q.global_height() # needs sage.rings.real_mpfr 3.93182563272433 :: sage: R. = PolynomialRing(QQ) - 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 + sage: k. = NumberField(x^2 + 5) # needs sage.rings.number_field + sage: A = AffineSpace(k, 2, 'z') # needs sage.rings.number_field + sage: A([3, 5*w + 1]).global_height(prec=100) # needs sage.rings.number_field sage.rings.real_mpfr 2.4181409534757389986565376694 .. TODO:: @@ -291,24 +291,25 @@ def weil_restriction(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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 (1, 0, 0, 4, 0, 0, 1, 0, 0) - sage: Q.codomain() == Y # optional - sage.rings.finite_rings + sage: Q.codomain() == Y True :: sage: R. = QQ[] - 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 + sage: K. = NumberField(x^5 - 2) # needs sage.rings.number_field + sage: R. = K[] # needs sage.rings.number_field + sage: L. = K.extension(x^2 + w) # needs sage.rings.number_field + sage: A. = AffineSpace(L, 2) # needs sage.rings.number_field + sage: P = A([w^3 - v, 1 + w + w*v]) # needs sage.rings.number_field + sage: P.weil_restriction() # needs sage.rings.number_field (w^3, -1, w + 1, w) """ L = self.codomain().base_ring() @@ -362,10 +363,10 @@ def intersection_multiplicity(self, X): 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) # optional - sage.rings.finite_rings + sage: Q1.intersection_multiplicity(X) # needs sage.rings.finite_rings 2 sage: Q2 = X([4,6]) - sage: Q2.intersection_multiplicity(Y) # optional - sage.rings.finite_rings + sage: Q2.intersection_multiplicity(Y) # needs sage.rings.finite_rings 1 :: @@ -397,10 +398,10 @@ def multiplicity(self): sage: A. = AffineSpace(QQ, 3) sage: X = A.subscheme([y^2 - x^7*z]) sage: Q1 = X([1,1,1]) - sage: Q1.multiplicity() + sage: Q1.multiplicity() # needs sage.libs.singular 1 sage: Q2 = X([0,0,2]) - sage: Q2.multiplicity() + sage: Q2.multiplicity() # needs sage.libs.singular 2 """ from sage.schemes.affine.affine_space import is_AffineSpace @@ -438,8 +439,8 @@ def __hash__(self): :: - sage: P. = AffineSpace(GF(13^3, 't'), 2) # optional - sage.rings.finite_rings - sage: hash(P(3, 4)) # optional - sage.rings.finite_rings + sage: P. = AffineSpace(GF(13^3, 't'), 2) # needs sage.rings.finite_rings + sage: hash(P(3, 4)) # needs 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 271864fe2af..60dc76543ca 100644 --- a/src/sage/schemes/affine/affine_rational_point.py +++ b/src/sage/schemes/affine/affine_rational_point.py @@ -94,8 +94,8 @@ def enum_affine_rational_field(X, B): :: sage: A. = AffineSpace(2, QQ) - sage: C = Curve(x^2 + y - x) - sage: enum_affine_rational_field(C, 10) # long time (3 s) + sage: C = Curve(x^2 + y - x) # needs sage.libs.singular + sage: enum_affine_rational_field(C, 10) # long time (3 s) # needs sage.libs.singular [(-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)] @@ -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') # 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 + sage: K = NumberField(u^2 + 2, 'v') # needs sage.rings.number_field + sage: A. = AffineSpace(K, 3) # needs sage.rings.number_field + sage: X = A.subscheme([y^2 - x]) # needs sage.rings.number_field + sage: enum_affine_number_field(X(K), bound=2**0.5) # needs 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), @@ -203,10 +203,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 + 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 + sage: K = NumberField(u^2 + 3, 'v') # needs sage.rings.number_field + sage: A. = AffineSpace(K, 2) # needs sage.rings.number_field + sage: X = A.subscheme(x - y) # needs sage.rings.number_field + sage: enum_affine_number_field(X, bound=3**0.25) # needs 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)] """ diff --git a/src/sage/schemes/affine/affine_space.py b/src/sage/schemes/affine/affine_space.py index 87f63d3cedf..dd3bdcaeacd 100644 --- a/src/sage/schemes/affine/affine_space.py +++ b/src/sage/schemes/affine/affine_space.py @@ -49,7 +49,7 @@ def is_AffineSpace(x) -> bool: 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')) # optional - sage.rings.finite_rings + sage: is_AffineSpace(AffineSpace(5, GF(9, 'alpha'), names='x')) # needs sage.rings.finite_rings True sage: is_AffineSpace(Spec(ZZ)) False @@ -170,10 +170,10 @@ class AffineSpace_generic(AmbientSpace, AffineScheme): sage: AffineSpace(5, PolynomialRing(QQ, 'z'), 'Z') Affine Space of dimension 5 over Univariate Polynomial Ring in z over Rational Field - sage: AffineSpace(RealField(), 3, 'Z') + sage: AffineSpace(RealField(), 3, 'Z') # needs sage.rings.real_mpfr Affine Space of dimension 3 over Real Field with 53 bits of precision - sage: AffineSpace(Qp(7), 2, 'x') # optional - sage.rings.padics + sage: AffineSpace(Qp(7), 2, 'x') # needs 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') # optional - sage.rings.padics + sage: AffineSpace(3, Zp(5), 'y') # needs sage.rings.padics Affine Space of dimension 3 over 5-adic Ring with capped relative precision 20 """ AmbientSpace.__init__(self, n, R) @@ -252,7 +252,7 @@ def rational_points(self, F=None): sage: A = AffineSpace(1, GF(3)) sage: A.rational_points() [(0), (1), (2)] - sage: A.rational_points(GF(3^2, 'b')) # optional - sage.rings.finite_rings + sage: A.rational_points(GF(3^2, 'b')) # needs 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)) @@ -333,7 +333,7 @@ def _latex_(self): TESTS:: - sage: AffineSpace(3, Zp(5), 'y')._latex_() # optional - sage.rings.padics + sage: AffineSpace(3, Zp(5), 'y')._latex_() # needs 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_() # optional - sage.rings.padics + sage: AffineSpace(3, Zp(5), 'y')._repr_() # needs 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()) @@ -638,9 +638,9 @@ def change_ring(self, R): :: - 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 + sage: K. = QuadraticField(5) # needs sage.rings.number_field + sage: A = AffineSpace(K, 2, 't') # needs sage.rings.number_field + sage: A.change_ring(K.embeddings(CC)[1]) # needs sage.rings.number_field Affine Space of dimension 2 over Complex Field with 53 bits of precision """ if isinstance(R, Map): @@ -654,9 +654,9 @@ def coordinate_ring(self): EXAMPLES:: - sage: R = AffineSpace(2, GF(9,'alpha'), 'z').coordinate_ring(); R # optional - sage.rings.finite_rings + sage: R = AffineSpace(2, GF(9,'alpha'), 'z').coordinate_ring(); R # needs 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() # optional - sage.rings.finite_rings + sage: AffineSpace(3, R, 'x').coordinate_ring() # needs 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 """ @@ -810,6 +810,7 @@ def subscheme(self, X, **kwds): :: + sage: # needs sage.libs.singular sage: X.defining_polynomials () (x, y^2, x*y^2) sage: I = X.defining_ideal(); I @@ -851,7 +852,7 @@ def _an_element_(self): sage: AffineSpace(ZZ, 2, 'x').an_element() (5, 4) - sage: AffineSpace(Qp(5), 2, 'x').an_element() # optional - sage.rings.padics + sage: AffineSpace(Qp(5), 2, 'x').an_element() # needs sage.rings.padics (5^2 + O(5^22), 4*5 + O(5^21)) """ n = self.dimension_relative() @@ -883,21 +884,21 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): EXAMPLES:: sage: A. = AffineSpace(QQ, 1) - sage: A.chebyshev_polynomial(5, 'first') + sage: A.chebyshev_polynomial(5, 'first') # needs sage.schemes 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) :: sage: A. = AffineSpace(QQ, 1) - sage: A.chebyshev_polynomial(3, 'second') + sage: A.chebyshev_polynomial(3, 'second') # needs sage.schemes Dynamical System of Affine Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x) to (8*x^3 - 4*x) :: sage: A. = AffineSpace(QQ, 1) - sage: A.chebyshev_polynomial(3, 2) + sage: A.chebyshev_polynomial(3, 2) # needs sage.schemes Traceback (most recent call last): ... ValueError: keyword 'kind' must have a value of either 'first' or 'second' @@ -921,15 +922,15 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): :: sage: A. = AffineSpace(QQ, 1) - sage: A.chebyshev_polynomial(7, monic=True) + sage: A.chebyshev_polynomial(7, monic=True) # needs sage.schemes 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) :: sage: F. = FunctionField(QQ) - sage: A. = AffineSpace(F,1) - sage: A.chebyshev_polynomial(4, monic=True) + sage: A. = AffineSpace(F, 1) + sage: A.chebyshev_polynomial(4, monic=True) # needs sage.schemes 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) @@ -1051,8 +1052,8 @@ def points_of_bounded_height(self, **kwds): :: sage: u = QQ['u'].0 - 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 + sage: A. = AffineSpace(NumberField(u^2 - 2, 'v'), 2) # needs sage.rings.number_field + sage: len(list(A.points_of_bounded_height(bound=2, tolerance=0.1))) # needs sage.rings.number_field 529 """ if is_RationalField(self.base_ring()): @@ -1106,14 +1107,14 @@ def weil_restriction(self): EXAMPLES:: sage: R. = QQ[] - 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 + sage: K. = NumberField(x^5 - 2) # needs sage.rings.number_field + sage: AK. = AffineSpace(K, 2) # needs sage.rings.number_field + sage: AK.weil_restriction() # needs sage.rings.number_field Affine Space of dimension 10 over Rational Field - 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 + sage: R. = K[] # needs sage.rings.number_field + sage: L. = K.extension(x^2 + 1) # needs sage.rings.number_field + sage: AL. = AffineSpace(L, 2) # needs sage.rings.number_field + sage: AL.weil_restriction() # needs sage.rings.number_field Affine Space of dimension 4 over Number Field in w with defining polynomial x^5 - 2 """ @@ -1147,7 +1148,7 @@ def curve(self, F): EXAMPLES:: sage: A. = AffineSpace(QQ, 3) - sage: A.curve([y - x^4, z - y^5]) + sage: A.curve([y - x^4, z - y^5]) # needs sage.libs.pari Affine Curve over Rational Field defined by -x^4 + y, -y^5 + z """ from sage.schemes.curves.constructor import Curve @@ -1166,13 +1167,12 @@ def line_through(self, p, q): sage: A3. = AffineSpace(3, QQ) sage: p1 = A3(1, 2, 3) sage: p2 = A3(4, 5, 6) - sage: A3.line_through(p1, p2) + sage: L = A3.line_through(p1, p2); L # needs sage.schemes 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 - sage: L = _ - sage: L(p1) + sage: L(p1) # needs sage.schemes (1, 2, 3) - sage: L(p2) + sage: L(p2) # needs sage.schemes (4, 5, 6) sage: A3.line_through(p1, p1) Traceback (most recent call last): diff --git a/src/sage/schemes/affine/affine_subscheme.py b/src/sage/schemes/affine/affine_subscheme.py index 889dfcef084..20f7cbe49c3 100644 --- a/src/sage/schemes/affine/affine_subscheme.py +++ b/src/sage/schemes/affine/affine_subscheme.py @@ -59,7 +59,7 @@ def __init__(self, A, polynomials, embedding_center=None, EXAMPLES:: sage: A. = AffineSpace(QQ, 3) - sage: A.subscheme([y^2-x*z-x*y]) + sage: A.subscheme([y^2 - x*z - x*y]) Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: -x*y + y^2 - x*z """ @@ -99,15 +99,15 @@ def dimension(self): EXAMPLES:: sage: A. = AffineSpace(2, QQ) - sage: A.subscheme([]).dimension() + sage: A.subscheme([]).dimension() # needs sage.libs.singular 2 - sage: A.subscheme([x]).dimension() + sage: A.subscheme([x]).dimension() # needs sage.libs.singular 1 - sage: A.subscheme([x^5]).dimension() + sage: A.subscheme([x^5]).dimension() # needs sage.libs.singular 1 - sage: A.subscheme([x^2 + y^2 - 1]).dimension() + sage: A.subscheme([x^2 + y^2 - 1]).dimension() # needs sage.libs.singular 1 - sage: A.subscheme([x*(x-1), y*(y-1)]).dimension() + sage: A.subscheme([x*(x-1), y*(y-1)]).dimension() # needs sage.libs.singular 0 Something less obvious:: @@ -120,7 +120,7 @@ def dimension(self): x^2*y^2 + z^2, z^2 - w^2, 10*x^2 - z^2 + w^2 - sage: X.dimension() + sage: X.dimension() # needs sage.libs.singular 1 """ try: @@ -152,7 +152,7 @@ def projective_embedding(self, i=None, PP=None): sage: A. = AffineSpace(3, ZZ) sage: S = A.subscheme([x*y - z]) - sage: S.projective_embedding() + sage: S.projective_embedding() # needs sage.libs.singular Scheme morphism: From: Closed subscheme of Affine Space of dimension 3 over Integer Ring defined by: x*y - z @@ -165,7 +165,7 @@ 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: S.projective_embedding(1, P) # needs sage.libs.singular Scheme morphism: From: Closed subscheme of Affine Space of dimension 3 over Integer Ring defined by: x^2 - y*z @@ -177,7 +177,7 @@ def projective_embedding(self, i=None, PP=None): sage: A. = AffineSpace(QQ, 3) sage: X = A.subscheme([y - x^2, z - x^3]) - sage: X.projective_embedding() + sage: X.projective_embedding() # needs sage.libs.singular Scheme morphism: From: Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: -x^2 + y, -x^3 + z @@ -189,17 +189,17 @@ def projective_embedding(self, i=None, PP=None): projective embedding, the subscheme inherits the embedding:: sage: A. = AffineSpace(2, QQ, default_embedding_index=1) - sage: X = A.subscheme(u - v) - sage: X.projective_embedding() + sage: X = A.subscheme(u - v) # needs sage.libs.singular + sage: X.projective_embedding() # needs sage.libs.singular 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) - sage: phi = X.projective_embedding() + sage: phi = X.projective_embedding() # needs sage.libs.singular sage: psi = A.projective_embedding() - sage: phi(X(2, 2)) == psi(A(X(2, 2))) + sage: phi(X(2, 2)) == psi(A(X(2, 2))) # needs sage.libs.singular True """ AA = self.ambient_space() @@ -261,8 +261,9 @@ def projective_closure(self, i=None, PP=None): EXAMPLES:: 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() + 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() # needs sage.libs.singular Closed subscheme of Projective Space of dimension 4 over Rational Field defined by: x0^2 - x1*x4, @@ -277,7 +278,7 @@ def projective_closure(self, i=None, PP=None): sage: A. = AffineSpace(QQ, 3) sage: P. = ProjectiveSpace(QQ, 3) sage: X = A.subscheme([z - x^2 - y^2]) - sage: X.projective_closure(1, P).ambient_space() == P + sage: X.projective_closure(1, P).ambient_space() == P # needs sage.libs.singular True """ return self.projective_embedding(i, PP).codomain() @@ -310,11 +311,11 @@ def is_smooth(self, point=None): sage: singular_point = cuspidal_curve.point([0,0]) sage: singular_point in cuspidal_curve True - sage: cuspidal_curve.is_smooth(smooth_point) + sage: cuspidal_curve.is_smooth(smooth_point) # needs sage.libs.singular True - sage: cuspidal_curve.is_smooth(singular_point) + sage: cuspidal_curve.is_smooth(singular_point) # needs sage.libs.singular False - sage: cuspidal_curve.is_smooth() + sage: cuspidal_curve.is_smooth() # needs sage.libs.singular False """ R = self.ambient_space().coordinate_ring() @@ -354,24 +355,24 @@ def intersection_multiplicity(self, X, P): EXAMPLES:: sage: A. = AffineSpace(QQ, 2) - sage: C = Curve([y^2 - x^3 - x^2], A) - sage: D = Curve([y^2 + x^3], A) + sage: C = Curve([y^2 - x^3 - x^2], A) # needs sage.libs.singular + sage: D = Curve([y^2 + x^3], A) # needs sage.libs.singular sage: Q = A([0,0]) - sage: C.intersection_multiplicity(D, Q) + sage: C.intersection_multiplicity(D, Q) # needs sage.libs.singular 4 :: sage: R. = QQ[] - 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 + sage: K. = NumberField(a^6 - 3*a^5 + 5*a^4 - 5*a^3 + 5*a^2 - 3*a + 1) # needs sage.rings.number_field + sage: A. = AffineSpace(K, 4) # needs sage.rings.number_field + sage: X = A.subscheme([x*y, y*z + 7, w^3 - x^3]) # needs sage.rings.number_field + sage: Y = A.subscheme([x - z^3 + z + 1]) # needs sage.rings.number_field + sage: Q = A([0, # needs 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 + sage: X.intersection_multiplicity(Y, Q) # needs sage.rings.number_field 3 :: @@ -380,7 +381,7 @@ def intersection_multiplicity(self, X, P): sage: X = A.subscheme([z^2 - 1]) sage: Y = A.subscheme([z - 1, y - x^2]) sage: Q = A([1,1,1]) - sage: X.intersection_multiplicity(Y, Q) + sage: X.intersection_multiplicity(Y, Q) # needs sage.libs.singular Traceback (most recent call last): ... TypeError: the intersection of this subscheme and (=Closed subscheme of Affine Space of dimension 3 @@ -392,7 +393,7 @@ def intersection_multiplicity(self, X, P): sage: X = A.subscheme([x*y, t^2*w, w^3*z]) sage: Y = A.subscheme([y*w + z]) sage: Q = A([0,0,0,0,0]) - sage: X.intersection_multiplicity(Y, Q) + sage: X.intersection_multiplicity(Y, Q) # needs sage.libs.singular Traceback (most recent call last): ... TypeError: the intersection of this subscheme and (=Closed subscheme of Affine Space of dimension 5 @@ -446,30 +447,31 @@ def multiplicity(self, P): sage: A. = AffineSpace(QQ, 4) sage: X = A.subscheme([z*y - x^7, w - 2*z]) sage: Q1 = A([1,1/3,3,6]) - sage: X.multiplicity(Q1) + sage: X.multiplicity(Q1) # needs sage.libs.singular 1 sage: Q2 = A([0,0,0,0]) - sage: X.multiplicity(Q2) + sage: X.multiplicity(Q2) # needs sage.libs.singular 2 :: sage: A. = AffineSpace(GF(23), 5) - sage: C = A.curve([x^8 - y, y^7 - z, z^3 - 1, w^5 - v^3]) # optional - sage.rings.finite_rings + sage: C = A.curve([x^8 - y, y^7 - z, z^3 - 1, w^5 - v^3]) # needs sage.rings.finite_rings sage: Q = A([22,1,1,0,0]) - sage: C.multiplicity(Q) # optional - sage.rings.finite_rings + sage: C.multiplicity(Q) # needs sage.rings.finite_rings 3 :: - 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 + sage: # needs sage.rings.number_field + 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) 1 - sage: Q2 = A([0,0,0,-a,0]) # optional - sage.rings.number_field - sage: X.multiplicity(Q2) # optional - sage.rings.number_field + sage: Q2 = A([0,0,0,-a,0]) + sage: X.multiplicity(Q2) 7 Check that :trac:`27479` is fixed:: @@ -477,7 +479,7 @@ def multiplicity(self, P): sage: A1. = AffineSpace(QQ, 1) sage: X = A1.subscheme([x^1789 + x]) sage: Q = X([0]) - sage: X.multiplicity(Q) + sage: X.multiplicity(Q) # needs sage.libs.singular 1 """ if not self.base_ring() in Fields(): @@ -543,11 +545,11 @@ def tangent_space(self, p): sage: A3. = AffineSpace(3, QQ) sage: X = A3.subscheme(z - x*y) - sage: X.tangent_space(A3.origin()) + sage: X.tangent_space(A3.origin()) # needs sage.libs.singular Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: z - sage: X.tangent_space(X(1,1,1)) + sage: X.tangent_space(X(1,1,1)) # needs sage.libs.singular Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: -x - y + z @@ -555,6 +557,7 @@ def tangent_space(self, p): Tangent space at a point may have higher dimension than the dimension of the point. :: + sage: # needs sage.libs.singular sage: C = Curve([x + y + z, x^2 - y^2*z^2 + z^3]) sage: C.singular_points() [(0, 0, 0)] diff --git a/src/sage/schemes/berkovich/berkovich_cp_element.py b/src/sage/schemes/berkovich/berkovich_cp_element.py index 4611d396fce..a0acee09194 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) # optional - sage.rings.padics - sage: B(2) # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics + sage: B(2) # needs sage.rings.padics Type I point centered at 2 + O(3^20) :: - sage: B(0, 1) # optional - sage.rings.padics + sage: B(0, 1) # needs 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) # optional - sage.rings.padics - sage: B(4) # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(5) # needs sage.rings.padics + sage: B(4) # needs 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)) # optional - sage.rings.padics - sage: Q1 = B(9) # optional - sage.rings.padics - sage: Q1._custom_abs(Q1.center()) # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(Qp(3)) # needs sage.rings.padics + sage: Q1 = B(9) # needs sage.rings.padics + sage: Q1._custom_abs(Q1.center()) # needs 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) # 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: B = Berkovich_Cp_Projective(5) # needs sage.rings.padics + sage: L. = PolynomialRing(Qp(5)) # needs sage.rings.padics + sage: T = FractionField(L) # needs sage.rings.padics + sage: f = T(1/t) # needs sage.rings.padics sage: R. = RR[] sage: Y = FractionField(R) - 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 + sage: g = (40*pi)/x # needs sage.symbolic + sage: Q1 = B(f, g) # needs sage.rings.padics sage.symbolic + sage: Q1.center_function() # needs 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) # 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: B = Berkovich_Cp_Projective(5) # needs sage.rings.padics + sage: L. = PolynomialRing(Qp(5)) # needs sage.rings.padics + sage: T = FractionField(L) # needs sage.rings.padics + sage: f = T(1/t) # needs sage.rings.padics sage: R. = RR[] sage: Y = FractionField(R) - 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 + sage: g = (40*pi)/x # needs sage.symbolic + sage: Q1 = B(f, g) # needs sage.rings.padics sage.symbolic + sage: Q1.radius_function() # needs 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)) # 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 + sage: B = Berkovich_Cp_Affine(Qp(3)) # needs sage.rings.padics + sage: d = B([2, 2, 2], [1.761, 1.123, 1.112]) # needs sage.rings.padics + sage: d.precision() # needs sage.rings.padics 3 TESTS:: - sage: d.precision == d.prec # optional - sage.rings.padics + sage: d.precision == d.prec # needs sage.rings.padics True """ if self._type in [1, 2, 3]: @@ -537,8 +537,8 @@ def ideal(self): :: - sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics - sage: B(0).ideal() # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: B(0).ideal() # needs sage.rings.padics """ return self.parent().ideal() @@ -557,15 +557,15 @@ def power(self): EXAMPLES:: - 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 + sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics + sage: Q1 = B(1, 9) # needs sage.rings.padics + sage: Q1.power() # needs sage.rings.padics 2 :: - sage: Q2 = B(1, 4) # optional - sage.rings.padics - sage: Q2.power() # optional - sage.rings.padics + sage: Q2 = B(1, 4) # needs sage.rings.padics + sage: Q2.power() # needs 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) # optional - sage.rings.padics - sage: Q1 = B(1, 2/5) # optional - sage.rings.padics - sage: Q1.radius() # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics + sage: Q1 = B(1, 2/5) # needs sage.rings.padics + sage: Q1.radius() # needs sage.rings.padics 0.400000000000000 :: - sage: d = B([2, 2, 2], [1.761, 1.123, 1.112]) # optional - sage.rings.padics - sage: d.radius() # optional - sage.rings.padics + sage: d = B([2, 2, 2], [1.761, 1.123, 1.112]) # needs sage.rings.padics + sage: d.radius() # needs sage.rings.padics [1.76100000000000, 1.12300000000000, 1.11200000000000] """ if self._type == 4: @@ -618,38 +618,40 @@ def diameter(self, basepoint=Infinity): EXAMPLES:: - 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 + sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics + sage: Q1 = B(3) # needs sage.rings.padics + sage: Q1.diameter() # needs sage.rings.padics 0 :: - sage: Q2 = B(1/2, 9) # optional - sage.rings.padics - sage: Q2.diameter() # optional - sage.rings.padics + sage: Q2 = B(1/2, 9) # needs sage.rings.padics + sage: Q2.diameter() # needs sage.rings.padics 9.00000000000000 The diameter of a type IV point is the limit of the radii:: - 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 + sage: # needs sage.rings.padics + 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() 1.0 :: - 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 + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: Q1 = B(1/81, 1) + sage: Q2 = B(1/3) + sage: Q1.diameter(Q2) 0.00137174211248285 :: - sage: Q2.diameter(Q2) # optional - sage.rings.padics + sage: Q2.diameter(Q2) # needs sage.rings.padics +infinity """ if basepoint == Infinity: @@ -693,21 +695,22 @@ def path_distance_metric(self, other): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: Q1 = B(1/4, 4) + sage: Q2 = B(1/4, 6) + sage: Q1.path_distance_metric(Q2) 0.369070246428542 :: - sage: Q3 = B(1) # optional - sage.rings.padics - sage: Q3.path_distance_metric(Q1) # optional - sage.rings.padics + sage: Q3 = B(1) # needs sage.rings.padics + sage: Q3.path_distance_metric(Q1) # needs sage.rings.padics +infinity :: - sage: Q3.path_distance_metric(Q3) # optional - sage.rings.padics + sage: Q3.path_distance_metric(Q3) # needs sage.rings.padics 0 """ if not isinstance(other, type(self)): @@ -744,20 +747,22 @@ def Hsia_kernel(self, other, basepoint): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + 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) 0.111111111111111 :: - 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 + sage: # needs sage.rings.padics + 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) +infinity """ @@ -790,10 +795,11 @@ def small_metric(self, other): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: Q1 = B(1/4, 4) + sage: Q2 = B(1/4, 6) + sage: Q1.small_metric(Q2) 0.0833333333333333 :: @@ -853,20 +859,22 @@ def potential_kernel(self, other, basepoint): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + 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) 0.369070246428543 :: - 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 + sage: # needs sage.rings.padics + 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) 0.369070246428543 """ if not isinstance(other, type(self)): @@ -895,16 +903,17 @@ def spherical_kernel(self, other): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: Q1 = B(2, 2) + sage: Q2 = B(1/9, 1) + sage: Q1.spherical_kernel(Q2) 0.500000000000000 :: - sage: Q3 = B(2) # optional - sage.rings.padics - sage: Q3.spherical_kernel(Q3) # optional - sage.rings.padics + sage: Q3 = B(2) # needs sage.rings.padics + sage: Q3.spherical_kernel(Q3) # needs sage.rings.padics 0 """ if not isinstance(other, type(self)): @@ -933,21 +942,22 @@ def Hsia_kernel_infinity(self, other): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + 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) 6.00000000000000 :: sage: R. = QQ[] - 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 + sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field + sage: ideal = A.ideal(-1/2*a^2 + a - 3) # needs sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field + sage: Q1 = B(4) # needs sage.rings.number_field + sage: Q2 = B(0, 1.5) # needs sage.rings.number_field + sage: Q1.Hsia_kernel_infinity(Q2) # needs sage.rings.number_field 1.50000000000000 """ return self.join(other).diameter() @@ -961,23 +971,23 @@ def center(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics - sage: B(3, 1).center() # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics + sage: B(3, 1).center() # needs sage.rings.padics 3 + O(3^21) :: - sage: C = Berkovich_Cp_Projective(3) # optional - sage.rings.padics - sage: C(3, 1).center() # optional - sage.rings.padics + sage: C = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: C(3, 1).center() # needs sage.rings.padics (3 + O(3^21) : 1 + O(3^20)) :: sage: R. = QQ[] - 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 + sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field + sage: ideal = A.ideal(-1/2*a^2 + a - 3) # needs sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field + sage: B(a^2 + 4).center() # needs sage.rings.number_field (a^2 + 4 : 1) """ if self._type == 4: @@ -992,13 +1002,13 @@ def type_of_point(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics - sage: B(1).type_of_point() # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics + sage: B(1).type_of_point() # needs sage.rings.padics 1 :: - sage: B(0, 1).type_of_point() # optional - sage.rings.padics + sage: B(0, 1).type_of_point() # needs sage.rings.padics 2 """ return ZZ(self._type) @@ -1011,8 +1021,8 @@ def prime(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics - sage: B(1).prime() # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics + sage: B(1).prime() # needs sage.rings.padics 3 """ return ZZ(self._p) @@ -1023,10 +1033,11 @@ def __ne__(self, other): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: Q1 = B(3, 3**(1/2)) # needs sage.symbolic + sage: Q2 = B(3, RR(3**(1/2))) # needs sage.symbolic + sage: Q1 != Q2 # needs sage.symbolic False """ return not (self == other) @@ -1037,8 +1048,8 @@ def _repr_(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics - sage: B(2, 1) # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: B(2, 1) # needs 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 +1078,8 @@ def _latex_(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics - sage: latex(B(2, 1)) # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: latex(B(2, 1)) # needs 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 +1143,124 @@ 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)) # optional - sage.rings.padics - sage: B(4) # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(Qp(3)) # needs sage.rings.padics + sage: B(4) # needs 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) # optional - sage.rings.padics - sage: B(1 + t) # optional - sage.rings.padics + sage: A. = Qq(27) # needs sage.rings.padics + sage: B(1 + t) # needs 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)) # optional - sage.rings.padics sage.symbolic + sage: B(2, 3**(1/2)) # needs sage.rings.padics sage.symbolic Type II point centered at 2 + O(3^20) of radius 3^1/2 :: - sage: B(2, 1.6) # optional - sage.rings.padics + sage: B(2, 1.6) # needs 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 # optional - sage.rings.padics + sage: B(3, 3**0.5) # not tested # needs 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)) # optional - sage.rings.padics + sage: B(3, power=RR(1/100000)) # needs 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]) # optional - sage.rings.padics + sage: B([Qp(3)(2), Qp(3)(2), Qp(3)(2)], [1.761, 1.123, 1.112]) # needs 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) # 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 + sage: # needs sage.rings.padics + 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 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) # optional - sage.rings.padics + sage: B(f, g, prec=100, error_check=False) # needs 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) # 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 + sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field + sage: ideal = A.prime_above(3) # needs sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field + sage: Q1 = B(a); Q1 # needs sage.rings.number_field Type I point centered at (a : 1) :: - sage: B(a + 1, 3) # optional - sage.rings.number_field + sage: B(a + 1, 3) # needs sage.rings.number_field Type II point centered at (a + 1 : 1) of radius 3^1 TESTS:: - sage: A = Berkovich_Cp_Affine(3) # optional - sage.rings.padics - sage: Q1 = A(3, 1); Q1 # optional - sage.rings.padics + sage: A = Berkovich_Cp_Affine(3) # needs sage.rings.padics + sage: Q1 = A(3, 1); Q1 # needs sage.rings.padics Type II point centered at 3 + O(3^21) of radius 3^0 - sage: Q2 = A(2.5, 1); Q2 # optional - sage.rings.padics + sage: Q2 = A(2.5, 1); Q2 # needs 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 # optional - sage.rings.padics + sage: Q5 = A(3, 0); Q5 # needs 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() # optional - sage.rings.padics + sage: A(Zp(3)(2), 2).center().parent() == A(Qp(3)(2), 2).center().parent() # needs sage.rings.padics True - sage: Q1 == Q2 # optional - sage.rings.padics + sage: Q1 == Q2 # needs sage.rings.padics True - sage: Q1 == Q5 # optional - sage.rings.padics + sage: Q1 == Q5 # needs sage.rings.padics False - sage: Q3 = A(Qp(3)(3), power=0, error_check=False); Q3 # optional - sage.rings.padics + sage: Q3 = A(Qp(3)(3), power=0, error_check=False); Q3 # needs sage.rings.padics Type II point centered at 3 + O(3^21) of radius 3^0 - sage: Q4 = A(3, 3**0); Q4 # optional - sage.rings.padics + sage: Q4 = A(3, 3**0); Q4 # needs sage.rings.padics Type II point centered at 3 + O(3^21) of radius 3^0 - sage: Q5 = A(3, power=1/2); Q5 # optional - sage.rings.padics + sage: Q5 = A(3, power=1/2); Q5 # needs 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 # optional - sage.rings.padics sage.symbolic + sage: Q6 = A(3, RR(3**(1/2))); Q6 # needs sage.rings.padics sage.symbolic Type III point centered at 3 + O(3^21) of radius 1.73205080756888 - sage: Q5 == Q6 # optional - sage.rings.padics sage.symbolic + sage: Q5 == Q6 # needs sage.rings.padics sage.symbolic True - 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 + sage: # needs sage.rings.padics + 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) Type II point centered at w + O(w^41) of radius 5^1 - sage: TestSuite(Q5).run() # optional - sage.rings.padics + sage: TestSuite(Q5).run() # needs sage.rings.padics """ def __init__(self, parent, center, radius=None, power=None, prec=20, error_check=True): @@ -1256,8 +1269,8 @@ def __init__(self, parent, center, radius=None, power=None, prec=20, error_check EXAMPLES:: - sage: A = Berkovich_Cp_Affine(17) # optional - sage.rings.padics - sage: A(5, 1) # optional - sage.rings.padics + sage: A = Berkovich_Cp_Affine(17) # needs sage.rings.padics + sage: A(5, 1) # needs 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 +1296,26 @@ def as_projective_point(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(5) # optional - sage.rings.padics - sage: B(5).as_projective_point() # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(5) # needs sage.rings.padics + sage: B(5).as_projective_point() # needs sage.rings.padics Type I point centered at (5 + O(5^21) : 1 + O(5^20)) :: - sage: B(0, 1).as_projective_point() # optional - sage.rings.padics + sage: B(0, 1).as_projective_point() # needs sage.rings.padics Type II point centered at (0 : 1 + O(5^20)) of radius 5^0 :: - 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 + sage: # needs sage.rings.padics + 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 # needs sage.symbolic + sage: Q2 = B(f, g) # needs sage.symbolic + sage: Q2.as_projective_point() # needs 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 +1343,29 @@ def __eq__(self, other): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: Q1 = B(1, RR(3**(1/2))) # needs sage.symbolic + sage: Q2 = B(1, 3**(1/2)) # needs sage.symbolic + sage: Q1 == Q2 # needs sage.symbolic True :: - sage: Q3 = B(1) # optional - sage.rings.padics - sage: Q4 = B(4) # optional - sage.rings.padics - sage: Q3 == Q4 # optional - sage.rings.padics + sage: Q3 = B(1) # needs sage.rings.padics + sage: Q4 = B(4) # needs sage.rings.padics + sage: Q3 == Q4 # needs sage.rings.padics False :: - sage: Q5 = B(1, 4) # optional - sage.rings.padics - sage: Q1 == Q5 # optional - sage.rings.padics sage.symbolic + sage: Q5 = B(1, 4) # needs sage.rings.padics + sage: Q1 == Q5 # needs sage.rings.padics sage.symbolic False :: - sage: Q1 == Q3 # optional - sage.rings.padics sage.symbolic + sage: Q1 == Q3 # needs sage.rings.padics sage.symbolic False """ if other is self: @@ -1379,21 +1394,22 @@ def __hash__(self): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: Q1 = B(1, RR(3**(1/2))) # needs sage.symbolic + sage: Q2 = B(1, 3**(1/2)) # needs sage.symbolic + sage: hash(Q1) == hash(Q2) # needs sage.symbolic True :: sage: R. = QQ[] - 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 + sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field + sage: ideal = A.ideal(-1/2*a^2 + a - 3) # needs sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field + sage: Q1 = B(a^2 + 1, 2) # needs sage.rings.number_field + sage: Q2 = B(0, 2) # needs sage.rings.number_field + sage: hash(Q1) == hash(Q2) # needs sage.rings.number_field True """ if self.type_of_point() == 1: @@ -1425,40 +1441,41 @@ def lt(self, other): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: Q1 = B(5, 0.5) + sage: Q2 = B(5, 1) + sage: Q1.lt(Q2) True :: - sage: Q3 = B(1) # optional - sage.rings.padics - sage: Q1.lt(Q3) # optional - sage.rings.padics + sage: Q3 = B(1) # needs sage.rings.padics + sage: Q1.lt(Q3) # needs sage.rings.padics False TESTS:: - 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 + sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: Q1 = B(5) # needs sage.rings.padics + sage: Q1.lt(Q1) # needs sage.rings.padics False :: - sage: Q2 = B([4, 1/3], [5, 1]) # optional - sage.rings.padics - sage: Q1.lt(Q2) # optional - sage.rings.padics + sage: Q2 = B([4, 1/3], [5, 1]) # needs sage.rings.padics + sage: Q1.lt(Q2) # needs sage.rings.padics False :: - sage: Q4 = B(0, 1) # optional - sage.rings.padics - sage: Q1.lt(Q4) # optional - sage.rings.padics + sage: Q4 = B(0, 1) # needs sage.rings.padics + sage: Q1.lt(Q4) # needs sage.rings.padics True :: - sage: Q2.lt(Q4) # optional - sage.rings.padics + sage: Q2.lt(Q4) # needs sage.rings.padics False """ if not isinstance(other, Berkovich_Element_Cp_Affine): @@ -1569,40 +1586,41 @@ def join(self, other, basepoint=Infinity): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: Q1 = B(2, 1) + sage: Q2 = B(2, 2) + sage: Q1.join(Q2) Type III point centered at 2 + O(3^20) of radius 2.00000000000000 :: - sage: Q3 = B(5) # optional - sage.rings.padics - sage: Q3.join(Q1) # optional - sage.rings.padics + sage: Q3 = B(5) # needs sage.rings.padics + sage: Q3.join(Q1) # needs sage.rings.padics Type II point centered at 2 + 3 + O(3^20) of radius 3^0 :: - sage: Q3.join(Q1, basepoint=Q2) # optional - sage.rings.padics + sage: Q3.join(Q1, basepoint=Q2) # needs 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) # optional - sage.rings.padics - sage: Q2.join(Q4, basepoint=Q1) # optional - sage.rings.padics + sage: Q4 = B(1/3**8 + 2, 1) # needs sage.rings.padics + sage: Q2.join(Q4, basepoint=Q1) # needs sage.rings.padics Type III point centered at 2 + O(3^20) of radius 2.00000000000000 :: - 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 + sage: Q5 = B(2, 1/9) # needs sage.rings.padics + sage: Q6 = B(1, 1/27) # needs sage.rings.padics + sage: Q4.join(Q5, basepoint=Q6) # needs sage.rings.padics Type II point centered at 1 + O(3^20) of radius 3^0 :: - sage: Q7 = B(1/27, 1/27) # optional - sage.rings.padics - sage: Q1.join(Q7, Q2) # optional - sage.rings.padics + sage: Q7 = B(1/27, 1/27) # needs sage.rings.padics + sage: Q1.join(Q7, Q2) # needs 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 +1666,46 @@ def involution_map(self): The involution map is 1/z on type I points:: - 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 + sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics + sage: Q1 = B(1/2) # needs sage.rings.padics + sage: Q1.involution_map() # needs sage.rings.padics Type I point centered at 2 + O(3^20) :: - sage: Q2 = B(0, 1/3) # optional - sage.rings.padics - sage: Q2.involution_map() # optional - sage.rings.padics + sage: Q2 = B(0, 1/3) # needs sage.rings.padics + sage: Q2.involution_map() # needs sage.rings.padics Type II point centered at 0 of radius 3^1 :: - sage: Q3 = B(1/3, 1/3) # optional - sage.rings.padics - sage: Q3.involution_map() # optional - sage.rings.padics + sage: Q3 = B(1/3, 1/3) # needs sage.rings.padics + sage: Q3.involution_map() # needs sage.rings.padics Type II point centered at 3 + O(3^21) of radius 3^-3 TESTS:: - sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics - sage: B(0).involution_map() # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics + sage: B(0).involution_map() # needs 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() # optional - sage.rings.padics + sage: B(1/81, 1.5).involution_map() # needs 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() # optional - sage.rings.padics + sage: B([1, 2], [3, 1]).involution_map() # needs 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() # optional - sage.rings.padics + sage: B([1/81, 10/81], [10, 9]).involution_map() # needs 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 +1759,18 @@ def contained_in_interval(self, start, end): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + 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)) False :: - sage: Q4 = B(1/81, 1) # optional - sage.rings.padics - sage: Q2.contained_in_interval(Q1, Q4.join(Q1)) # optional - sage.rings.padics + sage: Q4 = B(1/81, 1) # needs sage.rings.padics + sage: Q2.contained_in_interval(Q1, Q4.join(Q1)) # needs sage.rings.padics True """ if not isinstance(start, Berkovich_Element_Cp_Affine): @@ -1821,39 +1840,40 @@ 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) # optional - sage.rings.padics - sage: P = Berkovich_Cp_Projective(S); P # optional - sage.rings.padics + sage: S = ProjectiveSpace(Qp(5), 1) # needs sage.rings.padics + sage: P = Berkovich_Cp_Projective(S); P # needs sage.rings.padics Projective Berkovich line over Cp(5) of precision 20 :: - sage: a = S(0, 1) # optional - sage.rings.padics - sage: Q1 = P(a); Q1 # optional - sage.rings.padics + sage: a = S(0, 1) # needs sage.rings.padics + sage: Q1 = P(a); Q1 # needs sage.rings.padics Type I point centered at (0 : 1 + O(5^20)) :: - sage: Q2 = P((1,0)); Q2 # optional - sage.rings.padics + sage: Q2 = P((1,0)); Q2 # needs 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 # optional - sage.rings.padics sage.symbolic + sage: Q3 = P((0,5), 5**(3/2)); Q3 # needs 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 # optional - sage.rings.padics sage.symbolic + sage: Q4 = P(0, 3**(3/2)); Q4 # needs 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 # 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 + sage: # needs sage.rings.padics + 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 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 +1885,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)) # optional - sage.rings.padics - sage: T = FractionField(L) # optional - sage.rings.padics - sage: f = T(1/t) # optional - sage.rings.padics + sage: L. = PolynomialRing(Qp(5)) # needs sage.rings.padics + sage: T = FractionField(L) # needs sage.rings.padics + sage: f = T(1/t) # needs sage.rings.padics sage: R. = RR[] sage: Y = FractionField(R) - sage: g = (40*pi)/x # optional - sage.rings.padics sage.symbolic - sage: Q6 = P(f, g); Q6 # optional - sage.rings.padics sage.symbolic + sage: g = (40*pi)/x # needs sage.rings.padics sage.symbolic + sage: Q6 = P(f, g); Q6 # needs 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) # optional - sage.rings.padics + sage: P((1,0), 3) # needs 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) # optional - sage.rings.padics - sage: Q1 = B(3) # optional - sage.rings.padics - sage: TestSuite(Q1).run() # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: Q1 = B(3) # needs sage.rings.padics + sage: TestSuite(Q1).run() # needs sage.rings.padics """ def __init__(self, parent, center, radius=None, power=None, prec=20, error_check=True): @@ -1893,9 +1913,9 @@ def __init__(self, parent, center, radius=None, power=None, prec=20, error_check EXAMPLES:: - 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 + sage: S = ProjectiveSpace(Qp(7), 1) # needs sage.rings.padics + sage: P = Berkovich_Cp_Projective(S) # needs sage.rings.padics + sage: P(0,1) # needs 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 +1941,27 @@ def as_affine_point(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(5) # optional - sage.rings.padics - sage: B(5).as_affine_point() # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(5) # needs sage.rings.padics + sage: B(5).as_affine_point() # needs sage.rings.padics Type I point centered at 5 + O(5^21) :: - sage: Q = B(0, 1).as_affine_point(); Q # optional - sage.rings.padics + sage: Q = B(0, 1).as_affine_point(); Q # needs sage.rings.padics Type II point centered at 0 of radius 5^0 - sage: Q.parent() # optional - sage.rings.padics + sage: Q.parent() # needs sage.rings.padics Affine Berkovich line over Cp(5) of precision 20 :: - 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: L. = PolynomialRing(Qp(5)) # needs sage.rings.padics + sage: T = FractionField(L) # needs sage.rings.padics + sage: f = T(1/t) # needs sage.rings.padics sage: R. = RR[] sage: Y = FractionField(R) - 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 + sage: g = (40*pi)/x # needs sage.rings.padics sage.symbolic + sage: Q2 = B(f, g) # needs sage.rings.padics sage.symbolic + sage: Q2.as_affine_point() # needs 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 +1993,29 @@ def __eq__(self, other): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: Q1 = B([2, 2], RR(3**(1/2))) # needs sage.symbolic + sage: Q2 = B([1, 1], 3**(1/2)) # needs sage.symbolic + sage: Q1 == Q2 # needs sage.symbolic True :: - sage: Q3 = B(1) # optional - sage.rings.padics - sage: Q4 = B(4) # optional - sage.rings.padics - sage: Q3 == Q4 # optional - sage.rings.padics + sage: Q3 = B(1) # needs sage.rings.padics + sage: Q4 = B(4) # needs sage.rings.padics + sage: Q3 == Q4 # needs sage.rings.padics False :: - sage: Q5 = B(1, 4) # optional - sage.rings.padics - sage: Q1 == Q5 # optional - sage.rings.padics sage.symbolic + sage: Q5 = B(1, 4) # needs sage.rings.padics + sage: Q1 == Q5 # needs sage.rings.padics sage.symbolic False :: - sage: Q1 == Q3 # optional - sage.rings.padics sage.symbolic + sage: Q1 == Q3 # needs sage.rings.padics sage.symbolic False """ if other is self: @@ -2025,22 +2046,23 @@ def __hash__(self): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + 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))) # needs sage.symbolic + sage: Q2 = B([1, 1], 3**(1/2)) # needs sage.symbolic + sage: hash(Q1) == hash(Q2) # needs sage.symbolic True :: sage: R. = QQ[] - 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 + sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field + sage: ideal = A.ideal(-1/2*a^2 + a - 3) # needs sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field + sage: Q1 = B(a^2 + 1, 2) # needs sage.rings.number_field + sage: Q2 = B(0, 2) # needs sage.rings.number_field + sage: hash(Q1) == hash(Q2) # needs sage.rings.number_field True """ if self.type_of_point() == 1: @@ -2072,51 +2094,52 @@ def lt(self, other): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: Q1 = B(5, 0.5) + sage: Q2 = B(5, 1) + sage: Q1.lt(Q2) True :: - sage: Q3 = B(1) # optional - sage.rings.padics - sage: Q1.lt(Q3) # optional - sage.rings.padics + sage: Q3 = B(1) # needs sage.rings.padics + sage: Q1.lt(Q3) # needs sage.rings.padics False TESTS:: - 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 + sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: Q1 = B(5) # needs sage.rings.padics + sage: Q1.lt(Q1) # needs sage.rings.padics False :: - sage: Q2 = B([4, 1/3], [5, 1]) # optional - sage.rings.padics - sage: Q1.lt(Q2) # optional - sage.rings.padics + sage: Q2 = B([4, 1/3], [5, 1]) # needs sage.rings.padics + sage: Q1.lt(Q2) # needs sage.rings.padics False :: - 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 + sage: Q3 = B((1,0)) # needs sage.rings.padics + sage: Q4 = B(0, 1) # needs sage.rings.padics + sage: Q3.lt(Q4) # needs sage.rings.padics False :: - sage: Q4.lt(Q3) # optional - sage.rings.padics + sage: Q4.lt(Q3) # needs sage.rings.padics True :: - sage: Q1.lt(Q4) # optional - sage.rings.padics + sage: Q1.lt(Q4) # needs sage.rings.padics True :: - sage: Q2.lt(Q4) # optional - sage.rings.padics + sage: Q2.lt(Q4) # needs sage.rings.padics False """ if not isinstance(other, Berkovich_Element_Cp_Projective): @@ -2251,58 +2274,59 @@ def join(self, other, basepoint=Infinity): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: Q1 = B(2, 1) + sage: Q2 = B(2, 2) + sage: Q1.join(Q2) Type III point centered at (2 + O(3^20) : 1 + O(3^20)) of radius 2.00000000000000 :: - sage: Q3 = B(5) # optional - sage.rings.padics - sage: Q3.join(Q1) # optional - sage.rings.padics + sage: Q3 = B(5) # needs sage.rings.padics + sage: Q3.join(Q1) # needs 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) # optional - sage.rings.padics + sage: Q3.join(Q1, basepoint=Q2) # needs 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) # optional - sage.rings.padics - sage: Q2.join(Q4, basepoint=Q1) # optional - sage.rings.padics + sage: Q4 = B(1/3**8 + 2, 1) # needs sage.rings.padics + sage: Q2.join(Q4, basepoint=Q1) # needs 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) # optional - sage.rings.padics - sage: Q6 = B(1, 1/27) # optional - sage.rings.padics - sage: Q4.join(Q5, basepoint=Q6) # optional - sage.rings.padics + sage: Q5 = B(2, 1/9) # needs sage.rings.padics + sage: Q6 = B(1, 1/27) # needs sage.rings.padics + sage: Q4.join(Q5, basepoint=Q6) # needs 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) # optional - sage.rings.padics - sage: Q1.join(Q7, Q2) # optional - sage.rings.padics + sage: Q7 = B(1/27, 1/27) # needs sage.rings.padics + sage: Q1.join(Q7, Q2) # needs 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) # optional - sage.rings.padics + sage: Q1.join(Q2, Q7) # needs 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) # optional - sage.rings.padics - sage: Q9 = B(0, power=1/2) # optional - sage.rings.padics - sage: Q8.join(Q9) # optional - sage.rings.padics + sage: Q8 = B(0, power=1/3) # needs sage.rings.padics + sage: Q9 = B(0, power=1/2) # needs sage.rings.padics + sage: Q8.join(Q9) # needs 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) # 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 + sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field + sage: ideal = A.prime_above(3) # needs sage.rings.number_field + sage: C = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field + sage: Q10 = C(a, 1/9) # needs sage.rings.number_field + sage: Q10.join(Q9) # needs sage.rings.number_field sage.rings.padics Traceback (most recent call last): ... ValueError: other must be a point of the same projective Berkovich line - sage: Q11 = C(0, 1/3) # optional - sage.rings.number_field - sage: Q11.join(Q10) # optional - sage.rings.number_field + sage: Q11 = C(0, 1/3) # needs sage.rings.number_field + sage: Q11.join(Q10) # needs 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 +2439,49 @@ def involution_map(self): The involution map is 1/z on type I points:: - 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 + sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: Q1 = B(1/2) # needs sage.rings.padics + sage: Q1.involution_map() # needs sage.rings.padics Type I point centered at (2 + O(3^20) : 1 + O(3^20)) :: - sage: Q2 = B(0, 1/3) # optional - sage.rings.padics - sage: Q2.involution_map() # optional - sage.rings.padics + sage: Q2 = B(0, 1/3) # needs sage.rings.padics + sage: Q2.involution_map() # needs sage.rings.padics Type II point centered at (0 : 1 + O(3^20)) of radius 3^1 :: - sage: Q3 = B(1/3, 1/3) # optional - sage.rings.padics - sage: Q3.involution_map() # optional - sage.rings.padics + sage: Q3 = B(1/3, 1/3) # needs sage.rings.padics + sage: Q3.involution_map() # needs 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) # optional - sage.rings.padics - sage: B((1,0)).involution_map() # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: B((1,0)).involution_map() # needs sage.rings.padics Type I point centered at (0 : 1 + O(3^20)) :: - sage: B(0).involution_map() # optional - sage.rings.padics + sage: B(0).involution_map() # needs sage.rings.padics Type I point centered at (1 + O(3^20) : 0) :: - sage: B(1/81, 1.5).involution_map() # optional - sage.rings.padics + sage: B(1/81, 1.5).involution_map() # needs 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() # optional - sage.rings.padics + sage: B([1, 2], [3, 1]).involution_map() # needs 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() # optional - sage.rings.padics + sage: B([1/81, 10/81], [10, 9]).involution_map() # needs 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 +2538,50 @@ def contained_in_interval(self, start, end): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + 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)) False :: - sage: Q4 = B(1/81, 1) # optional - sage.rings.padics - sage: Q2.contained_in_interval(Q1, Q4.join(Q1)) # optional - sage.rings.padics + sage: Q4 = B(1/81, 1) # needs sage.rings.padics + sage: Q2.contained_in_interval(Q1, Q4.join(Q1)) # needs sage.rings.padics True TESTS:: - 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 + sage: # needs sage.rings.padics + 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) False :: - sage: Q1 = B(1, 3) # optional - sage.rings.padics - sage: infty.contained_in_interval(gauss, Q1) # optional - sage.rings.padics + sage: Q1 = B(1, 3) # needs sage.rings.padics + sage: infty.contained_in_interval(gauss, Q1) # needs sage.rings.padics False :: - sage: zero.contained_in_interval(infty, gauss) # optional - sage.rings.padics + sage: zero.contained_in_interval(infty, gauss) # needs sage.rings.padics False :: - sage: gauss.contained_in_interval(zero, infty) # optional - sage.rings.padics + sage: gauss.contained_in_interval(zero, infty) # needs sage.rings.padics True :: - sage: Q2 = B(81, 1/3) # optional - sage.rings.padics - sage: gauss.contained_in_interval(infty, Q2) # optional - sage.rings.padics + sage: Q2 = B(81, 1/3) # needs sage.rings.padics + sage: gauss.contained_in_interval(infty, Q2) # needs 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 9e04a0bb61d..8bedd157474 100644 --- a/src/sage/schemes/berkovich/berkovich_space.py +++ b/src/sage/schemes/berkovich/berkovich_space.py @@ -56,9 +56,9 @@ def is_Berkovich(space) -> bool: EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics sage: from sage.schemes.berkovich.berkovich_space import is_Berkovich - sage: is_Berkovich(B) # optional - sage.rings.padics + sage: is_Berkovich(B) # needs sage.rings.padics True """ return isinstance(space, Berkovich) @@ -75,9 +75,9 @@ def is_Berkovich_Cp(space) -> bool: EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics sage: from sage.schemes.berkovich.berkovich_space import is_Berkovich - sage: is_Berkovich(B) # optional - sage.rings.padics + sage: is_Berkovich(B) # needs sage.rings.padics True """ return isinstance(space, Berkovich_Cp) @@ -101,17 +101,17 @@ def residue_characteristic(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics - sage: B.prime() # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: B.prime() # needs sage.rings.padics 3 :: sage: R. = QQ[] - 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 + sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field + sage: ideal = A.ideal(-1/2*a^2 + a - 3) # needs sage.rings.number_field + sage: B = Berkovich_Cp_Affine(A, ideal) # needs sage.rings.number_field + sage: B.residue_characteristic() # needs sage.rings.number_field 7 """ return self._p @@ -129,8 +129,8 @@ def is_padic_base(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(Qp(3)) # optional - sage.rings.padics - sage: B.is_padic_base() # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(Qp(3)) # needs sage.rings.padics + sage: B.is_padic_base() # needs sage.rings.padics True :: @@ -152,8 +152,8 @@ def is_number_field_base(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(Qp(3)) # optional - sage.rings.padics - sage: B.is_number_field_base() # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(Qp(3)) # needs sage.rings.padics + sage: B.is_number_field_base() # needs sage.rings.padics False :: @@ -182,10 +182,10 @@ def ideal(self): EXAMPLES:: sage: R. = QQ[] - 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 + sage: A. = NumberField(z^2 + 1) # needs sage.rings.number_field + sage: ideal = A.prime_above(5) # needs sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field + sage: B.ideal() # needs sage.rings.number_field Fractional ideal (-a - 2) :: @@ -196,8 +196,8 @@ def ideal(self): :: - sage: B = Berkovich_Cp_Projective(Qp(3)) # optional - sage.rings.padics - sage: B.ideal() is None # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(Qp(3)) # needs sage.rings.padics + sage: B.ideal() is None # needs sage.rings.padics True """ return self._ideal @@ -208,36 +208,37 @@ def __eq__(self, right): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: A. = Qq(27) + sage: C = Berkovich_Cp_Affine(A) + sage: B == C True :: sage: R. = QQ[] - 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 + sage: A. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: A_ideal = A.prime_above(2) # needs sage.rings.number_field + sage: B. = NumberField(x^4 + 1) # needs sage.rings.number_field + sage: B_ideal = B.prime_above(2) # needs sage.rings.number_field + sage: C = Berkovich_Cp_Projective(A, A_ideal) # needs sage.rings.number_field + sage: D = Berkovich_Cp_Projective(B, B_ideal) # needs sage.rings.number_field + sage: C == D # needs sage.rings.number_field False :: - 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 + sage: C = Berkovich_Cp_Affine(A, A_ideal) # needs sage.rings.number_field + sage: D = Berkovich_Cp_Affine(B, B_ideal) # needs sage.rings.number_field + sage: C == D # needs sage.rings.number_field False :: - 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 + sage: A_ideal_2 = A.prime_above(5) # needs sage.rings.number_field + sage: E = Berkovich_Cp_Affine(A, A_ideal_2) # needs sage.rings.number_field + sage: C == E # needs sage.rings.number_field False """ if not isinstance(right, Berkovich_Cp): @@ -255,10 +256,11 @@ def __ne__(self, right): EXAMPLES:: - 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 + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(5) + sage: A. = Qq(25) + sage: C = Berkovich_Cp_Affine(A) + sage: B != C False """ return not (self == right) @@ -269,16 +271,16 @@ def __hash__(self): EXAMPLES:: - sage: hash(Berkovich_Cp_Projective(3)) # optional - sage.rings.padics + sage: hash(Berkovich_Cp_Projective(3)) # needs sage.rings.padics 3 :: sage: R. = QQ[] - 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 + sage: A. = NumberField(z^2 + 1) # needs sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, A.primes_above(5)[0]) # needs sage.rings.number_field + sage: C = Berkovich_Cp_Projective(A, A.primes_above(5)[1]) # needs sage.rings.number_field + sage: hash(B) != hash(C) # needs sage.rings.number_field True """ if self._base_type == 'padic field': @@ -319,57 +321,57 @@ class Berkovich_Cp_Affine(Berkovich_Cp): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3); B # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(3); B # needs sage.rings.padics Affine Berkovich line over Cp(3) of precision 20 We can create elements:: - sage: B(-2) # optional - sage.rings.padics + sage: B(-2) # needs 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) # optional - sage.rings.padics + sage: B(1, 2) # needs 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 # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(Qp(3)); B # needs 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 # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(Qp(3, 1)); B # needs sage.rings.padics Affine Berkovich line over Cp(3) of precision 1 - sage: B(1/2) # optional - sage.rings.padics + sage: B(1/2) # needs 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 # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(Qp(3, 1000)); B # needs 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) # optional - sage.rings.padics - sage: A. = Qp(3).extension(x^3 - 3) # optional - sage.rings.padics - sage: B(a) # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics + sage: A. = Qp(3).extension(x^3 - 3) # needs sage.rings.padics + sage: B(a) # needs 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) # 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 + sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field + sage: ideal = A.prime_above(3) # needs sage.rings.number_field + sage: B = Berkovich_Cp_Affine(A, ideal); B # needs sage.rings.number_field Affine Berkovich line over Cp(3), with base Number Field in a with defining polynomial x^3 + 20 @@ -387,11 +389,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) # 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 + sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field + sage: ideal = A.prime_above(3) # needs sage.rings.number_field + sage: B = Berkovich_Cp_Affine(A, ideal) # needs sage.rings.number_field + sage: C. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: B(c) # needs sage.rings.number_field Traceback (most recent call last): ... ValueError: could not convert c to Number Field in a @@ -399,14 +401,14 @@ class Berkovich_Cp_Affine(Berkovich_Cp): TESTS:: - sage: A. = AffineSpace(Qp(3), 1) # optional - sage.rings.padics - sage: Berkovich_Cp_Affine(A) # optional - sage.rings.padics + sage: A. = AffineSpace(Qp(3), 1) # needs sage.rings.padics + sage: Berkovich_Cp_Affine(A) # needs sage.rings.padics Affine Berkovich line over Cp(3) of precision 20 :: - sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics - sage: TestSuite(B).run() # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: TestSuite(B).run() # needs sage.rings.padics """ Element = Berkovich_Element_Cp_Affine @@ -417,7 +419,7 @@ def __init__(self, base, ideal=None): EXAMPLES:: - sage: Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: Berkovich_Cp_Affine(3) # needs sage.rings.padics Affine Berkovich line over Cp(3) of precision 20 """ if base in ZZ: @@ -463,16 +465,16 @@ def _repr_(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics - sage: B # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics + sage: B # needs sage.rings.padics Affine Berkovich line over Cp(3) of precision 20 :: sage: R. = QQ[] - 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 + sage: A. = NumberField(z^2 + 1) # needs sage.rings.number_field + sage: ideal = A.prime_above(3) # needs sage.rings.number_field + sage: Berkovich_Cp_Affine(A, ideal) # needs sage.rings.number_field Affine Berkovich line over Cp(3), with base Number Field in a with defining polynomial z^2 + 1 """ @@ -489,8 +491,8 @@ def _latex_(self): EXAMPLES: - sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics - sage: latex(B) # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics + sage: latex(B) # needs sage.rings.padics \text{Affine Berkovich line over } \Bold{C}_{3} """ return r"\text{Affine Berkovich line over } \Bold{C}_{%s}" % (self.prime()) @@ -529,36 +531,36 @@ class Berkovich_Cp_Projective(Berkovich_Cp): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3); B # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(3); B # needs sage.rings.padics Projective Berkovich line over Cp(3) of precision 20 Elements can be constructed:: - sage: B(1/2) # optional - sage.rings.padics + sage: B(1/2) # needs 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) # optional - sage.rings.padics + sage: B(2, 1) # needs 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 # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(Qp(3)); B # needs 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) # optional - sage.rings.padics - sage: B = Berkovich_Cp_Projective(S); B # optional - sage.rings.padics + sage: S = Qp(3, 1) # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(S); B # needs sage.rings.padics Projective Berkovich line over Cp(3) of precision 1 - sage: Q1 = B(1/2); Q1 # optional - sage.rings.padics + sage: Q1 = B(1/2); Q1 # needs 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 @@ -566,9 +568,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) # 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 + sage: A. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: ideal = A.prime_above(2) # needs sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, ideal); B # needs sage.rings.number_field Projective Berkovich line over Cp(2), with base Number Field in a with defining polynomial x^2 + 1 @@ -588,11 +590,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) # 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 + sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field + sage: ideal = A.prime_above(3) # needs sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field + sage: C. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: B(c) # needs sage.rings.number_field Traceback (most recent call last): ... TypeError: could not convert c to Projective Space @@ -600,8 +602,8 @@ class Berkovich_Cp_Projective(Berkovich_Cp): TESTS:: - sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics - sage: TestSuite(B).run() # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: TestSuite(B).run() # needs sage.rings.padics """ Element = Berkovich_Element_Cp_Projective @@ -612,7 +614,7 @@ def __init__(self, base, ideal=None): EXAMPLES:: - sage: Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: Berkovich_Cp_Projective(3) # needs sage.rings.padics Projective Berkovich line over Cp(3) of precision 20 """ if base in ZZ: @@ -669,23 +671,23 @@ def base_ring(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics - sage: B.base_ring() # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: B.base_ring() # needs sage.rings.padics 3-adic Field with capped relative precision 20 :: - sage: C = Berkovich_Cp_Projective(ProjectiveSpace(Qp(3, 1), 1)) # optional - sage.rings.padics - sage: C.base_ring() # optional - sage.rings.padics + sage: C = Berkovich_Cp_Projective(ProjectiveSpace(Qp(3, 1), 1)) # needs sage.rings.padics + sage: C.base_ring() # needs sage.rings.padics 3-adic Field with capped relative precision 1 :: sage: R. = QQ[] - 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 + sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field + sage: ideal = A.prime_above(3) # needs sage.rings.number_field + sage: D = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field + sage: D.base_ring() # needs sage.rings.number_field Number Field in a with defining polynomial x^3 + 20 """ return self.base().base_ring() @@ -696,16 +698,16 @@ def _repr_(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics - sage: B # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: B # needs sage.rings.padics Projective Berkovich line over Cp(3) of precision 20 :: sage: R. = QQ[] - 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 + sage: A. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: v = A.ideal(a + 1) # needs sage.rings.number_field + sage: Berkovich_Cp_Projective(A, v) # needs sage.rings.number_field Projective Berkovich line over Cp(2), with base Number Field in a with defining polynomial x^2 + 1 """ @@ -722,8 +724,8 @@ def _latex_(self): EXAMPLES: - sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics - sage: latex(B) # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: latex(B) # needs 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/curves/affine_curve.py b/src/sage/schemes/curves/affine_curve.py index 87b8dcb56c9..bbe2e7ee315 100644 --- a/src/sage/schemes/curves/affine_curve.py +++ b/src/sage/schemes/curves/affine_curve.py @@ -28,49 +28,52 @@ EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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() 10 - sage: C.function_field() # optional - sage.rings.finite_rings + sage: C.function_field() 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() # long time # optional - sage.rings.finite_rings + sage: # long time, needs sage.rings.finite_rings + sage: C.closed_points() [Point (x, y, z), Point (x + 1, y, z)] - sage: C.closed_points(2) # long time # optional - sage.rings.finite_rings + sage: C.closed_points(2) [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] # long time # optional - sage.rings.finite_rings - sage: p.places() # long time # optional - sage.rings.finite_rings + sage: p = _[0] + sage: p.places() [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() # long time # optional - sage.rings.finite_rings + sage: C.places_at_infinity() # long time # needs 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) # 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 + sage: # needs sage.rings.finite_rings + sage: fx = C(x) + sage: fy = C(y) + sage: fx^2 + fx - fy^3 0 - sage: fx.divisor() # optional - sage.rings.finite_rings + sage: fx.divisor() -9*Place (1/x, 1/x*z) + 9*Place (x, z) - sage: p, = fx.zeros() # optional - sage.rings.finite_rings - sage: C.place_to_closed_point(p) # optional - sage.rings.finite_rings + sage: p, = fx.zeros() + sage: C.place_to_closed_point(p) Point (x, y, z) - sage: _.rational_point() # optional - sage.rings.finite_rings + sage: _.rational_point() (0, 0, 0) - sage: _.closed_point() # optional - sage.rings.finite_rings + sage: _.closed_point() Point (x, y, z) - sage: _.place() # optional - sage.rings.finite_rings + sage: _.place() Place (x, z) Integral affine curves over `\QQ` @@ -96,10 +99,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') # 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 + sage: s = var('s') # needs sage.symbolic + sage: P1 = parametric_plot([sx, sy], (s, -1, 1), color='red') # needs sage.plot sage.symbolic + sage: P2 = C.plot((x, -1, 1), (y, 0, 2)) # half circle # needs sage.plot sage.symbolic + sage: P1 + P2 # needs sage.plot sage.symbolic Graphics object consisting of 2 graphics primitives AUTHORS: @@ -169,16 +172,16 @@ class AffineCurve(Curve_generic, AlgebraicScheme_subscheme_affine): EXAMPLES:: sage: R. = QQ[] - 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 + sage: K. = NumberField(v^2 + 3) # needs sage.rings.number_field + sage: A. = AffineSpace(K, 3) # needs sage.rings.number_field + sage: C = Curve([z - u*x^2, y^2], A); C # needs 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) # optional - sage.rings.finite_rings - sage: C = Curve([x^2 - z, z - 8*x], A); C # optional - sage.rings.finite_rings + sage: A. = AffineSpace(GF(7), 3) # needs sage.rings.finite_rings + sage: C = Curve([x^2 - z, z - 8*x], A); C # needs sage.rings.finite_rings Affine Curve over Finite Field of size 7 defined by x^2 - z, -x + z """ def __init__(self, A, X): @@ -188,16 +191,16 @@ def __init__(self, A, X): EXAMPLES:: sage: R. = QQ[] - 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 + sage: K. = NumberField(v^2 + 3) # needs sage.rings.number_field + sage: A. = AffineSpace(K, 3) # needs sage.rings.number_field + sage: C = Curve([z - u*x^2, y^2], A); C # needs 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) # optional - sage.rings.finite_rings - sage: C = Curve([x^2 - z, z - 8*x], A); C # optional - sage.rings.finite_rings + sage: A. = AffineSpace(GF(7), 3) # needs sage.rings.finite_rings + sage: C = Curve([x^2 - z, z - 8*x], A); C # needs sage.rings.finite_rings Affine Curve over Finite Field of size 7 defined by x^2 - z, -x + z """ if not is_AffineSpace(A): @@ -323,18 +326,19 @@ def divisor_of_function(self, r): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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) # not implemented (broken) [[-1, (0, 0, 1)]] - 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 + sage: r = 1/x^3 + sage: C.divisor_of_function(r) # not implemented (broken) [[-3, (0, 0, 1)]] """ F = self.base_ring() @@ -377,13 +381,14 @@ def local_coordinates(self, pt, n): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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) [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() @@ -448,22 +453,23 @@ def plot(self, *args, **kwds): sage: R. = QQ[] sage: C = Curve(x^3 - y^2) - sage: C.plot() + sage: C.plot() # needs sage.plot Graphics object consisting of 1 graphics primitive A 5-nodal curve of degree 11. This example also illustrates some of the optional arguments:: sage: R. = ZZ[] - sage: C = Curve(32*x^2 - 2097152*y^11 + 1441792*y^9 - 360448*y^7 + 39424*y^5 - 1760*y^3 + 22*y - 1) - sage: C.plot((x, -1, 1), (y, -1, 1), plot_points=400) + sage: C = Curve(32*x^2 - 2097152*y^11 + 1441792*y^9 + ....: - 360448*y^7 + 39424*y^5 - 1760*y^3 + 22*y - 1) + sage: C.plot((x, -1, 1), (y, -1, 1), plot_points=400) # needs sage.plot Graphics object consisting of 1 graphics primitive A line over `\mathbf{RR}`:: sage: R. = RR[] - sage: C = Curve(R(y - sqrt(2)*x)) - sage: C.plot() + sage: C = Curve(R(y - sqrt(2)*x)) # needs sage.symbolic + sage: C.plot() # needs sage.plot Graphics object consisting of 1 graphics primitive """ I = self.defining_ideal() @@ -496,12 +502,12 @@ def is_transverse(self, C, P): :: sage: R. = QQ[] - 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 + sage: K. = NumberField(a^3 + 2) # needs sage.rings.number_field + sage: A. = AffineSpace(K, 2) # needs sage.rings.number_field + sage: C = A.curve([x*y]) # needs sage.rings.number_field + sage: D = A.curve([y - b*x]) # needs sage.rings.number_field + sage: Q = A([0,0]) # needs sage.rings.number_field + sage: C.is_transverse(D, Q) # needs sage.rings.number_field False :: @@ -552,12 +558,13 @@ def multiplicity(self, P): :: - 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 + sage: # needs sage.rings.number_field + 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]) # optional - sage.rings.number_field - sage: C.multiplicity(Q) # optional - sage.rings.number_field + sage: Q = A([-1,-2]) + sage: C.multiplicity(Q) 6 :: @@ -608,29 +615,29 @@ def tangents(self, P, factor=True): EXAMPLES:: sage: set_verbose(-1) - 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 + sage: A. = AffineSpace(QQbar, 2) # needs 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 # needs 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 + sage: Q = A([0,0]) # needs sage.rings.number_field + sage: C.tangents(Q) # needs 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 + sage: C.tangents(Q, factor=False) # needs 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) # 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 + sage: K. = NumberField(a^2 - 3) # needs sage.rings.number_field + sage: A. = AffineSpace(K, 2) # needs sage.rings.number_field + sage: C = Curve([(x^2 + y^2 - 2*x)^2 - x^2 - y^2], A) # needs sage.rings.number_field + sage: Q = A([0,0]) # needs sage.rings.number_field + sage: C.tangents(Q) # needs sage.rings.number_field [x + (-1/3*b)*y, x + (1/3*b)*y] :: @@ -722,11 +729,11 @@ def is_ordinary_singularity(self, P): :: sage: R. = QQ[] - 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 + sage: K. = NumberField(a^2 - 3) # needs sage.rings.number_field + sage: A. = AffineSpace(K, 2) # needs sage.rings.number_field + sage: C = Curve([(x^2 + y^2 - 2*x)^2 - x^2 - y^2], A) # needs sage.rings.number_field + sage: Q = A([0,0]) # needs sage.rings.number_field + sage: C.is_ordinary_singularity(Q) # needs sage.rings.number_field True :: @@ -830,16 +837,16 @@ def __init__(self, A, X): EXAMPLES:: sage: R. = QQ[] - 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 + sage: K. = NumberField(v^2 + 3) # needs sage.rings.number_field + sage: A. = AffineSpace(K, 3) # needs sage.rings.number_field + sage: C = Curve([z - u*x^2, y^2], A); C # needs 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) # optional - sage.rings.number_field - sage: C = Curve([x^2 - z, z - 8*x], A); C # optional - sage.rings.number_field + sage: A. = AffineSpace(GF(7), 3) # needs sage.rings.number_field + sage: C = Curve([x^2 - z, z - 8*x], A); C # needs sage.rings.number_field Affine Curve over Finite Field of size 7 defined by x^2 - z, -x + z """ super().__init__(A, X) @@ -913,12 +920,13 @@ def projection(self, indices, AS=None): :: - 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 + sage: # needs sage.rings.finite_rings + 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) # 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 + sage: B. = AffineSpace(GF(11), 3) + sage: proj1 = C.projection([1,2,4], AS=B) + sage: proj1 (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 @@ -931,12 +939,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 # optional - sage.rings.finite_rings + sage: proj1[1].ambient_space() is B True - sage: proj2 = C.projection([1,2,4]) # optional - sage.rings.finite_rings - sage: proj2[1].ambient_space() is B # optional - sage.rings.finite_rings + sage: proj2 = C.projection([1,2,4]) + sage: proj2[1].ambient_space() is B False - sage: C.projection([1,2,3,5], AS=B) # optional - sage.rings.finite_rings + sage: C.projection([1,2,3,5], AS=B) Traceback (most recent call last): ... TypeError: (=Affine Space of dimension 3 over Finite Field of size 11) @@ -1055,12 +1063,12 @@ def plane_projection(self, AP=None): :: sage: R. = QQ[] - 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 + sage: K. = NumberField(a^2 + 2) # needs sage.rings.number_field + sage: A. = AffineSpace(K, 3) # needs sage.rings.number_field + sage: C = A.curve([x - b, y - 2]) # needs sage.rings.number_field + sage: B. = AffineSpace(K, 2) # needs sage.rings.number_field + sage: proj1 = C.plane_projection(AP=B) # needs sage.rings.number_field + sage: proj1 # needs 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 @@ -1070,10 +1078,10 @@ def plane_projection(self, AP=None): (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 # optional - sage.rings.number_field + sage: proj1[1].ambient_space() is B # needs sage.rings.number_field True - sage: proj2 = C.plane_projection() # optional - sage.rings.number_field - sage: proj2[1].ambient_space() is B # optional - sage.rings.number_field + sage: proj2 = C.plane_projection() # needs sage.rings.number_field + sage: proj2[1].ambient_space() is B # needs sage.rings.number_field False """ n = self.ambient_space().dimension_relative() @@ -1142,18 +1150,19 @@ def blowup(self, P=None): :: - 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 + sage: # needs sage.rings.number_field + 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] # optional - sage.rings.number_field + sage: B[1][0][2] Scheme morphism: From: Affine Curve over Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? @@ -1163,7 +1172,7 @@ def blowup(self, P=None): 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] # optional - sage.rings.number_field + sage: B[1][2][0] Scheme morphism: From: Affine Curve over Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? @@ -1173,7 +1182,7 @@ def blowup(self, P=None): 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] # optional - sage.rings.number_field + sage: B[2] (Scheme morphism: From: Affine Curve over Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? @@ -1278,9 +1287,9 @@ def blowup(self, P=None): :: - 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 + sage: A. = AffineSpace(QuadraticField(-1), 2) # needs sage.rings.number_field + sage: C = A.curve([y^2 + x^2]) # needs sage.rings.number_field + sage: C.blowup() # needs sage.rings.number_field Traceback (most recent call last): ... TypeError: this curve must be irreducible @@ -1453,10 +1462,10 @@ def resolution_of_singularities(self, extend=False): :: sage: set_verbose(-1) - 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 + sage: K. = QuadraticField(3) # needs sage.rings.number_field + sage: A. = AffineSpace(K, 2) # needs sage.rings.number_field + sage: C = A.curve(x^4 + 2*x^2 + a*y^3 + 1) # needs sage.rings.number_field + sage: C.resolution_of_singularities(extend=True)[0] # long time (2 s), needs 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), @@ -1469,10 +1478,11 @@ def resolution_of_singularities(self, extend=False): :: - 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 + sage: # needs sage.rings.finite_rings + 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 @@ -1754,13 +1764,14 @@ def fundamental_group(self): 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] # 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 + sage: # needs sage.rings.number_field + sage: a = QQ[x](x^2 + 5).roots(QQbar)[0][0] + sage: F = NumberField(a.minpoly(), 'a', embedding=a) + sage: F.inject_variables() Defining a - 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 + sage: A. = AffineSpace(F, 2) + sage: C = A.curve(y^2 - a*x^3 - x^2) + sage: C.fundamental_group() # optional - sirocco Finitely presented group < x0 | > .. WARNING:: @@ -1860,12 +1871,13 @@ def riemann_roch_basis(self, D): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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) [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() @@ -1911,33 +1923,36 @@ def rational_points(self, algorithm="enum"): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: x, y = (GF(5)['x,y']).gens() + sage: f = y^2 - x^9 - x + sage: C = Curve(f); C Affine Plane Curve over Finite Field of size 5 defined by -x^9 + y^2 - x - sage: C.rational_points(algorithm='bn') # optional - sage.rings.finite_rings + sage: C.rational_points(algorithm='bn') [(0, 0), (2, 2), (2, 3), (3, 1), (3, 4)] - sage: C = Curve(x - y + 1) # optional - sage.rings.finite_rings - sage: C.rational_points() # optional - sage.rings.finite_rings + sage: C = Curve(x - y + 1) + sage: C.rational_points() [(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)] We compare Brill-Noether and enumeration:: - 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 + sage: # needs sage.rings.finite_rings + 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) 20 - sage: v == w # optional - sage.rings.finite_rings + sage: v == w True - 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 + sage: # needs sage.rings.finite_rings + 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() # optional - sage.rings.finite_rings + 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)] """ @@ -2004,9 +2019,9 @@ def function_field(self): :: - 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 + sage: A. = AffineSpace(GF(8), 2) # needs sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y + 1) # needs sage.rings.finite_rings + sage: C.function_field() # needs sage.rings.finite_rings Function field in y defined by y^5 + x*y + x^5 + 1 """ return self._function_field @@ -2018,9 +2033,9 @@ def _genus(self): EXAMPLES:: - 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 + sage: A. = AffineSpace(GF(2), 2) # needs sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y + 1) # needs sage.rings.finite_rings + sage: C.genus() # indirect doctest # needs sage.rings.finite_rings 1 """ k = self.base_ring() @@ -2040,25 +2055,27 @@ def __call__(self, *args): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: A. = AffineSpace(GF(8), 2) + sage: C = Curve(x^5 + y^5 + x*y + 1) + sage: C(1,1) (1, 1) - sage: C(x/y) # optional - sage.rings.finite_rings + sage: C(x/y) (x/(x^5 + 1))*y^4 + x^2/(x^5 + 1) - sage: C(GF(8^2)) # optional - sage.rings.finite_rings + sage: C(GF(8^2)) 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) # 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 + sage: # needs sage.rings.finite_rings + 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]) (0, 0, 0) - sage: C(y) # optional - sage.rings.finite_rings + sage: C(y) z^2 - sage: C(A.coordinate_ring()(y)) # optional - sage.rings.finite_rings + sage: C(A.coordinate_ring()(y)) z^2 """ try: @@ -2080,14 +2097,15 @@ def function(self, f): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: A. = AffineSpace(GF(8), 2) + sage: C = Curve(x^5 + y^5 + x*y + 1) + sage: f = C.function(x/y) + sage: f (x/(x^5 + 1))*y^4 + x^2/(x^5 + 1) - sage: df = f.differential(); df # optional - sage.rings.finite_rings + sage: df = f.differential(); df ((1/(x^10 + 1))*y^4 + x^6/(x^10 + 1)) d(x) - sage: df.divisor() # long time # optional - sage.rings.finite_rings + sage: df.divisor() # long time 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) @@ -2108,10 +2126,11 @@ def coordinate_functions(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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 0 """ return self._coordinate_functions @@ -2128,9 +2147,9 @@ def _nonsingular_model(self): TESTS:: - 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 + sage: A. = AffineSpace(GF(11), 3) # needs sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # needs sage.rings.finite_rings + sage: C._nonsingular_model # needs sage.rings.finite_rings (Function field in z defined by z^3 + 10*x, Ring morphism: From: Multivariate Polynomial Ring in x, y, z @@ -2235,9 +2254,9 @@ def _function_field(self): TESTS:: - 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 + sage: A. = AffineSpace(GF(11), 3) # needs sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # needs sage.rings.finite_rings + sage: C._function_field # needs sage.rings.finite_rings Function field in z defined by z^3 + 10*x """ return self._nonsingular_model[0] @@ -2249,9 +2268,9 @@ def _lift_to_function_field(self): TESTS:: - 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 + sage: A. = AffineSpace(GF(11), 3) # needs sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # needs sage.rings.finite_rings + sage: C._lift_to_function_field # needs sage.rings.finite_rings Ring morphism: From: Multivariate Polynomial Ring in x, y, z over Finite Field of size 11 @@ -2269,9 +2288,9 @@ def _coordinate_functions(self): TESTS:: - 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 + sage: A. = AffineSpace(GF(11), 3) # needs sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # needs sage.rings.finite_rings + sage: C._coordinate_functions # needs sage.rings.finite_rings [x, z^2, z] """ return self._nonsingular_model[1].im_gens() @@ -2283,9 +2302,9 @@ def _singularities(self): TESTS:: - 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 # long time # optional - sage.rings.finite_rings + sage: A. = AffineSpace(GF(7^2), 2) # needs sage.rings.finite_rings + sage: C = Curve(x^2 - x^4 - y^4) # needs sage.rings.finite_rings + sage: C._singularities # long time # needs 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)])] """ @@ -2325,16 +2344,16 @@ def singular_closed_points(self): EXAMPLES:: - 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 + sage: A. = AffineSpace(GF(7^2), 2) # needs sage.rings.finite_rings + sage: C = Curve(x^2 - x^4 - y^4) # needs sage.rings.finite_rings + sage: C.singular_closed_points() # needs sage.rings.finite_rings [Point (x, y)] :: - 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 + sage: A. = AffineSpace(GF(11), 3) # needs sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # needs sage.rings.finite_rings + sage: C.singular_closed_points() # needs sage.rings.finite_rings [] """ return [p for p, _ in self._singularities] @@ -2350,13 +2369,14 @@ def place_to_closed_point(self, place): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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]) Point (x + 1, y + 1) - sage: C.place_to_closed_point(pls[-2]) # optional - sage.rings.finite_rings + sage: C.place_to_closed_point(pls[-2]) Point (x + 1, y + 1) """ F = self.function_field() @@ -2434,17 +2454,18 @@ def places_at_infinity(self): :: - 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 + sage: # needs sage.rings.finite_rings + sage: F = GF(9) + sage: A2. = AffineSpace(F, 2) + sage: C = A2.curve(y^3 + y - x^4) + sage: C.places_at_infinity() [Place (1/x, 1/x^3*y^2)] :: - 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 + sage: A. = AffineSpace(GF(11), 3) # needs sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # needs sage.rings.finite_rings + sage: C.places_at_infinity() # needs 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())) @@ -2471,11 +2492,12 @@ def places_on(self, point): :: - 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 + sage: # needs sage.rings.finite_rings + 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 [Point (x, y + (a + 1)), Point (x, y + (-a - 1)), Point (x + (a + 1), y + (a - 1)), @@ -2486,20 +2508,21 @@ 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] # optional - sage.rings.finite_rings - sage: C.places_on(p1) # optional - sage.rings.finite_rings + sage: p1, p2, p3 = pts[:3] + sage: C.places_on(p1) [Place (x, y + a + 1)] - sage: C.places_on(p2) # optional - sage.rings.finite_rings + sage: C.places_on(p2) [Place (x, y + 2*a + 2)] - sage: C.places_on(p3) # optional - sage.rings.finite_rings + sage: C.places_on(p3) [Place (x + a + 1, y + a + 2)] :: - 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 + sage: # needs sage.rings.finite_rings + 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) """ phi = self._lift_to_function_field gs = [phi(g) for g in point.prime_ideal().gens()] @@ -2533,17 +2556,18 @@ def parametric_representation(self, place, name=None): :: - 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 + sage: # needs sage.rings.finite_rings + 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)] [0, 0, 0, 0, 0] - 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 + sage: xs, ys = C.parametric_representation(b2) + sage: f = xs^2 - xs^4 - ys^4 + sage: [f.coefficient(i) for i in range(5)] [0, 0, 0, 0, 0] """ F = place.function_field() @@ -2564,11 +2588,11 @@ class IntegralAffineCurve_finite_field(IntegralAffineCurve): EXAMPLES:: - 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 + sage: A. = AffineSpace(GF(11), 3) # needs sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A); C # needs 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 + sage: C.function_field() # needs sage.rings.finite_rings Function field in z defined by z^3 + 10*x """ _point = IntegralAffineCurvePoint_finite_field @@ -2583,10 +2607,11 @@ def places(self, degree=1): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: F = GF(9) + sage: A2. = AffineSpace(F, 2) + sage: C = A2.curve(y^3 + y - x^4) + sage: C.places() [Place (1/x, 1/x^3*y^2), Place (x, y), Place (x, y + z2 + 1), @@ -2630,9 +2655,9 @@ def closed_points(self, degree=1): EXAMPLES:: - 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 + sage: A. = AffineSpace(GF(7), 2) # needs sage.rings.finite_rings + sage: C = Curve(x^2 - x^4 - y^4) # needs sage.rings.finite_rings + sage: C.closed_points() # needs sage.rings.finite_rings [Point (x, y), Point (x + 1, y), Point (x + 2, y + 2), @@ -2675,11 +2700,11 @@ class IntegralAffinePlaneCurve_finite_field(AffinePlaneCurve_finite_field, Integ EXAMPLES:: - 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 + sage: A. = AffineSpace(GF(8), 2) # needs sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y + 1); C # needs 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 + sage: C.function_field() # needs 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 84cd5e84cc5..808015db97d 100644 --- a/src/sage/schemes/curves/closed_point.py +++ b/src/sage/schemes/curves/closed_point.py @@ -9,30 +9,32 @@ EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: F. = GF(2) + sage: P. = AffineSpace(F, 2) + sage: C = Curve(y^2 + y - x^3) + sage: C.closed_points() [Point (x, y), Point (x, y + 1)] - sage: C.closed_points(2) # optional - sage.rings.finite_rings + sage: C.closed_points(2) [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) # optional - sage.rings.finite_rings + sage: C.closed_points(3) [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) # 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 + sage: # needs sage.rings.finite_rings + 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() [Point (x, z), Point (x, y), Point (y, z)] - sage: C.closed_points(2) # optional - sage.rings.finite_rings + sage: C.closed_points(2) [Point (y^2 + y*z + z^2, x + y + z)] - sage: C.closed_points(3) # optional - sage.rings.finite_rings + sage: C.closed_points(3) [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 +46,20 @@ Rational points are easily converted to closed points and vice versa if the closed point is of degree one:: - 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 + sage: # needs sage.rings.finite_rings + 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() (0 : 1 : 0) - sage: p2.rational_point() # optional - sage.rings.finite_rings + sage: p2.rational_point() (0 : 0 : 1) - sage: p3.rational_point() # optional - sage.rings.finite_rings + sage: p3.rational_point() (1 : 0 : 0) - sage: _.closed_point() # optional - sage.rings.finite_rings + sage: _.closed_point() Point (y, z) - sage: _ == p3 # optional - sage.rings.finite_rings + sage: _ == p3 True AUTHORS: @@ -99,10 +102,11 @@ class IntegralCurveClosedPoint(CurveClosedPoint): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: F. = GF(4) + sage: P. = AffineSpace(F, 2) + sage: C = Curve(y^2 + y - x^3) + sage: C.closed_points() [Point (x, y), Point (x, y + 1), Point (x + a, y + a), @@ -118,12 +122,13 @@ def __init__(self, curve, prime_ideal, degree): TESTS:: - 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 + sage: # needs sage.rings.finite_rings + sage: F. = GF(4) + sage: P. = AffineSpace(F, 2) + sage: C = Curve(y^2 + y - x^3) + sage: p = C([0,0]); p (0, 0) - sage: loads(dumps(p)) == p # optional - sage.rings.finite_rings + sage: loads(dumps(p)) == p True """ super().__init__(curve.ambient_space(), prime_ideal) @@ -137,12 +142,13 @@ def __hash__(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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} {Point (x, y): 1} """ return hash((self.parent(), self.prime_ideal())) @@ -159,11 +165,12 @@ def _richcmp_(self, other, op): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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] False """ return richcmp((self._curve, self.prime_ideal()), (other._curve, other.prime_ideal()), op) @@ -174,11 +181,12 @@ def _repr_(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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] Point (x, y) """ return "Point ({})".format(', '.join(repr(g) for g in self.prime_ideal().gens())) @@ -189,12 +197,13 @@ def curve(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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() Affine Plane Curve over Finite Field in a of size 2^2 defined by x^3 + y^2 + y """ return self._curve @@ -205,12 +214,13 @@ def degree(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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() 1 """ return self._degree @@ -221,12 +231,13 @@ def places(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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() [Place (x, y)] """ return self._curve.places_on(self) @@ -239,12 +250,13 @@ def place(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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() Place (x, y) """ return self._curve.places_on(self)[0] @@ -260,9 +272,10 @@ def rational_point(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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() [Point (x, y + (z2 + 1)), Point (x, y + (-z2 - 1)), Point (x + (z2 + 1), y + (z2 - 1)), @@ -273,7 +286,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 _] # optional - sage.rings.finite_rings + sage: [p.rational_point() for p in _] [(0, 2*z2 + 2), (0, z2 + 1), (2*z2 + 2, 2*z2 + 1), @@ -284,7 +297,7 @@ def rational_point(self): (z2 + 1, z2), (2, 2), (2, 1)] - sage: set(_) == set(C.rational_points()) # optional - sage.rings.finite_rings + sage: set(_) == set(C.rational_points()) True """ if self.degree() != 1: @@ -305,21 +318,22 @@ def projective(self, i=0): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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 Point (x, y) - sage: p2 # optional - sage.rings.finite_rings + sage: p2 Point (x, y + 1) - sage: p1.projective() # optional - sage.rings.finite_rings + sage: p1.projective() Point (x1, x2) - sage: p2.projective(0) # optional - sage.rings.finite_rings + sage: p2.projective(0) Point (x1, x0 + x2) - sage: p2.projective(1) # optional - sage.rings.finite_rings + sage: p2.projective(1) Point (x0, x1 + x2) - sage: p2.projective(2) # optional - sage.rings.finite_rings + sage: p2.projective(2) Point (x0, x1 + x2) """ C = self.curve() @@ -349,18 +363,19 @@ def rational_point(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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() [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 _] # optional - sage.rings.finite_rings + sage: [p.rational_point() for p in _] [(0 : 1 : 0), (0 : 0 : 1), (1 : 0 : 0), (a : a + 1 : 1), (a + 1 : a : 1)] - sage: set(_) == set(C.rational_points()) # optional - sage.rings.finite_rings + sage: set(_) == set(C.rational_points()) True """ if self.degree() != 1: @@ -385,19 +400,20 @@ def affine(self, i=None): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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() Point (x, z) - sage: p2.affine() # optional - sage.rings.finite_rings + sage: p2.affine() Point (x, y) - sage: p3.affine() # optional - sage.rings.finite_rings + sage: p3.affine() Point (y, z) - sage: p3.affine(0) # optional - sage.rings.finite_rings + sage: p3.affine(0) Point (y, z) - sage: p3.affine(1) # optional - sage.rings.finite_rings + sage: p3.affine(1) 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 78ae384ccb7..7bf581f8468 100644 --- a/src/sage/schemes/curves/constructor.py +++ b/src/sage/schemes/curves/constructor.py @@ -13,8 +13,8 @@ :: - sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings - sage: Curve(y^2*z^7 - x^9 - x*z^8) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(5), 2) # needs sage.rings.finite_rings + sage: Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings Projective Plane Curve over Finite Field of size 5 defined by -x^9 + y^2*z^7 - x*z^8 @@ -127,10 +127,10 @@ def Curve(F, A=None): Affine plane curves. :: - 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 + sage: x,y = GF(7)['x,y'].gens() # needs sage.rings.finite_rings + sage: C = Curve(y^2 + x^3 + x^10); C # needs sage.rings.finite_rings Affine Plane Curve over Finite Field of size 7 defined by x^10 + x^3 + y^2 - sage: C.genus() # optional - sage.rings.finite_rings + sage: C.genus() # needs sage.rings.finite_rings 0 sage: x, y = QQ['x,y'].gens() sage: Curve(x^3 + y^3 + 1) @@ -208,11 +208,12 @@ 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)) # 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 + sage: # needs sage.rings.finite_rings + sage: P1. = ProjectiveSpace(1, GF(5)) + sage: S = P1.coordinate_ring() + sage: Curve(S(0), P1) Projective Line over Finite Field of size 5 - sage: Curve(P1) # optional - sage.rings.finite_rings + sage: Curve(P1) 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 bb2ce1495fc..e358fd76ad7 100644 --- a/src/sage/schemes/curves/curve.py +++ b/src/sage/schemes/curves/curve.py @@ -217,29 +217,31 @@ def geometric_genus(self): Examples of projective curves. :: - 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 + sage: # needs sage.rings.finite_rings + 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) # optional - sage.rings.finite_rings - sage: C.geometric_genus() # optional - sage.rings.finite_rings + sage: C = Curve(y^2*z - x^3) + sage: C.geometric_genus() 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 + sage: C = Curve(x^10 + y^7*z^3 + z^10) + sage: C.geometric_genus() 3 Examples of affine curves. :: - 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 + sage: # needs sage.rings.finite_rings + sage: x, y = PolynomialRing(GF(5), 2, 'xy').gens() + sage: C = Curve(y^2 - x^3 - 17*x + y) + sage: C.geometric_genus() 1 - sage: C = Curve(y^2 - x^3) # optional - sage.rings.finite_rings - sage: C.geometric_genus() # optional - sage.rings.finite_rings + sage: C = Curve(y^2 - x^3) + sage: C.geometric_genus() 0 - sage: C = Curve(x^10 + y^7 + 1) # optional - sage.rings.finite_rings - sage: C.geometric_genus() # optional - sage.rings.finite_rings + sage: C = Curve(x^10 + y^7 + 1) + sage: C.geometric_genus() 3 """ @@ -325,12 +327,12 @@ def singular_points(self, F=None): :: sage: R. = QQ[] - 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 + sage: K. = NumberField(a^8 - a^4 + 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(QQ, 2) # needs 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 # needs 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 + sage: sorted(C.singular_points(K), key=str) # needs 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), @@ -374,10 +376,11 @@ def is_singular(self, P=None): :: - 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 + sage: # needs sage.rings.finite_rings + 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) True """ return not self.is_smooth(P) @@ -407,14 +410,15 @@ def intersects_at(self, C, P): :: - 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 + sage: # needs sage.rings.finite_rings + 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) True - sage: Q2 = A([3,7]) # optional - sage.rings.finite_rings - sage: C.intersects_at(D, Q2) # optional - sage.rings.finite_rings + sage: Q2 = A([3,7]) + sage: C.intersects_at(D, Q2) False """ if C.ambient_space() != self.ambient_space(): @@ -453,20 +457,21 @@ def intersection_points(self, C, F=None): EXAMPLES:: sage: R. = QQ[] - 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 + sage: K. = NumberField(a^2 + a + 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(QQ, 3) # needs sage.rings.number_field + sage: C = Curve([y^2 - w*z, w^3 - y^3], P) # needs sage.rings.number_field + sage: D = Curve([x*y - w*z, z^3 - y^3], P) # needs sage.rings.number_field + sage: C.intersection_points(D, F=K) # needs 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) # 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 + sage: # needs sage.rings.finite_rings + 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)] :: @@ -507,19 +512,19 @@ 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)) # optional - sage.rings.number_field + sage: C.change_ring(QuadraticField(-1)) # needs 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) # 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: K. = NumberField(a^3 + a^2 - 1) # needs sage.rings.number_field + sage: A. = AffineSpace(K, 2) # needs sage.rings.number_field + sage: C = Curve([K.0*x^2 - x + y^3 - 11], A) # needs sage.rings.number_field + sage: L = K.embeddings(QQbar) # needs sage.rings.number_field sage: set_verbose(-1) # suppress warnings for slow computation - sage: C.change_ring(L[0]) # optional - sage.rings.number_field + sage: C.change_ring(L[0]) # needs sage.rings.number_field Affine Plane Curve over Algebraic Field defined by y^3 + (-0.8774388331233464? - 0.744861766619745?*I)*x^2 - x - 11 @@ -527,7 +532,7 @@ def change_ring(self, R): sage: P. = ProjectiveSpace(QQ, 2) sage: C = P.curve([y*x - 18*x^2 + 17*z^2]) - sage: C.change_ring(GF(17)) # optional - sage.rings.finite_rings + sage: C.change_ring(GF(17)) # needs 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 167b4071edc..1e60b3d9e1c 100644 --- a/src/sage/schemes/curves/point.py +++ b/src/sage/schemes/curves/point.py @@ -13,10 +13,11 @@ or on affine curves:: - 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 + sage: # needs sage.rings.finite_rings + 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 @@ -72,10 +73,11 @@ def multiplicity(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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() 3 """ return self.codomain().multiplicity(self) @@ -115,14 +117,14 @@ def is_ordinary_singularity(self): :: sage: R. = QQ[] - 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 + sage: K. = NumberField(a^2 - 3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs 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 - # needs 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]) # optional - sage.rings.number_field - sage: Q.is_ordinary_singularity() # optional - sage.rings.number_field + sage: Q = C([-1/2, 1/2, 1]) # needs sage.rings.number_field + sage: Q.is_ordinary_singularity() # needs sage.rings.number_field True """ return self.codomain().is_ordinary_singularity(self) @@ -147,11 +149,12 @@ def is_transverse(self, 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 + sage: # needs sage.rings.finite_rings + 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) False """ return self.codomain().is_transverse(D, self) @@ -172,12 +175,13 @@ def closed_point(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(17), 2) + sage: C = Curve([x^4 - 16*y^3*z], P) + sage: C.singular_points() [(0 : 0 : 1)] - sage: p = _[0] # optional - sage.rings.finite_rings - sage: p.closed_point() # optional - sage.rings.finite_rings + sage: p = _[0] + sage: p.closed_point() Point (x, y) """ curve = self.codomain() @@ -200,12 +204,13 @@ def places(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(17), 2) + sage: C = Curve([x^4 - 16*y^3*z], P) + sage: C.singular_points() [(0 : 0 : 1)] - sage: p = _[0] # optional - sage.rings.finite_rings - sage: p.places() # optional - sage.rings.finite_rings + sage: p = _[0] + sage: p.places() [Place (y)] """ return self.closed_point().places() @@ -216,12 +221,13 @@ def place(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(17), 2) + sage: C = Curve([x^4 - 16*y^3*z], P) + sage: C.singular_points() [(0 : 0 : 1)] - sage: p = _[0] # optional - sage.rings.finite_rings - sage: p.place() # optional - sage.rings.finite_rings + sage: p = _[0] + sage: p.place() Place (y) """ return self.closed_point().place() @@ -256,14 +262,15 @@ def is_singular(self): EXAMPLES:: - 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 + sage: # needs sage.rings.number_field + 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() True - sage: Q2 = C([-K.gen(),0,-1]) # optional - sage.rings.number_field - sage: Q2.is_singular() # optional - sage.rings.number_field + sage: Q2 = C([-K.gen(),0,-1]) + sage: Q2.is_singular() False """ return self.codomain().is_singular(self) @@ -327,10 +334,11 @@ def is_ordinary_singularity(self): :: - 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 + sage: # needs sage.rings.finite_rings + 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() False """ return self.codomain().is_ordinary_singularity(self) @@ -356,12 +364,12 @@ def is_transverse(self, D): :: sage: R. = QQ[] - 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 + sage: K. = NumberField(a^2 - 2) # needs sage.rings.number_field + sage: A. = AffineSpace(K, 2) # needs sage.rings.number_field + sage: C = Curve([y^2 + x^2 - 1], A) # needs sage.rings.number_field + sage: D = Curve([y - x], A) # needs sage.rings.number_field + sage: Q = C([-1/2*b, -1/2*b]) # needs sage.rings.number_field + sage: Q.is_transverse(D) # needs sage.rings.number_field True """ return self.codomain().is_transverse(D, self) @@ -384,10 +392,11 @@ def closed_point(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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() Point (x + 1, y + 1) """ curve = self.codomain() @@ -403,14 +412,15 @@ def places(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: A. = AffineSpace(GF(2), 2) + sage: C = Curve(x^5 + y^5 + x*y + 1) + sage: p = C(-1,-1) + sage: p (1, 1) - sage: p.closed_point() # optional - sage.rings.finite_rings + sage: p.closed_point() Point (x + 1, y + 1) - sage: _.places() # optional - sage.rings.finite_rings + sage: _.places() [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 @@ -424,14 +434,15 @@ def place(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: A. = AffineSpace(GF(2), 2) + sage: C = Curve(x^5 + y^5 + x*y + 1) + sage: p = C(-1,-1) + sage: p (1, 1) - sage: p.closed_point() # optional - sage.rings.finite_rings + sage: p.closed_point() Point (x + 1, y + 1) - sage: _.place() # optional - sage.rings.finite_rings + 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) """ diff --git a/src/sage/schemes/curves/projective_curve.py b/src/sage/schemes/curves/projective_curve.py index 1e00d84918e..59058457a3b 100644 --- a/src/sage/schemes/curves/projective_curve.py +++ b/src/sage/schemes/curves/projective_curve.py @@ -47,34 +47,36 @@ All singular closed points can be found:: - sage: C.singular_closed_points() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: C.singular_closed_points() [Point (x, y)] - sage: p = _[0] # needs sage.rings.finite_rings - sage: p.places() # a unibranch singularity, that is, a cusp # needs sage.rings.finite_rings + sage: p = _[0] + sage: p.places() # a unibranch singularity, that is, a cusp [Place (1/y)] - sage: pls = _[0] # needs sage.rings.finite_rings - sage: C.place_to_closed_point(pls) # needs sage.rings.finite_rings + sage: pls = _[0] + sage: C.place_to_closed_point(pls) Point (x, y) It is easy to transit to and from the function field of the curve:: - sage: fx = C(x/z) # needs sage.rings.finite_rings - sage: fy = C(y/z) # needs sage.rings.finite_rings - sage: fx^2 - fy^3 # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: fx = C(x/z) + sage: fy = C(y/z) + sage: fx^2 - fy^3 0 - sage: fx.divisor() # needs sage.rings.finite_rings + sage: fx.divisor() 3*Place (1/y) - 3*Place (y) - sage: p, = fx.poles() # needs sage.rings.finite_rings - sage: p # needs sage.rings.finite_rings + sage: p, = fx.poles() + sage: p Place (y) - sage: C.place_to_closed_point(p) # needs sage.rings.finite_rings + sage: C.place_to_closed_point(p) Point (y, z) - sage: _.rational_point() # needs sage.rings.finite_rings + sage: _.rational_point() (1 : 0 : 0) - sage: _.closed_point() # needs sage.rings.finite_rings + sage: _.closed_point() Point (y, z) - sage: _.place() # needs sage.rings.finite_rings + sage: _.place() Place (y) Integral projective curves over `\QQ` @@ -299,12 +301,13 @@ def projection(self, P=None, PS=None): EXAMPLES:: - sage: K. = CyclotomicField(3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 3) # needs sage.rings.number_field - sage: C = Curve([y*w - x^2, z*w^2 - a*x^3], P) # needs sage.rings.number_field - sage: L. = ProjectiveSpace(K, 2) # needs sage.rings.number_field - sage: proj1 = C.projection(PS=L) # needs sage.rings.number_field - sage: proj1 # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 (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 @@ -314,10 +317,10 @@ def projection(self, P=None, PS=None): (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) - sage: proj1[1].ambient_space() is L # needs sage.rings.number_field + sage: proj1[1].ambient_space() is L True - sage: proj2 = C.projection() # needs sage.rings.number_field - sage: proj2[1].ambient_space() is L # needs sage.rings.number_field + sage: proj2 = C.projection() + sage: proj2[1].ambient_space() is L False :: @@ -695,7 +698,7 @@ def local_coordinates(self, pt, n): sage: x, y, z = P2.coordinate_ring().gens() sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings sage: pt = C([2,3,1]) # needs sage.rings.finite_rings - sage: C.local_coordinates(pt,9) # not implemented, needs sage.rings.finite_rings + sage: C.local_coordinates(pt,9) # not implemented # needs 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] """ @@ -1721,15 +1724,16 @@ def fundamental_group(self): 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] # needs sage.rings.number_field - sage: a # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: a = QQ[x](x^2 + 5).roots(QQbar)[0][0] + sage: a -2.236067977499790?*I - sage: F = NumberField(a.minpoly(), 'a', embedding=a) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(F, 2) # needs sage.rings.number_field - sage: F.inject_variables() # needs sage.rings.number_field + sage: F = NumberField(a.minpoly(), 'a', embedding=a) + sage: P. = ProjectiveSpace(F, 2) + sage: F.inject_variables() Defining a - sage: C = P.curve(x^2 + a * y^2) # needs sage.rings.number_field - sage: C.fundamental_group() # optional - sirocco, needs sage.rings.number_field + sage: C = P.curve(x^2 + a * y^2) + sage: C.fundamental_group() # optional - sirocco Finitely presented group < x0 | > .. WARNING:: @@ -2280,13 +2284,14 @@ def __call__(self, *args): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(4), 2) # needs sage.rings.finite_rings - sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) # needs sage.rings.finite_rings - sage: C(1,1,1) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(4), 2) + sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) + sage: C(1,1,1) (1 : 1 : 1) - sage: C(y/z) # needs sage.rings.finite_rings + sage: C(y/z) (y/(y^5 + 1))*z^4 + (y^2/(y^5 + 1))*z^2 - sage: C(GF(4^2)) # needs sage.rings.finite_rings + sage: C(GF(4^2)) 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 @@ -2305,11 +2310,12 @@ def function(self, f): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(4), 2) # needs sage.rings.finite_rings - sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) # needs sage.rings.finite_rings - sage: f = C.function(x/y); f # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 1/y - sage: f.divisor() # needs sage.rings.finite_rings + sage: f.divisor() 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) @@ -2334,11 +2340,12 @@ def coordinate_functions(self, i=None): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(4), 2) # needs sage.rings.finite_rings - sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) # needs sage.rings.finite_rings - sage: C.coordinate_functions(0) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(4), 2) + sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) + sage: C.coordinate_functions(0) (y, z) - sage: C.coordinate_functions(1) # needs sage.rings.finite_rings + sage: C.coordinate_functions(1) (1/y, 1/y*z) """ coords = self._coordinate_functions @@ -2684,10 +2691,11 @@ def closed_points(self, degree=1): EXAMPLES:: - sage: A. = AffineSpace(GF(9),2) # needs sage.rings.finite_rings - sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x-2) # needs sage.rings.finite_rings - sage: Cp = C.projective_closure() # needs sage.rings.finite_rings - sage: Cp.closed_points() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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() [Point (x0, x1), Point (x0 + (-z2 - 1)*x2, x1), Point (x0 + (z2 + 1)*x2, x1), @@ -2806,12 +2814,13 @@ class IntegralProjectivePlaneCurve_finite_field(IntegralProjectiveCurve_finite_f EXAMPLES:: - sage: A. = AffineSpace(GF(9), 2) # needs sage.rings.finite_rings - sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x - 2) # needs sage.rings.finite_rings - sage: Cb = C.projective_closure() # needs sage.rings.finite_rings - sage: Cb.singular_closed_points() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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() [Point (x0, x1)] - sage: Cb.function_field() # needs sage.rings.finite_rings + sage: Cb.function_field() 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 0111b5c7f2d..a0dad63a479 100644 --- a/src/sage/schemes/curves/zariski_vankampen.py +++ b/src/sage/schemes/curves/zariski_vankampen.py @@ -597,10 +597,10 @@ def braid_in_segment(g, x0, x1): sage: f = y*(y + z)*x*(x - 1)*(x - y)*(x + z*y - 1)*(x + z*y + wp) sage: from sage.schemes.curves import zariski_vankampen as zvk sage: g = f.subs({x: x + 2*y}) - sage: p1 = QQbar(sqrt(-1/3)) - sage: p2 = QQbar(1/2+sqrt(-1/3)/2) - sage: B = zvk.braid_in_segment(g.factor(),CC(p1),CC(p2)) # optional - sirocco - sage: B # optional - sirocco + sage: p1 = QQbar(sqrt(-1/3)) # needs sage.symbolic + sage: p2 = QQbar(1/2+sqrt(-1/3)/2) # needs sage.symbolic + sage: B = zvk.braid_in_segment(g.factor(), CC(p1), CC(p2)) # optional - sirocco, needs sage.symbolic + sage: B # optional - needs sirocco # needs sage.symbolic s5*s3^-1 """ _, y = g.value().parent().gens() diff --git a/src/sage/schemes/cyclic_covers/constructor.py b/src/sage/schemes/cyclic_covers/constructor.py index d2975336301..644dd90a2a3 100644 --- a/src/sage/schemes/cyclic_covers/constructor.py +++ b/src/sage/schemes/cyclic_covers/constructor.py @@ -64,11 +64,11 @@ 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[] # optional - sage.rings.finite_rings - sage: CyclicCover(5, x^9 + x + 1) # optional - sage.rings.finite_rings + sage: k. = GF(9); R. = k[] # needs sage.rings.finite_rings + sage: CyclicCover(5, x^9 + x + 1) # needs 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 + sage: CyclicCover(15, x^9 + x + 1) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: As the characteristic divides the order of the cover, @@ -76,20 +76,20 @@ def CyclicCover(r, f, names=None, check_smooth=True): We can change the names of the variables in the output:: - 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 + sage: k. = GF(9); R. = k[] # needs sage.rings.finite_rings + sage: CyclicCover(5, x^9 + x + 1, names=["A","B"]) # needs 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)[] # optional - sage.rings.finite_rings - sage: CyclicCover(2, (x^3-x+2)^2*(x^6-1)) # optional - sage.rings.finite_rings + sage: P. = GF(7)[] # needs sage.rings.finite_rings + sage: CyclicCover(2, (x^3-x+2)^2*(x^6-1)) # needs 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) # optional - sage.rings.finite_rings + sage: CyclicCover(2, (x^3-x+2)^2*(x^6-1), check_smooth=False) # needs 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 diff --git a/src/sage/schemes/cyclic_covers/cycliccover_generic.py b/src/sage/schemes/cyclic_covers/cycliccover_generic.py index ec852541ad3..b6ce2bc596d 100644 --- a/src/sage/schemes/cyclic_covers/cycliccover_generic.py +++ b/src/sage/schemes/cyclic_covers/cycliccover_generic.py @@ -12,18 +12,19 @@ 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)) # optional - sage.rings.finite_rings + sage: C.change_ring(GF(5)) # needs 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)[] # 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 + sage: # needs sage.rings.finite_rings + sage: GF7x. = GF(7)[] + sage: C = CyclicCover(3, x^9 + x + 1) + sage: C Cyclic Cover of P^1 over Finite Field of size 7 defined by y^3 = x^9 + x + 1 - sage: C.genus() # optional - sage.rings.finite_rings + sage: C.genus() 7 - sage: C.projective_closure() # optional - sage.rings.finite_rings + sage: C.projective_closure() Traceback (most recent call last): ... NotImplementedError: Weighted Projective Space is not implemented @@ -71,20 +72,21 @@ 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)) # optional - sage.rings.finite_rings + sage: C.change_ring(GF(5)) # needs 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)[] # 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 + sage: # needs sage.rings.finite_rings + sage: GF7x. = GF(7)[] + sage: C = CyclicCover(3, x^9 + x + 1) + sage: C Cyclic Cover of P^1 over Finite Field of size 7 defined by y^3 = x^9 + x + 1 - sage: C.genus() # optional - sage.rings.finite_rings + sage: C.genus() 7 - sage: C.projective_closure() # optional - sage.rings.finite_rings + sage: C.projective_closure() Traceback (most recent call last): ... NotImplementedError: Weighted Projective Space is not implemented @@ -115,17 +117,17 @@ def change_ring(self, R): sage: ZZx. = ZZ[] sage: C = CyclicCover(5, x^5 + x + 1) - sage: C.change_ring(GF(5)) # optional - sage.rings.finite_rings + sage: C.change_ring(GF(5)) # needs 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: C.change_ring(GF(3)) # optional - sage.rings.finite_rings + sage: C.change_ring(GF(3)) # needs 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)) # optional - sage.rings.finite_rings + sage: C.change_ring(GF(17)) # needs 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 @@ -241,8 +243,8 @@ def projective_closure(self, **kwds): EXAMPLES:: - sage: GF7x. = GF(7)[] # optional - sage.rings.finite_rings - sage: CyclicCover(3, x^9 + x + 1).projective_closure() # optional - sage.rings.finite_rings + sage: GF7x. = GF(7)[] # needs sage.rings.finite_rings + sage: CyclicCover(3, x^9 + x + 1).projective_closure() # needs sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError: Weighted Projective Space is not implemented diff --git a/src/sage/schemes/elliptic_curves/Qcurves.py b/src/sage/schemes/elliptic_curves/Qcurves.py index c9ad15fa9ed..1d10b130d07 100644 --- a/src/sage/schemes/elliptic_curves/Qcurves.py +++ b/src/sage/schemes/elliptic_curves/Qcurves.py @@ -170,14 +170,15 @@ 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])) # needs sage.rings.number_field - sage: E = EllipticCurve([K([-2,-4,1,1]), K([0,1,0,0]), K([0,1,0,0]), # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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) # needs sage.rings.number_field - sage: flag # needs sage.rings.number_field + sage: flag, cert = is_Q_curve(E, certificate=True) + sage: flag True - sage: cert # needs sage.rings.number_field + sage: cert {'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 @@ -187,12 +188,13 @@ 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]), # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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) # needs sage.rings.number_field - sage: flag # needs sage.rings.number_field + sage: flag, cert = is_Q_curve(E, certificate=True) + sage: flag True - sage: cert # needs sage.rings.number_field + sage: cert {'CM': 0, 'N': 2, 'core_degs': [1, 2], diff --git a/src/sage/schemes/elliptic_curves/cm.py b/src/sage/schemes/elliptic_curves/cm.py index ae70905d971..4476654b84c 100644 --- a/src/sage/schemes/elliptic_curves/cm.py +++ b/src/sage/schemes/elliptic_curves/cm.py @@ -205,10 +205,10 @@ def is_HCP(f, check_monic_irreducible=True): sage: from sage.schemes.elliptic_curves.cm import is_HCP sage: D = -1856563 - sage: D.class_number() # optional - sage.libs.pari + sage: D.class_number() # needs sage.libs.pari 100 - sage: # optional - sage.libs.flint + sage: # needs sage.libs.flint sage: H = hilbert_class_polynomial(D) sage: H.degree() 100 @@ -219,13 +219,13 @@ def is_HCP(f, check_monic_irreducible=True): Testing polynomials which are not HCPs is faster:: - sage: is_HCP(H+1) # optional - sage.libs.flint + sage: is_HCP(H+1) # needs sage.libs.flint 0 TESTS:: - sage: # optional - sage.libs.flint + sage: # needs sage.libs.flint sage: from sage.schemes.elliptic_curves.cm import is_HCP sage: all(is_HCP(hilbert_class_polynomial(D)) == D ....: for D in srange(-4,-100,-1) if D.is_discriminant()) diff --git a/src/sage/schemes/elliptic_curves/constructor.py b/src/sage/schemes/elliptic_curves/constructor.py index 205cafbc9e8..fb295907616 100644 --- a/src/sage/schemes/elliptic_curves/constructor.py +++ b/src/sage/schemes/elliptic_curves/constructor.py @@ -276,13 +276,14 @@ class EllipticCurveFactory(UniqueFactory): sage: type(E) - sage: E = EllipticCurve([SR(i),i]); E # needs sage.symbolic + sage: # needs sage.symbolic + sage: E = EllipticCurve([SR(i),i]); E Elliptic Curve defined by y^2 = x^3 + I*x + I over Symbolic Ring - sage: type(E) # needs sage.symbolic + sage: type(E) - sage: E.category() # needs sage.symbolic + sage: E.category() Category of schemes over Symbolic Ring - sage: SR in Fields() # needs sage.symbolic + sage: SR in Fields() True sage: F = FractionField(PolynomialRing(QQ,'t')) @@ -1019,10 +1020,11 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): An example over a finite field, using a flex:: - sage: K = GF(17) # needs sage.rings.finite_rings - sage: R. = K[] # needs sage.rings.finite_rings - sage: cubic = 2*x^3 + 3*y^3 + 4*z^3 # needs sage.rings.finite_rings - sage: EllipticCurve_from_cubic(cubic, [0,3,1]) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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]) Scheme morphism: From: Projective Plane Curve over Finite Field of size 17 defined by 2*x^3 + 3*y^3 + 4*z^3 @@ -1032,10 +1034,11 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): An example in characteristic 3:: - sage: K = GF(3) # needs sage.rings.finite_rings - sage: R. = K[] # needs sage.rings.finite_rings - sage: cubic = x^3 + y^3 + z^3 + x*y*z # needs sage.rings.finite_rings - sage: EllipticCurve_from_cubic(cubic, [0,1,-1]) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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]) Scheme morphism: From: Projective Plane Curve over Finite Field of size 3 defined by x^3 + y^3 + x*y*z + z^3 @@ -1045,10 +1048,11 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): An example over a number field, using a non-flex and where there are no rational flexes:: - sage: K. = QuadraticField(-3) # needs sage.rings.number_field - sage: R. = K[] # needs sage.rings.number_field - sage: cubic = 2*x^3 + 3*y^3 + 5*z^3 # needs sage.rings.number_field - sage: EllipticCurve_from_cubic(cubic, [1,1,-1]) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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]) Scheme morphism: From: Projective Plane Curve over Number Field in a with defining polynomial x^2 + 3 with a = 1.732050807568878?*I @@ -1461,13 +1465,14 @@ def EllipticCurves_with_good_reduction_outside_S(S=[], proof=None, verbose=False sage: ', '.join(e.label() for e in elist) # long time '11a1, 11a2, 11a3, 121a1, 121a2, 121b1, 121b2, 121c1, 121c2, 121d1, 121d2, 121d3' + sage: # long time sage: elist = EllipticCurves_with_good_reduction_outside_S([2,3]) # long time (26s on sage.math, 2011) - sage: len(elist) # long time + sage: len(elist) 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])) + sage: max(conds) 62208 - sage: [N.factor() for N in conds] # long time + sage: [N.factor() for N in conds] [2^3 * 3, 3^3, 2^5, diff --git a/src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx b/src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx index 5fc182c8954..432ab02af88 100644 --- a/src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx +++ b/src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx @@ -1151,14 +1151,14 @@ def two_descent_by_two_isogeny(E, sage: n1, n2, n1_prime, n2_prime = two_descent_by_two_isogeny(E) sage: log(n1,2) + log(n1_prime,2) - 2 # the rank 1 - sage: x,y = var('x,y') - sage: E = EllipticCurve(y^2 == x^3 + x^2 - 25*x + 39) - sage: n1, n2, n1_prime, n2_prime = two_descent_by_two_isogeny(E) - sage: log(n1,2) + log(n1_prime,2) - 2 # the rank + sage: x,y = var('x,y') # needs sage.symbolic + sage: E = EllipticCurve(y^2 == x^3 + x^2 - 25*x + 39) # needs sage.symbolic + sage: n1, n2, n1_prime, n2_prime = two_descent_by_two_isogeny(E) # needs sage.symbolic + sage: log(n1,2) + log(n1_prime,2) - 2 # the rank # needs sage.symbolic 2 - sage: E = EllipticCurve(y^2 + x*y + y == x^3 - 131*x + 558) - sage: n1, n2, n1_prime, n2_prime = two_descent_by_two_isogeny(E) - sage: log(n1,2) + log(n1_prime,2) - 2 # the rank + sage: E = EllipticCurve(y^2 + x*y + y == x^3 - 131*x + 558) # needs sage.symbolic + sage: n1, n2, n1_prime, n2_prime = two_descent_by_two_isogeny(E) # needs sage.symbolic + sage: log(n1,2) + log(n1_prime,2) - 2 # the rank # needs sage.symbolic 3 Using the verbosity option:: diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index ea6b9f1b559..e839799f187 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -13,21 +13,22 @@ The usual way to create and work with isogenies is illustrated with the following example:: - sage: k = GF(11) # needs sage.rings.finite_rings - sage: E = EllipticCurve(k, [1,1]) # needs sage.rings.finite_rings - sage: Q = E(6,5) # needs sage.rings.finite_rings - sage: phi = E.isogeny(Q) # needs sage.rings.finite_rings - sage: phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: k = GF(11) + sage: E = EllipticCurve(k, [1,1]) + sage: Q = E(6,5) + sage: phi = E.isogeny(Q) + sage: phi 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) # needs sage.rings.finite_rings - sage: phi(P) # needs sage.rings.finite_rings + sage: P = E(4,5) + sage: phi(P) (10 : 0 : 1) - sage: phi.codomain() # needs sage.rings.finite_rings + sage: phi.codomain() Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 11 - sage: phi.rational_maps() # needs sage.rings.finite_rings + sage: phi.rational_maps() ((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 @@ -193,19 +194,20 @@ def isogeny_codomain_from_kernel(E, kernel, degree=None): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import isogeny_codomain_from_kernel - sage: E = EllipticCurve(GF(7), [1,0,1,0,1]) # needs sage.rings.finite_rings - sage: R. = GF(7)[] # needs sage.rings.finite_rings - sage: isogeny_codomain_from_kernel(E, [4,1]) # needs sage.rings.finite_rings + 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() # needs sage.rings.finite_rings + sage: (EllipticCurveIsogeny(E, [4,1]).codomain() ....: == isogeny_codomain_from_kernel(E, [4,1])) True - sage: isogeny_codomain_from_kernel(E, x^3 + x^2 + 4*x + 3) # needs sage.rings.finite_rings + 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) # needs sage.rings.finite_rings + 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 @@ -265,15 +267,16 @@ 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]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((1,2)) ) # needs sage.rings.finite_rings - sage: phi.codomain() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_codomain_formula - sage: v = phi._EllipticCurveIsogeny__v # needs sage.rings.finite_rings - sage: w = phi._EllipticCurveIsogeny__w # needs sage.rings.finite_rings - sage: compute_codomain_formula(E, v, w) == phi.codomain() # needs sage.rings.finite_rings + sage: v = phi._EllipticCurveIsogeny__v + sage: w = phi._EllipticCurveIsogeny__w + sage: compute_codomain_formula(E, v, w) == phi.codomain() True """ a1, a2, a3, a4, a6 = E.a_invariants() @@ -302,18 +305,19 @@ 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]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, [9,1]); phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_vw_kohel_even_deg1 - sage: a1,a2,a3,a4,a6 = E.a_invariants() # needs sage.rings.finite_rings - sage: x0 = -9 # needs sage.rings.finite_rings - sage: y0 = -(a1*x0 + a3)/2 # needs sage.rings.finite_rings - sage: compute_vw_kohel_even_deg1(x0, y0, a1, a2, a4) # needs sage.rings.finite_rings + 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) (18, 9) """ v = 3*x0**2 + 2*a2*x0 + a4 - a1*y0 @@ -340,18 +344,19 @@ 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]) # needs sage.rings.finite_rings - sage: R. = GF(19)[] # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, x^3 + 7*x^2 + 15*x + 12); phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_vw_kohel_even_deg3 - sage: b2,b4 = E.b2(), E.b4() # needs sage.rings.finite_rings - sage: s1, s2, s3 = -7, 15, -12 # needs sage.rings.finite_rings - sage: compute_vw_kohel_even_deg3(b2, b4, s1, s2, s3) # needs sage.rings.finite_rings + 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) (4, 7) """ temp1 = s1**2 - 2*s2 @@ -381,18 +386,19 @@ 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]) # needs sage.rings.finite_rings - sage: R. = GF(19)[] # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, x^3 + 14*x^2 + 3*x + 11); phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_vw_kohel_odd - sage: b2,b4,b6 = E.b2(), E.b4(), E.b6() # needs sage.rings.finite_rings - sage: s1,s2,s3 = -14,3,-11 # needs sage.rings.finite_rings - sage: compute_vw_kohel_odd(b2,b4,b6,s1,s2,s3,3) # needs sage.rings.finite_rings + 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) (7, 1) """ v = 6*(s1**2 - 2*s2) + b2*s1 + n*b4 @@ -418,27 +424,28 @@ def compute_codomain_kohel(E, kernel): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_codomain_kohel - sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, [9,1]) # needs sage.rings.finite_rings - sage: phi.codomain() == isogeny_codomain_from_kernel(E, [9,1]) # needs sage.rings.finite_rings + 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]) True - sage: compute_codomain_kohel(E, [9,1]) # needs sage.rings.finite_rings + 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)[] # needs sage.rings.finite_rings - sage: E = EllipticCurve(GF(19), [18,17,16,15,14]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, x^3 + 14*x^2 + 3*x + 11) # needs sage.rings.finite_rings - sage: phi.codomain() == isogeny_codomain_from_kernel(E, x^3 + 14*x^2 + 3*x + 11) # needs sage.rings.finite_rings + 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) True - sage: compute_codomain_kohel(E, x^3 + 14*x^2 + 3*x + 11) # needs sage.rings.finite_rings + 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]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, x^3 + 7*x^2 + 15*x + 12) # needs sage.rings.finite_rings - sage: isogeny_codomain_from_kernel(E, x^3 + 7*x^2 + 15*x + 12) == phi.codomain() # needs sage.rings.finite_rings + 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() True - sage: compute_codomain_kohel(E, x^3 + 7*x^2 + 15*x + 12) # needs sage.rings.finite_rings + 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 @@ -529,13 +536,14 @@ 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]) # needs sage.rings.finite_rings - sage: R. = GF(19)[] # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, x + 13) # needs sage.rings.finite_rings - sage: isogeny_codomain_from_kernel(E, x + 13) == phi.codomain() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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() True sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import two_torsion_part - sage: two_torsion_part(E, x + 13) # needs sage.rings.finite_rings + sage: two_torsion_part(E, x + 13) x + 13 """ x = psi.parent().gen() # NB psi is univariate but could be constant @@ -612,105 +620,110 @@ 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]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0)) ); phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 # needs sage.rings.finite_rings + sage: phi.degree() == 2 True - sage: phi.kernel_polynomial() # needs sage.rings.finite_rings + sage: phi.kernel_polynomial() x - sage: phi.rational_maps() # needs sage.rings.finite_rings + sage: phi.rational_maps() ((x^2 + 1)/x, (x^2*y - y)/x^2) - sage: phi == loads(dumps(phi)) # known bug # needs sage.rings.finite_rings + sage: phi == loads(dumps(phi)) # known bug True A more complicated example of a characteristic-2 field:: - sage: E = EllipticCurve(GF(2^4,'alpha'), [0,0,1,0,1]) # needs sage.rings.finite_rings - sage: P = E((1,1)) # needs sage.rings.finite_rings - sage: phi_v = EllipticCurveIsogeny(E, P); phi_v # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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() # needs sage.rings.finite_rings - sage: phi_ker_poly # needs sage.rings.finite_rings + sage: phi_ker_poly = phi_v.kernel_polynomial() + sage: phi_ker_poly x + 1 - sage: phi_k = EllipticCurveIsogeny(E, phi_ker_poly) # needs sage.rings.finite_rings - sage: phi_k == phi_v # needs sage.rings.finite_rings + sage: phi_k = EllipticCurveIsogeny(E, phi_ker_poly) + sage: phi_k == phi_v True - sage: phi_k.rational_maps() # needs sage.rings.finite_rings + sage: phi_k.rational_maps() ((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() # needs sage.rings.finite_rings + sage: phi_v.rational_maps() ((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 # needs sage.rings.finite_rings + sage: phi_k.degree() == phi_v.degree() == 3 True - sage: phi_k.is_separable() # needs sage.rings.finite_rings + sage: phi_k.is_separable() True - sage: phi_v(E(0)) # needs sage.rings.finite_rings + sage: phi_v(E(0)) (0 : 1 : 0) - sage: alpha = E.base_field().gen() # needs sage.rings.finite_rings - sage: Q = E((0, alpha*(alpha + 1))) # needs sage.rings.finite_rings - sage: phi_v(Q) # needs sage.rings.finite_rings + sage: alpha = E.base_field().gen() + sage: Q = E((0, alpha*(alpha + 1))) + sage: phi_v(Q) (1 : alpha^2 + alpha : 1) - sage: phi_v(P) == phi_k(P) # needs sage.rings.finite_rings + sage: phi_v(P) == phi_k(P) True - sage: phi_k(P) == phi_v.codomain()(0) # needs sage.rings.finite_rings + sage: phi_k(P) == phi_v.codomain()(0) True We can create an isogeny whose kernel equals the full 2-torsion:: - sage: E = EllipticCurve(GF((3,2)), [0,0,0,1,1]) # needs sage.rings.finite_rings - sage: ker_poly = E.division_polynomial(2) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, ker_poly); phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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)) # needs sage.rings.finite_rings - sage: phi(P1) # needs sage.rings.finite_rings + sage: P1,P2,P3 = filter(bool, E(0).division_points(2)) + sage: phi(P1) (0 : 1 : 0) - sage: phi(P2) # needs sage.rings.finite_rings + sage: phi(P2) (0 : 1 : 0) - sage: phi(P3) # needs sage.rings.finite_rings + sage: phi(P3) (0 : 1 : 0) - sage: phi.degree() # needs sage.rings.finite_rings + sage: phi.degree() 4 We can also create trivial isogenies with the trivial kernel:: - sage: E = EllipticCurve(GF(17), [11, 11, 4, 12, 10]) # needs sage.rings.finite_rings - sage: phi_v = EllipticCurveIsogeny(E, E(0)) # needs sage.rings.finite_rings - sage: phi_v.degree() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(17), [11, 11, 4, 12, 10]) + sage: phi_v = EllipticCurveIsogeny(E, E(0)) + sage: phi_v.degree() 1 - sage: phi_v.rational_maps() # needs sage.rings.finite_rings + sage: phi_v.rational_maps() (x, y) - sage: E == phi_v.codomain() # needs sage.rings.finite_rings + sage: E == phi_v.codomain() True - sage: P = E.random_point() # needs sage.rings.finite_rings - sage: phi_v(P) == P # needs sage.rings.finite_rings + sage: P = E.random_point() + sage: phi_v(P) == P True - sage: E = EllipticCurve(GF(31), [23, 1, 22, 7, 18]) # needs sage.rings.finite_rings - sage: phi_k = EllipticCurveIsogeny(E, [1]); phi_k # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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() # needs sage.rings.finite_rings + sage: phi_k.degree() 1 - sage: phi_k.rational_maps() # needs sage.rings.finite_rings + sage: phi_k.rational_maps() (x, y) - sage: phi_k.codomain() == E # needs sage.rings.finite_rings + sage: phi_k.codomain() == E True - sage: phi_k.kernel_polynomial() # needs sage.rings.finite_rings + sage: phi_k.kernel_polynomial() 1 - sage: P = E.random_point(); P == phi_k(P) # needs sage.rings.finite_rings + sage: P = E.random_point(); P == phi_k(P) True Vélu and Kohel also work in characteristic `0`:: @@ -844,16 +857,17 @@ class EllipticCurveIsogeny(EllipticCurveHom): Here an example of a construction of a endomorphisms with cyclic kernel on a CM-curve:: - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [1,0]) # needs sage.rings.number_field - sage: RK. = K[] # needs sage.rings.number_field - sage: f = X^2 - 2/5*i + 1/5 # needs sage.rings.number_field - sage: phi= E.isogeny(f) # needs sage.rings.number_field - sage: isom = phi.codomain().isomorphism_to(E) # needs sage.rings.number_field - sage: phi = isom * phi # needs sage.rings.number_field - sage: phi.codomain() == phi.domain() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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() True - sage: phi.rational_maps() # needs sage.rings.number_field + 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))) @@ -868,11 +882,12 @@ 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]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, [17, 1]) # needs sage.rings.finite_rings - sage: phi.domain() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(31), [1,0,0,1,2]) + sage: phi = EllipticCurveIsogeny(E, [17, 1]) + sage: phi.domain() Elliptic Curve defined by y^2 + x*y = x^3 + x + 2 over Finite Field of size 31 - sage: phi.codomain() # needs sage.rings.finite_rings + sage: phi.codomain() 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`):: @@ -1184,18 +1199,20 @@ def _call_(self, P): sage: phi(E((1,5))) # needs sage.rings.finite_rings (2 : 0 : 1) - sage: E = EllipticCurve(QQ, [0,0,0,3,0]) # needs sage.rings.finite_rings - sage: P = E((1,2)) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, [0,1]) # needs sage.rings.finite_rings - sage: phi(P) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(QQ, [0,0,0,3,0]) + sage: P = E((1,2)) + sage: phi = EllipticCurveIsogeny(E, [0,1]) + sage: phi(P) (4 : -4 : 1) - sage: phi(-P) # needs sage.rings.finite_rings + sage: phi(-P) (4 : 4 : 1) - sage: E = EllipticCurve(GF(17), [0,-1,0,-3,-1]) # needs sage.rings.finite_rings - sage: Q = E((16,0)) # needs sage.rings.finite_rings - sage: tau = E.isogeny([Q], E) # needs sage.rings.finite_rings - sage: tau(Q) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(17), [0,-1,0,-3,-1]) + sage: Q = E((16,0)) + sage: tau = E.isogeny([Q], E) + sage: tau(Q) (0 : 1 : 0) TESTS: @@ -1216,25 +1233,27 @@ def _call_(self, P): Call a composed isogeny (added for :trac:`16238`):: - sage: E = EllipticCurve(j=GF(7)(0)) # needs sage.rings.finite_rings - sage: phi = E.isogeny([E(0), E((0,1)), E((0,-1))]) # needs sage.rings.finite_rings - sage: phi(E.points()[0]) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(j=GF(7)(0)) + sage: phi = E.isogeny([E(0), E((0,1)), E((0,-1))]) + sage: phi(E.points()[0]) (0 : 1 : 0) - sage: phi2 = phi * phi # needs sage.rings.finite_rings - sage: phi2(E.points()[0]) # needs sage.rings.finite_rings + sage: phi2 = phi * phi + sage: phi2(E.points()[0]) (0 : 1 : 0) Coercion works fine with :meth:`_call_` (added for :trac:`16238`):: - sage: K. = NumberField(x^2 + 3) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [7,0]) # needs sage.rings.number_field - sage: E2 = EllipticCurve(K, [5,0]) # needs sage.rings.number_field - sage: phi = E.isogeny(E(0)) # needs sage.rings.number_field - sage: phi(E2(0)) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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)) (0 : 1 : 0) - sage: E2(20,90) # needs sage.rings.number_field + sage: E2(20,90) (20 : 90 : 1) - sage: phi(E2(20,90)) # needs sage.rings.number_field + sage: phi(E2(20,90)) Traceback (most recent call last): ... TypeError: (20 : 90 : 1) fails to convert into the map's domain @@ -1243,12 +1262,13 @@ def _call_(self, P): Check that copying the order over works:: - sage: E = EllipticCurve(GF(431), [1,0]) # needs sage.rings.finite_rings - sage: P, = E.gens() # needs sage.rings.finite_rings - sage: Q = 2^99*P; Q.order() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(431), [1,0]) + sage: P, = E.gens() + sage: Q = 2^99*P; Q.order() 27 - sage: phi = E.isogeny(3^99*P) # needs sage.rings.finite_rings - sage: phi(Q)._order # needs sage.rings.finite_rings + sage: phi = E.isogeny(3^99*P) + sage: phi(Q)._order 27 Test for :trac:`35983`:: @@ -1326,11 +1346,12 @@ def __getitem__(self, i): sage: phi[1] y - sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings - sage: phi[0] # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) + sage: phi = EllipticCurveIsogeny(E, E((0,0))) + sage: phi[0] (x^2 + 3)/x - sage: phi[1] # needs sage.rings.finite_rings + sage: phi[1] (x^2*y - 3*y)/x^2 """ return self.rational_maps()[i] @@ -1365,19 +1386,21 @@ def __neg__(self): The following examples inherently exercise this function:: - sage: E = EllipticCurve(j=GF(17)(0)) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((-1,0)) ) # needs sage.rings.finite_rings - sage: negphi = -phi # needs sage.rings.finite_rings - sage: phi(E((0,1))) + negphi(E((0,1))) == 0 # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 True - sage: E = EllipticCurve(j=GF(19)(1728)) # needs sage.rings.finite_rings - sage: R. = GF(19)[] # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, x) # needs sage.rings.finite_rings - sage: negphi = -phi # needs sage.rings.finite_rings - sage: phi(E((3,7))) + negphi(E((3,12))) == phi(2*E((3,7))) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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))) True - sage: negphi(E((18,6))) # needs sage.rings.finite_rings + sage: negphi(E((18,6))) (17 : 0 : 1) sage: R. = QQ[] @@ -1392,30 +1415,32 @@ def __neg__(self): sage: phi(P) + negphi(P) == 0 True - sage: E = EllipticCurve(GF(23), [0,0,0,1,0]) # needs sage.rings.finite_rings - sage: f = E.torsion_polynomial(3)/3 # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f, E) # needs sage.rings.finite_rings - sage: phi.rational_maps() == E.multiplication_by_m(3) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) False - sage: negphi = -phi # needs sage.rings.finite_rings - sage: negphi.rational_maps() == E.multiplication_by_m(3) # needs sage.rings.finite_rings + sage: negphi = -phi + sage: negphi.rational_maps() == E.multiplication_by_m(3) True - sage: E = EllipticCurve(GF(17), [-2, 3, -5, 7, -11]) # needs sage.rings.finite_rings - sage: R. = GF(17)[] # needs sage.rings.finite_rings - sage: f = x+6 # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f); phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(17), [-2, 3, -5, 7, -11]) + sage: R. = GF(17)[] + sage: f = x+6 + sage: phi = EllipticCurveIsogeny(E, f); 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() # needs sage.rings.finite_rings + sage: phi.rational_maps() ((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 # needs sage.rings.finite_rings - sage: negphi # needs sage.rings.finite_rings + 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() # needs sage.rings.finite_rings + sage: negphi.rational_maps() ((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)) @@ -1431,14 +1456,15 @@ def __neg__(self): sage: ymap1 == -ymap2 - E.a1()*xmap2 - E.a3() True - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0,0,0,1,0]) # needs sage.rings.number_field - sage: R. = K[] # needs sage.rings.number_field - sage: phi = EllipticCurveIsogeny(E, x - a) # needs sage.rings.number_field - sage: phi.rational_maps() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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() ((x^2 + (-a)*x - 2)/(x + (-a)), (x^2*y + (-2*a)*x*y + y)/(x^2 + (-2*a)*x - 1)) - sage: negphi = -phi # needs sage.rings.number_field - sage: negphi.rational_maps() # needs sage.rings.number_field + sage: negphi = -phi + sage: negphi.rational_maps() ((x^2 + (-a)*x - 2)/(x + (-a)), (-x^2*y + (2*a)*x*y - y)/(x^2 + (-2*a)*x - 1)) """ output = copy(self) @@ -1481,10 +1507,11 @@ def _latex_(self): sage: phi._latex_() '\\left( x , y \\right)' - sage: E = EllipticCurve(GF(17), [0,0,0,1,-1]) # needs sage.rings.finite_rings - sage: R. = GF(17)[] # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, X + 11) # needs sage.rings.finite_rings - sage: phi._latex_() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(17), [0,0,0,1,-1]) + sage: R. = GF(17)[] + sage: phi = EllipticCurveIsogeny(E, X + 11) + sage: phi._latex_() '\\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() @@ -1512,17 +1539,18 @@ def __clear_cached_values(self): sage: old_ratl_maps[1] == -phi.rational_maps()[1] True - sage: F = GF(127); R. = F[] # needs sage.rings.finite_rings - sage: E = EllipticCurve(j=F(1728)) # needs sage.rings.finite_rings - sage: f = x^5 + 43*x^4 + 97*x^3 + 81*x^2 + 42*x + 82 # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings - sage: old_ratl_maps = phi.rational_maps() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: phi._set_post_isomorphism(WeierstrassIsomorphism(phi.codomain(), # needs sage.rings.finite_rings + sage: phi._set_post_isomorphism(WeierstrassIsomorphism(phi.codomain(), ....: (-13,13,-13,13))) - sage: old_ratl_maps == phi.rational_maps() # needs sage.rings.finite_rings + sage: old_ratl_maps == phi.rational_maps() False - sage: phi._EllipticCurveIsogeny__clear_cached_values() # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__clear_cached_values() """ self.__ratl_maps = None self.__dual = None @@ -1537,17 +1565,18 @@ def __perform_inheritance_housekeeping(self): The following examples will implicitly exercise this function:: - sage: E = EllipticCurve(GF(43), [2,3,5,7,11]) # needs sage.rings.finite_rings - sage: R. = GF(43)[]; f = x + 42 # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__perform_inheritance_housekeeping() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: E2 = phi.codomain() # needs sage.rings.finite_rings - sage: post_isom = WeierstrassIsomorphism(E2, (41, 37, 31, 29)) # needs sage.rings.finite_rings - sage: phi._set_post_isomorphism(post_isom) # needs sage.rings.finite_rings - sage: E1pr = WeierstrassIsomorphism(E, (-1, 2, -3, 4)).codomain() # needs sage.rings.finite_rings - sage: pre_isom = E1pr.isomorphism_to(E) # needs sage.rings.finite_rings - sage: phi._set_pre_isomorphism(pre_isom) # needs sage.rings.finite_rings + 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) """ EllipticCurveHom.__init__(self, self._domain, self._codomain) @@ -1564,25 +1593,27 @@ def __init_algebraic_structs(self, E): The constructor calls this function itself, so the fields it sets are already defined:: - sage: phi._domain # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: phi._domain Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__base_field # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__base_field Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__poly_ring # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__poly_ring Univariate Polynomial Ring in x over Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__mpoly_ring # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__mpoly_ring Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Finite Field of size 17 Now, calling the initialization function does nothing more:: - sage: phi._EllipticCurveIsogeny__init_algebraic_structs(E) # needs sage.rings.finite_rings - sage: phi._domain # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_algebraic_structs(E) + sage: phi._domain Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__base_field # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__base_field Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__poly_ring # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__poly_ring Univariate Polynomial Ring in x over Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__mpoly_ring # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__mpoly_ring Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Finite Field of size 17 sage: E = EllipticCurve(QQ, [0,0,0,1,0]) @@ -1597,17 +1628,18 @@ def __init_algebraic_structs(self, E): sage: phi._EllipticCurveIsogeny__mpoly_ring Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Rational Field - sage: F = GF(19); R. = F[] # needs sage.rings.finite_rings - sage: E = EllipticCurve(j=GF(19)(0)) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, x) # needs sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__init_algebraic_structs(E) # needs sage.rings.finite_rings - sage: phi._domain # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 19 - sage: phi._EllipticCurveIsogeny__base_field # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__base_field Finite Field of size 19 - sage: phi._EllipticCurveIsogeny__poly_ring # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__poly_ring Univariate Polynomial Ring in x over Finite Field of size 19 - sage: phi._EllipticCurveIsogeny__mpoly_ring # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__mpoly_ring Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Finite Field of size 19 """ self._domain = E @@ -1627,17 +1659,19 @@ def __compute_codomain(self): These examples inherently exercise this function:: - sage: E = EllipticCurve(j=GF(7)(1728)) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings - sage: phi.codomain() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(j=GF(7)(1728)) + sage: phi = EllipticCurveIsogeny(E, E((0,0))) + sage: phi.codomain() Elliptic Curve defined by y^2 = x^3 + 3*x over Finite Field of size 7 - sage: phi._EllipticCurveIsogeny__compute_codomain() # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_codomain() - sage: R. = GF(7)[] # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, x) # needs sage.rings.finite_rings - sage: phi.codomain() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(7)[] + sage: phi = EllipticCurveIsogeny(E, x) + sage: phi.codomain() Elliptic Curve defined by y^2 = x^3 + 3*x over Finite Field of size 7 - sage: phi._EllipticCurveIsogeny__compute_codomain() # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_codomain() """ if self.__algorithm == 'velu': self._codomain = self.__compute_codomain_via_velu() @@ -1734,16 +1768,17 @@ def __set_pre_isomorphism(self, domain, isomorphism): EXAMPLES:: - sage: E = EllipticCurve(GF(43), [2,3,5,7,11]) # needs sage.rings.finite_rings - sage: R. = GF(43)[]; f = x + 42 # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__perform_inheritance_housekeeping() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: E1pr = WeierstrassIsomorphism(E, (-1, 2, -3, 4)).codomain() # needs sage.rings.finite_rings - sage: pre_isom = E1pr.isomorphism_to(E) # needs sage.rings.finite_rings - sage: phi._set_pre_isomorphism(pre_isom) # needs sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__set_pre_isomorphism(E, WeierstrassIsomorphism(E, (-1, 3, -3, 4))) # needs sage.rings.finite_rings - sage: E == phi.domain() # needs sage.rings.finite_rings + 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() True """ self._domain = domain @@ -1778,14 +1813,15 @@ def __set_post_isomorphism(self, codomain, isomorphism): The following examples inherently exercise this function:: - sage: E = EllipticCurve(j=GF(7)(1728)) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(j=GF(7)(1728)) + sage: phi = EllipticCurveIsogeny(E, E((0,0))) sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: E2 = phi.codomain() # needs sage.rings.finite_rings - sage: isom = WeierstrassIsomorphism(E2, (-1,2,-3,4)) # needs sage.rings.finite_rings - sage: phi._set_post_isomorphism(isom) # needs sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__set_post_isomorphism(E2, WeierstrassIsomorphism(phi.codomain(), (1,-2,3,-4))) # needs sage.rings.finite_rings - sage: E2 == phi.codomain() # needs sage.rings.finite_rings + 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() True """ self._codomain = codomain @@ -1814,15 +1850,16 @@ def __setup_post_isomorphism(self, codomain, model): The following examples inherently exercise this function:: - sage: E = EllipticCurve(j=GF(7)(1728)) # needs sage.rings.finite_rings - sage: E2 = EllipticCurve(GF(7), [0,0,0,5,0]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0)), E2); phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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]) # needs sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__setup_post_isomorphism(E3, None) # needs sage.rings.finite_rings - sage: phi # needs sage.rings.finite_rings + 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 @@ -1897,11 +1934,12 @@ def __init_from_kernel_list(self, kernel_gens): 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 # needs sage.rings.finite_rings - sage: F = FiniteField(p, proof=False) # needs sage.rings.finite_rings - sage: E = EllipticCurve([F(1), F(0)]) # needs sage.rings.finite_rings - sage: P = E(0).division_points(3)[1] # needs sage.rings.finite_rings - sage: EllipticCurveIsogeny(E, P) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 @@ -1948,13 +1986,14 @@ def __sort_kernel_list(self): The following example inherently exercises this function:: - sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # needs sage.rings.finite_rings - sage: P = E((4,2)) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, P); phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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() # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__sort_kernel_list() """ a1, a2, a3, a4, _ = self._domain.a_invariants() @@ -2000,12 +2039,13 @@ def __compute_codomain_via_velu(self): The following example inherently exercises this function:: - sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # needs sage.rings.finite_rings - sage: P = E((4,2)) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, P) # needs sage.rings.finite_rings - sage: phi.codomain() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) + sage: P = E((4,2)) + sage: phi = EllipticCurveIsogeny(E, P) + sage: phi.codomain() Elliptic Curve defined by y^2 = x^3 + 2*x over Finite Field of size 7 - sage: phi._EllipticCurveIsogeny__compute_codomain_via_velu() # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_codomain_via_velu() 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) @@ -2020,22 +2060,24 @@ 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]) # needs sage.rings.finite_rings - sage: P = E((4,2)) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, P) # needs sage.rings.finite_rings - sage: Q = E((0,0)); phi(Q) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) (0 : 0 : 1) - sage: phi.rational_maps() # needs sage.rings.finite_rings + sage: phi.rational_maps() ((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) # needs sage.rings.finite_rings - sage: E = EllipticCurve(F, [0,0,0,1,0]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0)) ) # needs sage.rings.finite_rings - sage: Qvals = phi._EllipticCurveIsogeny__kernel_mod_sign[0] # needs sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__velu_sum_helper(0, Qvals, 0, 0, F(5), F(5)) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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)) (3, 3) - sage: R. = GF(7)[] # needs sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__velu_sum_helper(0, Qvals, 0, 0, x, y) # needs sage.rings.finite_rings + sage: R. = GF(7)[] + sage: phi._EllipticCurveIsogeny__velu_sum_helper(0, Qvals, 0, 0, x, y) (1/x, y/x^2) """ yQ, gxQ, gyQ, vQ, uQ = Qvalues @@ -2068,17 +2110,18 @@ def __compute_via_velu_numeric(self, xP, yP): The following example inherently exercises this function:: - sage: F = GF(7) # needs sage.rings.finite_rings - sage: E = EllipticCurve(F, [0,0,0,-1,0]) # needs sage.rings.finite_rings - sage: P = E((4,2)) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, P) # needs sage.rings.finite_rings - sage: Q = E((0,0)); phi(Q) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) (0 : 0 : 1) - sage: Q = E((-1,0)); phi(Q) # needs sage.rings.finite_rings + sage: Q = E((-1,0)); phi(Q) (0 : 0 : 1) - sage: phi._EllipticCurveIsogeny__compute_via_velu_numeric(F(0), F(0)) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_via_velu_numeric(F(0), F(0)) (0, 0) - sage: phi._EllipticCurveIsogeny__compute_via_velu_numeric(F(-1), F(0)) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_via_velu_numeric(F(-1), F(0)) (0, 0) """ # first check if the point is in the kernel @@ -2095,18 +2138,19 @@ def __compute_via_velu(self, xP, yP): The following example inherently exercises this function:: - sage: F = GF(7) # needs sage.rings.finite_rings - sage: E = EllipticCurve(F, [0,0,0,-1,0]) # needs sage.rings.finite_rings - sage: P = E((4,2)) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, P) # needs sage.rings.finite_rings - sage: Q = E((0,0)); phi(Q) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) (0 : 0 : 1) - sage: phi.rational_maps() # needs sage.rings.finite_rings + sage: phi.rational_maps() ((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)) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_via_velu(F(0), F(0)) (0, 0) - sage: R. = GF(7)[] # needs sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__compute_via_velu(x, y) # needs sage.rings.finite_rings + sage: R. = GF(7)[] + sage: phi._EllipticCurveIsogeny__compute_via_velu(x, y) ((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)) @@ -2114,24 +2158,26 @@ def __compute_via_velu(self, xP, yP): Check for :trac:`33214`:: - sage: z2 = GF(71^2).gen() # needs sage.rings.finite_rings - sage: E = EllipticCurve(GF(71^2), [5,5]) # needs sage.rings.finite_rings - sage: phi = E.isogeny(E.lift_x(0)) # needs sage.rings.finite_rings - sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism # needs sage.rings.finite_rings - sage: pre = WeierstrassIsomorphism(None, (z2,7,8,9), E) # needs sage.rings.finite_rings - sage: phi = phi * pre # needs sage.rings.finite_rings - sage: P = phi.domain()(1, 46*z2+49) # needs sage.rings.finite_rings - sage: phi(P) # indirect doctest # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 (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 # needs sage.rings.finite_rings - sage: R. = GF(71^2)[] # needs sage.rings.finite_rings - sage: E0, E2 = phi.domain(), phi.codomain() # needs sage.rings.finite_rings - sage: eqs = [EE.defining_polynomial()(x,y,1) for EE in (E0,E2)] # needs sage.rings.finite_rings - sage: eqs[1](fx,fy).numerator() % eqs[0] # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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] 0 """ if self.__pre_isomorphism is None: @@ -2161,12 +2207,13 @@ def __initialize_rational_maps_via_velu(self): The following example inherently exercises this function:: - sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # needs sage.rings.finite_rings - sage: P = E((4,2)) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, P) # needs sage.rings.finite_rings - sage: phi.rational_maps() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) + sage: P = E((4,2)) + sage: phi = EllipticCurveIsogeny(E, P) + sage: phi.rational_maps() ((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() # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__initialize_rational_maps_via_velu() ((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() @@ -2182,10 +2229,11 @@ def __init_kernel_polynomial_velu(self): The following example inherently exercises this function:: - sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # needs sage.rings.finite_rings - sage: P = E((4,2)) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, P) # needs sage.rings.finite_rings - sage: phi.kernel_polynomial() # implicit doctest # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 x^2 + 2*x + 4 """ poly_ring, x = self.__poly_ring.objgen() @@ -2339,16 +2387,17 @@ def __init_even_kernel_polynomial(self, E, psi_G): sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) # needs sage.rings.finite_rings (x^3 + x, (x^3 + x)*y + x^2, 1, 0, 1, 2) - sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # needs sage.rings.finite_rings - sage: R. = GF(7)[] # needs sage.rings.finite_rings - sage: f = x^3 + 6*x^2 + 1 # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f); phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) # needs sage.rings.finite_rings - sage: psig = two_torsion_part(E,f) # needs sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) # needs sage.rings.finite_rings + sage: psig = two_torsion_part(E,f) + sage: psig = two_torsion_part(E,f) + sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) (x^7 + 5*x^6 + 2*x^5 + 6*x^4 + 3*x^3 + 5*x^2 + 6*x + 3, (x^9 + 4*x^8 + 2*x^7 + 4*x^3 + 2*x^2 + x + 6)*y, 1, 6, 3, 4) """ # check if the polynomial really divides the two_torsion_polynomial @@ -2444,11 +2493,12 @@ def __init_odd_kernel_polynomial(self, E, psi): sage: phi._EllipticCurveIsogeny__init_odd_kernel_polynomial(E, x+6) # needs sage.rings.finite_rings (x^3 + 5*x^2 + 3*x + 2, (x^3 + 4*x^2 + x)*y, 2, 6, 1, 3) - sage: F = GF(2^4, 'alpha'); R. = F[] # needs sage.rings.finite_rings - sage: alpha = F.gen() # needs sage.rings.finite_rings - sage: E = EllipticCurve(F, [1,1,F.gen(),F.gen()^2+1,1]) # needs sage.rings.finite_rings - sage: f = x + alpha^2 + 1 # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f); phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 @@ -2458,11 +2508,12 @@ def __init_odd_kernel_polynomial(self, E, psi): sage: phi._EllipticCurveIsogeny__init_odd_kernel_polynomial(E, f) # needs sage.rings.finite_rings (x^3 + (alpha^2 + 1)*x + alpha^3 + alpha^2 + alpha, (x^3 + (alpha^2 + 1)*x^2 + (alpha^2 + 1)*x + alpha)*y + (alpha^2 + alpha + 1)*x^2 + (alpha^2 + alpha)*x + alpha, alpha^2 + alpha + 1, alpha^3 + alpha^2 + alpha, 1, 3) - sage: E = EllipticCurve(j=-262537412640768000) # needs sage.rings.finite_rings - sage: f = E.isogenies_prime_degree()[0].kernel_polynomial() # needs sage.rings.finite_rings - sage: f.degree() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(j=-262537412640768000) + sage: f = E.isogenies_prime_degree()[0].kernel_polynomial() + sage: f.degree() 81 - sage: E.isogeny(kernel=f, check=False) # needs sage.rings.finite_rings + 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 @@ -2542,12 +2593,13 @@ def __compute_omega_fast(self, E, psi, psi_pr, phi, phi_pr): 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)[] # needs sage.rings.finite_rings - sage: psi = phi._EllipticCurveIsogeny__psi # needs sage.rings.finite_rings - sage: psi_pr = psi.derivative() # needs sage.rings.finite_rings - sage: fi = phi._EllipticCurveIsogeny__phi # needs sage.rings.finite_rings - sage: fi_pr = fi.derivative() # needs sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__compute_omega_fast(E, psi, psi_pr, fi, fi_pr) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) (x^3 + 4*x^2 + x)*y """ a1 = E.a1() @@ -2585,32 +2637,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[] # needs sage.rings.finite_rings - sage: alpha = F.gen() # needs sage.rings.finite_rings - sage: E = EllipticCurve(F, [1, 1, F.gen(), F.gen()^2+1, 1]) # needs sage.rings.finite_rings - sage: f = x + alpha^2 + 1 # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f); phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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[] # needs sage.rings.finite_rings - sage: psi = phi._EllipticCurveIsogeny__psi # needs sage.rings.finite_rings - sage: psi_pr = psi.derivative() # needs sage.rings.finite_rings - sage: fi = phi._EllipticCurveIsogeny__phi # needs sage.rings.finite_rings - sage: fi_pr = fi.derivative() # needs sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__compute_omega_general(E, psi, psi_pr, fi, fi_pr) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) (x^3 + (alpha^2 + 1)*x^2 + (alpha^2 + 1)*x + alpha)*y + (alpha^2 + alpha + 1)*x^2 + (alpha^2 + alpha)*x + alpha A bug fixed in :trac:`7907`:: - sage: F = GF(128,'a') # needs sage.rings.finite_rings - sage: a = F.gen() # needs sage.rings.finite_rings - sage: E = EllipticCurve([1,0,0,0,(a**6+a**4+a**2+a)]) # needs sage.rings.finite_rings - sage: x = polygen(F) # needs 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 # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) # needs sage.rings.finite_rings + 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 @@ -2667,16 +2722,17 @@ def __compute_via_kohel_numeric(self, xP, yP): These examples inherently exercise this private function:: - sage: R. = GF(7)[] # needs sage.rings.finite_rings - sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) # needs sage.rings.finite_rings - sage: P = E((0,1)); phi(P) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) (2 : 0 : 1) - sage: P = E((1,1)); phi(P) # needs sage.rings.finite_rings + sage: P = E((1,1)); phi(P) (0 : 1 : 0) - sage: phi._EllipticCurveIsogeny__compute_via_kohel_numeric(0, 1) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_via_kohel_numeric(0, 1) (2, 0) - sage: phi._EllipticCurveIsogeny__compute_via_kohel_numeric(1, 1) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_via_kohel_numeric(1, 1) () """ # first check if the point is in the kernel @@ -2693,17 +2749,18 @@ def __compute_via_kohel(self, xP, yP): These examples inherently exercise this private function:: - sage: R. = GF(7)[] # needs sage.rings.finite_rings - sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) # needs sage.rings.finite_rings - sage: P = E((0,1)); phi(P) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) (2 : 0 : 1) - sage: phi.rational_maps() # needs sage.rings.finite_rings + sage: phi.rational_maps() ((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) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_via_kohel(0,1) (2, 0) - sage: R. = GF(7)[] # needs sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__compute_via_kohel(x,y) # needs sage.rings.finite_rings + sage: R. = GF(7)[] + sage: phi._EllipticCurveIsogeny__compute_via_kohel(x,y) ((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) @@ -2722,12 +2779,13 @@ def __initialize_rational_maps_via_kohel(self): These examples inherently exercise this private function:: - sage: R. = GF(7)[] # needs sage.rings.finite_rings - sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) # needs sage.rings.finite_rings - sage: phi.rational_maps() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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() ((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() # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__initialize_rational_maps_via_kohel() ((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() @@ -2746,12 +2804,13 @@ def __compute_codomain_via_kohel(self): These examples inherently exercise this private function:: - sage: R. = GF(7)[] # needs sage.rings.finite_rings - sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) # needs sage.rings.finite_rings - sage: phi.codomain() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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() 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() # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_codomain_via_kohel() 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) @@ -2827,13 +2886,14 @@ def scaling_factor(self): EXAMPLES:: - sage: E = EllipticCurve(GF(257^2), [0,1]) # needs sage.rings.finite_rings - sage: phi = E.isogeny(E.lift_x(240)) # needs sage.rings.finite_rings - sage: phi.degree() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(257^2), [0,1]) + sage: phi = E.isogeny(E.lift_x(240)) + sage: phi.degree() 43 - sage: phi.scaling_factor() # needs sage.rings.finite_rings + sage: phi.scaling_factor() 1 - sage: phi.dual().scaling_factor() # needs sage.rings.finite_rings + sage: phi.dual().scaling_factor() 43 ALGORITHM: The "inner" isogeny is normalized by construction, @@ -2909,45 +2969,47 @@ def _set_pre_isomorphism(self, preWI): TESTS:: - sage: E = EllipticCurve(GF(31), [1,1,0,1,-1]) # needs sage.rings.finite_rings - sage: R. = GF(31)[] # needs sage.rings.finite_rings - sage: f = x^3 + 9*x^2 + x + 30 # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings - sage: Epr = E.short_weierstrass_model() # needs sage.rings.finite_rings - sage: isom = Epr.isomorphism_to(E) # needs sage.rings.finite_rings - sage: phi._set_pre_isomorphism(isom) # needs sage.rings.finite_rings - sage: phi.rational_maps() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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))) # needs sage.rings.finite_rings + sage: phi(Epr((0,22))) (13 : 21 : 1) - sage: phi(Epr((3,7))) # needs sage.rings.finite_rings + sage: phi(Epr((3,7))) (14 : 17 : 1) - sage: E = EllipticCurve(GF(29), [0,0,0,1,0]) # needs sage.rings.finite_rings - sage: R. = GF(29)[] # needs sage.rings.finite_rings - sage: f = x^2 + 5 # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings - sage: phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: inv_isom = WeierstrassIsomorphism(E, (1,-2,5,10)) # needs sage.rings.finite_rings - sage: Epr = inv_isom.codomain() # needs sage.rings.finite_rings - sage: isom = Epr.isomorphism_to(E) # needs sage.rings.finite_rings - sage: phi._set_pre_isomorphism(isom) # needs sage.rings.finite_rings - sage: phi # needs sage.rings.finite_rings + 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))) # needs sage.rings.finite_rings + sage: phi(Epr((12,1))) (26 : 0 : 1) - sage: phi(Epr((2,9))) # needs sage.rings.finite_rings + sage: phi(Epr((2,9))) (0 : 0 : 1) - sage: phi(Epr((21,12))) # needs sage.rings.finite_rings + sage: phi(Epr((21,12))) (3 : 0 : 1) - sage: phi.rational_maps()[0] # needs sage.rings.finite_rings + sage: phi.rational_maps()[0] (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') @@ -2997,26 +3059,28 @@ def _set_post_isomorphism(self, postWI): TESTS:: - sage: E = EllipticCurve(j=GF(31)(0)) # needs sage.rings.finite_rings - sage: R. = GF(31)[] # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, x+18) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(j=GF(31)(0)) + sage: R. = GF(31)[] + sage: phi = EllipticCurveIsogeny(E, x+18) sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: phi._set_post_isomorphism(WeierstrassIsomorphism(phi.codomain(), (6,8,10,12))) # needs sage.rings.finite_rings - sage: phi # needs sage.rings.finite_rings + 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)) # needs sage.rings.finite_rings - sage: f = E.torsion_polynomial(3)/3 # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings - sage: E2 = phi.codomain() # needs sage.rings.finite_rings - sage: post_isom = E2.isomorphism_to(E) # needs sage.rings.finite_rings - sage: phi._set_post_isomorphism(post_isom) # needs sage.rings.finite_rings - sage: phi.rational_maps() == E.multiplication_by_m(3) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) False - sage: phi = -phi # needs sage.rings.finite_rings - sage: phi.rational_maps() == E.multiplication_by_m(3) # needs sage.rings.finite_rings + sage: phi = -phi + sage: phi.rational_maps() == E.multiplication_by_m(3) True sage: R. = QQ[] @@ -3082,49 +3146,52 @@ def dual(self): sage: (Xm, Ym) == E.multiplication_by_m(5) True - sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) # needs sage.rings.finite_rings - sage: R. = GF(37)[] # needs sage.rings.finite_rings - sage: f = x^3 + x^2 + 28*x + 33 # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings - sage: phi_hat = phi.dual() # needs sage.rings.finite_rings - sage: phi_hat.codomain() == phi.domain() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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() True - sage: phi_hat.domain() == phi.codomain() # needs sage.rings.finite_rings + sage: phi_hat.domain() == phi.codomain() True - sage: (X, Y) = phi.rational_maps() # needs sage.rings.finite_rings - sage: (Xhat, Yhat) = phi_hat.rational_maps() # needs sage.rings.finite_rings - sage: Xm = Xhat.subs(x=X, y=Y) # needs sage.rings.finite_rings - sage: Ym = Yhat.subs(x=X, y=Y) # needs sage.rings.finite_rings - sage: (Xm, Ym) == E.multiplication_by_m(7) # needs sage.rings.finite_rings + 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) True - sage: E = EllipticCurve(GF(31), [0,0,0,1,8]) # needs sage.rings.finite_rings - sage: R. = GF(31)[] # needs sage.rings.finite_rings - sage: f = x^2 + 17*x + 29 # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings - sage: phi_hat = phi.dual() # needs sage.rings.finite_rings - sage: phi_hat.codomain() == phi.domain() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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() True - sage: phi_hat.domain() == phi.codomain() # needs sage.rings.finite_rings + sage: phi_hat.domain() == phi.codomain() True - sage: (X, Y) = phi.rational_maps() # needs sage.rings.finite_rings - sage: (Xhat, Yhat) = phi_hat.rational_maps() # needs sage.rings.finite_rings - sage: Xm = Xhat.subs(x=X, y=Y) # needs sage.rings.finite_rings - sage: Ym = Yhat.subs(x=X, y=Y) # needs sage.rings.finite_rings - sage: (Xm, Ym) == E.multiplication_by_m(5) # needs sage.rings.finite_rings + 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) True Inseparable duals should be computed correctly:: - sage: z2 = GF(71^2).gen() # needs sage.rings.finite_rings - sage: E = EllipticCurve(j=57*z2+51) # needs sage.rings.finite_rings - sage: E.isogeny(3*E.lift_x(0)).dual() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: z2 = GF(71^2).gen() + sage: E = EllipticCurve(j=57*z2+51) + sage: E.isogeny(3*E.lift_x(0)).dual() 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() # needs sage.rings.finite_rings + sage: E.isogeny(E.lift_x(0)).dual() 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 @@ -3133,12 +3200,13 @@ def dual(self): ...even if pre- or post-isomorphisms are present:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: phi = E.isogeny(E.lift_x(0)) # needs sage.rings.finite_rings - sage: pre = ~WeierstrassIsomorphism(phi.domain(), (z2,2,3,4)) # needs sage.rings.finite_rings - sage: post = WeierstrassIsomorphism(phi.codomain(), (5,6,7,8)) # needs sage.rings.finite_rings - sage: phi = post * phi * pre # needs sage.rings.finite_rings - sage: phi.dual() # needs sage.rings.finite_rings + 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() 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) @@ -3166,16 +3234,17 @@ def dual(self): sage: phi.dual().dual() == phi True - sage: k = GF(103) # needs sage.rings.finite_rings - sage: E = EllipticCurve(k,[11,11]) # needs sage.rings.finite_rings - sage: phi = E.isogeny(E(4,4)) # needs sage.rings.finite_rings - sage: phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: phi = WeierstrassIsomorphism(phi.codomain(),(5,0,1,2)) * phi # needs sage.rings.finite_rings - sage: phi.dual().dual() == phi # needs sage.rings.finite_rings + sage: phi = WeierstrassIsomorphism(phi.codomain(),(5,0,1,2)) * phi + sage: phi.dual().dual() == phi True sage: E = EllipticCurve(GF(103),[1,0,0,1,-1]) # needs sage.rings.finite_rings @@ -3187,13 +3256,14 @@ def dual(self): Check that :trac:`17293` is fixed:: - sage: k. = QuadraticField(2) # needs sage.rings.number_field - sage: E = EllipticCurve(k, [-3*s*(4 + 5*s), 2*s*(2 + 14*s + 11*s^2)]) # needs sage.rings.number_field - sage: phi = E.isogenies_prime_degree(3)[0] # needs sage.rings.number_field - sage: (-phi).dual() == -phi.dual() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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() True - sage: phi._EllipticCurveIsogeny__clear_cached_values() # forget the dual # needs sage.rings.number_field - sage: -phi.dual() == (-phi).dual() # needs sage.rings.number_field + sage: phi._EllipticCurveIsogeny__clear_cached_values() # forget the dual + sage: -phi.dual() == (-phi).dual() True """ if self.__base_field.characteristic() in (2, 3): @@ -3285,19 +3355,20 @@ def _composition_impl(left, right): EXAMPLES:: - sage: E = EllipticCurve(GF(127), [5,2]) # needs sage.rings.finite_rings - sage: phi = E.isogeny(E.lift_x(47)); E2 = phi.codomain() # needs sage.rings.finite_rings - sage: iso1 = E.change_weierstrass_model(1,1,1,1).isomorphism_to(E) # needs sage.rings.finite_rings - sage: iso2 = E2.isomorphism_to(E2.change_weierstrass_model(39,0,0,0)) # needs sage.rings.finite_rings - sage: phi * iso1 # indirect doctest # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 # needs sage.rings.finite_rings + 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 # needs sage.rings.finite_rings + 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 @@ -3362,22 +3433,24 @@ 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]) # needs sage.rings.finite_rings - sage: R. = GF(97)[]; f = x^5 + 27*x^4 + 61*x^3 + 58*x^2 + 28*x + 21 # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings - sage: E2 = phi.codomain() # needs sage.rings.finite_rings - sage: isom1, isom2, E1pr, E2pr, ker_poly = compute_sequence_of_maps(E, E2, 11) # needs sage.rings.finite_rings - sage: compute_isogeny_stark(E1pr, E2pr, 11) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) 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]) # needs sage.rings.finite_rings - sage: R. = GF(37)[] # needs sage.rings.finite_rings - sage: f = (x + 14) * (x + 30) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings - sage: E2 = phi.codomain() # needs sage.rings.finite_rings - sage: compute_isogeny_stark(E, E2, 5) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) x^4 + 14*x^3 + x^2 + 34*x + 21 - sage: f**2 # needs sage.rings.finite_rings + sage: f**2 x^4 + 14*x^3 + x^2 + 34*x + 21 sage: E = EllipticCurve(QQ, [0,0,0,1,0]) @@ -3458,12 +3531,13 @@ def split_kernel_polynomial(poly): Check that this behaves identically to ``.radical()``:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import split_kernel_polynomial - sage: q = next_prime(randrange(3,10^3)) # needs sage.rings.finite_rings - sage: e = randrange(1,5) # needs sage.rings.finite_rings - sage: R = GF(q^e,'a')['x'] # needs sage.rings.finite_rings - sage: f = R.random_element(randrange(10,100)).monic() # needs sage.rings.finite_rings - sage: split_kernel_polynomial(f) == f.radical() # needs sage.rings.finite_rings + 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() doctest:warning ... DeprecationWarning: ... True @@ -3503,14 +3577,15 @@ 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]) # needs sage.rings.finite_rings - sage: R. = GF(37)[] # needs sage.rings.finite_rings - sage: f = (x + 14) * (x + 30) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings - sage: E2 = phi.codomain() # needs sage.rings.finite_rings - sage: compute_isogeny_kernel_polynomial(E, E2, 5) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) x^2 + 7*x + 13 - sage: f # needs sage.rings.finite_rings + sage: f x^2 + 7*x + 13 sage: R. = QQ[] @@ -3524,19 +3599,20 @@ def compute_isogeny_kernel_polynomial(E1, E2, ell, algorithm="stark"): Check that :meth:`Polynomial.radical` is doing the right thing for us:: - sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) # needs sage.rings.finite_rings - sage: R. = GF(37)[] # needs sage.rings.finite_rings - sage: f = (x + 10) * (x + 12) * (x + 16) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings - sage: E2 = phi.codomain() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_isogeny_stark - sage: ker_poly = compute_isogeny_stark(E, E2, 7); ker_poly # needs sage.rings.finite_rings + sage: ker_poly = compute_isogeny_stark(E, E2, 7); ker_poly x^6 + 2*x^5 + 20*x^4 + 11*x^3 + 36*x^2 + 35*x + 16 - sage: ker_poly.factor() # needs sage.rings.finite_rings + sage: ker_poly.factor() (x + 10)^2 * (x + 12)^2 * (x + 16)^2 - sage: poly = ker_poly.radical(); poly # needs sage.rings.finite_rings + sage: poly = ker_poly.radical(); poly x^3 + x^2 + 28*x + 33 - sage: poly.factor() # needs sage.rings.finite_rings + sage: poly.factor() (x + 10) * (x + 12) * (x + 16) """ if algorithm == 'starks': @@ -3583,12 +3659,13 @@ def compute_intermediate_curves(E1, E2): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_intermediate_curves - sage: E = EllipticCurve(GF(83), [1,0,1,1,0]) # needs sage.rings.finite_rings - sage: R. = GF(83)[]; f = x + 24 # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings - sage: E2 = phi.codomain() # needs sage.rings.finite_rings - sage: compute_intermediate_curves(E, E2) # needs sage.rings.finite_rings + 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) (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: @@ -3695,10 +3772,11 @@ def compute_sequence_of_maps(E1, E2, ell): 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) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0,0,0,1,0]) # needs sage.rings.number_field - sage: E2 = EllipticCurve(K, [0,0,0,16,0]) # needs sage.rings.number_field - sage: compute_sequence_of_maps(E, E2, 4) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 Via: (u,r,s,t) = (1, 0, 0, 0), @@ -3711,11 +3789,12 @@ def compute_sequence_of_maps(E1, E2, ell): over Number Field in i with defining polynomial x^2 + 1, x^3 + x) - sage: E = EllipticCurve(GF(97), [1,0,1,1,0]) # needs sage.rings.finite_rings - sage: R. = GF(97)[]; f = x^5 + 27*x^4 + 61*x^3 + 58*x^2 + 28*x + 21 # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, f) # needs sage.rings.finite_rings - sage: E2 = phi.codomain() # needs sage.rings.finite_rings - sage: compute_sequence_of_maps(E, E2, 11) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) (Elliptic-curve morphism: From: Elliptic Curve defined by y^2 + x*y + y = x^3 + x over Finite Field of size 97 diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index 6d6d67a81db..588a4524bcb 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -98,52 +98,56 @@ def quadratic_twist(self, D=None): EXAMPLES:: - sage: E = EllipticCurve([GF(1103)(1), 0, 0, 107, 340]); E # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 # needs sage.rings.finite_rings + 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) # needs sage.rings.finite_rings + sage: E.is_isomorphic(F) False - sage: E.is_isomorphic(F, GF(1103^2,'a')) # needs sage.rings.finite_rings + sage: E.is_isomorphic(F, GF(1103^2,'a')) True A characteristic 2 example:: - sage: E = EllipticCurve(GF(2), [1,0,1,1,1]) # needs sage.rings.finite_rings - sage: E1 = E.quadratic_twist(1) # needs sage.rings.finite_rings - sage: E.is_isomorphic(E1) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(2), [1,0,1,1,1]) + sage: E1 = E.quadratic_twist(1) + sage: E.is_isomorphic(E1) False - sage: E.is_isomorphic(E1, GF(4,'a')) # needs sage.rings.finite_rings + sage: E.is_isomorphic(E1, GF(4,'a')) True Over finite fields, the twisting parameter may be omitted:: - sage: k. = GF(2^10) # needs sage.rings.finite_rings - sage: E = EllipticCurve(k, [a^2,a,1,a+1,1]) # needs sage.rings.finite_rings - sage: Et = E.quadratic_twist() # needs sage.rings.finite_rings - sage: Et # random (only determined up to isomorphism) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) # needs sage.rings.finite_rings + sage: E.is_isomorphic(Et) False - sage: E.j_invariant() == Et.j_invariant() # needs sage.rings.finite_rings + sage: E.j_invariant() == Et.j_invariant() True - sage: p = next_prime(10^10) # needs sage.rings.finite_rings - sage: k = GF(p) # needs sage.rings.finite_rings - sage: E = EllipticCurve(k, [1,2,3,4,5]) # needs sage.rings.finite_rings - sage: Et = E.quadratic_twist() # needs sage.rings.finite_rings - sage: Et # random (only determined up to isomorphism) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) # needs sage.rings.finite_rings + sage: E.is_isomorphic(Et) False - sage: k2 = GF(p^2,'a') # needs sage.rings.finite_rings - sage: E.change_ring(k2).is_isomorphic(Et.change_ring(k2)) # needs sage.rings.finite_rings + sage: k2 = GF(p^2,'a') + sage: E.change_ring(k2).is_isomorphic(Et.change_ring(k2)) True """ K = self.base_ring() @@ -249,15 +253,16 @@ def quartic_twist(self, D): EXAMPLES:: - sage: E = EllipticCurve_from_j(GF(13)(1728)); E # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve_from_j(GF(13)(1728)); E Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 13 - sage: E1 = E.quartic_twist(2); E1 # needs sage.rings.finite_rings + sage: E1 = E.quartic_twist(2); E1 Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 13 - sage: E.is_isomorphic(E1) # needs sage.rings.finite_rings + sage: E.is_isomorphic(E1) False - sage: E.is_isomorphic(E1, GF(13^2,'a')) # needs sage.rings.finite_rings + sage: E.is_isomorphic(E1, GF(13^2,'a')) False - sage: E.is_isomorphic(E1, GF(13^4,'a')) # needs sage.rings.finite_rings + sage: E.is_isomorphic(E1, GF(13^4,'a')) True """ K = self.base_ring() @@ -292,17 +297,18 @@ def sextic_twist(self, D): EXAMPLES:: - sage: E = EllipticCurve_from_j(GF(13)(0)); E # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve_from_j(GF(13)(0)); E Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 13 - sage: E1 = E.sextic_twist(2); E1 # needs sage.rings.finite_rings + sage: E1 = E.sextic_twist(2); E1 Elliptic Curve defined by y^2 = x^3 + 11 over Finite Field of size 13 - sage: E.is_isomorphic(E1) # needs sage.rings.finite_rings + sage: E.is_isomorphic(E1) False - sage: E.is_isomorphic(E1, GF(13^2,'a')) # needs sage.rings.finite_rings + sage: E.is_isomorphic(E1, GF(13^2,'a')) False - sage: E.is_isomorphic(E1, GF(13^4,'a')) # needs sage.rings.finite_rings + sage: E.is_isomorphic(E1, GF(13^4,'a')) False - sage: E.is_isomorphic(E1, GF(13^6,'a')) # needs sage.rings.finite_rings + sage: E.is_isomorphic(E1, GF(13^6,'a')) True """ K = self.base_ring() @@ -377,40 +383,43 @@ def is_quadratic_twist(self, other): :: - sage: F = GF(101) # needs sage.rings.finite_rings - sage: E1 = EllipticCurve(F, [4,7]) # needs sage.rings.finite_rings - sage: E2 = E1.quadratic_twist() # needs sage.rings.finite_rings - sage: D = E1.is_quadratic_twist(E2); D != 0 # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(101) + sage: E1 = EllipticCurve(F, [4,7]) + sage: E2 = E1.quadratic_twist() + sage: D = E1.is_quadratic_twist(E2); D != 0 True - sage: F = GF(101) # needs sage.rings.finite_rings - sage: E1 = EllipticCurve(F, [4,7]) # needs sage.rings.finite_rings - sage: E2 = E1.quadratic_twist() # needs sage.rings.finite_rings - sage: D = E1.is_quadratic_twist(E2) # needs sage.rings.finite_rings - sage: E1.quadratic_twist(D).is_isomorphic(E2) # needs sage.rings.finite_rings + 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) True - sage: E1.is_isomorphic(E2) # needs sage.rings.finite_rings + sage: E1.is_isomorphic(E2) False - sage: F2 = GF(101^2,'a') # needs sage.rings.finite_rings - sage: E1.change_ring(F2).is_isomorphic(E2.change_ring(F2)) # needs sage.rings.finite_rings + sage: F2 = GF(101^2,'a') + sage: E1.change_ring(F2).is_isomorphic(E2.change_ring(F2)) True A characteristic 3 example:: - sage: F = GF(3^5,'a') # needs sage.rings.finite_rings - sage: E1 = EllipticCurve_from_j(F(1)) # needs sage.rings.finite_rings - sage: E2 = E1.quadratic_twist(-1) # needs sage.rings.finite_rings - sage: D = E1.is_quadratic_twist(E2); D != 0 # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 True - sage: E1.quadratic_twist(D).is_isomorphic(E2) # needs sage.rings.finite_rings + sage: E1.quadratic_twist(D).is_isomorphic(E2) True :: - sage: E1 = EllipticCurve_from_j(F(0)) # needs sage.rings.finite_rings - sage: E2 = E1.quadratic_twist() # needs sage.rings.finite_rings - sage: D = E1.is_quadratic_twist(E2); D # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E1 = EllipticCurve_from_j(F(0)) + sage: E2 = E1.quadratic_twist() + sage: D = E1.is_quadratic_twist(E2); D 1 - sage: E1.is_isomorphic(E2) # needs sage.rings.finite_rings + sage: E1.is_isomorphic(E2) True """ from sage.schemes.elliptic_curves.ell_generic import is_EllipticCurve @@ -496,11 +505,12 @@ def is_quartic_twist(self, other): EXAMPLES:: - sage: E = EllipticCurve_from_j(GF(13)(1728)) # needs sage.rings.finite_rings - sage: E1 = E.quartic_twist(2) # needs sage.rings.finite_rings - sage: D = E.is_quartic_twist(E1); D!=0 # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve_from_j(GF(13)(1728)) + sage: E1 = E.quartic_twist(2) + sage: D = E.is_quartic_twist(E1); D!=0 True - sage: E.quartic_twist(D).is_isomorphic(E1) # needs sage.rings.finite_rings + sage: E.quartic_twist(D).is_isomorphic(E1) True :: @@ -565,11 +575,12 @@ def is_sextic_twist(self, other): EXAMPLES:: - sage: E = EllipticCurve_from_j(GF(13)(0)) # needs sage.rings.finite_rings - sage: E1 = E.sextic_twist(2) # needs sage.rings.finite_rings - sage: D = E.is_sextic_twist(E1); D != 0 # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve_from_j(GF(13)(0)) + sage: E1 = E.sextic_twist(2) + sage: D = E.is_sextic_twist(E1); D != 0 True - sage: E.sextic_twist(D).is_isomorphic(E1) # needs sage.rings.finite_rings + sage: E.sextic_twist(D).is_isomorphic(E1) True :: @@ -663,15 +674,16 @@ def descend_to(self, K, f=None): :: - sage: L. = NumberField(x^4 - 7) # needs sage.rings.number_field - sage: K. = NumberField(x^2 - 7, embedding=a^2) # needs sage.rings.number_field - sage: E = EllipticCurve([a^6, 0]) # needs sage.rings.number_field - sage: EK = E.descend_to(K); EK # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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) # needs sage.rings.number_field + sage: all(Ei.change_ring(L).is_isomorphic(E) for Ei in EK) True :: @@ -685,11 +697,12 @@ def descend_to(self, K, f=None): Check that :trac:`16456` is fixed:: - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: E = EllipticCurve('11a1').quadratic_twist(2) # needs sage.rings.number_field - sage: EK = E.change_ring(K) # needs sage.rings.number_field - sage: EK2 = EK.change_weierstrass_model((a,a,a,a+1)) # needs sage.rings.number_field - sage: EK2.descend_to(QQ) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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) [Elliptic Curve defined by y^2 = x^3 + x^2 - 41*x - 199 over Rational Field] sage: k. = QuadraticField(-1) # needs sage.rings.number_field @@ -870,32 +883,34 @@ def division_field(self, l, names='t', map=False, **kwds): Some higher-degree examples:: - sage: E = EllipticCurve('11a1') # needs sage.rings.number_field - sage: K. = E.division_field(2); K # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 # needs sage.rings.number_field + sage: K. = E.division_field(3); K # long time Number Field in b with defining polynomial x^48 ... - sage: K. = E.division_field(5); K # needs sage.rings.number_field + sage: K. = E.division_field(5); K Number Field in b with defining polynomial x^4 - x^3 + x^2 - x + 1 - sage: E.division_field(5, 'b', simplify=False) # needs sage.rings.number_field + sage: E.division_field(5, 'b', simplify=False) 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 # needs sage.rings.number_field + sage: E.base_extend(K).torsion_subgroup() # 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 b with defining polynomial x^4 - x^3 + x^2 - x + 1 - sage: E = EllipticCurve('27a1') # needs sage.rings.number_field - sage: K. = E.division_field(3); K # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: E = EllipticCurve('27a1') + sage: K. = E.division_field(3); K Number Field in b with defining polynomial x^2 + 3*x + 9 - sage: K. = E.division_field(2); K # needs sage.rings.number_field + 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 # needs sage.rings.number_field + sage: K. = E.division_field(2, simplify_all=True); K 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 # needs sage.rings.number_field + sage: K. = E.division_field(5); K # long time Number Field in b with defining polynomial x^48 ... - sage: K. = E.division_field(7); K # long time # needs sage.rings.number_field + sage: K. = E.division_field(7); K # long time Number Field in b with defining polynomial x^72 ... Over a number field:: @@ -951,6 +966,7 @@ def division_field(self, l, names='t', map=False, **kwds): Some random testing:: + sage: # needs sage.rings.finite_rings sage: def check(E, l, K): ....: EE = E.change_ring(K) ....: cof = EE.order().prime_to_m_part(l) @@ -974,20 +990,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)) # needs sage.rings.finite_rings - sage: F. = GF(q) # needs sage.rings.finite_rings - sage: while True: # needs sage.rings.finite_rings + sage: q = next_prime_power(randrange(1, 10^9)) + sage: F. = GF(q) + sage: while True: ....: try: ....: E = EllipticCurve([F.random_element() for _ in range(5)]) ....: except ArithmeticError: ....: continue ....: break - sage: l = random_prime(8) # needs sage.rings.finite_rings - sage: K = E.division_field(l) # needs sage.rings.finite_rings - sage: n = E.cardinality(extension_degree=K.degree()//F.degree()) # needs sage.rings.finite_rings - sage: (l^2 if q%l else 0 + E.is_ordinary()).divides(n) # needs sage.rings.finite_rings + 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) True - sage: check(E, l, K) # long time # needs sage.rings.finite_rings + sage: check(E, l, K) # long time AUTHORS: @@ -1161,11 +1177,12 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al EXAMPLES:: - sage: F = GF(2^5, 'alpha'); alpha = F.gen() # needs sage.rings.finite_rings - sage: E = EllipticCurve(F, [1,0,1,1,1]) # needs sage.rings.finite_rings - sage: R. = F[] # needs sage.rings.finite_rings - sage: phi = E.isogeny(x + 1) # needs sage.rings.finite_rings - sage: phi.rational_maps() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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() ((x^2 + x + 1)/(x + 1), (x^2*y + x)/(x^2 + 1)) :: @@ -1181,15 +1198,16 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al :: - sage: E = EllipticCurve(GF(19),[1,1]) # needs sage.rings.finite_rings - sage: P = E(15,3); Q = E(2,12) # needs sage.rings.finite_rings - sage: (P.order(), Q.order()) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(19),[1,1]) + sage: P = E(15,3); Q = E(2,12) + sage: (P.order(), Q.order()) (7, 3) - sage: phi = E.isogeny([P,Q]); phi # needs sage.rings.finite_rings + 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 # needs sage.rings.finite_rings + sage: phi(E.random_point()) # all points defined over GF(19) are in the kernel (0 : 1 : 0) :: @@ -1238,10 +1256,11 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al We check that the cached order is correctly copied over:: - sage: E = EllipticCurve(GF(2^127-1), [1,2,3,4,5]) # needs sage.rings.finite_rings - sage: E.set_order(170141183460469231746191640949390434666) # needs sage.rings.finite_rings - sage: phi = E.isogeny(E.lift_x(77347718128277853096420969229987528666)) # needs sage.rings.finite_rings - sage: phi.codomain()._order # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 170141183460469231746191640949390434666 """ if algorithm is not None and degree is not None: @@ -1283,10 +1302,11 @@ def isogeny_codomain(self, kernel, degree=None): We check that the cached order is correctly copied over:: - sage: E = EllipticCurve(GF(2^127 - 1), [1,2,3,4,5]) # needs sage.rings.finite_rings - sage: E.set_order(170141183460469231746191640949390434666) # needs sage.rings.finite_rings - sage: E2 = E.isogeny_codomain(E.lift_x(77347718128277853096420969229987528666)) # needs sage.rings.finite_rings - sage: E2._order # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 170141183460469231746191640949390434666 Test deprecation warning for obsolete argument:: @@ -1336,8 +1356,9 @@ def isogenies_prime_degree(self, l=None, max_l=31): Examples over finite fields:: - sage: E = EllipticCurve(GF(next_prime(1000000)), [7,8]) # needs sage.rings.finite_rings - sage: E.isogenies_prime_degree(2) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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, @@ -1347,22 +1368,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) # needs sage.rings.finite_rings + sage: E.isogenies_prime_degree(3) [] - sage: E.isogenies_prime_degree(5) # needs sage.rings.finite_rings + sage: E.isogenies_prime_degree(5) [] - sage: E.isogenies_prime_degree(7) # needs sage.rings.finite_rings + sage: E.isogenies_prime_degree(7) [] - sage: E.isogenies_prime_degree(11) # needs sage.rings.finite_rings + sage: E.isogenies_prime_degree(11) [] - sage: E.isogenies_prime_degree(13) # needs sage.rings.finite_rings + 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] - sage: E.isogenies_prime_degree(max_l=13) # needs sage.rings.finite_rings + 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, @@ -1378,7 +1399,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 # needs sage.rings.finite_rings + 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, @@ -1421,16 +1442,17 @@ 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]) # needs sage.rings.finite_rings - sage: E.isogenies_prime_degree(max_l=3) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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] - sage: E = EllipticCurve(GF(13^6), [2,8]) # needs sage.rings.finite_rings - sage: E.isogenies_prime_degree(max_l=3) # needs sage.rings.finite_rings + 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, @@ -1456,19 +1478,20 @@ def isogenies_prime_degree(self, l=None, max_l=31): If the degree equals the characteristic, we find only separable isogenies:: - sage: E = EllipticCurve(GF(13), [2,8]) # needs sage.rings.finite_rings - sage: E.isogenies_prime_degree(13) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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] - sage: E = EllipticCurve(GF(5), [1,1]) # needs sage.rings.finite_rings - sage: E.isogenies_prime_degree(5) # needs sage.rings.finite_rings + 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] - sage: k. = GF(3^4) # needs sage.rings.finite_rings - sage: E = EllipticCurve(k, [0,1,0,0,a]) # needs sage.rings.finite_rings - sage: E.isogenies_prime_degree(3) # needs sage.rings.finite_rings + 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 @@ -1484,10 +1507,11 @@ def isogenies_prime_degree(self, l=None, max_l=31): An example over a rational function field:: - sage: R. = GF(5)[] # needs sage.rings.finite_rings - sage: K = R.fraction_field() # needs sage.rings.finite_rings - sage: E = EllipticCurve(K, [1, t^5]) # needs sage.rings.finite_rings - sage: E.isogenies_prime_degree(5) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(5)[] + 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 @@ -1721,18 +1745,19 @@ def hasse_invariant(self): Some examples over larger fields:: - sage: EllipticCurve(GF(101), [0,0,0,0,1]).hasse_invariant() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: EllipticCurve(GF(101), [0,0,0,0,1]).hasse_invariant() 0 - sage: EllipticCurve(GF(101), [0,0,0,1,1]).hasse_invariant() # needs sage.rings.finite_rings + sage: EllipticCurve(GF(101), [0,0,0,1,1]).hasse_invariant() 98 - sage: EllipticCurve(GF(103), [0,0,0,0,1]).hasse_invariant() # needs sage.rings.finite_rings + sage: EllipticCurve(GF(103), [0,0,0,0,1]).hasse_invariant() 20 - sage: EllipticCurve(GF(103), [0,0,0,1,1]).hasse_invariant() # needs sage.rings.finite_rings + sage: EllipticCurve(GF(103), [0,0,0,1,1]).hasse_invariant() 17 - sage: F. = GF(107^2) # needs sage.rings.finite_rings - sage: EllipticCurve(F, [0,0,0,a,1]).hasse_invariant() # needs sage.rings.finite_rings + sage: F. = GF(107^2) + sage: EllipticCurve(F, [0,0,0,a,1]).hasse_invariant() 62*a + 75 - sage: EllipticCurve(F, [0,0,0,0,a]).hasse_invariant() # needs sage.rings.finite_rings + sage: EllipticCurve(F, [0,0,0,0,a]).hasse_invariant() 0 Over fields of characteristic zero, the Hasse invariant is @@ -1809,24 +1834,25 @@ 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) # needs sage.rings.finite_rings - sage: G3 = E.isogeny_ell_graph(3, directed=False, label_by_j=True); G3 # needs sage.graphs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(419), j=1728) + sage: G3 = E.isogeny_ell_graph(3, directed=False, label_by_j=True); G3 # needs sage.graphs Graph on 27 vertices - sage: G3.vertices(sort=True) # needs sage.graphs sage.rings.finite_rings + sage: G3.vertices(sort=True) # needs sage.graphs ['0', '0*', ... '98*'] - sage: G3.edges(sort=True) # needs sage.graphs sage.rings.finite_rings + sage: G3.edges(sort=True) # needs sage.graphs [('0', '0*', None), ('0', '13', None), ... ('48*', '98*', None)] - sage: G5 = E.isogeny_ell_graph(5, directed=False, label_by_j=True); G5 # needs sage.graphs sage.rings.finite_rings + sage: G5 = E.isogeny_ell_graph(5, directed=False, label_by_j=True); G5 # needs sage.graphs Graph on 9 vertices - sage: G5.vertices(sort=True) # needs sage.graphs sage.rings.finite_rings + sage: G5.vertices(sort=True) # needs sage.graphs ['13', '13*', '407', '407*', '52', '62', '62*', '98', '98*'] - sage: G5.edges(sort=True) # needs sage.graphs sage.rings.finite_rings + sage: G5.edges(sort=True) # needs sage.graphs [('13', '52', None), ('13', '98', None), ... @@ -1834,30 +1860,31 @@ 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) # needs sage.rings.finite_rings - sage: E = EllipticCurve(K, j=0) # needs sage.rings.finite_rings - sage: E.is_supersingular() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(431^2, "i", x^2 + 1) + sage: E = EllipticCurve(K, j=0) + sage: E.is_supersingular() True - sage: G = E.isogeny_ell_graph(2, directed=True, label_by_j=True); G # needs sage.graphs sage.rings.finite_rings + sage: G = E.isogeny_ell_graph(2, directed=True, label_by_j=True); G # needs sage.graphs Looped multi-digraph on 37 vertices - sage: G.vertices(sort=True) # needs sage.graphs sage.rings.finite_rings + sage: G.vertices(sort=True) # needs sage.graphs ['0', '102', ... '87*i + 190'] - sage: G.edges(sort=True) # needs sage.graphs sage.rings.finite_rings + sage: G.edges(sort=True) # needs sage.graphs [('0', '125', None), ('0', '125', None), ... '81*i + 65', None)] - sage: H = E.isogeny_ell_graph(2, directed=False, label_by_j=True); H # needs sage.graphs sage.rings.finite_rings + sage: H = E.isogeny_ell_graph(2, directed=False, label_by_j=True); H # needs sage.graphs Looped multi-graph on 37 vertices - sage: H.vertices(sort=True) # needs sage.graphs sage.rings.finite_rings + sage: H.vertices(sort=True) # needs sage.graphs ['0', '102', ... '87*i + 190'] - sage: H.edges(sort=True) # needs sage.graphs sage.rings.finite_rings + sage: H.edges(sort=True) # needs sage.graphs [('0', '125', None), ('102', '125', None), ... @@ -1865,27 +1892,28 @@ 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) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [1, 0, 1, 4, -6]) # needs sage.rings.number_field - sage: G2 = E.isogeny_ell_graph(2, directed=False) # needs sage.graphs sage.rings.number_field - sage: G2.vertices(sort=True) # needs sage.graphs sage.rings.number_field + sage: # needs sage.rings.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) # needs sage.graphs + sage: G2.vertices(sort=True) # needs sage.graphs ['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) # needs sage.graphs sage.rings.number_field + sage: G2.edges(sort=True) # needs sage.graphs [('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) # needs sage.graphs sage.rings.number_field - sage: G3.vertices(sort=True) # needs sage.graphs sage.rings.number_field + sage: G3 = E.isogeny_ell_graph(3, directed=False) # needs sage.graphs + sage: G3.vertices(sort=True) # needs sage.graphs ['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) # needs sage.graphs sage.rings.number_field + sage: G3.edges(sort=True) # needs sage.graphs [('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)', @@ -1893,21 +1921,22 @@ class of curves. If the j-invariant is not unique in the isogeny TESTS:: - sage: E = EllipticCurve(GF(11), j=0) # needs sage.rings.finite_rings - sage: G0 = E.isogeny_ell_graph(2, directed=False) # needs sage.graphs sage.rings.finite_rings - sage: G0.is_directed() # needs sage.graphs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(11), j=0) + sage: G0 = E.isogeny_ell_graph(2, directed=False) # needs sage.graphs + sage: G0.is_directed() # needs sage.graphs False - sage: G1 = E.isogeny_ell_graph(2, directed=True) # needs sage.graphs sage.rings.finite_rings - sage: G1.is_directed() # needs sage.graphs sage.rings.finite_rings + sage: G1 = E.isogeny_ell_graph(2, directed=True) # needs sage.graphs + sage: G1.is_directed() # needs sage.graphs True - sage: G2 = E.isogeny_ell_graph(2, label_by_j=False) # needs sage.graphs sage.rings.finite_rings - sage: G2.vertices(sort=True) # needs sage.graphs sage.rings.finite_rings + sage: G2 = E.isogeny_ell_graph(2, label_by_j=False) # needs sage.graphs + sage: G2.vertices(sort=True) # needs sage.graphs ['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) # needs sage.graphs sage.rings.finite_rings - sage: G3.vertices(sort=True) # needs sage.graphs sage.rings.finite_rings + sage: G3 = E.isogeny_ell_graph(2, label_by_j=True) # needs sage.graphs + sage: G3.vertices(sort=True) # needs sage.graphs ['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 529dc803ce7..d4e8f4b6a1d 100644 --- a/src/sage/schemes/elliptic_curves/ell_generic.py +++ b/src/sage/schemes/elliptic_curves/ell_generic.py @@ -381,27 +381,29 @@ 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 # needs sage.symbolic + sage: # needs sage.symbolic + sage: v = F.solve(y)[0].rhs(); v -1/2*sqrt(4*x^3 - 4*x^2 - 40*x - 79) - 1/2 - sage: v = v.function(x) # needs sage.symbolic - sage: v(3) # needs sage.symbolic + sage: v = v.function(x) + sage: v(3) -1/2*sqrt(-127) - 1/2 - sage: v(7) # needs sage.symbolic + sage: v(7) -1/2*sqrt(817) - 1/2 - sage: v(-7) # needs sage.symbolic + sage: v(-7) -1/2*sqrt(-1367) - 1/2 - sage: v(sqrt(2)) # needs sage.symbolic + sage: v(sqrt(2)) -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 # needs sage.symbolic + sage: # needs sage.symbolic + 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) # needs sage.symbolic - sage: P # needs sage.symbolic + sage: P = E2.point((3, v(3), 1), check=False) # the check=False option doesn't verify that y^2 = f(x) + sage: P (3 : -1/2*sqrt(-127) - 1/2 : 1) - sage: P + P # needs sage.symbolic + sage: P + P (-756/127 : 41143/32258*sqrt(-127) - 1/2 : 1) We can even throw in a transcendental:: @@ -1370,11 +1372,12 @@ 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)) # needs sage.rings.finite_rings - sage: E.cardinality() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(j=GF(7)(5)) + sage: E.cardinality() 10 - sage: EE = E.base_extend(GF(7^2)) # needs sage.rings.finite_rings - sage: EE._order # needs sage.rings.finite_rings + sage: EE = E.base_extend(GF(7^2)) + sage: EE._order 60 Changing to a smaller field should not cache orders:: @@ -1408,14 +1411,15 @@ def change_ring(self, R): EXAMPLES:: - sage: F2 = GF(5^2,'a'); a = F2.gen() # needs sage.rings.finite_rings - sage: F4 = GF(5^4,'b'); b = F4.gen() # needs sage.rings.finite_rings - sage: roots = a.charpoly().roots(ring=F4, multiplicities=False) # needs sage.rings.finite_rings - sage: h = F2.hom([roots[0]], F4) # needs sage.rings.finite_rings - sage: E = EllipticCurve(F2, [1,a]); E # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F2 = GF(5^2,'a'); a = F2.gen() + sage: F4 = GF(5^4,'b'); b = F4.gen() + sage: roots = a.charpoly().roots(ring=F4, multiplicities=False) + sage: h = F2.hom([roots[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) # needs sage.rings.finite_rings + 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 """ @@ -1660,12 +1664,13 @@ def division_polynomial_0(self, n, x=None): An example to illustrate the relationship with torsion points:: - sage: F = GF(11) # needs sage.rings.finite_rings - sage: E = EllipticCurve(F, [0, 2]); E # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(11) + sage: E = EllipticCurve(F, [0, 2]); E Elliptic Curve defined by y^2 = x^3 + 2 over Finite Field of size 11 - sage: f = E.division_polynomial_0(5); f # needs sage.rings.finite_rings + sage: f = E.division_polynomial_0(5); f 5*x^12 + x^9 + 8*x^6 + 4*x^3 + 7 - sage: f.factor() # needs sage.rings.finite_rings + 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) @@ -1673,10 +1678,11 @@ def division_polynomial_0(self, n, x=None): `E` are in `\GF{11^2}`, and therefore the `y`-coordinates are in `\GF{11^4}`:: - sage: K = GF(11^4, 'a') # needs sage.rings.finite_rings - sage: X = E.change_ring(K) # needs sage.rings.finite_rings - sage: f = X.division_polynomial_0(5) # needs sage.rings.finite_rings - sage: x_coords = f.roots(multiplicities=False); x_coords # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 [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, @@ -2096,11 +2102,12 @@ def _multiple_x_numerator(self, n, x=None): Check for :trac:`33156`:: - sage: E = EllipticCurve(GF(65537), [5,5]) # needs sage.rings.finite_rings - sage: R. = E.base_field()[] # needs sage.rings.finite_rings - sage: E._multiple_x_numerator(5, x=R.quotient(x^2).gen()) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(65537), [5,5]) + sage: R. = E.base_field()[] + sage: E._multiple_x_numerator(5, x=R.quotient(x^2).gen()) 10220*xbar + 42539 - sage: E._multiple_x_numerator(5) # needs sage.rings.finite_rings + sage: E._multiple_x_numerator(5) x^25 + 65037*x^23 + 55137*x^22 + ... + 813*x^2 + 10220*x + 42539 """ n = Integer(n).abs() @@ -2192,11 +2199,12 @@ def _multiple_x_denominator(self, n, x=None): Check for :trac:`33156`:: - sage: E = EllipticCurve(GF(65537), [5,5]) # needs sage.rings.finite_rings - sage: R. = E.base_field()[] # needs sage.rings.finite_rings - sage: E._multiple_x_denominator(5, x=R.quotient(x^2).gen()) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(65537), [5,5]) + sage: R. = E.base_field()[] + sage: E._multiple_x_denominator(5, x=R.quotient(x^2).gen()) 52039*xbar + 56726 - sage: E._multiple_x_denominator(5) # needs sage.rings.finite_rings + sage: E._multiple_x_denominator(5) 25*x^24 + 3100*x^22 + 19000*x^21 + ... + 24111*x^2 + 52039*x + 56726 """ n = Integer(n).abs() @@ -2315,14 +2323,15 @@ 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) # needs sage.rings.finite_rings - sage: a = GF(p)(1) # needs sage.rings.finite_rings - sage: b = GF(p)(1) # needs sage.rings.finite_rings - sage: E = EllipticCurve([a, b]) # needs sage.rings.finite_rings - sage: P = E.random_point() # needs sage.rings.finite_rings - sage: my_eval = lambda f,P: [fi(P[0],P[1]) for fi in f] # needs sage.rings.finite_rings - sage: f = E.multiplication_by_m(2) # needs sage.rings.finite_rings - sage: assert(E(eval(f,P)) == 2*P) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) """ # Coerce the input m to be an integer m = Integer(m) @@ -2501,15 +2510,16 @@ def frobenius_isogeny(self, n=1): EXAMPLES:: - sage: z3, = GF(13^3).gens() # needs sage.rings.finite_rings - sage: E = EllipticCurve([z3, z3^2]) # needs sage.rings.finite_rings - sage: E.frobenius_isogeny() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: z3, = GF(13^3).gens() + sage: E = EllipticCurve([z3, z3^2]) + sage: E.frobenius_isogeny() 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 - sage: E.frobenius_isogeny(3) # needs sage.rings.finite_rings + 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 @@ -2689,11 +2699,12 @@ def isomorphisms(self, other, field=None): We can also find isomorphisms defined over extension fields:: - sage: E = EllipticCurve(GF(7), [0,0,0,1,1]) # needs sage.rings.finite_rings - sage: F = EllipticCurve(GF(7), [0,0,0,1,-1]) # needs sage.rings.finite_rings - sage: E.isomorphisms(F) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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.isomorphisms(F, GF(49,'a')) # needs sage.rings.finite_rings + sage: E.isomorphisms(F, GF(49,'a')) [Elliptic-curve morphism: From: Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field in a of size 7^2 @@ -2832,17 +2843,18 @@ def short_weierstrass_model(self, complete_cube=True): More tests in characteristic 3:: - sage: E = EllipticCurve(GF(3), [0,2,1,2,1]) # needs sage.rings.finite_rings - sage: E.short_weierstrass_model() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(3), [0,2,1,2,1]) + sage: E.short_weierstrass_model() 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) # needs sage.rings.finite_rings + 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) # needs sage.rings.finite_rings + sage: E.short_weierstrass_model(complete_cube=False).is_isomorphic(E) True """ from . import constructor @@ -2977,8 +2989,9 @@ 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) # needs sage.rings.finite_rings - sage: f # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: C, f = E.montgomery_model(twisted=True, morphism=True) + sage: f Scheme morphism: From: Elliptic Curve defined by y^2 = x^3 + 10*x + 10 over Finite Field of size 257 @@ -2986,7 +2999,7 @@ def montgomery_model(self, twisted=False, morphism=False): 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 # needs sage.rings.finite_rings + sage: g = f.inverse(); g 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 @@ -2994,28 +3007,29 @@ def montgomery_model(self, twisted=False, morphism=False): 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) # needs sage.rings.finite_rings - sage: Q = C(17, 17) # needs sage.rings.finite_rings - sage: P + Q # this doesn't work... # needs sage.rings.finite_rings + sage: P = C(70, 8) + sage: Q = C(17, 17) + sage: P + Q # this doesn't work... Traceback (most recent call last): ... TypeError: unsupported operand parent(s) for +: ... - sage: f(g(P) + g(Q)) # ...but this does # needs sage.rings.finite_rings + sage: f(g(P) + g(Q)) # ...but this does (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) # needs sage.rings.finite_rings - sage: C_ = C.change_ring(F) # needs sage.rings.finite_rings - sage: g_ = g.change_ring(F) # needs sage.rings.finite_rings - sage: g_(P).order() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = GF(257^2) + sage: C_ = C.change_ring(F) + sage: g_ = g.change_ring(F) + sage: g_(P).order() 12 - sage: T = C_(-7 * z2 - 57, 31 * z2 - 52, 1) # needs sage.rings.finite_rings - sage: g_(T).order() # needs sage.rings.finite_rings + sage: T = C_(-7 * z2 - 57, 31 * z2 - 52, 1) + sage: g_(T).order() 12 - sage: g_(P).weil_pairing(g_(T), 12) # needs sage.rings.finite_rings + sage: g_(P).weil_pairing(g_(T), 12) 15*z2 + 204 Another alternative is to simply extend the base field enough @@ -3546,12 +3560,13 @@ def pari_curve(self): Over a `p`-adic field:: - sage: Qp = pAdicField(5, prec=3) # needs sage.libs.pari sage.rings.padics - sage: E = EllipticCurve(Qp, [3, 4]) # needs sage.libs.pari sage.rings.padics - sage: E.pari_curve() # needs sage.libs.pari sage.rings.padics + sage: # needs sage.libs.pari sage.rings.padics + 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() # needs sage.libs.pari sage.rings.padics + sage: E.j_invariant() 3*5^-1 + O(5) Over a number field:: diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py index 4e612fe6c66..ec1bc552a2c 100644 --- a/src/sage/schemes/elliptic_curves/ell_point.py +++ b/src/sage/schemes/elliptic_curves/ell_point.py @@ -32,36 +32,39 @@ An example over a number field:: - sage: K. = QuadraticField(-1) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [1,0,0,0,-1]) # needs sage.rings.number_field - sage: P = E(0,i); P # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(-1) + sage: E = EllipticCurve(K, [1,0,0,0,-1]) + sage: P = E(0,i); P (0 : i : 1) - sage: P.order() # needs sage.rings.number_field + sage: P.order() +Infinity - sage: 101*P - 100*P == P # needs sage.rings.number_field + sage: 101*P - 100*P == P True An example over a finite field:: - sage: K. = GF((101,3)) # needs sage.rings.finite_rings - sage: E = EllipticCurve(K, [1,0,0,0,-1]) # needs sage.rings.finite_rings - sage: P = E(40*a^2 + 69*a + 84 , 58*a^2 + 73*a + 45) # needs sage.rings.finite_rings - sage: P.order() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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() 1032210 - sage: E.cardinality() # needs sage.rings.finite_rings + sage: E.cardinality() 1032210 Arithmetic with a point over an extension of a finite field:: - sage: k. = GF((5,2)) # needs sage.rings.finite_rings - sage: E = EllipticCurve(k,[1,0]); E # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: k. = GF((5,2)) + sage: E = EllipticCurve(k,[1,0]); E 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]) # needs sage.rings.finite_rings - sage: 5*P # needs sage.rings.finite_rings + sage: P = E([a,2*a+4]) + sage: 5*P (2*a + 3 : 2*a : 1) - sage: P*5 # needs sage.rings.finite_rings + sage: P*5 (2*a + 3 : 2*a : 1) - sage: P + P + P + P + P # needs sage.rings.finite_rings + sage: P + P + P + P + P (2*a + 3 : 2*a : 1) :: @@ -414,12 +417,13 @@ def __pari__(self): Try the same over a finite field:: - sage: E = EllipticCurve(GF(11), [0,0,0,3,0]) # needs sage.rings.finite_rings - sage: O = E(0) # needs sage.rings.finite_rings - sage: P = E.point([1,2]) # needs sage.rings.finite_rings - sage: O.__pari__() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(11), [0,0,0,3,0]) + sage: O = E(0) + sage: P = E.point([1,2]) + sage: O.__pari__() [0] - sage: P.__pari__() # needs sage.rings.finite_rings + sage: P.__pari__() [Mod(1, 11), Mod(2, 11)] We no longer need to explicitly call ``pari(O)`` and ``pari(P)`` @@ -807,26 +811,28 @@ def is_divisible_by(self, m): A finite field example:: - sage: E = EllipticCurve(GF(101), [23,34]) # needs sage.rings.finite_rings - sage: E.cardinality().factor() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(101), [23,34]) + sage: E.cardinality().factor() 2 * 53 - sage: Set([T.order() for T in E.points()]) # needs sage.rings.finite_rings + sage: Set([T.order() for T in E.points()]) {1, 106, 2, 53} - sage: len([T for T in E.points() if T.is_divisible_by(2)]) # needs sage.rings.finite_rings + sage: len([T for T in E.points() if T.is_divisible_by(2)]) 53 - sage: len([T for T in E.points() if T.is_divisible_by(3)]) # needs sage.rings.finite_rings + sage: len([T for T in E.points() if T.is_divisible_by(3)]) 106 TESTS: This shows that the bug reported at :trac:`10076` is fixed:: - sage: K = QuadraticField(8,'a') # needs sage.rings.number_field - sage: E = EllipticCurve([K(0),0,0,-1,0]) # needs sage.rings.number_field - sage: P = E([-1,0]) # needs sage.rings.number_field - sage: P.is_divisible_by(2) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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) False - sage: P.division_points(2) # needs sage.rings.number_field + sage: P.division_points(2) [] Note that it is not sufficient to test that @@ -835,15 +841,16 @@ def is_divisible_by(self, m): sage: P.division_points(2, poly_only=True).roots() # needs sage.rings.number_field [(1/2*a - 1, 1), (-1/2*a - 1, 1)] - sage: tor = E.torsion_points(); len(tor) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: tor = E.torsion_points(); len(tor) 8 - sage: [T.order() for T in tor] # needs sage.rings.number_field + sage: [T.order() for T in tor] [2, 4, 4, 2, 1, 2, 4, 4] - sage: all(T.is_divisible_by(3) for T in tor) # needs sage.rings.number_field + sage: all(T.is_divisible_by(3) for T in tor) True - sage: sorted(T for T in tor if T.is_divisible_by(2)) # needs sage.rings.number_field + sage: sorted(T for T in tor if T.is_divisible_by(2)) [(0 : 1 : 0), (1 : 0 : 1)] - sage: sorted(Set([2*T for T in tor])) # needs sage.rings.number_field + sage: sorted(Set([2*T for T in tor])) [(0 : 1 : 0), (1 : 0 : 1)] """ # Coerce the input m to an integer @@ -938,12 +945,13 @@ 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)) # needs sage.rings.finite_rings - sage: E = EllipticCurve(k, [1,2+a,3,4*a,2]) # needs sage.rings.finite_rings - sage: P = E([3, 3*a+4]) # needs sage.rings.finite_rings - sage: factor(E.order()) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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()) 2 * 3^2 - sage: P.order() # needs sage.rings.finite_rings + sage: P.order() 9 We find the `1`-division points as a consistency check -- there @@ -991,12 +999,13 @@ def division_points(self, m, poly_only=False): Check that :trac:`24844` is fixed:: - sage: p = next_prime(1000000) # needs sage.rings.finite_rings - sage: E = EllipticCurve(GF(p), 123, 456) # needs sage.rings.finite_rings - sage: pts = E(0).division_points(3) # needs sage.rings.finite_rings - sage: P = pts[1]; P # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: p = next_prime(1000000) + sage: E = EllipticCurve(GF(p), 123, 456) + sage: pts = E(0).division_points(3) + sage: P = pts[1]; P (389063 : 124244 : 1) - sage: P._order # needs sage.rings.finite_rings + sage: P._order 3 When we successfully divide a point known to have infinite @@ -1216,10 +1225,11 @@ def set_order(self, value=None, *, multiple=None, check=True): :: - sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 # needs sage.rings.finite_rings - sage: G = E(5, 0) # needs sage.rings.finite_rings - sage: G.set_order(2) # needs sage.rings.finite_rings - sage: 2*G # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 + sage: G = E(5, 0) + sage: G.set_order(2) + sage: 2*G (0 : 1 : 0) sage: G = E(0, 6) # optional - sage.rings.finite_rings sage: G.set_order(multiple=12) # optional - sage.rings.finite_rings @@ -1272,13 +1282,14 @@ def set_order(self, value=None, *, multiple=None, check=True): It is an error to pass a ``value`` equal to `0`:: - sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 # needs sage.rings.finite_rings - sage: G = E.random_point() # needs sage.rings.finite_rings - sage: G.set_order(0) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 + sage: G = E.random_point() + sage: G.set_order(0) Traceback (most recent call last): ... ValueError: Value 0 illegal for point order - sage: G.set_order(1000) # needs sage.rings.finite_rings + sage: G.set_order(1000) Traceback (most recent call last): ... ValueError: Value 1000 illegal: outside max Hasse bound @@ -1297,10 +1308,11 @@ def set_order(self, value=None, *, multiple=None, check=True): However, ``set_order`` can be fooled. 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 # needs sage.rings.finite_rings - sage: G = E(5, 0) # G has order 2 # needs sage.rings.finite_rings - sage: G.set_order(8) # needs sage.rings.finite_rings - sage: G.order() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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() 8 TESTS: @@ -1376,22 +1388,23 @@ def _line_(self, R, Q): EXAMPLES:: - sage: F. = GF((2,5)) # needs sage.rings.finite_rings - sage: E = EllipticCurve(F,[0,0,1,1,1]) # needs sage.rings.finite_rings - sage: P = E(a^4 + 1, a^3) # needs sage.rings.finite_rings - sage: Q = E(a^4, a^4 + a^3) # needs sage.rings.finite_rings - sage: O = E(0) # needs sage.rings.finite_rings - sage: P._line_(P,-2*P) == 0 # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 True - sage: P._line_(Q,-(P+Q)) == 0 # needs sage.rings.finite_rings + sage: P._line_(Q,-(P+Q)) == 0 True - sage: O._line_(O,Q) == F(1) # needs sage.rings.finite_rings + sage: O._line_(O,Q) == F(1) True - sage: P._line_(O,Q) == a^4 - a^4 + 1 # needs sage.rings.finite_rings + sage: P._line_(O,Q) == a^4 - a^4 + 1 True - sage: P._line_(13*P,Q) == a^4 # needs sage.rings.finite_rings + sage: P._line_(13*P,Q) == a^4 True - sage: P._line_(P,Q) == a^4 + a^3 + a^2 + 1 # needs sage.rings.finite_rings + sage: P._line_(P,Q) == a^4 + a^3 + a^2 + 1 True See :trac:`7116`:: @@ -1454,32 +1467,34 @@ def _miller_(self, Q, n): EXAMPLES:: - sage: F. = GF((2,5)) # needs sage.rings.finite_rings - sage: E = EllipticCurve(F, [0,0,1,1,1]) # needs sage.rings.finite_rings - sage: P = E(a^4 + 1, a^3) # needs sage.rings.finite_rings - sage: Fx. = GF((2,(4*5))) # needs sage.rings.finite_rings - sage: Ex = EllipticCurve(Fx, [0,0,1,1,1]) # needs sage.rings.finite_rings - sage: phi = Hom(F,Fx)(F.gen().minpoly().roots(Fx)[0][0]) # needs sage.rings.finite_rings - sage: Px = Ex(phi(P.xy()[0]), phi(P.xy()[1])) # needs 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, # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 # needs sage.rings.finite_rings + sage: Px._miller_(Qx,41) == b^17 + b^13 + b^12 + b^9 + b^8 + b^6 + b^4 + 1 True - sage: Qx._miller_(Px,41) == b^13 + b^10 + b^8 + b^7 + b^6 + b^5 # needs sage.rings.finite_rings + sage: Qx._miller_(Px,41) == b^13 + b^10 + b^8 + b^7 + b^6 + b^5 True - sage: P._miller_(E(0),41) # needs sage.rings.finite_rings + sage: P._miller_(E(0),41) Traceback (most recent call last): ... ValueError: Q must be nonzero. An example of even order:: - sage: F. = GF((19,4)) # needs sage.rings.finite_rings - sage: E = EllipticCurve(F, [-1,0]) # needs sage.rings.finite_rings - sage: P = E(15*a^3 + 17*a^2 + 14*a + 13,16*a^3 + 7*a^2 + a + 18) # needs 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) # needs sage.rings.finite_rings - sage: x = P.weil_pairing(Q, 360) # needs sage.rings.finite_rings - sage: x^360 == F(1) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) True You can use the _miller_ function on linearly dependent @@ -1492,40 +1507,43 @@ def _miller_(self, Q, n): A small example of embedding degree 6:: - sage: q = 401; F = GF(q); a = 146; b = 400; k = 6 # needs sage.rings.finite_rings - sage: E = EllipticCurve([F(a), F(b)]) # needs sage.rings.finite_rings - sage: R. = F[] # needs sage.rings.finite_rings - sage: K. = GF(q^k, modulus=x^6 + 4*x^4 + 115*x^3 + 81*x^2 + 51*x + 3) # needs sage.rings.finite_rings - sage: EK = E.base_extend(K) # needs sage.rings.finite_rings - sage: P = E([F(338), F(227)]) # needs sage.rings.finite_rings - sage: Q_x = 333*a^5 + 391*a^4 + 160*a^3 + 335*a^2 + 71*a + 93 # needs sage.rings.finite_rings - sage: Q_y = 343*a^5 + 273*a^4 + 26*a^3 + 342*a^2 + 340*a + 210 # needs sage.rings.finite_rings - sage: Q = EK([Q_x, Q_y]) # needs sage.rings.finite_rings - sage: P._miller_(Q, 127) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: q = 401; F = GF(q); a = 146; b = 400; k = 6 + sage: E = EllipticCurve([F(a), F(b)]) + sage: R. = F[] + sage: 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) 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]) # needs sage.rings.finite_rings - sage: P = E(5, 1); Q = E(0, 3); I = E(0) # needs sage.rings.finite_rings - sage: I._miller_(P, 1) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve([GF(7)(0), 2]) + sage: P = E(5, 1); Q = E(0, 3); I = E(0) + sage: I._miller_(P, 1) 1 - sage: I._miller_(Q, 1) # needs sage.rings.finite_rings + sage: I._miller_(Q, 1) 1 A two-torsion example. In this case `f_{n,P}(Q) = x_Q - x_P`:: - sage: E = EllipticCurve([GF(7)(-1), 0]) # needs sage.rings.finite_rings - sage: P = E(0,0); Q = E(1, 0); # needs sage.rings.finite_rings - sage: P._miller_(P, 2) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve([GF(7)(-1), 0]) + sage: P = E(0,0); Q = E(1, 0); + sage: P._miller_(P, 2) 0 - sage: Q._miller_(Q, 2) # needs sage.rings.finite_rings + sage: Q._miller_(Q, 2) 0 - sage: P._miller_(Q, 2) # needs sage.rings.finite_rings + sage: P._miller_(Q, 2) 1 - sage: Q._miller_(P, 2) # needs sage.rings.finite_rings + sage: Q._miller_(P, 2) 6 A three-torsion example:: @@ -1635,21 +1653,22 @@ def weil_pairing(self, Q, n, algorithm=None): EXAMPLES:: - sage: F. = GF((2,5)) # needs sage.rings.finite_rings - sage: E = EllipticCurve(F, [0,0,1,1,1]) # needs sage.rings.finite_rings - sage: P = E(a^4 + 1, a^3) # needs sage.rings.finite_rings - sage: Fx. = GF((2, 4*5)) # needs sage.rings.finite_rings - sage: Ex = EllipticCurve(Fx, [0,0,1,1,1]) # needs sage.rings.finite_rings - sage: phi = Hom(F, Fx)(F.gen().minpoly().roots(Fx)[0][0]) # needs sage.rings.finite_rings - sage: Px = Ex(phi(P.xy()[0]), phi(P.xy()[1])) # needs sage.rings.finite_rings - sage: O = Ex(0) # needs 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, # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 # needs sage.rings.finite_rings + sage: Px.weil_pairing(Qx, 41) == b^19 + b^15 + b^9 + b^8 + b^6 + b^4 + b^3 + b^2 + 1 True - sage: Px.weil_pairing(17*Px, 41) == Fx(1) # needs sage.rings.finite_rings + sage: Px.weil_pairing(17*Px, 41) == Fx(1) True - sage: Px.weil_pairing(O, 41) == Fx(1) # needs sage.rings.finite_rings + sage: Px.weil_pairing(O, 41) == Fx(1) True An error is raised if either point is not `n`-torsion:: @@ -1661,35 +1680,38 @@ def weil_pairing(self, Q, n, algorithm=None): A larger example (see :trac:`4964`):: - sage: P, Q = EllipticCurve(GF((19,4),'a'), [-1,0]).gens() # needs sage.rings.finite_rings - sage: P.order(), Q.order() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: P, Q = EllipticCurve(GF((19,4),'a'), [-1,0]).gens() + sage: P.order(), Q.order() (360, 360) - sage: z = P.weil_pairing(Q, 360) # needs sage.rings.finite_rings - sage: z.multiplicative_order() # needs sage.rings.finite_rings + sage: z = P.weil_pairing(Q, 360) + sage: z.multiplicative_order() 360 An example over a number field:: - sage: E = EllipticCurve('11a1').change_ring(CyclotomicField(5)) # needs sage.rings.number_field - sage: P, Q = E.torsion_subgroup().gens() # needs sage.rings.number_field - sage: P, Q = (P.element(), Q.element()) # needs sage.rings.number_field - sage: (P.order(), Q.order()) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: E = EllipticCurve('11a1').change_ring(CyclotomicField(5)) + sage: P, Q = E.torsion_subgroup().gens() + sage: P, Q = (P.element(), Q.element()) + sage: (P.order(), Q.order()) (5, 5) - sage: P.weil_pairing(Q, 5) # needs sage.rings.number_field + sage: P.weil_pairing(Q, 5) zeta5^2 - sage: Q.weil_pairing(P, 5) # needs sage.rings.number_field + sage: Q.weil_pairing(P, 5) zeta5^3 TESTS: Check that the original Sage implementation still works:: - sage: GF(65537^2).inject_variables() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: GF(65537^2).inject_variables() Defining z2 - sage: E = EllipticCurve(GF(65537^2), [0,1]) # needs sage.rings.finite_rings - sage: P = E(22, 28891) # needs sage.rings.finite_rings - sage: Q = E(-93, 40438*z2 + 31573) # needs sage.rings.finite_rings - sage: P.weil_pairing(Q, 7282, algorithm='sage') # needs sage.rings.finite_rings + 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') 19937*z2 + 65384 Passing an unknown ``algorithm=`` argument should fail:: @@ -1831,64 +1853,68 @@ 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)) # needs sage.rings.finite_rings - sage: EK = E.base_extend(K); P = EK(P) # needs sage.rings.finite_rings - sage: Qx = 69*a^5 + 96*a^4 + 22*a^3 + 86*a^2 + 6*a + 35 # needs sage.rings.finite_rings - sage: Qy = 34*a^5 + 24*a^4 + 16*a^3 + 41*a^2 + 4*a + 40 # needs sage.rings.finite_rings - sage: Q = EK(Qx, Qy); # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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); Multiply by cofactor so Q has order n:: - sage: h = 551269674; Q = h*Q # needs sage.rings.finite_rings - sage: P = EK(P); P.tate_pairing(Q, n, k) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: h = 551269674; Q = h*Q + sage: P = EK(P); P.tate_pairing(Q, n, k) 24*a^5 + 34*a^4 + 3*a^3 + 69*a^2 + 86*a + 45 - sage: s = Integer(randrange(1,n)) # needs sage.rings.finite_rings - sage: ans1 = (s*P).tate_pairing(Q, n, k) # needs sage.rings.finite_rings - sage: ans2 = P.tate_pairing(s*Q, n, k) # needs sage.rings.finite_rings - sage: ans3 = P.tate_pairing(Q, n, k)^s # needs sage.rings.finite_rings - sage: ans1 == ans2 == ans3 # needs sage.rings.finite_rings + 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 True - sage: (ans1 != 1) and (ans1^n == 1) # needs sage.rings.finite_rings + sage: (ans1 != 1) and (ans1^n == 1) 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 # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: e = Integer((p^k-1)/n); e 62844857712 - sage: P.weil_pairing(Q, n)^e # needs sage.rings.finite_rings + sage: P.weil_pairing(Q, n)^e 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 # needs sage.rings.finite_rings + sage: P.tate_pairing(Q, n, k) == P._miller_(Q, n)^e True - sage: Q.tate_pairing(P, n, k) == Q._miller_(P, n)^e # needs sage.rings.finite_rings + sage: Q.tate_pairing(P, n, k) == Q._miller_(P, n)^e True - sage: P.tate_pairing(Q, n, k)/Q.tate_pairing(P, n, k) # needs sage.rings.finite_rings + sage: P.tate_pairing(Q, n, k)/Q.tate_pairing(P, n, k) 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)) # needs sage.rings.finite_rings - sage: E = EllipticCurve(F, [0,0,1,1,1]) # needs sage.rings.finite_rings - sage: P = E(a^4 + 1, a^3) # needs sage.rings.finite_rings - sage: Fx. = GF((2,4*5)) # needs sage.rings.finite_rings - sage: Ex = EllipticCurve(Fx,[0,0,1,1,1]) # needs sage.rings.finite_rings - sage: phi = Hom(F, Fx)(F.gen().minpoly().roots(Fx)[0][0]) # needs sage.rings.finite_rings - sage: Px = Ex(phi(P.xy()[0]), phi(P.xy()[1])) # needs 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, # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) # needs sage.rings.finite_rings + sage: Px.tate_pairing(Qx, n=41, k=4) 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 # needs sage.rings.finite_rings + sage: num = Px.tate_pairing(Qx, n=41, k=4, q=32); num 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 # needs sage.rings.finite_rings + sage: den = Qx.tate_pairing(Px, n=41, k=4, q=32); den 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 # needs sage.rings.finite_rings + sage: e = Integer((32^4-1)/41); e 25575 - sage: Px.weil_pairing(Qx, 41)^e == num/den # needs sage.rings.finite_rings + sage: Px.weil_pairing(Qx, 41)^e == num/den True .. NOTE:: @@ -2021,12 +2047,13 @@ def ate_pairing(self, Q, n, k, t, q=None): 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 # needs sage.rings.finite_rings - sage: N = gcd(T^k - 1, p^k - 1) # needs sage.rings.finite_rings - sage: s = Integer(N/n) # needs sage.rings.finite_rings - sage: L = Integer((T^k - 1)/N) # needs sage.rings.finite_rings - sage: M = (L*s*c.inverse_mod(n)).mod(n) # needs sage.rings.finite_rings - sage: P.ate_pairing(Q, n, k, t) == Q.tate_pairing(P, n, k)^M # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 True An example where we have to pass the base field size (and we again have @@ -2069,12 +2096,13 @@ def ate_pairing(self, Q, n, k, t, q=None): 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 # needs sage.rings.finite_rings - sage: F = GF(p); R. = F[] # needs sage.rings.finite_rings - sage: E = EllipticCurve(F, [A, B]); # needs sage.rings.finite_rings - sage: K. = GF((p,k), modulus=x^k+2); EK = E.base_extend(K) # needs sage.rings.finite_rings - sage: P = EK(13, 8); Q = EK(13, 21) # needs sage.rings.finite_rings - sage: P.ate_pairing(Q, n, k, t) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) Traceback (most recent call last): ... ValueError: Point (13 : 21 : 1) not in Ker(pi - q) @@ -2341,21 +2369,23 @@ def is_on_identity_component(self, embedding=None): An example over a field with two real embeddings:: - sage: L. = QuadraticField(2) # needs sage.rings.number_field - sage: E = EllipticCurve(L, [0,1,0,a,a]) # needs sage.rings.number_field - sage: P = E(-1,0) # needs sage.rings.number_field - sage: [P.is_on_identity_component(e) for e in L.embeddings(RR)] # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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)] [False, True] We can check this as follows:: - sage: [e(E.discriminant()) > 0 for e in L.embeddings(RR)] # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: [e(E.discriminant()) > 0 for e in L.embeddings(RR)] [True, False] - sage: e = L.embeddings(RR)[0] # needs sage.rings.number_field - sage: E1 = EllipticCurve(RR, [e(ai) for ai in E.ainvs()]) # needs sage.rings.number_field - sage: e1, e2, e3 = E1.two_division_polynomial().roots(RR, # needs sage.rings.number_field + 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 # needs sage.rings.number_field + sage: e1 < e2 < e3 and e(P[0]) < e3 True """ if self.is_zero(): # trivial case @@ -2548,12 +2578,13 @@ def reduction(self, p): :: - sage: F. = NumberField(x^3 + x^2 + 1) # needs sage.rings.number_field - sage: E = EllipticCurve(F, [a,2]) # needs sage.rings.number_field - sage: P = E(a, 1) # needs sage.rings.number_field - sage: P.reduction(F.ideal(5)) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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)) (abar : 1 : 1) - sage: P.reduction(F.ideal(a^2 - 4*a - 2)) # needs sage.rings.number_field + sage: P.reduction(F.ideal(a^2 - 4*a - 2)) (abar : 1 : 1) """ P = self @@ -2711,13 +2742,14 @@ def height(self, precision=None, normalised=True, algorithm='pari'): sage: PK.height() # needs sage.rings.number_field 1.36857250535393 - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0,0,4,6*i,0]) # needs sage.rings.number_field - sage: Q = E.lift_x(-9/4); Q # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = NumberField(x^2 + 1) + sage: E = EllipticCurve(K, [0,0,4,6*i,0]) + sage: Q = E.lift_x(-9/4); Q (-9/4 : 27/8*i - 4 : 1) - sage: Q.height() # needs sage.rings.number_field + sage: Q.height() 2.69518560017909 - sage: (15*Q).height() / Q.height() # needs sage.rings.number_field + sage: (15*Q).height() / Q.height() 225.000000000000 sage: E = EllipticCurve('37a') @@ -2861,13 +2893,14 @@ def archimedean_local_height(self, v=None, prec=None, weighted=False): Examples 1, 2, and 3 from [Sil1988]_:: - sage: K. = QuadraticField(-2) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0,-1,1,0,0]); E # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 # needs sage.rings.number_field + sage: P = E.lift_x(2 + a); P (a + 2 : -2*a - 2 : 1) - sage: P.archimedean_local_height(K.places(prec=170)[0]) / 2 # needs sage.rings.number_field + sage: P.archimedean_local_height(K.places(prec=170)[0]) / 2 0.45754773287523276736211210741423654346576029814695 sage: x = polygen(ZZ, 'x') @@ -2894,10 +2927,11 @@ 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) # needs sage.rings.number_field - sage: E = EllipticCurve([0, 0, 0, K(1), 0]) # needs sage.rings.number_field - sage: P = E(i, 0) # needs sage.rings.number_field - sage: P.archimedean_local_height() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(-1) + sage: E = EllipticCurve([0, 0, 0, K(1), 0]) + sage: P = E(i, 0) + sage: P.archimedean_local_height() 0.346573590279973 TESTS: @@ -2914,25 +2948,27 @@ def archimedean_local_height(self, v=None, prec=None, weighted=False): See :trac:`19276`:: - sage: K. = NumberField(x^2 - x - 104) # needs sage.rings.number_field - sage: E = EllipticCurve([1, a - 1, 1, -816765673272*a - 7931030674178, 1478955604013312315*a + 14361086227143654561]) # needs sage.rings.number_field - sage: P = E(5393511/49*a + 52372721/49 , -33896210324/343*a - 329141996591/343 ) # needs sage.rings.number_field - sage: P.height() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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() 0.974232017827741 See :trac:`29966`:: - sage: K. = NumberField(x^3 - x^2 - 6*x + 2) # needs sage.rings.number_field - sage: E = EllipticCurve([1, -a^2 + 2*a + 4, 0, -6056450500590472699700624*a^2 - 11239394326797569935861742*a + 4241549693833829432516231, # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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]) # needs sage.rings.number_field - sage: P.height() # needs sage.rings.number_field + sage: P = E([1033399668533*a^2 + 1917754693229*a - 723726883800 , 12536493059202326563*a^2 + 23264879148900575548*a - 8779756111574815918 , 1]) + sage: P.height() 0.297318833424763 - sage: (2*P).height() / P.height() # needs sage.rings.number_field + sage: (2*P).height() / P.height() 4.00000000000000 - sage: P.height(200) # needs sage.rings.number_field + sage: P.height(200) 0.29731883342476341806143743594519935578696537745294661858984 - sage: (2*P).height(200) / P.height(200) # needs sage.rings.number_field + sage: (2*P).height(200) / P.height(200) 4.0000000000000000000000000000000000000000000000000000000000 """ from sage.rings.number_field.number_field import refine_embedding @@ -3103,15 +3139,16 @@ def non_archimedean_local_height(self, v=None, prec=None, sage: P.non_archimedean_local_height(K.ideal(1-2*i)) # needs sage.rings.number_field 0 - sage: Q = E.lift_x(-9/4); Q # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: Q = E.lift_x(-9/4); Q (-9/4 : 27/8*i - 4 : 1) - sage: Q.non_archimedean_local_height(K.ideal(1+i)) # needs sage.rings.number_field + sage: Q.non_archimedean_local_height(K.ideal(1+i)) 2*log(2) - sage: Q.non_archimedean_local_height(K.ideal(3)) # needs sage.rings.number_field + sage: Q.non_archimedean_local_height(K.ideal(3)) 0 - sage: Q.non_archimedean_local_height(K.ideal(1-2*i)) # needs sage.rings.number_field + sage: Q.non_archimedean_local_height(K.ideal(1-2*i)) 0 - sage: Q.non_archimedean_local_height() # needs sage.rings.number_field + sage: Q.non_archimedean_local_height() 2*log(2) An example over the rational numbers:: @@ -3124,10 +3161,11 @@ 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) # needs sage.rings.number_field - sage: E = EllipticCurve([0, 0, 0, K(1), 0]) # needs sage.rings.number_field - sage: P = E(i, 0) # needs sage.rings.number_field - sage: P.non_archimedean_local_height() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(-1) + sage: E = EllipticCurve([0, 0, 0, K(1), 0]) + sage: P = E(i, 0) + sage: P.non_archimedean_local_height() -1/2*log(2) TESTS:: @@ -3137,17 +3175,18 @@ def non_archimedean_local_height(self, v=None, prec=None, sage: (3*Q).non_archimedean_local_height() # needs sage.rings.number_field 1/2*log(75923153929839865104) - sage: F. = NumberField(x^4 + 2*x^3 + 19*x^2 + 18*x + 288) # needs sage.rings.number_field - sage: F.ring_of_integers().basis() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: F. = NumberField(x^4 + 2*x^3 + 19*x^2 + 18*x + 288) + sage: F.ring_of_integers().basis() [1, 5/6*a^3 + 1/6*a, 1/6*a^3 + 1/6*a^2, a^3] - sage: F.class_number() # needs sage.rings.number_field + sage: F.class_number() 12 - sage: E = EllipticCurve('37a').change_ring(F) # needs sage.rings.number_field - sage: P = E((-a^2/6 - a/6 - 1, a)); P # needs sage.rings.number_field + sage: E = EllipticCurve('37a').change_ring(F) + sage: P = E((-a^2/6 - a/6 - 1, a)); P (-1/6*a^2 - 1/6*a - 1 : a : 1) - sage: P[0].is_integral() # needs sage.rings.number_field + sage: P[0].is_integral() True - sage: P.non_archimedean_local_height() # needs sage.rings.number_field + sage: P.non_archimedean_local_height() 0 This shows that the bug reported at :trac:`13951` has been fixed:: @@ -3346,13 +3385,14 @@ def elliptic_logarithm(self, embedding=None, precision=100, [-1.73964256006716 - 1.07861534489191*I, -0.363756518406398 - 1.50699412135253*I, 1.90726488608927] - sage: E = EllipticCurve([-a^2 - a - 1, a^2 + a]) # needs sage.rings.number_field - sage: Ls = [E.period_lattice(e) for e in embs] # needs sage.rings.number_field - sage: pts = [E(2*a^2 - a - 1 , -2*a^2 - 2*a + 6 ), # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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] # needs sage.rings.number_field + 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, @@ -3362,12 +3402,13 @@ def elliptic_logarithm(self, embedding=None, precision=100, :: - sage: K. = QuadraticField(-1) # needs sage.rings.number_field - sage: E = EllipticCurve([0,0,0,9*i-10,21-i]) # needs sage.rings.number_field - sage: emb = K.embeddings(CC)[1] # needs sage.rings.number_field - sage: L = E.period_lattice(emb) # needs sage.rings.number_field - sage: P = E(2-i, 4+2*i) # needs sage.rings.number_field - sage: L.elliptic_logarithm(P, prec=100) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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) 0.70448375537782208460499649302 - 0.79246725643650979858266018068*I """ from sage.rings.number_field.number_field import refine_embedding @@ -3613,14 +3654,15 @@ def _acted_upon_(self, other, side): EXAMPLES:: - sage: P = EllipticCurve(GF(65537), [2,2]).lift_x(6) # needs sage.rings.finite_rings - sage: P.order().factor() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: P = EllipticCurve(GF(65537), [2,2]).lift_x(6) + sage: P.order().factor() 2^2 * 3 * 37^2 - sage: getattr(74*P, '_order', None) # needs sage.rings.finite_rings + sage: getattr(74*P, '_order', None) 222 - sage: getattr(P*4070, '_order', None) # needs sage.rings.finite_rings + sage: getattr(P*4070, '_order', None) 222 - sage: getattr(506*P*37, '_order', None) # needs sage.rings.finite_rings + sage: getattr(506*P*37, '_order', None) 222 """ k = ZZ(other) @@ -3703,14 +3745,15 @@ def discrete_log(self, Q, ord=None): EXAMPLES:: - sage: F = GF((3,6),'a') # needs sage.rings.finite_rings - sage: a = F.gen() # needs sage.rings.finite_rings - sage: E = EllipticCurve([0,1,1,a,a]) # needs sage.rings.finite_rings - sage: E.cardinality() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF((3,6),'a') + sage: a = F.gen() + sage: E = EllipticCurve([0,1,1,a,a]) + sage: E.cardinality() 762 - sage: P = E.gens()[0] # needs sage.rings.finite_rings - sage: Q = 400*P # needs sage.rings.finite_rings - sage: P.discrete_log(Q) # needs sage.rings.finite_rings + sage: P = E.gens()[0] + sage: Q = 400*P + sage: P.discrete_log(Q) 400 TESTS: @@ -3872,16 +3915,17 @@ def order(self): EXAMPLES:: - sage: k. = GF((5,5)) # needs sage.rings.finite_rings - sage: E = EllipticCurve(k,[2,4]); E # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: k. = GF((5,5)) + sage: E = EllipticCurve(k,[2,4]); E 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) # needs sage.rings.finite_rings - sage: P.order() # needs sage.rings.finite_rings + sage: P = E(3*a^4 + 3*a, 2*a + 1) + sage: P.order() 3227 - sage: Q = E(0,2) # needs sage.rings.finite_rings - sage: Q.order() # needs sage.rings.finite_rings + sage: Q = E(0,2) + sage: Q.order() 7 - sage: Q.additive_order() # needs sage.rings.finite_rings + sage: Q.additive_order() 7 :: @@ -3921,13 +3965,14 @@ def order(self): Check that the order actually gets cached (:trac:`32786`):: - sage: E = EllipticCurve(GF(31337), [42,1]) # needs sage.rings.finite_rings - sage: P = E.lift_x(1) # needs sage.rings.finite_rings - sage: hasattr(P, '_order') # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(31337), [42,1]) + sage: P = E.lift_x(1) + sage: hasattr(P, '_order') False - sage: P.order() # needs sage.rings.finite_rings + sage: P.order() 15649 - sage: P._order # needs sage.rings.finite_rings + sage: P._order 15649 The curve order should also get cached as a side effect diff --git a/src/sage/schemes/elliptic_curves/ell_wp.py b/src/sage/schemes/elliptic_curves/ell_wp.py index a4103bec501..afc203007f9 100644 --- a/src/sage/schemes/elliptic_curves/ell_wp.py +++ b/src/sage/schemes/elliptic_curves/ell_wp.py @@ -91,34 +91,35 @@ 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) # needs sage.rings.finite_rings - sage: E = EllipticCurve(k, [1,1]) # needs sage.rings.finite_rings - sage: E.weierstrass_p(prec=6, algorithm='fast') # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: k = GF(11) + sage: E = EllipticCurve(k, [1,1]) + sage: E.weierstrass_p(prec=6, algorithm='fast') z^-2 + 2*z^2 + 3*z^4 + O(z^6) - sage: E.weierstrass_p(prec=7, algorithm='fast') # needs sage.rings.finite_rings + sage: E.weierstrass_p(prec=7, algorithm='fast') 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) # needs sage.rings.finite_rings + sage: E.weierstrass_p(prec=8) z^-2 + 2*z^2 + 3*z^4 + 5*z^6 + O(z^8) - sage: E.weierstrass_p(prec=8, algorithm='quadratic') # needs sage.rings.finite_rings + sage: E.weierstrass_p(prec=8, algorithm='quadratic') z^-2 + 2*z^2 + 3*z^4 + 5*z^6 + O(z^8) - sage: E.weierstrass_p(prec=8, algorithm='pari') # needs sage.rings.finite_rings + sage: E.weierstrass_p(prec=8, algorithm='pari') z^-2 + 2*z^2 + 3*z^4 + 5*z^6 + O(z^8) - sage: E.weierstrass_p(prec=9) # needs sage.rings.finite_rings + sage: E.weierstrass_p(prec=9) 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") # needs sage.rings.finite_rings + sage: E.weierstrass_p(prec=9, algorithm="quadratic") 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') # needs sage.rings.finite_rings + sage: E.weierstrass_p(prec=9, algorithm='pari') Traceback (most recent call last): ... ValueError: for computing the Weierstrass p-function via pari, the @@ -329,16 +330,17 @@ def solve_linear_differential_system(a, b, c, alpha): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.ell_wp import solve_linear_differential_system - sage: k = GF(17) # needs sage.rings.finite_rings - sage: R. = PowerSeriesRing(k) # needs 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) # needs sage.rings.finite_rings - sage: f = solve_linear_differential_system(a, b, c, alpha) # needs sage.rings.finite_rings - sage: f # needs sage.rings.finite_rings + 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 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 # needs sage.rings.finite_rings + sage: a*f.derivative() + b*f - c O(x^7) - sage: f(0) == alpha # needs sage.rings.finite_rings + sage: f(0) == alpha 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 3fd0ee34071..db969338217 100644 --- a/src/sage/schemes/elliptic_curves/formal_group.py +++ b/src/sage/schemes/elliptic_curves/formal_group.py @@ -488,21 +488,23 @@ 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]) # needs sage.rings.finite_rings - sage: ehat = e.formal() # needs sage.rings.finite_rings - sage: ehat.group_law(3) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: e = EllipticCurve(GF(7), [3, 4]) + sage: ehat = e.formal() + sage: ehat.group_law(3) t1 + t2 + O(t1, t2)^3 - sage: F = ehat.group_law(7); F # needs sage.rings.finite_rings + sage: F = ehat.group_law(7); F 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)[[]] # needs sage.rings.finite_rings - sage: F(x, ehat.inverse()(x)) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(7)[[]] + sage: F(x, ehat.inverse()(x)) 0 + O(x, y, z)^7 - sage: F(x, y) == F(y, x) # needs sage.rings.finite_rings + sage: F(x, y) == F(y, x) True - sage: F(x, F(y, z)) == F(F(x, y), z) # needs sage.rings.finite_rings + sage: F(x, F(y, z)) == F(F(x, y), z) True Let's ensure caching with changed precision is working:: diff --git a/src/sage/schemes/elliptic_curves/height.py b/src/sage/schemes/elliptic_curves/height.py index de669ce4142..9964c481cf2 100644 --- a/src/sage/schemes/elliptic_curves/height.py +++ b/src/sage/schemes/elliptic_curves/height.py @@ -884,12 +884,13 @@ def __call__(self, P): Over a number field other than `\QQ`:: - sage: K. = QuadraticField(-1) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0,0,0,1,-27]) # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.number_field - sage: H.base_field() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(-1) + sage: E = EllipticCurve(K, [0,0,0,1,-27]) + sage: H = E.height_function() + sage: H.base_field() Number Field in i with defining polynomial x^2 + 1 with i = 1*I - sage: H((1, 5*i)) # needs sage.rings.number_field + sage: H((1, 5*i)) 1.22257115164148 """ return self.E(P).height() @@ -913,11 +914,12 @@ def alpha(self, v, tol=0.01): Example 1 from [CPS2006]_:: - sage: K. = QuadraticField(-1) # needs sage.rings.number_field - sage: E = EllipticCurve([0, 0, 0, 1 + 5*i, 3 + i]) # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.number_field - sage: alpha = H.alpha(K.places()[0]) # needs sage.rings.number_field - sage: alpha # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 1.12272013439355 Compare with `\log(\epsilon_v)=0.344562...` in [CPS2006]_:: @@ -984,29 +986,30 @@ def e_p(self, p): EXAMPLES:: - sage: K. = QuadraticField(-1) # needs sage.rings.number_field - sage: E = EllipticCurve([0, 0, 0, 1 + 5*i, 3 + i]) # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.number_field - sage: H.e_p(K.prime_above(2)) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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)) 2 - sage: H.e_p(K.prime_above(3)) # needs sage.rings.number_field + sage: H.e_p(K.prime_above(3)) 10 - sage: H.e_p(K.prime_above(5)) # needs sage.rings.number_field + sage: H.e_p(K.prime_above(5)) 9 - sage: E.conductor().norm().factor() # needs sage.rings.number_field + sage: E.conductor().norm().factor() 2^10 * 20921 - sage: p1, p2 = K.primes_above(20921) # needs sage.rings.number_field - sage: E.local_data(p1) # needs sage.rings.number_field + sage: p1, p2 = K.primes_above(20921) + sage: E.local_data(p1) Local data at Fractional ideal (-40*i + 139): Reduction type: bad split multiplicative ... - sage: H.e_p(p1) # needs sage.rings.number_field + sage: H.e_p(p1) 20920 - sage: E.local_data(p2) # needs sage.rings.number_field + sage: E.local_data(p2) Local data at Fractional ideal (40*i + 139): Reduction type: good ... - sage: H.e_p(p2) # needs sage.rings.number_field + sage: H.e_p(p2) 20815 """ kp = self.K.residue_field(p) @@ -1036,10 +1039,11 @@ def DE(self, n): EXAMPLES:: - sage: K. = QuadraticField(-1) # needs sage.rings.number_field - sage: E = EllipticCurve([0, 0, 0, 1+5*i, 3+i]) # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.number_field - sage: [H.DE(n) for n in srange(1,6)] # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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] """ s = 0 @@ -1396,10 +1400,11 @@ def wp_c(self, v): sage: H.wp_c(QQ.places()[0]) 2.68744508779950 - sage: K. = QuadraticField(-1) # needs sage.rings.number_field - sage: E = EllipticCurve([0, 0, 0, 1 + 5*i, 3 + i]) # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.number_field - sage: H.wp_c(K.places()[0]) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 """ # Note that we normalise w1, w2 differently from [Tho2010]_! @@ -1903,18 +1908,20 @@ 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) # needs sage.rings.number_field - sage: E = EllipticCurve([0, 0, 0, 91 - 26*i, -144 - 323*i]) # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.number_field - sage: H.min_gr(0.1, 4) # long time # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 0.1621049443313762 Example 10.2 from [Tho2010]_:: - sage: K. = QuadraticField(-1) # needs sage.rings.number_field - sage: E = EllipticCurve([0, 1 - i, i, -i, 0]) # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.number_field - sage: H.min_gr(0.01, 5) # long time # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 0.020153685521979152 In this example the point `P=(0,0)` has height 0.023 so our @@ -1929,20 +1936,22 @@ 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) # needs sage.rings.number_field - sage: E = EllipticCurve([0, 0, 0, -3*a - a^2, a^2]) # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.number_field - sage: H.min_gr(0.1, 5) # long time # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 0.25 TESTS: This example from the LMFDB gave problems before the fix in :trac:`8829`:: - sage: K. = NumberField(x^2 - x - 1) # needs sage.rings.number_field - sage: E = EllipticCurve([phi + 1, -phi + 1, 1, 20*phi - 39, 196*phi + 237]) # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.number_field - sage: H.min_gr(.1, 5, verbose=True) # long time # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 B_1(1) = 1540.199246369678 ... halving mu to 0.25 and increasing n_max to 6 @@ -2024,18 +2033,20 @@ 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) # needs sage.rings.number_field - sage: E = EllipticCurve([0, 0, 0, 91 - 26*i, -144 - 323*i]) # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.number_field - sage: H.min(0.1, 4) # long time # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 0.1621049443313762 Example 10.2 from [Tho2010]_:: - sage: K. = QuadraticField(-1) # needs sage.rings.number_field - sage: E = EllipticCurve([0, 1 - i, i, -i, 0]) # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.number_field - sage: H.min(0.01, 5) # long time # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 0.020153685521979152 In this example the point `P=(0,0)` has height 0.023 so our @@ -2048,10 +2059,11 @@ 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) # needs sage.rings.number_field - sage: E = EllipticCurve([0, 0, 0, -3*a - a^2, a^2]) # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.number_field - sage: H.min(0.1, 5) # long time # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 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 e6d3a0e5a79..e653e58618a 100644 --- a/src/sage/schemes/elliptic_curves/hom_composite.py +++ b/src/sage/schemes/elliptic_curves/hom_composite.py @@ -33,28 +33,29 @@ is identical to :class:`EllipticCurveIsogeny` and other instantiations of :class:`EllipticCurveHom`:: - sage: E = EllipticCurve(GF(419), [0,1]) # needs sage.rings.finite_rings - sage: P = E.lift_x(33); P.order() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(419), [0,1]) + sage: P = E.lift_x(33); P.order() 35 - sage: psi = EllipticCurveHom_composite(E, P); psi # needs sage.rings.finite_rings + sage: psi = EllipticCurveHom_composite(E, P); psi 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)) # needs sage.rings.finite_rings + sage: psi(E.lift_x(11)) (352 : 346 : 1) - sage: psi.rational_maps() # needs sage.rings.finite_rings + 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)) - sage: psi.kernel_polynomial() # needs sage.rings.finite_rings + 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 - sage: psi.dual() # needs sage.rings.finite_rings + 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 To: Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 419 - sage: psi.formal() # needs sage.rings.finite_rings + sage: psi.formal() 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 @@ -100,17 +101,18 @@ def _eval_factored_isogeny(phis, P): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves import hom_composite - sage: E = EllipticCurve(GF(419), [1,0]) # needs sage.rings.finite_rings - sage: Q = E(21, 8) # needs sage.rings.finite_rings - sage: phis = [] # needs sage.rings.finite_rings - sage: while len(phis) < 10: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(419), [1,0]) + sage: Q = E(21, 8) + sage: phis = [] + sage: while len(phis) < 10: ....: 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 # needs sage.rings.finite_rings + sage: R = hom_composite._eval_factored_isogeny(phis, Q); R (290 : 183 : 1) - sage: R in E # needs sage.rings.finite_rings + sage: R in E True """ for phi in phis: @@ -164,32 +166,34 @@ def _compute_factored_isogeny_prime_power(P, l, n, split=.8): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves import hom_composite - sage: E = EllipticCurve(GF(8191), [1,0]) # needs sage.rings.finite_rings - sage: P = E.random_point() # needs sage.rings.finite_rings - sage: (l,n), = P.order().factor() # needs sage.rings.finite_rings - sage: phis = hom_composite._compute_factored_isogeny_prime_power(P, l, n) # needs sage.rings.finite_rings - sage: hom_composite._eval_factored_isogeny(phis, P) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(8191), [1,0]) + sage: P = E.random_point() + sage: (l,n), = P.order().factor() + sage: phis = hom_composite._compute_factored_isogeny_prime_power(P, l, n) + sage: hom_composite._eval_factored_isogeny(phis, P) (0 : 1 : 0) - sage: [phi.degree() for phi in phis] == [l]*n # needs sage.rings.finite_rings + sage: [phi.degree() for phi in phis] == [l]*n True All choices of ``split`` produce the same result, albeit not equally fast:: - sage: E = EllipticCurve(GF(2^127 - 1), [1,0]) # needs sage.rings.finite_rings - sage: P, = E.gens() # needs sage.rings.finite_rings - sage: (l,n), = P.order().factor() # needs sage.rings.finite_rings - sage: phis = hom_composite._compute_factored_isogeny_prime_power(P,l,n) # needs sage.rings.finite_rings - sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=0) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(2^127 - 1), [1,0]) + sage: P, = E.gens() + sage: (l,n), = P.order().factor() + sage: phis = hom_composite._compute_factored_isogeny_prime_power(P,l,n) + sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=0) True - sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=0.1) # needs sage.rings.finite_rings + sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=0.1) True - sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=0.5) # needs sage.rings.finite_rings + sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=0.5) True - sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=0.9) # needs sage.rings.finite_rings + sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=0.9) True - sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=1) # needs sage.rings.finite_rings + sage: phis == hom_composite._compute_factored_isogeny_prime_power(P,l,n, split=1) True """ def rec(Q, k): @@ -222,13 +226,14 @@ def _compute_factored_isogeny_single_generator(P): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves import hom_composite - sage: E = EllipticCurve(GF(419), [1,0]) # needs sage.rings.finite_rings - sage: P = E(42, 321) # needs sage.rings.finite_rings - sage: phis = hom_composite._compute_factored_isogeny_single_generator(P) # needs sage.rings.finite_rings - sage: list(sorted(phi.degree() for phi in phis)) # needs sage.rings.finite_rings + 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)) [2, 2, 3, 5, 7] - sage: hom_composite._eval_factored_isogeny(phis, P) # needs sage.rings.finite_rings + sage: hom_composite._eval_factored_isogeny(phis, P) (0 : 1 : 0) """ phis = [] @@ -249,13 +254,14 @@ def _compute_factored_isogeny(kernel): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves import hom_composite - sage: E = EllipticCurve(GF(419), [-1,0]) # needs sage.rings.finite_rings - sage: Ps = [E(41,99), E(41,-99), E(51,14), E(21,21), E(33,17)] # needs sage.rings.finite_rings - sage: phis = hom_composite._compute_factored_isogeny(Ps) # needs sage.rings.finite_rings - sage: [phi.degree() for phi in phis] # needs sage.rings.finite_rings + 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] [2, 3, 5, 7, 2] - sage: {hom_composite._eval_factored_isogeny(phis, P) for P in Ps} # needs sage.rings.finite_rings + sage: {hom_composite._eval_factored_isogeny(phis, P) for P in Ps} {(0 : 1 : 0)} """ phis = [] @@ -312,10 +318,11 @@ def __init__(self, E, kernel, codomain=None, model=None): TESTS:: - sage: E = EllipticCurve(GF(19), [1,0]) # needs sage.rings.finite_rings - sage: P = E.random_point() # needs sage.rings.finite_rings - sage: psi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings - sage: psi # random # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(19), [1,0]) + sage: P = E.random_point() + sage: psi = EllipticCurveHom_composite(E, P) + sage: psi # random 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 @@ -329,10 +336,11 @@ def __init__(self, E, kernel, codomain=None, model=None): :: - sage: E = EllipticCurve(GF((2^127-1)^2), [1,0]) # needs sage.rings.finite_rings - sage: K = 2^30 * E.random_point() # needs sage.rings.finite_rings - sage: psi = EllipticCurveHom_composite(E, K, model='montgomery') # needs sage.rings.finite_rings - sage: psi.codomain().a_invariants() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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() (0, ..., 0, 1, 0) """ if not isinstance(E, EllipticCurve_generic): @@ -415,12 +423,13 @@ def from_factors(cls, maps, E=None, strict=True): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(43), [1,0]) # needs sage.rings.finite_rings - sage: P, = E.gens() # needs sage.rings.finite_rings - sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings - sage: psi = EllipticCurveHom_composite.from_factors(phi.factors()) # needs sage.rings.finite_rings - sage: psi == phi # needs sage.rings.finite_rings + 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 True TESTS:: @@ -431,10 +440,11 @@ def from_factors(cls, maps, E=None, strict=True): :: - sage: E = EllipticCurve(GF(419), [1,0]) # needs sage.rings.finite_rings - sage: P, = E.gens() # needs sage.rings.finite_rings - sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings - sage: EllipticCurveHom_composite.from_factors(phi.factors()) == phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 True """ maps = tuple(maps) @@ -478,12 +488,13 @@ def _call_(self, P): Check that copying the order over works:: - sage: E = EllipticCurve(GF(431), [1,0]) # needs sage.rings.finite_rings - sage: P, = E.gens() # needs sage.rings.finite_rings - sage: Q = 2^99*P; Q.order() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(431), [1,0]) + sage: P, = E.gens() + sage: Q = 2^99*P; Q.order() 27 - sage: phi = E.isogeny(3^99*P, algorithm='factored') # needs sage.rings.finite_rings - sage: phi(Q)._order # needs sage.rings.finite_rings + sage: phi = E.isogeny(3^99*P, algorithm='factored') + sage: phi(Q)._order 27 """ return _eval_factored_isogeny(self._phis, P) @@ -525,15 +536,16 @@ def _repr_(self): TESTS:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(43), [1,0]) # needs sage.rings.finite_rings - sage: P, = E.gens() # needs sage.rings.finite_rings - sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings - sage: phi # indirect doctest # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(43), [1,0]) + sage: P, = E.gens() + sage: phi = EllipticCurveHom_composite(E, P) + sage: phi # indirect doctest 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 # needs sage.rings.finite_rings + sage: phi * phi * phi * phi * phi * phi * phi # indirect doctest 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 @@ -556,11 +568,12 @@ def factors(self): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(43), [1,0]) # needs sage.rings.finite_rings - sage: P, = E.gens() # needs sage.rings.finite_rings - sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings - sage: phi.factors() # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(43), [1,0]) + 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, @@ -584,33 +597,34 @@ def _composition_impl(left, right): TESTS:: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve([i + 1, i, 0, -4, -6*i]) # needs sage.rings.number_field - sage: P,Q = E.lift_x(i - 5), E.lift_x(-4*i) # needs sage.rings.number_field - sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.number_field - sage: psi = phi.codomain().isogeny(phi(Q)) # needs sage.rings.number_field + 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: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: iso1 = WeierstrassIsomorphism(E, (-1, 0, -i - 1, 0)) # needs sage.rings.number_field - sage: iso2 = psi.codomain().isomorphism_to(E) # needs sage.rings.number_field - sage: psi * phi # indirect doctest # needs sage.rings.number_field + sage: iso1 = WeierstrassIsomorphism(E, (-1, 0, -i - 1, 0)) + sage: iso2 = psi.codomain().isomorphism_to(E) + sage: psi * phi # indirect doctest 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 # needs sage.rings.number_field + sage: iso2 * EllipticCurveHom_composite.from_factors([phi, psi]) # indirect doctest 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 # needs sage.rings.number_field + sage: phi * iso1 # indirect doctest 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 # needs sage.rings.number_field + sage: iso2 * psi * phi * iso1 # indirect doctest 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 @@ -647,26 +661,28 @@ def _comparison_impl(left, right, op): TESTS:: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(QuadraticField(-3), [0,16]) # needs sage.rings.number_field - sage: P,Q = E.lift_x(0), E.lift_x(-4) # needs sage.rings.number_field - sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.number_field - sage: psi = phi.codomain().isogeny(phi(Q)) # needs sage.rings.number_field - sage: psi = psi.codomain().isomorphism_to(E) * psi # needs sage.rings.number_field - sage: comp = psi * phi # needs sage.rings.number_field - sage: mu = E.scalar_multiplication(phi.degree()) # needs sage.rings.number_field - sage: sum(a*comp == mu for a in E.automorphisms()) # needs sage.rings.number_field + 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()) 1 :: - sage: E = EllipticCurve(GF(431**2), [1,0]) # needs sage.rings.finite_rings - sage: P,Q = E.gens() # needs sage.rings.finite_rings - sage: phi1 = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings - sage: phi2 = EllipticCurveHom_composite(phi1.codomain(), phi1(Q)) # needs sage.rings.finite_rings - sage: psi1 = EllipticCurveHom_composite(E, Q) # needs sage.rings.finite_rings - sage: psi2 = EllipticCurveHom_composite(psi1.codomain(), psi1(P)) # needs sage.rings.finite_rings - sage: phi2 * phi1 == psi2 * psi1 # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 True """ if op != op_EQ: @@ -683,11 +699,12 @@ def rational_maps(self): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # needs sage.rings.finite_rings - sage: P = E.lift_x(7321) # needs sage.rings.finite_rings - sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings - sage: phi.rational_maps() # needs sage.rings.finite_rings + 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), @@ -726,11 +743,12 @@ def x_rational_map(self): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # needs sage.rings.finite_rings - sage: P = E.lift_x(7321) # needs sage.rings.finite_rings - sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings - sage: phi.x_rational_map() == phi.rational_maps()[0] # needs sage.rings.finite_rings + 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] True TESTS:: @@ -750,16 +768,17 @@ def kernel_polynomial(self): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # needs sage.rings.finite_rings - sage: P = E.lift_x(7321) # needs sage.rings.finite_rings - sage: phi = EllipticCurveHom_composite(E, P); phi # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) + 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 - sage: phi.kernel_polynomial() # needs sage.rings.finite_rings + sage: phi.kernel_polynomial() x^4 + 46500*x^3 + 19556*x^2 + 7643*x + 15952 """ # shouldn't there be a better algorithm for this? @@ -772,24 +791,25 @@ def dual(self): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # needs sage.rings.finite_rings - sage: P = E.lift_x(7321) # needs sage.rings.finite_rings - sage: phi = EllipticCurveHom_composite(E, P); phi # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) + 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 - sage: psi = phi.dual(); psi # needs sage.rings.finite_rings + 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 - sage: psi * phi == phi.domain().scalar_multiplication(phi.degree()) # needs sage.rings.finite_rings + sage: psi * phi == phi.domain().scalar_multiplication(phi.degree()) True - sage: phi * psi == psi.domain().scalar_multiplication(psi.degree()) # needs sage.rings.finite_rings + sage: phi * psi == psi.domain().scalar_multiplication(psi.degree()) True """ phis = (phi.dual() for phi in self._phis[::-1]) @@ -804,16 +824,17 @@ def is_separable(self): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(7^2), [3,2]) # needs sage.rings.finite_rings - sage: P = E.lift_x(1) # needs sage.rings.finite_rings - sage: phi = EllipticCurveHom_composite(E, P); phi # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(7^2), [3,2]) + 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 - sage: phi.is_separable() # needs sage.rings.finite_rings + sage: phi.is_separable() True """ return all(phi.is_separable() for phi in self._phis) @@ -826,16 +847,17 @@ def formal(self, prec=20): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # needs sage.rings.finite_rings - sage: P = E.lift_x(7321) # needs sage.rings.finite_rings - sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings - sage: phi.formal() # needs sage.rings.finite_rings + 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() 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) # needs sage.rings.finite_rings + 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) """ @@ -857,18 +879,19 @@ def scaling_factor(self): EXAMPLES:: + sage: # needs sage.rings.finite_rings 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]) # needs sage.rings.finite_rings - sage: P = E.lift_x(7321) # needs sage.rings.finite_rings - sage: phi = EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings - sage: phi = WeierstrassIsomorphism(phi.codomain(), [7,8,9,10]) * phi # needs sage.rings.finite_rings - sage: phi.formal() # needs sage.rings.finite_rings + 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() 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() # needs sage.rings.finite_rings + sage: phi.scaling_factor() 7 ALGORITHM: The scaling factor is multiplicative under diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py index 86ccab0f2d2..b69a6a2a988 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py @@ -966,9 +966,10 @@ def isogenies_5_1728(E, minimal_models=True): An example of endomorphisms of degree 5:: - sage: K. = QuadraticField(-1) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0,0,0,1,0]) # needs sage.rings.number_field - sage: isogenies_5_1728(E) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 @@ -979,7 +980,7 @@ def isogenies_5_1728(E, minimal_models=True): 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() # needs sage.rings.number_field + 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 @@ -1008,14 +1009,15 @@ def isogenies_5_1728(E, minimal_models=True): See :trac:`19840`:: - sage: K. = NumberField(x^4 - 5*x^2 + 5) # needs sage.rings.number_field - sage: E = EllipticCurve([a^2 + a + 1, a^3 + a^2 + a + 1, a^2 + a, # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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)) # needs sage.rings.number_field + sage: len(E.isogenies_prime_degree(5)) 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)] # needs sage.rings.number_field + sage: [phi.codomain().j_invariant() for phi in isogenies_5_1728(E)] [19691491018752*a^2 - 27212977933632, 19691491018752*a^2 - 27212977933632] """ F = E.base_field() @@ -1230,12 +1232,13 @@ def isogenies_7_1728(E, minimal_models=True): An example in characteristic 53 (for which an earlier implementation did not work):: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_7_1728 - sage: E = EllipticCurve(GF(53), [1, 0]) # needs sage.rings.finite_rings - sage: isogenies_7_1728(E) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(53), [1, 0]) + sage: isogenies_7_1728(E) [] - sage: E = EllipticCurve(GF(53^2,'a'), [1, 0]) # needs sage.rings.finite_rings - sage: [iso.codomain().ainvs() for iso in isogenies_7_1728(E)] # needs sage.rings.finite_rings + 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)] @@ -1320,11 +1323,12 @@ def isogenies_13_0(E, minimal_models=True): Endomorphisms of degree 13 will exist when -3 is a square:: - sage: K. = QuadraticField(-3) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0, r]); E # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 - sage: isogenies_13_0(E) # needs sage.rings.number_field + 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 @@ -1335,7 +1339,7 @@ def isogenies_13_0(E, minimal_models=True): 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() # needs sage.rings.number_field + 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 @@ -1350,18 +1354,19 @@ def isogenies_13_0(E, minimal_models=True): An example of endomorphisms over a finite field:: - sage: K = GF(19^2,'a') # needs sage.rings.finite_rings - sage: E = EllipticCurve(j=K(0)); E # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) # needs sage.rings.finite_rings + 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] - sage: isogenies_13_0(E)[0].rational_maps() # needs sage.rings.finite_rings + 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)) @@ -1486,15 +1491,16 @@ def isogenies_13_1728(E, minimal_models=True): :: - sage: K = GF(83) # needs sage.rings.finite_rings - sage: E = EllipticCurve(K, [0,0,0,5,0]); E.ainvs() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(83) + sage: E = EllipticCurve(K, [0,0,0,5,0]); E.ainvs() (0, 0, 0, 5, 0) - sage: isogenies_13_1728(E) # needs sage.rings.finite_rings + sage: isogenies_13_1728(E) [] - sage: K = GF(89) # needs sage.rings.finite_rings - sage: E = EllipticCurve(K, [0,0,0,5,0]); E.ainvs() # needs sage.rings.finite_rings + sage: K = GF(89) + sage: E = EllipticCurve(K, [0,0,0,5,0]); E.ainvs() (0, 0, 0, 5, 0) - sage: isogenies_13_1728(E) # needs sage.rings.finite_rings + 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, @@ -1521,7 +1527,7 @@ def isogenies_13_1728(E, minimal_models=True): ....: - 282896640*x^4 - 149879808*x^2 - 349360128) sage: K. = NumberField(f) # needs sage.rings.number_field sage: E = EllipticCurve(K, [1,0]) # needs sage.rings.number_field - sage: [phi.codomain().ainvs() # long time, needs sage.rings.number_field + sage: [phi.codomain().ainvs() # long time # needs sage.rings.number_field ....: for phi in isogenies_13_1728(E)] [(0, 0, @@ -1865,10 +1871,11 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field] - sage: K = QuadraticField(-295,'a') # needs sage.rings.number_field - sage: a = K.gen() # needs sage.rings.number_field - sage: E = EllipticCurve_from_j(-484650135/16777216*a + 4549855725/16777216) # needs sage.rings.number_field - sage: isogenies_prime_degree_genus_plus_0(E, 23) # needs sage.rings.number_field + sage: # needs sage.rings.number_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 @@ -1881,10 +1888,11 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): over Number Field in a with defining polynomial x^2 + 295 with a = 17.17556403731767?*I] - sage: K = QuadraticField(-199,'a') # needs sage.rings.number_field - sage: a = K.gen() # needs sage.rings.number_field - sage: E = EllipticCurve_from_j(94743000*a + 269989875) # needs sage.rings.number_field - sage: isogenies_prime_degree_genus_plus_0(E, 29) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 @@ -1897,10 +1905,11 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): over Number Field in a with defining polynomial x^2 + 199 with a = 14.106735979665884?*I] - sage: K = QuadraticField(253,'a') # needs sage.rings.number_field - sage: a = K.gen() # needs sage.rings.number_field - sage: E = EllipticCurve_from_j(208438034112000*a - 3315409892960000) # needs sage.rings.number_field - sage: isogenies_prime_degree_genus_plus_0(E, 31) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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) [Isogeny of degree 31 from Elliptic Curve defined by y^2 = x^3 + (4146345122185433034677956608000*a-65951656549965037259634800640000)*x @@ -1922,11 +1931,12 @@ 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') # needs sage.rings.number_field - sage: a = K.gen() # needs sage.rings.number_field - sage: E = EllipticCurve_from_j(184068066743177379840*a # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 # needs sage.rings.number_field + sage: isogenies_prime_degree_genus_plus_0(E, 47) # long time [Isogeny of degree 47 from Elliptic Curve defined by y^2 = x^3 + (454562028554080355857852049849975895490560*a-1016431595837124114668689286176511361024000)*x @@ -2346,13 +2356,14 @@ 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) # needs sage.rings.finite_rings - sage: E = EllipticCurve(F, [0,0,0,-1,0]) # needs sage.rings.finite_rings - sage: f13 = E.division_polynomial(13) # needs sage.rings.finite_rings - sage: factors = [f for f, e in f13.factor()] # needs sage.rings.finite_rings - sage: all(f.degree() == 6 for f in factors) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) True - sage: [is_kernel_polynomial(E, 13, f) for f in factors] # needs sage.rings.finite_rings + sage: [is_kernel_polynomial(E, 13, f) for f in factors] [True, True, False, @@ -2370,15 +2381,16 @@ def is_kernel_polynomial(E, m, f): See :trac:`22232`:: - sage: K = GF(47^2) # needs sage.rings.finite_rings - sage: E = EllipticCurve([0, K.gen()]) # needs sage.rings.finite_rings - sage: psi7 = E.division_polynomial(7) # needs sage.rings.finite_rings - sage: f = psi7.factor()[4][0] # needs sage.rings.finite_rings - sage: f # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 x^3 + (7*z2 + 11)*x^2 + (25*z2 + 33)*x + 25*z2 - sage: f.divides(psi7) # needs sage.rings.finite_rings + sage: f.divides(psi7) True - sage: is_kernel_polynomial(E, 7, f) # needs sage.rings.finite_rings + sage: is_kernel_polynomial(E, 7, f) False """ m2 = m // 2 @@ -2546,12 +2558,13 @@ def isogenies_prime_degree_general(E, l, minimal_models=True): factors of degree 6 each, but only two those are kernel polynomials:: - sage: F3 = GF(3) # needs sage.rings.finite_rings - sage: E = EllipticCurve(F3, [0,0,0,-1,0]) # needs sage.rings.finite_rings - sage: Psi13 = E.division_polynomial(13) # needs sage.rings.finite_rings - sage: len([f for f, e in Psi13.factor() if f.degree() == 6]) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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]) 14 - sage: len(E.isogenies_prime_degree(13)) # needs sage.rings.finite_rings + sage: len(E.isogenies_prime_degree(13)) 2 Over GF(9) the other factors of degree 6 split into pairs of @@ -2565,7 +2578,7 @@ def isogenies_prime_degree_general(E, l, minimal_models=True): sage: K. = QuadraticField(-1) # needs sage.rings.number_field sage: E = EllipticCurve(K,[0,0,0,1,0]) # needs sage.rings.number_field - sage: [phi.codomain().ainvs() # long time, needs sage.rings.number_field + sage: [phi.codomain().ainvs() # long time # needs 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)] diff --git a/src/sage/schemes/elliptic_curves/lseries_ell.py b/src/sage/schemes/elliptic_curves/lseries_ell.py index b38638cfcb4..6e1dfa18c52 100644 --- a/src/sage/schemes/elliptic_curves/lseries_ell.py +++ b/src/sage/schemes/elliptic_curves/lseries_ell.py @@ -670,12 +670,13 @@ def deriv_at1(self, k=None, prec=None): With less numerical precision, the error is bounded by numerical accuracy:: - sage: L, err = E.lseries().deriv_at1(100, prec=64) # needs sage.symbolic - sage: L, err # needs sage.symbolic + sage: # needs sage.symbolic + sage: L, err = E.lseries().deriv_at1(100, prec=64) + sage: L, err (0.305999773834052302, 5.55318e-18) - sage: parent(L) # needs sage.symbolic + sage: parent(L) Real Field with 64 bits of precision - sage: parent(err) # needs sage.symbolic + sage: parent(err) Real Field with 24 bits of precision and rounding RNDU Rank 2 and rank 3 elliptic curves:: diff --git a/src/sage/schemes/elliptic_curves/padics.py b/src/sage/schemes/elliptic_curves/padics.py index 6244c83cbab..6c4a2050e4f 100644 --- a/src/sage/schemes/elliptic_curves/padics.py +++ b/src/sage/schemes/elliptic_curves/padics.py @@ -1107,12 +1107,13 @@ def padic_sigma(self, p, N=20, E2=None, check=False, check_hypotheses=True): Test that it returns consistent results over a range of precision:: - sage: max_N = 30 # get up to at least p^2 # long time - sage: E = EllipticCurve([1, 1, 1, 1, 1]) # long time - sage: p = 5 # long time - sage: E2 = E.padic_E2(5, max_N) # long time - sage: max_sigma = E.padic_sigma(p, max_N, E2=E2) # long time - sage: for N in range(3, max_N): # long time + sage: # long time + sage: max_N = 30 # get up to at least p^2 + sage: E = EllipticCurve([1, 1, 1, 1, 1]) + sage: p = 5 + sage: E2 = E.padic_E2(5, max_N) + sage: max_sigma = E.padic_sigma(p, max_N, E2=E2) + sage: for N in range(3, max_N): ....: sigma = E.padic_sigma(p, N, E2=E2) ....: assert sigma == max_sigma """ diff --git a/src/sage/schemes/elliptic_curves/period_lattice.py b/src/sage/schemes/elliptic_curves/period_lattice.py index 3cbad7097ab..60790c9b2d5 100644 --- a/src/sage/schemes/elliptic_curves/period_lattice.py +++ b/src/sage/schemes/elliptic_curves/period_lattice.py @@ -60,21 +60,23 @@ that `\tau = \omega_1/\omega_2` is in the fundamental region in the upper half plane:: - sage: w1, w2 = L.basis(); w1, w2 # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: w1, w2 = L.basis(); w1, w2 (-1.37588604166076 - 2.58560946624443*I, -2.10339907847356 + 0.428378776460622*I) - sage: L.is_real() # needs sage.rings.number_field + sage: L.is_real() False - sage: tau = w1/w2; tau # needs sage.rings.number_field + sage: tau = w1/w2; tau 0.387694505032876 + 1.30821088214407*I - sage: L.normalised_basis() # needs sage.rings.number_field + sage: L.normalised_basis() (-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') # needs sage.rings.number_field - sage: K. = QuadraticField(-7) # needs sage.rings.number_field - sage: EK = E.change_ring(K) # needs sage.rings.number_field - sage: EK.period_lattice(K.complex_embeddings()[0]) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: E = EllipticCurve('37a') + 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 @@ -203,12 +205,13 @@ def __init__(self, E, embedding=None): TESTS:: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.period_lattice import PeriodLattice_ell - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field - sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field - sage: L = PeriodLattice_ell(E,emb) # needs sage.rings.number_field - sage: L == loads(dumps(L)) # needs sage.rings.number_field + 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)) True """ # First we cache the elliptic curve with this period lattice: @@ -446,13 +449,14 @@ def basis(self, prec=None, algorithm='sage'): sage: L.basis(64) # needs sage.rings.number_field (3.81452977217854509, 1.90726488608927255 + 1.34047785962440202*I) - sage: emb = K.embeddings(ComplexField())[0] # needs sage.rings.number_field - sage: L = E.period_lattice(emb) # needs sage.rings.number_field - sage: w1, w2 = L.basis(); w1, w2 # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: emb = K.embeddings(ComplexField())[0] + sage: L = E.period_lattice(emb) + sage: w1, w2 = L.basis(); w1, w2 (-1.37588604166076 - 2.58560946624443*I, -2.10339907847356 + 0.428378776460622*I) - sage: L.is_real() # needs sage.rings.number_field + sage: L.is_real() False - sage: tau = w1/w2; tau # needs sage.rings.number_field + sage: tau = w1/w2; tau 0.387694505032876 + 1.30821088214407*I """ # We divide into two cases: (1) Q, or a number field with a @@ -549,14 +553,15 @@ def normalised_basis(self, prec=None, algorithm='sage'): (1.90726488608927255 - 1.34047785962440202*I, -1.90726488608927255 - 1.34047785962440202*I) - sage: emb = K.embeddings(ComplexField())[0] # needs sage.rings.number_field - sage: L = E.period_lattice(emb) # needs sage.rings.number_field - sage: w1, w2 = L.normalised_basis(); w1, w2 # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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: L.is_real() # needs sage.rings.number_field + sage: L.is_real() False - sage: tau = w1/w2; tau # needs sage.rings.number_field + sage: tau = w1/w2; tau 0.387694505032876 + 1.30821088214407*I """ w1, w2 = self.basis(prec=prec, algorithm=algorithm) @@ -606,13 +611,14 @@ def tau(self, prec=None, algorithm='sage'): sage: -0.5 <= tau.real() <= 0.5 # needs sage.rings.number_field True - sage: emb = K.embeddings(ComplexField())[0] # needs sage.rings.number_field - sage: L = E.period_lattice(emb) # needs sage.rings.number_field - sage: tau = L.tau(); tau # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: emb = K.embeddings(ComplexField())[0] + sage: L = E.period_lattice(emb) + sage: tau = L.tau(); tau 0.387694505032876 + 1.30821088214407*I - sage: tau.abs() # needs sage.rings.number_field + sage: tau.abs() 1.36444961115933 - sage: -0.5 <= tau.real() <= 0.5 # needs sage.rings.number_field + sage: -0.5 <= tau.real() <= 0.5 True """ w1, w2 = self.normalised_basis(prec=prec, algorithm=algorithm) @@ -732,13 +738,14 @@ def _compute_periods_complex(self, prec=None, normalise=True): Without normalisation:: - sage: w1,w2 = L._compute_periods_complex(normalise=False); w1,w2 # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: w1,w2 = L._compute_periods_complex(normalise=False); w1,w2 (2.10339907847356 - 0.428378776460622*I, 0.727513036812796 - 3.01398824270506*I) - sage: tau = w1/w2; tau # needs sage.rings.number_field + sage: tau = w1/w2; tau 0.293483964608883 + 0.627038168678760*I - sage: tau.real() # needs sage.rings.number_field + sage: tau.real() 0.293483964608883 - sage: tau.abs() # > 1 # needs sage.rings.number_field + sage: tau.abs() # > 1 0.692321964451917 """ if prec is None: @@ -775,11 +782,12 @@ def is_real(self): :: - sage: K. = QuadraticField(-1) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0,0,0,i,2*i]) # needs sage.rings.number_field - sage: emb = K.embeddings(ComplexField())[0] # needs sage.rings.number_field - sage: L = E.period_lattice(emb) # needs sage.rings.number_field - sage: L.is_real() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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() False :: @@ -934,14 +942,15 @@ 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) # needs sage.rings.number_field - sage: E = EllipticCurve([0,1-i,i,-i,0]) # needs sage.rings.number_field - sage: L = E.period_lattice(K.embeddings(CC)[0]) # needs sage.rings.number_field - sage: L.omega() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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() 8.80694160502647 - sage: L.omega(prec=200) # needs sage.rings.number_field + sage: L.omega(prec=200) 8.8069416050264741493250743632295462227858630765392114070032 - sage: L.omega(bsd_normalise=True) # needs sage.rings.number_field + sage: L.omega(bsd_normalise=True) 17.6138832100529 """ if self.is_real(): @@ -1365,30 +1374,32 @@ def e_log_RC(self, xP, yP, prec=None, reduce=True): Elliptic logs of real points which do not come from algebraic points:: - sage: ER = EllipticCurve([v(ai) for ai in E.a_invariants()]) # needs sage.rings.number_field - sage: P = ER.lift_x(12.34) # needs sage.rings.number_field - sage: xP, yP = P.xy() # needs sage.rings.number_field - sage: xP, yP # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 (12.3400000000000, -43.3628968710567) - sage: L.e_log_RC(xP, yP) # needs sage.rings.number_field + sage: L.e_log_RC(xP, yP) 0.284656841192041 - sage: xP, yP = ER.lift_x(0).xy() # needs sage.rings.number_field - sage: L.e_log_RC(xP, yP) # needs sage.rings.number_field + sage: xP, yP = ER.lift_x(0).xy() + sage: L.e_log_RC(xP, yP) 1.34921304541057 Elliptic logs of complex points:: - sage: v = K.complex_embeddings()[0] # needs sage.rings.number_field - sage: L = E.period_lattice(v) # needs sage.rings.number_field - sage: P = E.lift_x(1/3*a^2 + a + 5/3) # needs sage.rings.number_field - sage: L(P) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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) 1.68207104397706 - 1.87873661686704*I - sage: xP, yP = [v(c) for c in P.xy()] # needs sage.rings.number_field - sage: L.e_log_RC(xP, yP) # needs sage.rings.number_field + sage: xP, yP = [v(c) for c in P.xy()] + sage: L.e_log_RC(xP, yP) 1.68207104397706 - 1.87873661686704*I - sage: EC = EllipticCurve([v(ai) for ai in E.a_invariants()]) # needs sage.rings.number_field - sage: xP, yP = EC.lift_x(0).xy() # needs sage.rings.number_field - sage: L.e_log_RC(xP, yP) # needs sage.rings.number_field + 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) 2.06711431204080 - 1.73451485683471*I """ if prec is None: @@ -1583,14 +1594,15 @@ def elliptic_logarithm(self, P, prec=None, reduce=True): Some complex examples, taken from the paper by Cremona and Thongjunthug:: - sage: K. = QuadraticField(-1) # needs sage.rings.number_field - sage: a4 = 9*i - 10 # needs sage.rings.number_field - sage: a6 = 21 - i # needs sage.rings.number_field - sage: E = EllipticCurve([0,0,0,a4,a6]) # needs sage.rings.number_field - sage: e1 = 3 - 2*i; e2 = 1 + i; e3 = -4 + i # needs sage.rings.number_field - sage: emb = K.embeddings(CC)[1] # needs sage.rings.number_field - sage: L = E.period_lattice(emb) # needs sage.rings.number_field - sage: P = E(2 - i, 4 + 2*i) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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) By default, the output is reduced with respect to the normalised lattice basis, so that its coordinates with respect @@ -1632,22 +1644,23 @@ def elliptic_logarithm(self, P, prec=None, reduce=True): :: - sage: a4 = -78*i + 104 # needs sage.rings.number_field - sage: a6 = -216*i - 312 # needs sage.rings.number_field - sage: E = EllipticCurve([0,0,0,a4,a6]) # needs sage.rings.number_field - sage: emb = K.embeddings(CC)[1] # needs sage.rings.number_field - sage: L = E.period_lattice(emb) # needs sage.rings.number_field - sage: P = E(3 + 2*i, 14 - 7*i) # needs sage.rings.number_field - sage: L.elliptic_logarithm(P) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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) 0.297147783912228 - 0.546125549639461*I - sage: L.coordinates(L.elliptic_logarithm(P)) # needs sage.rings.number_field + sage: L.coordinates(L.elliptic_logarithm(P)) (0.628653378040238, 0.371417754610223) - sage: e1 = 1 + 3*i; e2 = -4 - 12*i; e3 = -e1 - e2 # needs sage.rings.number_field - sage: L.coordinates(L.elliptic_logarithm(E(e1, 0))) # needs sage.rings.number_field + 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))) # needs sage.rings.number_field + sage: L.coordinates(L.elliptic_logarithm(E(e2, 0))) (1.00000000000000, 0.500000000000000) - sage: L.coordinates(L.elliptic_logarithm(E(e3, 0))) # needs sage.rings.number_field + sage: L.coordinates(L.elliptic_logarithm(E(e3, 0))) (0.500000000000000, 0.000000000000000) TESTS: @@ -1764,26 +1777,27 @@ def elliptic_exponential(self, z, to_curve=True): sage: [c.real() for c in Li[0].elliptic_exponential(zi[2])] # needs sage.rings.number_field [-1.00000000000000, -1.00000000000000, 1.00000000000000] - sage: zi = [L.elliptic_logarithm(Q) for L in Li] # needs sage.rings.number_field - sage: Li[0].elliptic_exponential(zi[0]) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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] # needs sage.rings.number_field + 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]) # needs sage.rings.number_field + 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] # needs sage.rings.number_field + 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])] # needs sage.rings.number_field + sage: [c.real() for c in Li[2].elliptic_exponential(zi[2])] [0.259921049894873, -0.587401051968199, 1.00000000000000] - sage: [embs[2](c) for c in Q] # needs sage.rings.number_field + sage: [embs[2](c) for c in Q] [0.259921049894873, -0.587401051968200, 1.00000000000000] Test to show that :trac:`8820` is fixed:: @@ -1821,10 +1835,11 @@ def elliptic_exponential(self, z, to_curve=True): Very small `z` are handled properly (see :trac:`8820`):: - sage: K. = QuadraticField(-1) # needs sage.rings.number_field - sage: E = EllipticCurve([0,0,0,a,0]) # needs sage.rings.number_field - sage: L = E.period_lattice(K.complex_embeddings()[0]) # needs sage.rings.number_field - sage: L.elliptic_exponential(1e-100) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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) (0.000000000000000 : 1.00000000000000 : 0.000000000000000) The elliptic exponential of `z` is returned as (0 : 1 : 0) if diff --git a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx index 0d24651f4c1..eb40392dee9 100644 --- a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx +++ b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx @@ -54,12 +54,12 @@ cdef class PeriodicRegion: sage: import numpy as np sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion sage: S = PeriodicRegion(CDF(2), CDF(2*I), np.zeros((4, 4))) - sage: S.plot() + sage: S.plot() # needs sage.plot Graphics object consisting of 1 graphics primitive sage: data = np.zeros((4, 4)) sage: data[1,1] = True sage: S = PeriodicRegion(CDF(2), CDF(2*I+1), data) - sage: S.plot() + sage: S.plot() # needs sage.plot Graphics object consisting of 5 graphics primitives """ if data.dtype is not np.int8: @@ -250,16 +250,16 @@ cdef class PeriodicRegion: sage: data = np.zeros((4, 4)) sage: data[1,1] = True sage: S = PeriodicRegion(CDF(1), CDF(I + 1/2), data) - sage: S.plot() + sage: S.plot() # needs sage.plot Graphics object consisting of 5 graphics primitives - sage: S.expand().plot() + sage: S.expand().plot() # needs sage.plot Graphics object consisting of 13 graphics primitives sage: S.expand().data array([[1, 1, 1, 0], [1, 1, 1, 0], [1, 1, 1, 0], [0, 0, 0, 0]], dtype=int8) - sage: S.expand(corners=False).plot() + sage: S.expand(corners=False).plot() # needs sage.plot Graphics object consisting of 13 graphics primitives sage: S.expand(corners=False).data array([[0, 1, 0, 0], @@ -298,9 +298,9 @@ cdef class PeriodicRegion: sage: data = np.zeros((10, 10)) sage: data[1:4,1:4] = True sage: S = PeriodicRegion(CDF(1), CDF(I + 1/2), data) - sage: S.plot() + sage: S.plot() # needs sage.plot Graphics object consisting of 13 graphics primitives - sage: S.contract().plot() + sage: S.contract().plot() # needs sage.plot Graphics object consisting of 5 graphics primitives sage: S.contract().data.sum() 1 @@ -376,11 +376,11 @@ cdef class PeriodicRegion: sage: data[2:6, 2] = True sage: data[3, 3] = True sage: S = PeriodicRegion(CDF(1), CDF(I + 1/2), data) - sage: S.plot() + sage: S.plot() # needs sage.plot Graphics object consisting of 29 graphics primitives - sage: (S / 2).plot() + sage: (S / 2).plot() # needs sage.plot Graphics object consisting of 57 graphics primitives - sage: (S / 3).plot() + sage: (S / 3).plot() # needs sage.plot Graphics object consisting of 109 graphics primitives sage: (S / 2 / 3) == (S / 6) == (S / 3 / 2) True @@ -619,7 +619,7 @@ cdef class PeriodicRegion: sage: S = PeriodicRegion(CDF(1), CDF(I+1/2), data) sage: S.innermost_point() 0.375 + 0.25*I - sage: S.plot() + point(S.innermost_point()) + sage: S.plot() + point(S.innermost_point()) # needs sage.plot Graphics object consisting of 24 graphics primitives """ if self.is_empty(): @@ -646,7 +646,7 @@ cdef class PeriodicRegion: sage: data[2:5, 2] = True sage: data[3, 3] = True sage: S = PeriodicRegion(CDF(1), CDF(I + 1/2), data) - sage: plot(S) + plot(S.expand(), rgbcolor=(1, 0, 1), thickness=2) + sage: plot(S) + plot(S.expand(), rgbcolor=(1, 0, 1), thickness=2) # needs sage.plot Graphics object consisting of 46 graphics primitives """ from sage.plot.line import line diff --git a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py index 4bdaed4f3c7..9c23d9952f7 100644 --- a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py +++ b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py @@ -535,16 +535,17 @@ def _comparison_impl(left, right, op): sage: w1 == w2 False - sage: E = EllipticCurve_from_j(GF(7)(0)) # needs sage.rings.finite_rings - sage: F = E.change_weierstrass_model(2,3,4,5) # needs sage.rings.finite_rings - sage: a = E.isomorphisms(F) # needs sage.rings.finite_rings - sage: b = [w*a[0] for w in F.automorphisms()] # needs sage.rings.finite_rings - sage: b.sort() # needs sage.rings.finite_rings - sage: a == b # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 True - sage: c = [a[0]*w for w in E.automorphisms()] # needs sage.rings.finite_rings - sage: c.sort() # needs sage.rings.finite_rings - sage: a == c # needs sage.rings.finite_rings + sage: c = [a[0]*w for w in E.automorphisms()] + sage: c.sort() + sage: a == c True """ if not isinstance(left, WeierstrassIsomorphism) or not isinstance(right, WeierstrassIsomorphism): @@ -589,18 +590,19 @@ def _eval(self, P): EXAMPLES:: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: E = EllipticCurve([i, 0]); E # needs sage.rings.number_field + 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)) # needs sage.rings.number_field - sage: P = E.change_ring(QQbar).lift_x(QQbar.random_element()) # needs sage.rings.number_field - sage: Q = iso._eval(P) # needs sage.rings.number_field - sage: Q.curve() # needs sage.rings.number_field + 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 # needs sage.rings.number_field - sage: iso._eval((0, y, 0)) == 0 # needs sage.rings.number_field + sage: y = next(filter(bool, iter(QQbar.random_element, None))) # sample until nonzero + sage: iso._eval((0, y, 0)) == 0 True """ if self._domain.defining_polynomial()(*P): @@ -637,14 +639,15 @@ def __call__(self, P): Check that copying the order over works:: - sage: E = EllipticCurve(GF(431^2), [1,0]) # needs sage.rings.finite_rings - sage: i = next(a for a in E.automorphisms() if a^2 == -a^24) # needs sage.rings.finite_rings - sage: P,_ = E.gens() # needs sage.rings.finite_rings - sage: P._order # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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 432 - sage: i(P)._order # needs sage.rings.finite_rings + sage: i(P)._order 432 - sage: E(i(P))._order # needs sage.rings.finite_rings + sage: E(i(P))._order 432 """ if P[2] == 0: @@ -768,11 +771,12 @@ def rational_maps(self): :: - sage: E = EllipticCurve(GF(65537), [1,1,1,1,1]) # needs sage.rings.finite_rings - sage: w = E.isomorphism_to(E.short_weierstrass_model()) # needs sage.rings.finite_rings - sage: f,g = w.rational_maps() # needs sage.rings.finite_rings - sage: P = E.random_point() # needs sage.rings.finite_rings - sage: w(P).xy() == (f(P.xy()), g(P.xy())) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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())) True TESTS: @@ -906,15 +910,16 @@ def __neg__(self): :: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: K. = QuadraticField(-3) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0,1]) # needs sage.rings.number_field - sage: w = WeierstrassIsomorphism(E, (CyclotomicField(3).gen(),0,0,0)) # needs sage.rings.number_field - sage: w.tuple() # needs sage.rings.number_field + sage: K. = QuadraticField(-3) + sage: E = EllipticCurve(K, [0,1]) + sage: w = WeierstrassIsomorphism(E, (CyclotomicField(3).gen(),0,0,0)) + sage: w.tuple() (1/2*a - 1/2, 0, 0, 0) - sage: (-w).tuple() # needs sage.rings.number_field + sage: (-w).tuple() (-1/2*a + 1/2, 0, 0, 0) - sage: (-w)^3 == -(w^3) # needs sage.rings.number_field + sage: (-w)^3 == -(w^3) True :: diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index 706ee27fab1..8fc429b98d9 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -47,7 +47,7 @@ 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 - sage: V.dimension() + sage: V.dimension() # needs sage.libs.singular 1 Here is a more complicated example in a projective space:: @@ -55,14 +55,14 @@ sage: P3 = ProjectiveSpace(3, QQ, 'x') sage: P3.inject_variables() Defining x0, x1, x2, x3 - sage: Q = matrix([[x0, x1, x2], [x1, x2, x3]]).minors(2); Q + sage: Q = matrix([[x0, x1, x2], [x1, x2, x3]]).minors(2); Q # needs sage.modules [-x1^2 + x0*x2, -x1*x2 + x0*x3, -x2^2 + x1*x3] - sage: twisted_cubic = P3.subscheme(Q); twisted_cubic + sage: twisted_cubic = P3.subscheme(Q); twisted_cubic # needs sage.libs.singular sage.modules 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 - sage: twisted_cubic.dimension() + sage: twisted_cubic.dimension() # needs sage.libs.singular sage.modules 1 Note that there are 3 equations in the 3-dimensional ambient space, @@ -72,13 +72,12 @@ Let us look at one affine patch, for example the one where `x_0=1` :: - sage: patch = twisted_cubic.affine_patch(0) - sage: patch + sage: patch = twisted_cubic.affine_patch(0); patch # needs sage.libs.singular sage.modules 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() + sage: patch.embedding_morphism() # needs sage.libs.singular 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 @@ -279,9 +278,9 @@ def is_projective(self): projective spaces. This is why this method returns ``False`` for toric varieties:: - sage: PP. = toric_varieties.P(3) + sage: PP. = toric_varieties.P(3) # needs sage.geometry.polyhedron sage: V = PP.subscheme(x^3 + y^3 + z^3 + w^3) - sage: V.is_projective() + sage: V.is_projective() # needs sage.geometry.polyhedron False """ return self.ambient_space().is_projective() @@ -381,15 +380,15 @@ def embedding_morphism(self): sage: A2. = AffineSpace(QQ, 2) sage: C = A2.subscheme(x^2 + y^2 - 1) - sage: C.embedding_morphism() + sage: C.embedding_morphism() # needs sage.libs.singular Scheme morphism: 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) - sage: P1xP1. = toric_varieties.P1xP1() - sage: P1 = P1xP1.subscheme(x - y) - sage: P1.embedding_morphism() + sage: P1xP1. = toric_varieties.P1xP1() # needs sage.geometry.polyhedron + sage: P1 = P1xP1.subscheme(x - y) # needs sage.geometry.polyhedron sage.libs.singular + sage: P1.embedding_morphism() # needs sage.geometry.polyhedron sage.libs.singular Scheme morphism: From: Closed subscheme of 2-d CPR-Fano toric variety covered by 4 affine patches defined by: x - y @@ -402,8 +401,7 @@ def embedding_morphism(self): sage: P2. = ProjectiveSpace(QQ, 2) sage: X = P2.subscheme((x^2-y^2)*z) sage: p = (1,1,0) - sage: nbhd = X.neighborhood(p) - sage: nbhd + sage: nbhd = X.neighborhood(p); nbhd Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: -y^2*z - 2*y*z @@ -429,17 +427,18 @@ def embedding_morphism(self): A couple more examples:: - sage: patch1 = P1xP1.affine_patch(1); patch1 # optional - sage.geometry.polyhedron + sage: # needs sage.geometry.polyhedron + sage: patch1 = P1xP1.affine_patch(1); patch1 2-d affine toric variety - sage: patch1.embedding_morphism() # optional - sage.geometry.polyhedron sage.libs.singular + sage: patch1.embedding_morphism() # needs sage.libs.singular 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] - sage: subpatch = P1.affine_patch(1); subpatch # optional - sage.geometry.polyhedron sage.libs.singular + sage: subpatch = P1.affine_patch(1); subpatch # needs sage.libs.singular Closed subscheme of 2-d affine toric variety defined by: -y + 1 - sage: subpatch.embedding_morphism() # optional - sage.geometry.polyhedron sage.libs.singular + sage: subpatch.embedding_morphism() # needs sage.libs.singular Scheme morphism: From: Closed subscheme of 2-d affine toric variety defined by: -y + 1 To: Closed subscheme of 2-d CPR-Fano toric variety covered @@ -544,18 +543,19 @@ def _homset(self, *args, **kwds): EXAMPLES:: - sage: P1. = toric_varieties.P1() # optional - sage.geometry.polyhedron - sage: type(P1.Hom(P1)) # optional - sage.geometry.polyhedron + sage: # needs sage.geometry.polyhedron + sage: P1. = toric_varieties.P1() + sage: type(P1.Hom(P1)) - sage: X = P1.subscheme(x - y) # optional - sage.geometry.polyhedron - sage: type(X.Hom(X)) # optional - sage.geometry.polyhedron + sage: X = P1.subscheme(x - y) + sage: type(X.Hom(X)) :: - sage: P1xP1 = toric_varieties.P1xP1() # optional - sage.geometry.polyhedron - sage: P1 = toric_varieties.P1() # optional - sage.geometry.polyhedron - sage: P1xP1._homset(P1xP1, P1) # optional - sage.geometry.polyhedron + sage: P1xP1 = toric_varieties.P1xP1() # needs sage.geometry.polyhedron + sage: P1 = toric_varieties.P1() # needs sage.geometry.polyhedron + sage: P1xP1._homset(P1xP1, P1) # needs sage.geometry.polyhedron 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 @@ -849,7 +849,7 @@ def rational_points(self, **kwds): sage: U = T.complement(S) sage: U.rational_points() [(2, 4), (3, 2), (4, 2), (5, 4), (6, 1)] - sage: U.rational_points(F=GF(7^2, 'b')) # optional - sage.rings.finite_rings + sage: U.rational_points(F=GF(7^2, 'b')) # needs 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), @@ -998,7 +998,7 @@ def base_extend(self, R): sage: P. = ProjectiveSpace(2, GF(11)) sage: S = P.subscheme([x^2 - y*z]) - sage: S.base_extend(GF(11^2, 'b')) # optional - sage.rings.finite_rings + sage: S.base_extend(GF(11^2, 'b')) # needs 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 @@ -1019,7 +1019,7 @@ def __richcmp__(self, other, op): sage: X = A.subscheme([x*y, z]) sage: X == A.subscheme([z, x*y]) True - sage: X == A.subscheme([x*y, z^2]) + sage: X == A.subscheme([x*y, z^2]) # needs sage.libs.singular False sage: B. = AffineSpace(3, QQ) sage: X == B.subscheme([u*v, t]) @@ -1039,16 +1039,16 @@ def _latex_(self): EXAMPLES:: sage: P. = ProjectiveSpace(2, GF(11)) - sage: S = P.subscheme([x^2 - y*z]); S # optional - sage.libs.singular + sage: S = P.subscheme([x^2 - y*z]); S Closed subscheme of Projective Space of dimension 2 over Finite Field of size 11 defined by: x^2 - y*z - sage: S._latex_() # optional - sage.libs.singular + sage: S._latex_() '\\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]); S # optional - sage.libs.singular + sage: S = P.subscheme([x^2 - y*z, x^5]); S 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_() # optional - sage.libs.singular + sage: S._latex_() '\\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()) @@ -1064,16 +1064,16 @@ def _repr_(self): EXAMPLES:: sage: P. = ProjectiveSpace(2, GF(11)) - sage: S = P.subscheme([x^2 - y*z]); S # optional - sage.libs.singular + sage: S = P.subscheme([x^2 - y*z]); S Closed subscheme of Projective Space of dimension 2 over Finite Field of size 11 defined by: x^2 - y*z - sage: S._repr_() # optional - sage.libs.singular + sage: S._repr_() '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]); S # optional - sage.libs.singular + sage: S = P.subscheme([x^2 - y*z, x^5]); S 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_() # optional - sage.libs.singular + sage: S._repr_() '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()) @@ -1178,9 +1178,9 @@ def codimension(self): sage: PP. = ProjectiveSpace(4, QQ) sage: V = PP.subscheme(x*y) - sage: V.codimension() + sage: V.codimension() # needs sage.libs.singular 1 - sage: V.dimension() + sage: V.dimension() # needs sage.libs.singular 3 """ return self.ambient_space().dimension() - self.dimension() @@ -1203,8 +1203,8 @@ 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.irreducible_components() + 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() # needs sage.libs.singular [ Closed subscheme of Projective Space of dimension 4 over Rational Field defined by: w, @@ -1224,7 +1224,7 @@ def irreducible_components(self): sage: R = f.parent() sage: I = [f] + [f.derivative(zz) for zz in PP.gens()] sage: V = PP.subscheme(I) - sage: V.irreducible_components() + sage: V.irreducible_components() # needs sage.libs.singular [ ] @@ -1235,7 +1235,7 @@ def irreducible_components(self): sage: AA. = AffineSpace(4, QQ) sage: V = AA.subscheme(I) - sage: V.irreducible_components() + sage: V.irreducible_components() # needs sage.libs.singular [ Closed subscheme of Affine Space of dimension 4 over Rational Field defined by: w, @@ -1275,17 +1275,18 @@ def is_irreducible(self): EXAMPLES:: - 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 + sage: # needs sage.rings.number_field + 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() True :: sage: P. = ProjectiveSpace(QQ, 2) sage: X = P.subscheme([(y + x - z)^2]) - sage: X.is_irreducible() + sage: X.is_irreducible() # needs sage.libs.singular False :: @@ -1295,7 +1296,7 @@ def is_irreducible(self): ....: 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 + sage: X.is_irreducible() # needs sage.rings.finite_rings False """ return self.defining_ideal().is_prime() @@ -1312,8 +1313,9 @@ 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.Jacobian_matrix() + sage: twisted_cubic = P3.subscheme(matrix([[w, x, y], # needs sage.libs.singular + ....: [x, y, z]]).minors(2)) + sage: twisted_cubic.Jacobian_matrix() # needs sage.libs.singular [ y -2*x w 0] [ z -y -x w] [ 0 z -2*y x] @@ -1321,7 +1323,7 @@ def Jacobian_matrix(self): This example addresses issue :trac:`20512`:: sage: X = P3.subscheme([]) - sage: X.Jacobian_matrix().base_ring() == P3.coordinate_ring() + sage: X.Jacobian_matrix().base_ring() == P3.coordinate_ring() # needs sage.libs.singular True """ R = self.ambient_space().coordinate_ring() @@ -1351,20 +1353,21 @@ 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.Jacobian() + sage: twisted_cubic = P3.subscheme(matrix([[w, x, y], # needs sage.libs.singular + ....: [x, y, z]]).minors(2)) + sage: twisted_cubic.Jacobian() # needs sage.libs.singular 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() + sage: twisted_cubic.defining_ideal() # needs sage.libs.singular 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`:: sage: X = P3.subscheme([]) - sage: X.Jacobian() == P3.coordinate_ring().unit_ideal() + sage: X.Jacobian() == P3.coordinate_ring().unit_ideal() # needs sage.libs.singular True """ d = self.codimension() @@ -1386,18 +1389,19 @@ def reduce(self): Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x^5 - 3*x^4*y + 3*x^3*y^2 - x^2*y^3 - 2*x^4 + 6*x^3*y - 6*x^2*y^2 + 2*x*y^3 + x^3 - 3*x^2*y + 3*x*y^2 - y^3 - sage: X.dimension() + sage: X.dimension() # needs sage.libs.singular 1 Then we compute the corresponding reduced scheme:: - sage: Y = X.reduce(); Y + sage: Y = X.reduce(); Y # needs sage.libs.singular Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x^2 - x*y - x + y Finally, we verify that the reduced scheme `Y` is the union of those two lines:: + sage: # needs sage.libs.singular sage: L1 = A.subscheme([x - 1]); L1 Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x - 1 @@ -1434,28 +1438,28 @@ def union(self, other): sage: I = ideal([x, y])^3 sage: P = A.subscheme(I) sage: L = A.subscheme([y - 1]) - sage: S = L.union(P); S + sage: S = L.union(P); S # needs sage.libs.singular 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 - sage: S.dimension() + sage: S.dimension() # needs sage.libs.singular 1 - sage: S.reduce() + sage: S.reduce() # needs sage.libs.singular Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: y^2 - y, x*y - x We can also use the notation "+" for the union:: - sage: A.subscheme([x]) + A.subscheme([y^2 - (x^3+1)]) + sage: A.subscheme([x]) + A.subscheme([y^2 - (x^3+1)]) # needs sage.libs.singular Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x^4 - x*y^2 + x Saving and loading:: - sage: loads(S.dumps()) == S + sage: loads(S.dumps()) == S # needs sage.libs.singular True """ if not isinstance(other, AlgebraicScheme_subscheme): @@ -1509,8 +1513,8 @@ def __pow__(self, m): -x1*x3 + x0*x4, -x7*x9 + x6*x10 - sage: E = EllipticCurve([0,0,0,0,1]) - sage: E^2 + sage: E = EllipticCurve([0,0,0,0,1]) # needs sage.schemes + sage: E^2 # needs sage.schemes Closed subscheme of Product of projective spaces P^2 x P^2 over Rational Field defined by: -x0^3 + x1^2*x2 - x2^3, @@ -1761,17 +1765,17 @@ 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) # 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 + sage: K. = NumberField(u^2 + 3) # needs sage.rings.number_field + sage: A. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: X = A.subscheme(x^2 - y^2) # needs sage.rings.number_field + sage: X.rational_points(bound=3) # needs sage.rings.number_field [(-1 : 1), (1 : 1)] One can enumerate points up to a given bound on a projective scheme over the rationals:: - sage: E = EllipticCurve('37a') - sage: E.rational_points(bound=8) + sage: E = EllipticCurve('37a') # needs sage.schemes + sage: E.rational_points(bound=8) # needs sage.schemes [(-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)] @@ -1779,8 +1783,8 @@ 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)) # optional - sage.rings.finite_rings - sage: Etilde.rational_points() # optional - sage.rings.finite_rings + sage: Etilde = E.base_extend(GF(3)) # needs sage.rings.finite_rings sage.schemes + sage: Etilde.rational_points() # needs sage.rings.finite_rings sage.schemes [(0 : 0 : 1), (0 : 1 : 0), (0 : 2 : 1), (1 : 0 : 1), (1 : 2 : 1), (2 : 0 : 1), (2 : 2 : 1)] @@ -1789,26 +1793,28 @@ def rational_points(self, **kwds): sage: FF = FiniteField(7) sage: P. = PolynomialRing(FiniteField(7)) - sage: C = HyperellipticCurve(x^8 + x + 1) # optional - sage.rings.finite_rings sage.schemes - sage: C.rational_points() # optional - sage.rings.finite_rings sage.schemes + sage: C = HyperellipticCurve(x^8 + x + 1) # needs sage.rings.finite_rings sage.schemes + sage: C.rational_points() # needs sage.rings.finite_rings sage.schemes [(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) # 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 + sage: # needs sage.rings.number_field + 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) [(-3.00000000000000 : -0.577350269189626*I : 1.00000000000000), (0.000000000000000 : 1.00000000000000 : 0.000000000000000)] :: - 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 + sage: # needs sage.rings.number_field + 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) [(1.73205080756888, 1.00000000000000)] .. TODO:: @@ -1853,31 +1859,33 @@ 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)) # optional - sage.rings.finite_rings + sage: X.change_ring(GF(3)) Closed subscheme of Projective Space of dimension 1 over Finite Field of size 3 defined by: -y^2 :: - 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 + sage: # needs sage.rings.number_field + 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) # needs sage.libs.singular + sage: X.change_ring(L) # needs sage.libs.singular 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) # 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 + sage: # needs sage.rings.number_field + 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]) # needs sage.libs.singular + sage: emb = L.embeddings(QQbar) # needs sage.libs.singular + sage: X.change_ring(emb[0]) # needs sage.libs.singular Closed subscheme of Affine Space of dimension 3 over Algebraic Field defined by: x + (-1.414213562373095? + 0.?e-16*I)*y, @@ -1885,13 +1893,14 @@ def change_ring(self, R): :: - 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 + sage: # needs sage.rings.number_field + 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]) # needs sage.libs.singular + sage: emb = L.embeddings(QQbar) # needs sage.libs.singular + sage: X.change_ring(emb[1]) # needs sage.libs.singular Closed subscheme of Affine Space of dimension 3 over Algebraic Field defined by: x + (-1.414213562373095? + 0.?e-16*I)*y, @@ -1899,35 +1908,38 @@ def change_ring(self, R): :: - 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 + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(-3) + sage: P. = ProjectiveSpace(K, 1) + sage: X = P.subscheme(x - w*y) # needs sage.libs.singular + sage: X.change_ring(CC) # needs sage.libs.singular 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) # 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 + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(3) + sage: P. = ProjectiveSpace(K, 1) + sage: X = P.subscheme(x - w*y) # needs sage.libs.singular + sage: X.change_ring(RR) # needs sage.libs.singular 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) # 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 + sage: # needs sage.rings.number_field + sage: K. = CyclotomicField(7) + sage: O = K.maximal_order() + sage: P. = ProjectiveSpace(O, 1) + sage: X = P.subscheme([x^2 + O(v)*y^2]) # needs sage.libs.singular + sage: X.change_ring(CC) # needs sage.libs.singular 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 + sage: X.change_ring(K).change_ring(K.embeddings(QQbar)[3]) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 1 over Algebraic Field defined by: x^2 + (-0.9009688679024191? - 0.4338837391175581?*I)*y^2 @@ -1936,11 +1948,11 @@ def change_ring(self, R): sage: R. = QQ[] 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 + sage: L. = NumberField(f, embedding=f.roots(CC)[2][0]) # needs sage.rings.number_field + sage: A. = AffineSpace(L, 2) # needs sage.rings.number_field + sage: H = Hom(A, A) # needs sage.rings.number_field + sage: X = A.subscheme([b*x^2, y^2]) # needs sage.libs.singular sage.rings.number_field + sage: X.change_ring(CC) # needs sage.libs.singular 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, @@ -1987,24 +1999,24 @@ def weil_restriction(self): EXAMPLES:: sage: R. = QQ[] - 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 + sage: K. = NumberField(x^5 - 2) # needs sage.rings.number_field + sage: R. = K[] # needs sage.rings.number_field + sage: L. = K.extension(x^2 + 1) # needs sage.rings.number_field + sage: A. = AffineSpace(L, 2) # needs sage.rings.number_field + sage: X = A.subscheme([y^2 - L(w)*x^3 - v]) # needs sage.libs.singular sage.rings.number_field + sage: X.weil_restriction() # needs sage.libs.singular 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() # optional - sage.rings.number_field + sage: X.weil_restriction().ambient_space() is A.weil_restriction() # needs sage.libs.singular sage.rings.number_field True :: - 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 + sage: A. = AffineSpace(GF(5^2, 't'), 3) # needs sage.rings.finite_rings + sage: X = A.subscheme([y^2 - x*z, z^2 + 2*y]) # needs sage.libs.singular sage.rings.finite_rings + sage: X.weil_restriction() # needs sage.libs.singular 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, @@ -2062,8 +2074,9 @@ 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: X.specialization(phi=phi) + sage: phi = SpecializationMorphism(P.coordinate_ring(), + ....: dict({c: 2, a: 1})) + sage: X.specialization(phi=phi) # needs sage.libs.singular 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 diff --git a/src/sage/schemes/generic/ambient_space.py b/src/sage/schemes/generic/ambient_space.py index b0ae7fe4ec5..d22ea07d149 100644 --- a/src/sage/schemes/generic/ambient_space.py +++ b/src/sage/schemes/generic/ambient_space.py @@ -148,7 +148,7 @@ def _validate(self, polynomials): sage: from sage.schemes.generic.ambient_space import AmbientSpace sage: A = AmbientSpace(3, ZZ) - sage: A._validate((x + 1, 1)) + sage: A._validate((x + 1, 1)) # needs sage.symbolic Traceback (most recent call last): ... NotImplementedError: ambient spaces must override "_validate" method! diff --git a/src/sage/schemes/generic/divisor.py b/src/sage/schemes/generic/divisor.py index 9124b3cfb90..6a617309c5a 100644 --- a/src/sage/schemes/generic/divisor.py +++ b/src/sage/schemes/generic/divisor.py @@ -13,22 +13,23 @@ EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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 [(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 # 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 + 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() True - sage: D = D1 - D2 + D3; D # optional - sage.rings.finite_rings + sage: D = D1 - D2 + D3; D 3*(x, y) - (x, z) + 10*(x + 2*z, y + z) - sage: D[1][0] # optional - sage.rings.finite_rings + sage: D[1][0] -1 - sage: D[1][1] # optional - sage.rings.finite_rings + sage: D[1][1] 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])]) # optional - sage.rings.finite_rings + sage: C.divisor([(3, pts[0]), (-1, pts[1]), (10, pts[5])]) 3*(x, y) - (x, z) + 10*(x + 2*z, y + z) """ #******************************************************************************* @@ -107,9 +108,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() # 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 + sage: x,y = AffineSpace(2, GF(5), names='xy').gens() + sage: C = Curve(y^2 - x^9 - x) # needs sage.rings.finite_rings + sage: is_Divisor(C.divisor([])) # needs sage.rings.finite_rings True sage: is_Divisor("Ceci n'est pas un diviseur") False @@ -223,13 +224,14 @@ def scheme(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: A. = AffineSpace(2, GF(5)) + sage: C = Curve(y^2 - x^9 - x) + sage: pts = C.rational_points(); pts [(0, 0), (2, 2), (2, 3), (3, 1), (3, 4)] - sage: D = C.divisor(pts[0])*3 - C.divisor(pts[1]); D # optional - sage.rings.finite_rings + sage: D = C.divisor(pts[0])*3 - C.divisor(pts[1]); D 3*(x, y) - (x - 2, y - 2) - sage: D.scheme() # optional - sage.rings.finite_rings + sage: D.scheme() Affine Plane Curve over Finite Field of size 5 defined by -x^9 + y^2 - x """ return self.parent().scheme() @@ -369,31 +371,33 @@ def support(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: x,y = AffineSpace(2, GF(5), names='xy').gens() + sage: C = Curve(y^2 - x^9 - x) + sage: pts = C.rational_points(); pts [(0, 0), (2, 2), (2, 3), (3, 1), (3, 4)] - sage: D = C.divisor_group()([(3, pts[0]), (-1, pts[1])]); D # optional - sage.rings.finite_rings + sage: D = C.divisor_group()([(3, pts[0]), (-1, pts[1])]); D 3*(x, y) - (x - 2, y - 2) - sage: D.support() # optional - sage.rings.finite_rings + sage: D.support() [(0, 0), (2, 2)] TESTS: This checks that :trac:`10732` is fixed:: - 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 + sage: # needs sage.rings.finite_rings + 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() [(0 : 4 : 1)] - sage: (D + D).support() # optional - sage.rings.finite_rings + sage: (D + D).support() [(0 : 4 : 1)] - 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 + sage: E = C.divisor([(-3, pts[1]), (1, pts[2])]) + sage: (D - 2*E).support() [(0 : 4 : 1), (1 : 2 : 1), (2 : 1 : 1)] - sage: (D - D).support() # optional - sage.rings.finite_rings + sage: (D - D).support() [] """ try: @@ -417,18 +421,19 @@ def coefficient(self, P): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: x,y = AffineSpace(2, GF(5), names='xy').gens() + sage: C = Curve(y^2 - x^9 - x) + sage: pts = C.rational_points(); pts [(0, 0), (2, 2), (2, 3), (3, 1), (3, 4)] - sage: D = C.divisor(pts[0]) # optional - sage.rings.finite_rings - sage: D.coefficient(pts[0]) # optional - sage.rings.finite_rings + sage: D = C.divisor(pts[0]) + sage: D.coefficient(pts[0]) 1 - sage: D = C.divisor([(3, pts[0]), (-1, pts[1])]); D # optional - sage.rings.finite_rings + sage: D = C.divisor([(3, pts[0]), (-1, pts[1])]); D 3*(x, y) - (x - 2, y - 2) - sage: D.coefficient(pts[0]) # optional - sage.rings.finite_rings + sage: D.coefficient(pts[0]) 3 - sage: D.coefficient(pts[1]) # optional - sage.rings.finite_rings + sage: D.coefficient(pts[1]) -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 a4dc84b7967..5dfd66a1bb9 100644 --- a/src/sage/schemes/generic/divisor_group.py +++ b/src/sage/schemes/generic/divisor_group.py @@ -209,10 +209,10 @@ def _an_element_(self): EXAMPLES:: - sage: A. = AffineSpace(2, CC) # optional - sage.rings.real_mpfr - sage: C = Curve(y^2 - x^9 - x) # optional - sage.rings.real_mpfr sage.schemes + sage: A. = AffineSpace(2, CC) # needs sage.rings.real_mpfr + sage: C = Curve(y^2 - x^9 - x) # needs sage.rings.real_mpfr sage.schemes sage: from sage.schemes.generic.divisor_group import DivisorGroup - sage: DivisorGroup(C).an_element() # indirect test # optional - sage.rings.real_mpfr sage.schemes + sage: DivisorGroup(C).an_element() # indirect test # needs sage.rings.real_mpfr sage.schemes 0 """ return self._scheme.divisor([], base_ring=self.base_ring(), check=False, reduce=False) @@ -229,9 +229,9 @@ def base_extend(self, R): Divisor groups are unique:: - sage: A. = AffineSpace(2, CC) # optional - sage.rings.real_mpfr - sage: C = Curve(y^2 - x^9 - x) # optional - sage.rings.real_mpfr sage.schemes - sage: DivisorGroup(C, ZZ).base_extend(QQ) is DivisorGroup(C, QQ) # optional - sage.rings.real_mpfr sage.schemes + sage: A. = AffineSpace(2, CC) # needs sage.rings.real_mpfr + sage: C = Curve(y^2 - x^9 - x) # needs sage.rings.real_mpfr sage.schemes + sage: DivisorGroup(C, ZZ).base_extend(QQ) is DivisorGroup(C, QQ) # needs sage.rings.real_mpfr sage.schemes True """ if self.base_ring().has_coerce_map_from(R): @@ -252,15 +252,15 @@ def _element_constructor_(self, x, check=True, reduce=True): EXAMPLES:: sage: # needs sage.rings.real_mpfr sage.schemes - sage: A. = AffineSpace(2, CC) # optional - sage.rings.real_mpfr - sage: C = Curve(y^2 - x^9 - x) # optional - sage.rings.real_mpfr - sage: DivZZ = C.divisor_group(ZZ) # optional - sage.rings.real_mpfr - sage: DivQQ = C.divisor_group(QQ) # optional - sage.rings.real_mpfr - sage: DivQQ(DivQQ.an_element()) # indirect test # optional - sage.rings.real_mpfr + sage: A. = AffineSpace(2, CC) + sage: C = Curve(y^2 - x^9 - x) + sage: DivZZ = C.divisor_group(ZZ) + sage: DivQQ = C.divisor_group(QQ) + sage: DivQQ(DivQQ.an_element()) # indirect test 0 - sage: DivZZ(DivZZ.an_element()) # indirect test # optional - sage.rings.real_mpfr + sage: DivZZ(DivZZ.an_element()) # indirect test 0 - sage: DivQQ(DivZZ.an_element()) # indirect test # optional - sage.rings.real_mpfr + sage: DivQQ(DivZZ.an_element()) # indirect test 0 """ if isinstance(x, Divisor_curve): diff --git a/src/sage/schemes/generic/homset.py b/src/sage/schemes/generic/homset.py index 208aa902d91..cb18ea1dfba 100644 --- a/src/sage/schemes/generic/homset.py +++ b/src/sage/schemes/generic/homset.py @@ -473,8 +473,8 @@ def _coerce_map_from_(self, other): :: sage: P = ProjectiveSpace(QQ, 1, 'x') - sage: P2 = ProjectiveSpace(CC, 1, 'y') - sage: P2(CC)._coerce_map_from_(P(QQ)) + sage: P2 = ProjectiveSpace(CC, 1, 'y') # needs sage.rings.real_mpfr + sage: P2(CC)._coerce_map_from_(P(QQ)) # needs sage.rings.real_mpfr False :: @@ -484,13 +484,13 @@ def _coerce_map_from_(self, other): sage: L = A.subscheme([z, y + z]) sage: A(QQ)._coerce_map_from_(H(QQ)) True - sage: H(QQ)._coerce_map_from_(L(QQ)) + sage: H(QQ)._coerce_map_from_(L(QQ)) # needs sage.libs.singular True - sage: L(QQ).has_coerce_map_from(H(QQ)) + sage: L(QQ).has_coerce_map_from(H(QQ)) # needs sage.libs.singular False - sage: A(CC)._coerce_map_from_(H(QQ)) + sage: A(CC)._coerce_map_from_(H(QQ)) # needs sage.rings.real_mpfr True - sage: H(CC)._coerce_map_from_(L(RR)) + sage: H(CC)._coerce_map_from_(L(RR)) # needs sage.libs.singular sage.rings.real_mpfr True :: @@ -516,10 +516,10 @@ def _coerce_map_from_(self, other): :: sage: PS = ProjectiveSpace(ZZ, 1, 'x') - 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 + sage: PS2 = ProjectiveSpace(Zp(7), 1, 'x') # needs sage.rings.padics + sage: PS(ZZ).has_coerce_map_from(PS2(Zp(7))) # needs sage.rings.padics False - sage: PS2(Zp(7)).has_coerce_map_from(PS(ZZ)) # optional - sage.rings.padics + sage: PS2(Zp(7)).has_coerce_map_from(PS(ZZ)) # needs sage.rings.padics True :: @@ -536,10 +536,11 @@ def _coerce_map_from_(self, other): :: - 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 + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(2) + sage: A. = AffineSpace(QQ, 3) + sage: H = A.subscheme(z) + sage: A(K).has_coerce_map_from(H(QQ)) True TESTS:: @@ -552,8 +553,8 @@ def _coerce_map_from_(self, other): :: sage: A = AffineSpace(QQ, 1, 'x') - sage: AC = AffineSpace(CC, 1, 'x') - sage: A(3/2) == AC(3/2) + sage: AC = AffineSpace(CC, 1, 'x') # needs sage.rings.real_mpfr + sage: A(3/2) == AC(3/2) # needs sage.rings.real_mpfr True :: @@ -639,16 +640,16 @@ def _element_constructor_(self, *v, **kwds): (2, 2) sage: P2 = ProjectiveSpace(GF(3), 2) - sage: F. = GF(9, 'a') # optional - sage.rings.finite_rings + sage: F. = GF(9, 'a') # needs sage.rings.finite_rings sage: F_points = P2(F) sage: type(F_points) - sage: F_points([4,2*a]) # optional - sage.rings.finite_rings + sage: F_points([4,2*a]) # needs sage.rings.finite_rings (1 : 2*a : 1) TESTS:: - sage: F_points._element_constructor_([4,2*a]) # optional - sage.rings.finite_rings + sage: F_points._element_constructor_([4,2*a]) # needs sage.rings.finite_rings (1 : 2*a : 1) """ if len(v) == 1: @@ -669,15 +670,15 @@ def extended_codomain(self): sage: P2 = ProjectiveSpace(QQ, 2) sage: x = polygen(ZZ, 'x') - 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 + sage: K. = NumberField(x^2 + x - (3^3-3)) # needs sage.rings.number_field + sage: K_points = P2(K); K_points # needs 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() # optional - sage.rings.number_field + sage: K_points.codomain() # needs sage.rings.number_field Projective Space of dimension 2 over Rational Field - sage: K_points.extended_codomain() # optional - sage.rings.number_field + sage: K_points.extended_codomain() # needs sage.rings.number_field Projective Space of dimension 2 over Number Field in a with defining polynomial x^2 + x - 24 """ @@ -736,11 +737,11 @@ def cardinality(self): EXAMPLES:: - sage: toric_varieties.P2().point_set().cardinality() + sage: toric_varieties.P2().point_set().cardinality() # needs sage.geometry.polyhedron +Infinity - sage: P2 = toric_varieties.P2(base_ring=GF(3)) # optional - sage.rings.finite_rings - sage: P2.point_set().cardinality() # optional - sage.rings.finite_rings + sage: P2 = toric_varieties.P2(base_ring=GF(3)) # needs sage.geometry.polyhedron sage.rings.finite_rings + sage: P2.point_set().cardinality() # needs sage.geometry.polyhedron sage.rings.finite_rings 13 """ if hasattr(self, 'is_finite') and not self.is_finite(): @@ -760,8 +761,8 @@ def list(self): EXAMPLES:: - sage: P1 = toric_varieties.P1(base_ring=GF(3)) # optional - sage.rings.finite_rings - sage: P1.point_set().list() # optional - sage.rings.finite_rings + sage: P1 = toric_varieties.P1(base_ring=GF(3)) # needs sage.geometry.polyhedron sage.rings.finite_rings + sage: P1.point_set().list() # needs sage.geometry.polyhedron sage.rings.finite_rings ([0 : 1], [1 : 0], [1 : 1], [1 : 2]) """ return tuple(self) diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index d0493a01be4..47f76e5a0a5 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -513,9 +513,9 @@ def base_ring(self): :: - 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 + sage: E = EllipticCurve(GF((17,2)), [1,2,3,4,5]) # needs sage.rings.finite_rings + sage: P = E.random_point() # needs sage.rings.finite_rings + sage: P.base_ring() # needs sage.rings.finite_rings Finite Field in z2 of size 17^2 """ return self.domain().base_ring() @@ -622,28 +622,27 @@ def glue_along_domains(self, other): minus a point:: sage: R. = PolynomialRing(QQ, 2) - sage: S. = R.quotient(x*y - 1) + sage: S. = R.quotient(x*y - 1) # needs sage.libs.singular sage: Rx = PolynomialRing(QQ, 'x') - sage: i1 = Rx.hom([xbar]) + sage: i1 = Rx.hom([xbar]) # needs sage.libs.singular sage: Ry = PolynomialRing(QQ, 'y') - sage: i2 = Ry.hom([ybar]) + sage: i2 = Ry.hom([ybar]) # needs sage.libs.singular sage: Sch = Schemes() - sage: f1 = Sch(i1) - sage: f2 = Sch(i2) + sage: f1 = Sch(i1) # needs sage.libs.singular + sage: f2 = Sch(i2) # needs sage.libs.singular Now f1 and f2 have the same domain, which is a `\mathbb{A}^1` minus a point. We glue along the domain:: - sage: P1 = f1.glue_along_domains(f2) - sage: P1 + sage: P1 = f1.glue_along_domains(f2); P1 # needs sage.libs.singular Scheme obtained by gluing X and Y along U, where 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) - sage: a, b = P1.gluing_maps() - sage: a + sage: a, b = P1.gluing_maps() # needs sage.libs.singular + sage: a # needs sage.libs.singular Affine Scheme morphism: From: Spectrum of Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x*y - 1) @@ -653,7 +652,7 @@ def glue_along_domains(self, other): To: Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x*y - 1) Defn: x |--> xbar - sage: b + sage: b # needs sage.libs.singular Affine Scheme morphism: From: Spectrum of Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x*y - 1) @@ -972,7 +971,7 @@ class SchemeMorphism_polynomial(SchemeMorphism): Some checks are performed to make sure the given polynomials define a morphism:: - sage: f = H([exp(x),exp(y)]) + sage: f = H([exp(x),exp(y)]) # needs sage.symbolic Traceback (most recent call last): ... TypeError: polys (=[e^x, e^y]) must be elements of Multivariate @@ -1343,12 +1342,12 @@ def change_ring(self, R, check=True): TESTS:: sage: R. = QQ[] - sage: K. = QuadraticField(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 + sage: K. = QuadraticField(2) # needs sage.rings.number_field + sage: K2. = NumberField(t**4 - 2) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(QQ, 1) + sage: phi = K.embeddings(K2)[0] # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x**2 + 3*y**2, y**2]) # needs sage.rings.number_field + sage: f.change_ring(phi) # needs 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) @@ -1356,13 +1355,13 @@ def change_ring(self, R, check=True): :: sage: R. = QQ[] - 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 + sage: K. = QuadraticField(2) # needs sage.rings.number_field + sage: K1. = NumberField(t^4 - 2) # needs sage.rings.number_field + sage: K2. = NumberField(t^8 - 2) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: phi = K1.embeddings(K2)[0] # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 + 3*y^2, y^2]) # needs sage.rings.number_field + sage: f.change_ring(phi) # needs sage.rings.number_field Traceback (most recent call last): ... ValueError: no canonical coercion of base ring of morphism to domain of embedding @@ -1404,8 +1403,9 @@ def change_ring(self, R, check=True): sage: A. = AffineSpace(RR, 3) 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 + sage: f.change_ring(CC) # needs sage.rings.real_mpfr + 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) @@ -1426,7 +1426,7 @@ def change_ring(self, R, check=True): 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) # optional - sage.rings.real_mpfr + sage: f.change_ring(RR) # needs sage.rings.real_mpfr 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 @@ -1435,17 +1435,17 @@ def change_ring(self, R, check=True): :: sage: R. = PolynomialRing(QQ) - 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 + sage: K. = NumberField(x^3 - x + 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: H = End(P) + sage: f = H([x^2 + a*x*y + a^2*y^2, y^2]) # needs sage.rings.number_field + sage: emb = K.embeddings(QQbar) # needs sage.rings.number_field + sage: f.change_ring(emb[0]) # needs 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]) # optional - sage.rings.number_field + sage: f.change_ring(emb[1]) # needs sage.rings.number_field Scheme endomorphism of Projective Space of dimension 1 over Algebraic Field Defn: Defined on coordinates by sending (x : y) to @@ -1454,11 +1454,12 @@ def change_ring(self, R, check=True): :: - 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 + sage: # needs sage.rings.number_field sage.symbolic + 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) Scheme endomorphism of Projective Space of dimension 1 over Algebraic Field Defn: Defined on coordinates by sending (x : y) to @@ -1468,12 +1469,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))) # 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 + sage: K. = QuadraticField(2, embedding=QQbar(-sqrt(2))) # needs sage.rings.number_field sage.symbolic + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field sage.symbolic + 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]) # needs sage.rings.number_field sage.symbolic + sage: f.change_ring(QQbar) # needs sage.rings.number_field sage.symbolic 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 @@ -1483,23 +1484,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]) # 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 + sage: L. = NumberField(f, embedding=f.roots(QQbar)[1][0]) # needs sage.rings.number_field + sage: A. = AffineSpace(L, 2) # needs sage.rings.number_field + sage: H = Hom(A, A) + sage: F = H([b*x/y, 1 + y]) # needs sage.rings.number_field + sage: F.change_ring(QQbar) # needs 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) # 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 + sage: # needs sage.rings.number_field + 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) Scheme endomorphism of Affine Space of dimension 2 over Algebraic Field Defn: Defined on coordinates by sending (x, y) to (x/y, y) """ @@ -1717,14 +1719,14 @@ def _composition_(self, other, homset): Not both defined by polynomials:: sage: x = polygen(QQ) - 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 + sage: K. = NumberField(x^2 - 2) # needs sage.rings.number_field + sage: p1, p2 = K.Hom(K) # needs sage.rings.number_field + sage: R. = K[] # needs sage.rings.number_field + sage: q1 = R.Hom(R)(p1) # needs sage.rings.number_field + sage: A = AffineSpace(R) # needs sage.rings.number_field + sage: f1 = A.Hom(A)(q1) # needs sage.rings.number_field + sage: g = A.Hom(A)([x^2 - y, y + 1]) + sage: g*f1 # needs sage.rings.number_field Composite map: From: Affine Space of dimension 2 over Number Field in a with defining polynomial x^2 - 2 @@ -1975,23 +1977,24 @@ def change_ring(self, R, check=True): :: sage: P. = ProjectiveSpace(QQ, 1) - sage: P(-2/3,1).change_ring(CC) + sage: P(-2/3,1).change_ring(CC) # needs sage.rings.real_mpfr (-0.666666666666667 : 1.00000000000000) :: sage: P. = ProjectiveSpace(ZZ, 1) - sage: P(152,113).change_ring(Zp(5)) # optional - sage.rings.padics + sage: P(152,113).change_ring(Zp(5)) # needs sage.rings.padics (2 + 5^2 + 5^3 + O(5^20) : 3 + 2*5 + 4*5^2 + O(5^20)) :: - 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 + sage: # needs sage.rings.number_field + 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]) Scheme endomorphism of Projective Space of dimension 1 over Algebraic Field Defn: Defined on coordinates by sending (x : y) to @@ -2000,31 +2003,32 @@ def change_ring(self, R, check=True): :: sage: R. = PolynomialRing(QQ) - 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 + sage: K. = NumberField(x^2 - x + 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: Q = P([a + 1, 1]) # needs sage.rings.number_field + sage: emb = K.embeddings(QQbar) # needs sage.rings.number_field + sage: Q.change_ring(emb[0]) # needs sage.rings.number_field (1.5000000000000000? - 0.866025403784439?*I : 1) - sage: Q.change_ring(emb[1]) # optional - sage.rings.number_field + sage: Q.change_ring(emb[1]) # needs sage.rings.number_field (1.5000000000000000? + 0.866025403784439?*I : 1) :: - 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 + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(2) + sage: P. = ProjectiveSpace(K, 1) + sage: Q = P([v,1]) + sage: Q.change_ring(K.embeddings(QQbar)[0]) (-1.414213562373095? : 1) :: sage: R. = QQ[] 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 + sage: L. = NumberField(f, embedding=f.roots(QQbar)[1][0]) # needs sage.rings.number_field + sage: A. = AffineSpace(L, 2) # needs sage.rings.number_field + sage: P = A([b,1]) # needs sage.rings.number_field + sage: P.change_ring(QQbar) # needs sage.rings.number_field (1.122462048309373?, 1) """ S = self.codomain().change_ring(R) diff --git a/src/sage/schemes/generic/scheme.py b/src/sage/schemes/generic/scheme.py index 52780ef4127..9fd3a79aa37 100644 --- a/src/sage/schemes/generic/scheme.py +++ b/src/sage/schemes/generic/scheme.py @@ -96,7 +96,7 @@ def __init__(self, X=None, category=None): sage: I = (x^2 - y^2)*R sage: RmodI = R.quotient(I) sage: X = Spec(RmodI) - sage: TestSuite(X).run() + sage: TestSuite(X).run() # needs sage.libs.singular """ from sage.schemes.generic.morphism import is_SchemeMorphism @@ -223,7 +223,7 @@ def __call__(self, *args): Space of dimension 2 over Rational Field:: sage: R. = PolynomialRing(QQ) - sage: A(NumberField(x^2 + 1, 'a')) # optional - sage.rings.number_field + sage: A(NumberField(x^2 + 1, 'a')) # needs 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)) @@ -326,8 +326,8 @@ def point(self, v, check=True): (4, 5) sage: R. = PolynomialRing(QQ) - sage: E = EllipticCurve([t + 1, t, t, 0, 0]) - sage: E.point([0, 0]) + sage: E = EllipticCurve([t + 1, t, t, 0, 0]) # needs sage.schemes + sage: E.point([0, 0]) # needs sage.schemes (0 : 0 : 1) """ # todo: update elliptic curve stuff to take point_homset as argument @@ -645,8 +645,8 @@ def _Hom_(self, Y, category=None, check=True): sage: S._Hom_(P).__class__ - sage: E = EllipticCurve('37a1') - sage: Hom(E, E).__class__ + sage: E = EllipticCurve('37a1') # needs sage.schemes + sage: Hom(E, E).__class__ # needs sage.schemes sage: Hom(Spec(ZZ), Spec(ZZ)).__class__ @@ -673,17 +673,17 @@ def count_points(self, n): EXAMPLES:: sage: P. = PolynomialRing(GF(3)) - sage: C = HyperellipticCurve(x^3 + x^2 + 1) # optional - sage.rings.finite_rings - sage: C.count_points(4) # optional - sage.rings.finite_rings + sage: C = HyperellipticCurve(x^3 + x^2 + 1) # needs sage.rings.finite_rings + sage: C.count_points(4) # needs sage.rings.finite_rings [6, 12, 18, 96] - sage: C.base_extend(GF(9,'a')).count_points(2) # optional - sage.rings.finite_rings + sage: C.base_extend(GF(9,'a')).count_points(2) # needs sage.rings.finite_rings [12, 96] :: - 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 + sage: P. = ProjectiveSpace(GF(4, 't'), 2) # needs sage.rings.finite_rings + sage: X = P.subscheme([y^2*z - x^3 - z^3]) # needs sage.rings.finite_rings + sage: X.count_points(2) # needs sage.rings.finite_rings [5, 17] """ F = self.base_ring() @@ -706,9 +706,9 @@ def zeta_function(self): EXAMPLES:: - 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 + sage: P. = ProjectiveSpace(GF(4, 't'), 2) # needs sage.rings.finite_rings + sage: X = P.subscheme([y^2*z - x^3 - z^3]) # needs sage.rings.finite_rings + sage: X.zeta_function() # needs sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError @@ -735,9 +735,9 @@ def zeta_series(self, n, t): EXAMPLES:: sage: P. = PolynomialRing(GF(3)) - sage: C = HyperellipticCurve(x^3 + x^2 + 1) # optional - sage.rings.finite_rings sage.schemes + sage: C = HyperellipticCurve(x^3 + x^2 + 1) # needs sage.rings.finite_rings sage.schemes sage: R. = PowerSeriesRing(Integers()) - sage: C.zeta_series(4, t) # optional - sage.rings.finite_rings + sage: C.zeta_series(4, t) # needs sage.rings.finite_rings sage.schemes 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) # optional - sage.rings.finite_rings 1 + 6*t + 24*t^2 + 78*t^3 + 240*t^4 + O(t^5) @@ -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) # optional - sage.rings.finite_rings + sage: C.base_extend(GF(9, 'a')).zeta_series(4, t) # needs sage.rings.finite_rings sage.schemes 1 + 12*t + 120*t^2 + 1092*t^3 + 9840*t^4 + O(t^5) :: - 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: P. = ProjectiveSpace(GF(4, 't'), 2) # needs sage.rings.finite_rings + sage: X = P.subscheme([y^2*z - x^3 - z^3]) # needs sage.rings.finite_rings sage: R. = PowerSeriesRing(Integers()) - sage: X.zeta_series(2, t) # optional - sage.rings.finite_rings + sage: X.zeta_series(2, t) # needs 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) # needs sage.schemes sage: R. = PowerSeriesRing(Integers()) - sage: C.zeta_series(4, t) + sage: C.zeta_series(4, t) # needs sage.schemes Traceback (most recent call last): ... TypeError: zeta functions only defined for schemes @@ -952,8 +952,9 @@ def __call__(self, *args): Point on Spectrum of Integer Ring defined by the Principal ideal (3) of Integer Ring sage: type(P) - sage: S(ZZ.ideal(next_prime(1000000))) - Point on Spectrum of Integer Ring defined by the Principal ideal (1000003) of Integer Ring + sage: S(ZZ.ideal(next_prime(1000000))) # needs sage.libs.pari + Point on Spectrum of Integer Ring + defined by the Principal ideal (1000003) of Integer Ring sage: R. = QQ[] sage: S = Spec(R) @@ -1203,8 +1204,8 @@ def hom(self, x, Y=None): sage: S. = QQ[] sage: A1. = AffineSpace(QQ, 1) - sage: A1_emb = Curve(p - 2) - sage: A1.hom([2, r], A1_emb) + sage: A1_emb = Curve(p - 2) # needs sage.schemes + sage: A1.hom([2, r], A1_emb) # needs sage.schemes 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 965958a13c6..5fa86089b61 100644 --- a/src/sage/schemes/generic/spec.py +++ b/src/sage/schemes/generic/spec.py @@ -42,10 +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 # optional - sage.rings.finite_rings + sage: X = Spec(PolynomialRing(GF(49,'a'), 3, 'x')); X # needs 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 + sage: TestSuite(X).run() # needs sage.rings.finite_rings Applying ``Spec`` twice to the same ring gives identical output (see :trac:`17008`):: @@ -60,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')) # needs sage.combinat sage.modules Traceback (most recent call last): ... TypeError: x (=Free Algebra on 2 generators (x0, x1) over Rational Field) @@ -152,7 +152,7 @@ def _apply_functor(self, A): sage: from sage.schemes.generic.spec import SpecFunctor sage: F = SpecFunctor() - sage: F(RR) # indirect doctest + sage: F(RR) # indirect doctest # needs sage.rings.real_mpfr Spectrum of Real Field with 53 bits of precision """ # The second argument of AffineScheme defaults to None. diff --git a/src/sage/schemes/hyperelliptic_curves/constructor.py b/src/sage/schemes/hyperelliptic_curves/constructor.py index 121da1bf072..f8f27e116a0 100644 --- a/src/sage/schemes/hyperelliptic_curves/constructor.py +++ b/src/sage/schemes/hyperelliptic_curves/constructor.py @@ -74,41 +74,41 @@ def HyperellipticCurve(f, h=0, names=None, PP=None, check_squarefree=True): 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[] # optional - sage.rings.finite_rings - sage: HyperellipticCurve(x^3 + x - 1, x+a) # optional - sage.rings.finite_rings + sage: k. = GF(9); R. = k[] # needs sage.rings.finite_rings + sage: HyperellipticCurve(x^3 + x - 1, x+a) # needs 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')[] # optional - sage.rings.finite_rings - sage: HyperellipticCurve(x^7 + 1, x) # optional - sage.rings.finite_rings + sage: P. = GF(8, 'a')[] # needs sage.rings.finite_rings + sage: HyperellipticCurve(x^7 + 1, x) # needs 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 + sage: HyperellipticCurve(x^8 + x^7 + 1, x^4 + 1) # needs 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) # optional - sage.rings.finite_rings + sage: HyperellipticCurve(x^8 + 1, x) # needs 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) # optional - sage.rings.finite_rings + sage: HyperellipticCurve(x^8 + x^7 + 1, x^4) # needs 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)) # 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 + sage: F. = PowerSeriesRing(FiniteField(2)) # needs sage.rings.finite_rings + sage: P. = PolynomialRing(FractionField(F)) # needs sage.rings.finite_rings + sage: HyperellipticCurve(x^5 + t, x) # needs 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[] # optional - sage.rings.finite_rings - sage: HyperellipticCurve(x^3 + x - 1, x + a, names=['X','Y']) # optional - sage.rings.finite_rings + sage: k. = GF(9); R. = k[] # needs sage.rings.finite_rings + sage: HyperellipticCurve(x^3 + x - 1, x + a, names=['X','Y']) # needs 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 @@ -125,13 +125,13 @@ def HyperellipticCurve(f, h=0, names=None, PP=None, check_squarefree=True): Double roots:: - sage: P. = GF(7)[] # optional - sage.rings.finite_rings + sage: P. = GF(7)[] # needs 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) # optional - sage.rings.finite_rings + sage: HyperellipticCurve((x^3-x+2)^2*(x^6-1), check_squarefree=False) # needs 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 @@ -156,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)[] # optional - sage.rings.finite_rings - sage: P. = F[] # optional - sage.rings.finite_rings - sage: HyperellipticCurve(x^5 + t) # optional - sage.rings.finite_rings + sage: F. = GF(5)[] # needs sage.rings.finite_rings + sage: P. = F[] # needs sage.rings.finite_rings + sage: HyperellipticCurve(x^5 + t) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Not a hyperelliptic curve: singularity in the provided affine patch. @@ -182,17 +182,18 @@ 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))) # 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 + sage: # needs sage.rings.finite_rings + 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) True Check that the inheritance is correct:: - 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 + sage: R. = PolynomialRing(GF(next_prime(10^9))) # needs sage.rings.finite_rings + sage: C = HyperellipticCurve(t^5 + t + 1) # needs sage.rings.finite_rings + sage: type(C).mro() # needs sage.rings.finite_rings [, , , diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_g2.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_g2.py index 19d767ea2f3..c9cca66eafc 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_g2.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_g2.py @@ -95,13 +95,14 @@ def clebsch_invariants(self): TESTS:: - sage: magma(HyperellipticCurve(f)).ClebschInvariants() # optional - magma + sage: # optional - magma + sage: magma(HyperellipticCurve(f)).ClebschInvariants() [ 0, -2048/375, -4096/25, -4881645568/84375 ] - sage: magma(HyperellipticCurve(f(2*x))).ClebschInvariants() # optional - magma + sage: magma(HyperellipticCurve(f(2*x))).ClebschInvariants() [ 0, -8388608/375, -1073741824/25, -5241627016305836032/84375 ] - sage: magma(HyperellipticCurve(f, x)).ClebschInvariants() # optional - magma + sage: magma(HyperellipticCurve(f, x)).ClebschInvariants() [ -8/15, 17504/5625, -23162896/140625, -420832861216768/7119140625 ] - sage: magma(HyperellipticCurve(f(2*x), 2*x)).ClebschInvariants() # optional - magma + sage: magma(HyperellipticCurve(f(2*x), 2*x)).ClebschInvariants() [ -512/15, 71696384/5625, -6072014209024/140625, -451865844002031331704832/7119140625 ] """ f, h = self.hyperelliptic_polynomials() @@ -131,13 +132,14 @@ def igusa_clebsch_invariants(self): TESTS:: - sage: magma(HyperellipticCurve(f)).IgusaClebschInvariants() # optional - magma + sage: # optional - magma + sage: magma(HyperellipticCurve(f)).IgusaClebschInvariants() [ -640, -20480, 1310720, 52160364544 ] - sage: magma(HyperellipticCurve(f(2*x))).IgusaClebschInvariants() # optional - magma + sage: magma(HyperellipticCurve(f(2*x))).IgusaClebschInvariants() [ -40960, -83886080, 343597383680, 56006764965979488256 ] - sage: magma(HyperellipticCurve(f, x)).IgusaClebschInvariants() # optional - magma + sage: magma(HyperellipticCurve(f, x)).IgusaClebschInvariants() [ -640, 17920, -1966656, 52409511936 ] - sage: magma(HyperellipticCurve(f(2*x), 2*x)).IgusaClebschInvariants() # optional - magma + sage: magma(HyperellipticCurve(f(2*x), 2*x)).IgusaClebschInvariants() [ -40960, 73400320, -515547070464, 56274284941110411264 ] """ f, h = self.hyperelliptic_polynomials() @@ -203,13 +205,14 @@ def clebsch_invariants(self): TESTS:: - sage: magma(HyperellipticCurve(f)).ClebschInvariants() # optional - magma + sage: # optional - magma + sage: magma(HyperellipticCurve(f)).ClebschInvariants() [ 0, -2048/375, -4096/25, -4881645568/84375 ] - sage: magma(HyperellipticCurve(f(2*x))).ClebschInvariants() # optional - magma + sage: magma(HyperellipticCurve(f(2*x))).ClebschInvariants() [ 0, -8388608/375, -1073741824/25, -5241627016305836032/84375 ] - sage: magma(HyperellipticCurve(f, x)).ClebschInvariants() # optional - magma + sage: magma(HyperellipticCurve(f, x)).ClebschInvariants() [ -8/15, 17504/5625, -23162896/140625, -420832861216768/7119140625 ] - sage: magma(HyperellipticCurve(f(2*x), 2*x)).ClebschInvariants() # optional - magma + sage: magma(HyperellipticCurve(f(2*x), 2*x)).ClebschInvariants() [ -512/15, 71696384/5625, -6072014209024/140625, -451865844002031331704832/7119140625 ] """ f, h = self.hyperelliptic_polynomials() diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py index a56fee001cf..7f98036b700 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py @@ -3,9 +3,9 @@ EXAMPLES:: - 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 + sage: P. = GF(5)[] # needs sage.rings.finite_rings + sage: f = x^5 - 3*x^4 - 2*x^3 + 6*x^2 + 3*x - 1 # needs sage.rings.finite_rings + sage: C = HyperellipticCurve(f); C # needs 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 @@ -85,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)[] # 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: Q. = GF(5)[] # needs sage.rings.finite_rings + sage: f2 = y^5 - y^3 + y - 22 # needs sage.rings.finite_rings + sage: C2 = HyperellipticCurve(f2) # needs sage.rings.finite_rings sage: hash(C0) == hash(C0) True sage: hash(C0) == hash(C1) False - sage: hash(C1) == hash(C2) # optional - sage.rings.finite_rings + sage: hash(C1) == hash(C2) # needs sage.rings.finite_rings False """ def __init__(self, PP, f, h=None, names=None, genus=None): @@ -128,18 +128,18 @@ def change_ring(self, R): sage: R. = QQ[] sage: H = HyperellipticCurve(x^5 - 10*x + 9) - 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 + sage: K = Qp(3, 5) # needs sage.rings.padics + sage: L. = K.extension(x^30 - 3) # needs sage.rings.padics + sage: HK = H.change_ring(K) # needs sage.rings.padics + sage: HL = HK.change_ring(L); HL # needs 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 + sage: R. = FiniteField(7)[] # needs sage.rings.finite_rings + sage: H = HyperellipticCurve(x^8 + x + 5) # needs sage.rings.finite_rings + sage: H.base_extend(FiniteField(7^2, 'a')) # needs sage.rings.finite_rings Hyperelliptic Curve over Finite Field in a of size 7^2 defined by y^2 = x^8 + x + 5 """ @@ -225,23 +225,23 @@ def is_smooth(self): EXAMPLES:: - 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 + sage: R. = GF(13)[] # needs sage.rings.finite_rings + sage: H = HyperellipticCurve(x^8 + 1) # needs sage.rings.finite_rings + sage: H.is_smooth() # needs 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')[] # optional - sage.rings.finite_rings - sage: H = HyperellipticCurve(x^10 + 2) # optional - sage.rings.finite_rings + sage: R. = GF(27, 'a')[] # needs sage.rings.finite_rings + sage: H = HyperellipticCurve(x^10 + 2) # needs sage.rings.finite_rings sage: from sage.misc.verbose import set_verbose sage: set_verbose(-1) - sage: H.is_smooth() # optional - sage.rings.finite_rings + sage: H.is_smooth() # needs sage.rings.finite_rings True sage: from sage.schemes.curves.projective_curve import ProjectivePlaneCurve - sage: ProjectivePlaneCurve.is_smooth(H) # optional - sage.rings.finite_rings + sage: ProjectivePlaneCurve.is_smooth(H) # needs sage.rings.finite_rings False """ return True @@ -291,14 +291,14 @@ def odd_degree_model(self): ... ValueError: No odd degree model exists over field of definition - 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 + sage: K2 = QuadraticField(-2, 'a') # needs sage.rings.number_field + sage: Hp2 = H.change_ring(K2).odd_degree_model(); Hp2 # needs 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') # optional - sage.rings.number_field - sage: Hp3 = H.change_ring(QuadraticField(-3, 'b')).odd_degree_model(); Hp3 # optional - sage.rings.number_field + sage: K3 = QuadraticField(-3, 'b') # needs sage.rings.number_field + sage: Hp3 = H.change_ring(QuadraticField(-3, 'b')).odd_degree_model(); Hp3 # needs 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 @@ -309,22 +309,22 @@ def odd_degree_model(self): 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] # 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 + sage: P2 = K2.factor(43)[0][0] # needs sage.rings.number_field + sage: P3 = K3.factor(43)[0][0] # needs sage.rings.number_field + sage: Hp2.change_ring(K2.residue_field(P2)).frobenius_polynomial() # needs 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() # optional - sage.rings.number_field + sage: Hp3.change_ring(K3.residue_field(P3)).frobenius_polynomial() # needs 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() # optional - sage.rings.finite_rings + sage: H.change_ring(GF(43)).odd_degree_model().frobenius_polynomial() # needs sage.rings.finite_rings x^4 - 16*x^3 + 134*x^2 - 688*x + 1849 - 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 + sage: P2 = K2.factor(67)[0][0] # needs sage.rings.number_field + sage: P3 = K3.factor(67)[0][0] # needs sage.rings.number_field + sage: Hp2.change_ring(K2.residue_field(P2)).frobenius_polynomial() # needs 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() # optional - sage.rings.number_field + sage: Hp3.change_ring(K3.residue_field(P3)).frobenius_polynomial() # needs 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() # optional - sage.rings.finite_rings + sage: H.change_ring(GF(67)).odd_degree_model().frobenius_polynomial() # needs sage.rings.finite_rings x^4 - 8*x^3 + 150*x^2 - 536*x + 4489 TESTS:: @@ -387,12 +387,12 @@ def _magma_init_(self, magma): 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 # optional - sage.rings.finite_rings + sage: R. = GF(9,'a')[]; C = HyperellipticCurve(x^3 + x - 1, x^10); C # needs 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 + sage: D = magma(C); D # optional - magma # needs 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 # optional - sage.rings.finite_rings + sage: D.sage() # optional - magma # needs 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 """ @@ -655,9 +655,9 @@ def rational_points(self, **kwds): An example over a number field:: - 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 + sage: R. = PolynomialRing(QuadraticField(2)) # needs sage.rings.number_field + sage: C = HyperellipticCurve(R([1, 0, 0, 0, 0, 1])) # needs sage.rings.number_field + sage: C.rational_points(bound=2) # needs 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 7db44ac03aa..e1631774a12 100644 --- a/src/sage/schemes/hyperelliptic_curves/invariants.py +++ b/src/sage/schemes/hyperelliptic_curves/invariants.py @@ -175,8 +175,8 @@ def ubs(f): 'y2': 0, 'y3': 0} - 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 + sage: R. = GF(31)[] # needs sage.rings.finite_rings + sage: ubs(t^6 + 2*t^5 + t^2 + 3*t + 1) # needs sage.rings.finite_rings {'A': 0, 'B': -12, 'C': -15, @@ -219,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 # optional - sage.rings.finite_rings + sage: Cs = tuple(map(GF(31), (2, 3, 4, 5))); Cs # needs sage.rings.finite_rings (2, 3, 4, 5) - sage: clebsch_to_igusa(*Cs) # optional - sage.rings.finite_rings + sage: clebsch_to_igusa(*Cs) # needs sage.rings.finite_rings (8, 10, 15, 26) - sage: igusa_to_clebsch(*clebsch_to_igusa(*Cs)) # optional - sage.rings.finite_rings + sage: igusa_to_clebsch(*clebsch_to_igusa(*Cs)) # needs sage.rings.finite_rings (2, 3, 4, 5) """ I2 = -120*A @@ -245,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 # optional - sage.rings.finite_rings + sage: Is = tuple(map(GF(31), (-2400, 173700, 23112000, -10309890600))); Is # needs sage.rings.finite_rings (18, 7, 12, 27) - sage: igusa_to_clebsch(*Is) # optional - sage.rings.finite_rings + sage: igusa_to_clebsch(*Is) # needs sage.rings.finite_rings (20, 25, 25, 12) - sage: clebsch_to_igusa(*igusa_to_clebsch(*Is)) # optional - sage.rings.finite_rings + sage: clebsch_to_igusa(*igusa_to_clebsch(*Is)) # needs sage.rings.finite_rings (18, 7, 12, 27) """ A = -(+ I2) / 120 @@ -323,7 +323,7 @@ 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)) # optional - sage.rings.finite_rings + sage: absolute_igusa_invariants_wamelen(GF(5)['x'](x^6 - 2*x)) # needs sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves @@ -358,7 +358,7 @@ def absolute_igusa_invariants_wamelen(f): TESTS:: - sage: absolute_igusa_invariants_wamelen(GF(3)['x'](x^5 - 2*x)) # optional - sage.rings.finite_rings + sage: absolute_igusa_invariants_wamelen(GF(3)['x'](x^5 - 2*x)) # needs sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves @@ -397,7 +397,7 @@ def absolute_igusa_invariants_kohel(f): TESTS:: - sage: absolute_igusa_invariants_kohel(GF(2)['x'](x^5 - x)) # optional - sage.rings.finite_rings + sage: absolute_igusa_invariants_kohel(GF(2)['x'](x^5 - x)) # needs sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py b/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py index ec04cfd8801..704fe0e7feb 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py @@ -23,21 +23,22 @@ class HyperellipticJacobian_generic(Jacobian_generic): """ EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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 (x^2 + 376*x + 245, y + 988*x + 635) - sage: J(0) # optional - sage.rings.finite_rings + sage: J(0) (1) - sage: D == J([a,b]) # optional - sage.rings.finite_rings + sage: D == J([a,b]) True - sage: D == D + J(0) # optional - sage.rings.finite_rings + sage: D == D + J(0) True An more extended example, demonstrating arithmetic in J(QQ) and @@ -58,8 +59,8 @@ class HyperellipticJacobian_generic(Jacobian_generic): 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) # optional - sage.rings.number_field - sage: C(K) # optional - sage.rings.number_field + sage: K. = NumberField(x^2 - 2) # needs sage.rings.number_field + sage: C(K) # needs 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 @@ -70,10 +71,10 @@ class HyperellipticJacobian_generic(Jacobian_generic): 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) # 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 + sage: P1 = C(K)(P) # needs sage.rings.number_field + sage: P2 = C(K)([2, 4*t - 1, 1]) # needs sage.rings.number_field + sage: P3 = C(K)([-1/2, 1/8*(7*t+2), 1]) # needs sage.rings.number_field + sage: P1, P2, P3 # needs 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 @@ -88,54 +89,55 @@ class HyperellipticJacobian_generic(Jacobian_generic): (u^2, v + 1) (u, v + 1) (1) - sage: Q1 = J(K)(P1); print("%s -> %s"%( P1, Q1 )) # optional - sage.rings.number_field + sage: Q1 = J(K)(P1); print("%s -> %s"%( P1, Q1 )) # needs sage.rings.number_field (0 : 1 : 1) -> (u, v - 1) - sage: Q2 = J(K)(P2); print("%s -> %s"%( P2, Q2 )) # optional - sage.rings.number_field + sage: Q2 = J(K)(P2); print("%s -> %s"%( P2, Q2 )) # needs 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 )) # optional - sage.rings.number_field + sage: Q3 = J(K)(P3); print("%s -> %s"%( P3, Q3 )) # needs 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) # 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 + sage: R. = PolynomialRing(K) # needs sage.rings.number_field + sage: Q4 = J(K)([x^2 - t, R(1)]) # needs sage.rings.number_field + sage: for i in range(4): Q4*i # needs 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 # optional - sage.rings.number_field + sage: R2 = Q2*5; R2 # needs 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 + sage: R3 = Q3*5; R3 # needs 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 + sage: R4 = Q4*5; R4 # needs 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 # optional - sage.rings.number_field + sage: 5*Q2 + 5*Q4 # needs sage.rings.number_field (1) Moreover the following relation holds in the 5-torsion subgroup:: - sage: Q2 + Q4 == 2*Q1 # optional - sage.rings.number_field + sage: Q2 + Q4 == 2*Q1 # needs sage.rings.number_field True TESTS:: - 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 + sage: # needs sage.rings.finite_rings + 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 True - sage: J1 == J2 # optional - sage.rings.finite_rings + sage: J1 == J2 False """ def dimension(self): @@ -148,12 +150,13 @@ def dimension(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: k. = GF(9); R. = k[] + sage: HyperellipticCurve(x^3 + x - 1, x + a).jacobian().dimension() 1 - sage: g = HyperellipticCurve(x^6 + x - 1, x + a).jacobian().dimension(); g # optional - sage.rings.finite_rings + sage: g = HyperellipticCurve(x^6 + x - 1, x + a).jacobian().dimension(); g 2 - sage: type(g) # optional - sage.rings.finite_rings + sage: type(g) <... '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 f205b79b433..6fc6453734c 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py @@ -22,18 +22,19 @@ :: - 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 + sage: # needs sage.rings.finite_rings + 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; b = -x + 1; c = x - 1; d = 0 + sage: D1 = X([a,b]); D1 (x^2 + 2*x + 1, y + x + 2) - sage: D2 = X([c,d]); D2 # optional - sage.rings.finite_rings + sage: D2 = X([c,d]); D2 (x + 2, y) - sage: D1 + D2 # optional - sage.rings.finite_rings + sage: D1 + D2 (x^2 + 2*x + 2, y + 2*x + 1) """ # **************************************************************************** @@ -98,18 +99,19 @@ def __call__(self, P): :: - 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 + sage: # needs sage.rings.finite_rings + 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; b = -x + 1; c = x - 1; d = 0 + sage: D1 = X([a,b]); D1 (x^2 + 2*x + 1, y + x + 2) - sage: D2 = X([c,d]); D2 # optional - sage.rings.finite_rings + sage: D2 = X([c,d]); D2 (x + 2, y) - sage: D1 + D2 # optional - sage.rings.finite_rings + sage: D1 + D2 (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 da1f8908a7a..4286506727a 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() # 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 + sage: x = GF(37)['x'].gen() # needs sage.rings.finite_rings + sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x); H # needs 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 # optional - sage.rings.finite_rings + sage: J = H.jacobian(); J # needs 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 # optional - sage.rings.finite_rings + sage: J = J(J.base_ring()); J # needs 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 # optional - sage.rings.finite_rings + sage: P1 = H.lift_x(2); P1 # needs sage.rings.finite_rings (2 : 11 : 1) - sage: Q1 = H.lift_x(10); Q1 # optional - sage.rings.finite_rings + sage: Q1 = H.lift_x(10); Q1 # needs 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 # optional - sage.rings.finite_rings + sage: P = J(P1); P # needs sage.rings.finite_rings (x + 35, y + 26) - sage: Q = J(Q1); Q # optional - sage.rings.finite_rings + sage: Q = J(Q1); Q # needs sage.rings.finite_rings (x + 27, y + 19) :: - sage: P + Q # optional - sage.rings.finite_rings + sage: P + Q # needs sage.rings.finite_rings (x^2 + 25*x + 20, y + 13*x) - sage: (x^2 + 25*x + 20).roots(multiplicities=False) # optional - sage.rings.finite_rings + sage: (x^2 + 25*x + 20).roots(multiplicities=False) # needs sage.rings.finite_rings [10, 2] Frobenius satisfies @@ -85,24 +85,26 @@ :: - sage: 1904*P # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: 1904*P (1) - sage: 34*P == 0 # optional - sage.rings.finite_rings + sage: 34*P == 0 True - sage: 35*P == P # optional - sage.rings.finite_rings + sage: 35*P == P True - sage: 33*P == -P # optional - sage.rings.finite_rings + sage: 33*P == -P True :: - sage: Q*1904 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: Q*1904 (1) - sage: Q*238 == 0 # optional - sage.rings.finite_rings + sage: Q*238 == 0 True - sage: Q*239 == Q # optional - sage.rings.finite_rings + sage: Q*239 == Q True - sage: Q*237 == -Q # optional - sage.rings.finite_rings + sage: Q*237 == -Q True """ @@ -230,22 +232,23 @@ 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 + sage: F. = NumberField(x^2 - 2, 'a') # needs sage.rings.number_field + sage: J = H.jacobian()(F); J # needs 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 # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: P = J(H.lift_x(F(1))); P (x - 1, y - a) - sage: Q = J(H.lift_x(F(0))); Q # optional - sage.rings.number_field + sage: Q = J(H.lift_x(F(0))); Q (x, y) - sage: 2*P + 2*Q # indirect doctest # optional - sage.rings.number_field + sage: 2*P + 2*Q # indirect doctest (x^2 - 2*x + 1, y - 3/2*a*x + 1/2*a) - sage: 2*(P + Q) # indirect doctest # optional - sage.rings.number_field + sage: 2*(P + Q) # indirect doctest (x^2 - 2*x + 1, y - 3/2*a*x + 1/2*a) - sage: 3*P # indirect doctest # optional - sage.rings.number_field + sage: 3*P # indirect doctest (x^2 - 25/32*x + 49/32, y - 45/256*a*x - 315/256*a) """ a1, b1 = D1 @@ -271,53 +274,55 @@ def cantor_composition(D1,D2,f,h,genus): r""" EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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 # optional - sage.rings.finite_rings + sage: J = H.jacobian()(F); J 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 # optional - sage.rings.finite_rings + sage: Q = J(H.lift_x(F(1))); Q # needs sage.rings.finite_rings (x + 6, y + 2*a + 2) - sage: 10*Q # indirect doctest # optional - sage.rings.finite_rings + sage: 10*Q # indirect doctest # needs 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 + sage: 7*8297*Q # needs sage.rings.finite_rings (1) :: - sage: Q = J(H.lift_x(F(a+1))); Q # optional - sage.rings.finite_rings + sage: Q = J(H.lift_x(F(a+1))); Q # needs sage.rings.finite_rings (x + 6*a + 6, y + 2*a) - sage: 7*8297*Q # indirect doctest # optional - sage.rings.finite_rings + sage: 7*8297*Q # indirect doctest # needs sage.rings.finite_rings (1) A test over a prime field: - 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 + sage: # needs sage.rings.finite_rings + 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 # optional - sage.rings.finite_rings + sage: J = H.jacobian()(F); J 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 + sage: Q = J(H.lift_x(F(1))); Q (x + 1000000000000000000000000000056, y + 1000000000000000000000000000056) - sage: 10*Q # indirect doctest # optional - sage.rings.finite_rings + sage: 10*Q # indirect doctest (x^3 + 150296037169838934997145567227*x^2 + 377701248971234560956743242408*x + 509456150352486043408603286615, y + 514451014495791237681619598519*x^2 + 875375621665039398768235387900*x + 861429240012590886251910326876) - sage: 7*8297*Q # optional - sage.rings.finite_rings + sage: 7*8297*Q (x^3 + 35410976139548567549919839063*x^2 + 26230404235226464545886889960*x + 681571430588959705539385624700, y + 999722365017286747841221441793*x^2 @@ -371,22 +376,22 @@ def __init__(self, parent, polys, check=True): EXAMPLES:: - 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 + sage: x = GF(37)['x'].gen() # needs sage.rings.finite_rings + sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) # needs sage.rings.finite_rings + sage: J = H.jacobian()(GF(37)); J # needs 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 # optional - sage.rings.finite_rings + sage: P1 = J(H.lift_x(2)); P1 # indirect doctest # needs sage.rings.finite_rings (x + 35, y + 26) - sage: P1.parent() # optional - sage.rings.finite_rings + sage: P1.parent() # needs 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) # optional - sage.rings.finite_rings + sage: type(P1) # needs sage.rings.finite_rings """ SchemeMorphism.__init__(self, parent) @@ -408,15 +413,16 @@ def _printing_polys(self): TESTS:: - 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: # needs sage.rings.finite_rings + 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: Q = J(H.lift_x(F(1))); Q # indirect doctest # optional - sage.rings.finite_rings + sage: Q = J(H.lift_x(F(1))); Q # indirect doctest # needs sage.rings.finite_rings (x + 6, y + 2*a + 2) """ a, b = self.__polys @@ -431,19 +437,20 @@ def _repr_(self): EXAMPLES:: - 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: # needs sage.rings.finite_rings + 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: Q = J(0); Q # indirect doctest # optional - sage.rings.finite_rings + sage: Q = J(0); Q # indirect doctest # needs sage.rings.finite_rings (1) - sage: Q = J(H.lift_x(F(1))); Q # indirect doctest # optional - sage.rings.finite_rings + sage: Q = J(H.lift_x(F(1))); Q # indirect doctest # needs sage.rings.finite_rings (x + 6, y + 2*a + 2) - sage: Q + Q # indirect doctest # optional - sage.rings.finite_rings + sage: Q + Q # indirect doctest # needs sage.rings.finite_rings (x^2 + 5*x + 1, y + 3*a*x + 6*a + 2) """ if self.is_zero(): @@ -457,22 +464,23 @@ def _latex_(self): EXAMPLES:: - 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: # needs sage.rings.finite_rings + 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: Q = J(0); print(latex(Q)) # indirect doctest # optional - sage.rings.finite_rings + sage: Q = J(0); print(latex(Q)) # indirect doctest # needs sage.rings.finite_rings \left(1\right) - sage: Q = J(H.lift_x(F(1))); print(latex(Q)) # indirect doctest # optional - sage.rings.finite_rings + sage: Q = J(H.lift_x(F(1))); print(latex(Q)) # indirect doctest # needs sage.rings.finite_rings \left(x + 6, y + 2 \alpha + 2\right) :: - sage: print(latex(Q + Q)) # optional - sage.rings.finite_rings + sage: print(latex(Q + Q)) # needs sage.rings.finite_rings \left(x^{2} + 5 x + 1, y + 3 \alpha x + 6 \alpha + 2\right) """ if self.is_zero(): @@ -497,16 +505,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') # optional - sage.rings.number_field - sage: J = H.jacobian()(F); J # optional - sage.rings.number_field + sage: F. = NumberField(x^2 - 2, 'a') # needs sage.rings.number_field + sage: J = H.jacobian()(F); J # needs 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))) # optional - sage.rings.number_field - sage: P.scheme() # optional - sage.rings.number_field + sage: P = J(H.lift_x(F(1))) # needs sage.rings.number_field + sage: P.scheme() # needs sage.rings.number_field Jacobian of Hyperelliptic Curve over Rational Field defined by y^2 = x^5 + x """ return self.codomain() @@ -521,16 +529,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') # optional - sage.rings.number_field - sage: J = H.jacobian()(F); J # optional - sage.rings.number_field + sage: F. = NumberField(x^2 - 2, 'a') # needs sage.rings.number_field + sage: J = H.jacobian()(F); J # needs 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))) # optional - sage.rings.number_field - sage: list(P) # indirect doctest # optional - sage.rings.number_field + sage: P = J(H.lift_x(F(1))) # needs sage.rings.number_field + sage: list(P) # indirect doctest # needs sage.rings.number_field [x - 1, a] """ return list(self.__polys) @@ -545,16 +553,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') # optional - sage.rings.number_field - sage: J = H.jacobian()(F); J # optional - sage.rings.number_field + sage: F. = NumberField(x^2 - 2, 'a') # needs sage.rings.number_field + sage: J = H.jacobian()(F); J # needs 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))) # optional - sage.rings.number_field - sage: tuple(P) # indirect doctest # optional - sage.rings.number_field + sage: P = J(H.lift_x(F(1))) # needs sage.rings.number_field + sage: tuple(P) # indirect doctest # needs sage.rings.number_field (x - 1, a) """ return tuple(self.__polys) @@ -569,22 +577,23 @@ 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') # optional - sage.rings.number_field - sage: J = H.jacobian()(F); J # optional - sage.rings.number_field + sage: F. = NumberField(x^2 - 2, 'a') # needs sage.rings.number_field + sage: J = H.jacobian()(F); J # needs 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))) # optional - sage.rings.number_field - sage: P[0] # indirect doctest # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: P = J(H.lift_x(F(1))) + sage: P[0] # indirect doctest x - 1 - sage: P[1] # indirect doctest # optional - sage.rings.number_field + sage: P[1] # indirect doctest a - sage: P[-1] # indirect doctest # optional - sage.rings.number_field + sage: P[-1] # indirect doctest a - sage: P[:1] # indirect doctest # optional - sage.rings.number_field + sage: P[:1] # indirect doctest [x - 1] """ return list(self.__polys)[n] @@ -653,17 +662,17 @@ def __bool__(self): EXAMPLES:: - 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: x = GF(37)['x'].gen() # needs sage.rings.finite_rings + sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) # needs sage.rings.finite_rings + sage: J = H.jacobian()(GF(37)) # needs sage.rings.finite_rings :: - sage: P1 = J(H.lift_x(2)); P1 # optional - sage.rings.finite_rings + sage: P1 = J(H.lift_x(2)); P1 # needs sage.rings.finite_rings (x + 35, y + 26) - sage: P1 == 0 # indirect doctest # optional - sage.rings.finite_rings + sage: P1 == 0 # indirect doctest # needs sage.rings.finite_rings False - sage: P1 - P1 == 0 # indirect doctest # optional - sage.rings.finite_rings + sage: P1 - P1 == 0 # indirect doctest # needs sage.rings.finite_rings True """ return self.__polys[0] != 1 @@ -674,25 +683,27 @@ def __neg__(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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 (x + 35, y + 26) - sage: - P1 # indirect doctest # optional - sage.rings.finite_rings + sage: - P1 # indirect doctest (x + 35, y + 11) - sage: P1 + (-P1) # indirect doctest # optional - sage.rings.finite_rings + sage: P1 + (-P1) # indirect doctest (1) :: - 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 + sage: # needs sage.rings.finite_rings + 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 (x + 35, y + 15) - sage: - P2 # indirect doctest # optional - sage.rings.finite_rings + sage: - P2 # indirect doctest (x + 35, y + 24) - sage: P2 + (-P2) # indirect doctest # optional - sage.rings.finite_rings + sage: P2 + (-P2) # indirect doctest (1) TESTS: @@ -703,14 +714,14 @@ def __neg__(self): sage: f = x^5 - x + 1; h = x sage: C = HyperellipticCurve(f, h, 'u,v') sage: J = C.jacobian() - 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 + sage: K. = NumberField(x^2 - 2) # needs sage.rings.number_field + sage: R. = K[] # needs sage.rings.number_field + sage: Q = J(K)([x^2 - t, R(1)]) # needs sage.rings.number_field + sage: Q # needs sage.rings.number_field (u^2 - t, v - 1) - sage: -Q # optional - sage.rings.number_field + sage: -Q # needs sage.rings.number_field (u^2 - t, v + u + 1) - sage: Q + (-Q) # indirect doctest # optional - sage.rings.number_field + sage: Q + (-Q) # indirect doctest # needs sage.rings.number_field (1) """ @@ -737,15 +748,15 @@ def _add_(self,other): EXAMPLES:: - 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: x = GF(37)['x'].gen() # needs sage.rings.finite_rings + sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) # needs sage.rings.finite_rings + sage: J = H.jacobian()(GF(37)) # needs sage.rings.finite_rings :: - sage: P1 = J(H.lift_x(2)); P1 # optional - sage.rings.finite_rings + sage: P1 = J(H.lift_x(2)); P1 # needs sage.rings.finite_rings (x + 35, y + 26) - sage: P1 + P1 # indirect doctest # optional - sage.rings.finite_rings + sage: P1 + P1 # indirect doctest # needs sage.rings.finite_rings (x^2 + 33*x + 4, y + 13*x) """ X = self.parent() @@ -768,30 +779,30 @@ def _sub_(self, other): EXAMPLES:: - 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: x = GF(37)['x'].gen() # needs sage.rings.finite_rings + sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) # needs sage.rings.finite_rings + sage: J = H.jacobian()(GF(37)) # needs sage.rings.finite_rings :: - sage: P1 = J(H.lift_x(2)); P1 # optional - sage.rings.finite_rings + sage: P1 = J(H.lift_x(2)); P1 # needs sage.rings.finite_rings (x + 35, y + 26) - sage: P1 - P1 # indirect doctest # optional - sage.rings.finite_rings + sage: P1 - P1 # indirect doctest # needs sage.rings.finite_rings (1) :: - sage: P2 = J(H.lift_x(4)); P2 # optional - sage.rings.finite_rings + sage: P2 = J(H.lift_x(4)); P2 # needs 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 # optional - sage.rings.finite_rings + sage: P1 - P2 # indirect doctest # needs sage.rings.finite_rings (x^2 + 31*x + 8, y + 7*x + 12) - sage: P1 + P2 # indirect doctest # optional - sage.rings.finite_rings + sage: P1 + P2 # indirect doctest # needs sage.rings.finite_rings (x^2 + 31*x + 8, y + 4*x + 18) - sage: (P1 - P2) - (P1 + P2) + 2*P2 # indirect doctest # optional - sage.rings.finite_rings + sage: (P1 - P2) - (P1 + P2) + 2*P2 # indirect doctest # needs 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 166681b32a1..f86e33b7403 100644 --- a/src/sage/schemes/hyperelliptic_curves/mestre.py +++ b/src/sage/schemes/hyperelliptic_curves/mestre.py @@ -82,17 +82,17 @@ def HyperellipticCurve_from_invariants(i, reduced=True, precision=None, An example over a finite field:: - sage: H = HyperellipticCurve_from_invariants([GF(13)(1), 3, 7, 5]); H # optional - sage.rings.finite_rings + sage: H = HyperellipticCurve_from_invariants([GF(13)(1), 3, 7, 5]); H # needs sage.rings.finite_rings Hyperelliptic Curve over Finite Field of size 13 defined by ... - sage: H.igusa_clebsch_invariants() # optional - sage.rings.finite_rings + sage: H.igusa_clebsch_invariants() # needs sage.rings.finite_rings (4, 9, 6, 11) An example over a number field:: - 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 + sage: K = QuadraticField(353, 'a') # needs sage.rings.number_field + sage: H = HyperellipticCurve_from_invariants([21, 225/64, 22941/512, 1], # needs sage.rings.number_field ....: reduced=false) - sage: f = K['x'](H.hyperelliptic_polynomials()[0]) # optional - sage.rings.number_field + sage: f = K['x'](H.hyperelliptic_polynomials()[0]) # needs 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 @@ -123,13 +123,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)[] # optional - sage.rings.finite_rings - sage: HyperellipticCurve(x^6 + x + 1).igusa_clebsch_invariants() # optional - sage.rings.finite_rings + sage: P. = GF(3)[] # needs sage.rings.finite_rings + sage: HyperellipticCurve(x^6 + x + 1).igusa_clebsch_invariants() # needs 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]) # optional - sage.rings.finite_rings + sage: HyperellipticCurve_from_invariants([GF(5)(1), 1, 0, 1]) # needs sage.rings.finite_rings Traceback (most recent call last): ... ZeroDivisionError: inverse of Mod(0, 5) does not exist @@ -249,9 +249,9 @@ def Mestre_conic(i, xyz=False, names='u,v,w'): Note that the algorithm works over number fields as well:: sage: x = polygen(ZZ, 'x') - 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: k = NumberField(x^2 - 41, 'a') # needs sage.rings.number_field + sage: a = k.an_element() # needs sage.rings.number_field + sage: Mestre_conic([1, 2 + a, a, 4 + a]) # needs 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 @@ -259,7 +259,7 @@ def Mestre_conic(i, xyz=False, names='u,v,w'): And over finite fields:: - sage: Mestre_conic([GF(7)(10), GF(7)(1), GF(7)(2), GF(7)(3)]) # optional - sage.rings.finite_rings + sage: Mestre_conic([GF(7)(10), GF(7)(1), GF(7)(2), GF(7)(3)]) # needs 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 diff --git a/src/sage/schemes/jacobians/abstract_jacobian.py b/src/sage/schemes/jacobians/abstract_jacobian.py index 08bee459739..17deb70832b 100644 --- a/src/sage/schemes/jacobians/abstract_jacobian.py +++ b/src/sage/schemes/jacobians/abstract_jacobian.py @@ -246,8 +246,8 @@ def base_extend(self, R): 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) # optional - sage.rings.number_field - sage: Jac.base_extend(F) # optional - sage.rings.number_field + sage: F. = QQ.extension(x^2 + 1) # needs sage.rings.number_field + sage: Jac.base_extend(F) # needs 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/plane_conics/con_field.py b/src/sage/schemes/plane_conics/con_field.py index 9ba15183074..cbd4ca9e635 100644 --- a/src/sage/schemes/plane_conics/con_field.py +++ b/src/sage/schemes/plane_conics/con_field.py @@ -105,10 +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 # optional - sage.rings.number_field + sage: d = c.base_extend(QuadraticField(-1, 'i')); d # needs 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 + sage: d.rational_point(algorithm='rnfisnorm') # needs sage.rings.number_field (i : 1 : 0) """ if S in _Fields: @@ -160,10 +160,10 @@ def coefficients(self): sage: Conic(QQ, [1,2,3,4,5,6]).coefficients() [1, 2, 3, 4, 5, 6] - 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 + sage: P. = GF(13)[] # needs sage.rings.finite_rings + sage: a = Conic(x^2 + 5*x*y + y^2 + z^2).coefficients(); a # needs sage.rings.finite_rings [1, 5, 0, 1, 0, 1] - sage: Conic(a) # optional - sage.rings.finite_rings + sage: Conic(a) # needs sage.rings.finite_rings Projective Conic Curve over Finite Field of size 13 defined by x^2 + 5*x*y + y^2 + z^2 """ @@ -194,14 +194,14 @@ def derivative_matrix(self): An example in characteristic `2`:: - sage: P. = GF(2)[] # optional - sage.rings.finite_rings - sage: c = Conic([t, 1, t^2, 1, 1, 0]); c # optional - sage.libs.ntl + sage: P. = GF(2)[] # needs sage.rings.finite_rings + sage: c = Conic([t, 1, t^2, 1, 1, 0]); c # needs sage.libs.ntl 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 + sage: c.is_smooth() # needs sage.rings.finite_rings True - sage: c.derivative_matrix() # optional - sage.rings.finite_rings + sage: c.derivative_matrix() # needs sage.rings.finite_rings [ 0 1 t^2] [ 1 0 1] [t^2 1 0] @@ -231,10 +231,10 @@ def determinant(self): Determinants are only defined in characteristic different from `2`:: - 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 + sage: C = Conic(GF(2), [1, 1, 1, 1, 1, 0]) # needs sage.rings.finite_rings + sage: C.is_smooth() # needs sage.rings.finite_rings True - sage: C.determinant() # optional - sage.rings.finite_rings + sage: C.determinant() # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: The conic self (= Projective Conic Curve over Finite Field @@ -270,10 +270,10 @@ def diagonal_matrix(self): :: - 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 + sage: c = Conic(GF(4, 'a'), [0, 1, 1, 1, 1, 1]) # needs sage.rings.finite_rings + sage: c.is_smooth() # needs sage.rings.finite_rings True - sage: c.diagonal_matrix() # optional - sage.rings.finite_rings + sage: c.diagonal_matrix() # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: The conic self (= Projective Conic Curve over Finite Field @@ -312,7 +312,7 @@ def diagonalization(self, names=None): EXAMPLES:: - sage: Conic(GF(5), [1,0,1,1,0,1]).diagonalization() # optional - sage.rings.finite_rings + sage: Conic(GF(5), [1,0,1,1,0,1]).diagonalization() # needs sage.rings.finite_rings (Projective Conic Curve over Finite Field of size 5 defined by x^2 + y^2 + 2*z^2, Scheme morphism: @@ -333,7 +333,7 @@ def diagonalization(self, names=None): :: - sage: Conic(GF(2), [1,1,1,1,1,0]).diagonalization() # optional - sage.rings.finite_rings + sage: Conic(GF(2), [1,1,1,1,1,0]).diagonalization() # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: The conic self (= Projective Conic Curve over Finite Field @@ -344,10 +344,11 @@ def diagonalization(self, names=None): :: - 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 + sage: # needs sage.rings.finite_rings + 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, @@ -394,8 +395,8 @@ def gens(self): :: - sage: C. = Conic(GF(3), [1, 1, 1]) # optional - sage.rings.finite_rings - sage: C # optional - sage.rings.finite_rings + sage: C. = Conic(GF(3), [1, 1, 1]) # needs sage.rings.finite_rings + sage: C # needs sage.rings.finite_rings Projective Conic Curve over Finite Field of size 3 defined by a^2 + b^2 + c^2 @@ -579,11 +580,11 @@ def has_singular_point(self, point=False): sage: c.has_singular_point(point = True) (True, (0 : 1 : 0)) - 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 + sage: P. = GF(7)[] # needs sage.rings.finite_rings + sage: e = Conic((x+y+z)*(x-y+2*z)); e # needs 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) # optional - sage.rings.finite_rings + sage: e.has_singular_point(point = True) # needs sage.rings.finite_rings (True, (2 : 4 : 1)) sage: Conic([1, 1, -1]).has_singular_point() @@ -596,15 +597,15 @@ def has_singular_point(self, point=False): :: - 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 + sage: F. = FiniteField(8) # needs sage.rings.finite_rings + sage: Conic([a, a + 1, 1]).has_singular_point(point=True) # needs sage.rings.finite_rings (True, (a + 1 : 0 : 1)) - sage: P. = GF(2)[] # optional - sage.rings.finite_rings - sage: C = Conic(P, [t,t,1]); C # optional - sage.rings.finite_rings sage.libs.ntl + sage: P. = GF(2)[] # needs sage.rings.finite_rings + sage: C = Conic(P, [t,t,1]); C # needs sage.libs.ntl 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 + sage: C.has_singular_point(point = False) # needs sage.libs.ntl sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError: Sorry, find singular point on conics not implemented @@ -755,7 +756,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() # optional - sage.rings.finite_rings + sage: Conic(GF(2),[1,1,1,1,1,0]).is_smooth() # needs sage.rings.finite_rings True """ if self.base_ring().characteristic() == 2: @@ -775,15 +776,15 @@ def _magma_init_(self, magma): sage: C = Conic(QQ, [1,2,3]) 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 # optional - sage.rings.finite_rings - sage: C._magma_init_(magma) # optional - magma # optional - sage.rings.finite_rings + sage: C = Conic(GF(41), [-1,2,5]) # optional - magma # needs sage.rings.finite_rings + sage: C._magma_init_(magma) # optional - magma # needs 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) # 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 + sage: F. = GF(25) # needs sage.rings.finite_rings + sage: C = Conic([3,0,1,4,a,2]) # needs sage.rings.finite_rings + sage: C # needs 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 + sage: magma(C) # optional - magma # needs 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 @@ -794,8 +795,8 @@ def _magma_init_(self, 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) # optional - sage.rings.number_field - sage: magma(Conic([b,1,2])) # optional - magma # optional - sage.rings.number_field + sage: K. = NumberField(x^3 + x + 1) # needs sage.rings.number_field + sage: magma(Conic([b,1,2])) # optional - magma # needs 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 """ @@ -821,9 +822,9 @@ def matrix(self): [1/2 1 0] [ 0 0 1] - 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 + sage: R. = GF(2)[] # needs sage.rings.finite_rings + sage: C = Conic(x^2 + x*y + y^2 + x*z + z^2) # needs sage.rings.finite_rings + sage: C.matrix() # needs sage.rings.finite_rings [1 1 1] [0 1 0] [0 0 1] @@ -851,8 +852,8 @@ def parametrization(self, point=None, morphism=True): An example over a finite field :: - 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 + sage: c = Conic(GF(2), [1,1,1,1,1,0]) # needs sage.rings.finite_rings + sage: f, g = c.parametrization(); f, g # needs 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 @@ -863,40 +864,42 @@ def parametrization(self, point=None, morphism=True): 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()) # optional - sage.rings.finite_rings + sage: set(f(p) for p in f.domain()) # needs sage.rings.finite_rings {(0 : 0 : 1), (0 : 1 : 1), (1 : 0 : 1)} Verfication of the example :: - sage: h = g*f; h # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: h = g*f; h 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] # optional - sage.rings.finite_rings + sage: h[0]/h[1] x/y - sage: h.is_one() # known bug (see :trac:`31892`) # optional - sage.rings.finite_rings + sage: h.is_one() # known bug True - sage: (x,y,z) = c.gens() # optional - sage.rings.finite_rings - sage: x.parent() # optional - sage.rings.finite_rings + 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 # optional - sage.rings.finite_rings - sage: k[0]*z-k[2]*x # optional - sage.rings.finite_rings + sage: k = f*g + sage: k[0]*z-k[2]*x 0 - sage: k[1]*z-k[2]*y # optional - sage.rings.finite_rings + sage: k[1]*z-k[2]*y 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]) # optional - sage.rings.finite_rings - sage: g([0,1,1]) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: f, g = c.parametrization([0,0,1]) + sage: g([0,1,1]) (1 : 0) - sage: f([1,0]) # optional - sage.rings.finite_rings + sage: f([1,0]) (0 : 1 : 1) - sage: f([1,1]) # optional - sage.rings.finite_rings + sage: f([1,1]) (0 : 0 : 1) - sage: g([0,0,1]) # optional - sage.rings.finite_rings + sage: g([0,0,1]) (1 : 1) An example with ``morphism = False`` :: @@ -1009,8 +1012,8 @@ def random_rational_point(self, *args1, **args2): EXAMPLES:: - 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 + sage: c = Conic(GF(2), [1,1,1,1,1,0]) # needs sage.rings.finite_rings + sage: [c.random_rational_point() for i in range(10)] # random # needs 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)] @@ -1072,70 +1075,74 @@ def rational_point(self, algorithm='default', read_cache=True): Examples over number fields :: sage: P. = QQ[] - 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 + sage: L. = NumberField(x^3 - 5) # needs sage.rings.number_field + sage: C = Conic(L, [3, 2, -b]) # needs sage.rings.number_field + sage: p = C.rational_point(algorithm = 'rnfisnorm') # needs sage.rings.number_field + sage: p # output is random # needs sage.rings.number_field (1/3*b^2 - 4/3*b + 4/3 : b^2 - 2 : 1) - sage: C.defining_polynomial()(list(p)) # optional - sage.rings.number_field + sage: C.defining_polynomial()(list(p)) # needs sage.rings.number_field 0 - 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 + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: D = Conic(K, [3, 2, 5]) # needs sage.rings.number_field + sage: D.rational_point(algorithm = 'rnfisnorm') # output is random # needs sage.rings.number_field (-3 : 4*i : 1) - sage: L. = QuadraticField(2) # optional - sage.rings.number_field - sage: Conic(QQ, [1, 1, -3]).has_rational_point() # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: L. = QuadraticField(2) + sage: Conic(QQ, [1, 1, -3]).has_rational_point() False - sage: E = Conic(L, [1, 1, -3]) # optional - sage.rings.number_field - sage: E.rational_point() # output is random # optional - sage.rings.number_field + sage: E = Conic(L, [1, 1, -3]) + sage: E.rational_point() # output is random (-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', # optional - magma # optional - sage.rings.number_field + sage: # optional - magma, needs sage.rings.number_field + sage: q = C.rational_point(algorithm='magma', ....: read_cache=False) - sage: q # output is random, # optional - magma # optional - sage.rings.number_field + sage: q # output is random, (1/5*b^2 : 1/5*b^2 : 1) - sage: C.defining_polynomial()(list(q)) # optional - magma # optional - sage.rings.number_field + sage: C.defining_polynomial()(list(q)) 0 - sage: len(str(p)) > 1.5*len(str(q)) # optional - magma # optional - sage.rings.number_field + sage: len(str(p)) > 1.5*len(str(q)) True - sage: D.rational_point(algorithm='magma', # random, optional - magma # optional - sage.rings.number_field + sage: D.rational_point(algorithm='magma', # optional - magma # needs sage.rings.number_field (1 : 2*i : 1) - sage: E.rational_point(algorithm='magma', # random, optional - magma # optional - sage.rings.number_field + sage: E.rational_point(algorithm='magma', # optional - magma # needs sage.rings.number_field ....: read_cache=False) (-s : 1 : 1) - 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 + sage: # needs sage.rings.number_field + sage: F = Conic([L.gen(), 30, -20]) + sage: q = F.rational_point(algorithm='magma') # optional - magma + sage: q # optional - magma (-10/7*s + 40/7 : 5/7*s - 6/7 : 1) - sage: p = F.rational_point(read_cache=False) # optional - sage.rings.number_field - sage: p # random # optional - sage.rings.number_field + sage: p = F.rational_point(read_cache=False) + sage: p # random (788210*s - 1114700 : -171135*s + 242022 : 1) - sage: len(str(p)) > len(str(q)) # optional - magma # optional - sage.rings.number_field + sage: len(str(p)) > len(str(q)) # optional - magma True - 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 + sage: # needs sage.rings.number_field + sage: G = Conic([L.gen(), 30, -21]) + sage: G.has_rational_point(algorithm='magma') # optional - magma False - sage: G.has_rational_point(read_cache=False) # optional - sage.rings.number_field + sage: G.has_rational_point(read_cache=False) False - sage: G.has_rational_point(algorithm='local', read_cache=False) # optional - sage.rings.number_field + sage: G.has_rational_point(algorithm='local', read_cache=False) False - sage: G.rational_point(algorithm='magma') # optional - magma # optional - sage.rings.number_field + sage: G.rational_point(algorithm='magma') # optional - magma 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', # optional - magma # optional - sage.rings.number_field + sage: G.rational_point(algorithm='magma', # optional - magma ....: read_cache=False) Traceback (most recent call last): ... @@ -1146,11 +1153,11 @@ def rational_point(self, algorithm='default', read_cache=True): Examples over finite fields :: - sage: F. = FiniteField(7^20) # optional - sage.rings.finite_rings - sage: C = Conic([1, a, -5]); C # optional - sage.rings.finite_rings + sage: F. = FiniteField(7^20) # needs sage.rings.finite_rings + sage: C = Conic([1, a, -5]); C # needs 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 + sage: C.rational_point() # output is random # needs 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 @@ -1159,10 +1166,10 @@ def rational_point(self, algorithm='default', read_cache=True): Examples over `\RR` and `\CC` :: - sage: Conic(CC, [1, 2, 3]).rational_point() # optional - sage.rings.finite_rings + sage: Conic(CC, [1, 2, 3]).rational_point() # needs sage.rings.finite_rings (0 : 1.22474487139159*I : 1) - sage: Conic(RR, [1, 1, 1]).rational_point() # optional - sage.rings.finite_rings + sage: Conic(RR, [1, 1, 1]).rational_point() # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Conic Projective Conic Curve over Real Field @@ -1184,7 +1191,7 @@ def singular_point(self): :: - sage: Conic(GF(2), [1,1,1,1,1,1]).singular_point() # optional - sage.rings.finite_rings + sage: Conic(GF(2), [1,1,1,1,1,1]).singular_point() # needs 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_rational_function_field.py b/src/sage/schemes/plane_conics/con_rational_function_field.py index 8e5bf4669c2..e6db233558d 100644 --- a/src/sage/schemes/plane_conics/con_rational_function_field.py +++ b/src/sage/schemes/plane_conics/con_rational_function_field.py @@ -130,16 +130,16 @@ def has_rational_point(self, point=False, algorithm='default', 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)[] # 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 + sage: R. = FiniteField(23)[] # needs sage.rings.finite_rings + sage: C = Conic([2, t^2 + 1, t^2 + 5]) # needs sage.rings.finite_rings + sage: C.has_rational_point() # needs sage.rings.finite_rings True - sage: C.has_rational_point(point=True) # optional - sage.rings.finite_rings + sage: C.has_rational_point(point=True) # needs sage.rings.finite_rings (True, (5*t : 8 : 1)) - 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 + sage: F. = QuadraticField(-1) # needs sage.rings.number_field + sage: R. = F[] # needs sage.rings.number_field + sage: C = Conic([1, i*t, -t^2 + 4]) # needs sage.rings.number_field + sage: C.has_rational_point(point=True) # needs sage.rings.number_field (True, (-t - 2*i : -2*i : 1)) It works on non-diagonal conics as well:: @@ -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) # 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 + sage: F. = E.extension(Y^2 - u^3 - 1) # needs sage.rings.function_field + sage: R. = F[] # needs sage.rings.function_field + sage: K = R.fraction_field() # needs sage.rings.function_field + sage: C = Conic(K, [u, v, 1]) # needs sage.rings.function_field + sage: C.has_rational_point() # needs sage.rings.function_field Traceback (most recent call last): ... NotImplementedError: has_rational_point not implemented for conics @@ -198,10 +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)) # 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 + sage: K. = PolynomialRing(GF(7)) # needs sage.rings.finite_rings + sage: C = Conic([5*t^2 + 4, t^2 + 3*t + 3, 6*t^2 + 3*t + 2, # needs 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 + sage: C.has_rational_point() # needs sage.rings.finite_rings Traceback (most recent call last): ... TypeError: self (=Scheme morphism: diff --git a/src/sage/schemes/plane_conics/constructor.py b/src/sage/schemes/plane_conics/constructor.py index 0a73422519c..e74212cdb7b 100644 --- a/src/sage/schemes/plane_conics/constructor.py +++ b/src/sage/schemes/plane_conics/constructor.py @@ -105,8 +105,8 @@ 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() # optional - sage.rings.finite_rings - sage: Conic(x^2 - x + 2*y^2 - 3, 'U,V,W') # optional - sage.rings.finite_rings + sage: x,y = GF(7)['x,y'].gens() # needs sage.rings.finite_rings + sage: Conic(x^2 - x + 2*y^2 - 3, 'U,V,W') # needs 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 @@ -115,17 +115,17 @@ def Conic(base_field, F=None, names=None, unique=True): 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() # optional - sage.rings.finite_rings - sage: C = Conic(x^2 + y^2 - 2*z^2); C # optional - sage.rings.finite_rings + sage: x,y,z = GF(11)['x,y,z'].gens() # needs sage.rings.finite_rings + sage: C = Conic(x^2 + y^2 - 2*z^2); C # needs 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') # optional - sage.rings.finite_rings + sage: Conic(C.symmetric_matrix(), 'x,y,z') # needs 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') # optional - sage.rings.finite_rings + sage: Conic(GF(7), [1,2,3,4,5,6], 'X') # needs 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 +139,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) # optional - sage.rings.finite_rings - sage: Conic([a([x,x^2]) for x in range(5)]) # optional - sage.rings.finite_rings + sage: a = AffineSpace(GF(13), 2) # needs sage.rings.finite_rings + sage: Conic([a([x,x^2]) for x in range(5)]) # needs 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/product_projective/homset.py b/src/sage/schemes/product_projective/homset.py index 9bd1fd4277b..2b16549fd13 100644 --- a/src/sage/schemes/product_projective/homset.py +++ b/src/sage/schemes/product_projective/homset.py @@ -104,24 +104,24 @@ def points(self, **kwds): sage: P. = ProductProjectiveSpaces([1, 1], QQ) sage: X = P.subscheme([x - y, z^2 - 2*w^2]) - sage: X(P.base_ring()).points() # optional - sage.libs.singular + sage: X(P.base_ring()).points() # needs sage.libs.singular [] :: sage: u = QQ['u'].0 - 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.libs.singular sage.rings.number_field + sage: K = NumberField(u^2 - 2, 'v') # needs sage.rings.number_field + sage: P. = ProductProjectiveSpaces([1, 1], K) # needs sage.rings.number_field + sage: X = P.subscheme([x^2 - y^2, z^2 - 2*w^2]) + sage: sorted(X(P.base_ring()).points()) # needs sage.libs.singular 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') # optional - sage.rings.number_field - sage: P. = ProductProjectiveSpaces([1, 1], K) # optional - sage.rings.number_field - sage: P(K).points(bound=1) # optional - sage.libs.singular sage.rings.number_field + sage: K = NumberField(u^2 + 1, 'v') # needs sage.rings.number_field + sage: P. = ProductProjectiveSpaces([1, 1], K) # needs sage.rings.number_field + sage: P(K).points(bound=1) # needs sage.libs.singular 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), @@ -135,7 +135,7 @@ def points(self, **kwds): :: sage: P. = ProductProjectiveSpaces([2, 1], GF(3)) - sage: P(P.base_ring()).points() # optional - sage.libs.singular + sage: P(P.base_ring()).points() [(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), @@ -154,7 +154,7 @@ def points(self, **kwds): sage: PP. = ProductProjectiveSpaces([2, 1], QQ) sage: X = PP.subscheme([x + y, u*u - v*u]) - sage: X.rational_points(bound=2) # optional - sage.libs.singular + sage: X.rational_points(bound=2) # needs sage.libs.singular [(-2 : 2 : 1 , 0 : 1), (-2 : 2 : 1 , 1 : 1), (-1 : 1 : 0 , 0 : 1), @@ -176,7 +176,7 @@ def points(self, **kwds): 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')) # optional - sage.libs.singular + sage: len(X.rational_points(bound=1, algorithm='enumerate')) # needs sage.libs.singular 232 """ B = kwds.pop('bound', 0) diff --git a/src/sage/schemes/product_projective/morphism.py b/src/sage/schemes/product_projective/morphism.py index f28aa84e7ba..8d710013841 100644 --- a/src/sage/schemes/product_projective/morphism.py +++ b/src/sage/schemes/product_projective/morphism.py @@ -250,11 +250,12 @@ def __eq__(self, right): EXAMPLES:: sage: P1. = ProductProjectiveSpaces([1, 1], QQ) - sage: P2. = ProductProjectiveSpaces([1, 1], CC) - sage: H1 = End(P1); H2 = End(P2) + sage: P2. = ProductProjectiveSpaces([1, 1], CC) # needs sage.rings.real_mpfr + sage: H1 = End(P1) + sage: H2 = End(P2) # needs sage.rings.real_mpfr sage: f = H1([x1*x2, x2^2, x3*x4, x4^2]) - sage: g = H2([y1*y2, y2^2, y3*y4, y4^2]) - sage: f == g + sage: g = H2([y1*y2, y2^2, y3*y4, y4^2]) # needs sage.rings.real_mpfr + sage: f == g # needs sage.rings.real_mpfr False :: @@ -359,7 +360,7 @@ 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.is_morphism() + sage: f.is_morphism() # needs sage.libs.singular False :: @@ -367,7 +368,7 @@ def is_morphism(self): 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() + sage: f.is_morphism() # needs sage.libs.singular True :: @@ -376,7 +377,7 @@ def is_morphism(self): sage: Q. = ProductProjectiveSpaces([1, 2], QQ) sage: H = Hom(P, Q) sage: f = H([x^2, y^2, u^3, w^3, u^3]) - sage: f.is_morphism() + sage: f.is_morphism() # needs sage.libs.singular False """ m = 0 @@ -411,7 +412,7 @@ def as_dynamical_system(self): 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()) + sage: type(f.as_dynamical_system()) # needs sage.schemes """ if not self.is_endomorphism(): @@ -443,18 +444,18 @@ def global_height(self, prec=None): sage: P1xP1. = ProductProjectiveSpaces([1, 1], ZZ) sage: H = End(P1xP1) sage: f = H([x^2*u, 3*y^2*v, 5*x*v^2, y*u^2]) - sage: f.global_height() + sage: f.global_height() # needs sage.rings.real_mpfr 1.60943791243410 :: sage: u = QQ['u'].0 - 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 + sage: R = NumberField(u^2 - 2, 'v') # needs sage.rings.number_field + sage: PP. = ProductProjectiveSpaces([1, 1], R) # needs sage.rings.number_field + sage: H = End(PP) # needs sage.rings.number_field + sage: O = R.maximal_order() # needs 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]) # needs sage.rings.number_field + sage: g.global_height() # needs sage.rings.number_field sage.rings.real_mpfr 2.56494935746154 """ K = self.domain().base_ring() @@ -489,17 +490,17 @@ 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.local_height(2) + sage: f.local_height(2) # needs sage.rings.real_mpfr 4.85203026391962 :: sage: R. = PolynomialRing(QQ) - 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 + sage: K. = NumberField(z^2 - 5) # needs sage.rings.number_field + sage: P. = ProductProjectiveSpaces([1, 1], K) # needs sage.rings.number_field + sage: H = Hom(P, P) # needs 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]) # needs sage.rings.number_field + sage: f.local_height(K.ideal(3)) # needs sage.rings.number_field sage.rings.real_mpfr 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 82b8ea4fcc0..acb7868576b 100644 --- a/src/sage/schemes/product_projective/point.py +++ b/src/sage/schemes/product_projective/point.py @@ -339,6 +339,7 @@ def dehomogenize(self, L): :: + sage: # needs sage.rings.real_mpfr sage: PP. = ProductProjectiveSpaces([1, 2], CC) sage: X = PP.subscheme([a^2 + b^2]) sage: P = X([2, 2*i, -3, 6*i, 3 - 6*i]) @@ -437,30 +438,30 @@ def global_height(self, prec=None): sage: PP = ProductProjectiveSpaces(QQ, [2, 2], 'x') sage: Q = PP([1, 7, 5, 18, 2, 3]) - sage: Q.global_height() + sage: Q.global_height() # needs sage.symbolic 2.89037175789616 :: sage: PP = ProductProjectiveSpaces(ZZ, [1, 1], 'x') sage: A = PP([-30, 2, 1, 6]) - sage: A.global_height() + sage: A.global_height() # needs sage.symbolic 2.70805020110221 :: sage: R. = PolynomialRing(QQ) - 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 + sage: k. = NumberField(x^2 + 5) # needs sage.rings.number_field + sage: PP = ProductProjectiveSpaces(k, [1, 2], 'y') # needs sage.rings.number_field + sage: Q = PP([3, 5*w + 1, 1, 7*w, 10]) # needs sage.rings.number_field + sage: Q.global_height() # needs sage.rings.number_field 2.75062910527236 :: - 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 + sage: PP = ProductProjectiveSpaces(QQbar, [1, 1], 'x') # needs sage.rings.number_field + sage: Q = PP([1, QQbar(sqrt(2)), QQbar(5^(1/3)), QQbar(3^(1/3))]) # needs sage.rings.number_field sage.symbolic + sage: Q.global_height() # needs sage.rings.number_field sage.symbolic 0.536479304144700 """ K = self.codomain().base_ring() @@ -491,14 +492,14 @@ def local_height(self, v, prec=None): sage: PP = ProductProjectiveSpaces(QQ, [1, 1], 'x') sage: A = PP([11, 5, 10, 2]) - sage: A.local_height(5) + sage: A.local_height(5) # needs sage.rings.real_mpfr 1.60943791243410 :: sage: P = ProductProjectiveSpaces(QQ, [1, 2], 'x') sage: Q = P([1, 4, 1/2, 2, 32]) - sage: Q.local_height(2) + sage: Q.local_height(2) # needs sage.rings.real_mpfr 4.15888308335967 """ K = FractionField(self.domain().base_ring()) @@ -530,7 +531,7 @@ def intersection_multiplicity(self, X): 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]) - sage: Q.intersection_multiplicity(Y) + sage: Q.intersection_multiplicity(Y) # needs sage.libs.singular 2 """ from sage.schemes.product_projective.space import is_ProductProjectiveSpaces @@ -552,13 +553,13 @@ def multiplicity(self): 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() + sage: Q1.multiplicity() # needs sage.libs.singular 1 sage: Q2 = X([0,0,0,1,0,1,1]) - sage: Q2.multiplicity() + sage: Q2.multiplicity() # needs sage.libs.singular 5 sage: Q3 = X([0,0,0,1,1,0,0]) - sage: Q3.multiplicity() + sage: Q3.multiplicity() # needs sage.libs.singular 6 """ from sage.schemes.product_projective.space import is_ProductProjectiveSpaces diff --git a/src/sage/schemes/product_projective/rational_point.py b/src/sage/schemes/product_projective/rational_point.py index 3177c951545..1c4f6704e8a 100644 --- a/src/sage/schemes/product_projective/rational_point.py +++ b/src/sage/schemes/product_projective/rational_point.py @@ -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') # 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: K = NumberField(u^2 + 2, 'v') # needs sage.rings.number_field + sage: PP. = ProductProjectiveSpaces([1, 1], K) # needs sage.rings.number_field + sage: X = PP.subscheme([x^2 + 2*y^2]) # needs 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) # optional - sage.rings.number_field + sage: enum_product_projective_number_field(X, bound=1.5) # needs 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), @@ -336,7 +336,7 @@ def sieve(X, bound): 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: sieve(X, 2) + sage: sieve(X, 2) # needs sage.libs.singular [(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), (1 : 0 : 1 , 0 : 1), (1 : 0 : 1 , 1 : 1)] diff --git a/src/sage/schemes/product_projective/subscheme.py b/src/sage/schemes/product_projective/subscheme.py index 5612fdab77a..084dcfec4d2 100644 --- a/src/sage/schemes/product_projective/subscheme.py +++ b/src/sage/schemes/product_projective/subscheme.py @@ -84,14 +84,14 @@ def segre_embedding(self, PP=None): 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 + sage: phi = W.segre_embedding(P) # needs sage.libs.singular + sage: phi.codomain().ambient_space() == P # needs sage.libs.singular True :: - sage: PP. = ProductProjectiveSpaces([1, 1, 1], CC) - sage: PP.subscheme([]).segre_embedding() + sage: PP. = ProductProjectiveSpaces([1, 1, 1], CC) # needs sage.rings.real_mpfr + sage: PP.subscheme([]).segre_embedding() # needs sage.libs.singular sage.rings.real_mpfr 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: @@ -107,7 +107,7 @@ 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.subscheme([x^3, u - v, s^2 - t^2]).segre_embedding() # needs sage.libs.singular Scheme morphism: From: Closed subscheme of Product of projective spaces P^2 x P^1 x P^1 over Integer Ring defined by: @@ -195,33 +195,33 @@ def dimension(self): 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() + sage: W.dimension() # needs sage.libs.singular 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() + sage: X.dimension() # needs sage.libs.singular -1 :: - sage: PP = ProductProjectiveSpaces([2, 1, 3], CC, 't') - sage: PP.subscheme([]).dimension() + sage: PP = ProductProjectiveSpaces([2, 1, 3], CC, 't') # needs sage.rings.real_mpfr + sage: PP.subscheme([]).dimension() # needs sage.libs.singular sage.rings.real_mpfr 6 :: sage: PP = ProductProjectiveSpaces([1, 3, 1], ZZ, 't') - sage: PP.subscheme([]).dimension() + sage: PP.subscheme([]).dimension() # needs sage.libs.singular 5 :: - sage: PP. = ProductProjectiveSpaces([1,1,1], CC) - sage: X = PP.subscheme([x^2 - y^2, u - v, s^2 - t^2]) - sage: X.dimension() + sage: PP. = ProductProjectiveSpaces([1,1,1], CC) # needs sage.rings.real_mpfr + sage: X = PP.subscheme([x^2 - y^2, u - v, s^2 - t^2]) # needs sage.libs.singular sage.rings.real_mpfr + sage: X.dimension() # needs sage.libs.singular sage.rings.real_mpfr 0 """ try: @@ -356,20 +356,21 @@ def intersection_multiplicity(self, X, P): 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()) + sage: sorted(G.intersection(D).rational_points()) # needs sage.libs.singular [(1/2 : 1 , 1/2 : 1), (1 : 0 , 1 : 0)] sage: Q = PP([1/2,1,1/2,1]) - sage: G.intersection_multiplicity(D, Q) + sage: G.intersection_multiplicity(D, Q) # needs sage.libs.singular 2 :: - 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 + sage: # needs sage.rings.finite_rings + 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) # needs sage.libs.singular 16 :: @@ -378,7 +379,7 @@ def intersection_multiplicity(self, X, P): 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]) - sage: X.intersection_multiplicity(Y, Q) + sage: X.intersection_multiplicity(Y, Q) # needs sage.libs.singular Traceback (most recent call last): ... TypeError: the intersection of this subscheme and (=Closed subscheme of Affine Space of dimension 4 @@ -424,10 +425,10 @@ def multiplicity(self, P): 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) + sage: X.multiplicity(Q1) # needs sage.libs.singular 1 sage: Q2 = PP([0,1,1,0]) - sage: X.multiplicity(Q2) + sage: X.multiplicity(Q2) # needs sage.libs.singular 3 :: @@ -435,10 +436,10 @@ 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) # optional - sage.libs.singular sage.rings.finite_rings + sage: X.multiplicity(Q1) # needs sage.libs.singular sage.rings.finite_rings 1 sage: Q2 = PP([1,0,1,0,0]) - sage: X.multiplicity(Q2) # optional - sage.libs.singular sage.rings.finite_rings + sage: X.multiplicity(Q2) # needs sage.libs.singular sage.rings.finite_rings 4 """ PP = self.ambient_space() diff --git a/src/sage/schemes/projective/proj_bdd_height.py b/src/sage/schemes/projective/proj_bdd_height.py index c00bf2f22c3..d6db237c02f 100644 --- a/src/sage/schemes/projective/proj_bdd_height.py +++ b/src/sage/schemes/projective/proj_bdd_height.py @@ -172,12 +172,13 @@ def IQ_points_of_bounded_height(PS, K, dim, bound): EXAMPLES: + sage: # needs sage.rings.number_field sage: from sage.schemes.projective.proj_bdd_height import IQ_points_of_bounded_height - 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 + sage: CF. = CyclotomicField(3) + sage: P. = ProjectiveSpace(CF, 2) + sage: len(list(IQ_points_of_bounded_height(P, CF, 2, -1))) 0 - sage: len(list(IQ_points_of_bounded_height(P, CF, 2, 1))) # optional - sage.rings.number_field + sage: len(list(IQ_points_of_bounded_height(P, CF, 2, 1))) 57 """ if bound < 1: @@ -255,41 +256,10 @@ def points_of_bounded_height(PS, K, dim, bound, prec=53): sage: from sage.schemes.projective.proj_bdd_height import points_of_bounded_height sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 7) # optional - sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field - sage: sorted(list(points_of_bounded_height(P, K, 2, 1))) # optional - sage.rings.number_field - [(0 : 0 : 1), (0 : 1 : 0), (1 : 0 : 0), (0 : -1 : 1), (0 : 1 : 1), - (-1 : 0 : 1), (1 : 0 : 1), (1 : 1 : 0), (-1 : 1 : 0), (-1 : -1 : 1), - (-1 : 1 : 1), (1 : -1 : 1), (1 : 1 : 1)] - - :: - - sage: R. = QQ[] - sage: K. = NumberField(3*x^2 + 1) - sage: O = K.maximal_order() - sage: P. = ProjectiveSpace(O, 1) - sage: len(list(P.points_of_bounded_height(bound=2))) - 44 - - :: - - sage: R. = QQ[] - sage: K. = NumberField(3*x^2 + 1) - sage: O = K.maximal_order() - sage: P. = ProjectiveSpace(O, 1) - sage: sorted(list(P.points_of_bounded_height(bound=1))) - [(-1 : 1), (-3/2*a - 1/2 : 1), (3/2*a - 1/2 : 1), (0 : 1), - (-3/2*a + 1/2 : 0), (-3/2*a + 1/2 : 1), (3/2*a + 1/2 : 1), (1 : 1)] - - :: - - sage: R. = QQ[] - sage: K. = NumberField(x^2 - 2) - sage: R2. = K[] - sage: L. = K.extension(y^2 - 3) - sage: P. = ProjectiveSpace(L, 1) - sage: len(list(P.points_of_bounded_height(bound=2))) - 256 + sage: K. = NumberField(x^3 - 7) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: len(list(points_of_bounded_height(P, K, 2, 1))) # needs sage.geometry.polyhedron sage.libs.pari sage.rings.number_field + 13 """ if bound < 1: return iter([]) diff --git a/src/sage/schemes/projective/projective_homset.py b/src/sage/schemes/projective/projective_homset.py index d1681cfc850..d952ae687b6 100644 --- a/src/sage/schemes/projective/projective_homset.py +++ b/src/sage/schemes/projective/projective_homset.py @@ -122,31 +122,32 @@ def points(self, **kwds): :: sage: u = QQ['u'].0 - 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 + sage: K. = NumberField(u^2 + 3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: len(P(K).points(bound=1.8)) # needs sage.rings.number_field 309 :: sage: P1 = ProjectiveSpace(GF(2), 1) - sage: F. = GF(4, 'a') # optional - sage.rings.finite_rings - sage: P1(F).points() # optional - sage.libs.singular sage.rings.finite_rings + sage: F. = GF(4, 'a') # needs sage.rings.finite_rings + sage: P1(F).points() # needs sage.libs.singular 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: E(P.base_ring()).points() + sage: E(P.base_ring()).points() # needs sage.libs.singular [(-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: # needs sage.rings.real_mpfr 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) # needs sage.libs.singular 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), @@ -155,7 +156,7 @@ def points(self, **kwds): (0.000000000000000 : 0.000000000000000 : 1.00000000000000), (1.00000000000000 : 1.00000000000000 : 0.000000000000000), (1.00000000000000*I : 0.000000000000000 : 1.00000000000000)] - sage: L[0].codomain() + sage: L[0].codomain() # needs sage.libs.singular Projective Space of dimension 2 over Complex Field with 53 bits of precision :: @@ -163,7 +164,7 @@ def points(self, **kwds): sage: # needs sage.rings.complex_double 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()) + sage: len(E(P.base_ring()).points()) # needs sage.libs.singular verbose 0 (...: projective_homset.py, points) Warning: computations in the numerical fields are inexact;points may be computed partially or incorrectly. 6 @@ -327,33 +328,33 @@ def numerical_points(self, F=None, **kwds): sage: P. = ProjectiveSpace(QQ, 2) sage: E = P.subscheme([y^3 - x^3 - x*z^2, x*y*z]) - sage: L = E(QQ).numerical_points(F=RR); L + sage: L = E(QQ).numerical_points(F=RR); L # needs sage.libs.singular [(0.000000000000000 : 0.000000000000000 : 1.00000000000000), (1.00000000000000 : 1.00000000000000 : 0.000000000000000)] - sage: L[0].codomain() + sage: L[0].codomain() # needs sage.libs.singular Projective Space of dimension 2 over Real Field with 53 bits of precision :: sage: S. = QQ[] - 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 + sage: K. = NumberField(a^5 - 7, embedding=CC(7)**(1/5)) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: X = P.subscheme([x^2 - v^2*z^2, y - v*z]) # needs sage.rings.number_field + sage: len(X(K).numerical_points(F=CDF)) # needs sage.libs.singular sage.rings.number_field 2 :: sage: P. = ProjectiveSpace(QQ, 2) sage: E = P.subscheme([3000*x1^50 + 9875643*x2^2*x3^48 + 12334545*x2^50, x1 + x2]) - sage: len(E(P.base_ring()).numerical_points(F=CDF, zero_tolerance=1e-6)) + sage: len(E(P.base_ring()).numerical_points(F=CDF, zero_tolerance=1e-6)) # needs sage.libs.singular 49 TESTS:: sage: P. = ProjectiveSpace(QQ, 2) sage: E = P.subscheme([y^3 - x^3 - x*z^2, x*y*z]) - sage: E(QQ).numerical_points(F=CDF, point_tolerance=-1) + sage: E(QQ).numerical_points(F=CDF, point_tolerance=-1) # needs sage.libs.singular Traceback (most recent call last): ... ValueError: tolerance must be positive @@ -362,7 +363,7 @@ def numerical_points(self, F=None, **kwds): sage: P. = ProjectiveSpace(QQ, 2) sage: E = P.subscheme([y^3 - x^3 - x*z^2, x*y*z]) - sage: E(QQ).numerical_points(F=CC, zero_tolerance=-1) + sage: E(QQ).numerical_points(F=CC, zero_tolerance=-1) # needs sage.libs.singular Traceback (most recent call last): ... ValueError: tolerance must be positive @@ -371,7 +372,7 @@ def numerical_points(self, F=None, **kwds): sage: P. = ProjectiveSpace(QQ, 2) sage: E = P.subscheme([y^3 - x^3 - x*z^2, x*y*z]) - sage: E(QQ).numerical_points(F=QQbar) + sage: E(QQ).numerical_points(F=QQbar) # needs sage.rings.number_field Traceback (most recent call last): ... TypeError: F must be a numerical field @@ -581,33 +582,33 @@ class SchemeHomset_points_abelian_variety_field(SchemeHomset_points_projective_f The bug reported at :trac:`1785` is fixed:: sage: x = polygen(ZZ, '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 + sage: K. = NumberField(x^2 + x - (3^3-3)) # needs sage.rings.number_field + sage: E = EllipticCurve('37a') # needs sage.rings.number_field + sage: X = E(K) # needs sage.rings.number_field + sage: X # needs 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]) # optional - sage.rings.number_field - sage: P # optional - sage.rings.number_field + sage: P = X([3,a]) # needs sage.rings.number_field + sage: P # needs sage.rings.number_field (3 : a : 1) - sage: P in E # optional - sage.rings.number_field + sage: P in E # needs sage.rings.number_field False - sage: P in E.base_extend(K) # optional - sage.rings.number_field + sage: P in E.base_extend(K) # needs sage.rings.number_field True - sage: P in X.codomain() # optional - sage.rings.number_field + sage: P in X.codomain() # needs sage.rings.number_field False - sage: P in X.extended_codomain() # optional - sage.rings.number_field + sage: P in X.extended_codomain() # needs sage.rings.number_field True Check for :trac:`11982`:: sage: P2. = ProjectiveSpace(QQ,2) sage: d = 7 - sage: C = Curve(x^3 + y^3 - d*z^3) - sage: E = EllipticCurve([0,-432*d^2]) - sage: transformation = [(36*d*z-y)/(72*d),(36*d*z+y)/(72*d),x/(12*d)] - sage: phi = E.hom(transformation, C); phi + sage: C = Curve(x^3 + y^3 - d*z^3) # needs sage.schemes + sage: E = EllipticCurve([0,-432*d^2]) # needs sage.schemes + sage: transformation = [(36*d*z-y)/(72*d), (36*d*z+y)/(72*d), x/(12*d)] + sage: phi = E.hom(transformation, C); phi # needs sage.schemes Scheme morphism: From: Elliptic Curve defined by y^2 = x^3 - 21168 over Rational Field To: Projective Plane Curve over Rational Field defined by x^3 + y^3 - 7*z^3 @@ -630,6 +631,7 @@ def _element_constructor_(self, *v, **kwds): EXAMPLES:: + sage: # needs sage.schemes sage: E = EllipticCurve('37a') sage: X = E(QQ) sage: P = X([0,1,0]); P @@ -639,7 +641,7 @@ def _element_constructor_(self, *v, **kwds): TESTS:: - sage: X._element_constructor_([0,1,0]) + sage: X._element_constructor_([0,1,0]) # needs sage.schemes (0 : 1 : 0) """ if len(v) == 1: @@ -656,9 +658,9 @@ def _repr_(self): EXAMPLES:: - sage: E = EllipticCurve('37a') - sage: X = E(QQ) - sage: X._repr_() + sage: E = EllipticCurve('37a') # needs sage.schemes + sage: X = E(QQ) # needs sage.schemes + sage: X._repr_() # needs sage.schemes 'Abelian group of points on Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field' """ s = 'Abelian group of points on ' + str(self.extended_codomain()) @@ -677,6 +679,7 @@ def base_extend(self, R): EXAMPLES:: + sage: # needs sage.schemes sage: E = EllipticCurve('37a') sage: Hom = E.point_homset(); Hom Abelian group of points on Elliptic Curve defined diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 99f6ebe14cb..02c2479251e 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -113,11 +113,11 @@ class SchemeMorphism_polynomial_projective_space(SchemeMorphism_polynomial): 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: C = Curve(f) # needs sage.schemes + sage: E = Curve(g) # needs sage.schemes + sage: xbar,ybar,zbar = C.coordinate_ring().gens() # needs sage.schemes + sage: H = C.Hom(E) # needs sage.schemes + sage: H([zbar, xbar - ybar, -(xbar+ybar)/80]) # needs sage.schemes 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 @@ -151,7 +151,7 @@ class SchemeMorphism_polynomial_projective_space(SchemeMorphism_polynomial): ... ValueError: polys (=[x - 1, x*y + x]) must be homogeneous - sage: H([exp(x), exp(y)]) + sage: H([exp(x), exp(y)]) # needs sage.symbolic Traceback (most recent call last): ... TypeError: polys (=[e^x, e^y]) must be elements of @@ -167,7 +167,7 @@ class SchemeMorphism_polynomial_projective_space(SchemeMorphism_polynomial): sage: H = End(P) sage: f = H([(x-2*y)^2, (x-2*z)^2, x^2]) sage: X = P.subscheme(y-z) - sage: f(f(f(X))) + sage: f(f(f(X))) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: y - z @@ -177,7 +177,7 @@ class SchemeMorphism_polynomial_projective_space(SchemeMorphism_polynomial): sage: P. = ProjectiveSpace(QQ, 3) sage: H = End(P) sage: f = H([(x-2*y)^2, (x-2*z)^2, (x-2*w)^2, x^2]) - sage: f(P.subscheme([x,y,z])) + sage: f(P.subscheme([x,y,z])) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: w, @@ -211,11 +211,12 @@ def __init__(self, parent, polys, check=True): When elements of the quotient ring is used, they are reduced:: + sage: # needs sage.rings.real_mpfr sage: P. = ProjectiveSpace(CC, 2) sage: X = P.subscheme([x - y]) - sage: u,v,w = X.coordinate_ring().gens() + sage: u,v,w = X.coordinate_ring().gens() # needs sage.libs.singular sage: H = End(X) - sage: H([u^2, v^2, w*u]) + sage: H([u^2, v^2, w*u]) # needs sage.libs.singular 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 @@ -329,7 +330,7 @@ def __call__(self, x, check=True): sage: H = End(PS) sage: f = H([y^2, x^2, w^2, z^2]) sage: X = PS.subscheme([z^2 + y*w]) - sage: f(X) + sage: f(X) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: x*z - w^2 @@ -341,7 +342,7 @@ def __call__(self, x, check=True): sage: H = End(PS) sage: f = H([x^2, y^2, z^2]) sage: X = P1.subscheme([u - v]) - sage: f(X) + sage: f(X) # needs sage.libs.singular Traceback (most recent call last): ... TypeError: subscheme must be in ambient space of domain of map @@ -352,11 +353,11 @@ def __call__(self, x, check=True): sage: P1. = ProjectiveSpace(ZZ, 1) sage: H = End(P1) sage: f = H([u^2, v^2]) - sage: f([u-v]) + sage: f([u - v]) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 1 over Integer Ring defined by: u - v sage: X = PS.subscheme([x - z]) - sage: f([x-z]) + sage: f([x - z]) Traceback (most recent call last): ... TypeError: [x - z] fails to convert into the map's domain Projective Space of @@ -375,13 +376,14 @@ 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) # optional - sage.rings.finite_rings - sage: P = T(F)(1, a) # optional - sage.rings.finite_rings - sage: h(P) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = GF(4) + sage: P = T(F)(1, a) + sage: h(P) # needs sage.libs.singular (a : a) - sage: h(P).domain() # optional - sage.rings.finite_rings + sage: h(P).domain() Spectrum of Finite Field in a of size 2^2 - sage: h.change_ring(F)(P) # optional - sage.rings.finite_rings + sage: h.change_ring(F)(P) (1 : 1) """ from sage.schemes.projective.projective_point import SchemeMorphism_point_projective_ring @@ -474,17 +476,19 @@ def _fast_eval(self, x): :: + sage: # needs sage.rings.real_mpfr 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) # needs sage.libs.pari sage: H = End(P) - sage: f = H([x^2 + x*y, y^2]) - sage: Q = P(z^2, 1) - sage: f._fast_eval(list(Q)) + sage: f = H([x^2 + x*y, y^2]) # needs sage.libs.pari + sage: Q = P(z^2, 1) # needs sage.libs.pari + sage: f._fast_eval(list(Q)) # needs sage.libs.pari [zbar^2, 1.00000000000000] :: + sage: # needs sage.rings.real_mpfr sage: T. = LaurentSeriesRing(CC) sage: R. = PolynomialRing(T) sage: P. = ProjectiveSpace(R,1) @@ -522,11 +526,11 @@ def __eq__(self, right): :: sage: P. = ProjectiveSpace(QQ, 1) - sage: P2. = ProjectiveSpace(CC, 1) + sage: P2. = ProjectiveSpace(CC, 1) # needs sage.rings.real_mpfr sage: H = End(P) - sage: H2 = End(P2) + sage: H2 = End(P2) # needs sage.rings.real_mpfr sage: f = H([x^2 - 2*x*y, y^2]) - sage: g = H2([u^2 - 2*u*v, v^2]) + sage: g = H2([u^2 - 2*u*v, v^2]) # needs sage.rings.real_mpfr sage: f == g False @@ -600,7 +604,7 @@ def _matrix_times_polymap_(self, mat, h): sage: P. = ProjectiveSpace(ZZ, 1) sage: H = Hom(P,P) sage: f = H([x^2 + y^2, y^2]) - sage: matrix([[1,2], [0,1]]) * f + sage: matrix([[1,2], [0,1]]) * f # needs sage.modules Scheme endomorphism of Projective Space of dimension 1 over Integer Ring Defn: Defined on coordinates by sending (x : y) to (x^2 + 3*y^2 : y^2) @@ -608,11 +612,11 @@ def _matrix_times_polymap_(self, mat, h): :: sage: R. = PolynomialRing(QQ) - 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 + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + 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 # needs sage.modules 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 @@ -644,7 +648,7 @@ def _polymap_times_matrix_(self, mat, h): sage: P. = ProjectiveSpace(ZZ, 1) sage: H = Hom(P, P) sage: f = H([x^2 + y^2, y^2]) - sage: f * matrix([[1,2], [0,1]]) + sage: f * matrix([[1,2], [0,1]]) # needs sage.modules Scheme endomorphism of Projective Space of dimension 1 over Integer Ring Defn: Defined on coordinates by sending (x : y) to (x^2 + 4*x*y + 5*y^2 : y^2) @@ -652,11 +656,11 @@ def _polymap_times_matrix_(self, mat, h): :: sage: R. = PolynomialRing(QQ) - 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 + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + 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]]) # needs sage.modules 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 @@ -688,15 +692,15 @@ def as_dynamical_system(self): sage: P. = ProjectiveSpace(ZZ, 2) sage: H = End(P) sage: f = H([x^2, y^2, z^2]) - sage: type(f.as_dynamical_system()) + sage: type(f.as_dynamical_system()) # needs sage.schemes :: sage: P. = ProjectiveSpace(QQ, 1) sage: H = End(P) - sage: f = H([x^2-y^2, y^2]) - sage: type(f.as_dynamical_system()) + sage: f = H([x^2 - y^2, y^2]) + sage: type(f.as_dynamical_system()) # needs sage.schemes :: @@ -704,15 +708,15 @@ 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()) # optional - sage.rings.finite_rings sage.schemes + sage: type(f.as_dynamical_system()) # needs sage.rings.finite_rings sage.schemes :: sage: P. = ProjectiveSpace(RR, 1) - sage: f = DynamicalSystem([x^2 + y^2, y^2], P) - sage: g = f.as_dynamical_system() - sage: g is f + sage: f = DynamicalSystem([x^2 + y^2, y^2], P) # needs sage.schemes + sage: g = f.as_dynamical_system() # needs sage.schemes + sage: g is f # needs sage.schemes True """ from sage.dynamics.arithmetic_dynamics.generic_ds import DynamicalSystem @@ -772,7 +776,7 @@ def scale_by(self, t): 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 # optional - sage.rings.finite_rings + sage: f.scale_by(x - y); f # needs 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 @@ -836,7 +840,7 @@ def normalize_coordinates(self, **kwds): 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 # optional - sage.rings.finite_rings + sage: f.normalize_coordinates(); f # needs 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) @@ -854,10 +858,11 @@ 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: # needs sage.rings.number_field + 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 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) @@ -865,11 +870,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) # needs sage.rings.number_field + sage: a = 7/(b - 1) + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([a*y^2 - (a*y - x)^2, y^2]) # needs sage.rings.number_field + sage: f.normalize_coordinates(); f # needs 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 @@ -887,12 +892,12 @@ def normalize_coordinates(self, **kwds): :: sage: R. = QQ[] - 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 + sage: A. = NumberField(w^2 + 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(A, 2) # needs sage.rings.number_field + 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]) # needs sage.rings.number_field + sage: f.normalize_coordinates(ideal=A.prime_above(2)); f # needs 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 Defn: Defined on coordinates by sending (x : y : z) to @@ -900,16 +905,16 @@ 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]) # 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 + sage: g = H([(a+1)*x^3 + 2*x*y^2, 4*x*y^2, 8*x*z^2]) # needs sage.rings.number_field + sage: g.normalize_coordinates(valuation=A.valuation(A.prime_above(2))) # needs sage.rings.number_field + sage: g == f # needs sage.rings.number_field True :: - 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 + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_projective([3*x^2 + 6*y^2, 9*x*y]) # needs sage.rings.padics + sage: f.normalize_coordinates(); f # needs 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 @@ -918,8 +923,8 @@ def normalize_coordinates(self, **kwds): Check that #35797 is fixed:: sage: R. = QQ[] - sage: K. = NumberField(3*x^2 + 1) - sage: P. = ProjectiveSpace(K, 1) + sage: K. = NumberField(3*x^2 + 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field sage: f = DynamicalSystem_projective([a*(z^2 + w^2), z*w]) sage: f.normalize_coordinates(); f Dynamical System of Projective Space of dimension 1 over @@ -1069,6 +1074,7 @@ def degree(self): :: + sage: # needs sage.rings.real_mpfr sage: P. = ProjectiveSpace(CC, 2) sage: H = Hom(P, P) sage: f = H([x^3 + y^3, y^2*z, z*x*y]) @@ -1160,7 +1166,7 @@ def dehomogenize(self, n): 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) + sage: f.dehomogenize(2) # needs sage.libs.singular 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) @@ -1175,12 +1181,13 @@ 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: # needs sage.rings.number_field + 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? @@ -1256,7 +1263,7 @@ def is_morphism(self): sage: P. = ProjectiveSpace(QQ, 1) sage: H = Hom(P, P) sage: f = H([x^2 + y^2, y^2]) - sage: f.is_morphism() + sage: f.is_morphism() # needs sage.libs.singular True :: @@ -1264,7 +1271,7 @@ def is_morphism(self): 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() + sage: f.is_morphism() # needs sage.libs.singular False :: @@ -1273,7 +1280,7 @@ def is_morphism(self): 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() # optional - sage.libs.singular sage.rings.finite_rings + sage: f.is_morphism() # needs sage.libs.singular sage.rings.finite_rings True Map that is not morphism on projective space, but is over a subscheme:: @@ -1282,7 +1289,7 @@ def is_morphism(self): 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: f.is_morphism() + sage: f.is_morphism() # needs sage.libs.singular True """ @@ -1319,7 +1326,7 @@ def global_height(self, 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.global_height() # optional - sage.symbolic + sage: f.global_height() # needs sage.symbolic 20.8348429892146 :: @@ -1327,7 +1334,7 @@ def global_height(self, 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.global_height(prec=11) # optional - sage.symbolic + sage: f.global_height(prec=11) # needs sage.symbolic 20.8 :: @@ -1335,27 +1342,28 @@ def global_height(self, prec=None): sage: P. = ProjectiveSpace(ZZ, 2) sage: H = Hom(P, P) sage: f = H([4*x^2 + 100*y^2, 210*x*y, 10000*z^2]); - sage: f.global_height() # optional - sage.symbolic + sage: f.global_height() # needs sage.symbolic 8.51719319141624 :: 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) # needs sage.rings.number_field + sage: O = K.maximal_order() # needs sage.rings.number_field + sage: P. = ProjectiveSpace(O, 1) # needs sage.rings.number_field + sage: H = Hom(P, P) + sage: f = H([2*x^2 + 3*O(w)*y^2, O(w)*y^2]) # needs sage.rings.number_field + sage: f.global_height() # needs 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: # needs sage.rings.number_field + 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() 1.09861228866811 :: @@ -1364,25 +1372,25 @@ def global_height(self, prec=None): sage: A. = ProjectiveSpace(QQ, 1) sage: H = Hom(P, A) sage: f = H([1/1331*x^2 + 4000*y*z, y^2]) - sage: f.global_height() # optional - sage.symbolic + sage: f.global_height() # needs sage.symbolic 15.4877354584971 :: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([1/25*x^2 + 25/3*x*y + y^2, 1*y^2]) - sage: exp(f.global_height()) # optional - sage.symbolic + sage: exp(f.global_height()) # needs sage.symbolic 625.000000000000 Scaling should not change the result:: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([1/25*x^2 + 25/3*x*y + y^2, 1*y^2]) - sage: f.global_height() # optional - sage.symbolic + sage: f.global_height() # needs sage.symbolic 6.43775164973640 sage: c = 10000 sage: f.scale_by(c) - sage: f.global_height() # optional - sage.symbolic + sage: f.global_height() # needs sage.symbolic 6.43775164973640 """ K = self.domain().base_ring() @@ -1422,7 +1430,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.local_height(1331) + sage: f.local_height(1331) # needs sage.rings.real_mpfr 7.19368581839511 :: @@ -1430,7 +1438,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.local_height(1331, prec=2) + sage: f.local_height(1331, prec=2) # needs sage.rings.real_mpfr 8.0 This function does not automatically normalize:: @@ -1438,20 +1446,20 @@ 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.local_height(2) + sage: f.local_height(2) # needs sage.rings.real_mpfr 2.77258872223978 - sage: f.normalize_coordinates() - sage: f.local_height(2) + sage: f.normalize_coordinates() # needs sage.libs.singular + sage: f.local_height(2) # needs sage.libs.singular 0.000000000000000 :: 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) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: H = Hom(P, P) + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) # needs sage.rings.number_field + sage: f.local_height(K.ideal(3)) # needs sage.rings.number_field 1.09861228866811 """ K = FractionField(self.domain().base_ring()) @@ -1480,7 +1488,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.local_height_arch(0) + sage: f.local_height_arch(0) # needs sage.rings.real_mpfr 5.34710753071747 :: @@ -1488,17 +1496,17 @@ 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.local_height_arch(0, prec=5) + sage: f.local_height_arch(0, prec=5) # needs sage.rings.real_mpfr 5.2 :: 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) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: H = Hom(P, P) + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) # needs sage.rings.number_field + sage: f.local_height_arch(1) # needs sage.rings.number_field 0.6931471805599453094172321214582 """ K = FractionField(self.domain().base_ring()) @@ -1521,21 +1529,21 @@ 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) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: H = End(P) # needs sage.rings.number_field + sage: f = H([x^2 - w*y^2, w*y^2]) # needs sage.rings.number_field + sage: f.wronskian_ideal() # needs 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: H = Hom(P,P2) - sage: f = H([x^2 - 2*y^2, y^2, x*y]) - sage: f.wronskian_ideal() + sage: P2. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: H = Hom(P, P2) # needs sage.rings.number_field + sage: f = H([x^2 - 2*y^2, y^2, x*y]) # needs sage.rings.number_field + sage: f.wronskian_ideal() # needs sage.rings.number_field Ideal (4*x*y, 2*x^2 + 4*y^2, -2*y^2) of Multivariate Polynomial Ring in x, y over Rational Field """ @@ -1577,7 +1585,7 @@ def rational_preimages(self, Q, k=1): sage: P. = ProjectiveSpace(QQ, 1) sage: H = End(P) sage: f = H([16*x^2 - 29*y^2, 16*y^2]) - sage: f.rational_preimages(P(-1, 4)) + sage: f.rational_preimages(P(-1, 4)) # needs sage.libs.singular [(-5/4 : 1), (5/4 : 1)] :: @@ -1587,7 +1595,7 @@ def rational_preimages(self, Q, k=1): 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)) + sage: f.rational_preimages(P(-9, -4, 1)) # needs sage.libs.singular [(0 : 4 : 1)] A non-periodic example :: @@ -1595,7 +1603,7 @@ def rational_preimages(self, Q, k=1): sage: P. = ProjectiveSpace(QQ, 1) sage: H = End(P) sage: f = H([x^2 + y^2, 2*x*y]) - sage: f.rational_preimages(P(17, 15)) + sage: f.rational_preimages(P(17, 15)) # needs sage.libs.singular [(3/5 : 1), (5/3 : 1)] :: @@ -1605,7 +1613,7 @@ def rational_preimages(self, Q, k=1): 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)) + sage: f.rational_preimages(P(0, -1, 0, 1)) # needs sage.libs.singular [] :: @@ -1613,7 +1621,7 @@ def rational_preimages(self, Q, k=1): sage: P. = ProjectiveSpace(QQ, 1) sage: H = End(P) sage: f = H([x^2 + y^2, 2*x*y]) - sage: f.rational_preimages([CC.0, 1]) + sage: f.rational_preimages([CC.0, 1]) # needs sage.libs.singular Traceback (most recent call last): ... TypeError: point must be in codomain of self @@ -1621,22 +1629,22 @@ def rational_preimages(self, Q, k=1): A number field example :: sage: z = QQ['z'].0 - 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 + sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: H = End(P) + sage: f = H([x^2 + y^2, y^2]) + sage: f.rational_preimages(P(3, 1)) # needs sage.libs.singular sage.rings.number_field [(-a : 1), (a : 1)] :: sage: z = QQ['z'].0 - 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 + sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: X = P.subscheme([x^2 - z^2]) # needs sage.rings.number_field + sage: H = End(X) # needs sage.rings.number_field + sage: f= H([x^2 - z^2, a*y^2, z^2 - x^2]) # needs sage.rings.number_field + sage: f.rational_preimages(X([1, 2, -1])) # needs sage.libs.singular sage.rings.number_field [] :: @@ -1645,7 +1653,7 @@ def rational_preimages(self, Q, k=1): sage: X = P.subscheme([x^2 - z^2]) sage: H = End(X) sage: f = H([x^2-z^2, y^2, z^2-x^2]) - sage: f.rational_preimages(X([0, 1, 0])) + sage: f.rational_preimages(X([0, 1, 0])) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x^2 - z^2, -x^2 + z^2, @@ -1657,7 +1665,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.rational_preimages(P.subscheme([x])) + sage: f.rational_preimages(P.subscheme([x])) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 1 over Rational Field defined by: x^2 - y^2 @@ -1666,7 +1674,7 @@ def rational_preimages(self, Q, k=1): sage: P. = ProjectiveSpace(QQ, 1) sage: H = End(P) sage: f = H([x^2 - 29/16*y^2, y^2]) - sage: f.rational_preimages(P(5/4, 1), k=4) + sage: f.rational_preimages(P(5/4, 1), k=4) # needs sage.libs.singular [(-3/4 : 1), (3/4 : 1), (-7/4 : 1), (7/4 : 1)] :: @@ -1675,7 +1683,7 @@ def rational_preimages(self, Q, k=1): sage: P2. = ProjectiveSpace(QQ, 2) sage: H = Hom(P, P2) sage: f = H([x^2, y^2, x^2-y^2]) - sage: f.rational_preimages(P2(1, 1, 0)) + sage: f.rational_preimages(P2(1, 1, 0)) # needs sage.libs.singular [(-1 : 1), (1 : 1)] """ k = ZZ(k) @@ -1728,10 +1736,10 @@ def _number_field_from_algebraics(self): EXAMPLES:: sage: R. = PolynomialRing(QQ) - 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 + sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field + sage: H = End(P) # needs sage.rings.number_field + sage: f = H([QQbar(3^(1/3))*x^2 + QQbar(sqrt(-2))*y^2, y^2]) # needs sage.rings.number_field sage.symbolic + sage: f._number_field_from_algebraics() # needs sage.rings.number_field sage.symbolic 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 @@ -1742,11 +1750,12 @@ def _number_field_from_algebraics(self): :: - 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 + sage: # needs sage.rings.number_field + 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]) # needs sage.symbolic + sage: f._number_field_from_algebraics() # needs sage.symbolic Scheme morphism: From: Projective Space of dimension 1 over Number Field in a with defining polynomial y^4 + 3*y^2 + 1 @@ -1760,16 +1769,16 @@ 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] # 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 + sage: s = (t^3 + t + 1).roots(QQbar)[0][0] # needs sage.rings.number_field + sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field + sage: H = Hom(P, P) # needs sage.rings.number_field + sage: f = H([s*x^3 - 13*y^3, y^3 - 15*y^3]) # needs sage.rings.number_field + sage: f # needs 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() # optional - sage.rings.number_field - sage: f_alg.change_ring(QQbar) # Used to fail # optional - sage.rings.number_field + sage: f_alg = f._number_field_from_algebraics() # needs sage.rings.number_field + sage: f_alg.change_ring(QQbar) # Used to fail # needs 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) @@ -1894,7 +1903,7 @@ def indeterminacy_locus(self): sage: P. = ProjectiveSpace(QQ, 2) sage: H = End(P) sage: f = H([x^2, y^2, z^2]) - sage: f.indeterminacy_locus() + sage: f.indeterminacy_locus() # needs sage.libs.singular ... 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: @@ -1907,7 +1916,7 @@ def indeterminacy_locus(self): 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() + sage: f.indeterminacy_locus() # needs sage.libs.singular Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: z, x^2 - y^2 @@ -1951,7 +1960,7 @@ def indeterminacy_points(self, F=None, base=False): 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_points() + sage: f.indeterminacy_points() # needs sage.libs.singular ... 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)] @@ -1963,10 +1972,10 @@ def indeterminacy_points(self, F=None, base=False): sage: H = Hom(P1, P2) sage: h = H([x + y, y, z + y, y]) sage: set_verbose(None) - sage: h.indeterminacy_points(base=True) + sage: h.indeterminacy_points(base=True) # needs sage.libs.singular [] sage: g = H([y^3*z^3, x^3*z^3, y^3*z^3, x^2*y^2*z^2]) - sage: g.indeterminacy_points(base=True) + sage: g.indeterminacy_points(base=True) # needs sage.libs.singular Traceback (most recent call last): ... ValueError: indeterminacy scheme is not dimension 0 @@ -1976,14 +1985,14 @@ def indeterminacy_points(self, F=None, base=False): sage: P. = ProjectiveSpace(QQ, 2) sage: H = End(P) sage: f = H([x^2 + y^2, x*z, x^2 + y^2]) - sage: f.indeterminacy_points() + sage: f.indeterminacy_points() # needs sage.libs.singular [(0 : 0 : 1)] sage: R. = QQ[] - sage: K. = NumberField(t^2 + 1) # optional - sage.rings.number_field - sage: f.indeterminacy_points(F=K) # optional - sage.rings.number_field + sage: K. = NumberField(t^2 + 1) # needs sage.rings.number_field + sage: f.indeterminacy_points(F=K) # needs sage.libs.singular 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) # optional - sage.rings.number_field + sage: f.indeterminacy_points(F=QQbar, base=True) # needs sage.libs.singular sage.rings.number_field [(-1*I : 1 : 0), (0 : 0 : 1), (1*I : 1 : 0)] :: @@ -1993,16 +2002,16 @@ def indeterminacy_points(self, F=None, base=False): sage: P. = ProjectiveSpace(K, 2) sage: H = End(P) sage: f = H([x^2 - t^2*y^2, y^2 - z^2, x^2 - t^2*z^2]) - sage: f.indeterminacy_points(base=True) + sage: f.indeterminacy_points(base=True) # needs sage.libs.singular [(-t : -1 : 1), (-t : 1 : 1), (t : -1 : 1), (t : 1 : 1)] :: sage: set_verbose(None) - 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 + sage: P. = ProjectiveSpace(Qp(3), 2) # needs sage.rings.padics + 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) # needs sage.libs.singular 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 @@ -2047,25 +2056,26 @@ def reduce_base_field(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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() 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 - sage: f2.reduce_base_field() # optional - sage.rings.finite_rings + sage: f2 = H2([x^2 + 5*y^2, y^2, 2*x*y]) + sage: f2.reduce_base_field() 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]) # optional - sage.rings.finite_rings - sage: f3.reduce_base_field() # optional - sage.rings.finite_rings + sage: f3 = H3([a^2 + t*b^2, c^2]) + sage: f3.reduce_base_field() 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 @@ -2073,28 +2083,29 @@ def reduce_base_field(self): :: - 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 + sage: # needs sage.rings.number_field + 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() 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() # 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 + sage: L = K.algebraic_closure() # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(L, 1) # needs sage.rings.finite_rings + sage: H = End(P) # needs sage.rings.finite_rings + sage: f = H([(L.gen(2))*x^2 + L.gen(4)*y^2, x*y]) # needs sage.rings.finite_rings + sage: f.reduce_base_field() # needs 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]) # optional - sage.rings.finite_rings - sage: f.reduce_base_field() # optional - sage.rings.finite_rings + sage: f = DynamicalSystem_projective([L.gen(3)*x^2 + L.gen(2)*y^2, x*y]) # needs sage.rings.finite_rings + sage: f.reduce_base_field() # needs 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 @@ -2103,11 +2114,12 @@ def reduce_base_field(self): TESTS:: - 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 + sage: # needs sage.rings.finite_rings + 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() 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) @@ -2219,11 +2231,11 @@ def image(self): sage: P2. = ProjectiveSpace(QQ, 2) sage: f = P2.hom([x0^3, x0^2*x1, x0*x1^2], P2) - sage: f.image() + sage: f.image() # needs sage.libs.singular Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x1^2 - x0*x2 sage: f = P2.hom([x0 - x1, x0 - x2, x1 - x2], P2) - sage: f.image() + sage: f.image() # needs sage.libs.singular Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x0 - x1 + x2 @@ -2232,7 +2244,7 @@ def image(self): sage: P2. = ProjectiveSpace(QQ, 2) sage: A2. = AffineSpace(QQ, 2) sage: f = P2.hom([1, x0/x1], A2) - sage: f.image() + sage: f.image() # needs sage.libs.singular Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: -x + 1 """ @@ -2280,13 +2292,13 @@ def __call__(self, x): TESTS:: sage: R. = QQ[] - sage: C = Curve(7*x^2 + 2*y*z + z^2) - sage: f, g = C.parametrization() - sage: g([0, -1, 2]) + sage: C = Curve(7*x^2 + 2*y*z + z^2) # needs sage.schemes + sage: f, g = C.parametrization() # needs sage.schemes + sage: g([0, -1, 2]) # needs sage.schemes (1 : 0) - sage: f([1, 0]) + sage: f([1, 0]) # needs sage.schemes (0 : -1/2 : 1) - sage: _ == C([0, -1, 2]) + sage: _ == C([0, -1, 2]) # needs sage.schemes True """ try: @@ -2309,11 +2321,12 @@ def __eq__(self, other): EXAMPLES:: sage: R. = QQ[] - sage: C = Curve(7*x^2 + 2*y*z + z^2) # conic - sage: f, g = C.parametrization() - sage: f*g == C.identity_morphism() + sage: C = Curve(7*x^2 + 2*y*z + z^2) # conic # needs sage.schemes + sage: f, g = C.parametrization() # needs sage.schemes + sage: f*g == C.identity_morphism() # needs sage.schemes True + sage: # needs sage.schemes sage: C = Curve(x^2 + y^2 - z^2) sage: P. = ProjectiveSpace(QQ, 1) sage: f = C.hom([x + z, y], P) @@ -2349,7 +2362,7 @@ def representatives(self): 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() + sage: f.representatives() # needs sage.libs.singular [Scheme morphism: From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: 0 @@ -2362,7 +2375,7 @@ def representatives(self): 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() + sage: f.representatives() # needs sage.libs.singular [Scheme morphism: From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x^2 - y^2 - y*z @@ -2373,8 +2386,8 @@ 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 (x : y)] - sage: g = _[0] - sage: g.representatives() + sage: g = _[0] # needs sage.libs.singular + sage: g.representatives() # needs sage.libs.singular [Scheme morphism: From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x^2 - y^2 - y*z @@ -2392,7 +2405,7 @@ def representatives(self): sage: X = P2.subscheme([x^2 - y^2 - y*z]) sage: A1. = AffineSpace(QQ, 1) sage: g = X.hom([y/x], A1) - sage: g.representatives() + sage: g.representatives() # needs sage.libs.singular [Scheme morphism: From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x^2 - y^2 - y*z @@ -2403,15 +2416,15 @@ def representatives(self): 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)] - sage: g0, g1 = _ + sage: g0, g1 = _ # needs sage.libs.singular sage: emb = A1.projective_embedding(0) - sage: emb*g0 + sage: emb*g0 # needs sage.libs.singular 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 Defn: Defined on coordinates by sending (x : y : z) to (y + z : x) - sage: emb*g1 + sage: emb*g1 # needs sage.libs.singular Scheme morphism: From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x^2 - y^2 - y*z @@ -2497,8 +2510,8 @@ def indeterminacy_locus(self): sage: P2. = ProjectiveSpace(QQ, 2) sage: X = P2.subscheme(0) sage: f = X.hom([x1,x0], P) - sage: L = f.indeterminacy_locus() - sage: L.rational_points() + sage: L = f.indeterminacy_locus() # needs sage.libs.singular + sage: L.rational_points() # needs sage.libs.singular [(0 : 0 : 1)] :: @@ -2507,7 +2520,7 @@ def indeterminacy_locus(self): 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() + sage: f.indeterminacy_locus() # needs sage.libs.singular Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: z, y, @@ -2519,12 +2532,12 @@ def indeterminacy_locus(self): sage: P2. = ProjectiveSpace(QQ, 2) sage: X = P3.subscheme(x^2 - w*y - x*z) sage: f = X.hom([x*y, y*z, z*x], P2) - sage: L = f.indeterminacy_locus() - sage: L.dimension() + sage: L = f.indeterminacy_locus() # needs sage.libs.singular + sage: L.dimension() # needs sage.libs.singular 0 - sage: L.degree() + sage: L.degree() # needs sage.libs.singular 2 - sage: L.rational_points() + sage: L.rational_points() # needs sage.libs.singular [(0 : 0 : 0 : 1), (0 : 1 : 0 : 0)] :: @@ -2533,8 +2546,8 @@ def indeterminacy_locus(self): sage: A2. = AffineSpace(QQ, 2) sage: X = P3.subscheme(x^2 - w*y - x*z) sage: f = X.hom([x/z, y/x], A2) - sage: L = f.indeterminacy_locus() - sage: L.rational_points() + sage: L = f.indeterminacy_locus() # needs sage.libs.singular + sage: L.rational_points() # needs sage.libs.singular [(0 : 0 : 0 : 1), (0 : 1 : 0 : 0)] :: @@ -2543,7 +2556,7 @@ def indeterminacy_locus(self): sage: X = P.subscheme(x - y) sage: H = End(X) sage: f = H([x^2 - 4*y^2, y^2 - z^2, 4*z^2 - x^2]) - sage: Z = f.indeterminacy_locus(); Z + sage: Z = f.indeterminacy_locus(); Z # needs sage.libs.singular Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: z, y, @@ -2589,7 +2602,7 @@ def is_morphism(self): 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() + sage: f.is_morphism() # needs sage.libs.singular True """ return self.indeterminacy_locus().dimension() < 0 @@ -2604,7 +2617,7 @@ def image(self): sage: P2. = ProjectiveSpace(QQ, 2) sage: X = P2.subscheme(0) sage: f = X.hom([x1,x0], P) - sage: f.image() + sage: f.image() # needs sage.libs.singular Closed subscheme of Projective Space of dimension 1 over Rational Field defined by: (no polynomials) @@ -2613,7 +2626,7 @@ def image(self): sage: P2. = ProjectiveSpace(QQ,2) sage: X = P2.subscheme([z^3 - x*y^2 + y^3]) sage: f = X.hom([x*z, x*y, x^2 + y*z], P2) - sage: f.image() + sage: f.image() # needs sage.libs.singular Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x^6 + 2*x^3*y^3 + x*y^5 + y^6 - x^3*y^2*z - y^5*z """ @@ -2665,11 +2678,11 @@ def graph(self): sage: A1. = AffineSpace(1, QQ) sage: X = A1.subscheme(0) # affine line sage: phi = X.hom([x^2], A1) - sage: mor = phi.homogenize(0) - sage: G = mor.graph(); G + sage: mor = phi.homogenize(0) # needs sage.libs.singular + sage: G = mor.graph(); G # needs sage.libs.singular 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]) + sage: G.affine_patch([0, 0]) # needs sage.libs.singular Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x0^2 - x1 """ @@ -2718,11 +2731,11 @@ def projective_degrees(self): EXAMPLES:: sage: k = GF(11) - 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 + sage: E = EllipticCurve(k, [1,1]) # needs sage.rings.finite_rings + sage: Q = E(6, 5) # needs sage.rings.finite_rings + sage: phi = E.scalar_multiplication(2) # needs sage.rings.finite_rings + sage: mor = phi.as_morphism() # needs sage.rings.finite_rings + sage: mor.projective_degrees() # needs sage.rings.finite_rings (12, 3) """ X = self.domain() @@ -2760,11 +2773,11 @@ def degree(self): EXAMPLES:: sage: k = GF(11) - 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 + sage: E = EllipticCurve(k, [1,1]) # needs sage.rings.finite_rings + sage: Q = E(6, 5) # needs sage.rings.finite_rings + sage: phi = E.scalar_multiplication(2) # needs sage.rings.finite_rings + sage: mor = phi.as_morphism() # needs sage.rings.finite_rings + sage: mor.degree() # needs 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 22a47c2480e..a3c726e210c 100644 --- a/src/sage/schemes/projective/projective_point.py +++ b/src/sage/schemes/projective/projective_point.py @@ -139,8 +139,8 @@ def __init__(self, X, v, check=True): :: sage: R. = PolynomialRing(ZZ) - sage: P = ProjectiveSpace(1, R.quo(t^2 + 1)) - sage: P([2*t, 1]) + sage: P = ProjectiveSpace(1, R.quo(t^2 + 1)) # needs sage.libs.pari + sage: P([2*t, 1]) # needs sage.libs.pari (2*tbar : 1) :: @@ -236,9 +236,9 @@ def _richcmp_(self, right, op): :: - 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 + sage: PS = ProjectiveSpace(Zp(5), 1, 'x') # needs sage.rings.padics + sage: P = PS([0, 1]) + sage: P == PS(0) True :: @@ -261,9 +261,9 @@ def _richcmp_(self, right, op): sage: PS = ProjectiveSpace(ZZ, 1, 'x') sage: P = PS([2, 1]) - 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 + sage: PS2 = ProjectiveSpace(Zp(7), 1, 'x') # needs sage.rings.padics + sage: Q = PS2([2, 1]) # needs sage.rings.padics + sage: P == Q # needs sage.rings.padics True :: @@ -285,13 +285,13 @@ def _richcmp_(self, right, op): :: sage: R. = PolynomialRing(QQ) - 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 + sage: K. = NumberField(z^2 + 5) # needs sage.rings.number_field + sage: OK = K.ring_of_integers() # needs sage.rings.number_field + sage: t = OK.gen(1) # needs sage.rings.number_field + sage: PS. = ProjectiveSpace(OK, 1) # needs sage.rings.number_field + sage: P = PS(2, 1 + t) # needs sage.rings.number_field + sage: Q = PS(1 - t, 3) # needs sage.rings.number_field + sage: P == Q # needs sage.rings.number_field True Check that :trac:`17429` is fixed:: @@ -324,9 +324,9 @@ def _richcmp_(self, right, op): :: - 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 + sage: PS = ProjectiveSpace(Zp(5), 1, 'x') # needs sage.rings.padics + sage: P = PS([0, 1]) + sage: P != PS(0) False :: @@ -349,9 +349,9 @@ def _richcmp_(self, right, op): sage: PS = ProjectiveSpace(ZZ, 1, 'x') sage: P = PS([2, 1]) - 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 + sage: PS2 = ProjectiveSpace(Zp(7), 1, 'x') # needs sage.rings.padics + sage: Q = PS2([2, 1]) # needs sage.rings.padics + sage: P != Q # needs sage.rings.padics False :: @@ -397,10 +397,10 @@ def __hash__(self): :: sage: R. = PolynomialRing(QQ) - 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 + sage: K. = NumberField(x^2 + 3) # needs sage.rings.number_field + sage: O = K.maximal_order() # needs sage.rings.number_field + sage: P. = ProjectiveSpace(O, 1) # needs sage.rings.number_field + sage: hash(P([1 + w, 2])) == hash(P([2, 1 - w])) # needs sage.rings.number_field True TESTS:: @@ -441,8 +441,8 @@ def _matrix_times_point_(self, mat, dom): sage: P = ProjectiveSpace(QQ, 1) sage: Q = P(1,1) - sage: m = matrix(QQ, 2, 2, [1,1, 0,1]) - sage: m*Q + sage: m = matrix(QQ, 2, 2, [1,1, 0,1]) # needs sage.modules + sage: m*Q # needs sage.modules (2 : 1) :: @@ -450,25 +450,26 @@ def _matrix_times_point_(self, mat, dom): 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*Q + sage: m = matrix(CC, 3, 3, [1,CC.0,0, CC.0,1,0, 1,1,1]) # needs sage.modules + sage: m*Q # needs sage.modules (0.333333333333333 + 0.333333333333333*I : 0.333333333333333 + 0.333333333333333*I : 1.00000000000000) :: - 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 + sage: # needs sage.rings.number_field + sage: P = ProjectiveSpace(QQbar, 1) + sage: Q = P(QQbar(sqrt(2)),1) # needs sage.symbolic + sage: m = matrix(ZZ, 2, 2, [1,-1, 0,1]) # needs sage.modules sage.symbolic + sage: m*Q # needs sage.modules sage.symbolic (0.4142135623730951? : 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*Q + sage: m = matrix(QQ, 3, 2, [1,1, 0,1, 1,1]) # needs sage.modules + sage: m*Q # needs sage.modules Traceback (most recent call last): ... ValueError: matrix must be square @@ -505,10 +506,10 @@ def scale_by(self,t): :: sage: R. = PolynomialRing(QQ) - sage: S = R.quo(R.ideal(t^3)) - sage: P. = ProjectiveSpace(S, 2) + sage: S = R.quo(R.ideal(t^3)) # needs sage.libs.pari + sage: P. = ProjectiveSpace(S, 2) # needs sage.libs.pari sage: Q = P(t, 1, 1) - sage: Q.scale_by(t);Q + sage: Q.scale_by(t);Q # needs sage.libs.pari (tbar^2 : tbar : tbar) :: @@ -546,9 +547,9 @@ def normalize_coordinates(self): :: - 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 + sage: P = ProjectiveSpace(Zp(7), 2, 'x') # needs sage.rings.padics + sage: p = P([-5, -15, -2]) + sage: p.normalize_coordinates(); p # needs sage.rings.padics (5 + O(7^20) : 1 + 2*7 + O(7^20) : 2 + O(7^20)) :: @@ -588,10 +589,10 @@ def normalize_coordinates(self): 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) # needs sage.libs.singular + sage: Q = P(t + 1, t^2 + t) # needs sage.libs.singular sage: Q.normalize_coordinates() - sage: Q + sage: Q # needs sage.libs.singular (1 : tbar) """ R = self.codomain().base_ring() @@ -641,30 +642,30 @@ def dehomogenize(self,n): sage: P. = ProjectiveSpace(QQ, 2) sage: X = P.subscheme(x^2 - y^2) sage: Q = X(23, 23, 46) - sage: Q.dehomogenize(2) + sage: Q.dehomogenize(2) # needs sage.libs.singular (1/2, 1/2) :: sage: R. = PolynomialRing(QQ) - sage: S = R.quo(R.ideal(t^3)) - sage: P. = ProjectiveSpace(S, 2) - sage: Q = P(t, 1, 1) - sage: Q.dehomogenize(1) + sage: S = R.quo(R.ideal(t^3)) # needs sage.libs.pari + sage: P. = ProjectiveSpace(S, 2) # needs sage.libs.pari + sage: Q = P(t, 1, 1) # needs sage.libs.pari + sage: Q.dehomogenize(1) # needs sage.libs.pari sage.libs.singular (tbar, 1) :: sage: P. = ProjectiveSpace(GF(5), 2) sage: Q = P(1, 3, 1) - sage: Q.dehomogenize(0) # optional - sage.libs.singular + sage: Q.dehomogenize(0) (3, 1) :: sage: P. = ProjectiveSpace(GF(5), 2) sage: Q = P(1, 3, 0) - sage: Q.dehomogenize(2) # optional - sage.libs.singular + sage: Q.dehomogenize(2) Traceback (most recent call last): ... ValueError: can...t dehomogenize at 0 coordinate @@ -696,49 +697,50 @@ def global_height(self, prec=None): sage: P. = ProjectiveSpace(QQ, 2) sage: Q = P.point([4, 4, 1/30]) - sage: Q.global_height() # optional - sage.symbolic + sage: Q.global_height() # needs sage.symbolic 4.78749174278205 :: sage: P. = ProjectiveSpace(ZZ, 2) sage: Q = P([4, 1, 30]) - sage: Q.global_height() # optional - sage.symbolic + sage: Q.global_height() # needs sage.symbolic 3.40119738166216 :: sage: R. = PolynomialRing(QQ) - 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 + sage: k. = NumberField(x^2 + 5) # needs sage.rings.number_field + sage: A = ProjectiveSpace(k, 2, 'z') # needs sage.rings.number_field + sage: A([3, 5*w + 1, 1]).global_height(prec=100) # needs sage.rings.number_field 2.4181409534757389986565376694 :: - 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 + sage: P. = ProjectiveSpace(QQbar, 2) # needs sage.rings.number_field + sage: Q = P([QQbar(sqrt(3)), QQbar(sqrt(-2)), 1]) # needs sage.rings.number_field + sage: Q.global_height() # needs sage.rings.number_field 0.549306144334055 :: - 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 + sage: # needs sage.rings.number_field + 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() 1.38629436111989 TESTS:: sage: P = ProjectiveSpace(QQ, 2) - sage: P(1/1, 2/3, 5/8).global_height() # optional - sage.symbolic + sage: P(1/1, 2/3, 5/8).global_height() # needs sage.symbolic 3.17805383034795 sage: x = polygen(QQ, 'x') - 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 + sage: F. = NumberField(x^3 - 5) # needs sage.rings.number_field + sage: P = ProjectiveSpace(F, 2) # needs sage.rings.number_field + sage: P(u, u^2/5, 1).global_height() # needs sage.rings.number_field 1.07295860828940 """ if prec is None: @@ -788,14 +790,14 @@ def local_height(self, v, prec=None): sage: P. = ProjectiveSpace(QQ, 2) sage: Q = P.point([4, 4, 1/150], False) - sage: Q.local_height(5) + sage: Q.local_height(5) # needs sage.rings.real_mpfr 3.21887582486820 :: sage: P. = ProjectiveSpace(QQ, 2) sage: Q = P([4, 1, 30]) - sage: Q.local_height(2) + sage: Q.local_height(2) # needs sage.rings.real_mpfr 0.693147180559945 """ K = FractionField(self.domain().base_ring()) @@ -822,14 +824,14 @@ def local_height_arch(self, i, prec=None): sage: P. = ProjectiveSpace(QQ, 2) sage: Q = P.point([4, 4, 1/150], False) - sage: Q.local_height_arch(0) + sage: Q.local_height_arch(0) # needs sage.rings.real_mpfr 1.38629436111989 :: - 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 + sage: P. = ProjectiveSpace(QuadraticField(5, 'w'), 2) # needs sage.rings.number_field + sage: Q = P.point([4, 1, 30], False) + sage: Q.local_height_arch(1) # needs sage.rings.number_field 3.401197381662155375413236691607 """ K = FractionField(self.domain().base_ring()) @@ -862,9 +864,9 @@ def multiplier(self, f, n, check=True): EXAMPLES:: sage: P. = ProjectiveSpace(QQ, 3) - sage: f = DynamicalSystem_projective([x^2, y^2, 4*w^2, 4*z^2], domain=P) + sage: f = DynamicalSystem_projective([x^2, y^2, 4*w^2, 4*z^2], domain=P) # needs sage.schemes sage: Q = P.point([4, 4, 1, 1], False) - sage: Q.multiplier(f, 1) + sage: Q.multiplier(f, 1) # needs sage.schemes [ 2 0 -8] [ 0 2 -8] [ 0 0 -2] @@ -919,103 +921,103 @@ 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: f = DynamicalSystem_projective([x^3 - 3*x*y^2, y^3], domain=P) # needs sage.schemes sage: Q = P(-1, 1) - sage: Q.is_preperiodic(f) + sage: Q.is_preperiodic(f) # needs sage.schemes True :: sage: P. = ProjectiveSpace(QQ, 2) sage: X = P.subscheme(z) - sage: f = DynamicalSystem([x^2 - y^2, y^2, z^2], domain=X) + sage: f = DynamicalSystem([x^2 - y^2, y^2, z^2], domain=X) # needs sage.schemes sage: p = X((-1, 1, 0)) - sage: p.is_preperiodic(f, return_period=True) + sage: p.is_preperiodic(f, return_period=True) # needs sage.schemes (0, 2) :: sage: P. = ProjectiveSpace(QQ,1) - sage: f = DynamicalSystem_projective([x^2 - 29/16*y^2, y^2], domain=P) + sage: f = DynamicalSystem_projective([x^2 - 29/16*y^2, y^2], domain=P) # needs sage.schemes sage: Q = P(1, 4) - sage: Q.is_preperiodic(f, return_period=True) + sage: Q.is_preperiodic(f, return_period=True) # needs sage.schemes (1, 3) sage: Q = P(1, 1) - sage: Q.is_preperiodic(f, return_period=True) + sage: Q.is_preperiodic(f, return_period=True) # needs sage.schemes (0, 0) :: sage: R. = PolynomialRing(QQ) - 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 + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^5 + 5/4*x*y^4, y^5], domain=P) # needs sage.rings.number_field sage.schemes + sage: Q = P([-1/2*a + 1/2, 1]) # needs sage.rings.number_field + sage: Q.is_preperiodic(f) # needs sage.rings.number_field sage.schemes True - sage: Q = P([a, 1]) # optional - sage.rings.number_field - sage: Q.is_preperiodic(f) # optional - sage.rings.number_field + sage: Q = P([a, 1]) # needs sage.rings.number_field + sage: Q.is_preperiodic(f) # needs sage.rings.number_field sage.schemes False :: sage: P. = ProjectiveSpace(QQ, 2) - sage: f = DynamicalSystem_projective([ + sage: f = DynamicalSystem_projective([ # needs sage.schemes ....: -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) + sage: Q.is_preperiodic(f, return_period=True) # needs sage.schemes (0, 9) :: sage: P. = ProjectiveSpace(QQ, 3) - sage: f = DynamicalSystem_projective([ + sage: f = DynamicalSystem_projective([ # needs sage.schemes ....: (-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) + sage: Q.is_preperiodic(f, return_period=True) # needs sage.schemes (2, 24) :: 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], # optional - sage.rings.number_field sage.symbolic + sage: P. = ProjectiveSpace(QQbar, 2) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2, QQbar(sqrt(-1))*y^2, z^2], # needs sage.rings.number_field sage.schemes 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 + sage: Q = P([1, 1, 1]) + sage: Q.is_preperiodic(f) # needs sage.rings.number_field sage.schemes 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) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2, y^2, z^2], domain=P) # needs sage.rings.number_field sage.schemes + sage: Q = P([QQbar(sqrt(-1)), 1, 1]) # needs sage.rings.number_field sage.symbolic + sage: Q.is_preperiodic(f) # needs sage.rings.number_field sage.schemes 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) # needs sage.schemes sage: Q = P(-1,4) - sage: Q.is_preperiodic(f) + sage: Q.is_preperiodic(f) # needs sage.schemes True :: sage: P. = ProjectiveSpace(GF(3), 2) - sage: F = DynamicalSystem([x^2 - 2*y^2, y^2, z^2]) # optional - sage.rings.finite_rings sage.schemes + sage: F = DynamicalSystem([x^2 - 2*y^2, y^2, z^2]) # needs sage.rings.finite_rings sage.schemes sage: Q = P(1, 1, 1) - sage: Q.is_preperiodic(F, return_period=True) # optional - sage.rings.finite_rings sage.schemes + sage: Q.is_preperiodic(F, return_period=True) # needs sage.rings.finite_rings sage.schemes (1, 1) TESTS:: @@ -1032,9 +1034,9 @@ 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]) # needs sage.schemes sage: Q = P(11,4) - sage: Q.is_preperiodic(f, err=2) + sage: Q.is_preperiodic(f, err=2) # needs sage.schemes False """ try: @@ -1224,26 +1226,26 @@ def _number_field_from_algebraics(self): EXAMPLES:: sage: R. = PolynomialRing(QQ) - 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 + sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field + sage: Q = P([-1/2*QQbar(sqrt(2)) + QQbar(I), 1]) # needs sage.rings.number_field sage.symbolic + sage: S = Q._number_field_from_algebraics(); S # needs sage.rings.number_field sage.symbolic (1/2*a^3 + a^2 - 1/2*a : 1) - sage: S.codomain() # optional - sage.rings.number_field sage.symbolic + sage: S.codomain() # needs 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) # optional - sage.rings.number_field - sage: Q = P([-1/2*QQbar(sqrt(2)) + QQbar(I), 1]);Q # optional - sage.rings.number_field sage.symbolic + sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field + sage: Q = P([-1/2*QQbar(sqrt(2)) + QQbar(I), 1]);Q # needs sage.rings.number_field sage.symbolic (-0.7071067811865475? + 1*I : 1) - sage: S = Q._number_field_from_algebraics(); S # optional - sage.rings.number_field sage.symbolic + sage: S = Q._number_field_from_algebraics(); S # needs 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 # optional - sage.rings.number_field sage.symbolic - sage: T # optional - sage.rings.number_field sage.symbolic + sage: T = S.change_ring(QQbar) # Used to fail # needs sage.rings.number_field sage.symbolic + sage: T # needs sage.rings.number_field sage.symbolic (-0.7071067811865475? + 1.000000000000000?*I : 1) - sage: Q[0] == T[0] # optional - sage.rings.number_field sage.symbolic + sage: Q[0] == T[0] # needs sage.rings.number_field sage.symbolic True """ from sage.schemes.projective.projective_space import is_ProjectiveSpace @@ -1282,10 +1284,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) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: Q = P([1/w, 3, 0]) # needs sage.rings.number_field + sage: Q.clear_denominators(); Q # needs sage.rings.number_field (w : 9 : 0) :: @@ -1325,13 +1327,13 @@ def intersection_multiplicity(self, X): sage: X = P.subscheme([x*z - y^2]) sage: Y = P.subscheme([x^3 - y*w^2 + z*w^2, x*y - z*w]) sage: Q1 = X([1/2, 1/4, 1/8, 1]) - sage: Q1.intersection_multiplicity(Y) + sage: Q1.intersection_multiplicity(Y) # needs sage.libs.singular 1 sage: Q2 = X([0,0,0,1]) - sage: Q2.intersection_multiplicity(Y) + sage: Q2.intersection_multiplicity(Y) # needs sage.libs.singular 5 sage: Q3 = X([0,0,1,0]) - sage: Q3.intersection_multiplicity(Y) + sage: Q3.intersection_multiplicity(Y) # needs sage.libs.singular 6 :: @@ -1363,10 +1365,10 @@ def multiplicity(self): sage: P. = ProjectiveSpace(QQ, 4) sage: X = P.subscheme([y^6 - x^3*w^2*t + t^5*w, x^2 - t^2]) sage: Q1 = X([1,0,2,1,1]) - sage: Q1.multiplicity() + sage: Q1.multiplicity() # needs sage.libs.singular 1 sage: Q2 = X([0,0,-2,1,0]) - sage: Q2.multiplicity() + sage: Q2.multiplicity() # needs sage.libs.singular 8 """ from sage.schemes.projective.projective_space import is_ProjectiveSpace @@ -1403,8 +1405,8 @@ def __hash__(self): :: - sage: P. = ProjectiveSpace(GF(13^3,'t'), 1) # optional - sage.rings.finite_rings - sage: hash(P(3, 4)) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(13^3,'t'), 1) # needs sage.rings.finite_rings + sage: hash(P(3, 4)) # needs sage.rings.finite_rings 2201 """ p = self.codomain().base_ring().order() @@ -1420,6 +1422,7 @@ class SchemeMorphism_point_abelian_variety_field(AdditiveGroupElement, SchemeMor EXAMPLES:: + sage: # needs sage.schemes sage: E = EllipticCurve([0,0,1,-1,0]) sage: origin = E(0) sage: origin.domain() diff --git a/src/sage/schemes/projective/projective_rational_point.py b/src/sage/schemes/projective/projective_rational_point.py index 0ab98a08484..fd5a77f38e0 100644 --- a/src/sage/schemes/projective/projective_rational_point.py +++ b/src/sage/schemes/projective/projective_rational_point.py @@ -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)) # optional - sage.rings.finite_rings - sage: enum_projective_finite_field(E) # optional - sage.rings.finite_rings + sage: E = EllipticCurve('72').change_ring(GF(19)) # needs sage.rings.finite_rings sage.schemes + sage: enum_projective_finite_field(E) # needs sage.rings.finite_rings sage.schemes [(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), @@ -187,20 +187,19 @@ 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') # 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 + sage: K = NumberField(u^3 - 5, 'v') # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: X = P.subscheme([x - y]) # needs sage.rings.number_field + sage: enum_projective_number_field(X(K), bound=RR(5^(1/3)), prec=2^10) # needs 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') # 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) # optional - sage.rings.number_field + sage: K = NumberField(u^2 + 3, 'v') # needs sage.rings.number_field + sage: A. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: X = A.subscheme(x - y) # needs sage.rings.number_field + sage: enum_projective_number_field(X, bound=2) # needs sage.rings.number_field [(1 : 1)] """ B = kwds.pop('bound') @@ -256,10 +255,10 @@ def enum_projective_finite_field(X): :: - sage: F = GF(9, 'a') # optional - sage.rings.finite_rings + sage: F = GF(9, 'a') # needs sage.rings.finite_rings sage: P. = ProjectiveSpace(2,F) - sage: C = Curve(X^3 - Y^3 + Z^2*Y) # optional - sage.rings.finite_rings sage.schemes - sage: enum_projective_finite_field(C(F)) # optional - sage.rings.finite_rings sage.schemes + sage: C = Curve(X^3 - Y^3 + Z^2*Y) # needs sage.rings.finite_rings sage.schemes + sage: enum_projective_finite_field(C(F)) # needs sage.rings.finite_rings sage.schemes [(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)] @@ -346,15 +345,15 @@ def sieve(X, bound): 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: sorted(sieve(Y, 12)) # long time + sage: sorted(sieve(Y, 12)) # long time # needs sage.libs.singular [(-4 : -4/3 : 0 : 1), (-4 : 4/3 : 0 : 1), (-1 : -1/3 : 1 : 0), (-1 : 1/3 : 1 : 0)] :: sage: from sage.schemes.projective.projective_rational_point import sieve - sage: E = EllipticCurve('37a') - sage: sorted(sieve(E, 14)) # long time + sage: E = EllipticCurve('37a') # needs sage.schemes + sage: sorted(sieve(E, 14)) # long time # needs sage.libs.singular sage.schemes [(-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), @@ -367,7 +366,7 @@ def sieve(X, bound): sage: from sage.schemes.projective.projective_rational_point import sieve sage: P. = ProjectiveSpace(2, QQ) sage: X = P.subscheme(3*x - 3/2*y) - sage: sieve(X, 3) + sage: sieve(X, 3) # needs sage.libs.singular [(-1 : -2 : 1), (-1/2 : -1 : 1), (-1/3 : -2/3 : 1), (0 : 0 : 1), (1/3 : 2/3 : 1), (1/2 : 1 : 0), (1/2 : 1 : 1), (1 : 2 : 1)] """ diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index e04539a841f..b5029a6255a 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -1428,7 +1428,7 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): :: sage: P. = ProjectiveSpace(QQ, 1) - sage: P.chebyshev_polynomial(-4, 'second') # needs sage.symbolic + sage: P.chebyshev_polynomial(-4, 'second') Traceback (most recent call last): ... ValueError: first parameter 'n' must be a non-negative integer @@ -1436,7 +1436,7 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): :: sage: P = ProjectiveSpace(QQ, 2, 'x') - sage: P.chebyshev_polynomial(2) # needs sage.symbolic + sage: P.chebyshev_polynomial(2) Traceback (most recent call last): ... TypeError: projective space must be of dimension 1 @@ -1669,7 +1669,7 @@ 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.point_transformation_matrix(points_source, points_target) # needs sage.modules + sage: P.point_transformation_matrix(points_source, points_target) Traceback (most recent call last): ... ValueError: incorrect number of points in source, need 4 points @@ -1679,7 +1679,7 @@ 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.point_transformation_matrix(points_source, points_target) # needs sage.modules + sage: P.point_transformation_matrix(points_source, points_target) Traceback (most recent call last): ... ValueError: incorrect number of points in target, need 4 points @@ -1690,7 +1690,7 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr 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) # needs sage.modules + sage: P.point_transformation_matrix(points_source, points_target) Traceback (most recent call last): ... ValueError: source points not in self @@ -1701,7 +1701,7 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr 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) # needs sage.modules + sage: P.point_transformation_matrix(points_source, points_target) Traceback (most recent call last): ... ValueError: target points not in self @@ -1816,11 +1816,12 @@ def hyperplane_transformation_matrix(self, plane_1, plane_2): :: - sage: K. = CyclotomicField(3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field - sage: plane1 = P.subscheme(x - 2*v*y + z) # needs sage.rings.number_field - sage: plane2 = P.subscheme(x + v*y + v*z) # needs sage.rings.number_field - sage: m = P.hyperplane_transformation_matrix(plane1, plane2); m # needs sage.modules sage.rings.number_field + sage: # needs sage.rings.number_field + 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); m # needs sage.modules [ v 0 0] [ 0 -2*v 0] [ 0 0 1] @@ -1840,15 +1841,16 @@ def hyperplane_transformation_matrix(self, plane_1, plane_2): :: - sage: K. = CyclotomicField(3) # needs sage.rings.number_field - sage: R. = K[] # needs sage.rings.number_field - sage: F. = K.extension(t^5 + 2) # needs sage.rings.number_field - sage: G. = F.absolute_field() # needs sage.rings.number_field - sage: P. = ProjectiveSpace(G, 2) # needs sage.rings.number_field - sage: plane1 = P.subscheme(x - 2*u*y + z) # needs sage.rings.number_field - sage: plane2 = P.subscheme(x + u*y + z) # needs sage.rings.number_field - sage: m = P.hyperplane_transformation_matrix(plane1, plane2) # needs sage.modules sage.rings.number_field - sage: plane2(m*P((2*u, 1, 0))) # needs sage.modules sage.rings.number_field + sage: # needs sage.rings.number_field + 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) # needs sage.modules + sage: plane2(m*P((2*u, 1, 0))) # needs sage.modules (-u : 1 : 0) :: @@ -1877,7 +1879,7 @@ def hyperplane_transformation_matrix(self, plane_1, plane_2): sage: P. = ProjectiveSpace(QQ, 1) sage: plane1 = P.subscheme(x^2) sage: plane2 = P.subscheme(y) - sage: P.hyperplane_transformation_matrix(plane1, plane2) # needs sage.modules + sage: P.hyperplane_transformation_matrix(plane1, plane2) Traceback (most recent call last): ... ValueError: plane_1 must be defined by a single degree 1 equation @@ -2000,10 +2002,11 @@ def is_linearly_independent(self, points, n=None): :: - sage: K. = CyclotomicField(3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field - sage: points = [P((k, k^2, 1)), P((0, k, 1)), P((1, 0, 4)), P((0, 0, 1))] # needs sage.rings.number_field - sage: P.is_linearly_independent(points, 3) # needs sage.modules sage.rings.number_field + sage: # needs sage.rings.number_field + 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) # needs sage.modules True :: @@ -2016,7 +2019,7 @@ def is_linearly_independent(self, points, n=None): TESTS:: sage: points = [P(1, 0), P(1, 1), P(2, 1)] - sage: P.is_linearly_independent(points, 5) # needs sage.modules + sage: P.is_linearly_independent(points, 5) Traceback (most recent call last): ... ValueError: n must be a non negative integer not greater than the length of points diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index 8dc53d89bd6..6d2470f4229 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -169,15 +169,15 @@ def dimension(self): EXAMPLES:: sage: P2. = ProjectiveSpace(2, QQ) - sage: P2.subscheme([]).dimension() + sage: P2.subscheme([]).dimension() # needs sage.libs.singular 2 - sage: P2.subscheme([x]).dimension() + sage: P2.subscheme([x]).dimension() # needs sage.libs.singular 1 - sage: P2.subscheme([x^5]).dimension() + sage: P2.subscheme([x^5]).dimension() # needs sage.libs.singular 1 - sage: P2.subscheme([x^2 + y^2 - z^2]).dimension() + sage: P2.subscheme([x^2 + y^2 - z^2]).dimension() # needs sage.libs.singular 1 - sage: P2.subscheme([x*(x-z), y*(y-z)]).dimension() + sage: P2.subscheme([x*(x-z), y*(y-z)]).dimension() # needs sage.libs.singular 0 Something less obvious:: @@ -190,7 +190,7 @@ def dimension(self): x^2*y^2 + z^2*t^2, z^2 - w^2, 10*x^2 - z^2 + w^2 - sage: X.dimension() + sage: X.dimension() # needs sage.libs.singular 1 """ try: @@ -224,26 +224,25 @@ def affine_patch(self, i, AA=None): sage: PP = ProjectiveSpace(2, QQ, names='X,Y,Z') sage: X,Y,Z = PP.gens() sage: C = PP.subscheme(X^3*Y + Y^3*Z + Z^3*X) - sage: U = C.affine_patch(0) - sage: U + sage: U = C.affine_patch(0); U # needs sage.libs.singular Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: Y^3*Z + Z^3 + Y - sage: U.embedding_morphism() + sage: U.embedding_morphism() # needs sage.libs.singular 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 Defn: Defined on coordinates by sending (Y, Z) to (1 : Y : Z) - sage: U.projective_embedding() is U.embedding_morphism() + sage: U.projective_embedding() is U.embedding_morphism() # needs sage.libs.singular True :: 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 = X.projective_embedding(1).codomain() # needs sage.libs.singular + sage: Y.affine_patch(1, A).ambient_space() == A # needs sage.libs.singular True :: @@ -251,7 +250,7 @@ def affine_patch(self, i, AA=None): sage: P. = ProjectiveSpace(2, ZZ) sage: S = P.subscheme([u^2 - v*w]) sage: A. = AffineSpace(2, ZZ) - sage: S.affine_patch(1, A) + sage: S.affine_patch(1, A) # needs sage.libs.singular Closed subscheme of Affine Space of dimension 2 over Integer Ring defined by: x^2 - y """ @@ -415,19 +414,19 @@ def is_smooth(self, point=None): sage: cuspidal_curve Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: -x^3 + y^2*z - sage: cuspidal_curve.is_smooth([1,1,1]) + sage: cuspidal_curve.is_smooth([1,1,1]) # needs sage.libs.singular True - sage: cuspidal_curve.is_smooth([0,0,1]) + sage: cuspidal_curve.is_smooth([0,0,1]) # needs sage.libs.singular False - sage: cuspidal_curve.is_smooth() + sage: cuspidal_curve.is_smooth() # needs sage.libs.singular 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() # needs sage.libs.singular True TESTS:: sage: H = P2.subscheme(x) - sage: H.is_smooth() # one of the few cases where the cone over the subvariety is smooth + sage: H.is_smooth() # one of the few cases where the cone over the subvariety is smooth # needs sage.libs.singular True """ if point is not None: @@ -468,8 +467,9 @@ 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, # needs sage.schemes + ....: (x-2*w)^2, x^2]) + sage: f.orbit(P.subscheme([x]), 5) # needs sage.schemes [Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: x, Closed subscheme of Projective Space of dimension 3 over Rational Field @@ -498,9 +498,9 @@ def orbit(self, f, N): :: sage: PS. = ProjectiveSpace(QQ, 2) - sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) + sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) # needs sage.schemes sage: X = PS.subscheme([x - y]) - sage: X.orbit(f, [-1,2]) + sage: X.orbit(f, [-1,2]) # needs sage.schemes Traceback (most recent call last): ... TypeError: orbit bounds must be non-negative @@ -544,8 +544,8 @@ def nth_iterate(self, f, n): EXAMPLES:: 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 = DynamicalSystem_projective([y^2, z^2, x^2, w^2]) # needs sage.schemes + sage: f.nth_iterate(P.subscheme([x - w, y - z]), 3) # needs sage.schemes Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: y - z, @@ -554,9 +554,9 @@ def nth_iterate(self, f, n): :: sage: PS. = ProjectiveSpace(ZZ, 2) - sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) + sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) # needs sage.schemes sage: X = PS.subscheme([x - y]) - sage: X.nth_iterate(f, -2) + sage: X.nth_iterate(f, -2) # needs sage.schemes Traceback (most recent call last): ... TypeError: must be a forward orbit @@ -576,9 +576,9 @@ def nth_iterate(self, f, n): :: sage: PS. = ProjectiveSpace(QQ, 2) - sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) + sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) # needs sage.schemes sage: X = PS.subscheme([x - y]) - sage: X.nth_iterate(f, 2.5) + sage: X.nth_iterate(f, 2.5) # needs sage.schemes Traceback (most recent call last): ... TypeError: Attempt to coerce non-integral RealNumber to Integer @@ -615,7 +615,7 @@ def _forward_image(self, f, check=True): sage: H = End(PS) sage: f = H([x^2, y^2 - 2*z^2, z^2]) sage: X = PS.subscheme(y - 2*z) - sage: X._forward_image(f) + sage: X._forward_image(f) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: y - 2*z @@ -627,7 +627,7 @@ def _forward_image(self, f, check=True): 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: f(X) + sage: f(X) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 3 over Integer Ring defined by: y - z, @@ -635,11 +635,12 @@ def _forward_image(self, f, check=True): :: + sage: # needs sage.rings.real_mpfr 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: f(X) + sage: f(X) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 3 over Complex Field with 53 bits of precision defined by: y + z + (-4.00000000000000)*w @@ -650,7 +651,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]) # needs sage.libs.singular 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 @@ -658,11 +659,11 @@ def _forward_image(self, f, check=True): :: sage: set_verbose(-1) - 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 + sage: PS. = ProjectiveSpace(Qp(3), 2) # needs sage.rings.padics + 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) # needs sage.libs.singular sage.rings.padics Closed subscheme of Projective Space of dimension 2 over 3-adic Field with capped relative precision 20 defined by: z, @@ -675,7 +676,7 @@ def _forward_image(self, f, check=True): sage: H = End(P) 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) + sage: X._forward_image(f) # needs sage.libs.singular 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: @@ -688,7 +689,7 @@ def _forward_image(self, f, check=True): sage: H = Hom(P2, P5) sage: f = H([x^2, x*y, x*z, y^2, y*z, z^2]) # Veronese map sage: X = P2.subscheme([]) - sage: f(X) + sage: f(X) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 5 over Rational Field defined by: -z4^2 + z3*z5, @@ -705,7 +706,7 @@ def _forward_image(self, f, check=True): 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: f(X) + sage: f(X) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: w - t, @@ -719,7 +720,7 @@ def _forward_image(self, f, check=True): sage: H = Hom(P2, P1) sage: f = H([x^2, y*z]) sage: X = P2.subscheme([x - y]) - sage: f(X) + sage: f(X) # needs sage.libs.singular Traceback (most recent call last): ... TypeError: map must be a morphism @@ -730,7 +731,7 @@ def _forward_image(self, f, check=True): sage: H = End(PS) sage: f = H([x^3, x*y^2, x*z^2]) sage: X = PS.subscheme([x - y]) - sage: X._forward_image(f) + sage: X._forward_image(f) # needs sage.libs.singular Traceback (most recent call last): ... TypeError: map must be a morphism @@ -742,7 +743,7 @@ def _forward_image(self, f, check=True): sage: Y = P1.subscheme([u - v]) sage: H = End(PS) sage: f = H([x^2, y^2, z^2]) - sage: Y._forward_image(f) + sage: Y._forward_image(f) # needs sage.libs.singular Traceback (most recent call last): ... TypeError: subscheme must be in ambient space of domain of map @@ -801,7 +802,7 @@ def preimage(self, f, k=1, check=True): sage: H = End(PS) sage: f = H([y^2, x^2, z^2]) sage: X = PS.subscheme([x - y]) - sage: X.preimage(f) + sage: X.preimage(f) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 2 over Integer Ring defined by: -x^2 + y^2 @@ -811,7 +812,7 @@ 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.rational_preimages(P.subscheme([x - z, t^2, w - t])) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 4 over Rational Field defined by: x^2 - y^2 - z^2, @@ -825,7 +826,7 @@ def preimage(self, f, k=1, check=True): 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.preimage(f) + sage: X.preimage(f) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 1 over Rational Field defined by: x^2 - y^2, @@ -839,7 +840,7 @@ def preimage(self, f, k=1, check=True): sage: H = Hom(P3, P1) sage: X = P1.subscheme([x - y]) sage: f = H([u^2, v^2]) - sage: X.preimage(f) + sage: X.preimage(f) # needs sage.libs.singular Traceback (most recent call last): ... TypeError: map must be a morphism @@ -850,7 +851,7 @@ def preimage(self, f, k=1, check=True): sage: H = End(PS) sage: f = H([x^2, x^2, x^2]) sage: X = PS.subscheme([x - y]) - sage: X.preimage(f) + sage: X.preimage(f) # needs sage.libs.singular Traceback (most recent call last): ... TypeError: map must be a morphism @@ -862,7 +863,7 @@ def preimage(self, f, k=1, check=True): 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) + sage: Y.preimage(f) # needs sage.libs.singular Traceback (most recent call last): ... TypeError: subscheme must be in ambient space of codomain @@ -873,7 +874,7 @@ def preimage(self, f, k=1, check=True): 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) + sage: Y.preimage(f, k=2) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x^4 - y^4 @@ -920,7 +921,7 @@ def dual(self): sage: P. = ProjectiveSpace(2, QQ) sage: I = R.ideal(x^2 + y^2 + z^2) sage: X = P.subscheme(I) - sage: X.dual() + sage: X.dual() # needs sage.libs.singular Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: y0^2 + y1^2 + y2^2 @@ -934,7 +935,7 @@ def dual(self): sage: P. = ProjectiveSpace(3, QQ) sage: I = R.ideal(y^2*z^2 - 4*x*z^3 - 4*y^3*w + 18*x*y*z*w - 27*x^2*w^2) sage: X = P.subscheme(I) - sage: X.dual() + sage: X.dual() # needs sage.libs.singular Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: y2^2 - y1*y3, @@ -944,7 +945,7 @@ def dual(self): The singular locus of the quartic surface in the last example is itself supported on a twisted cubic:: - sage: X.Jacobian().radical() + sage: X.Jacobian().radical() # needs sage.libs.singular Ideal (z^2 - 3*y*w, y*z - 9*x*w, y^2 - 3*x*z) of Multivariate Polynomial Ring in x, y, z, w over Rational Field @@ -953,17 +954,18 @@ def dual(self): 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() # optional - sage.libs.singular sage.rings.finite_rings + sage: X.dual() # needs sage.libs.singular 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') # 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 + sage: # needs sage.rings.padics + 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() Traceback (most recent call last): ... NotImplementedError: base ring must be QQ or a finite field @@ -1022,17 +1024,17 @@ def degree(self): sage: P. = ProjectiveSpace(QQ, 5) sage: X = P.subscheme([x^7 + x*y*z*t^4 - u^7]) - sage: X.degree() + sage: X.degree() # needs sage.libs.singular 7 sage: P. = ProjectiveSpace(GF(13), 3) sage: X = P.subscheme([y^3 - w^3, x + 7*z]) - sage: X.degree() # optional - sage.libs.singular sage.rings.finite_rings + sage: X.degree() # needs sage.libs.singular sage.rings.finite_rings 3 sage: P. = ProjectiveSpace(QQ, 4) - sage: C = P.curve([x^7 - y*z^3*w^2*u, w*x^2 - y*u^2, z^3 + y^3]) - sage: C.degree() + sage: C = P.curve([x^7 - y*z^3*w^2*u, w*x^2 - y*u^2, z^3 + y^3]) # needs sage.schemes + sage: C.degree() # needs sage.libs.singular sage.schemes 63 """ P = self.defining_ideal().hilbert_polynomial() @@ -1056,27 +1058,27 @@ def intersection_multiplicity(self, X, P): EXAMPLES:: sage: P. = ProjectiveSpace(GF(5), 2) - 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: C = Curve([x^4 - z^2*y^2], P) # needs sage.rings.finite_rings + sage: D = Curve([y^4*z - x^5 - x^3*z^2], P) # needs sage.rings.finite_rings sage: Q1 = P([0,1,0]) - sage: C.intersection_multiplicity(D, Q1) # optional - sage.libs.singular sage.rings.finite_rings + sage: C.intersection_multiplicity(D, Q1) # needs sage.libs.singular sage.rings.finite_rings 4 sage: Q2 = P([0,0,1]) - sage: C.intersection_multiplicity(D, Q2) # optional - sage.libs.singular sage.rings.finite_rings + sage: C.intersection_multiplicity(D, Q2) # needs sage.libs.singular sage.rings.finite_rings 6 :: sage: R. = QQ[] - 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 + sage: K. = NumberField(a^4 + 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 3) # needs sage.rings.number_field + sage: X = P.subscheme([x^2 + y^2 - z*w]) # needs sage.rings.number_field + sage: Y = P.subscheme([y*z - x*w, z - w]) # needs sage.rings.number_field + sage: Q1 = P([b^2,1,0,0]) # needs sage.rings.number_field + sage: X.intersection_multiplicity(Y, Q1) # needs sage.libs.singular sage.rings.number_field 1 - 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 + sage: Q2 = P([1/2*b^3 - 1/2*b, 1/2*b^3 - 1/2*b, 1, 1]) # needs sage.rings.number_field + sage: X.intersection_multiplicity(Y, Q2) # needs sage.libs.singular sage.rings.number_field 1 :: @@ -1085,7 +1087,7 @@ def intersection_multiplicity(self, X, P): sage: X = P.subscheme([x^2 - z^2, y^3 - w*x^2]) sage: Y = P.subscheme([w^2 - 2*x*y + z^2, y^2 - w^2]) sage: Q = P([1,1,-1,1]) - sage: X.intersection_multiplicity(Y, Q) + sage: X.intersection_multiplicity(Y, Q) # needs sage.libs.singular Traceback (most recent call last): ... TypeError: the intersection of this subscheme and (=Closed subscheme of Affine Space of dimension 3 @@ -1126,29 +1128,30 @@ def multiplicity(self, P): sage: P. = ProjectiveSpace(QQ, 4) sage: X = P.subscheme([y^2 - x*t, w^7 - t*w*x^5 - z^7]) sage: Q1 = P([0,0,1,1,1]) - sage: X.multiplicity(Q1) + sage: X.multiplicity(Q1) # needs sage.libs.singular 1 sage: Q2 = P([1,0,0,0,0]) - sage: X.multiplicity(Q2) + sage: X.multiplicity(Q2) # needs sage.libs.singular 3 sage: Q3 = P([0,0,0,0,1]) - sage: X.multiplicity(Q3) + sage: X.multiplicity(Q3) # needs sage.libs.singular 7 :: + sage: # needs sage.rings.real_mpfr sage: P. = ProjectiveSpace(CC, 3) sage: X = P.subscheme([z^5*x^2*w - y^8]) sage: Q = P([2,0,0,1]) - sage: X.multiplicity(Q) + sage: X.multiplicity(Q) # needs sage.libs.singular 5 :: sage: P. = ProjectiveSpace(GF(29), 3) - sage: C = Curve([y^17 - x^5*w^4*z^8, x*y - z^2], P) # optional - sage.rings.finite_rings + sage: C = Curve([y^17 - x^5*w^4*z^8, x*y - z^2], P) # needs sage.rings.finite_rings sage: Q = P([3,0,0,1]) - sage: C.multiplicity(Q) # optional - sage.libs.singular sage.rings.finite_rings + sage: C.multiplicity(Q) # needs sage.libs.singular sage.rings.finite_rings 8 """ if self.base_ring() not in Fields(): @@ -1190,8 +1193,7 @@ def veronese_embedding(self, d, CS=None, order='lex'): sage: P. = ProjectiveSpace(QQ, 2) sage: L = P.subscheme([y - x]) - sage: v = L.veronese_embedding(2) - sage: v + sage: v = L.veronese_embedding(2); v # needs sage.libs.singular Scheme morphism: From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: -x + y @@ -1203,17 +1205,17 @@ def veronese_embedding(self, d, CS=None, order='lex'): 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() + sage: v.codomain().degree() # needs sage.libs.singular 2 sage: C = P.subscheme([y*z - x^2]) - sage: C.veronese_embedding(2).codomain().degree() + sage: C.veronese_embedding(2).codomain().degree() # needs sage.libs.singular 4 twisted cubic:: sage: P. = ProjectiveSpace(QQ, 1) sage: Q. = ProjectiveSpace(QQ, 3) - sage: P.subscheme([]).veronese_embedding(3, Q) + sage: P.subscheme([]).veronese_embedding(3, Q) # needs sage.libs.singular Scheme morphism: From: Closed subscheme of Projective Space of dimension 1 over Rational Field defined by: (no polynomials) @@ -1297,23 +1299,23 @@ def Chow_form(self): sage: P. = ProjectiveSpace(GF(17), 3) sage: X = P.subscheme([x3 + x1, x2 - x0, x2 - x3]) - sage: X.Chow_form() # optional - sage.libs.singular sage.rings.finite_rings + sage: X.Chow_form() # needs sage.libs.singular 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: X.Chow_form() + sage: X.Chow_form() # needs sage.libs.singular 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: Ch = X.Chow_form(); Ch + sage: Ch = X.Chow_form(); Ch # needs sage.libs.singular 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 + sage: Y = P.subscheme_from_Chow_form(Ch, 1); Y # needs sage.libs.singular Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: x2^2*x3 - x1*x3^2, -x2^3 + x0*x3^2, @@ -1324,8 +1326,8 @@ def Chow_form(self): 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] + sage: I = Y.defining_ideal() # needs sage.libs.singular + sage: I.saturation(I.ring().ideal(list(I.ring().gens())))[0] # needs sage.libs.singular 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 """ diff --git a/src/sage/schemes/riemann_surfaces/riemann_surface.py b/src/sage/schemes/riemann_surfaces/riemann_surface.py index 58027b94c4e..14599021c5d 100644 --- a/src/sage/schemes/riemann_surfaces/riemann_surface.py +++ b/src/sage/schemes/riemann_surfaces/riemann_surface.py @@ -2442,7 +2442,7 @@ def plot_paths(self): sage: from sage.schemes.riemann_surfaces.riemann_surface import RiemannSurface sage: R. = QQ[] sage: S = RiemannSurface(y^2 - x^3 - x) - sage: S.plot_paths() + sage: S.plot_paths() # needs sage.plot Graphics object consisting of 2 graphics primitives """ from sage.plot.point import point2d @@ -2478,8 +2478,8 @@ def plot_paths3d(self, thickness=0.01): sage: from sage.schemes.riemann_surfaces.riemann_surface import RiemannSurface sage: R. = QQ[] - sage: S = RiemannSurface(y^2-x^3-x) - sage: S.plot_paths3d() + sage: S = RiemannSurface(y^2 - x^3 - x) + sage: S.plot_paths3d() # needs sage.plot Graphics3d Object """ from sage.plot.graphics import Graphics @@ -2959,7 +2959,7 @@ def _integrate_differentials_iteratively( sage: s = sign(w_start) sage: u_edge = ((z_start, w_start), z_end) sage: J, _ = S._integrate_differentials_iteratively(u_edge) - sage: bool(J[0]+s*S._RR(sqrt(pi)*gamma(5/4)/gamma(3/4)/2)<1e-10) + sage: bool(J[0] + s*S._RR(sqrt(pi)*gamma(5/4)/gamma(3/4)/2) < 1e-10) # needs sage.symbolic True .. NOTE:: diff --git a/src/sage/schemes/toric/chow_group.py b/src/sage/schemes/toric/chow_group.py index 8c835df37d2..b647bcc0350 100644 --- a/src/sage/schemes/toric/chow_group.py +++ b/src/sage/schemes/toric/chow_group.py @@ -862,7 +862,7 @@ def degree(self, k=None): 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: l.show3d() # needs sage.plot sage: X = ToricVariety(FaceFan(l)) sage: A = X.Chow_group() sage: A.degree(2) diff --git a/src/sage/schemes/toric/fano_variety.py b/src/sage/schemes/toric/fano_variety.py index 06e942c5336..fe17a164a84 100644 --- a/src/sage/schemes/toric/fano_variety.py +++ b/src/sage/schemes/toric/fano_variety.py @@ -1304,9 +1304,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") # 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 + sage: F = GF(5^2, "a") # needs sage.rings.finite_rings + sage: X = P1xP1.change_ring(F) # needs sage.rings.finite_rings + sage: X.anticanonical_hypersurface(monomial_points="all", # needs 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 4470303d8d4..07c94ae1414 100644 --- a/src/sage/schemes/toric/homset.py +++ b/src/sage/schemes/toric/homset.py @@ -324,7 +324,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() # optional - sage.rings.finite_rings + sage: P2.change_ring(GF(7)).point_set().is_finite() # needs sage.rings.finite_rings True """ variety = self.codomain() @@ -347,11 +347,12 @@ def _naive_enumerator(self, ring=None): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) + sage: point_set = P123.point_set() + sage: next(iter(point_set._naive_enumerator())) (0, 0, 1) - sage: next(iter(point_set)) # optional - sage.rings.finite_rings + sage: next(iter(point_set)) [0 : 0 : 1] """ from sage.schemes.toric.points import NaiveFinitePointEnumerator @@ -378,11 +379,12 @@ def _finite_field_enumerator(self, finite_field=None): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) + sage: point_set = P123.point_set() + sage: next(iter(point_set._finite_field_enumerator())) (0, 0, 1) - sage: next(iter(point_set)) # optional - sage.rings.finite_rings + sage: next(iter(point_set)) [0 : 0 : 1] """ from sage.schemes.toric.points import FiniteFieldPointEnumerator @@ -404,9 +406,9 @@ def _enumerator(self): EXAMPLES:: - 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 + sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) # needs sage.rings.finite_rings + sage: point_set = P123.point_set() # needs sage.rings.finite_rings + sage: point_set._enumerator() # needs sage.rings.finite_rings """ ring = self.domain().base_ring() @@ -448,11 +450,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)) # 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 + sage: X = ToricVariety(fan, base_field=GF(7)) # needs sage.rings.finite_rings + sage: point_set = X.point_set() # needs sage.rings.finite_rings + sage: point_set.cardinality() # needs sage.rings.finite_rings 21 - sage: sorted(X.point_set().list()) # optional - sage.rings.finite_rings + sage: sorted(X.point_set().list()) # needs 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], @@ -466,9 +468,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)) # 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 + sage: blowup_plane = ToricVariety(fan, base_ring=GF(3)) # needs sage.rings.finite_rings + sage: point_set = blowup_plane.point_set() # needs sage.rings.finite_rings + sage: sorted(point_set.list()) # needs 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], @@ -477,8 +479,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)) # optional - sage.rings.finite_rings - sage: sorted(F_times_Fstar.point_set().list()) # optional - sage.rings.finite_rings + sage: F_times_Fstar = ToricVariety(Fan([Cone([(1,0)])]), base_field=GF(3)) # needs sage.rings.finite_rings + sage: sorted(F_times_Fstar.point_set().list()) # needs sage.rings.finite_rings [[0 : 1], [0 : 2], [1 : 1], [1 : 2], [2 : 1], [2 : 2]] TESTS:: @@ -500,29 +502,30 @@ def cardinality(self): sage: o = lattice_polytope.cross_polytope(3) sage: V = ToricVariety(FaceFan(o)) - sage: V.change_ring(GF(2)).point_set().cardinality() # optional - sage.rings.finite_rings + sage: V.change_ring(GF(2)).point_set().cardinality() # needs sage.rings.finite_rings 27 - sage: V.change_ring(GF(8, "a")).point_set().cardinality() # optional - sage.rings.finite_rings + sage: V.change_ring(GF(8, "a")).point_set().cardinality() # needs sage.rings.finite_rings 729 - sage: V.change_ring(GF(101)).point_set().cardinality() # optional - sage.rings.finite_rings + sage: V.change_ring(GF(101)).point_set().cardinality() # needs sage.rings.finite_rings 1061208 For non-smooth varieties over finite fields, the homogeneous rescalings are solved. This is somewhat slower:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_field=GF(7)) # optional - sage.rings.finite_rings - sage: X.point_set().cardinality() # optional - sage.rings.finite_rings + sage: X = ToricVariety(fan, base_field=GF(7)) # needs sage.rings.finite_rings + sage: X.point_set().cardinality() # needs 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() # 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 + sage: # needs sage.rings.finite_rings + 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)) 57 Over infinite fields the number of points is not very tricky:: @@ -571,11 +574,12 @@ def __iter__(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) + sage: point_set = P123.point_set() + sage: next(iter(point_set.__iter__())) [0 : 0 : 1] - sage: next(iter(point_set)) # syntactic sugar # optional - sage.rings.finite_rings + sage: next(iter(point_set)) # syntactic sugar [0 : 0 : 1] """ for pt in self._enumerator(): @@ -595,9 +599,9 @@ def _enumerator(self): EXAMPLES:: - 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 + sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) # needs sage.rings.finite_rings + sage: point_set = P123.point_set() # needs sage.rings.finite_rings + sage: point_set._enumerator() # needs sage.rings.finite_rings """ ambient = super()._enumerator() @@ -620,11 +624,12 @@ def __iter__(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: P2. = toric_varieties.P2(base_ring=GF(5)) + sage: cubic = P2.subscheme([x^3 + y^3 + z^3]) + sage: list(cubic.point_set()) [[0 : 1 : 4], [1 : 0 : 4], [1 : 4 : 0], [1 : 1 : 2], [1 : 2 : 1], [1 : 3 : 3]] - sage: cubic.point_set().cardinality() # optional - sage.rings.finite_rings + sage: cubic.point_set().cardinality() 6 """ for p in self._enumerator(): @@ -640,11 +645,12 @@ def cardinality(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: P2. = toric_varieties.P2(base_ring=GF(5)) + sage: cubic = P2.subscheme([x^3 + y^3 + z^3]) + sage: list(cubic.point_set()) [[0 : 1 : 4], [1 : 0 : 4], [1 : 4 : 0], [1 : 1 : 2], [1 : 2 : 1], [1 : 3 : 3]] - sage: cubic.point_set().cardinality() # optional - sage.rings.finite_rings + sage: cubic.point_set().cardinality() 6 """ try: diff --git a/src/sage/schemes/toric/ideal.py b/src/sage/schemes/toric/ideal.py index d2f0b094f5a..41cc4399fc1 100644 --- a/src/sage/schemes/toric/ideal.py +++ b/src/sage/schemes/toric/ideal.py @@ -217,7 +217,7 @@ def __init__(self, A, 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)) # optional - sage.rings.finite_rings + sage: ToricIdeal(A, names='x', base_ring=GF(101)) # needs 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'])) diff --git a/src/sage/schemes/toric/library.py b/src/sage/schemes/toric/library.py index 309b62e05c1..03484a35d65 100644 --- a/src/sage/schemes/toric/library.py +++ b/src/sage/schemes/toric/library.py @@ -1330,7 +1330,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()) # optional - sage.rings.finite_rings + sage: sorted(T3.change_ring(GF(3)).point_set().list()) # needs 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]] """ diff --git a/src/sage/schemes/toric/points.py b/src/sage/schemes/toric/points.py index 8a70350a30e..b401a2052f8 100644 --- a/src/sage/schemes/toric/points.py +++ b/src/sage/schemes/toric/points.py @@ -13,13 +13,14 @@ EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: P2 = toric_varieties.P2(base_ring=GF(3)) + sage: point_set = P2.point_set() + sage: point_set.cardinality() 13 - sage: next(iter(point_set)) # optional - sage.rings.finite_rings + sage: next(iter(point_set)) [0 : 0 : 1] - sage: list(point_set)[0:5] # optional - sage.rings.finite_rings + sage: list(point_set)[0:5] [[0 : 0 : 1], [1 : 0 : 0], [0 : 1 : 0], [0 : 1 : 1], [0 : 1 : 2]] """ @@ -122,8 +123,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)) # optional - sage.rings.finite_rings - sage: next(iter(n)) # optional - sage.rings.finite_rings + sage: n = NaiveFinitePointEnumerator(fan, GF(3)) # needs sage.rings.finite_rings + sage: next(iter(n)) # needs sage.rings.finite_rings (0, 0, 1) """ assert ring.is_finite() @@ -144,8 +145,8 @@ def rays(self): sage: fan.rays() Empty collection in 2-d lattice N - sage: n = NaiveFinitePointEnumerator(fan, GF(3)) # optional - sage.rings.finite_rings - sage: n.rays() # optional - sage.rings.finite_rings + sage: n = NaiveFinitePointEnumerator(fan, GF(3)) # needs sage.rings.finite_rings + sage: n.rays() # needs sage.rings.finite_rings N(1, 0), N(0, 1) in 2-d lattice N @@ -159,9 +160,9 @@ def units(self): EXAMPLES:: - 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 + sage: P2 = toric_varieties.P2(base_ring=GF(5)) # needs sage.rings.finite_rings + sage: ne = P2.point_set()._naive_enumerator() # needs sage.rings.finite_rings + sage: ne.units() # needs sage.rings.finite_rings (1, 2, 3, 4) """ return tuple(x for x in self.ring if x != 0) @@ -182,13 +183,14 @@ def roots(self, n): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: P2 = toric_varieties.P2(base_ring=GF(5)) + sage: ne = P2.point_set()._naive_enumerator() + sage: ne.roots(2) (1, 4) - sage: ne.roots(3) # optional - sage.rings.finite_rings + sage: ne.roots(3) (1,) - sage: ne.roots(4) # optional - sage.rings.finite_rings + sage: ne.roots(4) (1, 2, 3, 4) """ return tuple(x for x in self.ring if x**n == self.ring.one()) @@ -205,11 +207,11 @@ def _Chow_group_free(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) # optional - sage.rings.finite_rings - sage: X.Chow_group().degree(1) # optional - sage.rings.finite_rings + sage: X = ToricVariety(fan, base_ring=GF(7)) # needs sage.rings.finite_rings + sage: X.Chow_group().degree(1) # needs sage.rings.finite_rings C3 x Z - sage: enum = X.point_set()._naive_enumerator() # optional - sage.rings.finite_rings - sage: enum._Chow_group_free() # optional - sage.rings.finite_rings + sage: enum = X.point_set()._naive_enumerator() # needs sage.rings.finite_rings + sage: enum._Chow_group_free() # needs 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() @@ -233,11 +235,11 @@ def _Chow_group_torsion(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) # optional - sage.rings.finite_rings - sage: X.Chow_group().degree(1) # optional - sage.rings.finite_rings + sage: X = ToricVariety(fan, base_ring=GF(7)) # needs sage.rings.finite_rings + sage: X.Chow_group().degree(1) # needs sage.rings.finite_rings C3 x Z - sage: enum = X.point_set()._naive_enumerator() # optional - sage.rings.finite_rings - sage: enum._Chow_group_torsion() # optional - sage.rings.finite_rings + sage: enum = X.point_set()._naive_enumerator() # needs sage.rings.finite_rings + sage: enum._Chow_group_torsion() # needs sage.rings.finite_rings ((1, 2, 4), (1, 4, 2)) """ if self.fan.is_smooth(): @@ -266,19 +268,19 @@ def rescalings(self): EXAMPLES:: - 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 + sage: P2_123 = toric_varieties.P2_123(base_ring=GF(5)) # needs sage.rings.finite_rings + sage: ni = P2_123.point_set()._naive_enumerator() # needs sage.rings.finite_rings + sage: ni.rescalings() # needs sage.rings.finite_rings ((1, 1, 1), (1, 4, 4), (4, 2, 3), (4, 3, 2)) - 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 + sage: dP8 = toric_varieties.dP8(base_ring=GF(3)) # needs sage.rings.finite_rings + sage: ni = dP8.point_set()._naive_enumerator() # needs sage.rings.finite_rings + sage: ni.rescalings() # needs sage.rings.finite_rings ((1, 1, 1, 1), (1, 2, 2, 2), (2, 1, 2, 1), (2, 2, 1, 2)) - 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 + sage: P1xP1 = toric_varieties.P1xP1(base_ring=GF(3)) # needs sage.rings.finite_rings + sage: ni = P1xP1.point_set()._naive_enumerator() # needs sage.rings.finite_rings + sage: ni.rescalings() # needs 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,15 +304,16 @@ def orbit(self, point): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: P2_123 = toric_varieties.P2_123(base_ring=GF(7)) + sage: ne = P2_123.point_set()._naive_enumerator() + sage: sorted(ne.orbit([1, 0, 0])) [(1, 0, 0), (2, 0, 0), (4, 0, 0)] - sage: sorted(ne.orbit([0, 1, 0])) # optional - sage.rings.finite_rings + sage: sorted(ne.orbit([0, 1, 0])) [(0, 1, 0), (0, 6, 0)] - sage: sorted(ne.orbit([0, 0, 1])) # optional - sage.rings.finite_rings + sage: sorted(ne.orbit([0, 0, 1])) [(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])) # optional - sage.rings.finite_rings + sage: sorted(ne.orbit([1, 1, 0])) [(1, 1, 0), (1, 6, 0), (2, 1, 0), (2, 6, 0), (4, 1, 0), (4, 6, 0)] """ result = set() @@ -330,9 +333,9 @@ def cone_iter(self): EXAMPLES:: - 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 + sage: dP6 = toric_varieties.dP6(base_ring=GF(11)) # needs sage.rings.finite_rings + sage: ne = dP6.point_set()._naive_enumerator() # needs sage.rings.finite_rings + sage: for cone in ne.cone_iter(): # needs sage.rings.finite_rings ....: print(cone.ambient_ray_indices()) (0, 1) (1, 2) @@ -363,24 +366,24 @@ def coordinate_iter(self): EXAMPLES:: - 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 + sage: P2 = toric_varieties.P2(base_ring=GF(2)) # needs sage.rings.finite_rings + sage: ni = P2.point_set()._naive_enumerator() # needs sage.rings.finite_rings + sage: list(ni.coordinate_iter()) # needs 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: 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 + sage: P1xP1 = toric_varieties.P1xP1(base_ring=GF(2)) # needs sage.rings.finite_rings + sage: ni = P1xP1.point_set()._naive_enumerator() # needs sage.rings.finite_rings + sage: list(ni.coordinate_iter()) # needs 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)) # 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 + sage: V = ToricVariety(Fan([Cone([(1,1)])]), base_ring=GF(3)) # needs sage.rings.finite_rings + sage: ni = V.point_set()._naive_enumerator() # needs sage.rings.finite_rings + sage: list(ni.coordinate_iter()) # needs 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] @@ -405,15 +408,15 @@ def __iter__(self): EXAMPLES:: - 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 + sage: P2 = toric_varieties.P2(base_ring=GF(2)) # needs sage.rings.finite_rings + sage: ni = P2.point_set()._naive_enumerator() # needs sage.rings.finite_rings + sage: list(ni) # needs 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: 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 + sage: P1xP1 = toric_varieties.P1xP1(base_ring=GF(3)) # needs sage.rings.finite_rings + sage: ni = P1xP1.point_set()._naive_enumerator() # needs sage.rings.finite_rings + sage: list(ni) # needs 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 +441,9 @@ def multiplicative_generator(self): EXAMPLES:: - 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 + sage: point_set = toric_varieties.P2(base_ring=GF(5^2, 'a')).point_set() # needs sage.rings.finite_rings + sage: ffe = point_set._finite_field_enumerator() # needs sage.rings.finite_rings + sage: ffe.multiplicative_generator() # needs sage.rings.finite_rings a """ return self.ring.multiplicative_generator() @@ -462,18 +465,19 @@ def root_generator(self, n): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: point_set = toric_varieties.P2(base_ring=GF(5)).point_set() + sage: ffe = point_set._finite_field_enumerator() + sage: ffe.root_generator(2) 4 - sage: ffe.root_generator(3) # optional - sage.rings.finite_rings + sage: ffe.root_generator(3) 1 - sage: ffe.root_generator(4) # optional - sage.rings.finite_rings + sage: ffe.root_generator(4) 2 TESTS:: - sage: for p in primes(10): # optional - sage.rings.finite_rings + sage: for p in primes(10): # needs sage.rings.finite_rings ....: for k in range(1, 5): ....: F = GF(p^k, 'a') ....: N = F.cardinality() - 1 @@ -499,13 +503,13 @@ def _Chow_group_free_generators(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) # optional - sage.rings.finite_rings - sage: X.Chow_group().degree(1) # optional - sage.rings.finite_rings + sage: X = ToricVariety(fan, base_ring=GF(7)) # needs sage.rings.finite_rings + sage: X.Chow_group().degree(1) # needs sage.rings.finite_rings C3 x Z - sage: enum = X.point_set()._finite_field_enumerator() # optional - sage.rings.finite_rings - sage: enum._Chow_group_free() # optional - sage.rings.finite_rings + sage: enum = X.point_set()._finite_field_enumerator() # needs sage.rings.finite_rings + sage: enum._Chow_group_free() # needs 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() # optional - sage.rings.finite_rings + sage: enum._Chow_group_free_generators() # needs sage.rings.finite_rings ((3, 3, 3),) """ result = [] @@ -528,13 +532,13 @@ def _Chow_group_torsion_generators(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) # optional - sage.rings.finite_rings - sage: X.Chow_group().degree(1) # optional - sage.rings.finite_rings + sage: X = ToricVariety(fan, base_ring=GF(7)) # needs sage.rings.finite_rings + sage: X.Chow_group().degree(1) # needs sage.rings.finite_rings C3 x Z - sage: enum = X.point_set()._finite_field_enumerator() # optional - sage.rings.finite_rings - sage: enum._Chow_group_torsion() # optional - sage.rings.finite_rings + sage: enum = X.point_set()._finite_field_enumerator() # needs sage.rings.finite_rings + sage: enum._Chow_group_torsion() # needs sage.rings.finite_rings ((1, 2, 4), (1, 4, 2)) - sage: enum._Chow_group_torsion_generators() # optional - sage.rings.finite_rings + sage: enum._Chow_group_torsion_generators() # needs sage.rings.finite_rings ((1, 2, 4),) """ if self.fan.is_smooth(): @@ -568,19 +572,20 @@ def log(self, z): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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 (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) # optional - sage.rings.finite_rings + sage: ffe.log(z) (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 # optional - sage.rings.finite_rings + sage: ffe.exp(ffe.log(z)) == z True - sage: ffe.log(ffe.exp(range(24))) == tuple(range(24)) # optional - sage.rings.finite_rings + sage: ffe.log(ffe.exp(range(24))) == tuple(range(24)) True """ base = self.multiplicative_generator() @@ -601,15 +606,16 @@ def exp(self, powers): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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) (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) # optional - sage.rings.finite_rings + sage: ffe.log(ffe.exp(powers)) == tuple(powers) True """ base = self.multiplicative_generator() @@ -627,13 +633,14 @@ def rescaling_log_generators(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + sage: point_set = toric_varieties.P2_123(base_ring=GF(5)).point_set() + sage: ffe = point_set._finite_field_enumerator() + sage: ffe.rescalings() ((1, 1, 1), (1, 4, 4), (4, 2, 3), (4, 3, 2)) - sage: list(map(ffe.log, ffe.rescalings())) # optional - sage.rings.finite_rings + sage: list(map(ffe.log, ffe.rescalings())) [(0, 0, 0), (0, 2, 2), (2, 1, 3), (2, 3, 1)] - sage: ffe.rescaling_log_generators() # optional - sage.rings.finite_rings + sage: ffe.rescaling_log_generators() ((2, 3, 1),) """ free = self._Chow_group_free_generators() @@ -655,22 +662,22 @@ def cone_points_iter(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - 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 + sage: X = ToricVariety(fan, base_ring=GF(7)) # needs sage.rings.finite_rings + sage: point_set = X.point_set() # needs sage.rings.finite_rings + sage: ffe = point_set._finite_field_enumerator() # needs sage.rings.finite_rings + sage: cpi = ffe.cone_points_iter() # needs sage.rings.finite_rings + sage: cone, nonzero_points, cokernel = list(cpi)[5] # needs sage.rings.finite_rings + sage: cone # needs sage.rings.finite_rings 1-d cone of Rational polyhedral fan in 2-d lattice N - sage: cone.ambient_ray_indices() # optional - sage.rings.finite_rings + sage: cone.ambient_ray_indices() # needs sage.rings.finite_rings (2,) - sage: nonzero_points # optional - sage.rings.finite_rings + sage: nonzero_points # needs sage.rings.finite_rings [0, 1] - sage: cokernel # optional - sage.rings.finite_rings + sage: cokernel # needs sage.rings.finite_rings Finitely generated module V/W over Integer Ring with invariants (2) - sage: list(cokernel) # optional - sage.rings.finite_rings + sage: list(cokernel) # needs sage.rings.finite_rings [(0), (1)] - sage: [p.lift() for p in cokernel] # optional - sage.rings.finite_rings + sage: [p.lift() for p in cokernel] # needs sage.rings.finite_rings [(0, 0), (0, 1)] """ from sage.matrix.constructor import matrix, block_matrix, identity_matrix @@ -704,22 +711,22 @@ def __iter__(self): EXAMPLES:: - 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 + sage: point_set = toric_varieties.P2(base_ring=GF(2)).point_set() # needs sage.rings.finite_rings + sage: ffe = point_set._finite_field_enumerator() # needs sage.rings.finite_rings + sage: list(ffe) # needs 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)) # 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 + sage: X = ToricVariety(fan, base_ring=GF(7)) # needs sage.rings.finite_rings + sage: point_set = X.point_set() # needs sage.rings.finite_rings + sage: ffe = point_set._finite_field_enumerator() # needs sage.rings.finite_rings + sage: list(ffe) # needs 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) # optional - sage.rings.finite_rings + sage: set(point_set._naive_enumerator()) == set(ffe) # needs sage.rings.finite_rings True """ nrays = len(self.rays()) @@ -741,10 +748,10 @@ def cardinality(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - 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 + sage: X = ToricVariety(fan, base_ring=GF(7)) # needs sage.rings.finite_rings + sage: point_set = X.point_set() # needs sage.rings.finite_rings + sage: ffe = point_set._finite_field_enumerator() # needs sage.rings.finite_rings + sage: ffe.cardinality() # needs sage.rings.finite_rings 21 """ n = 0 @@ -826,14 +833,14 @@ def inhomogeneous_equations(self, ring, nonzero_coordinates, cokernel): EXAMPLES:: sage: R. = QQ[] - 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 + sage: P2. = toric_varieties.P2(base_ring=GF(7)) # needs sage.rings.finite_rings + sage: X = P2.subscheme([x^3 + 2*y^3 + 3*z^3, x*y*z + x*y^2]) # needs sage.rings.finite_rings + sage: point_set = X.point_set() # needs sage.rings.finite_rings + sage: ffe = point_set._enumerator() # needs sage.rings.finite_rings + sage: cone, nonzero_coordinates, cokernel = list(ffe.ambient.cone_points_iter())[5] # needs sage.rings.finite_rings + sage: cone.ambient_ray_indices(), nonzero_coordinates # needs sage.rings.finite_rings ((2,), [0, 1]) - sage: ffe.inhomogeneous_equations(R, nonzero_coordinates, cokernel) # optional - sage.rings.finite_rings + sage: ffe.inhomogeneous_equations(R, nonzero_coordinates, cokernel) # needs sage.rings.finite_rings [2*s^3 + 1, s^2] """ nrays = len(self.ambient.rays()) @@ -867,14 +874,15 @@ def solutions_serial(self, inhomogeneous_equations, log_range): EXAMPLES:: - 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: # needs sage.rings.finite_rings + 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: list(_) # optional - sage.rings.finite_rings + sage: list(_) [(0,), (3,)] """ from itertools import product @@ -895,14 +903,15 @@ def solutions(self, inhomogeneous_equations, log_range): EXAMPLES:: - 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: # needs sage.rings.finite_rings + 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: sorted(_) # optional - sage.rings.finite_rings + sage: sorted(_) [(0,), (3,)] """ # Do simple cases in one process (this includes most doctests) @@ -941,18 +950,19 @@ def homogeneous_coordinates(self, log_t, nonzero_coordinates, cokernel): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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 ((2,), [0, 1]) - sage: ffe.homogeneous_coordinates([0], nonzero_coordinates, cokernel) # optional - sage.rings.finite_rings + sage: ffe.homogeneous_coordinates([0], nonzero_coordinates, cokernel) (1, 1, 0) - sage: ffe.homogeneous_coordinates([1], nonzero_coordinates, cokernel) # optional - sage.rings.finite_rings + sage: ffe.homogeneous_coordinates([1], nonzero_coordinates, cokernel) (1, 3, 0) - sage: ffe.homogeneous_coordinates([2], nonzero_coordinates, cokernel) # optional - sage.rings.finite_rings + sage: ffe.homogeneous_coordinates([2], nonzero_coordinates, cokernel) (1, 2, 0) """ z = [self.ambient.ring.zero()] * len(self.ambient.rays()) @@ -977,11 +987,12 @@ def __iter__(self): EXAMPLES:: - 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 + sage: # needs sage.rings.finite_rings + 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 [(1, 1, 6), (1, 2, 5), (1, 4, 3)] """ for cone, nonzero_coordinates, cokernel in self.ambient.cone_points_iter(): @@ -1001,10 +1012,10 @@ def cardinality(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - 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 + sage: X. = ToricVariety(fan, base_ring=GF(7)) # needs sage.rings.finite_rings + sage: Y = X.subscheme(u^3 + v^3 + w^3 + u*v*w) # needs sage.rings.finite_rings + sage: point_set = Y.point_set() # needs sage.rings.finite_rings + sage: list(point_set) # needs sage.rings.finite_rings [[0 : 1 : 3], [1 : 0 : 3], [1 : 3 : 0], @@ -1012,8 +1023,8 @@ def cardinality(self): [1 : 1 : 4], [1 : 3 : 2], [1 : 3 : 5]] - sage: ffe = point_set._enumerator() # optional - sage.rings.finite_rings - sage: ffe.cardinality() # optional - sage.rings.finite_rings + sage: ffe = point_set._enumerator() # needs sage.rings.finite_rings + sage: ffe.cardinality() # needs sage.rings.finite_rings 7 """ n = 0 diff --git a/src/sage/schemes/toric/toric_subscheme.py b/src/sage/schemes/toric/toric_subscheme.py index e425ee3d0a8..61b7095bbba 100644 --- a/src/sage/schemes/toric/toric_subscheme.py +++ b/src/sage/schemes/toric/toric_subscheme.py @@ -644,9 +644,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() # optional - sage.rings.finite_rings + sage: P2.change_ring(GF(5)).subscheme([f]).is_nondegenerate() # needs sage.rings.finite_rings True - sage: P2.change_ring(GF(7)).subscheme([f]).is_nondegenerate() # optional - sage.rings.finite_rings + sage: P2.change_ring(GF(7)).subscheme([f]).is_nondegenerate() # needs sage.rings.finite_rings False TESTS: diff --git a/src/sage/schemes/toric/variety.py b/src/sage/schemes/toric/variety.py index eabb25ca4a1..954c0ba9e7f 100644 --- a/src/sage/schemes/toric/variety.py +++ b/src/sage/schemes/toric/variety.py @@ -1536,7 +1536,7 @@ def plot(self, **options): EXAMPLES:: sage: X = toric_varieties.Cube_deformation(4) - sage: X.plot() + sage: X.plot() # needs sage.plot Graphics3d Object """ if "ray_label" not in options: @@ -1849,8 +1849,8 @@ def Stanley_Reisner_ideal(self): 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 + sage: X = ToricVariety(fan, coordinate_names='A B C D E', base_field=GF(5)) # needs sage.rings.finite_rings + sage: SR = X.Stanley_Reisner_ideal(); SR # needs 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 """ @@ -1873,8 +1873,8 @@ def linear_equivalence_ideal(self): 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 + sage: X = ToricVariety(fan, coordinate_names='A B C D E', base_field=GF(5)) # needs sage.rings.finite_rings + sage: lin = X.linear_equivalence_ideal(); lin # needs 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 """ @@ -2411,7 +2411,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 - sage: Div(x) + sage: Div(x) # needs sage.symbolic V(x) """ from sage.schemes.generic.divisor_group import DivisorGroup @@ -2487,7 +2487,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) # optional - sage.rings.finite_rings + sage: P2.change_ring(GF(101))._semigroup_ring(cone) # needs 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) @@ -2739,10 +2739,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)) # needs sage.rings.finite_rings + sage: V2.point_set().cardinality() # needs sage.rings.finite_rings 27 - sage: V2.count_points() # optional - sage.rings.finite_rings + sage: V2.count_points() # needs sage.rings.finite_rings 27 """ return self.point_set().cardinality() diff --git a/src/sage/schemes/toric/weierstrass_higher.py b/src/sage/schemes/toric/weierstrass_higher.py index af9d56233db..3693bf0373e 100644 --- a/src/sage/schemes/toric/weierstrass_higher.py +++ b/src/sage/schemes/toric/weierstrass_higher.py @@ -262,17 +262,18 @@ def WeierstrassMap_P3(quadratic1, quadratic2, variables=None): TESTS:: - 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 + sage: # needs sage.rings.finite_rings + 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()) (22, 4164) - sage: Y.total_degree(), len(Y.coefficients()) # optional - sage.rings.finite_rings + sage: Y.total_degree(), len(Y.coefficients()) (33, 26912) - sage: Z.total_degree(), len(Z.coefficients()) # optional - sage.rings.finite_rings + sage: Z.total_degree(), len(Z.coefficients()) (10, 24) - sage: Z # optional - sage.rings.finite_rings + sage: Z 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 1df8e8c94ec9aaac15c34dcb9f3c07434d56eaa2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 13 Jul 2023 22:29:35 -0700 Subject: [PATCH 040/423] sage.schemes: Update # needs --- src/sage/schemes/generic/scheme.py | 2 +- .../schemes/projective/projective_homset.py | 21 ++++++++++--------- .../schemes/projective/projective_morphism.py | 12 +++++------ 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/sage/schemes/generic/scheme.py b/src/sage/schemes/generic/scheme.py index 9fd3a79aa37..5a94f1aec75 100644 --- a/src/sage/schemes/generic/scheme.py +++ b/src/sage/schemes/generic/scheme.py @@ -216,7 +216,7 @@ def __call__(self, *args): sage: A(QQ) Set of rational points of Affine Space of dimension 2 over Rational Field - sage: A(RR) + sage: A(RR) # needs sage.rings.real_mpfr Set of rational points of Affine Space of dimension 2 over Real Field with 53 bits of precision diff --git a/src/sage/schemes/projective/projective_homset.py b/src/sage/schemes/projective/projective_homset.py index d952ae687b6..770c1b0f12e 100644 --- a/src/sage/schemes/projective/projective_homset.py +++ b/src/sage/schemes/projective/projective_homset.py @@ -581,24 +581,25 @@ class SchemeHomset_points_abelian_variety_field(SchemeHomset_points_projective_f The bug reported at :trac:`1785` is fixed:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 + x - (3^3-3)) # needs sage.rings.number_field - sage: E = EllipticCurve('37a') # needs sage.rings.number_field - sage: X = E(K) # needs sage.rings.number_field - sage: X # needs sage.rings.number_field + sage: K. = NumberField(x^2 + x - (3^3-3)) + sage: E = EllipticCurve('37a') + sage: X = E(K) + sage: X 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]) # needs sage.rings.number_field - sage: P # needs sage.rings.number_field + sage: P = X([3,a]) + sage: P (3 : a : 1) - sage: P in E # needs sage.rings.number_field + sage: P in E False - sage: P in E.base_extend(K) # needs sage.rings.number_field + sage: P in E.base_extend(K) True - sage: P in X.codomain() # needs sage.rings.number_field + sage: P in X.codomain() False - sage: P in X.extended_codomain() # needs sage.rings.number_field + sage: P in X.extended_codomain() True Check for :trac:`11982`:: diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 02c2479251e..d7afa2dc3ed 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -476,14 +476,14 @@ def _fast_eval(self, x): :: - sage: # needs sage.rings.real_mpfr + sage: # needs sage.libs.pari sage.rings.real_mpfr sage: T. = PolynomialRing(CC) sage: I = T.ideal(z^3) - sage: P. = ProjectiveSpace(T.quotient_ring(I), 1) # needs sage.libs.pari + sage: P. = ProjectiveSpace(T.quotient_ring(I), 1) sage: H = End(P) - sage: f = H([x^2 + x*y, y^2]) # needs sage.libs.pari - sage: Q = P(z^2, 1) # needs sage.libs.pari - sage: f._fast_eval(list(Q)) # needs sage.libs.pari + 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] :: @@ -1865,7 +1865,7 @@ def base_indeterminacy_locus(self): 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() + sage: h.base_indeterminacy_locus() # needs sage.rings.real_mpfr Closed subscheme of Projective Space of dimension 2 over Real Field with 53 bits of precision defined by: y^3*z^3, From a5da282671e37b389efd3d3ae12d2ab4918fd6e2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 21 Jul 2023 19:43:59 -0700 Subject: [PATCH 041/423] More # needs --- src/sage/schemes/projective/projective_space.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index b5029a6255a..1b95875e06b 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -1040,6 +1040,7 @@ def points_of_bounded_height(self, **kwds): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: F. = NumberField(x^4 - 8*x^2 + 3) # needs sage.rings.number_field sage: P. = ProjectiveSpace(F, 2) # needs sage.rings.number_field @@ -1072,6 +1073,7 @@ def points_of_bounded_height(self, **kwds): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: K. = NumberField(x^5 + x^3 + 1) # needs sage.rings.number_field sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field @@ -1081,6 +1083,7 @@ def points_of_bounded_height(self, **kwds): :: + sage: # needs sage.rings.number_field sage: K. = QuadraticField(2) sage: P. = ProjectiveSpace(K, 1) sage: sorted(list(P.points_of_bounded_height(bound=2))) @@ -1091,6 +1094,7 @@ def points_of_bounded_height(self, **kwds): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: K. = NumberField(3*x^2 + 1) sage: P. = ProjectiveSpace(K, 1) @@ -1100,6 +1104,7 @@ def points_of_bounded_height(self, **kwds): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: K. = NumberField(3*x^2 + 1) sage: O = K.maximal_order() @@ -1109,6 +1114,7 @@ def points_of_bounded_height(self, **kwds): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: K. = NumberField(x^3 - 7) sage: O = K.maximal_order() @@ -1135,6 +1141,7 @@ def points_of_bounded_height(self, **kwds): :: + sage: # needs sage.rings.number_field sage: K. = NumberField(x^2 + 1) sage: PK. = K[] sage: L. = K.extension(t^4 - i) From 1a594070128f432f38e8e9ea29f572278b419b8c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 2 Aug 2023 14:32:44 -0700 Subject: [PATCH 042/423] sage.schemes: Update # needs --- .../schemes/projective/projective_morphism.py | 44 +++++++++++++------ .../projective/projective_subscheme.py | 14 +++--- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index d7afa2dc3ed..bb0a8c82ff9 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -110,6 +110,7 @@ class SchemeMorphism_polynomial_projective_space(SchemeMorphism_polynomial): An example of a morphism between projective plane curves (see :trac:`10297`):: + sage: # needs sage.schemes 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) @@ -525,6 +526,7 @@ def __eq__(self, right): :: + sage: # needs sage.rings.real_mpfr sage: P. = ProjectiveSpace(QQ, 1) sage: P2. = ProjectiveSpace(CC, 1) # needs sage.rings.real_mpfr sage: H = End(P) @@ -776,7 +778,7 @@ def scale_by(self, t): 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 # needs sage.rings.finite_rings + sage: f.scale_by(x - y); f # needs sage.libs.singular 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 @@ -840,7 +842,7 @@ def normalize_coordinates(self, **kwds): 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 # needs sage.rings.finite_rings + sage: f.normalize_coordinates(); f # needs sage.libs.singular 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) @@ -869,6 +871,7 @@ def normalize_coordinates(self, **kwds): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(ZZ) sage: K. = NumberField(t^3 - 11) # needs sage.rings.number_field sage: a = 7/(b - 1) @@ -891,6 +894,7 @@ def normalize_coordinates(self, **kwds): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: A. = NumberField(w^2 + 1) # needs sage.rings.number_field sage: P. = ProjectiveSpace(A, 2) # needs sage.rings.number_field @@ -1280,7 +1284,7 @@ def is_morphism(self): 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() # needs sage.libs.singular sage.rings.finite_rings + sage: f.is_morphism() # needs sage.libs.singular True Map that is not morphism on projective space, but is over a subscheme:: @@ -1347,6 +1351,7 @@ def global_height(self, prec=None): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field sage: O = K.maximal_order() # needs sage.rings.number_field @@ -1454,6 +1459,7 @@ def local_height(self, v, prec=None): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field @@ -1501,6 +1507,7 @@ def local_height_arch(self, i, prec=None): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field @@ -1528,6 +1535,7 @@ def wronskian_ideal(self): EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) sage: K. = NumberField(x^2 + 11) # needs sage.rings.number_field sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field @@ -1539,6 +1547,7 @@ def wronskian_ideal(self): :: + sage: # needs sage.rings.number_field sage: P. = ProjectiveSpace(QQ, 1) sage: P2. = ProjectiveSpace(K, 2) # needs sage.rings.number_field sage: H = Hom(P, P2) # needs sage.rings.number_field @@ -1628,6 +1637,7 @@ def rational_preimages(self, Q, k=1): A number field example :: + sage: # needs sage.rings.number_field sage: z = QQ['z'].0 sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field @@ -1638,6 +1648,7 @@ def rational_preimages(self, Q, k=1): :: + sage: # needs sage.rings.number_field sage: z = QQ['z'].0 sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field @@ -1735,6 +1746,7 @@ def _number_field_from_algebraics(self): EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field sage: H = End(P) # needs sage.rings.number_field @@ -1768,6 +1780,7 @@ def _number_field_from_algebraics(self): The following was fixed in :trac:`23808`:: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) sage: s = (t^3 + t + 1).roots(QQbar)[0][0] # needs sage.rings.number_field sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field @@ -2007,6 +2020,7 @@ def indeterminacy_points(self, F=None, base=False): :: + sage: # needs sage.rings.padics sage: set_verbose(None) sage: P. = ProjectiveSpace(Qp(3), 2) # needs sage.rings.padics sage: H = End(P) @@ -2094,6 +2108,7 @@ def reduce_base_field(self): :: + sage: # needs sage.rings.finite_rings sage: K. = GF(5) sage: L = K.algebraic_closure() # needs sage.rings.finite_rings sage: P. = ProjectiveSpace(L, 1) # needs sage.rings.finite_rings @@ -2291,6 +2306,7 @@ def __call__(self, x): TESTS:: + sage: # needs sage.schemes sage: R. = QQ[] sage: C = Curve(7*x^2 + 2*y*z + z^2) # needs sage.schemes sage: f, g = C.parametrization() # needs sage.schemes @@ -2730,12 +2746,13 @@ def projective_degrees(self): EXAMPLES:: + sage: # needs sage.schemes sage: k = GF(11) - sage: E = EllipticCurve(k, [1,1]) # needs sage.rings.finite_rings - sage: Q = E(6, 5) # needs sage.rings.finite_rings - sage: phi = E.scalar_multiplication(2) # needs sage.rings.finite_rings - sage: mor = phi.as_morphism() # needs sage.rings.finite_rings - sage: mor.projective_degrees() # needs sage.rings.finite_rings + 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() (12, 3) """ X = self.domain() @@ -2772,12 +2789,13 @@ def degree(self): EXAMPLES:: + sage: # needs sage.schemes sage: k = GF(11) - sage: E = EllipticCurve(k, [1,1]) # needs sage.rings.finite_rings - sage: Q = E(6, 5) # needs sage.rings.finite_rings - sage: phi = E.scalar_multiplication(2) # needs sage.rings.finite_rings - sage: mor = phi.as_morphism() # needs sage.rings.finite_rings - sage: mor.degree() # needs sage.rings.finite_rings + 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() 4 """ return self.projective_degrees()[0] // self.image().degree() diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index 6d2470f4229..c06f45ccc31 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -1057,18 +1057,20 @@ def intersection_multiplicity(self, X, P): EXAMPLES:: + sage: # needs sage.schemes sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve([x^4 - z^2*y^2], P) # needs sage.rings.finite_rings - sage: D = Curve([y^4*z - x^5 - x^3*z^2], P) # needs sage.rings.finite_rings + 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) # needs sage.libs.singular sage.rings.finite_rings + sage: C.intersection_multiplicity(D, Q1) # needs sage.libs.singular 4 sage: Q2 = P([0,0,1]) - sage: C.intersection_multiplicity(D, Q2) # needs sage.libs.singular sage.rings.finite_rings + sage: C.intersection_multiplicity(D, Q2) # needs sage.libs.singular 6 :: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: K. = NumberField(a^4 + 1) # needs sage.rings.number_field sage: P. = ProjectiveSpace(K, 3) # needs sage.rings.number_field @@ -1149,9 +1151,9 @@ 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) # needs sage.rings.finite_rings + sage: C = Curve([y^17 - x^5*w^4*z^8, x*y - z^2], P) # needs sage.schemes sage: Q = P([3,0,0,1]) - sage: C.multiplicity(Q) # needs sage.libs.singular sage.rings.finite_rings + sage: C.multiplicity(Q) # needs sage.libs.singular sage.schemes 8 """ if self.base_ring() not in Fields(): From 17324b1ef49fc8c643947131e8c26e36de28bdb3 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 6 Aug 2023 18:30:22 -0700 Subject: [PATCH 043/423] sage.schemes: Update # needs --- src/sage/schemes/affine/affine_point.py | 8 +++-- src/sage/schemes/affine/affine_subscheme.py | 4 +-- src/sage/schemes/generic/morphism.py | 7 +++-- src/sage/schemes/generic/scheme.py | 8 +++-- src/sage/schemes/product_projective/space.py | 16 +++++----- .../schemes/projective/projective_point.py | 1 + .../schemes/projective/projective_space.py | 30 ++++++++++--------- 7 files changed, 40 insertions(+), 34 deletions(-) diff --git a/src/sage/schemes/affine/affine_point.py b/src/sage/schemes/affine/affine_point.py index a30ae04e009..fa5c3337274 100644 --- a/src/sage/schemes/affine/affine_point.py +++ b/src/sage/schemes/affine/affine_point.py @@ -291,7 +291,7 @@ def weil_restriction(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.singular sage.rings.finite_rings sage: A. = AffineSpace(GF(5^3, 't'), 3) sage: X = A.subscheme([y^2 - x*z, z^2 + y]) sage: Y = X.weil_restriction() @@ -303,6 +303,7 @@ def weil_restriction(self): :: + sage: # needs sage.libs.singular sage.rings.number_field sage: R. = QQ[] sage: K. = NumberField(x^5 - 2) # needs sage.rings.number_field sage: R. = K[] # needs sage.rings.number_field @@ -359,14 +360,15 @@ def intersection_multiplicity(self, X): EXAMPLES:: + sage: # needs sage.libs.singular 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) # needs sage.rings.finite_rings + sage: Q1.intersection_multiplicity(X) 2 sage: Q2 = X([4,6]) - sage: Q2.intersection_multiplicity(Y) # needs sage.rings.finite_rings + sage: Q2.intersection_multiplicity(Y) 1 :: diff --git a/src/sage/schemes/affine/affine_subscheme.py b/src/sage/schemes/affine/affine_subscheme.py index 20f7cbe49c3..ae506500d38 100644 --- a/src/sage/schemes/affine/affine_subscheme.py +++ b/src/sage/schemes/affine/affine_subscheme.py @@ -456,9 +456,9 @@ 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]) # needs sage.rings.finite_rings + sage: C = A.curve([x^8 - y, y^7 - z, z^3 - 1, w^5 - v^3]) # needs sage.schemes sage: Q = A([22,1,1,0,0]) - sage: C.multiplicity(Q) # needs sage.rings.finite_rings + sage: C.multiplicity(Q) # needs sage.libs.singular sage.schemes 3 :: diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index 47f76e5a0a5..97dd38a69e7 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -513,9 +513,10 @@ def base_ring(self): :: - sage: E = EllipticCurve(GF((17,2)), [1,2,3,4,5]) # needs sage.rings.finite_rings - sage: P = E.random_point() # needs sage.rings.finite_rings - sage: P.base_ring() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage,schemes + sage: E = EllipticCurve(GF((17,2)), [1,2,3,4,5]) + sage: P = E.random_point() + sage: P.base_ring() Finite Field in z2 of size 17^2 """ return self.domain().base_ring() diff --git a/src/sage/schemes/generic/scheme.py b/src/sage/schemes/generic/scheme.py index 5a94f1aec75..32986ef6907 100644 --- a/src/sage/schemes/generic/scheme.py +++ b/src/sage/schemes/generic/scheme.py @@ -672,9 +672,10 @@ def count_points(self, n): EXAMPLES:: + sage: # needs sage.schemes sage: P. = PolynomialRing(GF(3)) - sage: C = HyperellipticCurve(x^3 + x^2 + 1) # needs sage.rings.finite_rings - sage: C.count_points(4) # needs sage.rings.finite_rings + sage: C = HyperellipticCurve(x^3 + x^2 + 1) + sage: C.count_points(4) [6, 12, 18, 96] sage: C.base_extend(GF(9,'a')).count_points(2) # needs sage.rings.finite_rings [12, 96] @@ -756,8 +757,9 @@ def zeta_series(self, n, t): sage: P. = ProjectiveSpace(GF(4, 't'), 2) # needs sage.rings.finite_rings sage: X = P.subscheme([y^2*z - x^3 - z^3]) # needs sage.rings.finite_rings + sage: R. = PowerSeriesRing(Integers()) - sage: X.zeta_series(2, t) # needs sage.rings.finite_rings + sage: X.zeta_series(2, t) # needs sage.libs.singular 1 + 5*t + 21*t^2 + O(t^3) TESTS:: diff --git a/src/sage/schemes/product_projective/space.py b/src/sage/schemes/product_projective/space.py index 17a5580ebb0..687feb0112f 100644 --- a/src/sage/schemes/product_projective/space.py +++ b/src/sage/schemes/product_projective/space.py @@ -848,7 +848,7 @@ def subscheme(self, X): sage: I = X.defining_ideal(); I Ideal (x - y, z - w) of Multivariate Polynomial Ring in x, y, z, w over Finite Field of size 5 - sage: X.dimension() # needs sage.rings.finite_rings + sage: X.dimension() # needs sage.libs.singular 0 sage: X.base_ring() Finite Field of size 5 @@ -1282,14 +1282,12 @@ def rational_points(self, F=None): :: sage: P = ProductProjectiveSpaces([1, 1], GF(2)) - sage: P.rational_points(GF(2^2, 'a')) # needs 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)] + sage: sorted(P.rational_points(GF(2^2, 'a')), key=str) # needs sage.rings.finite_rings + [(0 : 1 , 0 : 1), (0 : 1 , 1 : 0), (0 : 1 , 1 : 1), (0 : 1 , a + 1 : 1), (0 : 1 , a : 1), + (1 : 0 , 0 : 1), (1 : 0 , 1 : 0), (1 : 0 , 1 : 1), (1 : 0 , a + 1 : 1), (1 : 0 , a : 1), + (1 : 1 , 0 : 1), (1 : 1 , 1 : 0), (1 : 1 , 1 : 1), (1 : 1 , a + 1 : 1), (1 : 1 , a : 1), + (a + 1 : 1 , 0 : 1), (a + 1 : 1 , 1 : 0), (a + 1 : 1 , 1 : 1), (a + 1 : 1 , a + 1 : 1), (a + 1 : 1 , a : 1), + (a : 1 , 0 : 1), (a : 1 , 1 : 0), (a : 1 , 1 : 1), (a : 1 , a + 1 : 1), (a : 1 , a : 1)] """ if F is None: return list(self) diff --git a/src/sage/schemes/projective/projective_point.py b/src/sage/schemes/projective/projective_point.py index a3c726e210c..9d127673f39 100644 --- a/src/sage/schemes/projective/projective_point.py +++ b/src/sage/schemes/projective/projective_point.py @@ -296,6 +296,7 @@ def _richcmp_(self, right, op): Check that :trac:`17429` is fixed:: + sage: # needs sage.rings.complex_interval_field sage: R. = PolynomialRing(QQ) sage: r = (x^2 - x - 3).polynomial(x).roots(ComplexIntervalField(), multiplicities=False) sage: P. = ProjectiveSpace(ComplexIntervalField(), 1) diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index 1b95875e06b..9c67f083053 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -1042,9 +1042,9 @@ def points_of_bounded_height(self, **kwds): sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: F. = NumberField(x^4 - 8*x^2 + 3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(F, 2) # needs sage.rings.number_field - sage: all(exp(p.global_height()) <= 1 # needs sage.rings.number_field sage.symbolic + sage: F. = NumberField(x^4 - 8*x^2 + 3) + sage: P. = ProjectiveSpace(F, 2) + sage: all(exp(p.global_height()) <= 1 # needs sage.symbolic ....: for p in P.points_of_bounded_height(bound=1)) True @@ -1075,10 +1075,10 @@ def points_of_bounded_height(self, **kwds): sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(x^5 + x^3 + 1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field - sage: L = P.points_of_bounded_height(bound=1.2) # needs sage.rings.number_field - sage: len(list(L)) # needs sage.rings.number_field + 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)) 109 :: @@ -2149,11 +2149,12 @@ def subscheme_from_Chow_form(self, Ch, dim): :: + sage: # needs sage.libs.singular sage: P. = ProjectiveSpace(GF(7), 3) sage: X = P.subscheme([x3^2 + x1*x2, x2 - x0]) - sage: Ch = X.Chow_form(); Ch # needs sage.rings.finite_rings + sage: Ch = X.Chow_form(); Ch t0^2 - 2*t0*t3 + t3^2 - t2*t4 - t4*t5 - sage: Y = P.subscheme_from_Chow_form(Ch, 1); Y # needs sage.rings.finite_rings + sage: Y = P.subscheme_from_Chow_form(Ch, 1); Y Closed subscheme of Projective Space of dimension 3 over Finite Field of size 7 defined by: x1*x2 + x3^2, @@ -2164,8 +2165,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() # needs sage.rings.finite_rings - sage: I.saturation(I.ring().ideal(list(I.ring().gens())))[0] # needs sage.rings.finite_rings + sage: I = Y.defining_ideal() + sage: I.saturation(I.ring().ideal(list(I.ring().gens())))[0] Ideal (x0 - x2, x1*x2 + x3^2) of Multivariate Polynomial Ring in x0, x1, x2, x3 over Finite Field of size 7 """ @@ -2362,9 +2363,10 @@ def rational_points(self, F=None): sage: P = ProjectiveSpace(1, GF(3)) sage: P.rational_points() [(0 : 1), (1 : 1), (2 : 1), (1 : 0)] - sage: P.rational_points(GF(3^2, 'b')) # needs 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)] + sage: sorted(P.rational_points(GF(3^2, 'b')), key=str) # needs sage.rings.finite_rings + [(0 : 1), (1 : 0), (1 : 1), (2 : 1), + (2*b + 1 : 1), (2*b + 2 : 1), (2*b : 1), + (b + 1 : 1), (b + 2 : 1), (b : 1)] """ if F is None: return [P for P in self] From b6224fa0c7574d0d517742802de53c6d4109a7e2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 6 Aug 2023 20:45:14 -0700 Subject: [PATCH 044/423] src/sage/schemes: Update file-level doctest tag --- src/sage/schemes/cyclic_covers/cycliccover_finite_field.py | 2 +- src/sage/schemes/elliptic_curves/padic_lseries.py | 2 +- src/sage/schemes/generic/divisor.py | 1 + src/sage/schemes/generic/hypersurface.py | 1 + .../schemes/hyperelliptic_curves/hyperelliptic_finite_field.py | 2 +- src/sage/schemes/plane_conics/con_finite_field.py | 2 +- src/sage/schemes/plane_conics/con_number_field.py | 2 +- src/sage/schemes/toric/all.py | 1 + src/sage/schemes/toric/chow_group.py | 1 + src/sage/schemes/toric/divisor.py | 1 + src/sage/schemes/toric/divisor_class.pyx | 1 + src/sage/schemes/toric/fano_variety.py | 1 + src/sage/schemes/toric/homset.py | 1 + src/sage/schemes/toric/ideal.py | 1 + src/sage/schemes/toric/library.py | 1 + src/sage/schemes/toric/morphism.py | 1 + src/sage/schemes/toric/points.py | 1 + src/sage/schemes/toric/sheaf/constructor.py | 1 + src/sage/schemes/toric/sheaf/klyachko.py | 1 + src/sage/schemes/toric/toric_subscheme.py | 1 + src/sage/schemes/toric/variety.py | 1 + src/sage/schemes/toric/weierstrass.py | 1 + src/sage/schemes/toric/weierstrass_covering.py | 1 + src/sage/schemes/toric/weierstrass_higher.py | 1 + 24 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py b/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py index a3104af8175..82583c14cfc 100644 --- a/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py +++ b/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.finite_rings +# sage.doctest: needs sage.rings.finite_rings r""" Cyclic covers over a finite field diff --git a/src/sage/schemes/elliptic_curves/padic_lseries.py b/src/sage/schemes/elliptic_curves/padic_lseries.py index 00f27d6e1fe..96177ed417c 100644 --- a/src/sage/schemes/elliptic_curves/padic_lseries.py +++ b/src/sage/schemes/elliptic_curves/padic_lseries.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.padics +# sage.doctest: needs sage.rings.padics r""" `p`-adic `L`-functions of elliptic curves diff --git a/src/sage/schemes/generic/divisor.py b/src/sage/schemes/generic/divisor.py index 6a617309c5a..f24b4d9718e 100644 --- a/src/sage/schemes/generic/divisor.py +++ b/src/sage/schemes/generic/divisor.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.schemes """ Divisors on schemes diff --git a/src/sage/schemes/generic/hypersurface.py b/src/sage/schemes/generic/hypersurface.py index fa2326d43e5..9e3396cbbe8 100644 --- a/src/sage/schemes/generic/hypersurface.py +++ b/src/sage/schemes/generic/hypersurface.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.schemes r""" Hypersurfaces in affine and projective space diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py index ddb2cd61479..3d4af3e52c7 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.finite_rings +# sage.doctest: needs sage.rings.finite_rings r""" Hyperelliptic curves over a finite field diff --git a/src/sage/schemes/plane_conics/con_finite_field.py b/src/sage/schemes/plane_conics/con_finite_field.py index 5a6ef94bd7e..e62d8db828f 100644 --- a/src/sage/schemes/plane_conics/con_finite_field.py +++ b/src/sage/schemes/plane_conics/con_finite_field.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.finite_rings +# sage.doctest: needs sage.rings.finite_rings r""" Projective plane conics over finite fields diff --git a/src/sage/schemes/plane_conics/con_number_field.py b/src/sage/schemes/plane_conics/con_number_field.py index 2844329e195..19be6d237a8 100644 --- a/src/sage/schemes/plane_conics/con_number_field.py +++ b/src/sage/schemes/plane_conics/con_number_field.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.number_field +# sage.doctest: needs sage.rings.number_field r""" Projective plane conics over a number field diff --git a/src/sage/schemes/toric/all.py b/src/sage/schemes/toric/all.py index 9d7c83954a7..71ad52ef5c6 100644 --- a/src/sage/schemes/toric/all.py +++ b/src/sage/schemes/toric/all.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs from sage.misc.lazy_import import lazy_import lazy_import('sage.schemes.toric.weierstrass', 'WeierstrassForm') diff --git a/src/sage/schemes/toric/chow_group.py b/src/sage/schemes/toric/chow_group.py index b647bcc0350..ae3d245c744 100644 --- a/src/sage/schemes/toric/chow_group.py +++ b/src/sage/schemes/toric/chow_group.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs # -*- coding: utf-8 -*- r""" The Chow group of a toric variety diff --git a/src/sage/schemes/toric/divisor.py b/src/sage/schemes/toric/divisor.py index c71ca05eede..3fbdae4cdb5 100644 --- a/src/sage/schemes/toric/divisor.py +++ b/src/sage/schemes/toric/divisor.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs r""" Toric divisors and divisor classes diff --git a/src/sage/schemes/toric/divisor_class.pyx b/src/sage/schemes/toric/divisor_class.pyx index d0c497d8a94..5a92fe5b38d 100644 --- a/src/sage/schemes/toric/divisor_class.pyx +++ b/src/sage/schemes/toric/divisor_class.pyx @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs r""" Toric rational divisor classes diff --git a/src/sage/schemes/toric/fano_variety.py b/src/sage/schemes/toric/fano_variety.py index fe17a164a84..a1405c966ec 100644 --- a/src/sage/schemes/toric/fano_variety.py +++ b/src/sage/schemes/toric/fano_variety.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs r""" Fano toric varieties diff --git a/src/sage/schemes/toric/homset.py b/src/sage/schemes/toric/homset.py index 07c94ae1414..f9ec732c334 100644 --- a/src/sage/schemes/toric/homset.py +++ b/src/sage/schemes/toric/homset.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs r""" Set of homomorphisms between two toric varieties diff --git a/src/sage/schemes/toric/ideal.py b/src/sage/schemes/toric/ideal.py index 41cc4399fc1..b048980811f 100644 --- a/src/sage/schemes/toric/ideal.py +++ b/src/sage/schemes/toric/ideal.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs r""" Toric ideals diff --git a/src/sage/schemes/toric/library.py b/src/sage/schemes/toric/library.py index 03484a35d65..1bcaad63859 100644 --- a/src/sage/schemes/toric/library.py +++ b/src/sage/schemes/toric/library.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs r""" Library of toric varieties diff --git a/src/sage/schemes/toric/morphism.py b/src/sage/schemes/toric/morphism.py index 9a9f87a9b5e..1c8944b6dfc 100644 --- a/src/sage/schemes/toric/morphism.py +++ b/src/sage/schemes/toric/morphism.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs r""" Morphisms of toric varieties diff --git a/src/sage/schemes/toric/points.py b/src/sage/schemes/toric/points.py index b401a2052f8..d2891867360 100644 --- a/src/sage/schemes/toric/points.py +++ b/src/sage/schemes/toric/points.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs """ Enumerate points of a toric variety diff --git a/src/sage/schemes/toric/sheaf/constructor.py b/src/sage/schemes/toric/sheaf/constructor.py index 11a189adbf3..52f00d99815 100644 --- a/src/sage/schemes/toric/sheaf/constructor.py +++ b/src/sage/schemes/toric/sheaf/constructor.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs r""" Construct sheaves on toric varieties diff --git a/src/sage/schemes/toric/sheaf/klyachko.py b/src/sage/schemes/toric/sheaf/klyachko.py index 0bff2218156..08cea1487f9 100644 --- a/src/sage/schemes/toric/sheaf/klyachko.py +++ b/src/sage/schemes/toric/sheaf/klyachko.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs """ Klyachko bundles and sheaves diff --git a/src/sage/schemes/toric/toric_subscheme.py b/src/sage/schemes/toric/toric_subscheme.py index 61b7095bbba..abf7d1b1164 100644 --- a/src/sage/schemes/toric/toric_subscheme.py +++ b/src/sage/schemes/toric/toric_subscheme.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs r""" Subschemes of toric space diff --git a/src/sage/schemes/toric/variety.py b/src/sage/schemes/toric/variety.py index 954c0ba9e7f..727de10a43d 100644 --- a/src/sage/schemes/toric/variety.py +++ b/src/sage/schemes/toric/variety.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs # -*- coding: utf-8 -*- r""" Toric varieties diff --git a/src/sage/schemes/toric/weierstrass.py b/src/sage/schemes/toric/weierstrass.py index ecf28546aac..137dfd3e042 100644 --- a/src/sage/schemes/toric/weierstrass.py +++ b/src/sage/schemes/toric/weierstrass.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs r""" Weierstrass form of a toric elliptic curve diff --git a/src/sage/schemes/toric/weierstrass_covering.py b/src/sage/schemes/toric/weierstrass_covering.py index 5c7b899d93a..13e3c24b2c1 100644 --- a/src/sage/schemes/toric/weierstrass_covering.py +++ b/src/sage/schemes/toric/weierstrass_covering.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs r""" Map to the Weierstrass form of a toric elliptic curve diff --git a/src/sage/schemes/toric/weierstrass_higher.py b/src/sage/schemes/toric/weierstrass_higher.py index 3693bf0373e..f95b2fb2f6c 100644 --- a/src/sage/schemes/toric/weierstrass_higher.py +++ b/src/sage/schemes/toric/weierstrass_higher.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.geometry.polyhedron sage.graphs r""" Weierstrass for elliptic curves in higher codimension From 1a463edb79a44aed3a2e14651a1dfe9eafeaa5c6 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 7 Aug 2023 22:44:22 -0700 Subject: [PATCH 045/423] src/sage/schemes: sage -fixdoctests --only-tags --- src/sage/schemes/affine/affine_point.py | 12 +- src/sage/schemes/elliptic_curves/cm.py | 18 +- .../elliptic_curves/ell_curve_isogeny.py | 32 +-- src/sage/schemes/elliptic_curves/ell_field.py | 20 +- .../schemes/elliptic_curves/ell_generic.py | 17 +- src/sage/schemes/elliptic_curves/ell_point.py | 106 +++++----- src/sage/schemes/elliptic_curves/height.py | 65 +++--- .../schemes/elliptic_curves/hom_composite.py | 30 +-- .../elliptic_curves/isogeny_small_degree.py | 54 ++--- .../schemes/elliptic_curves/period_lattice.py | 197 ++++++++++-------- src/sage/schemes/generic/algebraic_scheme.py | 2 +- src/sage/schemes/generic/morphism.py | 2 +- src/sage/schemes/generic/scheme.py | 2 +- src/sage/schemes/plane_conics/con_field.py | 9 +- .../schemes/projective/proj_bdd_height.py | 44 +++- .../schemes/projective/projective_morphism.py | 146 ++++++------- .../projective/projective_subscheme.py | 16 +- 17 files changed, 425 insertions(+), 347 deletions(-) diff --git a/src/sage/schemes/affine/affine_point.py b/src/sage/schemes/affine/affine_point.py index fa5c3337274..a665ba6881a 100644 --- a/src/sage/schemes/affine/affine_point.py +++ b/src/sage/schemes/affine/affine_point.py @@ -305,12 +305,12 @@ def weil_restriction(self): sage: # needs sage.libs.singular sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(x^5 - 2) # needs sage.rings.number_field - sage: R. = K[] # needs sage.rings.number_field - sage: L. = K.extension(x^2 + w) # needs sage.rings.number_field - sage: A. = AffineSpace(L, 2) # needs sage.rings.number_field - sage: P = A([w^3 - v, 1 + w + w*v]) # needs sage.rings.number_field - sage: P.weil_restriction() # needs sage.rings.number_field + 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() (w^3, -1, w + 1, w) """ L = self.codomain().base_ring() diff --git a/src/sage/schemes/elliptic_curves/cm.py b/src/sage/schemes/elliptic_curves/cm.py index 4476654b84c..ddfc6bb1d3c 100644 --- a/src/sage/schemes/elliptic_curves/cm.py +++ b/src/sage/schemes/elliptic_curves/cm.py @@ -368,14 +368,15 @@ def cm_j_invariants(K, proof=None): Over number fields K of many higher degrees this also works:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: cm_j_invariants(K) # needs sage.rings.number_field + sage: K. = NumberField(x^3 - 2) + sage: cm_j_invariants(K) [-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) # needs sage.rings.number_field - sage: len(cm_j_invariants(K)) # needs sage.rings.number_field + sage: K. = NumberField(x^4 - 2) + sage: len(cm_j_invariants(K)) 23 """ return sorted(j for D, f, j in cm_j_invariants_and_orders(K, proof=proof)) @@ -930,12 +931,13 @@ def is_cm_j_invariant(j, algorithm='CremonaSutherland', method=None): sage: is_cm_j_invariant(8000) (True, (-8, 1)) - sage: K. = QuadraticField(5) # needs sage.rings.number_field - sage: is_cm_j_invariant(282880*a + 632000) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(5) + sage: is_cm_j_invariant(282880*a + 632000) (True, (-20, 1)) sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: is_cm_j_invariant(31710790944000*a^2 + 39953093016000*a + 50337742902000) # needs sage.rings.number_field + sage: K. = NumberField(x^3 - 2) + sage: is_cm_j_invariant(31710790944000*a^2 + 39953093016000*a + 50337742902000) (True, (-3, 6)) An example of large degree. This is only possible using the default algorithm:: diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index e839799f187..675a94da3d5 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -1219,16 +1219,17 @@ def _call_(self, P): Tests for :trac:`10888`:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 + 3) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [7,0]) # needs sage.rings.number_field - sage: phi = E.isogeny(E(0,0)) # needs sage.rings.number_field - sage: P = E(-3,4*th) # needs sage.rings.number_field - sage: phi(P) # needs sage.rings.number_field + 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) (-16/3 : 8/9*th : 1) - sage: Q = phi(P) # needs sage.rings.number_field - sage: phihat = phi.dual() # needs sage.rings.number_field - sage: phihat(Q) # needs sage.rings.number_field + sage: Q = phi(P) + sage: phihat = phi.dual() + sage: phihat(Q) (-1/48 : 127/576*th : 1) Call a composed isogeny (added for :trac:`16238`):: @@ -1273,14 +1274,15 @@ def _call_(self, P): Test for :trac:`35983`:: - sage: E = EllipticCurve([1,0,0,-1,0]) # optional - sage.rings.finite_rings - sage: P = E([1,0]) # optional - sage.rings.finite_rings - sage: P.order() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E = EllipticCurve([1,0,0,-1,0]) + sage: P = E([1,0]) + sage: P.order() +Infinity - sage: phi = E.isogenies_prime_degree(2)[0] # optional - sage.rings.finite_rings - sage: Q = phi(P); Q # optional - sage.rings.finite_rings + sage: phi = E.isogenies_prime_degree(2)[0] + sage: Q = phi(P); Q (0 : 1 : 1) - sage: Q.order() # optional - sage.rings.finite_rings + sage: Q.order() +Infinity """ @@ -3685,7 +3687,7 @@ def compute_intermediate_curves(E1, E2): sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field sage: E = EllipticCurve(K, [0,0,0,1,0]) # needs sage.rings.number_field sage: E2 = EllipticCurve(K, [0,0,0,16,0]) # needs sage.rings.number_field - sage: compute_intermediate_curves(E, E2) # needs sage.rings.number_field + sage: compute_intermediate_curves(E, E2) # needs sage.rings.finite_rings 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 diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index 588a4524bcb..de5c2fdfd47 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -661,15 +661,16 @@ def descend_to(self, K, f=None): :: - sage: F. = QuadraticField(23) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: F. = QuadraticField(23) sage: x = polygen(ZZ, 'x') - sage: G. = F.extension(x^3 + 5) # needs sage.rings.number_field - sage: E = EllipticCurve(j=1728*b).change_ring(G) # needs sage.rings.number_field - sage: EF = E.descend_to(F); EF # needs sage.rings.number_field + 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) # needs sage.rings.number_field + sage: all(Ei.change_ring(G).is_isomorphic(E) for Ei in EF) True :: @@ -1817,16 +1818,17 @@ class of curves. If the j-invariant is not unique in the isogeny Ordinary curve over finite extension field of degree 2:: + sage: # needs sage.rings.finite_rings sage: x = polygen(ZZ, 'x') - sage: E = EllipticCurve(GF(59^2, "i", x^2 + 1), j=5) # needs sage.rings.finite_rings - sage: G = E.isogeny_ell_graph(5, directed=False, label_by_j=True); G # needs sage.graphs sage.rings.finite_rings + 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); G # needs sage.graphs Graph on 20 vertices - sage: G.vertices(sort=True) # needs sage.graphs sage.rings.finite_rings + sage: G.vertices(sort=True) # needs sage.graphs ['1', '12', ... 'i + 55'] - sage: G.edges(sort=True) # needs sage.graphs sage.rings.finite_rings + sage: G.edges(sort=True) # needs sage.graphs [('1', '28*i + 11', None), ('1', '31*i + 11', None), ... diff --git a/src/sage/schemes/elliptic_curves/ell_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py index d4e8f4b6a1d..7afc98429c5 100644 --- a/src/sage/schemes/elliptic_curves/ell_generic.py +++ b/src/sage/schemes/elliptic_curves/ell_generic.py @@ -509,20 +509,21 @@ def __call__(self, *args, **kwds): We create a point on an elliptic curve over a number field:: + sage: # needs sage.rings.number_field sage: x = polygen(RationalField()) - sage: K = NumberField(x**3 + x + 1, 'a'); a = K.gen() # needs sage.rings.number_field - sage: E = EllipticCurve([a, a]) # needs sage.rings.number_field - sage: E # needs sage.rings.number_field + 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]) # needs sage.rings.number_field - sage: E # needs sage.rings.number_field + 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]) # needs sage.rings.number_field - sage: P # needs sage.rings.number_field + sage: P = E([a,0,1]) + sage: P (a : 0 : 1) - sage: P + P # needs sage.rings.number_field + sage: P + P (0 : 1 : 0) Another example involving p-adics:: diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py index ec1bc552a2c..b9ae1d8c93d 100644 --- a/src/sage/schemes/elliptic_curves/ell_point.py +++ b/src/sage/schemes/elliptic_curves/ell_point.py @@ -191,14 +191,15 @@ class EllipticCurvePoint_field(SchemeMorphism_point_abelian_variety_field): Abelian group of points on Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0,1,0,-160,308]) # needs sage.rings.number_field - sage: P = E(26, -120) # needs sage.rings.number_field - sage: Q = E(2+12*i, -36+48*i) # needs sage.rings.number_field - sage: P.order() == Q.order() == 4 # long time # needs sage.rings.number_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 True - sage: 2*P == 2*Q # needs sage.rings.number_field + sage: 2*P == 2*Q False :: @@ -2456,22 +2457,23 @@ def has_good_reduction(self, P=None): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0,1,0,-160,308]) # needs sage.rings.number_field - sage: P = E(26, -120) # needs sage.rings.number_field - sage: E.discriminant().support() # needs sage.rings.number_field + sage: K. = NumberField(x^2 + 1) + sage: E = EllipticCurve(K, [0,1,0,-160,308]) + sage: P = E(26, -120) + sage: E.discriminant().support() [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()] # needs sage.rings.number_field + sage: [E.tamagawa_exponent(p) for p in E.discriminant().support()] [1, 4, 4, 4] - sage: P.has_good_reduction() # needs sage.rings.number_field + sage: P.has_good_reduction() False - sage: (2*P).has_good_reduction() # needs sage.rings.number_field + sage: (2*P).has_good_reduction() False - sage: (4*P).has_good_reduction() # needs sage.rings.number_field + sage: (4*P).has_good_reduction() True TESTS: @@ -2567,13 +2569,14 @@ def reduction(self, p): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: F. = NumberField(x^2 + 5) # needs sage.rings.number_field - sage: E = EllipticCurve(F, [1,2,3,4,0]) # needs sage.rings.number_field - sage: Q = E(98, 931) # needs sage.rings.number_field - sage: Q.reduction(a) # needs sage.rings.number_field + sage: F. = NumberField(x^2 + 5) + sage: E = EllipticCurve(F, [1,2,3,4,0]) + sage: Q = E(98, 931) + sage: Q.reduction(a) (3 : 1 : 1) - sage: Q.reduction(11) # needs sage.rings.number_field + sage: Q.reduction(11) (10 : 7 : 1) :: @@ -2796,18 +2799,19 @@ def height(self, precision=None, normalised=True, algorithm='pari'): An example to show that the bug at :trac:`12509` is fixed (precision issues):: + sage: # needs sage.rings.number_field sage: x = polygen(QQ) - sage: K. = NumberField(x^2 - x - 1) # needs sage.rings.number_field - sage: v = [0, a + 1, 1, 28665*a - 46382, 2797026*a - 4525688] # needs sage.rings.number_field - sage: E = EllipticCurve(v) # needs sage.rings.number_field - sage: P = E([72*a - 509/5, -682/25*a - 434/25]) # needs sage.rings.number_field - sage: P.height() # needs sage.rings.number_field + 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() 1.38877711688727 - sage: (2*P).height()/P.height() # needs sage.rings.number_field + sage: (2*P).height()/P.height() 4.00000000000000 - sage: (2*P).height(precision=100)/P.height(precision=100) # needs sage.rings.number_field + sage: (2*P).height(precision=100)/P.height(precision=100) 4.0000000000000000000000000000 - sage: (2*P).height(precision=1000)/P.height(precision=1000) # needs sage.rings.number_field + sage: (2*P).height(precision=1000)/P.height(precision=1000) 4.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 This shows that the bug reported at :trac:`13951` has been fixed:: @@ -2903,13 +2907,14 @@ def archimedean_local_height(self, v=None, prec=None, weighted=False): sage: P.archimedean_local_height(K.places(prec=170)[0]) / 2 0.45754773287523276736211210741423654346576029814695 + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0,0,4,6*i,0]); E # needs sage.rings.number_field + 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)) # needs sage.rings.number_field - sage: P.archimedean_local_height(K.places()[0]) / 2 # needs sage.rings.number_field + sage: P = E((0,0)) + sage: P.archimedean_local_height(K.places()[0]) / 2 0.510184995162373 sage: Q = E.lift_x(-9/4); Q # needs sage.rings.number_field @@ -2938,12 +2943,13 @@ def archimedean_local_height(self, v=None, prec=None, weighted=False): See :trac:`12509`:: + sage: # needs sage.rings.number_field sage: x = polygen(QQ) - sage: K. = NumberField(x^2 - x - 1) # needs sage.rings.number_field - sage: v = [0, a + 1, 1, 28665*a - 46382, 2797026*a - 4525688] # needs sage.rings.number_field - sage: E = EllipticCurve(v) # needs sage.rings.number_field - sage: P = E([72*a - 509/5, -682/25*a - 434/25]) # needs sage.rings.number_field - sage: P.archimedean_local_height() # needs sage.rings.number_field + 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() -0.220660795546828 See :trac:`19276`:: @@ -3126,17 +3132,18 @@ def non_archimedean_local_height(self, v=None, prec=None, Examples 2 and 3 from [Sil1988]_:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0,0,4,6*i,0]); E # needs sage.rings.number_field + 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)) # needs sage.rings.number_field - sage: P.non_archimedean_local_height(K.ideal(i+1)) # needs sage.rings.number_field + sage: P = E((0,0)) + sage: P.non_archimedean_local_height(K.ideal(i+1)) -1/2*log(2) - sage: P.non_archimedean_local_height(K.ideal(3)) # needs sage.rings.number_field + sage: P.non_archimedean_local_height(K.ideal(3)) 0 - sage: P.non_archimedean_local_height(K.ideal(1-2*i)) # needs sage.rings.number_field + sage: P.non_archimedean_local_height(K.ideal(1-2*i)) 0 sage: # needs sage.rings.number_field @@ -3373,15 +3380,16 @@ def elliptic_logarithm(self, embedding=None, precision=100, Examples over number fields:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: embs = K.embeddings(CC) # needs sage.rings.number_field - sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field - sage: Ls = [E.period_lattice(e) for e in embs] # needs sage.rings.number_field - sage: [L.real_flag for L in Ls] # needs sage.rings.number_field + 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] [0, 0, -1] - sage: P = E(-1,0) # order 2 # needs sage.rings.number_field - sage: [L.elliptic_logarithm(P) for L in Ls] # needs sage.rings.number_field + 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] diff --git a/src/sage/schemes/elliptic_curves/height.py b/src/sage/schemes/elliptic_curves/height.py index 9964c481cf2..881072130ed 100644 --- a/src/sage/schemes/elliptic_curves/height.py +++ b/src/sage/schemes/elliptic_curves/height.py @@ -1166,21 +1166,22 @@ def psi(self, xi, v): An example over a number field:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: E = EllipticCurve([0,0,0,0,a]) # needs sage.rings.number_field - sage: P = E.lift_x(1/3*a^2 + a + 5/3) # needs sage.rings.number_field - sage: v = K.real_places()[0] # needs sage.rings.number_field - sage: L = E.period_lattice(v) # needs sage.rings.number_field - sage: L(P) # needs sage.rings.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) 3.51086196882538 - sage: L(P) / L.real_period() # needs sage.rings.number_field + sage: L(P) / L.real_period() 0.867385122699931 - sage: xP = v(P.xy()[0]) # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.number_field - sage: H.psi(xP, v) # needs sage.rings.number_field + sage: xP = v(P.xy()[0]) + sage: H = E.height_function() + sage: H.psi(xP, v) 0.867385122699931 - sage: H.psi(1.23, v) # needs sage.rings.number_field + sage: H.psi(1.23, v) 0.785854718241495 """ if xi > 1e9: @@ -1222,12 +1223,13 @@ def S(self, xi1, xi2, v): An example over a number field:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: E = EllipticCurve([0,0,0,0,a]) # needs sage.rings.number_field - sage: v = K.real_places()[0] # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.number_field - sage: H.S(9, 10, v) # needs sage.rings.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) ([0.078119444725347..., 0.082342373201640...] U [0.91765762679836..., 0.92188055527465...]) """ L = self.E.period_lattice(v) @@ -1274,15 +1276,16 @@ def Sn(self, xi1, xi2, n, v): An example over a number field:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: E = EllipticCurve([0,0,0,0,a]) # needs sage.rings.number_field - sage: v = K.real_places()[0] # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.number_field - sage: H.S(2, 3, v), H.Sn(2, 3, 1, v) # needs sage.rings.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) (([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) # needs sage.rings.number_field + 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) @@ -1328,11 +1331,12 @@ def real_intersection_is_empty(self, Bk, v): An example over a number field:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: E = EllipticCurve([0,0,0,0,a]) # needs sage.rings.number_field - sage: v = K.real_places()[0] # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.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() The following two lines prove that the heights of non-torsion points on `E` with everywhere good reduction have canonical @@ -1680,11 +1684,12 @@ def complex_intersection_is_empty(self, Bk, v, verbose=False, use_half=True): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: E = EllipticCurve([0,0,0,0,a]) # needs sage.rings.number_field - sage: v = K.complex_embeddings()[0] # needs sage.rings.number_field - sage: H = E.height_function() # needs sage.rings.number_field + 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() The following two lines prove that the heights of non-torsion points on `E` with everywhere good reduction have canonical diff --git a/src/sage/schemes/elliptic_curves/hom_composite.py b/src/sage/schemes/elliptic_curves/hom_composite.py index e653e58618a..c4da8dacf1c 100644 --- a/src/sage/schemes/elliptic_curves/hom_composite.py +++ b/src/sage/schemes/elliptic_curves/hom_composite.py @@ -301,14 +301,15 @@ def __init__(self, E, kernel, codomain=None, model=None): The given kernel generators need not be independent:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 - x - 5) # needs sage.rings.number_field - sage: E = EllipticCurve('210.b6').change_ring(K) # needs sage.rings.number_field - sage: E.torsion_subgroup() # needs sage.rings.number_field + 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 - sage: EllipticCurveHom_composite(E, E.torsion_points()) # needs sage.rings.number_field + 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 @@ -435,7 +436,7 @@ def from_factors(cls, maps, E=None, strict=True): TESTS:: sage: E = EllipticCurve('4730k1') - sage: EllipticCurveHom_composite.from_factors([], E) == E.scalar_multiplication(1) + sage: EllipticCurveHom_composite.from_factors([], E) == E.scalar_multiplication(1) # needs sage.rings.finite_rings True :: @@ -477,13 +478,14 @@ def _call_(self, P): TESTS:: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 - x - 5) # needs sage.rings.number_field - sage: E = EllipticCurve('210.b6').change_ring(K) # needs sage.rings.number_field - sage: psi = EllipticCurveHom_composite(E, E.torsion_points()) # needs sage.rings.number_field - sage: R = E.lift_x(15/4 * (a+3)) # needs sage.rings.number_field - sage: psi(R) # indirect doctest # needs sage.rings.number_field + 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 (1033648757/303450 : -58397496786187/1083316500*a + 54706287407197/2166633000 : 1) Check that copying the order over works:: @@ -678,10 +680,10 @@ def _comparison_impl(left, right, op): sage: # needs sage.rings.finite_rings 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: phi1 = EllipticCurveHom_composite(E, P) # needs sage.rings.number_field + sage: phi2 = EllipticCurveHom_composite(phi1.codomain(), phi1(Q)) # needs sage.rings.number_field + sage: psi1 = EllipticCurveHom_composite(E, Q) # needs sage.rings.number_field + sage: psi2 = EllipticCurveHom_composite(psi1.codomain(), psi1(P)) # needs sage.rings.number_field sage: phi2 * phi1 == psi2 * psi1 True """ diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py index b69a6a2a988..2838e8e2e8a 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py @@ -990,12 +990,13 @@ def isogenies_5_1728(E, minimal_models=True): An example of 5-isogenies over a number field:: + sage: # needs sage.rings.number_field sage: x = polygen(QQ, 'x') - sage: K. = NumberField(x**4 + 20*x**2 - 80) # needs sage.rings.number_field - sage: K(5).is_square() # necessary but not sufficient! # needs sage.rings.number_field + 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]) # needs sage.rings.number_field - sage: isogenies_5_1728(E) # needs sage.rings.number_field + 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 @@ -1137,11 +1138,12 @@ def isogenies_7_0(E, minimal_models=True): 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: # needs sage.rings.number_field sage: x = polygen(QQ, 'x') - sage: K. = NumberField(x^6 + 1512*x^3 - 21168) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0,1]) # needs sage.rings.number_field - sage: isogs = isogenies_7_0(E) # needs sage.rings.number_field - sage: [phi.codomain().a_invariants() for phi in isogs] # needs sage.rings.number_field + 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] [(0, 0, 0, @@ -1154,7 +1156,7 @@ def isogenies_7_0(E, minimal_models=True): -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] # needs sage.rings.number_field + sage: [phi.codomain().j_invariant() for phi in isogs] [158428486656000/7*a^3 - 313976217600000, -158428486656000/7*a^3 - 34534529335296000] """ @@ -1245,20 +1247,21 @@ def isogenies_7_1728(E, minimal_models=True): :: + sage: # needs sage.rings.number_field sage: x = polygen(QQ, 'x') - sage: K. = NumberField(x^8 + 84*x^6 - 1890*x^4 + 644*x^2 - 567) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [1, 0]) # needs sage.rings.number_field - sage: isogs = isogenies_7_1728(E) # needs sage.rings.number_field - sage: [phi.codomain().j_invariant() for phi in isogs] # needs sage.rings.number_field + 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() # needs sage.rings.number_field - sage: E2 = isogs[1].codomain() # needs sage.rings.number_field - sage: E1.is_isomorphic(E2) # needs sage.rings.number_field + sage: E1 = isogs[0].codomain() + sage: E2 = isogs[1].codomain() + sage: E1.is_isomorphic(E2) False - sage: E1.is_quadratic_twist(E2) # needs sage.rings.number_field + sage: E1.is_quadratic_twist(E2) -1 """ if E.j_invariant() != 1728: @@ -2181,13 +2184,14 @@ 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: # needs sage.rings.number_field sage: u = polygen(QQ) - sage: K. = NumberField(u^6 - 522*u^5 - 10017*u^4 # needs sage.rings.number_field + 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 # needs sage.rings.number_field + 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) # needs sage.rings.number_field + 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 @@ -2208,9 +2212,9 @@ def isogenies_prime_degree_genus_plus_0_j1728(E, l, minimal_models=True): + (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() # needs sage.rings.number_field - sage: E = EllipticCurve([-1 - 2*i, 0]) # needs sage.rings.number_field - sage: isogenies_prime_degree_genus_plus_0_j1728(E, 17) # needs sage.rings.number_field + 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 @@ -2221,8 +2225,8 @@ def isogenies_prime_degree_genus_plus_0_j1728(E, l, minimal_models=True): 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() # needs sage.rings.number_field - sage: [(p, len(isogenies_prime_degree_genus_plus_0_j1728(Emin, p))) # needs sage.rings.number_field + 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)] """ diff --git a/src/sage/schemes/elliptic_curves/period_lattice.py b/src/sage/schemes/elliptic_curves/period_lattice.py index 60790c9b2d5..512385611b1 100644 --- a/src/sage/schemes/elliptic_curves/period_lattice.py +++ b/src/sage/schemes/elliptic_curves/period_lattice.py @@ -182,11 +182,12 @@ def __init__(self, E, embedding=None): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field - sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field - sage: L = PeriodLattice_ell(E, emb); L # needs sage.rings.number_field + 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 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: @@ -283,13 +284,14 @@ def __richcmp__(self, other, op): TESTS:: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.period_lattice import PeriodLattice_ell sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field - sage: embs = K.embeddings(ComplexField()) # needs sage.rings.number_field - sage: L1, L2, L3 = [PeriodLattice_ell(E, e) for e in embs] # needs sage.rings.number_field - sage: L1 < L2 < L3 # needs sage.rings.number_field + 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 True """ if not isinstance(other, PeriodLattice_ell): @@ -315,11 +317,12 @@ def __repr__(self): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field - sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field - sage: L = E.period_lattice(emb); L # needs sage.rings.number_field + 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 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 @@ -441,12 +444,13 @@ def basis(self, prec=None, algorithm='sage'): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field - sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field - sage: L = E.period_lattice(emb) # needs sage.rings.number_field - sage: L.basis(64) # needs sage.rings.number_field + 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) (3.81452977217854509, 1.90726488608927255 + 1.34047785962440202*I) sage: # needs sage.rings.number_field @@ -544,12 +548,13 @@ def normalised_basis(self, prec=None, algorithm='sage'): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field - sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field - sage: L = E.period_lattice(emb) # needs sage.rings.number_field - sage: L.normalised_basis(64) # needs sage.rings.number_field + 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) @@ -599,16 +604,17 @@ def tau(self, prec=None, algorithm='sage'): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field - sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field - sage: L = E.period_lattice(emb) # needs sage.rings.number_field - sage: tau = L.tau(); tau # needs sage.rings.number_field + 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 -0.338718341018919 + 0.940887817679340*I - sage: tau.abs() # needs sage.rings.number_field + sage: tau.abs() 1.00000000000000 - sage: -0.5 <= tau.real() <= 0.5 # needs sage.rings.number_field + sage: -0.5 <= tau.real() <= 0.5 True sage: # needs sage.rings.number_field @@ -647,17 +653,18 @@ def _compute_periods_real(self, prec=None, algorithm='sage'): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field - sage: embs = K.embeddings(CC) # needs sage.rings.number_field - sage: Ls = [E.period_lattice(e) for e in embs] # needs sage.rings.number_field - sage: [L.is_real() for L in Ls] # needs sage.rings.number_field + 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] [False, False, True] - sage: Ls[2]._compute_periods_real(100) # needs sage.rings.number_field + sage: Ls[2]._compute_periods_real(100) (3.8145297721785450936365098936, 1.9072648860892725468182549468 + 1.3404778596244020196600112394*I) - sage: Ls[2]._compute_periods_real(100, algorithm='pari') # needs sage.rings.number_field + sage: Ls[2]._compute_periods_real(100, algorithm='pari') (3.8145297721785450936365098936, 1.9072648860892725468182549468 - 1.3404778596244020196600112394*I) """ @@ -718,22 +725,23 @@ def _compute_periods_complex(self, prec=None, normalise=True): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field - sage: embs = K.embeddings(CC) # needs sage.rings.number_field - sage: Ls = [E.period_lattice(e) for e in embs] # needs sage.rings.number_field - sage: [L.is_real() for L in Ls] # needs sage.rings.number_field + 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] [False, False, True] - sage: L = Ls[0] # needs sage.rings.number_field - sage: w1,w2 = L._compute_periods_complex(100); w1,w2 # needs sage.rings.number_field + sage: L = Ls[0] + sage: w1,w2 = L._compute_periods_complex(100); w1,w2 (-1.3758860416607626645495991458 - 2.5856094662444337042877901304*I, -2.1033990784735587243397865076 + 0.42837877646062187766760569686*I) - sage: tau = w1/w2; tau # needs sage.rings.number_field + sage: tau = w1/w2; tau 0.38769450503287609349437509561 + 1.3082108821440725664008561928*I - sage: tau.real() # needs sage.rings.number_field + sage: tau.real() 0.38769450503287609349437509561 - sage: tau.abs() # needs sage.rings.number_field + sage: tau.abs() 1.3644496111593345713923386773 Without normalisation:: @@ -867,12 +875,13 @@ def real_period(self, prec=None, algorithm='sage'): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field - sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field - sage: L = E.period_lattice(emb) # needs sage.rings.number_field - sage: L.real_period(64) # needs sage.rings.number_field + 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) 3.81452977217854509 """ if self.is_real(): @@ -929,12 +938,13 @@ def omega(self, prec=None, bsd_normalise=False): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field - sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field - sage: L = E.period_lattice(emb) # needs sage.rings.number_field - sage: L.omega(64) # needs sage.rings.number_field + 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) 3.81452977217854509 A complex example (taken from J.E.Cremona and E.Whitley, @@ -988,12 +998,13 @@ def basis_matrix(self, prec=None, normalised=False): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: emb = K.embeddings(RealField())[0] # needs sage.rings.number_field - sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field - sage: L = E.period_lattice(emb) # needs sage.rings.number_field - sage: L.basis_matrix(64) # needs sage.rings.number_field + 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) [ 3.81452977217854509 0.000000000000000000] [ 1.90726488608927255 1.34047785962440202] @@ -1113,11 +1124,12 @@ def curve(self): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field - sage: L = E.period_lattice(K.embeddings(RealField())[0]) # needs sage.rings.number_field - sage: L.curve() is E # needs sage.rings.number_field + 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 True sage: L = E.period_lattice(K.embeddings(ComplexField())[0]) # needs sage.rings.number_field @@ -1143,14 +1155,15 @@ def ei(self): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: E = EllipticCurve([0,1,0,a,a]) # needs sage.rings.number_field - sage: L = E.period_lattice(K.embeddings(RealField())[0]) # needs sage.rings.number_field - sage: x1,x2,x3 = L.ei() # needs sage.rings.number_field - sage: abs(x1.real()) + abs(x2.real()) < 1e-14 # needs sage.rings.number_field + 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 True - sage: x1.imag(), x2.imag(), x3 # needs sage.rings.number_field + sage: x1.imag(), x2.imag(), x3 (-1.122462048309373?, 1.122462048309373?, -1.000000000000000?) :: @@ -1359,16 +1372,17 @@ def e_log_RC(self, xP, yP, prec=None, reduce=True): A number field example:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: E = EllipticCurve([0,0,0,0,a]) # needs sage.rings.number_field - sage: v = K.real_places()[0] # needs sage.rings.number_field - sage: L = E.period_lattice(v) # needs sage.rings.number_field - sage: P = E.lift_x(1/3*a^2 + a + 5/3) # needs sage.rings.number_field - sage: L(P) # needs sage.rings.number_field + 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) 3.51086196882538 - sage: xP, yP = [v(c) for c in P.xy()] # needs sage.rings.number_field - sage: L.e_log_RC(xP, yP) # needs sage.rings.number_field + sage: xP, yP = [v(c) for c in P.xy()] + sage: L.e_log_RC(xP, yP) 3.51086196882538 Elliptic logs of real points which do not come from algebraic @@ -1761,20 +1775,21 @@ def elliptic_exponential(self, z, to_curve=True): Examples over number fields:: + sage: # needs sage.rings.number_field sage: x = polygen(QQ) - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: embs = K.embeddings(CC) # needs sage.rings.number_field - sage: E = EllipticCurve('37a') # needs sage.rings.number_field - sage: EK = E.change_ring(K) # needs sage.rings.number_field - sage: Li = [EK.period_lattice(e) for e in embs] # needs sage.rings.number_field - sage: P = EK(-1, -1) # needs sage.rings.number_field - sage: Q = EK(a - 1, 1 - a^2) # needs sage.rings.number_field - sage: zi = [L.elliptic_logarithm(P) for L in Li] # needs sage.rings.number_field - sage: [c.real() for c in Li[0].elliptic_exponential(zi[0])] # needs sage.rings.number_field + 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])] [-1.00000000000000, -1.00000000000000, 1.00000000000000] - sage: [c.real() for c in Li[0].elliptic_exponential(zi[1])] # needs sage.rings.number_field + sage: [c.real() for c in Li[0].elliptic_exponential(zi[1])] [-1.00000000000000, -1.00000000000000, 1.00000000000000] - sage: [c.real() for c in Li[0].elliptic_exponential(zi[2])] # needs sage.rings.number_field + sage: [c.real() for c in Li[0].elliptic_exponential(zi[2])] [-1.00000000000000, -1.00000000000000, 1.00000000000000] sage: # needs sage.rings.number_field diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index 8fc429b98d9..6a0d8c48aa1 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -77,7 +77,7 @@ -x1^2 + x2, -x1*x2 + x3, -x2^2 + x1*x3 - sage: patch.embedding_morphism() # needs sage.libs.singular + sage: patch.embedding_morphism() # needs sage.libs.singular sage.modules 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 diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index 97dd38a69e7..eedd0935525 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -513,7 +513,7 @@ def base_ring(self): :: - sage: # needs sage.rings.finite_rings sage,schemes + sage: # optional - sage, needs sage.rings.finite_rings sage: E = EllipticCurve(GF((17,2)), [1,2,3,4,5]) sage: P = E.random_point() sage: P.base_ring() diff --git a/src/sage/schemes/generic/scheme.py b/src/sage/schemes/generic/scheme.py index 32986ef6907..ee5a02335b7 100644 --- a/src/sage/schemes/generic/scheme.py +++ b/src/sage/schemes/generic/scheme.py @@ -759,7 +759,7 @@ def zeta_series(self, n, t): sage: X = P.subscheme([y^2*z - x^3 - z^3]) # needs sage.rings.finite_rings sage: R. = PowerSeriesRing(Integers()) - sage: X.zeta_series(2, t) # needs sage.libs.singular + sage: X.zeta_series(2, t) # needs sage.libs.singular sage.rings.finite_rings 1 + 5*t + 21*t^2 + O(t^3) TESTS:: diff --git a/src/sage/schemes/plane_conics/con_field.py b/src/sage/schemes/plane_conics/con_field.py index cbd4ca9e635..5ac081d5df8 100644 --- a/src/sage/schemes/plane_conics/con_field.py +++ b/src/sage/schemes/plane_conics/con_field.py @@ -194,14 +194,15 @@ def derivative_matrix(self): An example in characteristic `2`:: - sage: P. = GF(2)[] # needs sage.rings.finite_rings - sage: c = Conic([t, 1, t^2, 1, 1, 0]); c # needs sage.libs.ntl sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: P. = GF(2)[] + sage: c = Conic([t, 1, t^2, 1, 1, 0]); c # needs sage.libs.ntl 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() # needs sage.rings.finite_rings + sage: c.is_smooth() True - sage: c.derivative_matrix() # needs sage.rings.finite_rings + sage: c.derivative_matrix() [ 0 1 t^2] [ 1 0 1] [t^2 1 0] diff --git a/src/sage/schemes/projective/proj_bdd_height.py b/src/sage/schemes/projective/proj_bdd_height.py index d6db237c02f..744313fc77f 100644 --- a/src/sage/schemes/projective/proj_bdd_height.py +++ b/src/sage/schemes/projective/proj_bdd_height.py @@ -256,10 +256,46 @@ def points_of_bounded_height(PS, K, dim, bound, prec=53): sage: from sage.schemes.projective.proj_bdd_height import points_of_bounded_height sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 7) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field - sage: len(list(points_of_bounded_height(P, K, 2, 1))) # needs sage.geometry.polyhedron sage.libs.pari sage.rings.number_field - 13 + + sage: # needs sage.geometry.polyhedron sage.libs.pari sage.rings.number_field + sage: K. = NumberField(x^3 - 7) + sage: P. = ProjectiveSpace(K, 2) + sage: sorted(list(points_of_bounded_height(P, K, 2, 1))) + [(0 : 0 : 1), (0 : 1 : 0), (1 : 0 : 0), (0 : -1 : 1), (0 : 1 : 1), + (-1 : 0 : 1), (1 : 0 : 1), (1 : 1 : 0), (-1 : 1 : 0), (-1 : -1 : 1), + (-1 : 1 : 1), (1 : -1 : 1), (1 : 1 : 1)] + + :: + + sage: # needs sage.geometry.polyhedron sage.libs.pari sage.rings.number_field + sage: R. = QQ[] + sage: K. = NumberField(3*x^2 + 1) + sage: O = K.maximal_order() + sage: P. = ProjectiveSpace(O, 1) + sage: len(list(P.points_of_bounded_height(bound=2))) + 44 + + :: + + sage: # needs sage.geometry.polyhedron sage.libs.pari sage.rings.number_field + sage: R. = QQ[] + sage: K. = NumberField(3*x^2 + 1) + sage: O = K.maximal_order() + sage: P. = ProjectiveSpace(O, 1) + sage: sorted(list(P.points_of_bounded_height(bound=1))) + [(-1 : 1), (-3/2*a - 1/2 : 1), (3/2*a - 1/2 : 1), (0 : 1), + (-3/2*a + 1/2 : 0), (-3/2*a + 1/2 : 1), (3/2*a + 1/2 : 1), (1 : 1)] + + :: + + sage: # needs sage.geometry.polyhedron sage.libs.pari sage.rings.number_field + sage: R. = QQ[] + sage: K. = NumberField(x^2 - 2) + sage: R2. = K[] + sage: L. = K.extension(y^2 - 3) + sage: P. = ProjectiveSpace(L, 1) + sage: len(list(P.points_of_bounded_height(bound=2))) + 256 """ if bound < 1: return iter([]) diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index bb0a8c82ff9..2e14c997dc7 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -114,11 +114,11 @@ class SchemeMorphism_polynomial_projective_space(SchemeMorphism_polynomial): 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) # needs sage.schemes - sage: E = Curve(g) # needs sage.schemes - sage: xbar,ybar,zbar = C.coordinate_ring().gens() # needs sage.schemes - sage: H = C.Hom(E) # needs sage.schemes - sage: H([zbar, xbar - ybar, -(xbar+ybar)/80]) # needs sage.schemes + 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]) 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 @@ -528,11 +528,11 @@ def __eq__(self, right): sage: # needs sage.rings.real_mpfr sage: P. = ProjectiveSpace(QQ, 1) - sage: P2. = ProjectiveSpace(CC, 1) # needs sage.rings.real_mpfr + sage: P2. = ProjectiveSpace(CC, 1) sage: H = End(P) - sage: H2 = End(P2) # needs sage.rings.real_mpfr + sage: H2 = End(P2) sage: f = H([x^2 - 2*x*y, y^2]) - sage: g = H2([u^2 - 2*u*v, v^2]) # needs sage.rings.real_mpfr + sage: g = H2([u^2 - 2*u*v, v^2]) sage: f == g False @@ -873,11 +873,11 @@ def normalize_coordinates(self, **kwds): sage: # needs sage.rings.number_field sage: R. = PolynomialRing(ZZ) - sage: K. = NumberField(t^3 - 11) # needs sage.rings.number_field + sage: K. = NumberField(t^3 - 11) sage: a = 7/(b - 1) - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([a*y^2 - (a*y - x)^2, y^2]) # needs sage.rings.number_field - sage: f.normalize_coordinates(); f # needs sage.rings.number_field + 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 Defn: Defined on coordinates by sending (x : y) to @@ -896,12 +896,12 @@ def normalize_coordinates(self, **kwds): sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(w^2 + 1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(A, 2) # needs sage.rings.number_field + 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]) # needs sage.rings.number_field - sage: f.normalize_coordinates(ideal=A.prime_above(2)); f # needs sage.rings.number_field + 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 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 Defn: Defined on coordinates by sending (x : y : z) to @@ -929,7 +929,7 @@ def normalize_coordinates(self, **kwds): sage: R. = QQ[] sage: K. = NumberField(3*x^2 + 1) # needs sage.rings.number_field sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([a*(z^2 + w^2), z*w]) + sage: f = DynamicalSystem_projective([a*(z^2 + w^2), z*w]) # needs sage.rings.number_field sage: f.normalize_coordinates(); f Dynamical System of Projective Space of dimension 1 over Number Field in a with defining polynomial 3*x^2 + 1 @@ -1353,12 +1353,12 @@ def global_height(self, prec=None): sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field - sage: O = K.maximal_order() # needs sage.rings.number_field - sage: P. = ProjectiveSpace(O, 1) # needs sage.rings.number_field + 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]) # needs sage.rings.number_field - sage: f.global_height() # needs sage.rings.number_field + sage: f = H([2*x^2 + 3*O(w)*y^2, O(w)*y^2]) + sage: f.global_height() 1.09861228866811 :: @@ -1461,11 +1461,11 @@ def local_height(self, v, prec=None): sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + 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]) # needs sage.rings.number_field - sage: f.local_height(K.ideal(3)) # needs sage.rings.number_field + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) + sage: f.local_height(K.ideal(3)) 1.09861228866811 """ K = FractionField(self.domain().base_ring()) @@ -1509,11 +1509,11 @@ def local_height_arch(self, i, prec=None): sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + 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]) # needs sage.rings.number_field - sage: f.local_height_arch(1) # needs sage.rings.number_field + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) + sage: f.local_height_arch(1) 0.6931471805599453094172321214582 """ K = FractionField(self.domain().base_ring()) @@ -1537,11 +1537,11 @@ def wronskian_ideal(self): sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2 + 11) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: H = End(P) # needs sage.rings.number_field - sage: f = H([x^2 - w*y^2, w*y^2]) # needs sage.rings.number_field - sage: f.wronskian_ideal() # needs sage.rings.number_field + 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() Ideal ((4*w)*x*y) of Multivariate Polynomial Ring in x, y over Number Field in w with defining polynomial x^2 + 11 @@ -1549,10 +1549,10 @@ def wronskian_ideal(self): sage: # needs sage.rings.number_field sage: P. = ProjectiveSpace(QQ, 1) - sage: P2. = ProjectiveSpace(K, 2) # needs sage.rings.number_field - sage: H = Hom(P, P2) # needs sage.rings.number_field - sage: f = H([x^2 - 2*y^2, y^2, x*y]) # needs sage.rings.number_field - sage: f.wronskian_ideal() # needs sage.rings.number_field + sage: P2. = ProjectiveSpace(K, 2) + 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 """ @@ -1639,23 +1639,23 @@ def rational_preimages(self, Q, k=1): sage: # needs sage.rings.number_field sage: z = QQ['z'].0 - sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + 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)) # needs sage.libs.singular sage.rings.number_field + sage: f.rational_preimages(P(3, 1)) # needs sage.libs.singular [(-a : 1), (a : 1)] :: sage: # needs sage.rings.number_field sage: z = QQ['z'].0 - sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field - sage: X = P.subscheme([x^2 - z^2]) # needs sage.rings.number_field - sage: H = End(X) # needs sage.rings.number_field - sage: f= H([x^2 - z^2, a*y^2, z^2 - x^2]) # needs sage.rings.number_field - sage: f.rational_preimages(X([1, 2, -1])) # needs sage.libs.singular sage.rings.number_field + 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])) # needs sage.libs.singular [] :: @@ -1748,10 +1748,10 @@ def _number_field_from_algebraics(self): sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field - sage: H = End(P) # needs sage.rings.number_field - sage: f = H([QQbar(3^(1/3))*x^2 + QQbar(sqrt(-2))*y^2, y^2]) # needs sage.rings.number_field sage.symbolic - sage: f._number_field_from_algebraics() # needs sage.rings.number_field sage.symbolic + 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]) # needs sage.symbolic + sage: f._number_field_from_algebraics() # needs sage.symbolic 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 @@ -1782,16 +1782,16 @@ def _number_field_from_algebraics(self): sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: s = (t^3 + t + 1).roots(QQbar)[0][0] # needs sage.rings.number_field - sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field - sage: H = Hom(P, P) # needs sage.rings.number_field - sage: f = H([s*x^3 - 13*y^3, y^3 - 15*y^3]) # needs sage.rings.number_field - sage: f # needs sage.rings.number_field + 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 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() # needs sage.rings.number_field - sage: f_alg.change_ring(QQbar) # Used to fail # needs sage.rings.number_field + sage: f_alg = f._number_field_from_algebraics() + sage: f_alg.change_ring(QQbar) # Used to fail 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) @@ -2022,10 +2022,10 @@ def indeterminacy_points(self, F=None, base=False): sage: # needs sage.rings.padics sage: set_verbose(None) - sage: P. = ProjectiveSpace(Qp(3), 2) # needs sage.rings.padics + 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) # needs sage.libs.singular sage.rings.padics + sage: f.indeterminacy_points(base=True) # needs sage.libs.singular [(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 @@ -2110,17 +2110,17 @@ def reduce_base_field(self): sage: # needs sage.rings.finite_rings sage: K. = GF(5) - sage: L = K.algebraic_closure() # needs sage.rings.finite_rings - sage: P. = ProjectiveSpace(L, 1) # needs sage.rings.finite_rings - sage: H = End(P) # needs sage.rings.finite_rings - sage: f = H([(L.gen(2))*x^2 + L.gen(4)*y^2, x*y]) # needs sage.rings.finite_rings - sage: f.reduce_base_field() # needs sage.rings.finite_rings + 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 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]) # needs sage.rings.finite_rings - sage: f.reduce_base_field() # needs sage.rings.finite_rings + 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 Defn: Defined on coordinates by sending (x : y) to @@ -2308,13 +2308,13 @@ def __call__(self, x): sage: # needs sage.schemes sage: R. = QQ[] - sage: C = Curve(7*x^2 + 2*y*z + z^2) # needs sage.schemes - sage: f, g = C.parametrization() # needs sage.schemes - sage: g([0, -1, 2]) # needs sage.schemes + sage: C = Curve(7*x^2 + 2*y*z + z^2) + sage: f, g = C.parametrization() + sage: g([0, -1, 2]) (1 : 0) - sage: f([1, 0]) # needs sage.schemes + sage: f([1, 0]) (0 : -1/2 : 1) - sage: _ == C([0, -1, 2]) # needs sage.schemes + sage: _ == C([0, -1, 2]) True """ try: diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index c06f45ccc31..3a852c3af37 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -1072,15 +1072,15 @@ def intersection_multiplicity(self, X, P): sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(a^4 + 1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 3) # needs sage.rings.number_field - sage: X = P.subscheme([x^2 + y^2 - z*w]) # needs sage.rings.number_field - sage: Y = P.subscheme([y*z - x*w, z - w]) # needs sage.rings.number_field - sage: Q1 = P([b^2,1,0,0]) # needs sage.rings.number_field - sage: X.intersection_multiplicity(Y, Q1) # needs sage.libs.singular sage.rings.number_field + 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) # needs sage.libs.singular 1 - sage: Q2 = P([1/2*b^3 - 1/2*b, 1/2*b^3 - 1/2*b, 1, 1]) # needs sage.rings.number_field - sage: X.intersection_multiplicity(Y, Q2) # needs sage.libs.singular sage.rings.number_field + 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) # needs sage.libs.singular 1 :: From 152a7bd67b3aa62e3f91b4f30c37a97ca223bb57 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 13 Aug 2023 12:31:51 -0700 Subject: [PATCH 046/423] sage --fixdoctests --no-test --- src/sage/schemes/elliptic_curves/ell_point.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py index b9ae1d8c93d..79f7053bc96 100644 --- a/src/sage/schemes/elliptic_curves/ell_point.py +++ b/src/sage/schemes/elliptic_curves/ell_point.py @@ -1232,9 +1232,9 @@ def set_order(self, value=None, *, multiple=None, check=True): sage: G.set_order(2) sage: 2*G (0 : 1 : 0) - sage: G = E(0, 6) # optional - sage.rings.finite_rings - sage: G.set_order(multiple=12) # optional - sage.rings.finite_rings - sage: G._order # optional - sage.rings.finite_rings + sage: G = E(0, 6) + sage: G.set_order(multiple=12) + sage: G._order 3 We now give a more interesting case, the NIST-P521 curve. Its From fef539e63d47456a539773c0e85718388daee704 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 17 Aug 2023 19:15:06 -0700 Subject: [PATCH 047/423] sage.schemes: Use more block tags --- src/sage/schemes/affine/affine_space.py | 7 +- src/sage/schemes/affine/affine_subscheme.py | 2 +- .../schemes/berkovich/berkovich_cp_element.py | 187 +++++++++--------- src/sage/schemes/curves/projective_curve.py | 1 + .../elliptic_curves/descent_two_isogeny.pyx | 4 +- src/sage/schemes/elliptic_curves/ell_field.py | 154 ++++++++------- .../elliptic_curves/ell_finite_field.py | 2 + .../schemes/elliptic_curves/ell_generic.py | 2 +- src/sage/schemes/elliptic_curves/ell_point.py | 4 +- .../elliptic_curves/gal_reps_number_field.py | 2 +- src/sage/schemes/elliptic_curves/gp_simon.py | 1 + .../schemes/elliptic_curves/hom_composite.py | 2 +- .../elliptic_curves/isogeny_small_degree.py | 2 +- .../hyperelliptic_curves/jacobian_morphism.py | 30 +-- src/sage/schemes/plane_conics/con_field.py | 2 +- 15 files changed, 205 insertions(+), 197 deletions(-) diff --git a/src/sage/schemes/affine/affine_space.py b/src/sage/schemes/affine/affine_space.py index dd3bdcaeacd..ac092e578f7 100644 --- a/src/sage/schemes/affine/affine_space.py +++ b/src/sage/schemes/affine/affine_space.py @@ -1164,15 +1164,16 @@ def line_through(self, p, q): EXAMPLES:: + sage: # needs sage.libs.singular sage.schemes sage: A3. = AffineSpace(3, QQ) sage: p1 = A3(1, 2, 3) sage: p2 = A3(4, 5, 6) - sage: L = A3.line_through(p1, p2); L # needs sage.schemes + sage: L = A3.line_through(p1, p2); L 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 - sage: L(p1) # needs sage.schemes + sage: L(p1) (1, 2, 3) - sage: L(p2) # needs sage.schemes + sage: L(p2) (4, 5, 6) sage: A3.line_through(p1, p1) Traceback (most recent call last): diff --git a/src/sage/schemes/affine/affine_subscheme.py b/src/sage/schemes/affine/affine_subscheme.py index ae506500d38..838aad612f4 100644 --- a/src/sage/schemes/affine/affine_subscheme.py +++ b/src/sage/schemes/affine/affine_subscheme.py @@ -456,7 +456,7 @@ 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]) # needs sage.schemes + sage: C = A.curve([x^8 - y, y^7 - z, z^3 - 1, w^5 - v^3]) # needs sage.libs.singular sage.schemes sage: Q = A([22,1,1,0,0]) sage: C.multiplicity(Q) # needs sage.libs.singular sage.schemes 3 diff --git a/src/sage/schemes/berkovich/berkovich_cp_element.py b/src/sage/schemes/berkovich/berkovich_cp_element.py index a0acee09194..37004b35cc5 100644 --- a/src/sage/schemes/berkovich/berkovich_cp_element.py +++ b/src/sage/schemes/berkovich/berkovich_cp_element.py @@ -426,9 +426,10 @@ def _custom_abs(self, x): :: - sage: B = Berkovich_Cp_Affine(Qp(3)) # needs sage.rings.padics - sage: Q1 = B(9) # needs sage.rings.padics - sage: Q1._custom_abs(Q1.center()) # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(Qp(3)) + sage: Q1 = B(9) + sage: Q1._custom_abs(Q1.center()) 1/9 """ if self._base_type == 'padic field': @@ -450,15 +451,16 @@ def center_function(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(5) # needs sage.rings.padics - sage: L. = PolynomialRing(Qp(5)) # needs sage.rings.padics - sage: T = FractionField(L) # needs sage.rings.padics - sage: f = T(1/t) # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(5) + 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 # needs sage.symbolic - sage: Q1 = B(f, g) # needs sage.rings.padics sage.symbolic - sage: Q1.center_function() # needs sage.rings.padics sage.symbolic + sage: Q1 = B(f, g) # needs sage.symbolic + sage: Q1.center_function() # needs sage.symbolic (1 + O(5^20))/((1 + O(5^20))*t) """ if self.type_of_point() != 4: @@ -478,15 +480,16 @@ def radius_function(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(5) # needs sage.rings.padics - sage: L. = PolynomialRing(Qp(5)) # needs sage.rings.padics - sage: T = FractionField(L) # needs sage.rings.padics - sage: f = T(1/t) # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(5) + 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 # needs sage.symbolic - sage: Q1 = B(f, g) # needs sage.rings.padics sage.symbolic - sage: Q1.radius_function() # needs sage.rings.padics sage.symbolic + sage: Q1 = B(f, g) # needs sage.symbolic + sage: Q1.radius_function() # needs sage.symbolic 40.0000000000000*pi/x """ if self.type_of_point() != 4: @@ -951,13 +954,14 @@ def Hsia_kernel_infinity(self, other): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field - sage: ideal = A.ideal(-1/2*a^2 + a - 3) # needs sage.rings.number_field - sage: B = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field - sage: Q1 = B(4) # needs sage.rings.number_field - sage: Q2 = B(0, 1.5) # needs sage.rings.number_field - sage: Q1.Hsia_kernel_infinity(Q2) # needs sage.rings.number_field + 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) 1.50000000000000 """ return self.join(other).diameter() @@ -983,11 +987,12 @@ def center(self): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field - sage: ideal = A.ideal(-1/2*a^2 + a - 3) # needs sage.rings.number_field - sage: B = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field - sage: B(a^2 + 4).center() # needs sage.rings.number_field + 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() (a^2 + 4 : 1) """ if self._type == 4: @@ -1033,11 +1038,11 @@ def __ne__(self, other): EXAMPLES:: - sage: # needs sage.rings.padics + sage: # needs sage.rings.padics sage.symbolic sage: B = Berkovich_Cp_Affine(3) - sage: Q1 = B(3, 3**(1/2)) # needs sage.symbolic - sage: Q2 = B(3, RR(3**(1/2))) # needs sage.symbolic - sage: Q1 != Q2 # needs sage.symbolic + sage: Q1 = B(3, 3**(1/2)) + sage: Q2 = B(3, RR(3**(1/2))) + sage: Q1 != Q2 False """ return not (self == other) @@ -1202,11 +1207,12 @@ class Berkovich_Element_Cp_Affine(Berkovich_Element_Cp): When creating a Berkovich space backed by a number field, points can be created similarly:: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field - sage: ideal = A.prime_above(3) # needs sage.rings.number_field - sage: B = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field - sage: Q1 = B(a); Q1 # needs sage.rings.number_field + sage: A. = NumberField(x^3 + 20) + sage: ideal = A.prime_above(3) + sage: B = Berkovich_Cp_Projective(A, ideal) + sage: Q1 = B(a); Q1 Type I point centered at (a : 1) :: @@ -1216,40 +1222,31 @@ class Berkovich_Element_Cp_Affine(Berkovich_Element_Cp): TESTS:: - sage: A = Berkovich_Cp_Affine(3) # needs sage.rings.padics - sage: Q1 = A(3, 1); Q1 # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: A = Berkovich_Cp_Affine(3) + sage: Q1 = A(3, 1); Q1 Type II point centered at 3 + O(3^21) of radius 3^0 - - sage: Q2 = A(2.5, 1); Q2 # needs sage.rings.padics + sage: Q2 = A(2.5, 1); Q2 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 # needs sage.rings.padics + sage: Q5 = A(3, 0); Q5 Type I point centered at 3 + O(3^21) - - sage: A(Zp(3)(2), 2).center().parent() == A(Qp(3)(2), 2).center().parent() # needs sage.rings.padics + sage: A(Zp(3)(2), 2).center().parent() == A(Qp(3)(2), 2).center().parent() True - - sage: Q1 == Q2 # needs sage.rings.padics + sage: Q1 == Q2 True - - sage: Q1 == Q5 # needs sage.rings.padics + sage: Q1 == Q5 False - - sage: Q3 = A(Qp(3)(3), power=0, error_check=False); Q3 # needs sage.rings.padics + sage: Q3 = A(Qp(3)(3), power=0, error_check=False); Q3 Type II point centered at 3 + O(3^21) of radius 3^0 - - sage: Q4 = A(3, 3**0); Q4 # needs sage.rings.padics + sage: Q4 = A(3, 3**0); Q4 Type II point centered at 3 + O(3^21) of radius 3^0 - - sage: Q5 = A(3, power=1/2); Q5 # needs sage.rings.padics + sage: Q5 = A(3, power=1/2); Q5 Type II point centered at 3 + O(3^21) of radius 3^1/2 - - sage: Q6 = A(3, RR(3**(1/2))); Q6 # needs sage.rings.padics sage.symbolic + sage: Q6 = A(3, RR(3**(1/2))); Q6 # needs sage.symbolic Type III point centered at 3 + O(3^21) of radius 1.73205080756888 - - sage: Q5 == Q6 # needs sage.rings.padics sage.symbolic + sage: Q5 == Q6 # needs sage.symbolic True sage: # needs sage.rings.padics @@ -1403,13 +1400,14 @@ def __hash__(self): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field - sage: ideal = A.ideal(-1/2*a^2 + a - 3) # needs sage.rings.number_field - sage: B = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field - sage: Q1 = B(a^2 + 1, 2) # needs sage.rings.number_field - sage: Q2 = B(0, 2) # needs sage.rings.number_field - sage: hash(Q1) == hash(Q2) # needs sage.rings.number_field + 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) True """ if self.type_of_point() == 1: @@ -1885,13 +1883,14 @@ 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)) # needs sage.rings.padics - sage: T = FractionField(L) # needs sage.rings.padics - sage: f = T(1/t) # needs sage.rings.padics + sage: # needs sage.rings.padics + 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 # needs sage.rings.padics sage.symbolic - sage: Q6 = P(f, g); Q6 # needs sage.rings.padics sage.symbolic + sage: g = (40*pi)/x # needs sage.symbolic + sage: Q6 = P(f, g); Q6 # needs 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 @@ -2056,13 +2055,14 @@ def __hash__(self): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field - sage: ideal = A.ideal(-1/2*a^2 + a - 3) # needs sage.rings.number_field - sage: B = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field - sage: Q1 = B(a^2 + 1, 2) # needs sage.rings.number_field - sage: Q2 = B(0, 2) # needs sage.rings.number_field - sage: hash(Q1) == hash(Q2) # needs sage.rings.number_field + 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) True """ if self.type_of_point() == 1: @@ -2294,39 +2294,36 @@ def join(self, other, basepoint=Infinity): TESTS:: - sage: Q4 = B(1/3**8 + 2, 1) # needs sage.rings.padics - sage: Q2.join(Q4, basepoint=Q1) # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: Q4 = B(1/3**8 + 2, 1) + sage: Q2.join(Q4, basepoint=Q1) Type III point centered at (2 + O(3^20) : 1 + O(3^20)) of radius 2.00000000000000 - - sage: Q5 = B(2, 1/9) # needs sage.rings.padics - sage: Q6 = B(1, 1/27) # needs sage.rings.padics - sage: Q4.join(Q5, basepoint=Q6) # needs sage.rings.padics + sage: Q5 = B(2, 1/9) + sage: Q6 = B(1, 1/27) + sage: Q4.join(Q5, basepoint=Q6) Type II point centered at (1 + O(3^20) : 1 + O(3^20)) of radius 3^0 - - sage: Q7 = B(1/27, 1/27) # needs sage.rings.padics - sage: Q1.join(Q7, Q2) # needs sage.rings.padics + sage: Q7 = B(1/27, 1/27) + sage: Q1.join(Q7, Q2) Type III point centered at (2 + O(3^20) : 1 + O(3^20)) of radius 2.00000000000000 - - sage: Q1.join(Q2, Q7) # needs sage.rings.padics + sage: Q1.join(Q2, Q7) Type III point centered at (2 + O(3^20) : 1 + O(3^20)) of radius 2.00000000000000 - - sage: Q8 = B(0, power=1/3) # needs sage.rings.padics - sage: Q9 = B(0, power=1/2) # needs sage.rings.padics - sage: Q8.join(Q9) # needs sage.rings.padics + sage: Q8 = B(0, power=1/3) + sage: Q9 = B(0, power=1/2) + sage: Q8.join(Q9) Type II point centered at (0 : 1 + O(3^20)) of radius 3^1/2 + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field - sage: ideal = A.prime_above(3) # needs sage.rings.number_field - sage: C = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field - sage: Q10 = C(a, 1/9) # needs sage.rings.number_field - sage: Q10.join(Q9) # needs sage.rings.number_field sage.rings.padics + 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) # needs sage.rings.padics Traceback (most recent call last): ... ValueError: other must be a point of the same projective Berkovich line - - sage: Q11 = C(0, 1/3) # needs sage.rings.number_field - sage: Q11.join(Q10) # needs sage.rings.number_field + sage: Q11 = C(0, 1/3) + sage: Q11.join(Q10) Type II point centered at (0 : 1) of radius 3^0 """ if not isinstance(other, Berkovich_Element_Cp_Projective): diff --git a/src/sage/schemes/curves/projective_curve.py b/src/sage/schemes/curves/projective_curve.py index 59058457a3b..a4e0d9406d2 100644 --- a/src/sage/schemes/curves/projective_curve.py +++ b/src/sage/schemes/curves/projective_curve.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.libs.singular r""" Projective curves diff --git a/src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx b/src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx index 432ab02af88..1cc6a8f866b 100644 --- a/src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx +++ b/src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx @@ -1154,11 +1154,11 @@ def two_descent_by_two_isogeny(E, sage: x,y = var('x,y') # needs sage.symbolic sage: E = EllipticCurve(y^2 == x^3 + x^2 - 25*x + 39) # needs sage.symbolic sage: n1, n2, n1_prime, n2_prime = two_descent_by_two_isogeny(E) # needs sage.symbolic - sage: log(n1,2) + log(n1_prime,2) - 2 # the rank # needs sage.symbolic + sage: log(n1,2) + log(n1_prime,2) - 2 # the rank # needs sage.symbolic 2 sage: E = EllipticCurve(y^2 + x*y + y == x^3 - 131*x + 558) # needs sage.symbolic sage: n1, n2, n1_prime, n2_prime = two_descent_by_two_isogeny(E) # needs sage.symbolic - sage: log(n1,2) + log(n1_prime,2) - 2 # the rank # needs sage.symbolic + sage: log(n1,2) + log(n1_prime,2) - 2 # the rank # needs sage.symbolic 3 Using the verbosity option:: diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index de5c2fdfd47..e9e3b51148e 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -335,7 +335,7 @@ def is_quadratic_twist(self, other): INPUT: - - ``other`` -- an elliptic curves with the same base field as self. + - ``other`` -- an elliptic curve with the same base field as ``self``. OUTPUT: @@ -366,7 +366,7 @@ def is_quadratic_twist(self, other): 2 sage: E1.is_quadratic_twist(E1) 1 - sage: type(E1.is_quadratic_twist(E1)) == type(E1.is_quadratic_twist(E2)) #trac 6574 + sage: type(E1.is_quadratic_twist(E1)) == type(E1.is_quadratic_twist(E2)) # Issue #6574 True :: @@ -505,7 +505,6 @@ def is_quartic_twist(self, other): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve_from_j(GF(13)(1728)) sage: E1 = E.quartic_twist(2) sage: D = E.is_quartic_twist(E1); D!=0 @@ -833,17 +832,18 @@ def division_field(self, l, names='t', map=False, **kwds): The 2-division field is the same as the splitting field of the 2-division polynomial (therefore, it has degree 1, 2, 3 or 6):: + sage: # needs sage.rings.number_field sage: E = EllipticCurve('15a1') - sage: K. = E.division_field(2); K # needs sage.rings.number_field + sage: K. = E.division_field(2); K Number Field in b with defining polynomial x sage: E = EllipticCurve('14a1') - sage: K. = E.division_field(2); K # needs sage.rings.number_field + sage: K. = E.division_field(2); K Number Field in b with defining polynomial x^2 + 5*x + 92 sage: E = EllipticCurve('196b1') - sage: K. = E.division_field(2); K # needs sage.rings.number_field + sage: K. = E.division_field(2); K 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 # needs sage.rings.number_field + 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 @@ -851,11 +851,12 @@ def division_field(self, l, names='t', map=False, **kwds): field of the `\ell`-division polynomial, or a quadratic extension of it. :: + sage: # needs sage.rings.number_field sage: E = EllipticCurve('50a1') - sage: F. = E.division_polynomial(3).splitting_field(simplify_all=True); F # needs sage.rings.number_field + 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 # needs sage.rings.number_field + 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 @@ -863,22 +864,24 @@ def division_field(self, l, names='t', map=False, **kwds): 3-division polynomial remains the same, but the 3-division field becomes a quadratic extension:: - sage: E = E.quadratic_twist(5) # 50b3 # needs sage.rings.number_field - sage: F. = E.division_polynomial(3).splitting_field(simplify_all=True); F # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 # needs sage.rings.number_field + 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 Try another quadratic twist, this time over a subfield of `F`:: - sage: G.,_,_ = F.subfields(3)[0] # needs sage.rings.number_field - sage: E = E.base_extend(G).quadratic_twist(c); E # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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 # needs sage.rings.number_field + 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 @@ -916,24 +919,25 @@ def division_field(self, l, names='t', map=False, **kwds): Over a number field:: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: E = EllipticCurve([0,0,0,0,i]) # needs sage.rings.number_field - sage: L. = E.division_field(2); L # needs sage.rings.number_field + sage: K. = NumberField(x^2 + 1) + sage: E = EllipticCurve([0,0,0,0,i]) + sage: L. = E.division_field(2); L Number Field in b with defining polynomial x^4 - x^2 + 1 - sage: L., phi = E.division_field(2, map=True); phi # needs sage.rings.number_field + sage: L., phi = E.division_field(2, map=True); phi 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) # needs sage.rings.number_field - sage: L # needs sage.rings.number_field + 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 # needs sage.rings.number_field + sage: phi Ring morphism: From: Number Field in i with defining polynomial x^2 + 1 To: Number Field in b with defining polynomial x^24 ... @@ -1199,7 +1203,6 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al :: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(19),[1,1]) sage: P = E(15,3); Q = E(2,12) sage: (P.order(), Q.order()) @@ -1244,11 +1247,12 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al :trac:`23222`, the following raised no error but returned an invalid morphism. See also :trac:`11578`:: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(x^2 - x - 1) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [-13392, -1080432]) # needs sage.rings.number_field - sage: R. = K[] # needs sage.rings.number_field - sage: phi = E.isogeny( (x-564)*(x - 396/5*a + 348/5) ) # needs sage.rings.number_field + 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) ) Traceback (most recent call last): ... ValueError: the polynomial x^2 + (-396/5*a - 2472/5)*x + 223344/5*a - 196272/5 does not @@ -1357,7 +1361,7 @@ def isogenies_prime_degree(self, l=None, max_l=31): Examples over finite fields:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.pari sage: E = EllipticCurve(GF(next_prime(1000000)), [7,8]) sage: E.isogenies_prime_degree(2) [Isogeny of degree 2 @@ -1426,10 +1430,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]) # needs sage.rings.finite_rings - sage: E.isogenies_prime_degree(3) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(17), [2,0]) + sage: E.isogenies_prime_degree(3) [] - sage: E.isogenies_prime_degree(2) # needs sage.rings.finite_rings + 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, @@ -1443,7 +1447,6 @@ def isogenies_prime_degree(self, l=None, max_l=31): The base field matters, over a field extension we find more isogenies:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(13), [2,8]) sage: E.isogenies_prime_degree(max_l=3) [Isogeny of degree 2 @@ -1452,6 +1455,8 @@ def isogenies_prime_degree(self, l=None, max_l=31): 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: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(13^6), [2,8]) sage: E.isogenies_prime_degree(max_l=3) [Isogeny of degree 2 @@ -1479,7 +1484,6 @@ def isogenies_prime_degree(self, l=None, max_l=31): If the degree equals the characteristic, we find only separable isogenies:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(13), [2,8]) sage: E.isogenies_prime_degree(13) [Isogeny of degree 13 @@ -1490,6 +1494,8 @@ def isogenies_prime_degree(self, l=None, max_l=31): [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: # needs sage.rings.finite_rings sage: k. = GF(3^4) sage: E = EllipticCurve(k, [0,1,0,0,a]) sage: E.isogenies_prime_degree(3) @@ -1521,10 +1527,11 @@ def isogenies_prime_degree(self, l=None, max_l=31): Examples over number fields (other than QQ):: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: QQroot2. = NumberField(x^2 - 2) # needs sage.rings.number_field - sage: E = EllipticCurve(QQroot2, j=8000) # needs sage.rings.number_field - sage: E.isogenies_prime_degree() # needs sage.rings.number_field + 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 @@ -1540,17 +1547,16 @@ def isogenies_prime_degree(self, l=None, max_l=31): 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 # needs sage.rings.number_field + 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) # needs sage.rings.number_field + 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] - sage: E.isogenies_prime_degree(3) # needs sage.rings.number_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 Number Field in e with defining polynomial x^2 - 2 @@ -1818,17 +1824,17 @@ class of curves. If the j-invariant is not unique in the isogeny Ordinary curve over finite extension field of degree 2:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.graphs sage.rings.finite_rings sage: x = polygen(ZZ, 'x') 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); G # needs sage.graphs + sage: G = E.isogeny_ell_graph(5, directed=False, label_by_j=True); G Graph on 20 vertices - sage: G.vertices(sort=True) # needs sage.graphs + sage: G.vertices(sort=True) ['1', '12', ... 'i + 55'] - sage: G.edges(sort=True) # needs sage.graphs + sage: G.edges(sort=True) [('1', '28*i + 11', None), ('1', '31*i + 11', None), ... @@ -1836,25 +1842,25 @@ class of curves. If the j-invariant is not unique in the isogeny Supersingular curve over prime field:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.graphs sage.rings.finite_rings sage: E = EllipticCurve(GF(419), j=1728) - sage: G3 = E.isogeny_ell_graph(3, directed=False, label_by_j=True); G3 # needs sage.graphs + sage: G3 = E.isogeny_ell_graph(3, directed=False, label_by_j=True); G3 Graph on 27 vertices - sage: G3.vertices(sort=True) # needs sage.graphs + sage: G3.vertices(sort=True) ['0', '0*', ... '98*'] - sage: G3.edges(sort=True) # needs sage.graphs + sage: G3.edges(sort=True) [('0', '0*', None), ('0', '13', None), ... ('48*', '98*', None)] - sage: G5 = E.isogeny_ell_graph(5, directed=False, label_by_j=True); G5 # needs sage.graphs + sage: G5 = E.isogeny_ell_graph(5, directed=False, label_by_j=True); G5 Graph on 9 vertices - sage: G5.vertices(sort=True) # needs sage.graphs + sage: G5.vertices(sort=True) ['13', '13*', '407', '407*', '52', '62', '62*', '98', '98*'] - sage: G5.edges(sort=True) # needs sage.graphs + sage: G5.edges(sort=True) [('13', '52', None), ('13', '98', None), ... @@ -1862,31 +1868,31 @@ class of curves. If the j-invariant is not unique in the isogeny Supersingular curve over finite extension field of degree 2:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.graphs sage.rings.finite_rings sage: K = GF(431^2, "i", x^2 + 1) sage: E = EllipticCurve(K, j=0) sage: E.is_supersingular() True - sage: G = E.isogeny_ell_graph(2, directed=True, label_by_j=True); G # needs sage.graphs + sage: G = E.isogeny_ell_graph(2, directed=True, label_by_j=True); G Looped multi-digraph on 37 vertices - sage: G.vertices(sort=True) # needs sage.graphs + sage: G.vertices(sort=True) ['0', '102', ... '87*i + 190'] - sage: G.edges(sort=True) # needs sage.graphs + sage: G.edges(sort=True) [('0', '125', None), ('0', '125', None), ... '81*i + 65', None)] - sage: H = E.isogeny_ell_graph(2, directed=False, label_by_j=True); H # needs sage.graphs + sage: H = E.isogeny_ell_graph(2, directed=False, label_by_j=True); H Looped multi-graph on 37 vertices - sage: H.vertices(sort=True) # needs sage.graphs + sage: H.vertices(sort=True) ['0', '102', ... '87*i + 190'] - sage: H.edges(sort=True) # needs sage.graphs + sage: H.edges(sort=True) [('0', '125', None), ('102', '125', None), ... @@ -1894,28 +1900,28 @@ class of curves. If the j-invariant is not unique in the isogeny Curve over a quadratic number field:: - sage: # needs sage.rings.number_field + sage: # needs sage.graphs sage.rings.finite_rings sage.rings.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) # needs sage.graphs - sage: G2.vertices(sort=True) # needs sage.graphs + sage: G2 = E.isogeny_ell_graph(2, directed=False) + sage: G2.vertices(sort=True) ['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) # needs sage.graphs + sage: G2.edges(sort=True) [('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) # needs sage.graphs - sage: G3.vertices(sort=True) # needs sage.graphs + sage: G3 = E.isogeny_ell_graph(3, directed=False) + sage: G3.vertices(sort=True) ['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) # needs sage.graphs + sage: G3.edges(sort=True) [('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)', @@ -1923,22 +1929,22 @@ class of curves. If the j-invariant is not unique in the isogeny TESTS:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.graphs sage.rings.finite_rings sage: E = EllipticCurve(GF(11), j=0) - sage: G0 = E.isogeny_ell_graph(2, directed=False) # needs sage.graphs - sage: G0.is_directed() # needs sage.graphs + sage: G0 = E.isogeny_ell_graph(2, directed=False) + sage: G0.is_directed() False - sage: G1 = E.isogeny_ell_graph(2, directed=True) # needs sage.graphs - sage: G1.is_directed() # needs sage.graphs + sage: G1 = E.isogeny_ell_graph(2, directed=True) + sage: G1.is_directed() True - sage: G2 = E.isogeny_ell_graph(2, label_by_j=False) # needs sage.graphs - sage: G2.vertices(sort=True) # needs sage.graphs + sage: G2 = E.isogeny_ell_graph(2, label_by_j=False) + sage: G2.vertices(sort=True) ['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) # needs sage.graphs - sage: G3.vertices(sort=True) # needs sage.graphs + sage: G3 = E.isogeny_ell_graph(2, label_by_j=True) + sage: G3.vertices(sort=True) ['0', '0*', '1', '1*'] """ diff --git a/src/sage/schemes/elliptic_curves/ell_finite_field.py b/src/sage/schemes/elliptic_curves/ell_finite_field.py index f3ef8eefb47..af71b5a72f1 100644 --- a/src/sage/schemes/elliptic_curves/ell_finite_field.py +++ b/src/sage/schemes/elliptic_curves/ell_finite_field.py @@ -55,6 +55,7 @@ class EllipticCurve_finite_field(EllipticCurve_field, HyperellipticCurve_finite_ sage: EllipticCurve(GF(101),[2,3]) Elliptic Curve defined by y^2 = x^3 + 2*x + 3 over Finite Field of size 101 + sage: # needs sage.rings.finite_rings sage: F = GF(101^2, 'a') sage: EllipticCurve([F(2),F(3)]) Elliptic Curve defined by y^2 = x^3 + 2*x + 3 over Finite Field in a of size 101^2 @@ -135,6 +136,7 @@ def _points_via_group_structure(self): :: + sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(4,'a'),[0, 0, 1, 0, 1]) sage: E.points() [(0 : 1 : 0), (0 : a : 1), (0 : a + 1 : 1), (1 : 0 : 1), (1 : 1 : 1), (a : 0 : 1), (a : 1 : 1), (a + 1 : 0 : 1), (a + 1 : 1 : 1)] diff --git a/src/sage/schemes/elliptic_curves/ell_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py index 7afc98429c5..a15399d5a82 100644 --- a/src/sage/schemes/elliptic_curves/ell_generic.py +++ b/src/sage/schemes/elliptic_curves/ell_generic.py @@ -3589,7 +3589,7 @@ def pari_curve(self): PARI no longer requires that the `j`-invariant has negative `p`-adic valuation:: sage: E = EllipticCurve(Qp,[1, 1]) # needs sage.libs.pari sage.rings.padics - sage: E.j_invariant() # the j-invariant is a p-adic integer # needs sage.libs.pari sage.rings.padics + sage: E.j_invariant() # the j-invariant is a p-adic integer # needs sage.libs.pari sage.rings.padics 2 + 4*5^2 + O(5^3) sage: E.pari_curve() # needs sage.libs.pari sage.rings.padics [0, 0, 0, 1, 1, 0, 2, 4, -1, -48, -864, -496, 6912/31, diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py index 79f7053bc96..4002388fefe 100644 --- a/src/sage/schemes/elliptic_curves/ell_point.py +++ b/src/sage/schemes/elliptic_curves/ell_point.py @@ -3955,7 +3955,7 @@ def order(self): sage: E.j_invariant() # needs sage.rings.finite_rings 0 sage: P = E.random_point() # needs sage.rings.finite_rings - sage: P.order() # random # needs sage.rings.finite_rings + sage: P.order() # random # needs sage.rings.finite_rings 16777251 Similarly when `j(E)=1728`:: @@ -3966,7 +3966,7 @@ def order(self): sage: E.j_invariant() # needs sage.rings.finite_rings 1728 sage: P = E.random_point() # needs sage.rings.finite_rings - sage: P.order() # random # needs sage.rings.finite_rings + sage: P.order() # random # needs sage.rings.finite_rings 46912611635760 TESTS: 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 06fa51c9050..e257b511371 100644 --- a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py +++ b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.rings.number_field r""" Galois representations for elliptic curves over number fields diff --git a/src/sage/schemes/elliptic_curves/gp_simon.py b/src/sage/schemes/elliptic_curves/gp_simon.py index 34418ad1025..5a62c5cc445 100644 --- a/src/sage/schemes/elliptic_curves/gp_simon.py +++ b/src/sage/schemes/elliptic_curves/gp_simon.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.libs.pari """ Denis Simon's PARI scripts """ diff --git a/src/sage/schemes/elliptic_curves/hom_composite.py b/src/sage/schemes/elliptic_curves/hom_composite.py index c4da8dacf1c..0ab6dc6c407 100644 --- a/src/sage/schemes/elliptic_curves/hom_composite.py +++ b/src/sage/schemes/elliptic_curves/hom_composite.py @@ -684,7 +684,7 @@ def _comparison_impl(left, right, op): sage: phi2 = EllipticCurveHom_composite(phi1.codomain(), phi1(Q)) # needs sage.rings.number_field sage: psi1 = EllipticCurveHom_composite(E, Q) # needs sage.rings.number_field sage: psi2 = EllipticCurveHom_composite(psi1.codomain(), psi1(P)) # needs sage.rings.number_field - sage: phi2 * phi1 == psi2 * psi1 + sage: phi2 * phi1 == psi2 * psi1 # needs sage.rings.number_field True """ if op != op_EQ: diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py index 2838e8e2e8a..b2b2c617de8 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py @@ -2788,7 +2788,7 @@ def isogenies_prime_degree(E, l, minimal_models=True): generic code must be used:: sage: E = EllipticCurve(GF(101), [-3440, 77658]) # needs sage.rings.finite_rings - sage: E.isogenies_prime_degree(71) # fast # needs sage.rings.finite_rings + sage: E.isogenies_prime_degree(71) # fast # needs sage.rings.finite_rings [] sage: E.isogenies_prime_degree(73) # long time # needs sage.rings.finite_rings [] diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py b/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py index 4286506727a..b73774b8904 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py @@ -299,7 +299,7 @@ def cantor_composition(D1,D2,f,h,genus): sage: Q = J(H.lift_x(F(a+1))); Q # needs sage.rings.finite_rings (x + 6*a + 6, y + 2*a) - sage: 7*8297*Q # indirect doctest # needs sage.rings.finite_rings + sage: 7*8297*Q # indirect doctest # needs sage.rings.finite_rings (1) A test over a prime field: @@ -385,7 +385,7 @@ def __init__(self, parent, polys, check=True): :: - sage: P1 = J(H.lift_x(2)); P1 # indirect doctest # needs sage.rings.finite_rings + sage: P1 = J(H.lift_x(2)); P1 # indirect doctest # needs sage.rings.finite_rings (x + 35, y + 26) sage: P1.parent() # needs sage.rings.finite_rings Set of rational points of Jacobian of Hyperelliptic Curve over @@ -422,7 +422,7 @@ def _printing_polys(self): :: - sage: Q = J(H.lift_x(F(1))); Q # indirect doctest # needs sage.rings.finite_rings + sage: Q = J(H.lift_x(F(1))); Q # indirect doctest # needs sage.rings.finite_rings (x + 6, y + 2*a + 2) """ a, b = self.__polys @@ -446,11 +446,11 @@ def _repr_(self): :: - sage: Q = J(0); Q # indirect doctest # needs sage.rings.finite_rings + sage: Q = J(0); Q # indirect doctest # needs sage.rings.finite_rings (1) - sage: Q = J(H.lift_x(F(1))); Q # indirect doctest # needs sage.rings.finite_rings + sage: Q = J(H.lift_x(F(1))); Q # indirect doctest # needs sage.rings.finite_rings (x + 6, y + 2*a + 2) - sage: Q + Q # indirect doctest # needs sage.rings.finite_rings + sage: Q + Q # indirect doctest # needs sage.rings.finite_rings (x^2 + 5*x + 1, y + 3*a*x + 6*a + 2) """ if self.is_zero(): @@ -473,9 +473,9 @@ def _latex_(self): :: - sage: Q = J(0); print(latex(Q)) # indirect doctest # needs sage.rings.finite_rings + sage: Q = J(0); print(latex(Q)) # indirect doctest # needs sage.rings.finite_rings \left(1\right) - sage: Q = J(H.lift_x(F(1))); print(latex(Q)) # indirect doctest # needs sage.rings.finite_rings + sage: Q = J(H.lift_x(F(1))); print(latex(Q)) # indirect doctest # needs sage.rings.finite_rings \left(x + 6, y + 2 \alpha + 2\right) :: @@ -670,9 +670,9 @@ def __bool__(self): sage: P1 = J(H.lift_x(2)); P1 # needs sage.rings.finite_rings (x + 35, y + 26) - sage: P1 == 0 # indirect doctest # needs sage.rings.finite_rings + sage: P1 == 0 # indirect doctest # needs sage.rings.finite_rings False - sage: P1 - P1 == 0 # indirect doctest # needs sage.rings.finite_rings + sage: P1 - P1 == 0 # indirect doctest # needs sage.rings.finite_rings True """ return self.__polys[0] != 1 @@ -756,7 +756,7 @@ def _add_(self,other): sage: P1 = J(H.lift_x(2)); P1 # needs sage.rings.finite_rings (x + 35, y + 26) - sage: P1 + P1 # indirect doctest # needs sage.rings.finite_rings + sage: P1 + P1 # indirect doctest # needs sage.rings.finite_rings (x^2 + 33*x + 4, y + 13*x) """ X = self.parent() @@ -787,7 +787,7 @@ def _sub_(self, other): sage: P1 = J(H.lift_x(2)); P1 # needs sage.rings.finite_rings (x + 35, y + 26) - sage: P1 - P1 # indirect doctest # needs sage.rings.finite_rings + sage: P1 - P1 # indirect doctest # needs sage.rings.finite_rings (1) :: @@ -798,11 +798,11 @@ def _sub_(self, other): Observe that the `x`-coordinates are the same but the `y`-coordinates differ:: - sage: P1 - P2 # indirect doctest # needs sage.rings.finite_rings + sage: P1 - P2 # indirect doctest # needs sage.rings.finite_rings (x^2 + 31*x + 8, y + 7*x + 12) - sage: P1 + P2 # indirect doctest # needs sage.rings.finite_rings + sage: P1 + P2 # indirect doctest # needs sage.rings.finite_rings (x^2 + 31*x + 8, y + 4*x + 18) - sage: (P1 - P2) - (P1 + P2) + 2*P2 # indirect doctest # needs sage.rings.finite_rings + sage: (P1 - P2) - (P1 + P2) + 2*P2 # indirect doctest # needs sage.rings.finite_rings (1) """ return self + (-other) diff --git a/src/sage/schemes/plane_conics/con_field.py b/src/sage/schemes/plane_conics/con_field.py index 5ac081d5df8..5675a062147 100644 --- a/src/sage/schemes/plane_conics/con_field.py +++ b/src/sage/schemes/plane_conics/con_field.py @@ -1086,7 +1086,7 @@ def rational_point(self, algorithm='default', read_cache=True): sage: K. = QuadraticField(-1) # needs sage.rings.number_field sage: D = Conic(K, [3, 2, 5]) # needs sage.rings.number_field - sage: D.rational_point(algorithm = 'rnfisnorm') # output is random # needs sage.rings.number_field + sage: D.rational_point(algorithm = 'rnfisnorm') # output is random # needs sage.rings.number_field (-3 : 4*i : 1) sage: # needs sage.rings.number_field From f4b2a48379243f1dc5171e37ece07ee1f57c0a49 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 17 Aug 2023 21:08:36 -0700 Subject: [PATCH 048/423] sage.schemes: Remove many unnecessary # needs - sage.rings.finite_rings; other # needs updates --- src/sage/schemes/affine/affine_morphism.py | 2 +- src/sage/schemes/curves/affine_curve.py | 24 ++-- src/sage/schemes/curves/constructor.py | 4 +- src/sage/schemes/curves/curve.py | 4 +- src/sage/schemes/cyclic_covers/constructor.py | 4 +- src/sage/schemes/elliptic_curves/Qcurves.py | 10 +- .../schemes/elliptic_curves/constructor.py | 22 ++-- .../elliptic_curves/ell_curve_isogeny.py | 114 +++++++++--------- src/sage/schemes/elliptic_curves/ell_field.py | 10 +- .../schemes/elliptic_curves/ell_generic.py | 62 +++++----- src/sage/schemes/elliptic_curves/ell_point.py | 38 +++--- src/sage/schemes/elliptic_curves/ell_wp.py | 4 +- .../schemes/elliptic_curves/formal_group.py | 6 +- src/sage/schemes/elliptic_curves/height.py | 2 +- src/sage/schemes/elliptic_curves/kraus.py | 84 ++++++++----- .../schemes/elliptic_curves/period_lattice.py | 1 + .../elliptic_curves/period_lattice_region.pyx | 1 + .../hyperelliptic_curves/constructor.py | 36 +++--- .../hyperelliptic_generic.py | 24 ++-- .../hyperelliptic_curves/jacobian_morphism.py | 32 ++--- src/sage/schemes/plane_conics/con_field.py | 36 +++--- .../con_rational_function_field.py | 8 +- src/sage/schemes/plane_conics/constructor.py | 8 +- 23 files changed, 284 insertions(+), 252 deletions(-) diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index 602b6c1ce58..fa55588780c 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -663,7 +663,7 @@ 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()) # needs sage.rings.finite_rings sage.schemes + sage: type(f.as_dynamical_system()) # needs sage.schemes :: diff --git a/src/sage/schemes/curves/affine_curve.py b/src/sage/schemes/curves/affine_curve.py index bbe2e7ee315..49421fbbd16 100644 --- a/src/sage/schemes/curves/affine_curve.py +++ b/src/sage/schemes/curves/affine_curve.py @@ -180,7 +180,7 @@ class AffineCurve(Curve_generic, AlgebraicScheme_subscheme_affine): :: - sage: A. = AffineSpace(GF(7), 3) # needs sage.rings.finite_rings + sage: A. = AffineSpace(GF(7), 3) sage: C = Curve([x^2 - z, z - 8*x], A); C # needs sage.rings.finite_rings Affine Curve over Finite Field of size 7 defined by x^2 - z, -x + z """ @@ -199,7 +199,7 @@ def __init__(self, A, X): :: - sage: A. = AffineSpace(GF(7), 3) # needs sage.rings.finite_rings + sage: A. = AffineSpace(GF(7), 3) sage: C = Curve([x^2 - z, z - 8*x], A); C # needs sage.rings.finite_rings Affine Curve over Finite Field of size 7 defined by x^2 - z, -x + z """ @@ -845,7 +845,7 @@ def __init__(self, A, X): :: - sage: A. = AffineSpace(GF(7), 3) # needs sage.rings.number_field + sage: A. = AffineSpace(GF(7), 3) sage: C = Curve([x^2 - z, z - 8*x], A); C # needs sage.rings.number_field Affine Curve over Finite Field of size 7 defined by x^2 - z, -x + z """ @@ -2033,7 +2033,7 @@ def _genus(self): EXAMPLES:: - sage: A. = AffineSpace(GF(2), 2) # needs sage.rings.finite_rings + sage: A. = AffineSpace(GF(2), 2) sage: C = Curve(x^5 + y^5 + x*y + 1) # needs sage.rings.finite_rings sage: C.genus() # indirect doctest # needs sage.rings.finite_rings 1 @@ -2147,7 +2147,7 @@ def _nonsingular_model(self): TESTS:: - sage: A. = AffineSpace(GF(11), 3) # needs sage.rings.finite_rings + sage: A. = AffineSpace(GF(11), 3) sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # needs sage.rings.finite_rings sage: C._nonsingular_model # needs sage.rings.finite_rings (Function field in z defined by z^3 + 10*x, @@ -2254,7 +2254,7 @@ def _function_field(self): TESTS:: - sage: A. = AffineSpace(GF(11), 3) # needs sage.rings.finite_rings + sage: A. = AffineSpace(GF(11), 3) sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # needs sage.rings.finite_rings sage: C._function_field # needs sage.rings.finite_rings Function field in z defined by z^3 + 10*x @@ -2268,7 +2268,7 @@ def _lift_to_function_field(self): TESTS:: - sage: A. = AffineSpace(GF(11), 3) # needs sage.rings.finite_rings + sage: A. = AffineSpace(GF(11), 3) sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # needs sage.rings.finite_rings sage: C._lift_to_function_field # needs sage.rings.finite_rings Ring morphism: @@ -2288,7 +2288,7 @@ def _coordinate_functions(self): TESTS:: - sage: A. = AffineSpace(GF(11), 3) # needs sage.rings.finite_rings + sage: A. = AffineSpace(GF(11), 3) sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # needs sage.rings.finite_rings sage: C._coordinate_functions # needs sage.rings.finite_rings [x, z^2, z] @@ -2351,7 +2351,7 @@ def singular_closed_points(self): :: - sage: A. = AffineSpace(GF(11), 3) # needs sage.rings.finite_rings + sage: A. = AffineSpace(GF(11), 3) sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # needs sage.rings.finite_rings sage: C.singular_closed_points() # needs sage.rings.finite_rings [] @@ -2463,7 +2463,7 @@ def places_at_infinity(self): :: - sage: A. = AffineSpace(GF(11), 3) # needs sage.rings.finite_rings + sage: A. = AffineSpace(GF(11), 3) sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # needs sage.rings.finite_rings sage: C.places_at_infinity() # needs sage.rings.finite_rings [Place (1/x, 1/x*z^2)] @@ -2588,7 +2588,7 @@ class IntegralAffineCurve_finite_field(IntegralAffineCurve): EXAMPLES:: - sage: A. = AffineSpace(GF(11), 3) # needs sage.rings.finite_rings + sage: A. = AffineSpace(GF(11), 3) sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A); C # needs sage.rings.finite_rings Affine Curve over Finite Field of size 11 defined by -y^2 + x*z, -z^2 + y, -y*z + x @@ -2655,7 +2655,7 @@ def closed_points(self, degree=1): EXAMPLES:: - sage: A. = AffineSpace(GF(7), 2) # needs sage.rings.finite_rings + sage: A. = AffineSpace(GF(7), 2) sage: C = Curve(x^2 - x^4 - y^4) # needs sage.rings.finite_rings sage: C.closed_points() # needs sage.rings.finite_rings [Point (x, y), diff --git a/src/sage/schemes/curves/constructor.py b/src/sage/schemes/curves/constructor.py index 7bf581f8468..26ab59cecac 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) # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(5), 2) sage: Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings Projective Plane Curve over Finite Field of size 5 defined by -x^9 + y^2*z^7 - x*z^8 @@ -127,7 +127,7 @@ def Curve(F, A=None): Affine plane curves. :: - sage: x,y = GF(7)['x,y'].gens() # needs sage.rings.finite_rings + sage: x,y = GF(7)['x,y'].gens() sage: C = Curve(y^2 + x^3 + x^10); C # needs sage.rings.finite_rings Affine Plane Curve over Finite Field of size 7 defined by x^10 + x^3 + y^2 sage: C.genus() # needs sage.rings.finite_rings diff --git a/src/sage/schemes/curves/curve.py b/src/sage/schemes/curves/curve.py index e358fd76ad7..99833c13829 100644 --- a/src/sage/schemes/curves/curve.py +++ b/src/sage/schemes/curves/curve.py @@ -328,7 +328,7 @@ def singular_points(self, F=None): sage: R. = QQ[] sage: K. = NumberField(a^8 - a^4 + 1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(QQ, 2) # needs sage.rings.number_field + 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 # needs 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) @@ -458,7 +458,7 @@ def intersection_points(self, C, F=None): sage: R. = QQ[] sage: K. = NumberField(a^2 + a + 1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(QQ, 3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(QQ, 3) sage: C = Curve([y^2 - w*z, w^3 - y^3], P) # needs sage.rings.number_field sage: D = Curve([x*y - w*z, z^3 - y^3], P) # needs sage.rings.number_field sage: C.intersection_points(D, F=K) # needs sage.rings.number_field diff --git a/src/sage/schemes/cyclic_covers/constructor.py b/src/sage/schemes/cyclic_covers/constructor.py index 644dd90a2a3..99250257121 100644 --- a/src/sage/schemes/cyclic_covers/constructor.py +++ b/src/sage/schemes/cyclic_covers/constructor.py @@ -83,8 +83,8 @@ def CyclicCover(r, f, names=None, check_smooth=True): Double roots:: - sage: P. = GF(7)[] # needs sage.rings.finite_rings - sage: CyclicCover(2, (x^3-x+2)^2*(x^6-1)) # needs sage.rings.finite_rings + sage: P. = GF(7)[] + sage: CyclicCover(2, (x^3-x+2)^2*(x^6-1)) Traceback (most recent call last): ... ValueError: Not a smooth Cyclic Cover of P^1: singularity in the provided affine patch. diff --git a/src/sage/schemes/elliptic_curves/Qcurves.py b/src/sage/schemes/elliptic_curves/Qcurves.py index 1d10b130d07..e0b30169562 100644 --- a/src/sage/schemes/elliptic_curves/Qcurves.py +++ b/src/sage/schemes/elliptic_curves/Qcurves.py @@ -204,8 +204,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]]) # needs sage.rings.finite_rings - sage: is_Q_curve(E) # needs sage.rings.finite_rings + sage: E = EllipticCurve([GF(5)(t) for t in [2,3,5,7,11]]) + sage: is_Q_curve(E) Traceback (most recent call last): ... TypeError: Elliptic Curve defined by ... must be an elliptic curve @@ -520,13 +520,13 @@ def conjugacy_test(jlist, verbose=False): [] sage: conjugacy_test([3 + a, 3 - a]) # needs sage.rings.number_field [x^2 - 6*x + 7] - sage: x = polygen(QQ) # needs sage.rings.number_field - sage: f = x^3 - 3 # needs sage.rings.number_field + sage: x = polygen(QQ) + sage: f = x^3 - 3 sage: K. = f.splitting_field() # needs sage.rings.number_field sage: js = f.roots(K, multiplicities=False) # needs sage.rings.number_field sage: conjugacy_test(js) # needs sage.rings.number_field [] - sage: f = x^4 - 3 # needs sage.rings.number_field + sage: f = x^4 - 3 sage: K. = NumberField(f) # needs sage.rings.number_field sage: js = f.roots(K, multiplicities=False) # needs sage.rings.number_field sage: conjugacy_test(js) # needs sage.rings.number_field diff --git a/src/sage/schemes/elliptic_curves/constructor.py b/src/sage/schemes/elliptic_curves/constructor.py index fb295907616..8e8dedab3d3 100644 --- a/src/sage/schemes/elliptic_curves/constructor.py +++ b/src/sage/schemes/elliptic_curves/constructor.py @@ -115,9 +115,9 @@ class EllipticCurveFactory(UniqueFactory): We create curves over a finite field as follows:: - sage: EllipticCurve([GF(5)(0),0,1,-1,0]) # needs sage.rings.finite_rings + sage: EllipticCurve([GF(5)(0),0,1,-1,0]) 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]) # needs sage.rings.finite_rings + sage: EllipticCurve(GF(5), [0, 0,1,-1,0]) 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 @@ -159,8 +159,8 @@ 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)[] # needs sage.rings.finite_rings - sage: EllipticCurve(x^3 + x^2 + 2 - y^2 - y*x) # needs sage.rings.finite_rings + sage: R. = GF(5)[] + sage: EllipticCurve(x^3 + x^2 + 2 - y^2 - y*x) 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:: @@ -178,7 +178,7 @@ class EllipticCurveFactory(UniqueFactory): 1728 '32a2' - sage: E = EllipticCurve(j=GF(5)(2)); E; E.j_invariant() # needs sage.rings.finite_rings + sage: E = EllipticCurve(j=GF(5)(2)); E; E.j_invariant() Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 5 2 @@ -256,7 +256,7 @@ class EllipticCurveFactory(UniqueFactory): ... ValueError: First parameter (if present) must be a ring when j is specified - sage: EllipticCurve(GF(5), j=3/5) # needs sage.rings.finite_rings + sage: EllipticCurve(GF(5), j=3/5) Traceback (most recent call last): ... ValueError: First parameter must be a ring containing 3/5 @@ -462,8 +462,8 @@ def create_object(self, version, key, **kwds): EXAMPLES:: - sage: E = EllipticCurve.create_object(0, (GF(3), (1, 2, 0, 1, 2))) # needs sage.rings.finite_rings - sage: type(E) # needs sage.rings.finite_rings + sage: E = EllipticCurve.create_object(0, (GF(3), (1, 2, 0, 1, 2))) + sage: type(E) .. NOTE:: @@ -1072,7 +1072,7 @@ 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: EllipticCurve_from_cubic(cubic, [1,1,-1], morphism=False) # needs sage.libs.singular 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 @@ -1374,8 +1374,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) # needs sage.rings.finite_rings - sage: projective_point([F(4), F(8), F(2)]) # needs sage.rings.finite_rings + sage: F = GF(11) + sage: projective_point([F(4), F(8), F(2)]) [4, 8, 2] """ from sage.rings.integer import GCD_list diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index 675a94da3d5..a1568f9f333 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -128,32 +128,32 @@ def _isogeny_determine_algorithm(E, kernel): This helper function will be implicitly called by the following examples:: - sage: R. = GF(5)[] # needs sage.rings.finite_rings - sage: E = EllipticCurve(GF(5), [0,0,0,1,0]) # indirect doctest # needs sage.rings.finite_rings + sage: R. = GF(5)[] + sage: E = EllipticCurve(GF(5), [0,0,0,1,0]) # indirect doctest We can construct the same isogeny from a kernel polynomial:: - sage: phi = EllipticCurveIsogeny(E, x + 3) # indirect doctest # needs sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x + 3) # indirect doctest or from a list of coefficients of a kernel polynomial:: - sage: phi == EllipticCurveIsogeny(E, [3,1]) # indirect doctest # needs sage.rings.finite_rings + sage: phi == EllipticCurveIsogeny(E, [3,1]) # indirect doctest True or from a rational point which generates the kernel:: - sage: phi == EllipticCurveIsogeny(E, E((2,0))) # indirect doctest # needs sage.rings.finite_rings + sage: phi == EllipticCurveIsogeny(E, E((2,0))) # indirect doctest 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) # needs sage.rings.finite_rings + sage: _isogeny_determine_algorithm(E, x + 3) 'kohel' - sage: _isogeny_determine_algorithm(E, [3, 1]) # needs sage.rings.finite_rings + sage: _isogeny_determine_algorithm(E, [3, 1]) 'kohel' - sage: _isogeny_determine_algorithm(E, E((2,0))) # needs sage.rings.finite_rings + sage: _isogeny_determine_algorithm(E, E((2,0))) 'velu' """ kernel_is_list = isinstance(kernel, list) @@ -211,8 +211,8 @@ def isogeny_codomain_from_kernel(E, kernel, degree=None): 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]) # needs sage.rings.finite_rings - sage: kernel_list = [E((15,10)), E((10,3)), E((6,5))] # needs sage.rings.finite_rings + 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) # needs 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 @@ -892,12 +892,12 @@ class EllipticCurveIsogeny(EllipticCurveHom): Composition tests (see :trac:`16245`, cf. :trac:`34410`):: - sage: E = EllipticCurve(j=GF(7)(0)) # needs sage.rings.finite_rings - sage: phi = E.isogeny([E(0), E((0,1)), E((0,-1))]); phi # needs sage.rings.finite_rings + 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 # needs sage.rings.finite_rings + sage: phi2 = phi * phi; phi2 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 @@ -1030,15 +1030,15 @@ def __init__(self, E, kernel, codomain=None, degree=None, model=None, check=True EXAMPLES:: - sage: E = EllipticCurve(GF(2), [0,0,1,0,1]) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(2), [0,0,1,0,1]) sage: phi = EllipticCurveIsogeny(E, [1,1]); phi # needs 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]) # needs sage.rings.finite_rings - sage: P = E((2,17)) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, P); phi # needs sage.rings.finite_rings + 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 @@ -1483,9 +1483,9 @@ def _repr_(self): EXAMPLES:: - sage: E = EllipticCurve(GF(31), [1,0,1,1,0]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0)) ) # needs sage.rings.finite_rings - sage: phi._repr_() # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(31), [1,0,1,1,0]) + sage: phi = EllipticCurveIsogeny(E, E((0,0)) ) + sage: phi._repr_() '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]) @@ -1589,8 +1589,8 @@ def __init_algebraic_structs(self, E): EXAMPLES:: - sage: E = EllipticCurve(j=GF(17)(0)) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((-1,0))) # needs sage.rings.finite_rings + sage: E = EllipticCurve(j=GF(17)(0)) + sage: phi = EllipticCurveIsogeny(E, E((-1,0))) The constructor calls this function itself, so the fields it sets are already defined:: @@ -1752,9 +1752,9 @@ def __init_kernel_polynomial(self): The following examples inherently exercise this function:: - sage: E = EllipticCurve(j=GF(7)(1728)) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings - sage: phi.kernel_polynomial() # implicit doctest # needs sage.rings.finite_rings + sage: E = EllipticCurve(j=GF(7)(1728)) + sage: phi = EllipticCurveIsogeny(E, E((0,0))) + sage: phi.kernel_polynomial() # implicit doctest x """ if self.__kernel_polynomial is None: @@ -1925,12 +1925,12 @@ 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]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0))); phi # needs sage.rings.finite_rings + 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))]) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_from_kernel_list([E(0), E((0,0))]) The following example demonstrates the necessity of avoiding any calls to P.order(), since such calls involve factoring the group order which @@ -2265,16 +2265,16 @@ def __init_from_kernel_polynomial(self, kernel_polynomial): These examples inherently exercise this private function:: - sage: R. = GF(7)[] # needs sage.rings.finite_rings - sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, x);phi # needs sage.rings.finite_rings + 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: phi._EllipticCurveIsogeny__init_from_kernel_polynomial(x) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_from_kernel_polynomial(x) - sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi # needs 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 @@ -2366,16 +2366,16 @@ def __init_even_kernel_polynomial(self, E, psi_G): These examples inherently exercise this private function:: - sage: R. = GF(7)[] # needs sage.rings.finite_rings - sage: E = EllipticCurve(GF(7), [-1,0]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, x); phi # needs sage.rings.finite_rings + 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: from sage.schemes.elliptic_curves.ell_curve_isogeny import two_torsion_part - sage: psig = two_torsion_part(E,x) # needs sage.rings.finite_rings - sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) # needs sage.rings.finite_rings + sage: psig = two_torsion_part(E,x) + sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) (x^3 + 6*x, (x^3 + x)*y, 6, 0, 1, 2) sage: F = GF(2^4, 'alpha'); R. = F[] # needs sage.rings.finite_rings @@ -2484,14 +2484,14 @@ def __init_odd_kernel_polynomial(self, E, psi): These examples inherently exercise this private function:: - sage: R. = GF(7)[] # needs sage.rings.finite_rings - sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # needs sage.rings.finite_rings + sage: R. = GF(7)[] + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi # needs 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)[] # needs sage.rings.finite_rings + sage: R. = GF(7)[] sage: phi._EllipticCurveIsogeny__init_odd_kernel_polynomial(E, x+6) # needs sage.rings.finite_rings (x^3 + 5*x^2 + 3*x + 2, (x^3 + 4*x^2 + x)*y, 2, 6, 1, 3) @@ -2588,8 +2588,8 @@ def __compute_omega_fast(self, E, psi, psi_pr, phi, phi_pr): These examples inherently exercise this private function:: - sage: R. = GF(7)[] # needs sage.rings.finite_rings - sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # needs sage.rings.finite_rings + sage: R. = GF(7)[] + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi # needs 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 @@ -2840,8 +2840,8 @@ def rational_maps(self): sage: phi.rational_maps() (x, y) - sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) + sage: phi = EllipticCurveIsogeny(E, E((0,0))) sage: phi.rational_maps() # needs sage.rings.finite_rings ((x^2 + 3)/x, (x^2*y - 3*y)/x^2) """ @@ -2867,9 +2867,9 @@ def x_rational_map(self): sage: phi.x_rational_map() x - sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings - sage: phi.x_rational_map() # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) + sage: phi = EllipticCurveIsogeny(E, E((0,0))) + sage: phi.x_rational_map() (x^2 + 3)/x """ self.__initialize_rational_maps() @@ -2925,14 +2925,14 @@ def kernel_polynomial(self): sage: phi.kernel_polynomial() x^2 - 21*x + 80 - sage: E = EllipticCurve(GF(17), [1,-1,1,-1,1]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, [1]) # needs sage.rings.finite_rings - sage: phi.kernel_polynomial() # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(17), [1,-1,1,-1,1]) + sage: phi = EllipticCurveIsogeny(E, [1]) + sage: phi.kernel_polynomial() 1 - sage: E = EllipticCurve(GF(31), [0,0,0,3,0]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, [0,3,0,1]) # needs sage.rings.finite_rings - sage: phi.kernel_polynomial() # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(31), [0,0,0,3,0]) + sage: phi = EllipticCurveIsogeny(E, [0,3,0,1]) + sage: phi.kernel_polynomial() x^3 + 3*x """ if self.__kernel_polynomial is None: @@ -2948,9 +2948,9 @@ def is_separable(self): EXAMPLES:: - sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings - sage: phi.is_separable() # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) + sage: phi = EllipticCurveIsogeny(E, E((0,0))) + sage: phi.is_separable() True :: diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index e9e3b51148e..b0a9d01b2d4 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -48,8 +48,8 @@ def genus(self): EXAMPLES:: - sage: E = EllipticCurve(GF(3), [0, -1, 0, -346, 2652]) # needs sage.rings.finite_rings - sage: E.genus() # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(3), [0, -1, 0, -346, 2652]) + sage: E.genus() 1 sage: R = FractionField(QQ['z']) @@ -1227,7 +1227,7 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al Not all polynomials define a finite subgroup (:trac:`6384`):: - sage: E = EllipticCurve(GF(31), [1,0,0,1,2]) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(31), [1,0,0,1,2]) sage: phi = E.isogeny([14,27,4,1]) # needs sage.rings.finite_rings Traceback (most recent call last): ... @@ -1508,8 +1508,8 @@ def isogenies_prime_degree(self, l=None, max_l=31): In the supersingular case, there are no separable isogenies of degree equal to the characteristic:: - sage: E = EllipticCurve(GF(5), [0,1]) # needs sage.rings.finite_rings - sage: E.isogenies_prime_degree(5) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(5), [0,1]) + sage: E.isogenies_prime_degree(5) [] An example over a rational function field:: diff --git a/src/sage/schemes/elliptic_curves/ell_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py index a15399d5a82..06185ef72e7 100644 --- a/src/sage/schemes/elliptic_curves/ell_generic.py +++ b/src/sage/schemes/elliptic_curves/ell_generic.py @@ -19,13 +19,13 @@ We construct an elliptic curve over an elaborate base ring:: sage: p, a, b = 97, 1, 3 - sage: R. = GF(p)[] # needs sage.rings.finite_rings - sage: S. = R[] # needs sage.rings.finite_rings - sage: T = S.fraction_field() # needs sage.rings.finite_rings - sage: E = EllipticCurve(T, [a, b]); E # needs sage.rings.finite_rings + 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) # needs sage.rings.finite_rings + sage: latex(E) y^2 = x^{3} + x + 3 AUTHORS: @@ -143,7 +143,7 @@ def __init__(self, K, ainvs): 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 # needs sage.rings.finite_rings + 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 @@ -324,7 +324,7 @@ def _magma_init_(self, 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]) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(41), [2,5]) sage: E._magma_init_(magma) # optional - magma # needs 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]) # needs sage.rings.finite_rings @@ -440,15 +440,15 @@ def __contains__(self, P): True sage: (1,3) in E False - sage: E = EllipticCurve([GF(7)(0), 1]) # needs sage.rings.finite_rings - sage: [0,0] in E # needs sage.rings.finite_rings + sage: E = EllipticCurve([GF(7)(0), 1]) + sage: [0,0] in E False - sage: [0,8] in E # needs sage.rings.finite_rings + sage: [0,8] in E True - sage: P = E(0,8) # needs sage.rings.finite_rings - sage: P # needs sage.rings.finite_rings + sage: P = E(0,8) + sage: P (0 : 1 : 1) - sage: P in E # needs sage.rings.finite_rings + sage: P in E True """ if not isinstance(P, ell_point.EllipticCurvePoint): @@ -498,10 +498,10 @@ def __call__(self, *args, **kwds): We create points on an elliptic curve over a prime finite field:: - sage: E = EllipticCurve([GF(7)(0), 1]) # needs sage.rings.finite_rings - sage: E([2,3]) # needs sage.rings.finite_rings + sage: E = EllipticCurve([GF(7)(0), 1]) + sage: E([2,3]) (2 : 3 : 1) - sage: E([0,0]) # needs sage.rings.finite_rings + sage: E([0,0]) Traceback (most recent call last): ... TypeError: Coordinates [0, 0, 1] do not define a point @@ -975,7 +975,7 @@ def _point_homset(self, *args, **kwds): EXAMPLES:: - sage: E = EllipticCurve(GF(5),[1,1]) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(5),[1,1]) sage: E._point_homset(Spec(GF(5^10,'a'), GF(5)), E) # needs 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 @@ -1021,8 +1021,8 @@ 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]) # needs sage.rings.finite_rings - sage: E._EllipticCurve_generic__is_over_RationalField() # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(5),[1,1]) + sage: E._EllipticCurve_generic__is_over_RationalField() False """ return isinstance(self.base_ring(), RationalField) @@ -1065,8 +1065,8 @@ def a_invariants(self): sage: E.a_invariants() (0, 0, 0, 0, 1) - sage: E = EllipticCurve([GF(7)(3),5]) # needs sage.rings.finite_rings - sage: E.a_invariants() # needs sage.rings.finite_rings + sage: E = EllipticCurve([GF(7)(3),5]) + sage: E.a_invariants() (0, 0, 0, 3, 5) TESTS:: @@ -1311,8 +1311,8 @@ def discriminant(self): sage: E.discriminant() -161051 - sage: E = EllipticCurve([GF(7)(2),1]) # needs sage.rings.finite_rings - sage: E.discriminant() # needs sage.rings.finite_rings + sage: E = EllipticCurve([GF(7)(2),1]) + sage: E.discriminant() 1 """ b2, b4, b6, b8 = self.b_invariants() @@ -1339,8 +1339,8 @@ def j_invariant(self): sage: E.j_invariant() 1728 - sage: E = EllipticCurve([GF(7)(2),1]) # needs sage.rings.finite_rings - sage: E.j_invariant() # needs sage.rings.finite_rings + sage: E = EllipticCurve([GF(7)(2),1]) + sage: E.j_invariant() 1 """ c4, _ = self.c_invariants() @@ -1363,7 +1363,7 @@ def base_extend(self, R): EXAMPLES:: - sage: E = EllipticCurve(GF(5), [1,1]); E # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(5), [1,1]); E 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 # needs sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field in a of size 5^3 @@ -2833,13 +2833,13 @@ def short_weierstrass_model(self, complete_cube=True): :: - sage: E = EllipticCurve(GF(3), [1,2,3,4,5]) # needs sage.rings.finite_rings - sage: E.short_weierstrass_model(complete_cube=False) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(3), [1,2,3,4,5]) + sage: E.short_weierstrass_model(complete_cube=False) 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() # needs sage.rings.finite_rings + sage: E.short_weierstrass_model() Elliptic Curve defined by y^2 = x^3 + x + 2 over Finite Field of size 3 More tests in characteristic 3:: @@ -2956,7 +2956,7 @@ def montgomery_model(self, twisted=False, morphism=False): Not all elliptic curves have a Montgomery model over their field of definition:: - sage: E = EllipticCurve(GF(257), [1,1]) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(257), [1,1]) sage: E.montgomery_model() # needs sage.rings.finite_rings Traceback (most recent call last): ... @@ -2965,7 +2965,7 @@ def montgomery_model(self, twisted=False, morphism=False): :: - sage: E = EllipticCurve(GF(257), [10,10]) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(257), [10,10]) sage: E.montgomery_model() # needs sage.rings.finite_rings Traceback (most recent call last): ... diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py index 4002388fefe..66d72a9fb4e 100644 --- a/src/sage/schemes/elliptic_curves/ell_point.py +++ b/src/sage/schemes/elliptic_curves/ell_point.py @@ -1299,8 +1299,8 @@ def set_order(self, value=None, *, multiple=None, 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 # needs sage.rings.finite_rings - sage: G = E(5, 0) # G has order 2 # needs sage.rings.finite_rings + 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) # needs sage.rings.finite_rings Traceback (most recent call last): ... @@ -1549,30 +1549,30 @@ def _miller_(self, Q, n): A three-torsion example:: - sage: E = EllipticCurve([GF(7)(0), 2]) # needs sage.rings.finite_rings - sage: P = E(5, 1); Q = E(0, 3); # needs sage.rings.finite_rings - sage: P._miller_(Q, 3) # needs sage.rings.finite_rings + sage: E = EllipticCurve([GF(7)(0), 2]) + sage: P = E(5, 1); Q = E(0, 3); + sage: P._miller_(Q, 3) 4 A 4-torsion example:: - sage: E = EllipticCurve([GF(7)(-1), 0]) # needs sage.rings.finite_rings - sage: P = E(5, 1); Q = E(4, 2) # needs sage.rings.finite_rings - sage: P._miller_(Q, 4) # needs sage.rings.finite_rings + sage: E = EllipticCurve([GF(7)(-1), 0]) + sage: P = E(5, 1); Q = E(4, 2) + sage: P._miller_(Q, 4) 3 A 5-torsion example:: - sage: E = EllipticCurve([GF(7)(-1), 4]) # needs sage.rings.finite_rings - sage: P = E(4, 1); Q = E(6, 5) # needs sage.rings.finite_rings - sage: P._miller_(Q, 5) # needs sage.rings.finite_rings + sage: E = EllipticCurve([GF(7)(-1), 4]) + sage: P = E(4, 1); Q = E(6, 5) + sage: P._miller_(Q, 5) 1 A 6-torsion example:: - sage: E = EllipticCurve([GF(7)(3), 1]) # needs sage.rings.finite_rings - sage: P = E(5, 1); Q = E(3, 3) # needs sage.rings.finite_rings - sage: P._miller_(Q, 6) # needs sage.rings.finite_rings + sage: E = EllipticCurve([GF(7)(3), 1]) + sage: P = E(5, 1); Q = E(3, 3) + sage: P._miller_(Q, 6) 5 An example which is part of an ate pairing calculation. The trace of @@ -3646,8 +3646,8 @@ def _magma_init_(self, magma): EXAMPLES:: - sage: E = EllipticCurve(GF(17), [1,-1]) # needs sage.rings.finite_rings - sage: P = E([13, 4]) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(17), [1,-1]) + sage: P = E([13, 4]) sage: P._magma_init_(magma) # optional - magma # needs sage.rings.finite_rings 'EllipticCurve([_sage_ref...|GF(17)!0,GF(17)!0,GF(17)!0,GF(17)!1,GF(17)!16])![13,4]' """ @@ -3904,9 +3904,9 @@ def has_finite_order(self): EXAMPLES:: - sage: E = EllipticCurve(GF(7), [1,3]) # needs sage.rings.finite_rings - sage: P = E.points()[3] # needs sage.rings.finite_rings - sage: P.has_finite_order() # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [1,3]) + sage: P = E.points()[3] + sage: P.has_finite_order() True """ return True diff --git a/src/sage/schemes/elliptic_curves/ell_wp.py b/src/sage/schemes/elliptic_curves/ell_wp.py index afc203007f9..ba93a89ea89 100644 --- a/src/sage/schemes/elliptic_curves/ell_wp.py +++ b/src/sage/schemes/elliptic_curves/ell_wp.py @@ -284,8 +284,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) # needs sage.rings.finite_rings - sage: compute_wp_fast(k, k(1), k(8), 5) # needs sage.rings.finite_rings + sage: k = GF(37) + sage: compute_wp_fast(k, k(1), k(8), 5) z^-2 + 22*z^2 + 20*z^4 + O(z^5) """ R = PowerSeriesRing(k,'z',default_prec=m+5) diff --git a/src/sage/schemes/elliptic_curves/formal_group.py b/src/sage/schemes/elliptic_curves/formal_group.py index db969338217..5c426ff6383 100644 --- a/src/sage/schemes/elliptic_curves/formal_group.py +++ b/src/sage/schemes/elliptic_curves/formal_group.py @@ -627,12 +627,12 @@ def mult_by_n(self, n, prec=10): TESTS:: - sage: F = EllipticCurve(GF(17), [1, 1]).formal_group() # needs sage.rings.finite_rings + sage: F = EllipticCurve(GF(17), [1, 1]).formal_group() sage: F.mult_by_n(10, 50) # long time # needs 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() # needs sage.rings.finite_rings - sage: F.mult_by_n(100, 20) # needs sage.rings.finite_rings + sage: F = EllipticCurve(GF(101), [1, 1]).formal_group() + sage: F.mult_by_n(100, 20) 100*t + O(t^20) sage: P. = PolynomialRing(ZZ, 5) diff --git a/src/sage/schemes/elliptic_curves/height.py b/src/sage/schemes/elliptic_curves/height.py index 881072130ed..2229faf808b 100644 --- a/src/sage/schemes/elliptic_curves/height.py +++ b/src/sage/schemes/elliptic_curves/height.py @@ -798,7 +798,7 @@ 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]) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,0,0,0,1]) sage: EllipticCurveCanonicalHeight(E) # needs sage.rings.finite_rings Traceback (most recent call last): ... diff --git a/src/sage/schemes/elliptic_curves/kraus.py b/src/sage/schemes/elliptic_curves/kraus.py index 9573dccabac..8565cc5e3be 100644 --- a/src/sage/schemes/elliptic_curves/kraus.py +++ b/src/sage/schemes/elliptic_curves/kraus.py @@ -86,6 +86,7 @@ def c4c6_nonsingular(c4, c6): Over number fields:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 - 10) sage: c4c6_nonsingular(-217728*a - 679104, 141460992*a + 409826304) @@ -122,9 +123,10 @@ def c4c6_model(c4, c6, assume_nonsingular=False): sage: from sage.schemes.elliptic_curves.kraus import c4c6_model sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 10) - sage: c4c6_model(-217728*a - 679104, 141460992*a + 409826304) - Elliptic Curve defined by y^2 = x^3 + (4536*a+14148)*x + (-163728*a-474336) over Number Field in a with defining polynomial x^3 - 10 + sage: K. = NumberField(x^3 - 10) # needs sage.rings.number_field + sage: c4c6_model(-217728*a - 679104, 141460992*a + 409826304) # needs sage.rings.number_field + Elliptic Curve defined by y^2 = x^3 + (4536*a+14148)*x + (-163728*a-474336) + over Number Field in a with defining polynomial x^3 - 10 sage: c4, c6 = EllipticCurve('389a1').c_invariants() sage: c4c6_model(c4,c6) @@ -166,6 +168,7 @@ def make_integral(a, P, e): sage: from sage.schemes.elliptic_curves.kraus import make_integral + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 - 10) sage: P = K.primes_above(2)[0] @@ -206,6 +209,7 @@ def sqrt_mod_4(x, P): EXAMPLES:: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.kraus import sqrt_mod_4 sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 - 10) @@ -249,6 +253,7 @@ def test_b2_local(c4, c6, P, b2, debug=False): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 - 10) sage: c4 = -60544*a + 385796 @@ -259,28 +264,36 @@ def test_b2_local(c4, c6, P, b2, debug=False): b2=0 works at the first prime but not the second:: sage: b2 = 0 - sage: test_b2_local(c4,c6,P3a,b2) - Elliptic Curve defined by y^2 = x^3 + (3784/3*a-96449/12)*x + (1743740/27*a-32765791/108) over Number Field in a with defining polynomial x^2 - 10 - sage: test_b2_local(c4,c6,P3b,b2) + sage: test_b2_local(c4,c6,P3a,b2) # needs sage.rings.number_field + Elliptic Curve defined by + y^2 = x^3 + (3784/3*a-96449/12)*x + (1743740/27*a-32765791/108) + over Number Field in a with defining polynomial x^2 - 10 + sage: test_b2_local(c4,c6,P3b,b2) # needs sage.rings.number_field False b2=-a works at the second prime but not the first:: - sage: b2 = -a - sage: test_b2_local(c4,c6,P3a,b2,debug=True) + sage: b2 = -a # needs sage.rings.number_field + sage: test_b2_local(c4,c6,P3a,b2,debug=True) # needs sage.rings.number_field test_b2_local: not integral at Fractional ideal (3, a + 1) False - sage: test_b2_local(c4,c6,P3b,b2) - Elliptic Curve defined by y^2 = x^3 + (-1/4*a)*x^2 + (3784/3*a-192893/24)*x + (56378369/864*a-32879311/108) over Number Field in a with defining polynomial x^2 - 10 + sage: test_b2_local(c4,c6,P3b,b2) # needs sage.rings.number_field + Elliptic Curve defined by + y^2 = x^3 + (-1/4*a)*x^2 + (3784/3*a-192893/24)*x + (56378369/864*a-32879311/108) + over Number Field in a with defining polynomial x^2 - 10 Using CRT we can do both with the same b2:: - sage: b2 = K.solve_CRT([0,-a],[P3a,P3b]); b2 + sage: b2 = K.solve_CRT([0,-a],[P3a,P3b]); b2 # needs sage.rings.number_field a + 1 - sage: test_b2_local(c4,c6,P3a,b2) - Elliptic Curve defined by y^2 = x^3 + (1/4*a+1/4)*x^2 + (10091/8*a-128595/16)*x + (4097171/64*a-19392359/64) over Number Field in a with defining polynomial x^2 - 10 - sage: test_b2_local(c4,c6,P3b,b2) - Elliptic Curve defined by y^2 = x^3 + (1/4*a+1/4)*x^2 + (10091/8*a-128595/16)*x + (4097171/64*a-19392359/64) over Number Field in a with defining polynomial x^2 - 10 + sage: test_b2_local(c4,c6,P3a,b2) # needs sage.rings.number_field + Elliptic Curve defined by + y^2 = x^3 + (1/4*a+1/4)*x^2 + (10091/8*a-128595/16)*x + (4097171/64*a-19392359/64) + over Number Field in a with defining polynomial x^2 - 10 + sage: test_b2_local(c4,c6,P3b,b2) # needs sage.rings.number_field + Elliptic Curve defined + by y^2 = x^3 + (1/4*a+1/4)*x^2 + (10091/8*a-128595/16)*x + (4097171/64*a-19392359/64) + over Number Field in a with defining polynomial x^2 - 10 """ E = c4c6_model(c4,c6).rst_transform(b2/12,0,0) if not (c4,c6) == E.c_invariants(): @@ -312,6 +325,7 @@ def test_b2_global(c4, c6, b2, debug=False): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 - 10) sage: c4 = -60544*a + 385796 @@ -361,6 +375,7 @@ def check_Kraus_local_3(c4, c6, P, assume_nonsingular=False, debug=False): EXAMPLES:: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.kraus import check_Kraus_local_3 sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 - 10) @@ -374,7 +389,8 @@ def check_Kraus_local_3(c4, c6, P, assume_nonsingular=False, debug=False): An example in a field where 3 is ramified:: - sage: K. = NumberField(x^2-15) + sage: # needs sage.rings.number_field + sage: K. = NumberField(x^2 - 15) sage: c4 = -60504*a + 386001 sage: c6 = -55346820*a + 261045153 sage: P3 = K.primes_above(3)[0] @@ -430,6 +446,7 @@ def test_a1a3_local(c4, c6, P, a1, a3, debug=False): EXAMPLES:: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.kraus import test_a1a3_local sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 - 10) @@ -472,6 +489,7 @@ def test_a1a3_global(c4, c6, a1, a3, debug=False): EXAMPLES:: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.kraus import test_a1a3_global sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 - 10) @@ -513,6 +531,7 @@ def test_rst_global(c4, c6, r, s, t, debug=False): EXAMPLES:: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.kraus import test_rst_global sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2-10) @@ -579,6 +598,7 @@ def check_Kraus_local_2(c4, c6, P, a1=None, assume_nonsingular=False): EXAMPLES:: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.kraus import check_Kraus_local_2 sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 - 10) @@ -666,6 +686,7 @@ def check_Kraus_local(c4, c6, P, assume_nonsingular=False): EXAMPLES:: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.kraus import check_Kraus_local sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 - 15) @@ -687,6 +708,7 @@ def check_Kraus_local(c4, c6, P, assume_nonsingular=False): sage: E.is_local_integral_model(P5) and (c4,c6)==E.c_invariants() True + sage: # needs sage.rings.number_field sage: c4 = 123+456*a sage: c6 = 789+101112*a sage: check_Kraus_local(c4,c6,P2) @@ -735,6 +757,7 @@ def check_Kraus_global(c4, c6, assume_nonsingular=False, debug=False): EXAMPLES:: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.kraus import check_Kraus_global sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 - 10) @@ -752,7 +775,8 @@ def check_Kraus_global(c4, c6, assume_nonsingular=False, debug=False): ...and it does! Elliptic Curve defined by y^2 + 3*a*x*y + (-89*a+10)*y = x^3 + (a-89)*x^2 + (1202*a-5225)*x + (34881*a-151813) over Number Field in a with defining polynomial x^2 - 10 - sage: K. = NumberField(x^2-15) + sage: # needs sage.rings.number_field + sage: K. = NumberField(x^2 - 15) sage: E = EllipticCurve([0, 0, 0, 4536*a + 14148, -163728*a - 474336]) sage: c4, c6 = E.c_invariants() sage: check_Kraus_global(c4,c6) @@ -760,16 +784,19 @@ def check_Kraus_global(c4, c6, assume_nonsingular=False, debug=False): TESTS (see :trac:`17295`):: - sage: K. =NumberField(x^3 - 7*x - 5) + sage: # needs sage.rings.number_field + sage: K. = NumberField(x^3 - 7*x - 5) sage: E = EllipticCurve([a, 0, 1, 2*a^2 + 5*a + 3, -a^2 - 3*a - 2]) sage: assert E.conductor().norm() ==8 sage: G = K.galois_group(names='b') sage: def conj_curve(E,sigma): return EllipticCurve([sigma(a) for a in E.ainvs()]) sage: EL = conj_curve(E,G[0]) sage: L = EL.base_field() - sage: assert L.class_number()== 2 - sage: EL.isogeny_class() # long time (~10s) - Isogeny class of Elliptic Curve defined by y^2 + (-1/90*b^4+7/18*b^2-1/2*b-98/45)*x*y + y = x^3 + (1/45*b^5-1/18*b^4-7/9*b^3+41/18*b^2+167/90*b-29/9)*x + (-1/90*b^5+1/30*b^4+7/18*b^3-4/3*b^2-61/90*b+11/5) over Number Field in b with defining polynomial x^6 - 42*x^4 + 441*x^2 - 697 + sage: assert L.class_number() == 2 + sage: EL.isogeny_class() # long time (~10s) + Isogeny class of Elliptic Curve defined by + y^2 + (-1/90*b^4+7/18*b^2-1/2*b-98/45)*x*y + y = x^3 + (1/45*b^5-1/18*b^4-7/9*b^3+41/18*b^2+167/90*b-29/9)*x + (-1/90*b^5+1/30*b^4+7/18*b^3-4/3*b^2-61/90*b+11/5) + over Number Field in b with defining polynomial x^6 - 42*x^4 + 441*x^2 - 697 """ if not assume_nonsingular: if not c4c6_nonsingular(c4,c6): @@ -913,6 +940,7 @@ def semi_global_minimal_model(E, debug=False): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 - 10) sage: K.class_number() @@ -932,16 +960,18 @@ def semi_global_minimal_model(E, debug=False): has order 3315. The smallest prime in that ideal class has norm 23567:: - sage: K. = NumberField(x^2-x+31821453) - sage: ainvs = (0, 0, 0, -382586771000351226384*a - 2498023791133552294513515, 358777608829102441023422458989744*a + 1110881475104109582383304709231832166) + sage: # long time, needs sage.rings.number_field + sage: K. = NumberField(x^2 - x + 31821453) + sage: ainvs = (0, 0, 0, -382586771000351226384*a - 2498023791133552294513515, + ....: 358777608829102441023422458989744*a + 1110881475104109582383304709231832166) sage: E = EllipticCurve(ainvs) sage: from sage.schemes.elliptic_curves.kraus import semi_global_minimal_model - sage: Emin, p = semi_global_minimal_model(E) # long time (25s) - sage: p # long time + sage: Emin, p = semi_global_minimal_model(E) # 25s + sage: p Fractional ideal (23567, a + 2270) - sage: p.norm() # long time + sage: p.norm() 23567 - sage: Emin.discriminant().norm().factor() # long time + sage: Emin.discriminant().norm().factor() 23567^12 """ c = E.global_minimality_class() diff --git a/src/sage/schemes/elliptic_curves/period_lattice.py b/src/sage/schemes/elliptic_curves/period_lattice.py index 512385611b1..a1d352ee8e9 100644 --- a/src/sage/schemes/elliptic_curves/period_lattice.py +++ b/src/sage/schemes/elliptic_curves/period_lattice.py @@ -1057,6 +1057,7 @@ def complex_area(self, prec=None): :: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^3 - 2) sage: embs = K.embeddings(ComplexField()) diff --git a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx index eb40392dee9..b0914d6347a 100644 --- a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx +++ b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.rings.complex_double sage.symbolic r""" Regions in fundamental domains of period lattices diff --git a/src/sage/schemes/hyperelliptic_curves/constructor.py b/src/sage/schemes/hyperelliptic_curves/constructor.py index f8f27e116a0..de93cc7e371 100644 --- a/src/sage/schemes/hyperelliptic_curves/constructor.py +++ b/src/sage/schemes/hyperelliptic_curves/constructor.py @@ -81,27 +81,26 @@ def HyperellipticCurve(f, h=0, names=None, PP=None, check_squarefree=True): Characteristic two:: - sage: P. = GF(8, 'a')[] # needs sage.rings.finite_rings - sage: HyperellipticCurve(x^7 + 1, x) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) # needs sage.rings.finite_rings + 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: HyperellipticCurve(x^8 + 1, x) # needs sage.rings.finite_rings + sage: HyperellipticCurve(x^8 + 1, x) Traceback (most recent call last): ... ValueError: Not a hyperelliptic curve: highly singular at infinity. - - sage: HyperellipticCurve(x^8 + x^7 + 1, x^4) # needs sage.rings.finite_rings + sage: HyperellipticCurve(x^8 + x^7 + 1, x^4) Traceback (most recent call last): ... ValueError: Not a hyperelliptic curve: singularity in the provided affine patch. - sage: F. = PowerSeriesRing(FiniteField(2)) # needs sage.rings.finite_rings - sage: P. = PolynomialRing(FractionField(F)) # needs sage.rings.finite_rings - sage: HyperellipticCurve(x^5 + t, x) # needs sage.rings.finite_rings + 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 @@ -125,13 +124,13 @@ def HyperellipticCurve(f, h=0, names=None, PP=None, check_squarefree=True): Double roots:: - sage: P. = GF(7)[] # needs sage.rings.finite_rings + sage: P. = GF(7)[] 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) # needs sage.rings.finite_rings + 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 @@ -156,9 +155,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)[] # needs sage.rings.finite_rings - sage: P. = F[] # needs sage.rings.finite_rings - sage: HyperellipticCurve(x^5 + t) # needs sage.rings.finite_rings + sage: F. = GF(5)[] + sage: P. = F[] + sage: HyperellipticCurve(x^5 + t) Traceback (most recent call last): ... ValueError: Not a hyperelliptic curve: singularity in the provided affine patch. @@ -191,9 +190,10 @@ def HyperellipticCurve(f, h=0, names=None, PP=None, check_squarefree=True): Check that the inheritance is correct:: - sage: R. = PolynomialRing(GF(next_prime(10^9))) # needs sage.rings.finite_rings - sage: C = HyperellipticCurve(t^5 + t + 1) # needs sage.rings.finite_rings - sage: type(C).mro() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = PolynomialRing(GF(next_prime(10^9))) + sage: C = HyperellipticCurve(t^5 + t + 1) + sage: type(C).mro() [, , , diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py index 7f98036b700..e4dddf40713 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py @@ -3,9 +3,9 @@ EXAMPLES:: - sage: P. = GF(5)[] # needs sage.rings.finite_rings - sage: f = x^5 - 3*x^4 - 2*x^3 + 6*x^2 + 3*x - 1 # needs sage.rings.finite_rings - sage: C = HyperellipticCurve(f); C # needs sage.rings.finite_rings + 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 @@ -85,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)[] # needs sage.rings.finite_rings - sage: f2 = y^5 - y^3 + y - 22 # needs sage.rings.finite_rings - sage: C2 = HyperellipticCurve(f2) # needs sage.rings.finite_rings + sage: Q. = GF(5)[] + sage: f2 = y^5 - y^3 + y - 22 + sage: C2 = HyperellipticCurve(f2) sage: hash(C0) == hash(C0) True sage: hash(C0) == hash(C1) False - sage: hash(C1) == hash(C2) # needs sage.rings.finite_rings + sage: hash(C1) == hash(C2) False """ def __init__(self, PP, f, h=None, names=None, genus=None): @@ -137,8 +137,8 @@ def change_ring(self, R): 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)[] # needs sage.rings.finite_rings - sage: H = HyperellipticCurve(x^8 + x + 5) # needs sage.rings.finite_rings + sage: R. = FiniteField(7)[] + sage: H = HyperellipticCurve(x^8 + x + 5) sage: H.base_extend(FiniteField(7^2, 'a')) # needs sage.rings.finite_rings Hyperelliptic Curve over Finite Field in a of size 7^2 defined by y^2 = x^8 + x + 5 @@ -225,9 +225,9 @@ def is_smooth(self): EXAMPLES:: - sage: R. = GF(13)[] # needs sage.rings.finite_rings - sage: H = HyperellipticCurve(x^8 + 1) # needs sage.rings.finite_rings - sage: H.is_smooth() # needs sage.rings.finite_rings + sage: R. = GF(13)[] + sage: H = HyperellipticCurve(x^8 + 1) + sage: H.is_smooth() True A hyperelliptic curve with genus at least 2 always has a singularity at diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py b/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py index b73774b8904..abfb5f11f37 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py @@ -36,18 +36,18 @@ :: - sage: x = GF(37)['x'].gen() # needs sage.rings.finite_rings - sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x); H # needs sage.rings.finite_rings + sage: x = GF(37)['x'].gen() + sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x); H 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 # needs sage.rings.finite_rings + sage: J = H.jacobian(); J 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 # needs sage.rings.finite_rings + sage: J = J(J.base_ring()); J 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 @@ -376,9 +376,9 @@ def __init__(self, parent, polys, check=True): EXAMPLES:: - sage: x = GF(37)['x'].gen() # needs sage.rings.finite_rings - sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) # needs sage.rings.finite_rings - sage: J = H.jacobian()(GF(37)); J # needs sage.rings.finite_rings + 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 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 @@ -662,9 +662,9 @@ def __bool__(self): EXAMPLES:: - sage: x = GF(37)['x'].gen() # needs sage.rings.finite_rings - sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) # needs sage.rings.finite_rings - sage: J = H.jacobian()(GF(37)) # needs sage.rings.finite_rings + 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)) :: @@ -748,9 +748,9 @@ def _add_(self,other): EXAMPLES:: - sage: x = GF(37)['x'].gen() # needs sage.rings.finite_rings - sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) # needs sage.rings.finite_rings - sage: J = H.jacobian()(GF(37)) # needs sage.rings.finite_rings + 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)) :: @@ -779,9 +779,9 @@ def _sub_(self, other): EXAMPLES:: - sage: x = GF(37)['x'].gen() # needs sage.rings.finite_rings - sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) # needs sage.rings.finite_rings - sage: J = H.jacobian()(GF(37)) # needs sage.rings.finite_rings + 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)) :: diff --git a/src/sage/schemes/plane_conics/con_field.py b/src/sage/schemes/plane_conics/con_field.py index 5675a062147..23acc3da6d9 100644 --- a/src/sage/schemes/plane_conics/con_field.py +++ b/src/sage/schemes/plane_conics/con_field.py @@ -160,10 +160,10 @@ def coefficients(self): sage: Conic(QQ, [1,2,3,4,5,6]).coefficients() [1, 2, 3, 4, 5, 6] - sage: P. = GF(13)[] # needs sage.rings.finite_rings - sage: a = Conic(x^2 + 5*x*y + y^2 + z^2).coefficients(); a # needs sage.rings.finite_rings + sage: P. = GF(13)[] + sage: a = Conic(x^2 + 5*x*y + y^2 + z^2).coefficients(); a [1, 5, 0, 1, 0, 1] - sage: Conic(a) # needs sage.rings.finite_rings + sage: Conic(a) Projective Conic Curve over Finite Field of size 13 defined by x^2 + 5*x*y + y^2 + z^2 """ @@ -232,10 +232,10 @@ def determinant(self): Determinants are only defined in characteristic different from `2`:: - sage: C = Conic(GF(2), [1, 1, 1, 1, 1, 0]) # needs sage.rings.finite_rings - sage: C.is_smooth() # needs sage.rings.finite_rings + sage: C = Conic(GF(2), [1, 1, 1, 1, 1, 0]) + sage: C.is_smooth() True - sage: C.determinant() # needs sage.rings.finite_rings + sage: C.determinant() Traceback (most recent call last): ... ValueError: The conic self (= Projective Conic Curve over Finite Field @@ -334,7 +334,7 @@ def diagonalization(self, names=None): :: - sage: Conic(GF(2), [1,1,1,1,1,0]).diagonalization() # needs sage.rings.finite_rings + sage: Conic(GF(2), [1,1,1,1,1,0]).diagonalization() Traceback (most recent call last): ... ValueError: The conic self (= Projective Conic Curve over Finite Field @@ -581,11 +581,11 @@ def has_singular_point(self, point=False): sage: c.has_singular_point(point = True) (True, (0 : 1 : 0)) - sage: P. = GF(7)[] # needs sage.rings.finite_rings - sage: e = Conic((x+y+z)*(x-y+2*z)); e # needs sage.rings.finite_rings + 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: e.has_singular_point(point = True) # needs sage.rings.finite_rings + sage: e.has_singular_point(point = True) (True, (2 : 4 : 1)) sage: Conic([1, 1, -1]).has_singular_point() @@ -602,7 +602,7 @@ def has_singular_point(self, point=False): sage: Conic([a, a + 1, 1]).has_singular_point(point=True) # needs sage.rings.finite_rings (True, (a + 1 : 0 : 1)) - sage: P. = GF(2)[] # needs sage.rings.finite_rings + sage: P. = GF(2)[] sage: C = Conic(P, [t,t,1]); C # needs sage.libs.ntl 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 @@ -757,7 +757,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() # needs sage.rings.finite_rings + sage: Conic(GF(2),[1,1,1,1,1,0]).is_smooth() True """ if self.base_ring().characteristic() == 2: @@ -823,9 +823,9 @@ def matrix(self): [1/2 1 0] [ 0 0 1] - sage: R. = GF(2)[] # needs sage.rings.finite_rings - sage: C = Conic(x^2 + x*y + y^2 + x*z + z^2) # needs sage.rings.finite_rings - sage: C.matrix() # needs sage.rings.finite_rings + sage: R. = GF(2)[] + sage: C = Conic(x^2 + x*y + y^2 + x*z + z^2) + sage: C.matrix() [1 1 1] [0 1 0] [0 0 1] @@ -853,7 +853,7 @@ def parametrization(self, point=None, morphism=True): An example over a finite field :: - sage: c = Conic(GF(2), [1,1,1,1,1,0]) # needs sage.rings.finite_rings + sage: c = Conic(GF(2), [1,1,1,1,1,0]) sage: f, g = c.parametrization(); f, g # needs sage.rings.finite_rings (Scheme morphism: From: Projective Space of dimension 1 over Finite Field of size 2 @@ -1013,7 +1013,7 @@ def random_rational_point(self, *args1, **args2): EXAMPLES:: - sage: c = Conic(GF(2), [1,1,1,1,1,0]) # needs sage.rings.finite_rings + sage: c = Conic(GF(2), [1,1,1,1,1,0]) sage: [c.random_rational_point() for i in range(10)] # random # needs 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)] @@ -1192,7 +1192,7 @@ def singular_point(self): :: - sage: Conic(GF(2), [1,1,1,1,1,1]).singular_point() # needs sage.rings.finite_rings + sage: Conic(GF(2), [1,1,1,1,1,1]).singular_point() (1 : 1 : 1) ``ValueError`` is raised if the conic has no rational singular point 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 e6db233558d..451f99acf51 100644 --- a/src/sage/schemes/plane_conics/con_rational_function_field.py +++ b/src/sage/schemes/plane_conics/con_rational_function_field.py @@ -130,8 +130,8 @@ def has_rational_point(self, point=False, algorithm='default', 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)[] # needs sage.rings.finite_rings - sage: C = Conic([2, t^2 + 1, t^2 + 5]) # needs sage.rings.finite_rings + sage: R. = FiniteField(23)[] + sage: C = Conic([2, t^2 + 1, t^2 + 5]) sage: C.has_rational_point() # needs sage.rings.finite_rings True sage: C.has_rational_point(point=True) # needs sage.rings.finite_rings @@ -198,8 +198,8 @@ 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)) # needs sage.rings.finite_rings - sage: C = Conic([5*t^2 + 4, t^2 + 3*t + 3, 6*t^2 + 3*t + 2, # needs sage.rings.finite_rings + 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() # needs sage.rings.finite_rings Traceback (most recent call last): diff --git a/src/sage/schemes/plane_conics/constructor.py b/src/sage/schemes/plane_conics/constructor.py index e74212cdb7b..b1787330287 100644 --- a/src/sage/schemes/plane_conics/constructor.py +++ b/src/sage/schemes/plane_conics/constructor.py @@ -105,7 +105,7 @@ 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() # needs sage.rings.finite_rings + sage: x,y = GF(7)['x,y'].gens() sage: Conic(x^2 - x + 2*y^2 - 3, 'U,V,W') # needs 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 @@ -115,7 +115,7 @@ def Conic(base_field, F=None, names=None, unique=True): 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() # needs sage.rings.finite_rings + sage: x,y,z = GF(11)['x,y,z'].gens() sage: C = Conic(x^2 + y^2 - 2*z^2); C # needs 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') # needs sage.rings.finite_rings @@ -139,8 +139,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) # needs sage.rings.finite_rings - sage: Conic([a([x,x^2]) for x in range(5)]) # needs sage.rings.finite_rings + sage: a = AffineSpace(GF(13), 2) + sage: Conic([a([x,x^2]) for x in range(5)]) 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)): From b0f148e9578d802bf65c54ccc56996100fe2754a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 18 Aug 2023 13:54:10 -0700 Subject: [PATCH 049/423] sage.schemes: More block tags --- src/sage/schemes/affine/affine_morphism.py | 65 ++++---- .../schemes/elliptic_curves/ell_torsion.py | 28 ++-- src/sage/schemes/elliptic_curves/gp_simon.py | 16 +- src/sage/schemes/generic/morphism.py | 124 ++++++++------- .../con_rational_function_field.py | 35 +++-- .../schemes/projective/projective_point.py | 142 ++++++++++-------- 6 files changed, 226 insertions(+), 184 deletions(-) diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index fa55588780c..1fc3f207464 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -711,12 +711,13 @@ def global_height(self, prec=None): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: k. = NumberField(x^2 + 5) # needs sage.rings.number_field - sage: A. = AffineSpace(k, 2) # needs sage.rings.number_field + 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]) # needs sage.rings.number_field - sage: f.global_height(prec=2) # needs sage.rings.number_field + sage: f = H([13*w*x^2 + 4*y, 1/w*y^2]) + sage: f.global_height(prec=2) 4.0 :: @@ -789,12 +790,13 @@ def local_height(self, v, prec=None): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field - sage: P. = AffineSpace(K, 2) # needs sage.rings.number_field + 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]) # needs sage.rings.number_field - sage: f.local_height(K.ideal(3)) # needs sage.rings.number_field + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) + sage: f.local_height(K.ideal(3)) 1.09861228866811 """ K = FractionField(self.domain().base_ring()) @@ -836,12 +838,13 @@ def local_height_arch(self, i, prec=None): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field - sage: P. = AffineSpace(K, 2) # needs sage.rings.number_field + 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]) # needs sage.rings.number_field - sage: f.local_height_arch(1) # needs sage.rings.number_field + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) + sage: f.local_height_arch(1) 0.6931471805599453094172321214582 """ K = FractionField(self.domain().base_ring()) @@ -1161,11 +1164,12 @@ def reduce_base_field(self): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: A. = AffineSpace(QQbar, 1) # needs sage.rings.number_field - sage: H = End(A) # needs sage.rings.number_field - sage: f = H([QQbar(3^(1/3))*x^2 + QQbar(sqrt(-2))]) # needs sage.rings.number_field sage.symbolic - sage: f.reduce_base_field() # needs sage.rings.number_field sage.symbolic + sage: A. = AffineSpace(QQbar, 1) + sage: H = End(A) + sage: f = H([QQbar(3^(1/3))*x^2 + QQbar(sqrt(-2))]) # needs sage.symbolic + sage: f.reduce_base_field() # needs sage.symbolic 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 @@ -1176,14 +1180,15 @@ def reduce_base_field(self): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^3 - x + 1, # needs sage.rings.number_field + sage: K. = NumberField(x^3 - x + 1, ....: embedding=(x^3 + x + 1).roots(ring=CC)[0][0]) - sage: A. = AffineSpace(K, 1) # needs sage.rings.number_field - sage: A2. = AffineSpace(K, 2) # needs sage.rings.number_field - sage: H = Hom(A, A2) # needs sage.rings.number_field - sage: f = H([x^2 + a*x + 3, 5*x]) # needs sage.rings.number_field - sage: f.reduce_base_field() # needs sage.rings.number_field + 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() Scheme morphism: From: Affine Space of dimension 1 over Number Field in a with defining polynomial x^3 - x + 1 with a = -1.324717957244746? @@ -1310,23 +1315,24 @@ def image(self): EXAMPLES:: + sage: # needs sage.libs.singular sage: A1. = AffineSpace(QQ, 1) sage: A2. = AffineSpace(QQ, 2) sage: f = A2.hom([x + y], A1) - sage: f.image() # needs sage.libs.singular + sage: f.image() Closed subscheme of Affine Space of dimension 1 over Rational Field defined by: (no polynomials) sage: f = A2.hom([x, x], A2) - sage: f.image() # needs sage.libs.singular + sage: f.image() Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x - y sage: f = A2.hom([x^2, x^3], A2) - sage: f.image() # needs sage.libs.singular + sage: f.image() Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x^3 - y^2 sage: P2. = ProjectiveSpace(QQ, 2) sage: f = A2.hom([x, x^2, x^3], P2) - sage: f.image() # needs sage.libs.singular + sage: f.image() Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x1^2 - x0*x2 """ @@ -1399,11 +1405,12 @@ def representatives(self): :: + sage: # needs sage.libs.singular sage: A2. = AffineSpace(QQ, 2) sage: A1. = AffineSpace(QQ, 1) sage: X = A2.subscheme([x^2 - y^2 - y]) sage: f = X.hom([x/y], A1) - sage: f.representatives() # needs sage.libs.singular + sage: f.representatives() [Scheme morphism: From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x^2 - y^2 - y @@ -1414,8 +1421,8 @@ def representatives(self): 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)] - sage: g = _[1] # needs sage.libs.singular - sage: g.representatives() # needs sage.libs.singular + 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 diff --git a/src/sage/schemes/elliptic_curves/ell_torsion.py b/src/sage/schemes/elliptic_curves/ell_torsion.py index f56c3ee0e6f..9a39ead60e5 100644 --- a/src/sage/schemes/elliptic_curves/ell_torsion.py +++ b/src/sage/schemes/elliptic_curves/ell_torsion.py @@ -100,6 +100,7 @@ class EllipticCurveTorsionSubgroup(groups.AdditiveAbelianGroupWrapper): Examples over other Number Fields:: + sage: # needs sage.rings.number_field sage: E = EllipticCurve('11a1') sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 + 1) @@ -111,9 +112,9 @@ class EllipticCurveTorsionSubgroup(groups.AdditiveAbelianGroupWrapper): over Number Field in i with defining polynomial x^2 + 1 sage: E = EllipticCurve('11a1') - sage: K. = NumberField(x^2 + 1) - sage: EK = E.change_ring(K) - sage: T = EK.torsion_subgroup() + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: EK = E.change_ring(K) # needs sage.rings.number_field + sage: T = EK.torsion_subgroup() # needs sage.rings.number_field sage: T.ngens() 1 sage: T.gen(0) @@ -121,6 +122,7 @@ class EllipticCurveTorsionSubgroup(groups.AdditiveAbelianGroupWrapper): Note: this class is normally constructed indirectly as follows:: + sage: # needs sage.rings.number_field 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) @@ -147,20 +149,20 @@ def __init__(self, E): sage: from sage.schemes.elliptic_curves.ell_torsion import EllipticCurveTorsionSubgroup sage: E = EllipticCurve('11a1') sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 + 1) - sage: EK = E.change_ring(K) - sage: EllipticCurveTorsionSubgroup(EK) + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: EK = E.change_ring(K) # needs sage.rings.number_field + sage: EllipticCurveTorsionSubgroup(EK) # needs sage.rings.number_field 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 + sage: T = EK.torsion_subgroup(); T # needs sage.rings.number_field 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) + sage: type(T) # needs sage.rings.number_field sage: T == loads(dumps(T)) # known bug, see https://github.com/sagemath/sage/issues/11599#comment:7 @@ -219,9 +221,9 @@ def _repr_(self): sage: E = EllipticCurve('11a1') sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 + 1) - sage: EK = E.change_ring(K) - sage: T = EK.torsion_subgroup(); T._repr_() + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: EK = E.change_ring(K) # needs sage.rings.number_field + sage: T = EK.torsion_subgroup(); T._repr_() # needs sage.rings.number_field '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' """ return "Torsion Subgroup isomorphic to %s associated to the %s" % (self.short_name(), self.__E) @@ -247,6 +249,7 @@ def curve(self): EXAMPLES:: + sage: # needs sage.rings.number_field sage: E = EllipticCurve('11a1') sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 + 1) @@ -266,6 +269,7 @@ def points(self): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 + 1) sage: E = EllipticCurve(K, [0,0,0,1,0]) @@ -315,6 +319,7 @@ def torsion_bound(E, number_of_places=20): An example over a relative number field (see :trac:`16011`):: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: F. = QuadraticField(5) sage: K. = F.extension(x^2 - 3) @@ -324,6 +329,7 @@ def torsion_bound(E, number_of_places=20): An example of a base-change curve from `\QQ` to a degree 16 field:: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.ell_torsion import torsion_bound sage: f = PolynomialRing(QQ,'x')([5643417737593488384,0, ....: -11114515801179776,0,-455989850911004,0,379781901872, diff --git a/src/sage/schemes/elliptic_curves/gp_simon.py b/src/sage/schemes/elliptic_curves/gp_simon.py index 5a62c5cc445..198ceed7218 100644 --- a/src/sage/schemes/elliptic_curves/gp_simon.py +++ b/src/sage/schemes/elliptic_curves/gp_simon.py @@ -55,37 +55,41 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None, EXAMPLES:: sage: import sage.schemes.elliptic_curves.gp_simon - sage: E=EllipticCurve('389a1') + sage: E = EllipticCurve('389a1') sage: sage.schemes.elliptic_curves.gp_simon.simon_two_descent(E) (2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/8 : 1)]) TESTS:: + sage: # needs sage.rings.number_field sage: E = EllipticCurve('37a1').change_ring(QuadraticField(-11,'x')) sage: E.simon_two_descent() (1, 1, [(0 : 0 : 1)]) An example with an elliptic curve defined over a relative number field:: + sage: # needs sage.rings.number_field sage: F. = QuadraticField(29) sage: x = QQ['x'].gen() sage: K. = F.extension(x^2-1/2*a+1/2) - sage: E = EllipticCurve(K,[1, 0, 5/2*a + 27/2, 0, 0]) # long time (about 3 s) + sage: E = EllipticCurve(K,[1, 0, 5/2*a + 27/2, 0, 0]) # long time (about 3 s) sage: E.simon_two_descent(lim1=2, limtriv=3) (1, 1, ...) Check that :trac:`16022` is fixed:: + sage: # needs sage.rings.number_field sage: K. = NumberField(x^4 + x^2 - 7) sage: E = EllipticCurve(K, [1, 0, 5*y^2 + 16, 0, 0]) - sage: E.simon_two_descent(lim1=2, limtriv=3) # long time (about 3 s) + sage: E.simon_two_descent(lim1=2, limtriv=3) # long time (about 3 s) (1, 1, ...) An example that checks that :trac:`9322` is fixed (it should take less than a second to run):: - sage: K. = NumberField(x^2-x-232) - sage: E = EllipticCurve([2-w,18+3*w,209+9*w,2581+175*w,852-55*w]) - sage: E.simon_two_descent() # long time + sage: # needs sage.rings.number_field + sage: K. = NumberField(x^2 - x - 232) + sage: E = EllipticCurve([2 - w, 18 + 3*w, 209 + 9*w, 2581 + 175*w, 852 - 55*w]) + sage: E.simon_two_descent() # long time (0, 2, []) """ init() diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index eedd0935525..943b8adf74f 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -613,7 +613,7 @@ def glue_along_domains(self, other): OUTPUT: - Assuming that self and other are open immersions with the same + Assuming that ``self`` and ``other`` are open immersions with the same domain, return scheme obtained by gluing along the images. EXAMPLES: @@ -622,28 +622,29 @@ def glue_along_domains(self, other): `\mathrm{Spec}(\QQ)` by gluing two copies of `\mathbb{A}^1` minus a point:: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ, 2) - sage: S. = R.quotient(x*y - 1) # needs sage.libs.singular + sage: S. = R.quotient(x*y - 1) sage: Rx = PolynomialRing(QQ, 'x') - sage: i1 = Rx.hom([xbar]) # needs sage.libs.singular + sage: i1 = Rx.hom([xbar]) sage: Ry = PolynomialRing(QQ, 'y') - sage: i2 = Ry.hom([ybar]) # needs sage.libs.singular + sage: i2 = Ry.hom([ybar]) sage: Sch = Schemes() - sage: f1 = Sch(i1) # needs sage.libs.singular - sage: f2 = Sch(i2) # needs sage.libs.singular + sage: f1 = Sch(i1) + sage: f2 = Sch(i2) Now f1 and f2 have the same domain, which is a `\mathbb{A}^1` minus a point. We glue along the domain:: - sage: P1 = f1.glue_along_domains(f2); P1 # needs sage.libs.singular + sage: # needs sage.libs.singular + sage: P1 = f1.glue_along_domains(f2); P1 Scheme obtained by gluing X and Y along U, where 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) - - sage: a, b = P1.gluing_maps() # needs sage.libs.singular - sage: a # needs sage.libs.singular + 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) @@ -653,7 +654,7 @@ def glue_along_domains(self, other): To: Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x*y - 1) Defn: x |--> xbar - sage: b # needs sage.libs.singular + sage: b Affine Scheme morphism: From: Spectrum of Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x*y - 1) @@ -1342,27 +1343,29 @@ def change_ring(self, R, check=True): TESTS:: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = QuadraticField(2) # needs sage.rings.number_field - sage: K2. = NumberField(t**4 - 2) # needs sage.rings.number_field + sage: K. = QuadraticField(2) + sage: K2. = NumberField(t**4 - 2) sage: P. = ProjectiveSpace(QQ, 1) - sage: phi = K.embeddings(K2)[0] # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x**2 + 3*y**2, y**2]) # needs sage.rings.number_field - sage: f.change_ring(phi) # needs sage.rings.number_field + 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 Defn: Defined on coordinates by sending (x : y) to (x^2 + 3*y^2 : y^2) :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = QuadraticField(2) # needs sage.rings.number_field - sage: K1. = NumberField(t^4 - 2) # needs sage.rings.number_field - sage: K2. = NumberField(t^8 - 2) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: phi = K1.embeddings(K2)[0] # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 + 3*y^2, y^2]) # needs sage.rings.number_field - sage: f.change_ring(phi) # needs sage.rings.number_field + 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) Traceback (most recent call last): ... ValueError: no canonical coercion of base ring of morphism to domain of embedding @@ -1401,10 +1404,11 @@ def change_ring(self, R, check=True): Check that :trac:`16834` is fixed:: + sage: # needs sage.rings.real_mpfr sage: A. = AffineSpace(RR, 3) sage: h = Hom(A, A) sage: f = h([x^2 + 1.5, y^3, z^5 - 2.0]) - sage: f.change_ring(CC) # needs sage.rings.real_mpfr + 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 @@ -1435,18 +1439,19 @@ def change_ring(self, R, check=True): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^3 - x + 1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + 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]) # needs sage.rings.number_field - sage: emb = K.embeddings(QQbar) # needs sage.rings.number_field - sage: f.change_ring(emb[0]) # needs sage.rings.number_field + 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]) 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]) # needs sage.rings.number_field + sage: f.change_ring(emb[1]) Scheme endomorphism of Projective Space of dimension 1 over Algebraic Field Defn: Defined on coordinates by sending (x : y) to @@ -1468,14 +1473,15 @@ def change_ring(self, R, check=True): :: + sage: # needs sage.rings.number_field sage.symbolic sage: from sage.misc.verbose import set_verbose sage: set_verbose(-1) - sage: K. = QuadraticField(2, embedding=QQbar(-sqrt(2))) # needs sage.rings.number_field sage.symbolic - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field sage.symbolic + 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]) # needs sage.rings.number_field sage.symbolic - sage: f.change_ring(QQbar) # needs 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]) + sage: f.change_ring(QQbar) 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 @@ -1483,13 +1489,14 @@ def change_ring(self, R, check=True): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: f = x^6 - 2 - sage: L. = NumberField(f, embedding=f.roots(QQbar)[1][0]) # needs sage.rings.number_field - sage: A. = AffineSpace(L, 2) # needs sage.rings.number_field + 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]) # needs sage.rings.number_field - sage: F.change_ring(QQbar) # needs sage.rings.number_field + sage: F = H([b*x/y, 1 + y]) + sage: F.change_ring(QQbar) 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) @@ -1613,10 +1620,10 @@ def specialization(self, D=None, phi=None, homset=None): sage: R. = QQ[] 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: F = f.dynatomic_polynomial(3) # needs sage.libs.pari 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) + sage: g == f.specialization({c:1}).dynatomic_polynomial(3) # needs sage.libs.pari True :: @@ -1719,15 +1726,16 @@ def _composition_(self, other, homset): Not both defined by polynomials:: + sage: # needs sage.rings.number_field sage: x = polygen(QQ) - sage: K. = NumberField(x^2 - 2) # needs sage.rings.number_field - sage: p1, p2 = K.Hom(K) # needs sage.rings.number_field - sage: R. = K[] # needs sage.rings.number_field - sage: q1 = R.Hom(R)(p1) # needs sage.rings.number_field - sage: A = AffineSpace(R) # needs sage.rings.number_field - sage: f1 = A.Hom(A)(q1) # needs sage.rings.number_field + 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 # needs sage.rings.number_field + sage: g*f1 Composite map: From: Affine Space of dimension 2 over Number Field in a with defining polynomial x^2 - 2 @@ -2003,14 +2011,15 @@ def change_ring(self, R, check=True): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2 - x + 1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: Q = P([a + 1, 1]) # needs sage.rings.number_field - sage: emb = K.embeddings(QQbar) # needs sage.rings.number_field - sage: Q.change_ring(emb[0]) # needs sage.rings.number_field + 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]) (1.5000000000000000? - 0.866025403784439?*I : 1) - sage: Q.change_ring(emb[1]) # needs sage.rings.number_field + sage: Q.change_ring(emb[1]) (1.5000000000000000? + 0.866025403784439?*I : 1) :: @@ -2024,12 +2033,13 @@ def change_ring(self, R, check=True): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: f = x^6 - 2 - sage: L. = NumberField(f, embedding=f.roots(QQbar)[1][0]) # needs sage.rings.number_field - sage: A. = AffineSpace(L, 2) # needs sage.rings.number_field - sage: P = A([b,1]) # needs sage.rings.number_field - sage: P.change_ring(QQbar) # needs sage.rings.number_field + 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) (1.122462048309373?, 1) """ S = self.codomain().change_ring(R) 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 451f99acf51..3bc870a75f1 100644 --- a/src/sage/schemes/plane_conics/con_rational_function_field.py +++ b/src/sage/schemes/plane_conics/con_rational_function_field.py @@ -130,16 +130,19 @@ def has_rational_point(self, point=False, algorithm='default', 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() # needs sage.rings.finite_rings + sage: C.has_rational_point() True - sage: C.has_rational_point(point=True) # needs sage.rings.finite_rings + sage: C.has_rational_point(point=True) (True, (5*t : 8 : 1)) - sage: F. = QuadraticField(-1) # needs sage.rings.number_field - sage: R. = F[] # needs sage.rings.number_field - sage: C = Conic([1, i*t, -t^2 + 4]) # needs sage.rings.number_field - sage: C.has_rational_point(point=True) # needs sage.rings.number_field + + sage: # needs sage.rings.number_field + sage: F. = QuadraticField(-1) + sage: R. = F[] + sage: C = Conic([1, i*t, -t^2 + 4]) + sage: C.has_rational_point(point=True) (True, (-t - 2*i : -2*i : 1)) It works on non-diagonal conics as well:: @@ -183,8 +186,8 @@ 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) # needs sage.rings.function_field - sage: R. = F[] # needs sage.rings.function_field + sage: F. = E.extension(Y^2 - u^3 - 1) + sage: R. = F[] sage: K = R.fraction_field() # needs sage.rings.function_field sage: C = Conic(K, [u, v, 1]) # needs sage.rings.function_field sage: C.has_rational_point() # needs sage.rings.function_field @@ -201,7 +204,7 @@ def has_rational_point(self, point=False, algorithm='default', 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() # needs sage.rings.finite_rings + sage: C.has_rational_point() Traceback (most recent call last): ... TypeError: self (=Scheme morphism: @@ -480,14 +483,14 @@ def find_point(self, supports, roots, case, solution=0): sage: K. = PolynomialRing(QQ, 't') 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] - sage: tbar3 = QQ.extension(supp[2][0], 'tbar').gens()[0] - sage: roots = [[tbar1 + 1], [1/3*tbar2^0], [2/3*tbar3^2 + 11/3*tbar3 - 3]] - sage: C.find_point(supp, roots, 1) + sage: tbar1 = QQ.extension(supp[0][0], 'tbar').gens()[0] # needs sage.rings.number_field + sage: tbar2 = QQ.extension(supp[1][0], 'tbar').gens()[0] # needs sage.rings.number_field + sage: tbar3 = QQ.extension(supp[2][0], 'tbar').gens()[0] # needs sage.rings.number_field + sage: roots = [[tbar1 + 1], [1/3*tbar2^0], [2/3*tbar3^2 + 11/3*tbar3 - 3]] # needs sage.rings.number_field + sage: C.find_point(supp, roots, 1) # needs sage.rings.number_field (3 : t + 1 : 1) - sage: roots = [[-tbar1 - 1], [-1/3*tbar2^0], [-2/3*tbar3^2 - 11/3*tbar3 + 3]] - sage: C.find_point(supp, roots, 1) + sage: roots = [[-tbar1 - 1], [-1/3*tbar2^0], [-2/3*tbar3^2 - 11/3*tbar3 + 3]] # needs sage.rings.number_field + sage: C.find_point(supp, roots, 1) # needs sage.rings.number_field (3 : -t - 1 : 1) """ Ft = self.base().base() diff --git a/src/sage/schemes/projective/projective_point.py b/src/sage/schemes/projective/projective_point.py index 9d127673f39..0a040fb9903 100644 --- a/src/sage/schemes/projective/projective_point.py +++ b/src/sage/schemes/projective/projective_point.py @@ -284,21 +284,23 @@ def _richcmp_(self, right, op): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2 + 5) # needs sage.rings.number_field - sage: OK = K.ring_of_integers() # needs sage.rings.number_field - sage: t = OK.gen(1) # needs sage.rings.number_field - sage: PS. = ProjectiveSpace(OK, 1) # needs sage.rings.number_field - sage: P = PS(2, 1 + t) # needs sage.rings.number_field - sage: Q = PS(1 - t, 3) # needs sage.rings.number_field - sage: P == Q # needs sage.rings.number_field + 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 True Check that :trac:`17429` is fixed:: sage: # needs sage.rings.complex_interval_field 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) @@ -397,11 +399,12 @@ def __hash__(self): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2 + 3) # needs sage.rings.number_field - sage: O = K.maximal_order() # needs sage.rings.number_field - sage: P. = ProjectiveSpace(O, 1) # needs sage.rings.number_field - sage: hash(P([1 + w, 2])) == hash(P([2, 1 - w])) # needs sage.rings.number_field + 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])) True TESTS:: @@ -458,11 +461,11 @@ def _matrix_times_point_(self, mat, dom): :: - sage: # needs sage.rings.number_field + sage: # needs sage.modules sage.rings.number_field sage.symbolic sage: P = ProjectiveSpace(QQbar, 1) - sage: Q = P(QQbar(sqrt(2)),1) # needs sage.symbolic - sage: m = matrix(ZZ, 2, 2, [1,-1, 0,1]) # needs sage.modules sage.symbolic - sage: m*Q # needs sage.modules sage.symbolic + sage: Q = P(QQbar(sqrt(2)),1) + sage: m = matrix(ZZ, 2, 2, [1,-1, 0,1]) + sage: m*Q (0.4142135623730951? : 1) :: @@ -588,12 +591,13 @@ def normalize_coordinates(self): :: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ, 1) sage: S = R.quotient_ring(R.ideal(t^3)) - sage: P. = ProjectiveSpace(S, 1) # needs sage.libs.singular - sage: Q = P(t + 1, t^2 + t) # needs sage.libs.singular + sage: P. = ProjectiveSpace(S, 1) + sage: Q = P(t + 1, t^2 + t) sage: Q.normalize_coordinates() - sage: Q # needs sage.libs.singular + sage: Q (1 : tbar) """ R = self.codomain().base_ring() @@ -648,11 +652,12 @@ def dehomogenize(self,n): :: + sage: # needs sage.libs.pari sage: R. = PolynomialRing(QQ) - sage: S = R.quo(R.ideal(t^3)) # needs sage.libs.pari - sage: P. = ProjectiveSpace(S, 2) # needs sage.libs.pari - sage: Q = P(t, 1, 1) # needs sage.libs.pari - sage: Q.dehomogenize(1) # needs sage.libs.pari sage.libs.singular + sage: S = R.quo(R.ideal(t^3)) + sage: P. = ProjectiveSpace(S, 2) + sage: Q = P(t, 1, 1) + sage: Q.dehomogenize(1) (tbar, 1) :: @@ -830,9 +835,10 @@ def local_height_arch(self, i, prec=None): :: - sage: P. = ProjectiveSpace(QuadraticField(5, 'w'), 2) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: P. = ProjectiveSpace(QuadraticField(5, 'w'), 2) sage: Q = P.point([4, 1, 30], False) - sage: Q.local_height_arch(1) # needs sage.rings.number_field + sage: Q.local_height_arch(1) 3.401197381662155375413236691607 """ K = FractionField(self.domain().base_ring()) @@ -924,7 +930,7 @@ def is_preperiodic(self, f, err=0.1, return_period=False): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^3 - 3*x*y^2, y^3], domain=P) # needs sage.schemes sage: Q = P(-1, 1) - sage: Q.is_preperiodic(f) # needs sage.schemes + sage: Q.is_preperiodic(f) # needs sage.libs.singular sage.schemes True :: @@ -933,7 +939,7 @@ def is_preperiodic(self, f, err=0.1, return_period=False): sage: X = P.subscheme(z) sage: f = DynamicalSystem([x^2 - y^2, y^2, z^2], domain=X) # needs sage.schemes sage: p = X((-1, 1, 0)) - sage: p.is_preperiodic(f, return_period=True) # needs sage.schemes + sage: p.is_preperiodic(f, return_period=True) # needs sage.libs.singular sage.schemes (0, 2) :: @@ -941,23 +947,24 @@ def is_preperiodic(self, f, err=0.1, return_period=False): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2 - 29/16*y^2, y^2], domain=P) # needs sage.schemes sage: Q = P(1, 4) - sage: Q.is_preperiodic(f, return_period=True) # needs sage.schemes + sage: Q.is_preperiodic(f, return_period=True) # needs sage.libs.singular sage.schemes (1, 3) sage: Q = P(1, 1) - sage: Q.is_preperiodic(f, return_period=True) # needs sage.schemes + sage: Q.is_preperiodic(f, return_period=True) # needs sage.libs.singular sage.schemes (0, 0) :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^5 + 5/4*x*y^4, y^5], domain=P) # needs sage.rings.number_field sage.schemes - sage: Q = P([-1/2*a + 1/2, 1]) # needs sage.rings.number_field - sage: Q.is_preperiodic(f) # needs sage.rings.number_field sage.schemes + 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) # needs sage.schemes + sage: Q = P([-1/2*a + 1/2, 1]) + sage: Q.is_preperiodic(f) # needs sage.schemes True - sage: Q = P([a, 1]) # needs sage.rings.number_field - sage: Q.is_preperiodic(f) # needs sage.rings.number_field sage.schemes + sage: Q = P([a, 1]) + sage: Q.is_preperiodic(f) # needs sage.schemes False :: @@ -969,7 +976,7 @@ def is_preperiodic(self, f, err=0.1, return_period=False): ....: z^2 ....: ], domain=P) sage: Q = P([1, 3, 1]) - sage: Q.is_preperiodic(f, return_period=True) # needs sage.schemes + sage: Q.is_preperiodic(f, return_period=True) # needs sage.libs.singular sage.schemes (0, 9) :: @@ -982,27 +989,29 @@ def is_preperiodic(self, f, err=0.1, return_period=False): ....: w^2 ....: ], domain=P) sage: Q = P([3,0,4/3,1]) - sage: Q.is_preperiodic(f, return_period=True) # needs sage.schemes + sage: Q.is_preperiodic(f, return_period=True) # needs sage.libs.singular sage.schemes (2, 24) :: + sage: # needs sage.rings.number_field sage.schemes sage.symbolic sage: from sage.misc.verbose import set_verbose sage: set_verbose(-1) - sage: P. = ProjectiveSpace(QQbar, 2) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2, QQbar(sqrt(-1))*y^2, z^2], # needs sage.rings.number_field sage.schemes sage.symbolic + 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) # needs sage.rings.number_field sage.schemes sage.symbolic + sage: Q.is_preperiodic(f) True :: + sage: # needs sage.rings.number_field sage.schemes sage.symbolic sage: set_verbose(-1) - sage: P. = ProjectiveSpace(QQbar, 2) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2, y^2, z^2], domain=P) # needs sage.rings.number_field sage.schemes - sage: Q = P([QQbar(sqrt(-1)), 1, 1]) # needs sage.rings.number_field sage.symbolic - sage: Q.is_preperiodic(f) # needs sage.rings.number_field sage.schemes sage.symbolic + 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) True :: @@ -1010,15 +1019,15 @@ 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], domain=P) # needs sage.schemes sage: Q = P(-1,4) - sage: Q.is_preperiodic(f) # needs sage.schemes + sage: Q.is_preperiodic(f) # needs sage.libs.singular sage.schemes True :: sage: P. = ProjectiveSpace(GF(3), 2) - sage: F = DynamicalSystem([x^2 - 2*y^2, y^2, z^2]) # needs sage.rings.finite_rings sage.schemes + sage: F = DynamicalSystem([x^2 - 2*y^2, y^2, z^2]) # needs sage.schemes sage: Q = P(1, 1, 1) - sage: Q.is_preperiodic(F, return_period=True) # needs sage.rings.finite_rings sage.schemes + sage: Q.is_preperiodic(F, return_period=True) # needs sage.schemes (1, 1) TESTS:: @@ -1037,7 +1046,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]) # needs sage.schemes sage: Q = P(11,4) - sage: Q.is_preperiodic(f, err=2) # needs sage.schemes + sage: Q.is_preperiodic(f, err=2) # needs sage.libs.singular sage.schemes False """ try: @@ -1226,27 +1235,29 @@ def _number_field_from_algebraics(self): EXAMPLES:: + sage: # needs sage.rings.number_field sage.symbolic sage: R. = PolynomialRing(QQ) - sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field - sage: Q = P([-1/2*QQbar(sqrt(2)) + QQbar(I), 1]) # needs sage.rings.number_field sage.symbolic - sage: S = Q._number_field_from_algebraics(); S # needs sage.rings.number_field sage.symbolic + sage: P. = ProjectiveSpace(QQbar, 1) + sage: Q = P([-1/2*QQbar(sqrt(2)) + QQbar(I), 1]) + sage: S = Q._number_field_from_algebraics(); S (1/2*a^3 + a^2 - 1/2*a : 1) - sage: S.codomain() # needs sage.rings.number_field sage.symbolic + 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 The following was fixed in :trac:`23808`:: + sage: # needs sage.rings.number_field sage.symbolic sage: R. = PolynomialRing(QQ) - sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field - sage: Q = P([-1/2*QQbar(sqrt(2)) + QQbar(I), 1]);Q # needs sage.rings.number_field sage.symbolic + sage: P. = ProjectiveSpace(QQbar, 1) + sage: Q = P([-1/2*QQbar(sqrt(2)) + QQbar(I), 1]);Q (-0.7071067811865475? + 1*I : 1) - sage: S = Q._number_field_from_algebraics(); S # needs sage.rings.number_field sage.symbolic + sage: S = Q._number_field_from_algebraics(); S (1/2*a^3 + a^2 - 1/2*a : 1) - sage: T = S.change_ring(QQbar) # Used to fail # needs sage.rings.number_field sage.symbolic - sage: T # needs sage.rings.number_field sage.symbolic + sage: T = S.change_ring(QQbar) # Used to fail + sage: T (-0.7071067811865475? + 1.000000000000000?*I : 1) - sage: Q[0] == T[0] # needs sage.rings.number_field sage.symbolic + sage: Q[0] == T[0] True """ from sage.schemes.projective.projective_space import is_ProjectiveSpace @@ -1284,11 +1295,12 @@ def clear_denominators(self): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2 - 3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field - sage: Q = P([1/w, 3, 0]) # needs sage.rings.number_field - sage: Q.clear_denominators(); Q # needs sage.rings.number_field + sage: K. = NumberField(x^2 - 3) + sage: P. = ProjectiveSpace(K, 2) + sage: Q = P([1/w, 3, 0]) + sage: Q.clear_denominators(); Q (w : 9 : 0) :: @@ -1406,8 +1418,8 @@ def __hash__(self): :: - sage: P. = ProjectiveSpace(GF(13^3,'t'), 1) # needs sage.rings.finite_rings - sage: hash(P(3, 4)) # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(13^3,'t'), 1) # needs sage.rings.finite_rings + sage: hash(P(3, 4)) # needs sage.rings.finite_rings 2201 """ p = self.codomain().base_ring().order() From 000dfc1fcd96403617d712a52edbc1743b1743d1 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 18 Aug 2023 17:08:45 -0700 Subject: [PATCH 050/423] src/sage/schemes/projective/projective_rational_point.py --- src/sage/schemes/projective/projective_rational_point.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sage/schemes/projective/projective_rational_point.py b/src/sage/schemes/projective/projective_rational_point.py index fd5a77f38e0..4e2e2d17086 100644 --- a/src/sage/schemes/projective/projective_rational_point.py +++ b/src/sage/schemes/projective/projective_rational_point.py @@ -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)) # needs sage.rings.finite_rings sage.schemes - sage: enum_projective_finite_field(E) # needs sage.rings.finite_rings sage.schemes + sage: E = EllipticCurve('72').change_ring(GF(19)) # needs sage.schemes + sage: enum_projective_finite_field(E) # needs sage.schemes [(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), @@ -255,6 +255,7 @@ def enum_projective_finite_field(X): :: + sage: # needs sage.rings.finite_rings sage: F = GF(9, 'a') # needs sage.rings.finite_rings sage: P. = ProjectiveSpace(2,F) sage: C = Curve(X^3 - Y^3 + Z^2*Y) # needs sage.rings.finite_rings sage.schemes From 8fef9dcf894495a0b73045d84d1f7cc78a2761f2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 18 Aug 2023 17:10:37 -0700 Subject: [PATCH 051/423] sage.schemes: More block tags, remove many unnecessary # needs - sage.rings.finite_rings --- .../schemes/affine/affine_rational_point.py | 18 +- src/sage/schemes/affine/affine_space.py | 15 +- src/sage/schemes/affine/affine_subscheme.py | 24 +- src/sage/schemes/curves/affine_curve.py | 134 ++++---- src/sage/schemes/curves/closed_point.py | 5 - src/sage/schemes/curves/constructor.py | 7 +- src/sage/schemes/curves/curve.py | 34 +- src/sage/schemes/curves/point.py | 33 +- src/sage/schemes/curves/projective_curve.py | 305 +++++++++--------- .../cyclic_covers/cycliccover_generic.py | 16 +- src/sage/schemes/elliptic_curves/Qcurves.py | 29 +- .../schemes/elliptic_curves/constructor.py | 13 +- .../elliptic_curves/descent_two_isogeny.pyx | 16 +- src/sage/schemes/elliptic_curves/ell_field.py | 12 +- .../schemes/elliptic_curves/ell_generic.py | 82 ++--- .../elliptic_curves/ell_modular_symbols.py | 4 +- src/sage/schemes/elliptic_curves/ell_point.py | 252 ++++++++------- .../elliptic_curves/ell_rational_field.py | 14 +- src/sage/schemes/elliptic_curves/ell_wp.py | 10 +- .../schemes/elliptic_curves/formal_group.py | 6 +- src/sage/schemes/elliptic_curves/height.py | 2 +- .../schemes/elliptic_curves/hom_composite.py | 29 +- .../modular_parametrization.py | 9 +- .../schemes/elliptic_curves/period_lattice.py | 60 ++-- .../elliptic_curves/weierstrass_morphism.py | 1 - src/sage/schemes/generic/scheme.py | 2 +- .../projective/projective_rational_point.py | 4 +- .../schemes/projective/projective_space.py | 11 +- 28 files changed, 571 insertions(+), 576 deletions(-) diff --git a/src/sage/schemes/affine/affine_rational_point.py b/src/sage/schemes/affine/affine_rational_point.py index 60dc76543ca..739d1795086 100644 --- a/src/sage/schemes/affine/affine_rational_point.py +++ b/src/sage/schemes/affine/affine_rational_point.py @@ -188,12 +188,13 @@ def enum_affine_number_field(X, **kwds): EXAMPLES:: + sage: # needs sage.rings.number_field 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') # needs sage.rings.number_field - sage: A. = AffineSpace(K, 3) # needs sage.rings.number_field - sage: X = A.subscheme([y^2 - x]) # needs sage.rings.number_field - sage: enum_affine_number_field(X(K), bound=2**0.5) # needs sage.rings.number_field + 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) [(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), @@ -201,12 +202,13 @@ def enum_affine_number_field(X, **kwds): :: + sage: # needs sage.rings.number_field 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') # needs sage.rings.number_field - sage: A. = AffineSpace(K, 2) # needs sage.rings.number_field - sage: X = A.subscheme(x - y) # needs sage.rings.number_field - sage: enum_affine_number_field(X, bound=3**0.25) # needs sage.rings.number_field + sage: K = NumberField(u^2 + 3, 'v') + sage: A. = AffineSpace(K, 2) + sage: X = A.subscheme(x - y) + sage: enum_affine_number_field(X, bound=3**0.25) [(-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)] """ diff --git a/src/sage/schemes/affine/affine_space.py b/src/sage/schemes/affine/affine_space.py index ac092e578f7..927a065cf60 100644 --- a/src/sage/schemes/affine/affine_space.py +++ b/src/sage/schemes/affine/affine_space.py @@ -1106,15 +1106,16 @@ def weil_restriction(self): EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(x^5 - 2) # needs sage.rings.number_field - sage: AK. = AffineSpace(K, 2) # needs sage.rings.number_field - sage: AK.weil_restriction() # needs sage.rings.number_field + sage: K. = NumberField(x^5 - 2) + sage: AK. = AffineSpace(K, 2) + sage: AK.weil_restriction() Affine Space of dimension 10 over Rational Field - sage: R. = K[] # needs sage.rings.number_field - sage: L. = K.extension(x^2 + 1) # needs sage.rings.number_field - sage: AL. = AffineSpace(L, 2) # needs sage.rings.number_field - sage: AL.weil_restriction() # needs sage.rings.number_field + sage: R. = K[] + sage: L. = K.extension(x^2 + 1) + sage: AL. = AffineSpace(L, 2) + sage: AL.weil_restriction() Affine Space of dimension 4 over Number Field in w with defining polynomial x^5 - 2 """ diff --git a/src/sage/schemes/affine/affine_subscheme.py b/src/sage/schemes/affine/affine_subscheme.py index 838aad612f4..ed125a60193 100644 --- a/src/sage/schemes/affine/affine_subscheme.py +++ b/src/sage/schemes/affine/affine_subscheme.py @@ -98,16 +98,17 @@ def dimension(self): EXAMPLES:: + sage: # needs sage.libs.singular sage: A. = AffineSpace(2, QQ) - sage: A.subscheme([]).dimension() # needs sage.libs.singular + sage: A.subscheme([]).dimension() 2 - sage: A.subscheme([x]).dimension() # needs sage.libs.singular + sage: A.subscheme([x]).dimension() 1 - sage: A.subscheme([x^5]).dimension() # needs sage.libs.singular + sage: A.subscheme([x^5]).dimension() 1 - sage: A.subscheme([x^2 + y^2 - 1]).dimension() # needs sage.libs.singular + sage: A.subscheme([x^2 + y^2 - 1]).dimension() 1 - sage: A.subscheme([x*(x-1), y*(y-1)]).dimension() # needs sage.libs.singular + sage: A.subscheme([x*(x-1), y*(y-1)]).dimension() 0 Something less obvious:: @@ -363,16 +364,17 @@ def intersection_multiplicity(self, X, P): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(a^6 - 3*a^5 + 5*a^4 - 5*a^3 + 5*a^2 - 3*a + 1) # needs sage.rings.number_field - sage: A. = AffineSpace(K, 4) # needs sage.rings.number_field - sage: X = A.subscheme([x*y, y*z + 7, w^3 - x^3]) # needs sage.rings.number_field - sage: Y = A.subscheme([x - z^3 + z + 1]) # needs sage.rings.number_field - sage: Q = A([0, # needs sage.rings.number_field + 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) # needs sage.rings.number_field + sage: X.intersection_multiplicity(Y, Q) 3 :: diff --git a/src/sage/schemes/curves/affine_curve.py b/src/sage/schemes/curves/affine_curve.py index 49421fbbd16..cd0f6e6b9a6 100644 --- a/src/sage/schemes/curves/affine_curve.py +++ b/src/sage/schemes/curves/affine_curve.py @@ -28,7 +28,6 @@ EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: k. = GF(2) sage: A. = AffineSpace(k, 3) sage: C = Curve([x^2 + x - y^3, y^4 - y - z^3], A) @@ -39,7 +38,7 @@ Closed points of arbitrary degree can be computed:: - sage: # long time, needs sage.rings.finite_rings + sage: # long time sage: C.closed_points() [Point (x, y, z), Point (x + 1, y, z)] sage: C.closed_points(2) @@ -53,12 +52,11 @@ The places at infinity correspond to the extra closed points of the curve's projective closure:: - sage: C.places_at_infinity() # long time # needs sage.rings.finite_rings + sage: C.places_at_infinity() # long time [Place (1/x, 1/x*z)] It is easy to transit to and from the function field of the curve:: - sage: # needs sage.rings.finite_rings sage: fx = C(x) sage: fy = C(y) sage: fx^2 + fx - fy^3 @@ -181,7 +179,7 @@ class AffineCurve(Curve_generic, AlgebraicScheme_subscheme_affine): :: sage: A. = AffineSpace(GF(7), 3) - sage: C = Curve([x^2 - z, z - 8*x], A); C # needs sage.rings.finite_rings + sage: C = Curve([x^2 - z, z - 8*x], A); C Affine Curve over Finite Field of size 7 defined by x^2 - z, -x + z """ def __init__(self, A, X): @@ -200,7 +198,7 @@ def __init__(self, A, X): :: sage: A. = AffineSpace(GF(7), 3) - sage: C = Curve([x^2 - z, z - 8*x], A); C # needs sage.rings.finite_rings + sage: C = Curve([x^2 - z, z - 8*x], A); C Affine Curve over Finite Field of size 7 defined by x^2 - z, -x + z """ if not is_AffineSpace(A): @@ -326,7 +324,6 @@ def divisor_of_function(self, r): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: F = GF(5) sage: P2 = AffineSpace(2, F, names='xy') sage: R = P2.coordinate_ring() @@ -381,7 +378,6 @@ def local_coordinates(self, pt, n): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: F = GF(5) sage: pt = (2,3) sage: R = PolynomialRing(F, 2, names = ['x','y']) @@ -501,13 +497,14 @@ def is_transverse(self, C, P): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(a^3 + 2) # needs sage.rings.number_field - sage: A. = AffineSpace(K, 2) # needs sage.rings.number_field - sage: C = A.curve([x*y]) # needs sage.rings.number_field - sage: D = A.curve([y - b*x]) # needs sage.rings.number_field - sage: Q = A([0,0]) # needs sage.rings.number_field - sage: C.is_transverse(D, Q) # needs sage.rings.number_field + 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) False :: @@ -614,30 +611,32 @@ def tangents(self, P, factor=True): EXAMPLES:: + sage: # needs sage.rings.number_field sage: set_verbose(-1) - sage: A. = AffineSpace(QQbar, 2) # needs 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 # needs sage.rings.number_field + 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]) # needs sage.rings.number_field - sage: C.tangents(Q) # needs sage.rings.number_field + 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) # needs sage.rings.number_field + sage: C.tangents(Q, factor=False) [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: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(a^2 - 3) # needs sage.rings.number_field - sage: A. = AffineSpace(K, 2) # needs sage.rings.number_field - sage: C = Curve([(x^2 + y^2 - 2*x)^2 - x^2 - y^2], A) # needs sage.rings.number_field - sage: Q = A([0,0]) # needs sage.rings.number_field - sage: C.tangents(Q) # needs sage.rings.number_field + 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) [x + (-1/3*b)*y, x + (1/3*b)*y] :: @@ -728,12 +727,13 @@ def is_ordinary_singularity(self, P): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(a^2 - 3) # needs sage.rings.number_field - sage: A. = AffineSpace(K, 2) # needs sage.rings.number_field - sage: C = Curve([(x^2 + y^2 - 2*x)^2 - x^2 - y^2], A) # needs sage.rings.number_field - sage: Q = A([0,0]) # needs sage.rings.number_field - sage: C.is_ordinary_singularity(Q) # needs sage.rings.number_field + 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) True :: @@ -920,13 +920,11 @@ def projection(self, indices, AS=None): :: - sage: # needs sage.rings.finite_rings 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: proj1 = C.projection([1,2,4], AS=B); proj1 (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 @@ -1062,13 +1060,14 @@ def plane_projection(self, AP=None): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(a^2 + 2) # needs sage.rings.number_field - sage: A. = AffineSpace(K, 3) # needs sage.rings.number_field - sage: C = A.curve([x - b, y - 2]) # needs sage.rings.number_field - sage: B. = AffineSpace(K, 2) # needs sage.rings.number_field - sage: proj1 = C.plane_projection(AP=B) # needs sage.rings.number_field - sage: proj1 # needs sage.rings.number_field + 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 (Scheme morphism: From: Affine Curve over Number Field in b with defining polynomial a^2 + 2 defined by x + (-b), y - 2 @@ -1078,10 +1077,10 @@ def plane_projection(self, AP=None): (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 # needs sage.rings.number_field + sage: proj1[1].ambient_space() is B True - sage: proj2 = C.plane_projection() # needs sage.rings.number_field - sage: proj2[1].ambient_space() is B # needs sage.rings.number_field + sage: proj2 = C.plane_projection() + sage: proj2[1].ambient_space() is B False """ n = self.ambient_space().dimension_relative() @@ -1461,11 +1460,12 @@ def resolution_of_singularities(self, extend=False): :: + sage: # needs sage.rings.number_field sage: set_verbose(-1) - sage: K. = QuadraticField(3) # needs sage.rings.number_field - sage: A. = AffineSpace(K, 2) # needs sage.rings.number_field - sage: C = A.curve(x^4 + 2*x^2 + a*y^3 + 1) # needs sage.rings.number_field - sage: C.resolution_of_singularities(extend=True)[0] # long time (2 s), needs sage.rings.number_field + 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 s) (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), @@ -1478,7 +1478,6 @@ def resolution_of_singularities(self, extend=False): :: - sage: # needs sage.rings.finite_rings 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() @@ -1871,7 +1870,6 @@ def riemann_roch_basis(self, D): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: R = PolynomialRing(GF(5), 2, names=["x","y"]) sage: x, y = R.gens() sage: f = y^2 - x^9 - x @@ -1923,7 +1921,6 @@ def rational_points(self, algorithm="enum"): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: x, y = (GF(5)['x,y']).gens() sage: f = y^2 - x^9 - x sage: C = Curve(f); C @@ -1936,7 +1933,6 @@ def rational_points(self, algorithm="enum"): We compare Brill-Noether and enumeration:: - sage: # needs sage.rings.finite_rings 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') @@ -1948,8 +1944,7 @@ def rational_points(self, algorithm="enum"): sage: # needs sage.rings.finite_rings sage: A. = AffineSpace(2, GF(9,'a')) - sage: C = Curve(x^2 + y^2 - 1) - sage: C + sage: C = Curve(x^2 + y^2 - 1); C Affine Plane Curve over Finite Field in a of size 3^2 defined by x^2 + y^2 - 1 sage: C.rational_points() @@ -2034,8 +2029,8 @@ def _genus(self): EXAMPLES:: sage: A. = AffineSpace(GF(2), 2) - sage: C = Curve(x^5 + y^5 + x*y + 1) # needs sage.rings.finite_rings - sage: C.genus() # indirect doctest # needs sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y + 1) + sage: C.genus() # indirect doctest 1 """ k = self.base_ring() @@ -2068,7 +2063,6 @@ def __call__(self, *args): :: - sage: # needs sage.rings.finite_rings 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]) @@ -2148,8 +2142,8 @@ 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) # needs sage.rings.finite_rings - sage: C._nonsingular_model # needs sage.rings.finite_rings + 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 @@ -2255,8 +2249,8 @@ 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) # needs sage.rings.finite_rings - sage: C._function_field # needs sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) + sage: C._function_field Function field in z defined by z^3 + 10*x """ return self._nonsingular_model[0] @@ -2269,8 +2263,8 @@ 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) # needs sage.rings.finite_rings - sage: C._lift_to_function_field # needs sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) + sage: C._lift_to_function_field Ring morphism: From: Multivariate Polynomial Ring in x, y, z over Finite Field of size 11 @@ -2289,8 +2283,8 @@ 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) # needs sage.rings.finite_rings - sage: C._coordinate_functions # needs sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) + sage: C._coordinate_functions [x, z^2, z] """ return self._nonsingular_model[1].im_gens() @@ -2352,8 +2346,8 @@ def singular_closed_points(self): :: sage: A. = AffineSpace(GF(11), 3) - sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # needs sage.rings.finite_rings - sage: C.singular_closed_points() # needs sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) + sage: C.singular_closed_points() [] """ return [p for p, _ in self._singularities] @@ -2464,8 +2458,8 @@ def places_at_infinity(self): :: sage: A. = AffineSpace(GF(11), 3) - sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # needs sage.rings.finite_rings - sage: C.places_at_infinity() # needs sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) + sage: C.places_at_infinity() [Place (1/x, 1/x*z^2)] """ return list(set(p for f in self._coordinate_functions if f for p in f.poles())) @@ -2589,10 +2583,10 @@ 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 # needs sage.rings.finite_rings + 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() # needs sage.rings.finite_rings + sage: C.function_field() Function field in z defined by z^3 + 10*x """ _point = IntegralAffineCurvePoint_finite_field @@ -2656,8 +2650,8 @@ def closed_points(self, degree=1): EXAMPLES:: sage: A. = AffineSpace(GF(7), 2) - sage: C = Curve(x^2 - x^4 - y^4) # needs sage.rings.finite_rings - sage: C.closed_points() # needs sage.rings.finite_rings + sage: C = Curve(x^2 - x^4 - y^4) + sage: C.closed_points() [Point (x, y), Point (x + 1, y), Point (x + 2, y + 2), diff --git a/src/sage/schemes/curves/closed_point.py b/src/sage/schemes/curves/closed_point.py index 808015db97d..0b5952559c1 100644 --- a/src/sage/schemes/curves/closed_point.py +++ b/src/sage/schemes/curves/closed_point.py @@ -9,7 +9,6 @@ EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: F. = GF(2) sage: P. = AffineSpace(F, 2) sage: C = Curve(y^2 + y - x^3) @@ -26,7 +25,6 @@ Closed points of projective curves are represented by homogeneous maximal ideals:: - sage: # needs sage.rings.finite_rings sage: F. = GF(2) sage: P. = ProjectiveSpace(F, 2) sage: C = Curve(x^3*y + y^3*z + x*z^3) @@ -46,7 +44,6 @@ Rational points are easily converted to closed points and vice versa if the closed point is of degree one:: - sage: # needs sage.rings.finite_rings sage: F. = GF(2) sage: P. = ProjectiveSpace(F, 2) sage: C = Curve(x^3*y + y^3*z + x*z^3) @@ -318,7 +315,6 @@ def projective(self, i=0): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: F. = GF(2) sage: A. = AffineSpace(F, 2) sage: C = Curve(y^2 + y - x^3, A) @@ -400,7 +396,6 @@ def affine(self, i=None): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: F. = GF(2) sage: P. = ProjectiveSpace(F, 2) sage: C = Curve(x^3*y + y^3*z + x*z^3) diff --git a/src/sage/schemes/curves/constructor.py b/src/sage/schemes/curves/constructor.py index 26ab59cecac..6fe15a2efc2 100644 --- a/src/sage/schemes/curves/constructor.py +++ b/src/sage/schemes/curves/constructor.py @@ -14,7 +14,7 @@ :: sage: P. = ProjectiveSpace(GF(5), 2) - sage: Curve(y^2*z^7 - x^9 - x*z^8) # needs 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 @@ -128,9 +128,9 @@ 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 # needs sage.rings.finite_rings + sage: C = Curve(y^2 + x^3 + x^10); C Affine Plane Curve over Finite Field of size 7 defined by x^10 + x^3 + y^2 - sage: C.genus() # needs sage.rings.finite_rings + sage: C.genus() 0 sage: x, y = QQ['x,y'].gens() sage: Curve(x^3 + y^3 + 1) @@ -208,7 +208,6 @@ def Curve(F, A=None): The defining polynomial must be nonzero unless the ambient space itself is of dimension 1. :: - sage: # needs sage.rings.finite_rings sage: P1. = ProjectiveSpace(1, GF(5)) sage: S = P1.coordinate_ring() sage: Curve(S(0), P1) diff --git a/src/sage/schemes/curves/curve.py b/src/sage/schemes/curves/curve.py index 99833c13829..0af6fff803b 100644 --- a/src/sage/schemes/curves/curve.py +++ b/src/sage/schemes/curves/curve.py @@ -217,7 +217,6 @@ def geometric_genus(self): Examples of projective curves. :: - sage: # needs sage.rings.finite_rings 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) @@ -232,7 +231,6 @@ def geometric_genus(self): Examples of affine curves. :: - sage: # needs sage.rings.finite_rings sage: x, y = PolynomialRing(GF(5), 2, 'xy').gens() sage: C = Curve(y^2 - x^3 - 17*x + y) sage: C.geometric_genus() @@ -326,13 +324,14 @@ def singular_points(self, F=None): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(a^8 - a^4 + 1) # needs sage.rings.number_field + 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 # needs 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 ....: + 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) # needs sage.rings.number_field + sage: sorted(C.singular_points(K), key=str) [(-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), @@ -376,7 +375,6 @@ def is_singular(self, P=None): :: - sage: # needs sage.rings.finite_rings sage: A. = AffineSpace(GF(11), 3) sage: C = A.curve([y^3 - z^5, x^5 - y + 1]) sage: Q = A([7,0,0]) @@ -410,7 +408,6 @@ def intersects_at(self, C, P): :: - sage: # needs sage.rings.finite_rings 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) @@ -456,18 +453,18 @@ def intersection_points(self, C, F=None): EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(a^2 + a + 1) # needs sage.rings.number_field + sage: K. = NumberField(a^2 + a + 1) sage: P. = ProjectiveSpace(QQ, 3) - sage: C = Curve([y^2 - w*z, w^3 - y^3], P) # needs sage.rings.number_field - sage: D = Curve([x*y - w*z, z^3 - y^3], P) # needs sage.rings.number_field - sage: C.intersection_points(D, F=K) # needs sage.rings.number_field + 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: # needs sage.rings.finite_rings 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) @@ -518,13 +515,14 @@ def change_ring(self, R): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(a^3 + a^2 - 1) # needs sage.rings.number_field - sage: A. = AffineSpace(K, 2) # needs sage.rings.number_field - sage: C = Curve([K.0*x^2 - x + y^3 - 11], A) # needs sage.rings.number_field - sage: L = K.embeddings(QQbar) # needs sage.rings.number_field + 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: set_verbose(-1) # suppress warnings for slow computation - sage: C.change_ring(L[0]) # needs sage.rings.number_field + 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 @@ -532,7 +530,7 @@ def change_ring(self, R): sage: P. = ProjectiveSpace(QQ, 2) sage: C = P.curve([y*x - 18*x^2 + 17*z^2]) - sage: C.change_ring(GF(17)) # needs sage.rings.finite_rings + sage: C.change_ring(GF(17)) 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 1e60b3d9e1c..dcc78724497 100644 --- a/src/sage/schemes/curves/point.py +++ b/src/sage/schemes/curves/point.py @@ -13,7 +13,6 @@ or on affine curves:: - sage: # needs sage.rings.finite_rings sage: A. = AffineSpace(GF(23), 2) sage: C = Curve([y - y^4 + 17*x^2 - 2*x + 22], A) sage: Q = C([22,21]) @@ -73,7 +72,6 @@ def multiplicity(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: P. = ProjectiveSpace(GF(17), 2) sage: C = Curve([y^3*z - 16*x^4], P) sage: Q = C([0,0,1]) @@ -116,15 +114,16 @@ def is_ordinary_singularity(self): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(a^2 - 3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs 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 - # needs sage.rings.number_field + 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 = C([-1/2, 1/2, 1]) # needs sage.rings.number_field - sage: Q.is_ordinary_singularity() # needs sage.rings.number_field + sage: Q = C([-1/2, 1/2, 1]) + sage: Q.is_ordinary_singularity() True """ return self.codomain().is_ordinary_singularity(self) @@ -149,7 +148,6 @@ def is_transverse(self, D): :: - sage: # needs sage.rings.finite_rings sage: P. = ProjectiveSpace(GF(17), 2) sage: C = Curve([x^4 - 16*y^3*z], P) sage: D = Curve([y^2 - z*x], P) @@ -175,7 +173,6 @@ def closed_point(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: P. = ProjectiveSpace(GF(17), 2) sage: C = Curve([x^4 - 16*y^3*z], P) sage: C.singular_points() @@ -204,7 +201,6 @@ def places(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: P. = ProjectiveSpace(GF(17), 2) sage: C = Curve([x^4 - 16*y^3*z], P) sage: C.singular_points() @@ -221,7 +217,6 @@ def place(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: P. = ProjectiveSpace(GF(17), 2) sage: C = Curve([x^4 - 16*y^3*z], P) sage: C.singular_points() @@ -334,7 +329,6 @@ def is_ordinary_singularity(self): :: - sage: # needs sage.rings.finite_rings sage: A. = AffineSpace(GF(7), 2) sage: C = A.curve([y^2 - x^7 - 6*x^3]) sage: Q = C([0,0]) @@ -363,13 +357,14 @@ def is_transverse(self, D): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(a^2 - 2) # needs sage.rings.number_field - sage: A. = AffineSpace(K, 2) # needs sage.rings.number_field - sage: C = Curve([y^2 + x^2 - 1], A) # needs sage.rings.number_field - sage: D = Curve([y - x], A) # needs sage.rings.number_field - sage: Q = C([-1/2*b, -1/2*b]) # needs sage.rings.number_field - sage: Q.is_transverse(D) # needs sage.rings.number_field + 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) True """ return self.codomain().is_transverse(D, self) @@ -412,7 +407,6 @@ def places(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: A. = AffineSpace(GF(2), 2) sage: C = Curve(x^5 + y^5 + x*y + 1) sage: p = C(-1,-1) @@ -434,7 +428,6 @@ def place(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: A. = AffineSpace(GF(2), 2) sage: C = Curve(x^5 + y^5 + x*y + 1) sage: p = C(-1,-1) diff --git a/src/sage/schemes/curves/projective_curve.py b/src/sage/schemes/curves/projective_curve.py index a4e0d9406d2..aa3b4aa9a2a 100644 --- a/src/sage/schemes/curves/projective_curve.py +++ b/src/sage/schemes/curves/projective_curve.py @@ -30,25 +30,24 @@ sage: k = GF(2) sage: P. = ProjectiveSpace(k, 2) - sage: C = Curve(x^2*z - y^3, P) # needs sage.rings.finite_rings - sage: C.genus() # needs sage.rings.finite_rings + sage: C = Curve(x^2*z - y^3, P) + sage: C.genus() 0 - sage: C.function_field() # needs sage.rings.finite_rings + sage: C.function_field() Function field in z defined by z + y^3 Closed points of arbitrary degree can be computed:: - sage: C.closed_points() # needs sage.rings.finite_rings + sage: C.closed_points() [Point (x, y), Point (y, z), Point (x + z, y + z)] - sage: C.closed_points(2) # needs sage.rings.finite_rings + sage: C.closed_points(2) [Point (y^2 + y*z + z^2, x + z)] - sage: C.closed_points(3) # needs sage.rings.finite_rings + sage: C.closed_points(3) [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: # needs sage.rings.finite_rings sage: C.singular_closed_points() [Point (x, y)] sage: p = _[0] @@ -60,7 +59,6 @@ It is easy to transit to and from the function field of the curve:: - sage: # needs sage.rings.finite_rings sage: fx = C(x/z) sage: fy = C(y/z) sage: fx^2 - fy^3 @@ -192,7 +190,7 @@ 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 # needs 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 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 @@ -343,9 +341,9 @@ def projection(self, P=None, PS=None): :: sage: P. = ProjectiveSpace(GF(2), 3) - sage: C = P.curve([(x - y)*(x - z)*(x - w)*(y - z)*(y - w), # needs sage.rings.finite_rings + 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() # needs sage.rings.finite_rings + sage: C.projection() Traceback (most recent call last): ... NotImplementedError: this curve contains all points of its ambient space @@ -353,9 +351,9 @@ def projection(self, P=None, PS=None): :: 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]) # needs 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]) sage: L. = ProjectiveSpace(GF(7), 3) - sage: C.projection(PS=L) # needs sage.rings.finite_rings + sage: C.projection(PS=L) (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 @@ -365,7 +363,7 @@ def projection(self, P=None, PS=None): 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) # needs sage.rings.finite_rings + sage: C.projection(PS=Q) Traceback (most recent call last): ... TypeError: (=Projective Space of dimension 2 over Finite Field of @@ -538,8 +536,8 @@ 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]) # needs sage.rings.finite_rings - sage: C.plane_projection() # needs 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]) + sage: C.plane_projection() (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 @@ -553,8 +551,8 @@ def plane_projection(self, PP=None): :: sage: P. = ProjectiveSpace(GF(17), 2) - sage: C = P.curve(x^2 - y*z - z^2) # needs sage.rings.finite_rings - sage: C.plane_projection() # needs sage.rings.finite_rings + sage: C = P.curve(x^2 - y*z - z^2) + sage: C.plane_projection() Traceback (most recent call last): ... TypeError: this curve is already a plane curve @@ -653,13 +651,13 @@ def divisor_of_function(self, r): 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) # needs sage.rings.finite_rings + sage: C = Curve(f) sage: K = FractionField(R) sage: r = 1/x - sage: C.divisor_of_function(r) # not implemented # needs sage.rings.finite_rings + sage: C.divisor_of_function(r) # not implemented [[-1, (0, 0, 1)]] sage: r = 1/x^3 - sage: C.divisor_of_function(r) # not implemented # needs sage.rings.finite_rings + sage: C.divisor_of_function(r) # not implemented [[-3, (0, 0, 1)]] """ F = self.base_ring() @@ -697,9 +695,9 @@ def local_coordinates(self, pt, n): 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) # needs sage.rings.finite_rings - sage: pt = C([2,3,1]) # needs sage.rings.finite_rings - sage: C.local_coordinates(pt,9) # not implemented # needs sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) + sage: pt = C([2,3,1]) + sage: C.local_coordinates(pt,9) # 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] """ @@ -786,7 +784,7 @@ def plot(self, *args, **kwds): An elliptic curve:: sage: E = EllipticCurve('101a') - sage: C = Curve(E) # needs sage.rings.number_field + sage: C = Curve(E) sage: C.plot() # needs sage.plot Graphics object consisting of 1 graphics primitive sage: C.plot(patch=0) # needs sage.plot @@ -844,17 +842,17 @@ def is_singular(self, P=None): sage: F = GF(19) sage: P2. = ProjectiveSpace(F, 2) - sage: C = Curve(X^3 + Y^3 + Z^3) # needs sage.rings.finite_rings - sage: C.is_singular() # needs sage.rings.finite_rings + sage: C = Curve(X^3 + Y^3 + Z^3) + sage: C.is_singular() False - sage: D = Curve(X^4 - X*Z^3) # needs sage.rings.finite_rings - sage: D.is_singular() # needs sage.rings.finite_rings + sage: D = Curve(X^4 - X*Z^3) + sage: D.is_singular() True - sage: E = Curve(X^5 + 19*Y^5 + Z^5) # needs sage.rings.finite_rings - sage: E.is_singular() # needs sage.rings.finite_rings + sage: E = Curve(X^5 + 19*Y^5 + Z^5) + sage: E.is_singular() True - sage: E = Curve(X^5 + 9*Y^5 + Z^5) # needs sage.rings.finite_rings - sage: E.is_singular() # needs sage.rings.finite_rings + sage: E = Curve(X^5 + 9*Y^5 + Z^5) + sage: E.is_singular() False Over `\CC`:: @@ -875,7 +873,7 @@ def is_singular(self, P=None): sage: F. = GF(2)[] sage: G = Curve(X^2 + Y*Z) - sage: G.is_singular() # needs sage.rings.finite_rings + sage: G.is_singular() False :: @@ -932,16 +930,17 @@ def tangents(self, P, factor=True): EXAMPLES:: + sage: # needs sage.rings.number_field sage: set_verbose(-1) - sage: P. = ProjectiveSpace(QQbar, 2) # needs sage.rings.number_field - sage: C = Curve([x^3*y + 2*x^2*y^2 + x*y^3 + x^3*z # needs sage.rings.number_field + 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]) # needs sage.rings.number_field - sage: C.tangents(Q) # needs sage.rings.number_field + 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) # needs sage.rings.number_field + sage: C.tangents(Q, factor=False) [6*x^3 + 42*x^2*y + 84*x*y^2 + 54*y^3] :: @@ -1012,16 +1011,17 @@ def is_ordinary_singularity(self, P): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(a^2 - 3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs 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 # needs sage.rings.number_field + 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) # needs sage.rings.number_field + sage: C.is_ordinary_singularity(Q) True :: @@ -1075,8 +1075,8 @@ def quadratic_transform(self): :: sage: P. = ProjectiveSpace(GF(17), 2) - sage: C = P.curve([y^7*z^2 - 16*x^9 + x*y*z^7 + 2*z^9]) # needs sage.rings.finite_rings - sage: C.quadratic_transform() # needs 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 @@ -1140,16 +1140,17 @@ def excellent_position(self, Q): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(a^2 - 3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs 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 # needs sage.rings.number_field + 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) # needs sage.rings.number_field + sage: C.excellent_position(Q) Scheme morphism: From: Projective Plane Curve over Number Field in b with defining polynomial a^2 - 3 @@ -1178,13 +1179,14 @@ def excellent_position(self, Q): :: + sage: # needs sage.rings.number_field sage.symbolic sage: set_verbose(-1) - sage: a = QQbar(sqrt(2)) # needs sage.rings.number_field sage.symbolic - sage: P. = ProjectiveSpace(QQbar, 2) # needs sage.rings.number_field - sage: C = Curve([(-1/4*a)*x^3 + (-3/4*a)*x^2*y # needs sage.rings.number_field sage.symbolic + 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) # needs sage.rings.number_field sage.symbolic + sage: C.excellent_position(Q) Scheme morphism: From: Projective Plane Curve over Algebraic Field defined by (-0.3535533905932738?)*x^3 + (-1.060660171779822?)*x^2*y @@ -1335,11 +1337,12 @@ def ordinary_model(self): EXAMPLES:: + sage: # needs sage.rings.number_field sage: set_verbose(-1) - sage: K = QuadraticField(3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field - sage: C = Curve([x^5 - K.0*y*z^4], P) # needs sage.rings.number_field - sage: C.ordinary_model() # needs sage.rings.number_field + sage: K = QuadraticField(3) + sage: P. = ProjectiveSpace(K, 2) + sage: C = Curve([x^5 - K.0*y*z^4], P) + sage: C.ordinary_model() Scheme morphism: From: Projective Plane Curve over Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? @@ -1537,12 +1540,13 @@ def is_transverse(self, C, P): :: - sage: K = QuadraticField(-1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field - sage: C = Curve([y^2*z - K.0*x^3], P) # needs sage.rings.number_field - sage: D = Curve([z*x + y^2], P) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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) # needs sage.rings.number_field + sage: C.is_transverse(D, Q) False :: @@ -1603,8 +1607,8 @@ 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]) # needs sage.rings.finite_rings - sage: C.arithmetic_genus() # needs sage.rings.finite_rings + sage: C = P.curve([t^3 - x*y*w, x^3 + y^3 + z^3, z - w]) + sage: C.arithmetic_genus() 10 """ if not self.is_irreducible(): @@ -1685,12 +1689,12 @@ 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 # needs sage.rings.finite_rings + 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() # needs sage.rings.finite_rings + sage: C.arithmetic_genus() 28 - sage: C.genus() # needs sage.rings.finite_rings + sage: C.genus() 4 :: @@ -1807,7 +1811,7 @@ def rational_parameterization(self): sage: P. = ProjectiveSpace(QQ, 2) sage: C = Curve([x^2 + y^2 + z^2], P) - sage: C.rational_parameterization() # needs sage.rings.number_field + sage: C.rational_parameterization() Scheme morphism: From: Projective Space of dimension 1 over Number Field in a with defining polynomial a^2 + 1 @@ -1869,60 +1873,61 @@ def rational_points_iterator(self): sage: F = GF(37) sage: P2. = ProjectiveSpace(F, 2) - sage: C = Curve(X^7 + Y*X*Z^5*55 + Y^7*12) # needs sage.rings.finite_rings - sage: len(list(C.rational_points_iterator())) # needs sage.rings.finite_rings + sage: C = Curve(X^7 + Y*X*Z^5*55 + Y^7*12) + sage: len(list(C.rational_points_iterator())) 37 :: sage: F = GF(2) sage: P2. = ProjectiveSpace(F, 2) - sage: C = Curve(X*Y*Z) # needs sage.rings.finite_rings - sage: a = C.rational_points_iterator() # needs sage.rings.finite_rings - sage: next(a) # needs sage.rings.finite_rings + sage: C = Curve(X*Y*Z) + sage: a = C.rational_points_iterator() + sage: next(a) (1 : 0 : 0) - sage: next(a) # needs sage.rings.finite_rings + sage: next(a) (0 : 1 : 0) - sage: next(a) # needs sage.rings.finite_rings + sage: next(a) (1 : 1 : 0) - sage: next(a) # needs sage.rings.finite_rings + sage: next(a) (0 : 0 : 1) - sage: next(a) # needs sage.rings.finite_rings + sage: next(a) (1 : 0 : 1) - sage: next(a) # needs sage.rings.finite_rings + sage: next(a) (0 : 1 : 1) - sage: next(a) # needs sage.rings.finite_rings + sage: next(a) Traceback (most recent call last): ... StopIteration :: - sage: F = GF(3^2,'a') # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(3^2,'a') sage: P2. = ProjectiveSpace(F, 2) - sage: C = Curve(X^3 + 5*Y^2*Z - 33*X*Y*X) # needs sage.rings.finite_rings - sage: b = C.rational_points_iterator() # needs sage.rings.finite_rings - sage: next(b) # needs sage.rings.finite_rings + sage: C = Curve(X^3 + 5*Y^2*Z - 33*X*Y*X) + sage: b = C.rational_points_iterator() + sage: next(b) (0 : 1 : 0) - sage: next(b) # needs sage.rings.finite_rings + sage: next(b) (0 : 0 : 1) - sage: next(b) # needs sage.rings.finite_rings + sage: next(b) (2*a + 2 : a : 1) - sage: next(b) # needs sage.rings.finite_rings + sage: next(b) (2 : a + 1 : 1) - sage: next(b) # needs sage.rings.finite_rings + sage: next(b) (a + 1 : 2*a + 1 : 1) - sage: next(b) # needs sage.rings.finite_rings + sage: next(b) (1 : 2 : 1) - sage: next(b) # needs sage.rings.finite_rings + sage: next(b) (2*a + 2 : 2*a : 1) - sage: next(b) # needs sage.rings.finite_rings + sage: next(b) (2 : 2*a + 2 : 1) - sage: next(b) # needs sage.rings.finite_rings + sage: next(b) (a + 1 : a + 2 : 1) - sage: next(b) # needs sage.rings.finite_rings + sage: next(b) (1 : 1 : 1) - sage: next(b) # needs sage.rings.finite_rings + sage: next(b) Traceback (most recent call last): ... StopIteration @@ -1979,13 +1984,13 @@ def _points_via_singular(self, sort=True): 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 # needs sage.rings.finite_rings + 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._points_via_singular() # needs sage.rings.finite_rings + sage: C._points_via_singular() [(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 # needs sage.rings.finite_rings + sage: C._points_via_singular(sort=False) # random [(0 : 1 : 0), (3 : 1 : 1), (3 : 4 : 1), (2 : 2 : 1), (0 : 0 : 1), (2 : 3 : 1)] @@ -2049,18 +2054,18 @@ def riemann_roch_basis(self, D): sage: R. = GF(2)[] sage: f = x^3*y + y^3*z + x*z^3 - sage: C = Curve(f); pts = C.rational_points() # needs sage.rings.finite_rings - sage: D = C.divisor([ (4, pts[0]), (4, pts[2]) ]) # needs sage.rings.finite_rings - sage: C.riemann_roch_basis(D) # needs sage.rings.finite_rings + sage: C = Curve(f); pts = C.rational_points() + sage: D = C.divisor([ (4, pts[0]), (4, pts[2]) ]) + sage: C.riemann_roch_basis(D) [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() # needs sage.rings.finite_rings - sage: D = C.divisor([ (3, pts[0]), (-1,pts[1]), (10, pts[5]) ]) # needs sage.rings.finite_rings - sage: C.riemann_roch_basis(D) # needs sage.rings.finite_rings + 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) [(-2*x + y)/(x + y), (-x + z)/(x + y)] .. NOTE:: @@ -2140,18 +2145,18 @@ def rational_points(self, algorithm="enum", sort=True): 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 # needs sage.rings.finite_rings + 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() # needs sage.rings.finite_rings + sage: C.rational_points() [(0 : 0 : 1), (0 : 1 : 0), (2 : 2 : 1), (2 : 3 : 1), (3 : 1 : 1), (3 : 4 : 1)] - sage: C = Curve(x - y + z) # needs sage.rings.finite_rings - sage: C.rational_points() # needs sage.rings.finite_rings + sage: C = Curve(x - y + z) + sage: C.rational_points() [(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') # needs sage.rings.finite_rings + sage: C.rational_points('all') [(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)] @@ -2160,17 +2165,17 @@ def rational_points(self, algorithm="enum", sort=True): sage: F = GF(7) sage: P2. = ProjectiveSpace(F, 2) - sage: C = Curve(X^3 + Y^3 - Z^3) # needs sage.rings.finite_rings - sage: C.rational_points() # needs sage.rings.finite_rings + sage: C = Curve(X^3 + Y^3 - Z^3) + sage: C.rational_points() [(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) # needs sage.rings.finite_rings + sage: F = GF(1237) sage: P2. = ProjectiveSpace(F, 2) - sage: C = Curve(X^7 + 7*Y^6*Z + Z^4*X^2*Y*89) # needs sage.rings.finite_rings - sage: len(C.rational_points()) # needs sage.rings.finite_rings + sage: C = Curve(X^7 + 7*Y^6*Z + Z^4*X^2*Y*89) + sage: len(C.rational_points()) 1237 :: @@ -2185,8 +2190,8 @@ def rational_points(self, algorithm="enum", sort=True): sage: R. = GF(2)[] sage: f = x^3*y + y^3*z + x*z^3 - sage: C = Curve(f); pts = C.rational_points() # needs sage.rings.finite_rings - sage: pts # needs sage.rings.finite_rings + sage: C = Curve(f); pts = C.rational_points() + sage: pts [(0 : 0 : 1), (0 : 1 : 0), (1 : 0 : 0)] """ @@ -2229,8 +2234,8 @@ def __init__(self, A, f): TESTS:: sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings - sage: loads(dumps(C)) == C # needs sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) + sage: loads(dumps(C)) == C True """ super().__init__(A, f) @@ -2363,8 +2368,8 @@ def _function_field(self): TESTS:: sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings - sage: C._function_field # needs sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) + sage: C._function_field Function field in z defined by z^8 + 4*y^2*z^7 + 1 """ return self._open_affine._function_field @@ -2377,8 +2382,8 @@ 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) # needs sage.rings.finite_rings - sage: C._lift_to_function_field # needs sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) + sage: C._lift_to_function_field 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 @@ -2398,8 +2403,8 @@ def _coordinate_functions(self): TESTS:: sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings - sage: C._coordinate_functions # needs sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) + sage: C._coordinate_functions (1, y, z) """ # homogeneous coordinate functions @@ -2415,11 +2420,11 @@ def _singularities(self): TESTS:: sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings - sage: C._singularities # needs sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) + sage: C._singularities [(Point (x, z), [Place (1/y, 1/y*z^5 + 4*y*z^4 + 1/y^2*z)])] - sage: D = Curve(x) # needs sage.rings.finite_rings - sage: D._singularities # needs sage.rings.finite_rings + sage: D = Curve(x) + sage: D._singularities [] """ @@ -2475,8 +2480,8 @@ def singular_closed_points(self): :: sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings - sage: C.singular_closed_points() # needs sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) + sage: C.singular_closed_points() [Point (x, z)] """ return [p[0] for p in self._singularities] @@ -2493,12 +2498,12 @@ 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) # needs sage.rings.finite_rings - sage: pls = C.places() # needs sage.rings.finite_rings - sage: C.place_to_closed_point(pls[-1]) # needs sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) + sage: pls = C.places() + sage: C.place_to_closed_point(pls[-1]) Point (x - 2*z, y - 2*z) - sage: pls2 = C.places(2) # needs sage.rings.finite_rings - sage: C.place_to_closed_point(pls2[0]) # needs sage.rings.finite_rings + sage: pls2 = C.places(2) + sage: C.place_to_closed_point(pls2[0]) Point (y^2 + y*z + z^2, x + y) """ F = self.function_field() @@ -2593,8 +2598,8 @@ def places_on(self, point): :: sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(x^2*z - y^3) # needs sage.rings.finite_rings - sage: [C.places_on(p) for p in C.closed_points()] # needs sage.rings.finite_rings + sage: C = Curve(x^2*z - y^3) + sage: [C.places_on(p) for p in C.closed_points()] [[Place (1/y)], [Place (y)], [Place (y + 1)], @@ -2635,10 +2640,10 @@ class IntegralProjectiveCurve_finite_field(IntegralProjectiveCurve): EXAMPLES:: sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # needs sage.rings.finite_rings - sage: C.function_field() # needs sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) + sage: C.function_field() Function field in z defined by z^8 + 4*y^2*z^7 + 1 - sage: C.closed_points() # needs sage.rings.finite_rings + sage: C.closed_points() [Point (x, z), Point (x, y), Point (x - 2*z, y + 2*z), @@ -2659,15 +2664,15 @@ def places(self, degree=1): EXAMPLES:: sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(x^2*z - y^3) # needs sage.rings.finite_rings - sage: C.places() # needs sage.rings.finite_rings + sage: C = Curve(x^2*z - y^3) + sage: C.places() [Place (1/y), Place (y), Place (y + 1), Place (y + 2), Place (y + 3), Place (y + 4)] - sage: C.places(2) # needs sage.rings.finite_rings + sage: C.places(2) [Place (y^2 + 2), Place (y^2 + 3), Place (y^2 + y + 1), @@ -2741,9 +2746,9 @@ 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) # needs sage.rings.finite_rings - sage: Cbar = C.projective_closure() # needs sage.rings.finite_rings - sage: Cbar.L_polynomial() # needs sage.rings.finite_rings + sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x - 2) + sage: Cbar = C.projective_closure() + sage: Cbar.L_polynomial() 9*t^4 - 3*t^3 + t^2 - t + 1 """ @@ -2773,14 +2778,14 @@ 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) # needs sage.rings.finite_rings - sage: Cbar = C.projective_closure() # needs sage.rings.finite_rings - sage: Cbar.number_of_rational_points(3) # needs sage.rings.finite_rings + 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) 21 - sage: D = Cbar.change_ring(Cbar.base_ring().extension(3)) # needs sage.rings.finite_rings - sage: D.base_ring() # needs sage.rings.finite_rings + sage: D = Cbar.change_ring(Cbar.base_ring().extension(3)) + sage: D.base_ring() Finite Field in z3 of size 3^3 - sage: len(D.closed_points()) # needs sage.rings.finite_rings + sage: len(D.closed_points()) 21 """ diff --git a/src/sage/schemes/cyclic_covers/cycliccover_generic.py b/src/sage/schemes/cyclic_covers/cycliccover_generic.py index b6ce2bc596d..9bca8814dad 100644 --- a/src/sage/schemes/cyclic_covers/cycliccover_generic.py +++ b/src/sage/schemes/cyclic_covers/cycliccover_generic.py @@ -12,12 +12,11 @@ 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)) # needs sage.rings.finite_rings + 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. - sage: # needs sage.rings.finite_rings sage: GF7x. = GF(7)[] sage: C = CyclicCover(3, x^9 + x + 1) sage: C @@ -72,14 +71,13 @@ 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)) # needs sage.rings.finite_rings + 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. - sage: # needs sage.rings.finite_rings sage: GF7x. = GF(7)[] sage: C = CyclicCover(3, x^9 + x + 1) sage: C @@ -117,17 +115,17 @@ def change_ring(self, R): sage: ZZx. = ZZ[] sage: C = CyclicCover(5, x^5 + x + 1) - sage: C.change_ring(GF(5)) # needs sage.rings.finite_rings + 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. - sage: C.change_ring(GF(3)) # needs sage.rings.finite_rings + sage: C.change_ring(GF(3)) 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)) # needs sage.rings.finite_rings + sage: C.change_ring(GF(17)) Cyclic Cover of P^1 over Finite Field of size 17 defined by y^5 = x^5 + x + 1 """ from .constructor import CyclicCover @@ -243,8 +241,8 @@ def projective_closure(self, **kwds): EXAMPLES:: - sage: GF7x. = GF(7)[] # needs sage.rings.finite_rings - sage: CyclicCover(3, x^9 + x + 1).projective_closure() # needs sage.rings.finite_rings + sage: GF7x. = GF(7)[] + sage: CyclicCover(3, x^9 + x + 1).projective_closure() Traceback (most recent call last): ... NotImplementedError: Weighted Projective Space is not implemented diff --git a/src/sage/schemes/elliptic_curves/Qcurves.py b/src/sage/schemes/elliptic_curves/Qcurves.py index e0b30169562..45fb5c51293 100644 --- a/src/sage/schemes/elliptic_curves/Qcurves.py +++ b/src/sage/schemes/elliptic_curves/Qcurves.py @@ -508,32 +508,33 @@ def conjugacy_test(jlist, verbose=False): EXAMPLES:: + sage: # needs sage.rings.number_field sage: from sage.schemes.elliptic_curves.Qcurves import conjugacy_test sage: conjugacy_test([3]) [x - 3] - sage: K. = QuadraticField(2) # needs sage.rings.number_field - sage: conjugacy_test([K(3), a]) # needs sage.rings.number_field + sage: K. = QuadraticField(2) + sage: conjugacy_test([K(3), a]) [x - 3] - sage: conjugacy_test([K(3), 3 + a]) # needs sage.rings.number_field + sage: conjugacy_test([K(3), 3 + a]) [x - 3] - sage: conjugacy_test([3 + a]) # needs sage.rings.number_field + sage: conjugacy_test([3 + a]) [] - sage: conjugacy_test([3 + a, 3 - a]) # needs sage.rings.number_field + sage: conjugacy_test([3 + a, 3 - a]) [x^2 - 6*x + 7] sage: x = polygen(QQ) sage: f = x^3 - 3 - sage: K. = f.splitting_field() # needs sage.rings.number_field - sage: js = f.roots(K, multiplicities=False) # needs sage.rings.number_field - sage: conjugacy_test(js) # needs sage.rings.number_field + sage: K. = f.splitting_field() + sage: js = f.roots(K, multiplicities=False) + sage: conjugacy_test(js) [] sage: f = x^4 - 3 - sage: K. = NumberField(f) # needs sage.rings.number_field - sage: js = f.roots(K, multiplicities=False) # needs sage.rings.number_field - sage: conjugacy_test(js) # needs sage.rings.number_field + sage: K. = NumberField(f) + sage: js = f.roots(K, multiplicities=False) + sage: conjugacy_test(js) [] - sage: K. = f.splitting_field() # needs sage.rings.number_field - sage: js = f.roots(K, multiplicities=False) # needs sage.rings.number_field - sage: conjugacy_test(js) # needs sage.rings.number_field + sage: K. = f.splitting_field() + sage: js = f.roots(K, multiplicities=False) + sage: conjugacy_test(js) [x^4 - 3] """ from sage.sets.set import Set diff --git a/src/sage/schemes/elliptic_curves/constructor.py b/src/sage/schemes/elliptic_curves/constructor.py index 8e8dedab3d3..e7a1767cecb 100644 --- a/src/sage/schemes/elliptic_curves/constructor.py +++ b/src/sage/schemes/elliptic_curves/constructor.py @@ -390,17 +390,18 @@ def create_key_and_extra_args(self, x=None, y=None, j=None, minimal_twist=True, TESTS:: - sage: var('x', 'y', 'v', 'w') # needs sage.symbolic + sage: # needs sage.symbolic + sage: var('x', 'y', 'v', 'w') (x, y, v, w) - sage: EllipticCurve(y^2 + y > x^3 + x - 9) # needs sage.symbolic + sage: EllipticCurve(y^2 + y > x^3 + x - 9) Traceback (most recent call last): ... ValueError: no symbolic relations other than equalities are allowed - sage: E = EllipticCurve(y^2 + y == x^3 + x - 9) # needs sage.symbolic - sage: E is EllipticCurve(y^2 + y - ( x^3 + x - 9 )) # needs sage.symbolic + sage: E = EllipticCurve(y^2 + y == x^3 + x - 9) + sage: E is EllipticCurve(y^2 + y - ( x^3 + x - 9 )) True sage: R. = QQ[] - sage: E is EllipticCurve(y^2 + y - ( x^3 + x - 9 )) # needs sage.symbolic + sage: E is EllipticCurve(y^2 + y - ( x^3 + x - 9 )) True """ R = None @@ -1020,7 +1021,6 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): An example over a finite field, using a flex:: - sage: # needs sage.rings.finite_rings sage: K = GF(17) sage: R. = K[] sage: cubic = 2*x^3 + 3*y^3 + 4*z^3 @@ -1034,7 +1034,6 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): An example in characteristic 3:: - sage: # needs sage.rings.finite_rings sage: K = GF(3) sage: R. = K[] sage: cubic = x^3 + y^3 + z^3 + x*y*z diff --git a/src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx b/src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx index 1cc6a8f866b..458ce65a61d 100644 --- a/src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx +++ b/src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx @@ -1151,14 +1151,16 @@ def two_descent_by_two_isogeny(E, sage: n1, n2, n1_prime, n2_prime = two_descent_by_two_isogeny(E) sage: log(n1,2) + log(n1_prime,2) - 2 # the rank 1 - sage: x,y = var('x,y') # needs sage.symbolic - sage: E = EllipticCurve(y^2 == x^3 + x^2 - 25*x + 39) # needs sage.symbolic - sage: n1, n2, n1_prime, n2_prime = two_descent_by_two_isogeny(E) # needs sage.symbolic - sage: log(n1,2) + log(n1_prime,2) - 2 # the rank # needs sage.symbolic + + sage: # needs sage.symbolic + sage: x,y = var('x,y') + sage: E = EllipticCurve(y^2 == x^3 + x^2 - 25*x + 39) + sage: n1, n2, n1_prime, n2_prime = two_descent_by_two_isogeny(E) + sage: log(n1,2) + log(n1_prime,2) - 2 # the rank 2 - sage: E = EllipticCurve(y^2 + x*y + y == x^3 - 131*x + 558) # needs sage.symbolic - sage: n1, n2, n1_prime, n2_prime = two_descent_by_two_isogeny(E) # needs sage.symbolic - sage: log(n1,2) + log(n1_prime,2) - 2 # the rank # needs sage.symbolic + sage: E = EllipticCurve(y^2 + x*y + y == x^3 - 131*x + 558) + sage: n1, n2, n1_prime, n2_prime = two_descent_by_two_isogeny(E) + sage: log(n1,2) + log(n1_prime,2) - 2 # the rank 3 Using the verbosity option:: diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index b0a9d01b2d4..ea3f8c11485 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -112,7 +112,6 @@ def quadratic_twist(self, D=None): A characteristic 2 example:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(2), [1,0,1,1,1]) sage: E1 = E.quadratic_twist(1) sage: E.is_isomorphic(E1) @@ -574,7 +573,6 @@ def is_sextic_twist(self, other): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve_from_j(GF(13)(0)) sage: E1 = E.sextic_twist(2) sage: D = E.is_sextic_twist(E1); D != 0 @@ -1228,7 +1226,7 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al 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]) # needs sage.rings.finite_rings + sage: phi = E.isogeny([14,27,4,1]) Traceback (most recent call last): ... ValueError: the polynomial x^3 + 4*x^2 + 27*x + 14 does not define a finite @@ -1262,7 +1260,7 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al We check that the cached order is correctly copied over:: sage: # needs sage.rings.finite_rings - sage: E = EllipticCurve(GF(2^127-1), [1,2,3,4,5]) + 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 @@ -1514,7 +1512,6 @@ def isogenies_prime_degree(self, l=None, max_l=31): An example over a rational function field:: - sage: # needs sage.rings.finite_rings sage: R. = GF(5)[] sage: K = R.fraction_field() sage: E = EllipticCurve(K, [1, t^5]) @@ -1900,8 +1897,8 @@ class of curves. If the j-invariant is not unique in the isogeny Curve over a quadratic number field:: - sage: # needs sage.graphs sage.rings.finite_rings sage.rings.number_field - sage: K. = NumberField(x^2 - 2) + sage: # needs sage.graphs sage.rings.number_field + sage: K. = NumberField(x^2 - 2) # needs sage.rings.finite_rings sage: E = EllipticCurve(K, [1, 0, 1, 4, -6]) sage: G2 = E.isogeny_ell_graph(2, directed=False) sage: G2.vertices(sort=True) @@ -1929,7 +1926,6 @@ class of curves. If the j-invariant is not unique in the isogeny TESTS:: - sage: # needs sage.graphs sage.rings.finite_rings sage: E = EllipticCurve(GF(11), j=0) sage: G0 = E.isogeny_ell_graph(2, directed=False) sage: G0.is_directed() diff --git a/src/sage/schemes/elliptic_curves/ell_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py index 06185ef72e7..8e7fb204892 100644 --- a/src/sage/schemes/elliptic_curves/ell_generic.py +++ b/src/sage/schemes/elliptic_curves/ell_generic.py @@ -321,19 +321,20 @@ def _magma_init_(self, magma): EXAMPLES:: + sage: # optional - magma sage: E = EllipticCurve(QQ, [1,1]) - sage: E._magma_init_(magma) # optional - magma + sage: E._magma_init_(magma) 'EllipticCurve([_sage_ref...|0/1,0/1,0/1,1/1,1/1])' sage: E = EllipticCurve(GF(41), [2,5]) - sage: E._magma_init_(magma) # optional - magma # needs sage.rings.finite_rings + sage: E._magma_init_(magma) '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]) # needs sage.rings.finite_rings - sage: magma(E) # optional - magma # needs sage.rings.finite_rings + sage: magma(E) # needs 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])) 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 + sage: magma(EllipticCurve([x, 1 + x])) Elliptic Curve defined by y^2 = x^3 + x*x + (x + 1) over Univariate rational function field over Rational Field """ @@ -400,7 +401,7 @@ def _symbolic_(self, SR): 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 = E2.point((3, v(3), 1), check=False) # the check=False option doesn't verify that y^2 = f(x) sage: P (3 : -1/2*sqrt(-127) - 1/2 : 1) sage: P + P @@ -625,14 +626,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)) # needs sage.rings.finite_rings - sage: S = E11._reduce_point(R, 11) # needs sage.rings.finite_rings - sage: E11(S) # needs sage.rings.finite_rings + sage: E11 = E.change_ring(GF(11)) + sage: S = E11._reduce_point(R, 11) + sage: E11(S) (0 : 1 : 0) The 0 point reduces as expected:: - sage: E11._reduce_point(E(0), 11) # needs sage.rings.finite_rings + sage: E11._reduce_point(E(0), 11) (0 : 1 : 0) Note that one need not explicitly call @@ -809,11 +810,11 @@ def lift_x(self, x, all=False, extend=False): We can perform these operations over finite fields too:: - sage: E = EllipticCurve('37a').change_ring(GF(17)); E # needs sage.rings.finite_rings + sage: E = EllipticCurve('37a').change_ring(GF(17)); E Elliptic Curve defined by y^2 + y = x^3 + 16*x over Finite Field of size 17 - sage: E.lift_x(7) # needs sage.rings.finite_rings + sage: E.lift_x(7) (7 : 5 : 1) - sage: E.lift_x(3) # needs sage.rings.finite_rings + sage: E.lift_x(3) Traceback (most recent call last): ... ValueError: No point with x-coordinate 3 on @@ -822,7 +823,7 @@ def lift_x(self, x, all=False, extend=False): Note that there is only one lift with `x`-coordinate 10 in `E(\GF{17})`:: - sage: E.lift_x(10, all=True) # needs sage.rings.finite_rings + sage: E.lift_x(10, all=True) [(10 : 8 : 1)] We can lift over more exotic rings too. If the supplied x @@ -879,10 +880,10 @@ def lift_x(self, x, all=False, extend=False): TESTS:: - sage: E = EllipticCurve('37a').short_weierstrass_model().change_ring(GF(17)) # needs sage.rings.finite_rings - sage: E.lift_x(3, all=True) # needs sage.rings.finite_rings + sage: E = EllipticCurve('37a').short_weierstrass_model().change_ring(GF(17)) + sage: E.lift_x(3, all=True) [] - sage: E.lift_x(7, all=True) # needs sage.rings.finite_rings + sage: E.lift_x(7, all=True) [(7 : 3 : 1), (7 : 14 : 1)] Check determinism:: @@ -1665,7 +1666,6 @@ def division_polynomial_0(self, n, x=None): An example to illustrate the relationship with torsion points:: - sage: # needs sage.rings.finite_rings sage: F = GF(11) sage: E = EllipticCurve(F, [0, 2]); E Elliptic Curve defined by y^2 = x^3 + 2 over Finite Field of size 11 @@ -2325,7 +2325,7 @@ def multiplication_by_m(self, m, x_only=False): The following test shows that :trac:`4364` is indeed fixed:: sage: # needs sage.rings.finite_rings - sage: p = next_prime(2^30-41) + sage: p = next_prime(2^30 - 41) sage: a = GF(p)(1) sage: b = GF(p)(1) sage: E = EllipticCurve([a, b]) @@ -2647,21 +2647,22 @@ def automorphisms(self, field=None): Random testing:: + sage: # needs sage.rings.finite_rings sage: p = random_prime(100) sage: k = randrange(1,30) - sage: F. = GF((p,k)) # needs sage.rings.finite_rings - sage: while True: # needs sage.rings.finite_rings + sage: F. = GF((p,k)) + sage: while True: ....: try: ....: E = EllipticCurve(list((F^5).random_element())) ....: except ArithmeticError: ....: continue ....: break - sage: Aut = E.automorphisms() # needs sage.rings.finite_rings - sage: Aut[0] == E.scalar_multiplication(1) # needs sage.rings.finite_rings + sage: Aut = E.automorphisms() + sage: Aut[0] == E.scalar_multiplication(1) True - sage: Aut[1] == E.scalar_multiplication(-1) # needs sage.rings.finite_rings + sage: Aut[1] == E.scalar_multiplication(-1) True - sage: sorted(Aut) == Aut # needs sage.rings.finite_rings + sage: sorted(Aut) == Aut True """ if field is not None: @@ -2844,7 +2845,6 @@ def short_weierstrass_model(self, complete_cube=True): More tests in characteristic 3:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(3), [0,2,1,2,1]) sage: E.short_weierstrass_model() Traceback (most recent call last): @@ -2957,7 +2957,7 @@ def montgomery_model(self, twisted=False, morphism=False): of definition:: sage: E = EllipticCurve(GF(257), [1,1]) - sage: E.montgomery_model() # needs sage.rings.finite_rings + sage: E.montgomery_model() Traceback (most recent call last): ... ValueError: Elliptic Curve defined by y^2 = x^3 + x + 1 @@ -2966,7 +2966,7 @@ def montgomery_model(self, twisted=False, morphism=False): :: sage: E = EllipticCurve(GF(257), [10,10]) - sage: E.montgomery_model() # needs sage.rings.finite_rings + sage: E.montgomery_model() Traceback (most recent call last): ... ValueError: Elliptic Curve defined by y^2 = x^3 + 10*x + 10 @@ -2976,7 +2976,7 @@ def montgomery_model(self, twisted=False, morphism=False): admit a *twisted* Montgomery model, which can be computed by passing ``twisted=True``:: - sage: E.montgomery_model(twisted=True) # needs sage.rings.finite_rings + 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 @@ -2990,7 +2990,6 @@ def montgomery_model(self, twisted=False, morphism=False): but can easily be emulated by mapping back and forth to the corresponding Weierstrass curve:: - sage: # needs sage.rings.finite_rings sage: C, f = E.montgomery_model(twisted=True, morphism=True) sage: f Scheme morphism: @@ -3365,10 +3364,12 @@ 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: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^4 + x^3 + 11*x^2 + 41*x + 101) # needs sage.rings.number_field - sage: EK = E.base_extend(K) # needs sage.rings.number_field - sage: EK._p_primary_torsion_basis(5) # long time # needs sage.rings.number_field + 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 [[(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)) # needs sage.rings.finite_rings sage: EF._p_primary_torsion_basis(5) # needs sage.rings.finite_rings @@ -3387,7 +3388,7 @@ def _p_primary_torsion_basis(self, p, m=None): sage: a = 804515977734860566494239770982282063895480484302363715494873 sage: b = 584772221603632866665682322899297141793188252000674256662071 - sage: E = EllipticCurve(GF(10^60+3201), [0,a,0,b,0]) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(10^60 + 3201), [0,a,0,b,0]) # needs sage.rings.finite_rings sage: [t[1] for t in E._p_primary_torsion_basis(2)] # long time, needs sage.rings.finite_rings [16, 1] """ @@ -3541,18 +3542,19 @@ def pari_curve(self): EXAMPLES:: + sage: # needs sage.libs.pari sage: E = EllipticCurve([RR(0), RR(0), RR(1), RR(-1), RR(0)]) - sage: e = E.pari_curve() # needs sage.libs.pari - sage: type(e) # needs sage.libs.pari + sage: e = E.pari_curve() + sage: type(e) <... 'cypari2.gen.Gen'> - sage: e.type() # needs sage.libs.pari + sage: e.type() 't_VEC' - sage: e.disc() # needs sage.libs.pari + sage: e.disc() 37.0000000000000 Over a finite field:: - sage: EllipticCurve(GF(41), [2,5]).pari_curve() # needs sage.libs.pari sage.rings.finite_rings + sage: EllipticCurve(GF(41), [2,5]).pari_curve() # needs sage.libs.pari [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), @@ -3617,7 +3619,7 @@ def __pari__(self): Over a finite field:: - sage: EllipticCurve(GF(2), [0,0,1,1,1]).__pari__() # needs sage.libs.pari sage.rings.finite_rings + sage: EllipticCurve(GF(2), [0,0,1,1,1]).__pari__() # needs sage.libs.pari [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 4fcffc01dab..243df1d23f0 100644 --- a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py +++ b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py @@ -129,8 +129,8 @@ def modular_symbol_space(E, sign, base_ring, bound=None): sage: from sage.schemes.elliptic_curves.ell_modular_symbols import modular_symbol_space sage: E = EllipticCurve('11a1') - sage: M = modular_symbol_space(E, -1, GF(37)) # needs sage.rings.finite_rings - sage: M # needs sage.rings.finite_rings + sage: M = 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 """ diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py index 66d72a9fb4e..c6f5c509d5d 100644 --- a/src/sage/schemes/elliptic_curves/ell_point.py +++ b/src/sage/schemes/elliptic_curves/ell_point.py @@ -172,7 +172,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 # needs sage.rings.finite_rings + sage: E([GF(5)(0), 0]) # entries are coerced (0 : 0 : 1) sage: E(0.000, 0) @@ -418,7 +418,6 @@ def __pari__(self): Try the same over a finite field:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(11), [0,0,0,3,0]) sage: O = E(0) sage: P = E.point([1,2]) @@ -430,7 +429,7 @@ def __pari__(self): We no longer need to explicitly call ``pari(O)`` and ``pari(P)`` after :trac:`11868`:: - sage: pari(E).elladd(O, P) # needs sage.rings.finite_rings + sage: pari(E).elladd(O, P) [Mod(1, 11), Mod(2, 11)] """ if self[2]: @@ -812,7 +811,6 @@ def is_divisible_by(self, m): A finite field example:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(101), [23,34]) sage: E.cardinality().factor() 2 * 53 @@ -982,18 +980,19 @@ def division_points(self, m, poly_only=False): An example over a number field (see :trac:`3383`):: + sage: # needs sage.rings.number_field sage: E = EllipticCurve('19a1') sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^9 - 3*x^8 - 4*x^7 + 16*x^6 - 3*x^5 # needs sage.rings.number_field + 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) # needs sage.rings.number_field - sage: E(0).division_points(3) # needs sage.rings.number_field + sage: EK = E.base_extend(K) + sage: E(0).division_points(3) [(0 : 1 : 0), (5 : -10 : 1), (5 : 9 : 1)] - sage: EK(0).division_points(3) # needs sage.rings.number_field + sage: EK(0).division_points(3) [(0 : 1 : 0), (5 : 9 : 1), (5 : -10 : 1)] - sage: E(0).division_points(9) # needs sage.rings.number_field + sage: E(0).division_points(9) [(0 : 1 : 0), (5 : -10 : 1), (5 : 9 : 1)] - sage: EK(0).division_points(9) # needs sage.rings.number_field + sage: EK(0).division_points(9) [(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: @@ -1226,7 +1225,6 @@ def set_order(self, value=None, *, multiple=None, check=True): :: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 sage: G = E(5, 0) sage: G.set_order(2) @@ -1243,17 +1241,18 @@ def set_order(self, value=None, *, multiple=None, check=True): :: + sage: # needs sage.rings.finite_rings sage: p = 2^521 - 1 sage: prev_proof_state = proof.arithmetic() sage: proof.arithmetic(False) # turn off primality checking - sage: F = GF(p) # needs sage.rings.finite_rings + sage: F = GF(p) sage: A = p - 3 sage: B = 1093849038073734274511112390766805569936207598951683748994586394495953116150735016013708737573759623248592132296706313309438452531591012912142327488478985984 sage: q = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005449 - sage: E = EllipticCurve([F(A), F(B)]) # needs sage.rings.finite_rings - sage: G = E.random_point() # needs sage.rings.finite_rings - sage: G.set_order(q) # needs sage.rings.finite_rings - sage: G.order() * G # This takes practically no time. # needs sage.rings.finite_rings + 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. (0 : 1 : 0) sage: proof.arithmetic(prev_proof_state) # restore state @@ -1301,7 +1300,7 @@ def set_order(self, value=None, *, multiple=None, check=True): 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) # needs sage.rings.finite_rings + sage: G.set_order(11) Traceback (most recent call last): ... ValueError: Value 11 illegal: 11 * (5 : 0 : 1) is not the identity @@ -1309,7 +1308,6 @@ def set_order(self, value=None, *, multiple=None, check=True): However, ``set_order`` can be fooled. For instance, the order can be set to a multiple the actual order:: - sage: # needs sage.rings.finite_rings 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) @@ -1525,7 +1523,6 @@ def _miller_(self, Q, n): `n=1`, which is trivial: the function is the constant 1:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve([GF(7)(0), 2]) sage: P = E(5, 1); Q = E(0, 3); I = E(0) sage: I._miller_(P, 1) @@ -1535,7 +1532,6 @@ def _miller_(self, Q, n): A two-torsion example. In this case `f_{n,P}(Q) = x_Q - x_P`:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve([GF(7)(-1), 0]) sage: P = E(0,0); Q = E(1, 0); sage: P._miller_(P, 2) @@ -1579,14 +1575,15 @@ def _miller_(self, Q, n): the curve is negative, so it should exercise the `n<0` case in the code:: + sage: # needs sage.rings.finite_rings sage: p = 2017; A = 1; B = 30; r = 29; t = -70; k = 7 - sage: F = GF(p); R. = F[] # needs sage.rings.finite_rings - sage: E = EllipticCurve([F(A), F(B)]); P = E(369, 716) # needs sage.rings.finite_rings - sage: K. = GF(p^k, modulus=x^k+2); EK = E.base_extend(K) # needs sage.rings.finite_rings - sage: Qx = 1226*a^6 + 1778*a^5 + 660*a^4 + 1791*a^3 + 1750*a^2 + 867*a + 770 # needs sage.rings.finite_rings - sage: Qy = 1764*a^6 + 198*a^5 + 1206*a^4 + 406*a^3 + 1200*a^2 + 273*a + 1712 # needs sage.rings.finite_rings - sage: Q = EK(Qx, Qy) # needs sage.rings.finite_rings - sage: Q._miller_(P, t - 1) # needs sage.rings.finite_rings + 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) 1311*a^6 + 1362*a^5 + 1177*a^4 + 807*a^3 + 1331*a^2 + 1530*a + 1931 ALGORITHM: @@ -1836,18 +1833,18 @@ 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]) # needs sage.rings.finite_rings - sage: P = E(33, 91); n = P.order(); n # needs sage.rings.finite_rings + sage: p = 103; A = 1; B = 18; E = EllipticCurve(GF(p), [A, B]) + sage: P = E(33, 91); n = P.order(); n 19 - sage: k = GF(n)(p).multiplicative_order(); k # needs sage.rings.finite_rings + sage: k = GF(n)(p).multiplicative_order(); k 6 - sage: P.tate_pairing(P, n, k) # needs sage.rings.finite_rings + sage: P.tate_pairing(P, n, k) 1 - sage: Q = E(87, 51) # needs sage.rings.finite_rings - sage: P.tate_pairing(Q, n, k) # needs sage.rings.finite_rings + sage: Q = E(87, 51) + sage: P.tate_pairing(Q, n, k) 1 sage: set_random_seed(35) - sage: P.tate_pairing(P, n, k) # needs sage.rings.finite_rings + sage: P.tate_pairing(P, n, k) 1 We now let `Q` be a point on the same curve as above, but defined over @@ -1996,53 +1993,56 @@ def ate_pairing(self, Q, n, k, t, q=None): An example with embedding degree 6:: + sage: # needs sage.rings.finite_rings sage: p = 7549; A = 0; B = 1; n = 157; k = 6; t = 14 - sage: F = GF(p); E = EllipticCurve(F, [A, B]) # needs sage.rings.finite_rings - sage: R. = F[]; K. = GF((p,k), modulus=x^k+2) # needs sage.rings.finite_rings - sage: EK = E.base_extend(K) # needs sage.rings.finite_rings - sage: P = EK(3050, 5371); Q = EK(6908*a^4, 3231*a^3) # needs sage.rings.finite_rings - sage: P.ate_pairing(Q, n, k, t) # needs sage.rings.finite_rings + 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) 6708*a^5 + 4230*a^4 + 4350*a^3 + 2064*a^2 + 4022*a + 6733 - sage: s = Integer(randrange(1, n)) # needs sage.rings.finite_rings - sage: (s*P).ate_pairing(Q, n, k, t) == P.ate_pairing(s*Q, n, k, t) # needs sage.rings.finite_rings + sage: s = Integer(randrange(1, n)) + sage: (s*P).ate_pairing(Q, n, k, t) == P.ate_pairing(s*Q, n, k, t) True - sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s # needs sage.rings.finite_rings + sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s True Another example with embedding degree 7 and positive trace:: + sage: # needs sage.rings.finite_rings sage: p = 2213; A = 1; B = 49; n = 1093; k = 7; t = 28 - sage: F = GF(p); E = EllipticCurve(F, [A, B]) # needs sage.rings.finite_rings - sage: R. = F[]; K. = GF((p,k), modulus=x^k+2) # needs sage.rings.finite_rings - sage: EK = E.base_extend(K) # needs sage.rings.finite_rings - sage: P = EK(1583, 1734) # needs sage.rings.finite_rings - sage: Qx = 1729*a^6+1767*a^5+245*a^4+980*a^3+1592*a^2+1883*a+722 # needs sage.rings.finite_rings - sage: Qy = 1299*a^6+1877*a^5+1030*a^4+1513*a^3+1457*a^2+309*a+1636 # needs sage.rings.finite_rings - sage: Q = EK(Qx, Qy) # needs sage.rings.finite_rings - sage: P.ate_pairing(Q, n, k, t) # needs sage.rings.finite_rings + 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) 1665*a^6 + 1538*a^5 + 1979*a^4 + 239*a^3 + 2134*a^2 + 2151*a + 654 - sage: s = Integer(randrange(1, n)) # needs sage.rings.finite_rings - sage: (s*P).ate_pairing(Q, n, k, t) == P.ate_pairing(s*Q, n, k, t) # needs sage.rings.finite_rings + sage: s = Integer(randrange(1, n)) + sage: (s*P).ate_pairing(Q, n, k, t) == P.ate_pairing(s*Q, n, k, t) True - sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s # needs sage.rings.finite_rings + sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s True Another example with embedding degree 7 and negative trace:: + sage: # needs sage.rings.finite_rings sage: p = 2017; A = 1; B = 30; n = 29; k = 7; t = -70 - sage: F = GF(p); E = EllipticCurve(F, [A, B]) # needs sage.rings.finite_rings - sage: R. = F[]; K. = GF((p,k), modulus=x^k+2) # needs sage.rings.finite_rings - sage: EK = E.base_extend(K) # needs sage.rings.finite_rings - sage: P = EK(369, 716) # needs sage.rings.finite_rings - sage: Qx = 1226*a^6+1778*a^5+660*a^4+1791*a^3+1750*a^2+867*a+770 # needs sage.rings.finite_rings - sage: Qy = 1764*a^6+198*a^5+1206*a^4+406*a^3+1200*a^2+273*a+1712 # needs sage.rings.finite_rings - sage: Q = EK(Qx, Qy) # needs sage.rings.finite_rings - sage: P.ate_pairing(Q, n, k, t) # needs sage.rings.finite_rings + 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) 1794*a^6 + 1161*a^5 + 576*a^4 + 488*a^3 + 1950*a^2 + 1905*a + 1315 - sage: s = Integer(randrange(1, n)) # needs sage.rings.finite_rings - sage: (s*P).ate_pairing(Q, n, k, t) == P.ate_pairing(s*Q, n, k, t) # needs sage.rings.finite_rings + sage: s = Integer(randrange(1, n)) + sage: (s*P).ate_pairing(Q, n, k, t) == P.ate_pairing(s*Q, n, k, t) True - sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s # needs sage.rings.finite_rings + sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s True Using the same data, we show that the ate pairing is a power of the @@ -2062,36 +2062,37 @@ 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) # needs sage.rings.finite_rings - sage: n = 41; k = 4; t = -8 # needs sage.rings.finite_rings - sage: E = EllipticCurve(F,[0,0,1,1,1]) # needs sage.rings.finite_rings - sage: P = E(a^4 + 1, a^3) # needs sage.rings.finite_rings - sage: Fx. = GF(q^k) # needs sage.rings.finite_rings - sage: Ex = EllipticCurve(Fx, [0,0,1,1,1]) # needs sage.rings.finite_rings - sage: phi = Hom(F, Fx)(F.gen().minpoly().roots(Fx)[0][0]) # needs sage.rings.finite_rings - sage: Px = Ex(phi(P.xy()[0]), phi(P.xy()[1])) # needs 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, # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + 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) # needs sage.rings.finite_rings - sage: Px.ate_pairing(Qx, n, k, t) # needs sage.rings.finite_rings + 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) 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) # needs sage.rings.finite_rings + 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 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) # needs sage.rings.finite_rings + sage: (s*Px).ate_pairing(Qx, n, k, t, q) == Px.ate_pairing(s*Qx, n, k, t, q) True - sage: Px.ate_pairing(s*Qx, n, k, t, q) == Px.ate_pairing(Qx, n, k, t, q)^s # needs sage.rings.finite_rings + sage: Px.ate_pairing(s*Qx, n, k, t, q) == Px.ate_pairing(Qx, n, k, t, q)^s True - sage: c = (k*q^(k-1)).mod(n); T = t - 1 # needs sage.rings.finite_rings - sage: N = gcd(T^k - 1, q^k - 1) # needs sage.rings.finite_rings - sage: s = Integer(N/n) # needs sage.rings.finite_rings - sage: L = Integer((T^k - 1)/N) # needs sage.rings.finite_rings - sage: M = (L*s*c.inverse_mod(n)).mod(n) # needs sage.rings.finite_rings - sage: Px.ate_pairing(Qx, n, k, t, q) == Qx.tate_pairing(Px, n, k, q)^M # needs sage.rings.finite_rings + 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 True It is an error if `Q` is not in the kernel of `\pi - p`, where `\pi` is @@ -2110,12 +2111,13 @@ 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: # needs sage.rings.finite_rings sage: p = 29; A = 1; B = 0; n = 5; k = 2; t = 10 - sage: F = GF(p); R. = F[] # needs sage.rings.finite_rings - sage: E = EllipticCurve(F, [A, B]); # needs sage.rings.finite_rings - sage: K. = GF((p,k), modulus=x^k+2); EK = E.base_extend(K) # needs sage.rings.finite_rings - sage: P = EK(14, 10*a); Q = EK(13, 21) # needs sage.rings.finite_rings - sage: P.ate_pairing(Q, n, k, t) # needs sage.rings.finite_rings + 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) Traceback (most recent call last): ... ValueError: This point (14 : 10*a : 1) is not in Ker(pi - 1) @@ -2185,7 +2187,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 # needs sage.rings.finite_rings + sage: E([GF(5)(0), 0]) # entries are coerced (0 : 0 : 1) sage: E(0.000, 0) @@ -3648,7 +3650,7 @@ def _magma_init_(self, magma): sage: E = EllipticCurve(GF(17), [1,-1]) sage: P = E([13, 4]) - sage: P._magma_init_(magma) # optional - magma # needs sage.rings.finite_rings + sage: P._magma_init_(magma) # optional - magma '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) @@ -3768,14 +3770,15 @@ def discrete_log(self, Q, ord=None): Some random testing:: + sage: # needs sage.rings.finite_rings 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()) # needs sage.rings.finite_rings - sage: P = E.random_point() # needs sage.rings.finite_rings - sage: Q = randrange(2**999) * P # needs sage.rings.finite_rings - sage: x = P.discrete_log(Q) # needs sage.rings.finite_rings - sage: x*P == Q # needs sage.rings.finite_rings + 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 True Doctest deprecation:: @@ -3836,27 +3839,29 @@ def padic_elliptic_logarithm(self,Q, p): EXAMPLES:: - sage: p=235322474717419 - sage: b=8856682 - sage: E = EllipticCurve(GF(p), [0, b]) # needs sage.rings.finite_rings - sage: P = E(200673830421813, 57025307876612) # needs sage.rings.finite_rings - sage: Q = E(40345734829479, 211738132651297) # needs sage.rings.finite_rings - sage: x = P.padic_elliptic_logarithm(Q, p) # needs sage.rings.finite_rings sage.rings.padics - sage: x * P == Q # needs sage.rings.finite_rings sage.rings.padics + sage: # needs sage.rings.finite_rings + 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) # needs sage.rings.padics + sage: x * P == Q # needs sage.rings.padics True TESTS: Some testing:: + sage: # needs sage.rings.finite_rings sage: a = 49850651047495986645822557378918223 sage: b = 21049438014429831351540675253466229 sage: p = 54283205379427155782089046839411711 - sage: E = EllipticCurve(GF(p), [a, b]) # needs sage.rings.finite_rings - sage: P = E.random_point() # needs sage.rings.finite_rings - sage: Q = randrange(0, p-1) * P # needs sage.rings.finite_rings - sage: x = P.padic_elliptic_logarithm(Q, p) # needs sage.rings.finite_rings sage.rings.padics - sage: x*P == Q # needs sage.rings.finite_rings sage.rings.padics + 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) # needs sage.rings.padics + sage: x*P == Q # needs sage.rings.padics True """ E = self.curve() @@ -3938,35 +3943,38 @@ def order(self): :: + sage: # needs sage.rings.finite_rings sage: p = next_prime(2^150) - sage: E = EllipticCurve(GF(p), [1,1]) # needs sage.rings.finite_rings - sage: P = E(831623307675610677632782670796608848711856078, # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(p), [1,1]) + sage: P = E(831623307675610677632782670796608848711856078, ....: 42295786042873366706573292533588638217232964) - sage: P.order() # needs sage.rings.finite_rings + sage: P.order() 1427247692705959881058262545272474300628281448 - sage: P.order() == E.cardinality() # needs sage.rings.finite_rings + sage: P.order() == E.cardinality() True The next example has `j(E)=0`:: + sage: # needs sage.rings.finite_rings sage: p = 33554501 - sage: F. = GF((p,2)) # needs sage.rings.finite_rings - sage: E = EllipticCurve(F, [0,1]) # needs sage.rings.finite_rings - sage: E.j_invariant() # needs sage.rings.finite_rings + sage: F. = GF((p,2)) + sage: E = EllipticCurve(F, [0,1]) + sage: E.j_invariant() 0 - sage: P = E.random_point() # needs sage.rings.finite_rings - sage: P.order() # random # needs sage.rings.finite_rings + sage: P = E.random_point() + sage: P.order() # random 16777251 Similarly when `j(E)=1728`:: + sage: # needs sage.rings.finite_rings sage: p = 33554473 - sage: F. = GF((p,2)) # needs sage.rings.finite_rings - sage: E = EllipticCurve(F, [1,0]) # needs sage.rings.finite_rings - sage: E.j_invariant() # needs sage.rings.finite_rings + sage: F. = GF((p,2)) + sage: E = EllipticCurve(F, [1,0]) + sage: E.j_invariant() 1728 - sage: P = E.random_point() # needs sage.rings.finite_rings - sage: P.order() # random # needs sage.rings.finite_rings + sage: P = E.random_point() + sage: P.order() # random 46912611635760 TESTS: diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py index 167b6ace2fa..4766a720eba 100644 --- a/src/sage/schemes/elliptic_curves/ell_rational_field.py +++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py @@ -4160,22 +4160,22 @@ def reduction(self,p): EXAMPLES:: sage: E = EllipticCurve('389a1') - sage: E.reduction(2) # needs sage.rings.finite_rings + sage: E.reduction(2) Elliptic Curve defined by y^2 + y = x^3 + x^2 over Finite Field of size 2 - sage: E.reduction(3) # needs sage.rings.finite_rings + sage: E.reduction(3) Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 3 - sage: E.reduction(5) # needs sage.rings.finite_rings + sage: E.reduction(5) Elliptic Curve defined by y^2 + y = x^3 + x^2 + 3*x over Finite Field of size 5 - sage: E.reduction(38) # needs sage.rings.finite_rings + sage: E.reduction(38) Traceback (most recent call last): ... AttributeError: p must be prime. - sage: E.reduction(389) # needs sage.rings.finite_rings + sage: E.reduction(389) 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) # needs sage.rings.finite_rings + sage: E.reduction(5) Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 5 """ p = Integer(p) @@ -4541,7 +4541,7 @@ 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)) # needs sage.rings.finite_rings + sage: E.has_rational_cm(GF(2)) Traceback (most recent call last): ... ValueError: Error in has_rational_cm: Finite Field of size 2 diff --git a/src/sage/schemes/elliptic_curves/ell_wp.py b/src/sage/schemes/elliptic_curves/ell_wp.py index ba93a89ea89..8785976dec3 100644 --- a/src/sage/schemes/elliptic_curves/ell_wp.py +++ b/src/sage/schemes/elliptic_curves/ell_wp.py @@ -91,7 +91,6 @@ 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: # needs sage.rings.finite_rings sage: k = GF(11) sage: E = EllipticCurve(k, [1,1]) sage: E.weierstrass_p(prec=6, algorithm='fast') @@ -127,7 +126,7 @@ def weierstrass_p(E, prec=20, algorithm=None): TESTS:: - sage: E.weierstrass_p(prec=4, algorithm='foo') # needs sage.rings.finite_rings + sage: E.weierstrass_p(prec=4, algorithm='foo') Traceback (most recent call last): ... ValueError: unknown algorithm for computing the Weierstrass p-function @@ -225,13 +224,13 @@ 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]) # needs sage.rings.finite_rings - sage: E.weierstrass_p(algorithm='quadratic') # needs sage.rings.finite_rings + 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: from sage.schemes.elliptic_curves.ell_wp import compute_wp_quadratic - sage: compute_wp_quadratic(E.base_ring(), E.a4(), E.a6(), prec=10) # needs sage.rings.finite_rings + sage: compute_wp_quadratic(E.base_ring(), E.a4(), E.a6(), prec=10) z^-2 + 41*z^2 + 88*z^4 + 11*z^6 + 57*z^8 + O(z^10) """ m = (prec + 1)//2 @@ -330,7 +329,6 @@ def solve_linear_differential_system(a, b, c, alpha): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.ell_wp import solve_linear_differential_system sage: k = GF(17) sage: R. = PowerSeriesRing(k) diff --git a/src/sage/schemes/elliptic_curves/formal_group.py b/src/sage/schemes/elliptic_curves/formal_group.py index 5c426ff6383..dbd2db5f778 100644 --- a/src/sage/schemes/elliptic_curves/formal_group.py +++ b/src/sage/schemes/elliptic_curves/formal_group.py @@ -488,7 +488,6 @@ 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: # needs sage.rings.finite_rings sage: e = EllipticCurve(GF(7), [3, 4]) sage: ehat = e.formal() sage: ehat.group_law(3) @@ -498,7 +497,6 @@ def group_law(self, prec=10): TESTS:: - sage: # needs sage.rings.finite_rings sage: R. = GF(7)[[]] sage: F(x, ehat.inverse()(x)) 0 + O(x, y, z)^7 @@ -509,7 +507,7 @@ def group_law(self, prec=10): Let's ensure caching with changed precision is working:: - sage: e.formal_group().group_law(4) # needs sage.rings.finite_rings + sage: e.formal_group().group_law(4) t1 + t2 + O(t1, t2)^4 Test for :trac:`9646`:: @@ -628,7 +626,7 @@ 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 # needs sage.rings.finite_rings + sage: F.mult_by_n(10, 50) # long time 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() diff --git a/src/sage/schemes/elliptic_curves/height.py b/src/sage/schemes/elliptic_curves/height.py index 2229faf808b..97020957574 100644 --- a/src/sage/schemes/elliptic_curves/height.py +++ b/src/sage/schemes/elliptic_curves/height.py @@ -799,7 +799,7 @@ def __init__(self, E): sage: from sage.schemes.elliptic_curves.height import EllipticCurveCanonicalHeight sage: E = EllipticCurve(GF(7), [0,0,0,0,1]) - sage: EllipticCurveCanonicalHeight(E) # needs sage.rings.finite_rings + sage: EllipticCurveCanonicalHeight(E) Traceback (most recent call last): ... ValueError: EllipticCurveCanonicalHeight class can only be created diff --git a/src/sage/schemes/elliptic_curves/hom_composite.py b/src/sage/schemes/elliptic_curves/hom_composite.py index 0ab6dc6c407..a2cd521acd4 100644 --- a/src/sage/schemes/elliptic_curves/hom_composite.py +++ b/src/sage/schemes/elliptic_curves/hom_composite.py @@ -13,15 +13,16 @@ straightforward :class:`EllipticCurveIsogeny` implementation, but decomposing into prime steps is exponentially faster:: + sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite sage: p = 3 * 2^143 - 1 - sage: GF(p^2).inject_variables() # needs sage.rings.finite_rings + sage: GF(p^2).inject_variables() Defining z2 - sage: E = EllipticCurve(GF(p^2), [1,0]) # needs sage.rings.finite_rings - sage: P = E.lift_x(31415926535897932384626433832795028841971 - z2) # needs sage.rings.finite_rings - sage: P.order().factor() # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(p^2), [1,0]) + sage: P = E.lift_x(31415926535897932384626433832795028841971 - z2) + sage: P.order().factor() 2^143 - sage: EllipticCurveHom_composite(E, P) # needs sage.rings.finite_rings + 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 @@ -319,7 +320,6 @@ def __init__(self, E, kernel, codomain=None, model=None): TESTS:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(19), [1,0]) sage: P = E.random_point() sage: psi = EllipticCurveHom_composite(E, P) @@ -330,7 +330,7 @@ def __init__(self, E, kernel, codomain=None, model=None): :: - sage: EllipticCurveHom_composite(E, E.lift_x(3), codomain=E) # needs sage.rings.finite_rings + sage: EllipticCurveHom_composite(E, E.lift_x(3), codomain=E) 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 @@ -424,7 +424,6 @@ def from_factors(cls, maps, E=None, strict=True): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite sage: E = EllipticCurve(GF(43), [1,0]) sage: P, = E.gens() @@ -436,7 +435,7 @@ def from_factors(cls, maps, E=None, strict=True): TESTS:: sage: E = EllipticCurve('4730k1') - sage: EllipticCurveHom_composite.from_factors([], E) == E.scalar_multiplication(1) # needs sage.rings.finite_rings + sage: EllipticCurveHom_composite.from_factors([], E) == E.scalar_multiplication(1) True :: @@ -538,7 +537,6 @@ def _repr_(self): TESTS:: - sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite sage: E = EllipticCurve(GF(43), [1,0]) sage: P, = E.gens() @@ -570,7 +568,6 @@ def factors(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite sage: E = EllipticCurve(GF(43), [1,0]) sage: P, = E.gens() @@ -684,7 +681,7 @@ def _comparison_impl(left, right, op): sage: phi2 = EllipticCurveHom_composite(phi1.codomain(), phi1(Q)) # needs sage.rings.number_field sage: psi1 = EllipticCurveHom_composite(E, Q) # needs sage.rings.number_field sage: psi2 = EllipticCurveHom_composite(psi1.codomain(), psi1(P)) # needs sage.rings.number_field - sage: phi2 * phi1 == psi2 * psi1 # needs sage.rings.number_field + sage: phi2 * phi1 == psi2 * psi1 True """ if op != op_EQ: @@ -916,15 +913,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)) # needs sage.rings.finite_rings - sage: nu = EllipticCurveHom_composite.from_factors(E.automorphisms()) # needs sage.rings.finite_rings - sage: nu # needs sage.rings.finite_rings + sage: E = EllipticCurve_from_j(GF(3).algebraic_closure()(0)) + 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 - sage: nu.is_injective() # needs sage.rings.finite_rings + sage: nu.is_injective() True """ return all(phi.is_injective() for phi in self._phis) diff --git a/src/sage/schemes/elliptic_curves/modular_parametrization.py b/src/sage/schemes/elliptic_curves/modular_parametrization.py index 1352492e686..501c17cd571 100644 --- a/src/sage/schemes/elliptic_curves/modular_parametrization.py +++ b/src/sage/schemes/elliptic_curves/modular_parametrization.py @@ -212,14 +212,15 @@ def map_to_complex_numbers(self, z, prec=None): EXAMPLES:: + sage: # needs sage.symbolic sage: E = EllipticCurve('37a'); phi = E.modular_parametrization() sage: x = polygen(ZZ, 'x') - sage: tau = (sqrt(7)*I - 17)/74 # needs sage.symbolic - sage: z = phi.map_to_complex_numbers(tau); z # needs sage.symbolic + sage: tau = (sqrt(7)*I - 17)/74 + sage: z = phi.map_to_complex_numbers(tau); z 0.929592715285395 - 1.22569469099340*I - sage: E.elliptic_exponential(z) # needs sage.symbolic + sage: E.elliptic_exponential(z) (...e-16 - ...e-16*I : ...e-16 + ...e-16*I : 1.00000000000000) - sage: phi(tau) # needs sage.symbolic + sage: phi(tau) (...e-16 - ...e-16*I : ...e-16 + ...e-16*I : 1.00000000000000) """ if prec is None: diff --git a/src/sage/schemes/elliptic_curves/period_lattice.py b/src/sage/schemes/elliptic_curves/period_lattice.py index a1d352ee8e9..fe07917abaa 100644 --- a/src/sage/schemes/elliptic_curves/period_lattice.py +++ b/src/sage/schemes/elliptic_curves/period_lattice.py @@ -1682,28 +1682,29 @@ def elliptic_logarithm(self, P, prec=None, reduce=True): See :trac:`10026` and :trac:`11767`:: - sage: K. = QuadraticField(2) # needs sage.rings.number_field - sage: E = EllipticCurve([0, -1, 1, -3*w - 4, 3*w + 4]) # needs sage.rings.number_field - sage: T = E.simon_two_descent(lim1=20, lim3=5, limtriv=20) # needs sage.rings.number_field - sage: P, Q = T[2] # needs sage.rings.number_field - sage: embs = K.embeddings(CC) # needs sage.rings.number_field - sage: Lambda = E.period_lattice(embs[0]) # needs sage.rings.number_field - sage: Lambda.elliptic_logarithm(P, 100) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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) 4.7100131126199672766973600998 sage: R. = QQ[] - sage: K. = NumberField(x^2 + x + 5) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0,0,1,-3,-5]) # needs sage.rings.number_field - sage: P = E([0,a]) # needs sage.rings.number_field - sage: Lambda = P.curve().period_lattice(K.embeddings(ComplexField(600))[0]) # needs sage.rings.number_field - sage: Lambda.elliptic_logarithm(P, prec=600) # needs sage.rings.number_field + 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) -0.842248166487739393375018008381693990800588864069506187033873183845246233548058477561706400464057832396643843146464236956684557207157300006542470428493573195030603817094900751609464 - 0.571366031453267388121279381354098224265947866751130917440598461117775339240176310729173301979590106474259885638797913383502735083088736326391919063211421189027226502851390118943491*I - sage: K. = QuadraticField(-5) # needs sage.rings.number_field - sage: E = EllipticCurve([1,1,a,a,0]) # needs sage.rings.number_field - sage: P = E(0, 0) # needs sage.rings.number_field - sage: L = P.curve().period_lattice(K.embeddings(ComplexField())[0]) # needs sage.rings.number_field - sage: L.elliptic_logarithm(P, prec=500) # needs sage.rings.number_field + 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) 1.17058357737548897849026170185581196033579563441850967539191867385734983296504066660506637438866628981886518901958717288150400849746892393771983141354 - 1.13513899565966043682474529757126359416758251309237866586896869548539516543734207347695898664875799307727928332953834601460994992792519799260968053875*I - sage: L.elliptic_logarithm(P, prec=1000) # needs sage.rings.number_field + sage: L.elliptic_logarithm(P, prec=1000) 1.17058357737548897849026170185581196033579563441850967539191867385734983296504066660506637438866628981886518901958717288150400849746892393771983141354014895386251320571643977497740116710952913769943240797618468987304985625823413440999754037939123032233879499904283600304184828809773650066658885672885 - 1.13513899565966043682474529757126359416758251309237866586896869548539516543734207347695898664875799307727928332953834601460994992792519799260968053875387282656993476491590607092182964878750169490985439873220720963653658829712494879003124071110818175013453207439440032582917366703476398880865439217473*I """ if not P.curve() is self.E: @@ -1818,13 +1819,14 @@ def elliptic_exponential(self, z, to_curve=True): Test to show that :trac:`8820` is fixed:: + sage: # needs sage.rings.number_field sage: E = EllipticCurve('37a') - sage: K. = QuadraticField(-5) # needs sage.rings.number_field - sage: L = E.change_ring(K).period_lattice(K.places()[0]) # needs sage.rings.number_field - sage: L.elliptic_exponential(CDF(.1,.1)) # needs sage.rings.number_field + 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) # needs sage.rings.number_field + sage: L.elliptic_exponential(CDF(.1,.1), to_curve=False) (0.0000142854026029447 - 49.9960001066650*I, 500.040282501900 + 500.039711098263*I) @@ -1839,12 +1841,13 @@ def elliptic_exponential(self, z, to_curve=True): :: + sage: # needs sage.rings.number_field sage: E = EllipticCurve('37a') - sage: K. = QuadraticField(-5) # needs sage.rings.number_field - sage: L = E.change_ring(K).period_lattice(K.places()[0]) # needs sage.rings.number_field - sage: P = L.elliptic_exponential(0); P # needs sage.rings.number_field + sage: K. = QuadraticField(-5) + sage: L = E.change_ring(K).period_lattice(K.places()[0]) + sage: P = L.elliptic_exponential(0); P (0.000000000000000 : 1.00000000000000 : 0.000000000000000) - sage: P.parent() # needs sage.rings.number_field + 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 @@ -1950,6 +1953,7 @@ def reduce_tau(tau): EXAMPLES:: + sage: # needs sage.rings.real_mpfr sage.symbolic sage: from sage.schemes.elliptic_curves.period_lattice import reduce_tau sage: reduce_tau(CC(1.23,3.45)) (0.230000000000000 + 3.45000000000000*I, [1, -1, 0, 1]) @@ -1997,6 +2001,7 @@ def normalise_periods(w1, w2): EXAMPLES:: + sage: # needs sage.rings.real_mpfr sage.symbolic sage: from sage.schemes.elliptic_curves.period_lattice import reduce_tau, normalise_periods sage: w1 = CC(1.234, 3.456) sage: w2 = CC(1.234, 3.456000001) @@ -2038,6 +2043,7 @@ def extended_agm_iteration(a, b, c): EXAMPLES:: + sage: # needs sage.rings.real_mpfr 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) @@ -2048,7 +2054,7 @@ def extended_agm_iteration(a, b, c): TESTS:: - sage: extended_agm_iteration(1,2,3) + sage: extended_agm_iteration(1,2,3) # needs sage.rings.real_mpfr Traceback (most recent call last): ... ValueError: values must be real or complex numbers diff --git a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py index 9c23d9952f7..57ff015a2b2 100644 --- a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py +++ b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py @@ -535,7 +535,6 @@ def _comparison_impl(left, right, op): sage: w1 == w2 False - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve_from_j(GF(7)(0)) sage: F = E.change_weierstrass_model(2,3,4,5) sage: a = E.isomorphisms(F) diff --git a/src/sage/schemes/generic/scheme.py b/src/sage/schemes/generic/scheme.py index ee5a02335b7..d5cade5e5cc 100644 --- a/src/sage/schemes/generic/scheme.py +++ b/src/sage/schemes/generic/scheme.py @@ -740,7 +740,7 @@ def zeta_series(self, n, t): sage: R. = PowerSeriesRing(Integers()) sage: C.zeta_series(4, t) # needs sage.rings.finite_rings sage.schemes 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) # optional - sage.rings.finite_rings + sage: (1+2*t+3*t^2)/(1-t)/(1-3*t) + O(t^5) # needs 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 diff --git a/src/sage/schemes/projective/projective_rational_point.py b/src/sage/schemes/projective/projective_rational_point.py index 4e2e2d17086..6e81ea16b7b 100644 --- a/src/sage/schemes/projective/projective_rational_point.py +++ b/src/sage/schemes/projective/projective_rational_point.py @@ -243,8 +243,8 @@ def enum_projective_finite_field(X): EXAMPLES:: - sage: F = GF(53) # optional - sage.rings.finite_rings - sage: P. = ProjectiveSpace(2, F) # optional - sage.rings.finite_rings + sage: F = GF(53) # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(2, F) # needs sage.rings.finite_rings sage: from sage.schemes.projective.projective_rational_point import enum_projective_finite_field sage: F = GF(53) sage: P. = ProjectiveSpace(2, F) diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index 9c67f083053..d2bbee01716 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -1030,11 +1030,12 @@ def points_of_bounded_height(self, **kwds): :: - sage: CF. = CyclotomicField(3) # needs sage.rings.number_field - sage: R. = CF[] # needs sage.rings.number_field - sage: L. = CF.extension(x^3 + 2) # needs sage.rings.number_field - sage: Q. = ProjectiveSpace(L, 1) # needs sage.rings.number_field - sage: sorted(list(Q.points_of_bounded_height(bound=1))) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + 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))) [(0 : 1), (1 : 0), (a + 1 : 1), (a : 1), (-1 : 1), (-a - 1 : 1), (-a : 1), (1 : 1)] From b84bfec3cb7c1958ded59112f54df63d951dc43a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 19 Aug 2023 11:50:05 -0700 Subject: [PATCH 052/423] sage.schemes: Even more block tags, remove many unnecessary # needs - sage.rings.finite_rings --- src/sage/schemes/elliptic_curves/ell_field.py | 2 +- .../schemes/elliptic_curves/hom_composite.py | 2 +- src/sage/schemes/generic/algebraic_scheme.py | 43 +++++------ src/sage/schemes/generic/divisor.py | 9 +-- src/sage/schemes/generic/homset.py | 24 +++---- src/sage/schemes/generic/morphism.py | 2 +- src/sage/schemes/generic/scheme.py | 6 +- src/sage/schemes/generic/spec.py | 2 +- .../hyperelliptic_generic.py | 45 +++++++----- .../hyperelliptic_curves/invariants.py | 22 +++--- .../hyperelliptic_curves/jacobian_generic.py | 40 ++++++----- .../hyperelliptic_curves/jacobian_homset.py | 2 - .../hyperelliptic_curves/jacobian_morphism.py | 57 +++++++-------- .../schemes/hyperelliptic_curves/mestre.py | 12 ++-- src/sage/schemes/plane_conics/con_field.py | 71 +++++++++---------- .../con_rational_function_field.py | 15 ++-- src/sage/schemes/plane_conics/constructor.py | 8 +-- .../schemes/product_projective/morphism.py | 24 ++++--- src/sage/schemes/product_projective/point.py | 9 +-- .../product_projective/rational_point.py | 9 +-- .../projective/projective_rational_point.py | 26 +++---- .../schemes/projective/projective_space.py | 11 +-- .../projective/projective_subscheme.py | 47 ++++++------ 23 files changed, 250 insertions(+), 238 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index ea3f8c11485..1c6444583b9 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -1899,7 +1899,7 @@ class of curves. If the j-invariant is not unique in the isogeny sage: # needs sage.graphs sage.rings.number_field sage: K. = NumberField(x^2 - 2) # needs sage.rings.finite_rings - sage: E = EllipticCurve(K, [1, 0, 1, 4, -6]) + sage: E = EllipticCurve(K, [1, 0, 1, 4, -6]) # needs sage.rings.finite_rings sage: G2 = E.isogeny_ell_graph(2, directed=False) sage: G2.vertices(sort=True) ['y^2 + x*y + y = x^3 + (-130*e-356)*x + (-2000*e-2038)', diff --git a/src/sage/schemes/elliptic_curves/hom_composite.py b/src/sage/schemes/elliptic_curves/hom_composite.py index a2cd521acd4..e82cc6d226d 100644 --- a/src/sage/schemes/elliptic_curves/hom_composite.py +++ b/src/sage/schemes/elliptic_curves/hom_composite.py @@ -681,7 +681,7 @@ def _comparison_impl(left, right, op): sage: phi2 = EllipticCurveHom_composite(phi1.codomain(), phi1(Q)) # needs sage.rings.number_field sage: psi1 = EllipticCurveHom_composite(E, Q) # needs sage.rings.number_field sage: psi2 = EllipticCurveHom_composite(psi1.codomain(), psi1(P)) # needs sage.rings.number_field - sage: phi2 * phi1 == psi2 * psi1 + sage: phi2 * phi1 == psi2 * psi1 # needs sage.rings.number_field True """ if op != op_EQ: diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index 6a0d8c48aa1..642578950aa 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -1764,11 +1764,12 @@ def rational_points(self, **kwds): Enumerate over a projective scheme over a number field:: + sage: # needs sage.rings.number_field sage: u = QQ['u'].0 - sage: K. = NumberField(u^2 + 3) # needs sage.rings.number_field - sage: A. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: X = A.subscheme(x^2 - y^2) # needs sage.rings.number_field - sage: X.rational_points(bound=3) # needs sage.rings.number_field + 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) [(-1 : 1), (1 : 1)] One can enumerate points up to a given bound on a projective scheme @@ -1783,8 +1784,8 @@ 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)) # needs sage.rings.finite_rings sage.schemes - sage: Etilde.rational_points() # needs sage.rings.finite_rings sage.schemes + sage: Etilde = E.base_extend(GF(3)) # needs sage.schemes + sage: Etilde.rational_points() # needs sage.schemes [(0 : 0 : 1), (0 : 1 : 0), (0 : 2 : 1), (1 : 0 : 1), (1 : 2 : 1), (2 : 0 : 1), (2 : 2 : 1)] @@ -1793,8 +1794,8 @@ def rational_points(self, **kwds): sage: FF = FiniteField(7) sage: P. = PolynomialRing(FiniteField(7)) - sage: C = HyperellipticCurve(x^8 + x + 1) # needs sage.rings.finite_rings sage.schemes - sage: C.rational_points() # needs sage.rings.finite_rings sage.schemes + sage: C = HyperellipticCurve(x^8 + x + 1) # needs sage.schemes + sage: C.rational_points() # needs sage.schemes [(0 : 1 : 0), (0 : 1 : 1), (0 : 6 : 1), (2 : 0 : 1), (4 : 0 : 1), (6 : 1 : 1), (6 : 6 : 1)] @@ -1946,13 +1947,14 @@ def change_ring(self, R): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: f = x^6 - 2 - sage: L. = NumberField(f, embedding=f.roots(CC)[2][0]) # needs sage.rings.number_field - sage: A. = AffineSpace(L, 2) # needs sage.rings.number_field - sage: H = Hom(A, A) # needs sage.rings.number_field - sage: X = A.subscheme([b*x^2, y^2]) # needs sage.libs.singular sage.rings.number_field - sage: X.change_ring(CC) # needs sage.libs.singular sage.rings.number_field + 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]) # needs sage.libs.singular + sage: X.change_ring(CC) # needs sage.libs.singular 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, @@ -1998,18 +2000,19 @@ def weil_restriction(self): EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(x^5 - 2) # needs sage.rings.number_field - sage: R. = K[] # needs sage.rings.number_field - sage: L. = K.extension(x^2 + 1) # needs sage.rings.number_field - sage: A. = AffineSpace(L, 2) # needs sage.rings.number_field - sage: X = A.subscheme([y^2 - L(w)*x^3 - v]) # needs sage.libs.singular sage.rings.number_field - sage: X.weil_restriction() # needs sage.libs.singular sage.rings.number_field + 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]) # needs sage.libs.singular + sage: X.weil_restriction() # needs sage.libs.singular 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() # needs sage.libs.singular sage.rings.number_field + sage: X.weil_restriction().ambient_space() is A.weil_restriction() # needs sage.libs.singular True :: diff --git a/src/sage/schemes/generic/divisor.py b/src/sage/schemes/generic/divisor.py index f24b4d9718e..6a55c3e8ce7 100644 --- a/src/sage/schemes/generic/divisor.py +++ b/src/sage/schemes/generic/divisor.py @@ -14,7 +14,6 @@ EXAMPLES:: - sage: # needs sage.rings.finite_rings 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 @@ -110,8 +109,8 @@ def is_Divisor(x): 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) # needs sage.rings.finite_rings - sage: is_Divisor(C.divisor([])) # needs sage.rings.finite_rings + sage: C = Curve(y^2 - x^9 - x) + sage: is_Divisor(C.divisor([])) True sage: is_Divisor("Ceci n'est pas un diviseur") False @@ -225,7 +224,6 @@ def scheme(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: A. = AffineSpace(2, GF(5)) sage: C = Curve(y^2 - x^9 - x) sage: pts = C.rational_points(); pts @@ -372,7 +370,6 @@ def support(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: x,y = AffineSpace(2, GF(5), names='xy').gens() sage: C = Curve(y^2 - x^9 - x) sage: pts = C.rational_points(); pts @@ -386,7 +383,6 @@ def support(self): This checks that :trac:`10732` is fixed:: - sage: # needs sage.rings.finite_rings sage: R. = GF(5)[] sage: C = Curve(x^7 + y^7 + z^7) sage: pts = C.rational_points() @@ -422,7 +418,6 @@ def coefficient(self, P): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: x,y = AffineSpace(2, GF(5), names='xy').gens() sage: C = Curve(y^2 - x^9 - x) sage: pts = C.rational_points(); pts diff --git a/src/sage/schemes/generic/homset.py b/src/sage/schemes/generic/homset.py index cb18ea1dfba..5db57860f7d 100644 --- a/src/sage/schemes/generic/homset.py +++ b/src/sage/schemes/generic/homset.py @@ -639,12 +639,13 @@ def _element_constructor_(self, *v, **kwds): sage: F_points([2,5]) (2, 2) + sage: # needs sage.rings.finite_rings sage: P2 = ProjectiveSpace(GF(3), 2) - sage: F. = GF(9, 'a') # needs sage.rings.finite_rings + sage: F. = GF(9, 'a') sage: F_points = P2(F) sage: type(F_points) - sage: F_points([4,2*a]) # needs sage.rings.finite_rings + sage: F_points([4,2*a]) (1 : 2*a : 1) TESTS:: @@ -668,17 +669,16 @@ def extended_codomain(self): EXAMPLES:: + sage: # needs sage.rings.number_field sage: P2 = ProjectiveSpace(QQ, 2) sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 + x - (3^3-3)) # needs sage.rings.number_field - sage: K_points = P2(K); K_points # needs sage.rings.number_field + sage: K. = NumberField(x^2 + x - (3^3-3)) + sage: K_points = P2(K); K_points 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() # needs sage.rings.number_field + sage: K_points.codomain() Projective Space of dimension 2 over Rational Field - - sage: K_points.extended_codomain() # needs sage.rings.number_field + sage: K_points.extended_codomain() Projective Space of dimension 2 over Number Field in a with defining polynomial x^2 + x - 24 """ @@ -740,8 +740,8 @@ def cardinality(self): sage: toric_varieties.P2().point_set().cardinality() # needs sage.geometry.polyhedron +Infinity - sage: P2 = toric_varieties.P2(base_ring=GF(3)) # needs sage.geometry.polyhedron sage.rings.finite_rings - sage: P2.point_set().cardinality() # needs sage.geometry.polyhedron sage.rings.finite_rings + sage: P2 = toric_varieties.P2(base_ring=GF(3)) # needs sage.geometry.polyhedron + sage: P2.point_set().cardinality() # needs sage.geometry.polyhedron 13 """ if hasattr(self, 'is_finite') and not self.is_finite(): @@ -761,8 +761,8 @@ def list(self): EXAMPLES:: - sage: P1 = toric_varieties.P1(base_ring=GF(3)) # needs sage.geometry.polyhedron sage.rings.finite_rings - sage: P1.point_set().list() # needs sage.geometry.polyhedron sage.rings.finite_rings + sage: P1 = toric_varieties.P1(base_ring=GF(3)) # needs sage.geometry.polyhedron + sage: P1.point_set().list() # needs sage.geometry.polyhedron ([0 : 1], [1 : 0], [1 : 1], [1 : 2]) """ return tuple(self) diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index 943b8adf74f..675cbc73f2e 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -513,7 +513,7 @@ def base_ring(self): :: - sage: # optional - sage, needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF((17,2)), [1,2,3,4,5]) sage: P = E.random_point() sage: P.base_ring() diff --git a/src/sage/schemes/generic/scheme.py b/src/sage/schemes/generic/scheme.py index d5cade5e5cc..fe55bca9117 100644 --- a/src/sage/schemes/generic/scheme.py +++ b/src/sage/schemes/generic/scheme.py @@ -736,11 +736,11 @@ def zeta_series(self, n, t): EXAMPLES:: sage: P. = PolynomialRing(GF(3)) - sage: C = HyperellipticCurve(x^3 + x^2 + 1) # needs sage.rings.finite_rings sage.schemes + sage: C = HyperellipticCurve(x^3 + x^2 + 1) # needs sage.schemes sage: R. = PowerSeriesRing(Integers()) - sage: C.zeta_series(4, t) # needs sage.rings.finite_rings sage.schemes + sage: C.zeta_series(4, t) # needs sage.schemes 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) # needs sage.rings.finite_rings + sage: (1+2*t+3*t^2)/(1-t)/(1-3*t) + O(t^5) 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 diff --git a/src/sage/schemes/generic/spec.py b/src/sage/schemes/generic/spec.py index 5fa86089b61..c9a07313bb3 100644 --- a/src/sage/schemes/generic/spec.py +++ b/src/sage/schemes/generic/spec.py @@ -174,7 +174,7 @@ def _apply_functor_to_morphism(self, f): sage: A. = GF(7)[] sage: B. = GF(7)[] sage: f = A.hom((t^2, t^3)) - sage: Spec(f) + sage: Spec(f) # indirect doctest 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/hyperelliptic_curves/hyperelliptic_generic.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py index e4dddf40713..d12cbbc10f6 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py @@ -126,12 +126,13 @@ def change_ring(self, R): EXAMPLES:: + sage: # needs sage.rings.padics sage: R. = QQ[] sage: H = HyperellipticCurve(x^5 - 10*x + 9) - sage: K = Qp(3, 5) # needs sage.rings.padics - sage: L. = K.extension(x^30 - 3) # needs sage.rings.padics - sage: HK = H.change_ring(K) # needs sage.rings.padics - sage: HL = HK.change_ring(L); HL # needs sage.rings.padics + 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 @@ -234,14 +235,15 @@ def is_smooth(self): infinity when viewed as a *plane* projective curve. This can be seen in the following example.:: - sage: R. = GF(27, 'a')[] # needs sage.rings.finite_rings - sage: H = HyperellipticCurve(x^10 + 2) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(27, 'a')[] + sage: H = HyperellipticCurve(x^10 + 2) sage: from sage.misc.verbose import set_verbose sage: set_verbose(-1) - sage: H.is_smooth() # needs sage.rings.finite_rings + sage: H.is_smooth() True sage: from sage.schemes.curves.projective_curve import ProjectivePlaneCurve - sage: ProjectivePlaneCurve.is_smooth(H) # needs sage.rings.finite_rings + sage: ProjectivePlaneCurve.is_smooth(H) False """ return True @@ -309,21 +311,25 @@ def odd_degree_model(self): 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] # needs sage.rings.number_field - sage: P3 = K3.factor(43)[0][0] # needs sage.rings.number_field - sage: Hp2.change_ring(K2.residue_field(P2)).frobenius_polynomial() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: P2 = K2.factor(43)[0][0] + sage: P3 = K3.factor(43)[0][0] + sage: Hp2.change_ring(K2.residue_field(P2)).frobenius_polynomial() x^4 - 16*x^3 + 134*x^2 - 688*x + 1849 - sage: Hp3.change_ring(K3.residue_field(P3)).frobenius_polynomial() # needs sage.rings.number_field + sage: Hp3.change_ring(K3.residue_field(P3)).frobenius_polynomial() x^4 - 16*x^3 + 134*x^2 - 688*x + 1849 + sage: H.change_ring(GF(43)).odd_degree_model().frobenius_polynomial() # needs sage.rings.finite_rings x^4 - 16*x^3 + 134*x^2 - 688*x + 1849 - sage: P2 = K2.factor(67)[0][0] # needs sage.rings.number_field - sage: P3 = K3.factor(67)[0][0] # needs sage.rings.number_field - sage: Hp2.change_ring(K2.residue_field(P2)).frobenius_polynomial() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: P2 = K2.factor(67)[0][0] + sage: P3 = K3.factor(67)[0][0] + sage: Hp2.change_ring(K2.residue_field(P2)).frobenius_polynomial() x^4 - 8*x^3 + 150*x^2 - 536*x + 4489 - sage: Hp3.change_ring(K3.residue_field(P3)).frobenius_polynomial() # needs sage.rings.number_field + sage: Hp3.change_ring(K3.residue_field(P3)).frobenius_polynomial() x^4 - 8*x^3 + 150*x^2 - 536*x + 4489 + sage: H.change_ring(GF(67)).odd_degree_model().frobenius_polynomial() # needs sage.rings.finite_rings x^4 - 8*x^3 + 150*x^2 - 536*x + 4489 @@ -382,17 +388,18 @@ def _magma_init_(self, magma): EXAMPLES:: + sage: # optional - magma 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 + sage: magma(C) 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 # needs 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 # needs sage.rings.finite_rings + sage: D = magma(C); D # needs 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 # needs sage.rings.finite_rings + sage: D.sage() # needs 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 """ diff --git a/src/sage/schemes/hyperelliptic_curves/invariants.py b/src/sage/schemes/hyperelliptic_curves/invariants.py index e1631774a12..05bffb5c113 100644 --- a/src/sage/schemes/hyperelliptic_curves/invariants.py +++ b/src/sage/schemes/hyperelliptic_curves/invariants.py @@ -175,8 +175,8 @@ def ubs(f): 'y2': 0, 'y3': 0} - sage: R. = GF(31)[] # needs sage.rings.finite_rings - sage: ubs(t^6 + 2*t^5 + t^2 + 3*t + 1) # needs sage.rings.finite_rings + sage: R. = GF(31)[] + sage: ubs(t^6 + 2*t^5 + t^2 + 3*t + 1) {'A': 0, 'B': -12, 'C': -15, @@ -219,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 # needs sage.rings.finite_rings + sage: Cs = tuple(map(GF(31), (2, 3, 4, 5))); Cs (2, 3, 4, 5) - sage: clebsch_to_igusa(*Cs) # needs sage.rings.finite_rings + sage: clebsch_to_igusa(*Cs) (8, 10, 15, 26) - sage: igusa_to_clebsch(*clebsch_to_igusa(*Cs)) # needs sage.rings.finite_rings + sage: igusa_to_clebsch(*clebsch_to_igusa(*Cs)) (2, 3, 4, 5) """ I2 = -120*A @@ -245,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 # needs sage.rings.finite_rings + sage: Is = tuple(map(GF(31), (-2400, 173700, 23112000, -10309890600))); Is (18, 7, 12, 27) - sage: igusa_to_clebsch(*Is) # needs sage.rings.finite_rings + sage: igusa_to_clebsch(*Is) (20, 25, 25, 12) - sage: clebsch_to_igusa(*igusa_to_clebsch(*Is)) # needs sage.rings.finite_rings + sage: clebsch_to_igusa(*igusa_to_clebsch(*Is)) (18, 7, 12, 27) """ A = -(+ I2) / 120 @@ -323,7 +323,7 @@ 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)) # needs sage.rings.finite_rings + sage: absolute_igusa_invariants_wamelen(GF(5)['x'](x^6 - 2*x)) Traceback (most recent call last): ... NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves @@ -358,7 +358,7 @@ def absolute_igusa_invariants_wamelen(f): TESTS:: - sage: absolute_igusa_invariants_wamelen(GF(3)['x'](x^5 - 2*x)) # needs sage.rings.finite_rings + sage: absolute_igusa_invariants_wamelen(GF(3)['x'](x^5 - 2*x)) Traceback (most recent call last): ... NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves @@ -397,7 +397,7 @@ def absolute_igusa_invariants_kohel(f): TESTS:: - sage: absolute_igusa_invariants_kohel(GF(2)['x'](x^5 - x)) # needs sage.rings.finite_rings + sage: absolute_igusa_invariants_kohel(GF(2)['x'](x^5 - x)) Traceback (most recent call last): ... NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py b/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py index 704fe0e7feb..8e2df486769 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py @@ -48,11 +48,9 @@ class HyperellipticJacobian_generic(Jacobian_generic): sage: P. = PolynomialRing(QQ) sage: f = x^5 - x + 1; h = x - sage: C = HyperellipticCurve(f,h,'u,v') - sage: C + sage: C = HyperellipticCurve(f,h,'u,v'); C Hyperelliptic Curve over Rational Field defined by v^2 + u*v = u^5 - u + 1 - sage: PP = C.ambient_space() - sage: PP + sage: PP = C.ambient_space(); PP Projective Space of dimension 2 over Rational Field sage: C.defining_polynomial() -x0^5 + x0*x1*x2^3 + x1^2*x2^3 + x0*x2^4 - x2^5 @@ -71,13 +69,15 @@ class HyperellipticJacobian_generic(Jacobian_generic): 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) # needs sage.rings.number_field - sage: P2 = C(K)([2, 4*t - 1, 1]) # needs sage.rings.number_field - sage: P3 = C(K)([-1/2, 1/8*(7*t+2), 1]) # needs sage.rings.number_field - sage: P1, P2, P3 # needs sage.rings.number_field + + sage: # needs sage.rings.number_field + 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 ((0 : 1 : 1), (2 : 4*t - 1 : 1), (-1/2 : 7/8*t + 1/4 : 1)) - sage: J = C.jacobian() - sage: J + + sage: J = C.jacobian(); J Jacobian of Hyperelliptic Curve over Rational Field defined by v^2 + u*v = u^5 - u + 1 sage: Q = J(QQ)(P); Q @@ -89,30 +89,32 @@ class HyperellipticJacobian_generic(Jacobian_generic): (u^2, v + 1) (u, v + 1) (1) - sage: Q1 = J(K)(P1); print("%s -> %s"%( P1, Q1 )) # needs sage.rings.number_field + + sage: # needs sage.rings.number_field + sage: Q1 = J(K)(P1); print("%s -> %s"%( P1, Q1 )) (0 : 1 : 1) -> (u, v - 1) - sage: Q2 = J(K)(P2); print("%s -> %s"%( P2, Q2 )) # needs sage.rings.number_field + sage: Q2 = J(K)(P2); print("%s -> %s"%( P2, Q2 )) (2 : 4*t - 1 : 1) -> (u - 2, v - 4*t + 1) - sage: Q3 = J(K)(P3); print("%s -> %s"%( P3, Q3 )) # needs sage.rings.number_field + sage: Q3 = J(K)(P3); print("%s -> %s"%( P3, Q3 )) (-1/2 : 7/8*t + 1/4 : 1) -> (u + 1/2, v - 7/8*t - 1/4) - sage: R. = PolynomialRing(K) # needs sage.rings.number_field - sage: Q4 = J(K)([x^2 - t, R(1)]) # needs sage.rings.number_field - sage: for i in range(4): Q4*i # needs sage.rings.number_field + sage: R. = PolynomialRing(K) + sage: Q4 = J(K)([x^2 - t, R(1)]) + sage: for i in range(4): Q4*i (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 # needs sage.rings.number_field + 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 # needs sage.rings.number_field + 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 # needs sage.rings.number_field + sage: R4 = Q4*5; R4 (u^2 - 3789465233/116983808*u - 267915823/58491904, v + (233827256513849/1789384327168*t + 1/2)*u + 15782925357447/894692163584*t) diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py b/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py index 6fc6453734c..a5f4f63876c 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py @@ -22,7 +22,6 @@ :: - sage: # needs sage.rings.finite_rings sage: F. = GF(3) sage: R. = F[] sage: f = x^5 - 1 @@ -99,7 +98,6 @@ def __call__(self, P): :: - sage: # needs sage.rings.finite_rings sage: F. = GF(3) sage: R. = F[] sage: f = x^5 - 1 diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py b/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py index abfb5f11f37..8c94ad5e705 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py @@ -54,24 +54,24 @@ 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 # needs sage.rings.finite_rings + sage: P1 = H.lift_x(2); P1 (2 : 11 : 1) - sage: Q1 = H.lift_x(10); Q1 # needs sage.rings.finite_rings + sage: Q1 = H.lift_x(10); Q1 (10 : 18 : 1) Observe that 2 and 10 are the roots of the polynomials in x, respectively:: - sage: P = J(P1); P # needs sage.rings.finite_rings + sage: P = J(P1); P (x + 35, y + 26) - sage: Q = J(Q1); Q # needs sage.rings.finite_rings + sage: Q = J(Q1); Q (x + 27, y + 19) :: - sage: P + Q # needs sage.rings.finite_rings + sage: P + Q (x^2 + 25*x + 20, y + 13*x) - sage: (x^2 + 25*x + 20).roots(multiplicities=False) # needs sage.rings.finite_rings + sage: (x^2 + 25*x + 20).roots(multiplicities=False) [10, 2] Frobenius satisfies @@ -85,7 +85,6 @@ :: - sage: # needs sage.rings.finite_rings sage: 1904*P (1) sage: 34*P == 0 @@ -97,7 +96,6 @@ :: - sage: # needs sage.rings.finite_rings sage: Q*1904 (1) sage: Q*238 == 0 @@ -385,13 +383,13 @@ def __init__(self, parent, polys, check=True): :: - sage: P1 = J(H.lift_x(2)); P1 # indirect doctest # needs sage.rings.finite_rings + sage: P1 = J(H.lift_x(2)); P1 # indirect doctest (x + 35, y + 26) - sage: P1.parent() # needs sage.rings.finite_rings + sage: P1.parent() 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) # needs sage.rings.finite_rings + sage: type(P1) """ SchemeMorphism.__init__(self, parent) @@ -668,11 +666,11 @@ def __bool__(self): :: - sage: P1 = J(H.lift_x(2)); P1 # needs sage.rings.finite_rings + sage: P1 = J(H.lift_x(2)); P1 (x + 35, y + 26) - sage: P1 == 0 # indirect doctest # needs sage.rings.finite_rings + sage: P1 == 0 # indirect doctest False - sage: P1 - P1 == 0 # indirect doctest # needs sage.rings.finite_rings + sage: P1 - P1 == 0 # indirect doctest True """ return self.__polys[0] != 1 @@ -683,7 +681,6 @@ def __neg__(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings 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)) @@ -696,7 +693,6 @@ def __neg__(self): :: - sage: # needs sage.rings.finite_rings 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 @@ -710,18 +706,19 @@ def __neg__(self): The following was fixed in :trac:`14264`:: + sage: # needs sage.rings.number_field sage: P. = QQ[] sage: f = x^5 - x + 1; h = x sage: C = HyperellipticCurve(f, h, 'u,v') sage: J = C.jacobian() - sage: K. = NumberField(x^2 - 2) # needs sage.rings.number_field - sage: R. = K[] # needs sage.rings.number_field - sage: Q = J(K)([x^2 - t, R(1)]) # needs sage.rings.number_field - sage: Q # needs sage.rings.number_field + sage: K. = NumberField(x^2 - 2) + sage: R. = K[] + sage: Q = J(K)([x^2 - t, R(1)]) + sage: Q (u^2 - t, v - 1) - sage: -Q # needs sage.rings.number_field + sage: -Q (u^2 - t, v + u + 1) - sage: Q + (-Q) # indirect doctest # needs sage.rings.number_field + sage: Q + (-Q) # indirect doctest (1) """ @@ -754,9 +751,9 @@ def _add_(self,other): :: - sage: P1 = J(H.lift_x(2)); P1 # needs sage.rings.finite_rings + sage: P1 = J(H.lift_x(2)); P1 (x + 35, y + 26) - sage: P1 + P1 # indirect doctest # needs sage.rings.finite_rings + sage: P1 + P1 # indirect doctest (x^2 + 33*x + 4, y + 13*x) """ X = self.parent() @@ -785,24 +782,24 @@ def _sub_(self, other): :: - sage: P1 = J(H.lift_x(2)); P1 # needs sage.rings.finite_rings + sage: P1 = J(H.lift_x(2)); P1 (x + 35, y + 26) - sage: P1 - P1 # indirect doctest # needs sage.rings.finite_rings + sage: P1 - P1 # indirect doctest (1) :: - sage: P2 = J(H.lift_x(4)); P2 # needs sage.rings.finite_rings + sage: P2 = J(H.lift_x(4)); P2 (x + 33, y + 34) Observe that the `x`-coordinates are the same but the `y`-coordinates differ:: - sage: P1 - P2 # indirect doctest # needs sage.rings.finite_rings + sage: P1 - P2 # indirect doctest (x^2 + 31*x + 8, y + 7*x + 12) - sage: P1 + P2 # indirect doctest # needs sage.rings.finite_rings + sage: P1 + P2 # indirect doctest (x^2 + 31*x + 8, y + 4*x + 18) - sage: (P1 - P2) - (P1 + P2) + 2*P2 # indirect doctest # needs sage.rings.finite_rings + sage: (P1 - P2) - (P1 + P2) + 2*P2 # indirect doctest (1) """ return self + (-other) diff --git a/src/sage/schemes/hyperelliptic_curves/mestre.py b/src/sage/schemes/hyperelliptic_curves/mestre.py index f86e33b7403..b63b1d3a403 100644 --- a/src/sage/schemes/hyperelliptic_curves/mestre.py +++ b/src/sage/schemes/hyperelliptic_curves/mestre.py @@ -82,9 +82,9 @@ def HyperellipticCurve_from_invariants(i, reduced=True, precision=None, An example over a finite field:: - sage: H = HyperellipticCurve_from_invariants([GF(13)(1), 3, 7, 5]); H # needs sage.rings.finite_rings + sage: H = HyperellipticCurve_from_invariants([GF(13)(1), 3, 7, 5]); H Hyperelliptic Curve over Finite Field of size 13 defined by ... - sage: H.igusa_clebsch_invariants() # needs sage.rings.finite_rings + sage: H.igusa_clebsch_invariants() (4, 9, 6, 11) An example over a number field:: @@ -123,13 +123,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)[] # needs sage.rings.finite_rings - sage: HyperellipticCurve(x^6 + x + 1).igusa_clebsch_invariants() # needs sage.rings.finite_rings + sage: P. = GF(3)[] + sage: HyperellipticCurve(x^6 + x + 1).igusa_clebsch_invariants() 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]) # needs sage.rings.finite_rings + sage: HyperellipticCurve_from_invariants([GF(5)(1), 1, 0, 1]) Traceback (most recent call last): ... ZeroDivisionError: inverse of Mod(0, 5) does not exist @@ -259,7 +259,7 @@ def Mestre_conic(i, xyz=False, names='u,v,w'): And over finite fields:: - sage: Mestre_conic([GF(7)(10), GF(7)(1), GF(7)(2), GF(7)(3)]) # needs sage.rings.finite_rings + 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 diff --git a/src/sage/schemes/plane_conics/con_field.py b/src/sage/schemes/plane_conics/con_field.py index 23acc3da6d9..269170c563c 100644 --- a/src/sage/schemes/plane_conics/con_field.py +++ b/src/sage/schemes/plane_conics/con_field.py @@ -194,7 +194,6 @@ def derivative_matrix(self): An example in characteristic `2`:: - sage: # needs sage.rings.finite_rings sage: P. = GF(2)[] sage: c = Conic([t, 1, t^2, 1, 1, 0]); c # needs sage.libs.ntl Projective Conic Curve over Fraction Field of Univariate @@ -313,7 +312,7 @@ def diagonalization(self, names=None): EXAMPLES:: - sage: Conic(GF(5), [1,0,1,1,0,1]).diagonalization() # needs sage.rings.finite_rings + 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, Scheme morphism: @@ -345,7 +344,6 @@ def diagonalization(self, names=None): :: - sage: # needs sage.rings.finite_rings sage: K = FractionField(PolynomialRing(GF(7), 't')) sage: (t,) = K.gens() sage: C = Conic(K, [t/2,0, 1, 2, 0, 3]) @@ -396,8 +394,8 @@ def gens(self): :: - sage: C. = Conic(GF(3), [1, 1, 1]) # needs sage.rings.finite_rings - sage: C # needs sage.rings.finite_rings + sage: C. = Conic(GF(3), [1, 1, 1]) + sage: C Projective Conic Curve over Finite Field of size 3 defined by a^2 + b^2 + c^2 @@ -462,6 +460,7 @@ def has_rational_point(self, point=False, numbers, one does not. Check that they are both handled correctly by the Magma interface. :: + sage: # needs sage.rings.number_field sage: K. = QuadraticField(-1) sage: K.coerce_embedding() Generic morphism: @@ -471,8 +470,9 @@ def has_rational_point(self, point=False, sage: Conic(K, [1,1,1]).rational_point(algorithm='magma') # optional - magma (-i : 1 : 0) + sage: # needs sage.rings.number_field sage: x = QQ['x'].gen() - sage: L. = NumberField(x^2+1, embedding=None) + sage: L. = NumberField(x^2 + 1, embedding=None) sage: Conic(L, [1,1,1]).rational_point(algorithm='magma') # optional - magma (-i : 1 : 0) sage: L == K @@ -603,10 +603,10 @@ def has_singular_point(self, point=False): (True, (a + 1 : 0 : 1)) sage: P. = GF(2)[] - sage: C = Conic(P, [t,t,1]); C # needs sage.libs.ntl sage.rings.finite_rings + sage: C = Conic(P, [t,t,1]); C # needs sage.libs.ntl 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) # needs sage.libs.ntl sage.rings.finite_rings + sage: C.has_singular_point(point=False) # needs sage.libs.ntl Traceback (most recent call last): ... NotImplementedError: Sorry, find singular point on conics not implemented @@ -774,30 +774,30 @@ def _magma_init_(self, magma): EXAMPLES:: + sage: # optional - magma sage: C = Conic(QQ, [1,2,3]) - sage: C._magma_init_(magma) # optional - magma + sage: C._magma_init_(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 # needs sage.rings.finite_rings - sage: C._magma_init_(magma) # optional - magma # needs sage.rings.finite_rings + sage: C = Conic(GF(41), [-1,2,5]) + sage: C._magma_init_(magma) '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) # needs sage.rings.finite_rings - sage: C = Conic([3,0,1,4,a,2]) # needs sage.rings.finite_rings - sage: C # needs sage.rings.finite_rings + sage: C = Conic([3,0,1,4,a,2]); C # needs 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 # needs sage.rings.finite_rings + sage: magma(C) # needs 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])) 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])) 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) # needs sage.rings.number_field - sage: magma(Conic([b,1,2])) # optional - magma # needs sage.rings.number_field + sage: magma(Conic([b,1,2])) # needs 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 """ @@ -854,7 +854,7 @@ 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 # needs sage.rings.finite_rings + sage: f, g = c.parametrization(); f, g (Scheme morphism: From: Projective Space of dimension 1 over Finite Field of size 2 To: Projective Conic Curve over Finite Field of size 2 @@ -865,7 +865,7 @@ def parametrization(self, point=None, morphism=True): 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()) # needs sage.rings.finite_rings + sage: set(f(p) for p in f.domain()) {(0 : 0 : 1), (0 : 1 : 1), (1 : 0 : 1)} Verfication of the example :: @@ -1014,7 +1014,7 @@ 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)] # random # needs sage.rings.finite_rings + sage: [c.random_rational_point() for i in range(10)] # 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)] @@ -1067,7 +1067,7 @@ def rational_point(self, algorithm='default', read_cache=True): 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') + sage: C.rational_point(algorithm='rnfisnorm') Traceback (most recent call last): ... ValueError: Conic Projective Conic Curve over Rational Field defined by @@ -1075,18 +1075,19 @@ def rational_point(self, algorithm='default', read_cache=True): Examples over number fields :: + sage: # needs sage.rings.number_field sage: P. = QQ[] - sage: L. = NumberField(x^3 - 5) # needs sage.rings.number_field - sage: C = Conic(L, [3, 2, -b]) # needs sage.rings.number_field - sage: p = C.rational_point(algorithm = 'rnfisnorm') # needs sage.rings.number_field - sage: p # output is random # needs sage.rings.number_field + 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 (1/3*b^2 - 4/3*b + 4/3 : b^2 - 2 : 1) - sage: C.defining_polynomial()(list(p)) # needs sage.rings.number_field + sage: C.defining_polynomial()(list(p)) 0 sage: K. = QuadraticField(-1) # needs sage.rings.number_field sage: D = Conic(K, [3, 2, 5]) # needs sage.rings.number_field - sage: D.rational_point(algorithm = 'rnfisnorm') # output is random # needs sage.rings.number_field + sage: D.rational_point(algorithm='rnfisnorm') # output is random # needs sage.rings.number_field (-3 : 4*i : 1) sage: # needs sage.rings.number_field @@ -1103,27 +1104,25 @@ def rational_point(self, algorithm='default', read_cache=True): sage: # optional - magma, needs sage.rings.number_field sage: q = C.rational_point(algorithm='magma', ....: read_cache=False) - sage: q # output is random, + sage: q # output is random (1/5*b^2 : 1/5*b^2 : 1) sage: C.defining_polynomial()(list(q)) 0 sage: len(str(p)) > 1.5*len(str(q)) True - - sage: D.rational_point(algorithm='magma', # optional - magma # needs sage.rings.number_field + sage: D.rational_point(algorithm='magma', (1 : 2*i : 1) - - sage: E.rational_point(algorithm='magma', # optional - magma # needs sage.rings.number_field + sage: E.rational_point(algorithm='magma', ....: read_cache=False) (-s : 1 : 1) sage: # needs sage.rings.number_field sage: F = Conic([L.gen(), 30, -20]) sage: q = F.rational_point(algorithm='magma') # optional - magma - sage: q # optional - magma + sage: q # random # optional - magma (-10/7*s + 40/7 : 5/7*s - 6/7 : 1) sage: p = F.rational_point(read_cache=False) - sage: p # random + sage: p # random (788210*s - 1114700 : -171135*s + 242022 : 1) sage: len(str(p)) > len(str(q)) # optional - magma True @@ -1167,10 +1166,10 @@ def rational_point(self, algorithm='default', read_cache=True): Examples over `\RR` and `\CC` :: - sage: Conic(CC, [1, 2, 3]).rational_point() # needs sage.rings.finite_rings + sage: Conic(CC, [1, 2, 3]).rational_point() (0 : 1.22474487139159*I : 1) - sage: Conic(RR, [1, 1, 1]).rational_point() # needs sage.rings.finite_rings + sage: Conic(RR, [1, 1, 1]).rational_point() Traceback (most recent call last): ... ValueError: Conic Projective Conic Curve over Real Field 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 3bc870a75f1..1b3f0ac412a 100644 --- a/src/sage/schemes/plane_conics/con_rational_function_field.py +++ b/src/sage/schemes/plane_conics/con_rational_function_field.py @@ -480,17 +480,18 @@ def find_point(self, supports, roots, case, solution=0): Different solubility certificates give different points:: + sage: # needs sage.rings.number_field sage: K. = PolynomialRing(QQ, 't') 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] # needs sage.rings.number_field - sage: tbar2 = QQ.extension(supp[1][0], 'tbar').gens()[0] # needs sage.rings.number_field - sage: tbar3 = QQ.extension(supp[2][0], 'tbar').gens()[0] # needs sage.rings.number_field - sage: roots = [[tbar1 + 1], [1/3*tbar2^0], [2/3*tbar3^2 + 11/3*tbar3 - 3]] # needs sage.rings.number_field - sage: C.find_point(supp, roots, 1) # needs sage.rings.number_field + sage: tbar1 = QQ.extension(supp[0][0], 'tbar').gens()[0] + sage: tbar2 = QQ.extension(supp[1][0], 'tbar').gens()[0] + sage: tbar3 = QQ.extension(supp[2][0], 'tbar').gens()[0] + sage: roots = [[tbar1 + 1], [1/3*tbar2^0], [2/3*tbar3^2 + 11/3*tbar3 - 3]] + sage: C.find_point(supp, roots, 1) (3 : t + 1 : 1) - sage: roots = [[-tbar1 - 1], [-1/3*tbar2^0], [-2/3*tbar3^2 - 11/3*tbar3 + 3]] # needs sage.rings.number_field - sage: C.find_point(supp, roots, 1) # needs sage.rings.number_field + sage: roots = [[-tbar1 - 1], [-1/3*tbar2^0], [-2/3*tbar3^2 - 11/3*tbar3 + 3]] + sage: C.find_point(supp, roots, 1) (3 : -t - 1 : 1) """ Ft = self.base().base() diff --git a/src/sage/schemes/plane_conics/constructor.py b/src/sage/schemes/plane_conics/constructor.py index b1787330287..20bc5630ac1 100644 --- a/src/sage/schemes/plane_conics/constructor.py +++ b/src/sage/schemes/plane_conics/constructor.py @@ -106,7 +106,7 @@ def Conic(base_field, F=None, names=None, unique=True): 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') # needs sage.rings.finite_rings + 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 @@ -116,16 +116,16 @@ def Conic(base_field, F=None, names=None, unique=True): 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 # needs sage.rings.finite_rings + sage: C = Conic(x^2 + y^2 - 2*z^2); C 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') # needs sage.rings.finite_rings + sage: Conic(C.symmetric_matrix(), 'x,y,z') 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') # needs sage.rings.finite_rings + 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 diff --git a/src/sage/schemes/product_projective/morphism.py b/src/sage/schemes/product_projective/morphism.py index 8d710013841..4a6bbdbf160 100644 --- a/src/sage/schemes/product_projective/morphism.py +++ b/src/sage/schemes/product_projective/morphism.py @@ -449,13 +449,14 @@ def global_height(self, prec=None): :: + sage: # needs sage.rings.number_field sage: u = QQ['u'].0 - sage: R = NumberField(u^2 - 2, 'v') # needs sage.rings.number_field - sage: PP. = ProductProjectiveSpaces([1, 1], R) # needs sage.rings.number_field - sage: H = End(PP) # needs sage.rings.number_field - sage: O = R.maximal_order() # needs 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]) # needs sage.rings.number_field - sage: g.global_height() # needs sage.rings.number_field sage.rings.real_mpfr + 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() # needs sage.rings.real_mpfr 2.56494935746154 """ K = self.domain().base_ring() @@ -495,12 +496,13 @@ def local_height(self, v, prec=None): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2 - 5) # needs sage.rings.number_field - sage: P. = ProductProjectiveSpaces([1, 1], K) # needs sage.rings.number_field - sage: H = Hom(P, P) # needs 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]) # needs sage.rings.number_field - sage: f.local_height(K.ideal(3)) # needs sage.rings.number_field sage.rings.real_mpfr + 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)) # needs sage.rings.real_mpfr 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 acb7868576b..608e97bf1e0 100644 --- a/src/sage/schemes/product_projective/point.py +++ b/src/sage/schemes/product_projective/point.py @@ -450,11 +450,12 @@ def global_height(self, prec=None): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: k. = NumberField(x^2 + 5) # needs sage.rings.number_field - sage: PP = ProductProjectiveSpaces(k, [1, 2], 'y') # needs sage.rings.number_field - sage: Q = PP([3, 5*w + 1, 1, 7*w, 10]) # needs sage.rings.number_field - sage: Q.global_height() # needs sage.rings.number_field + 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() 2.75062910527236 :: diff --git a/src/sage/schemes/product_projective/rational_point.py b/src/sage/schemes/product_projective/rational_point.py index 1c4f6704e8a..5375ffb4535 100644 --- a/src/sage/schemes/product_projective/rational_point.py +++ b/src/sage/schemes/product_projective/rational_point.py @@ -207,13 +207,14 @@ def enum_product_projective_number_field(X, **kwds): EXAMPLES:: + sage: # needs sage.rings.number_field sage: u = QQ['u'].0 - sage: K = NumberField(u^2 + 2, 'v') # needs sage.rings.number_field - sage: PP. = ProductProjectiveSpaces([1, 1], K) # needs sage.rings.number_field - sage: X = PP.subscheme([x^2 + 2*y^2]) # needs sage.rings.number_field + sage: K = NumberField(u^2 + 2, 'v') + sage: PP. = ProductProjectiveSpaces([1, 1], K) + sage: X = PP.subscheme([x^2 + 2*y^2]) sage: from sage.schemes.product_projective.rational_point import \ enum_product_projective_number_field - sage: enum_product_projective_number_field(X, bound=1.5) # needs sage.rings.number_field + sage: enum_product_projective_number_field(X, bound=1.5) [(-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), diff --git a/src/sage/schemes/projective/projective_rational_point.py b/src/sage/schemes/projective/projective_rational_point.py index 6e81ea16b7b..31dc0703b5a 100644 --- a/src/sage/schemes/projective/projective_rational_point.py +++ b/src/sage/schemes/projective/projective_rational_point.py @@ -185,21 +185,23 @@ def enum_projective_number_field(X, **kwds): EXAMPLES:: + sage: # needs sage.rings.number_field 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') # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field - sage: X = P.subscheme([x - y]) # needs sage.rings.number_field - sage: enum_projective_number_field(X(K), bound=RR(5^(1/3)), prec=2^10) # needs sage.rings.number_field + 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) [(0 : 0 : 1), (1 : 1 : 0), (-1 : -1 : 1), (1 : 1 : 1)] :: + sage: # needs sage.rings.number_field sage: u = QQ['u'].0 - sage: K = NumberField(u^2 + 3, 'v') # needs sage.rings.number_field - sage: A. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: X = A.subscheme(x - y) # needs sage.rings.number_field - sage: enum_projective_number_field(X, bound=2) # needs sage.rings.number_field + sage: K = NumberField(u^2 + 3, 'v') + sage: A. = ProjectiveSpace(K, 1) + sage: X = A.subscheme(x - y) + sage: enum_projective_number_field(X, bound=2) [(1 : 1)] """ B = kwds.pop('bound') @@ -243,8 +245,6 @@ def enum_projective_finite_field(X): EXAMPLES:: - sage: F = GF(53) # needs sage.rings.finite_rings - sage: P. = ProjectiveSpace(2, F) # needs sage.rings.finite_rings sage: from sage.schemes.projective.projective_rational_point import enum_projective_finite_field sage: F = GF(53) sage: P. = ProjectiveSpace(2, F) @@ -256,10 +256,10 @@ def enum_projective_finite_field(X): :: sage: # needs sage.rings.finite_rings - sage: F = GF(9, 'a') # needs sage.rings.finite_rings + sage: F = GF(9, 'a') sage: P. = ProjectiveSpace(2,F) - sage: C = Curve(X^3 - Y^3 + Z^2*Y) # needs sage.rings.finite_rings sage.schemes - sage: enum_projective_finite_field(C(F)) # needs sage.rings.finite_rings sage.schemes + sage: C = Curve(X^3 - Y^3 + Z^2*Y) # needs sage.schemes + sage: enum_projective_finite_field(C(F)) # needs sage.schemes [(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)] diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index d2bbee01716..ecb34f8230a 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -1836,12 +1836,13 @@ def hyperplane_transformation_matrix(self, plane_1, plane_2): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 3) # needs sage.rings.number_field - sage: plane1 = P.subscheme(k*x + 2*k*y + z) # needs sage.rings.number_field - sage: plane2 = P.subscheme(7*k*x + y + 9*z) # needs sage.rings.number_field - sage: m = P.hyperplane_transformation_matrix(plane1, plane2); m # needs sage.modules sage.rings.number_field + 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 # needs sage.modules [ 1 0 0 0] [ 0 14*k 0 0] [ 0 0 7/9 0] diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index 3a852c3af37..31109f1b92c 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -168,16 +168,17 @@ def dimension(self): EXAMPLES:: + sage: # needs sage.libs.singular sage: P2. = ProjectiveSpace(2, QQ) - sage: P2.subscheme([]).dimension() # needs sage.libs.singular + sage: P2.subscheme([]).dimension() 2 - sage: P2.subscheme([x]).dimension() # needs sage.libs.singular + sage: P2.subscheme([x]).dimension() 1 - sage: P2.subscheme([x^5]).dimension() # needs sage.libs.singular + sage: P2.subscheme([x^5]).dimension() 1 - sage: P2.subscheme([x^2 + y^2 - z^2]).dimension() # needs sage.libs.singular + sage: P2.subscheme([x^2 + y^2 - z^2]).dimension() 1 - sage: P2.subscheme([x*(x-z), y*(y-z)]).dimension() # needs sage.libs.singular + sage: P2.subscheme([x*(x-z), y*(y-z)]).dimension() 0 Something less obvious:: @@ -221,20 +222,21 @@ def affine_patch(self, i, AA=None): EXAMPLES:: + sage: # needs sage.libs.singular sage: PP = ProjectiveSpace(2, QQ, names='X,Y,Z') sage: X,Y,Z = PP.gens() sage: C = PP.subscheme(X^3*Y + Y^3*Z + Z^3*X) - sage: U = C.affine_patch(0); U # needs sage.libs.singular + sage: U = C.affine_patch(0); U Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: Y^3*Z + Z^3 + Y - sage: U.embedding_morphism() # needs sage.libs.singular + 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 Defn: Defined on coordinates by sending (Y, Z) to (1 : Y : Z) - sage: U.projective_embedding() is U.embedding_morphism() # needs sage.libs.singular + sage: U.projective_embedding() is U.embedding_morphism() True :: @@ -409,23 +411,24 @@ def is_smooth(self, point=None): EXAMPLES:: + sage: # needs sage.libs.singular 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 - sage: cuspidal_curve.is_smooth([1,1,1]) # needs sage.libs.singular + sage: cuspidal_curve.is_smooth([1,1,1]) True - sage: cuspidal_curve.is_smooth([0,0,1]) # needs sage.libs.singular + sage: cuspidal_curve.is_smooth([0,0,1]) False - sage: cuspidal_curve.is_smooth() # needs sage.libs.singular + sage: cuspidal_curve.is_smooth() False - sage: P2.subscheme([y^2*z - x^3 + z^3 + 1/10*x*y*z]).is_smooth() # needs sage.libs.singular + sage: P2.subscheme([y^2*z - x^3 + z^3 + 1/10*x*y*z]).is_smooth() True TESTS:: - sage: H = P2.subscheme(x) + sage: H = P2.subscheme(x) # needs sage.libs.singular sage: H.is_smooth() # one of the few cases where the cone over the subvariety is smooth # needs sage.libs.singular True """ @@ -658,12 +661,13 @@ def _forward_image(self, f, check=True): :: + sage: # needs sage.rings.padics sage: set_verbose(-1) - sage: PS. = ProjectiveSpace(Qp(3), 2) # needs sage.rings.padics + 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) # needs sage.libs.singular sage.rings.padics + sage: f(X) # needs sage.libs.singular Closed subscheme of Projective Space of dimension 2 over 3-adic Field with capped relative precision 20 defined by: z, @@ -1029,7 +1033,7 @@ def degree(self): sage: P. = ProjectiveSpace(GF(13), 3) sage: X = P.subscheme([y^3 - w^3, x + 7*z]) - sage: X.degree() # needs sage.libs.singular sage.rings.finite_rings + sage: X.degree() # needs sage.libs.singular 3 sage: P. = ProjectiveSpace(QQ, 4) @@ -1301,7 +1305,7 @@ def Chow_form(self): sage: P. = ProjectiveSpace(GF(17), 3) sage: X = P.subscheme([x3 + x1, x2 - x0, x2 - x3]) - sage: X.Chow_form() # needs sage.libs.singular sage.rings.finite_rings + sage: X.Chow_form() # needs sage.libs.singular t0 - t1 + t2 + t3 :: @@ -1313,11 +1317,12 @@ def Chow_form(self): :: + sage: # needs sage.libs.singular 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 # needs sage.libs.singular + 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 # needs sage.libs.singular + 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, @@ -1328,8 +1333,8 @@ def Chow_form(self): 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() # needs sage.libs.singular - sage: I.saturation(I.ring().ideal(list(I.ring().gens())))[0] # needs sage.libs.singular + 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 """ From 0b4207eaf90a377b0346f4d6aecb809c5f4031b8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 18 Aug 2023 19:16:05 -0700 Subject: [PATCH 053/423] sage.schemes: Yet more block tags, remove many unnecessary # needs - sage.rings.finite_rings --- .../modular/overconvergent/weightspace.py | 2 +- .../schemes/berkovich/berkovich_cp_element.py | 404 +++++++++--------- src/sage/schemes/berkovich/berkovich_space.py | 178 ++++---- .../elliptic_curves/ell_curve_isogeny.py | 185 +++----- src/sage/schemes/elliptic_curves/ell_field.py | 4 +- .../elliptic_curves/isogeny_small_degree.py | 61 ++- src/sage/schemes/toric/homset.py | 46 +- src/sage/schemes/toric/ideal.py | 2 +- src/sage/schemes/toric/library.py | 2 +- src/sage/schemes/toric/points.py | 185 ++++---- src/sage/schemes/toric/toric_subscheme.py | 4 +- src/sage/schemes/toric/variety.py | 16 +- src/sage/schemes/toric/weierstrass_higher.py | 1 - 13 files changed, 512 insertions(+), 578 deletions(-) diff --git a/src/sage/modular/overconvergent/weightspace.py b/src/sage/modular/overconvergent/weightspace.py index 5cedff8a101..e9478c40a90 100644 --- a/src/sage/modular/overconvergent/weightspace.py +++ b/src/sage/modular/overconvergent/weightspace.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.padics +# sage.doctest: needs sage.rings.padics r""" The space of `p`-adic weights diff --git a/src/sage/schemes/berkovich/berkovich_cp_element.py b/src/sage/schemes/berkovich/berkovich_cp_element.py index 37004b35cc5..65ae0aae6ce 100644 --- a/src/sage/schemes/berkovich/berkovich_cp_element.py +++ b/src/sage/schemes/berkovich/berkovich_cp_element.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.rings.padics r""" Elements of Berkovich space. @@ -62,13 +63,13 @@ class Berkovich_Element_Cp(Berkovich_Element): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics - sage: B(2) # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: B(2) Type I point centered at 2 + O(3^20) :: - sage: B(0, 1) # needs sage.rings.padics + sage: B(0, 1) Type II point centered at 0 of radius 3^0 """ @@ -78,8 +79,8 @@ def __init__(self, parent, center, radius=None, power=None, prec=20, space_type= EXAMPLES:: - sage: B = Berkovich_Cp_Affine(5) # needs sage.rings.padics - sage: B(4) # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(5) + sage: B(4) Type I point centered at 4 + O(5^20) """ from sage.rings.function_field.element import is_FunctionFieldElement @@ -426,7 +427,7 @@ def _custom_abs(self, x): :: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Affine(Qp(3)) sage: Q1 = B(9) sage: Q1._custom_abs(Q1.center()) @@ -451,7 +452,7 @@ def center_function(self): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Projective(5) sage: L. = PolynomialRing(Qp(5)) sage: T = FractionField(L) @@ -480,7 +481,7 @@ def radius_function(self): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Projective(5) sage: L. = PolynomialRing(Qp(5)) sage: T = FractionField(L) @@ -509,14 +510,14 @@ def precision(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(Qp(3)) # needs sage.rings.padics - sage: d = B([2, 2, 2], [1.761, 1.123, 1.112]) # needs sage.rings.padics - sage: d.precision() # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(Qp(3)) + sage: d = B([2, 2, 2], [1.761, 1.123, 1.112]) + sage: d.precision() 3 TESTS:: - sage: d.precision == d.prec # needs sage.rings.padics + sage: d.precision == d.prec True """ if self._type in [1, 2, 3]: @@ -540,8 +541,8 @@ def ideal(self): :: - sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics - sage: B(0).ideal() # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: B(0).ideal() """ return self.parent().ideal() @@ -560,15 +561,15 @@ def power(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics - sage: Q1 = B(1, 9) # needs sage.rings.padics - sage: Q1.power() # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: Q1 = B(1, 9) + sage: Q1.power() 2 :: - sage: Q2 = B(1, 4) # needs sage.rings.padics - sage: Q2.power() # needs sage.rings.padics + sage: Q2 = B(1, 4) + sage: Q2.power() 1.26185950714291 """ if self._type in [1, 4]: @@ -586,15 +587,15 @@ def radius(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics - sage: Q1 = B(1, 2/5) # needs sage.rings.padics - sage: Q1.radius() # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: Q1 = B(1, 2/5) + sage: Q1.radius() 0.400000000000000 :: - sage: d = B([2, 2, 2], [1.761, 1.123, 1.112]) # needs sage.rings.padics - sage: d.radius() # needs sage.rings.padics + sage: d = B([2, 2, 2], [1.761, 1.123, 1.112]) + sage: d.radius() [1.76100000000000, 1.12300000000000, 1.11200000000000] """ if self._type == 4: @@ -621,20 +622,20 @@ def diameter(self, basepoint=Infinity): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics - sage: Q1 = B(3) # needs sage.rings.padics - sage: Q1.diameter() # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: Q1 = B(3) + sage: Q1.diameter() 0 :: - sage: Q2 = B(1/2, 9) # needs sage.rings.padics - sage: Q2.diameter() # needs sage.rings.padics + sage: Q2 = B(1/2, 9) + sage: Q2.diameter() 9.00000000000000 The diameter of a type IV point is the limit of the radii:: - sage: # needs sage.rings.padics + sage: sage: R. = PolynomialRing(Qp(3)) sage: f = R(2) sage: S. = PolynomialRing(RR) @@ -645,7 +646,7 @@ def diameter(self, basepoint=Infinity): :: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Affine(3) sage: Q1 = B(1/81, 1) sage: Q2 = B(1/3) @@ -654,7 +655,7 @@ def diameter(self, basepoint=Infinity): :: - sage: Q2.diameter(Q2) # needs sage.rings.padics + sage: Q2.diameter(Q2) +infinity """ if basepoint == Infinity: @@ -698,7 +699,7 @@ def path_distance_metric(self, other): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Affine(3) sage: Q1 = B(1/4, 4) sage: Q2 = B(1/4, 6) @@ -707,13 +708,13 @@ def path_distance_metric(self, other): :: - sage: Q3 = B(1) # needs sage.rings.padics - sage: Q3.path_distance_metric(Q1) # needs sage.rings.padics + sage: Q3 = B(1) + sage: Q3.path_distance_metric(Q1) +infinity :: - sage: Q3.path_distance_metric(Q3) # needs sage.rings.padics + sage: Q3.path_distance_metric(Q3) 0 """ if not isinstance(other, type(self)): @@ -750,7 +751,7 @@ def Hsia_kernel(self, other, basepoint): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(2, 9) sage: Q2 = B(1/27, 1/27) @@ -760,7 +761,7 @@ def Hsia_kernel(self, other, basepoint): :: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(2, 9) sage: Q2 = B(1/2) @@ -798,7 +799,7 @@ def small_metric(self, other): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Affine(3) sage: Q1 = B(1/4, 4) sage: Q2 = B(1/4, 6) @@ -862,7 +863,7 @@ def potential_kernel(self, other, basepoint): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(27, 1) sage: Q2 = B(1/3, 2) @@ -872,7 +873,7 @@ def potential_kernel(self, other, basepoint): :: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Affine(3) sage: Q1 = B(27, 1) sage: Q2 = B(1/3, 2) @@ -906,7 +907,7 @@ def spherical_kernel(self, other): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(2, 2) sage: Q2 = B(1/9, 1) @@ -915,8 +916,8 @@ def spherical_kernel(self, other): :: - sage: Q3 = B(2) # needs sage.rings.padics - sage: Q3.spherical_kernel(Q3) # needs sage.rings.padics + sage: Q3 = B(2) + sage: Q3.spherical_kernel(Q3) 0 """ if not isinstance(other, type(self)): @@ -945,7 +946,7 @@ def Hsia_kernel_infinity(self, other): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Affine(Qp(3)) sage: Q1 = B(1/4, 4) sage: Q2 = B(1/4, 6) @@ -975,14 +976,14 @@ def center(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics - sage: B(3, 1).center() # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: B(3, 1).center() 3 + O(3^21) :: - sage: C = Berkovich_Cp_Projective(3) # needs sage.rings.padics - sage: C(3, 1).center() # needs sage.rings.padics + sage: C = Berkovich_Cp_Projective(3) + sage: C(3, 1).center() (3 + O(3^21) : 1 + O(3^20)) :: @@ -1007,13 +1008,13 @@ def type_of_point(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics - sage: B(1).type_of_point() # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: B(1).type_of_point() 1 :: - sage: B(0, 1).type_of_point() # needs sage.rings.padics + sage: B(0, 1).type_of_point() 2 """ return ZZ(self._type) @@ -1026,8 +1027,8 @@ def prime(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics - sage: B(1).prime() # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: B(1).prime() 3 """ return ZZ(self._p) @@ -1038,7 +1039,7 @@ def __ne__(self, other): EXAMPLES:: - sage: # needs sage.rings.padics sage.symbolic + sage: # needs sage.symbolic sage: B = Berkovich_Cp_Affine(3) sage: Q1 = B(3, 3**(1/2)) sage: Q2 = B(3, RR(3**(1/2))) @@ -1053,8 +1054,8 @@ def _repr_(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics - sage: B(2, 1) # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: B(2, 1) Type II point centered at (2 + O(3^20) : 1 + O(3^20)) of radius 3^0 """ if self._type == 1: @@ -1083,8 +1084,8 @@ def _latex_(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics - sage: latex(B(2, 1)) # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: latex(B(2, 1)) \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 @@ -1148,46 +1149,46 @@ 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)) # needs sage.rings.padics - sage: B(4) # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(Qp(3)) + sage: B(4) 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) # needs sage.rings.padics - sage: B(1 + t) # needs sage.rings.padics + sage: A. = Qq(27) + sage: B(1 + t) 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)) # needs sage.rings.padics sage.symbolic + sage: B(2, 3**(1/2)) # needs sage.symbolic Type II point centered at 2 + O(3^20) of radius 3^1/2 :: - sage: B(2, 1.6) # needs sage.rings.padics + sage: B(2, 1.6) 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 # needs sage.rings.padics + sage: B(3, 3**0.5) # not tested 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)) # needs sage.rings.padics + sage: B(3, power=RR(1/100000)) 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]) # needs sage.rings.padics + sage: B([Qp(3)(2), Qp(3)(2), Qp(3)(2)], [1.761, 1.123, 1.112]) 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: # needs sage.rings.padics + sage: sage: A. = Qq(27) sage: R. = PolynomialRing(A) sage: f = (1 + t)^2*x @@ -1201,7 +1202,7 @@ class Berkovich_Element_Cp_Affine(Berkovich_Element_Cp): 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) # needs sage.rings.padics + sage: B(f, g, prec=100, error_check=False) 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 @@ -1222,7 +1223,7 @@ class Berkovich_Element_Cp_Affine(Berkovich_Element_Cp): TESTS:: - sage: # needs sage.rings.padics + sage: sage: A = Berkovich_Cp_Affine(3) sage: Q1 = A(3, 1); Q1 Type II point centered at 3 + O(3^21) of radius 3^0 @@ -1249,7 +1250,7 @@ class Berkovich_Element_Cp_Affine(Berkovich_Element_Cp): sage: Q5 == Q6 # needs sage.symbolic True - sage: # needs sage.rings.padics + sage: sage: k = Qp(5) sage: R. = k[] sage: l. = k.extension(x^2 - 5) @@ -1257,7 +1258,7 @@ class Berkovich_Element_Cp_Affine(Berkovich_Element_Cp): sage: B(w, power=1) Type II point centered at w + O(w^41) of radius 5^1 - sage: TestSuite(Q5).run() # needs sage.rings.padics + sage: TestSuite(Q5).run() """ def __init__(self, parent, center, radius=None, power=None, prec=20, error_check=True): @@ -1266,8 +1267,8 @@ def __init__(self, parent, center, radius=None, power=None, prec=20, error_check EXAMPLES:: - sage: A = Berkovich_Cp_Affine(17) # needs sage.rings.padics - sage: A(5, 1) # needs sage.rings.padics + sage: A = Berkovich_Cp_Affine(17) + sage: A(5, 1) 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 @@ -1293,18 +1294,18 @@ def as_projective_point(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(5) # needs sage.rings.padics - sage: B(5).as_projective_point() # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(5) + sage: B(5).as_projective_point() Type I point centered at (5 + O(5^21) : 1 + O(5^20)) :: - sage: B(0, 1).as_projective_point() # needs sage.rings.padics + sage: B(0, 1).as_projective_point() Type II point centered at (0 : 1 + O(5^20)) of radius 5^0 :: - sage: # needs sage.rings.padics + sage: sage: L. = PolynomialRing(Qp(5)) sage: T = FractionField(L) sage: f = T(1/t) @@ -1340,7 +1341,7 @@ def __eq__(self, other): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(1, RR(3**(1/2))) # needs sage.symbolic sage: Q2 = B(1, 3**(1/2)) # needs sage.symbolic @@ -1349,20 +1350,20 @@ def __eq__(self, other): :: - sage: Q3 = B(1) # needs sage.rings.padics - sage: Q4 = B(4) # needs sage.rings.padics - sage: Q3 == Q4 # needs sage.rings.padics + sage: Q3 = B(1) + sage: Q4 = B(4) + sage: Q3 == Q4 False :: - sage: Q5 = B(1, 4) # needs sage.rings.padics - sage: Q1 == Q5 # needs sage.rings.padics sage.symbolic + sage: Q5 = B(1, 4) + sage: Q1 == Q5 # needs sage.symbolic False :: - sage: Q1 == Q3 # needs sage.rings.padics sage.symbolic + sage: Q1 == Q3 # needs sage.symbolic False """ if other is self: @@ -1391,7 +1392,7 @@ def __hash__(self): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Affine(3) sage: Q1 = B(1, RR(3**(1/2))) # needs sage.symbolic sage: Q2 = B(1, 3**(1/2)) # needs sage.symbolic @@ -1439,7 +1440,7 @@ def lt(self, other): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(5, 0.5) sage: Q2 = B(5, 1) @@ -1448,32 +1449,32 @@ def lt(self, other): :: - sage: Q3 = B(1) # needs sage.rings.padics - sage: Q1.lt(Q3) # needs sage.rings.padics + sage: Q3 = B(1) + sage: Q1.lt(Q3) False TESTS:: - sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics - sage: Q1 = B(5) # needs sage.rings.padics - sage: Q1.lt(Q1) # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: Q1 = B(5) + sage: Q1.lt(Q1) False :: - sage: Q2 = B([4, 1/3], [5, 1]) # needs sage.rings.padics - sage: Q1.lt(Q2) # needs sage.rings.padics + sage: Q2 = B([4, 1/3], [5, 1]) + sage: Q1.lt(Q2) False :: - sage: Q4 = B(0, 1) # needs sage.rings.padics - sage: Q1.lt(Q4) # needs sage.rings.padics + sage: Q4 = B(0, 1) + sage: Q1.lt(Q4) True :: - sage: Q2.lt(Q4) # needs sage.rings.padics + sage: Q2.lt(Q4) False """ if not isinstance(other, Berkovich_Element_Cp_Affine): @@ -1584,7 +1585,7 @@ def join(self, other, basepoint=Infinity): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Affine(3) sage: Q1 = B(2, 1) sage: Q2 = B(2, 2) @@ -1593,32 +1594,32 @@ def join(self, other, basepoint=Infinity): :: - sage: Q3 = B(5) # needs sage.rings.padics - sage: Q3.join(Q1) # needs sage.rings.padics + sage: Q3 = B(5) + sage: Q3.join(Q1) Type II point centered at 2 + 3 + O(3^20) of radius 3^0 :: - sage: Q3.join(Q1, basepoint=Q2) # needs sage.rings.padics + sage: Q3.join(Q1, basepoint=Q2) Type II point centered at 2 + O(3^20) of radius 3^0 TESTS:: - sage: Q4 = B(1/3**8 + 2, 1) # needs sage.rings.padics - sage: Q2.join(Q4, basepoint=Q1) # needs sage.rings.padics + sage: Q4 = B(1/3**8 + 2, 1) + sage: Q2.join(Q4, basepoint=Q1) Type III point centered at 2 + O(3^20) of radius 2.00000000000000 :: - sage: Q5 = B(2, 1/9) # needs sage.rings.padics - sage: Q6 = B(1, 1/27) # needs sage.rings.padics - sage: Q4.join(Q5, basepoint=Q6) # needs sage.rings.padics + sage: Q5 = B(2, 1/9) + sage: Q6 = B(1, 1/27) + sage: Q4.join(Q5, basepoint=Q6) Type II point centered at 1 + O(3^20) of radius 3^0 :: - sage: Q7 = B(1/27, 1/27) # needs sage.rings.padics - sage: Q1.join(Q7, Q2) # needs sage.rings.padics + sage: Q7 = B(1/27, 1/27) + sage: Q1.join(Q7, Q2) 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 @@ -1664,46 +1665,46 @@ def involution_map(self): The involution map is 1/z on type I points:: - sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics - sage: Q1 = B(1/2) # needs sage.rings.padics - sage: Q1.involution_map() # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: Q1 = B(1/2) + sage: Q1.involution_map() Type I point centered at 2 + O(3^20) :: - sage: Q2 = B(0, 1/3) # needs sage.rings.padics - sage: Q2.involution_map() # needs sage.rings.padics + sage: Q2 = B(0, 1/3) + sage: Q2.involution_map() Type II point centered at 0 of radius 3^1 :: - sage: Q3 = B(1/3, 1/3) # needs sage.rings.padics - sage: Q3.involution_map() # needs sage.rings.padics + sage: Q3 = B(1/3, 1/3) + sage: Q3.involution_map() Type II point centered at 3 + O(3^21) of radius 3^-3 TESTS:: - sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics - sage: B(0).involution_map() # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: B(0).involution_map() 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() # needs sage.rings.padics + sage: B(1/81, 1.5).involution_map() Type III point centered at 3^4 + O(3^24) of radius 0.000228623685413809 :: - sage: B([1, 2], [3, 1]).involution_map() # needs sage.rings.padics + sage: B([1, 2], [3, 1]).involution_map() 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() # needs sage.rings.padics + sage: B([1/81, 10/81], [10, 9]).involution_map() 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] ... @@ -1757,7 +1758,7 @@ def contained_in_interval(self, start, end): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Projective((3)) sage: Q1 = B(2, 1) sage: Q2 = B(2, 4) @@ -1767,8 +1768,8 @@ def contained_in_interval(self, start, end): :: - sage: Q4 = B(1/81, 1) # needs sage.rings.padics - sage: Q2.contained_in_interval(Q1, Q4.join(Q1)) # needs sage.rings.padics + sage: Q4 = B(1/81, 1) + sage: Q2.contained_in_interval(Q1, Q4.join(Q1)) True """ if not isinstance(start, Berkovich_Element_Cp_Affine): @@ -1838,34 +1839,34 @@ 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) # needs sage.rings.padics - sage: P = Berkovich_Cp_Projective(S); P # needs sage.rings.padics + sage: S = ProjectiveSpace(Qp(5), 1) + sage: P = Berkovich_Cp_Projective(S); P Projective Berkovich line over Cp(5) of precision 20 :: - sage: a = S(0, 1) # needs sage.rings.padics - sage: Q1 = P(a); Q1 # needs sage.rings.padics + sage: a = S(0, 1) + sage: Q1 = P(a); Q1 Type I point centered at (0 : 1 + O(5^20)) :: - sage: Q2 = P((1,0)); Q2 # needs sage.rings.padics + sage: Q2 = P((1,0)); Q2 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 # needs sage.rings.padics sage.symbolic + sage: Q3 = P((0,5), 5**(3/2)); Q3 # needs 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 # needs sage.rings.padics sage.symbolic + sage: Q4 = P(0, 3**(3/2)); Q4 # needs 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: # needs sage.rings.padics + sage: sage: b = S((3,2)) # create centers sage: c = S((4,3)) sage: d = S((2,3)) @@ -1883,7 +1884,7 @@ 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: # needs sage.rings.padics + sage: sage: L. = PolynomialRing(Qp(5)) sage: T = FractionField(L) sage: f = T(1/t) @@ -1896,14 +1897,14 @@ class Berkovich_Element_Cp_Projective(Berkovich_Element_Cp): TESTS:: - sage: P((1,0), 3) # needs sage.rings.padics + sage: P((1,0), 3) Traceback (most recent call last): ... ValueError: type II and III points can not be centered at infinity - sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics - sage: Q1 = B(3) # needs sage.rings.padics - sage: TestSuite(Q1).run() # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: Q1 = B(3) + sage: TestSuite(Q1).run() """ def __init__(self, parent, center, radius=None, power=None, prec=20, error_check=True): @@ -1912,9 +1913,9 @@ def __init__(self, parent, center, radius=None, power=None, prec=20, error_check EXAMPLES:: - sage: S = ProjectiveSpace(Qp(7), 1) # needs sage.rings.padics - sage: P = Berkovich_Cp_Projective(S) # needs sage.rings.padics - sage: P(0,1) # needs sage.rings.padics + sage: S = ProjectiveSpace(Qp(7), 1) + sage: P = Berkovich_Cp_Projective(S) + sage: P(0,1) 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 @@ -1940,27 +1941,28 @@ def as_affine_point(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(5) # needs sage.rings.padics - sage: B(5).as_affine_point() # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(5) + sage: B(5).as_affine_point() Type I point centered at 5 + O(5^21) :: - sage: Q = B(0, 1).as_affine_point(); Q # needs sage.rings.padics + sage: Q = B(0, 1).as_affine_point(); Q Type II point centered at 0 of radius 5^0 - sage: Q.parent() # needs sage.rings.padics + sage: Q.parent() Affine Berkovich line over Cp(5) of precision 20 :: - sage: L. = PolynomialRing(Qp(5)) # needs sage.rings.padics - sage: T = FractionField(L) # needs sage.rings.padics - sage: f = T(1/t) # needs sage.rings.padics + sage: + 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 # needs sage.rings.padics sage.symbolic - sage: Q2 = B(f, g) # needs sage.rings.padics sage.symbolic - sage: Q2.as_affine_point() # needs sage.rings.padics sage.symbolic + sage: g = (40*pi)/x # needs sage.symbolic + sage: Q2 = B(f, g) # needs sage.symbolic + sage: Q2.as_affine_point() # needs 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 """ @@ -1992,7 +1994,7 @@ def __eq__(self, other): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B([2, 2], RR(3**(1/2))) # needs sage.symbolic sage: Q2 = B([1, 1], 3**(1/2)) # needs sage.symbolic @@ -2001,20 +2003,20 @@ def __eq__(self, other): :: - sage: Q3 = B(1) # needs sage.rings.padics - sage: Q4 = B(4) # needs sage.rings.padics - sage: Q3 == Q4 # needs sage.rings.padics + sage: Q3 = B(1) + sage: Q4 = B(4) + sage: Q3 == Q4 False :: - sage: Q5 = B(1, 4) # needs sage.rings.padics - sage: Q1 == Q5 # needs sage.rings.padics sage.symbolic + sage: Q5 = B(1, 4) + sage: Q1 == Q5 # needs sage.symbolic False :: - sage: Q1 == Q3 # needs sage.rings.padics sage.symbolic + sage: Q1 == Q3 # needs sage.symbolic False """ if other is self: @@ -2045,7 +2047,7 @@ def __hash__(self): EXAMPLES:: - sage: # needs sage.rings.padics + sage: 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))) # needs sage.symbolic @@ -2094,7 +2096,7 @@ def lt(self, other): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(5, 0.5) sage: Q2 = B(5, 1) @@ -2103,43 +2105,43 @@ def lt(self, other): :: - sage: Q3 = B(1) # needs sage.rings.padics - sage: Q1.lt(Q3) # needs sage.rings.padics + sage: Q3 = B(1) + sage: Q1.lt(Q3) False TESTS:: - sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics - sage: Q1 = B(5) # needs sage.rings.padics - sage: Q1.lt(Q1) # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: Q1 = B(5) + sage: Q1.lt(Q1) False :: - sage: Q2 = B([4, 1/3], [5, 1]) # needs sage.rings.padics - sage: Q1.lt(Q2) # needs sage.rings.padics + sage: Q2 = B([4, 1/3], [5, 1]) + sage: Q1.lt(Q2) False :: - sage: Q3 = B((1,0)) # needs sage.rings.padics - sage: Q4 = B(0, 1) # needs sage.rings.padics - sage: Q3.lt(Q4) # needs sage.rings.padics + sage: Q3 = B((1,0)) + sage: Q4 = B(0, 1) + sage: Q3.lt(Q4) False :: - sage: Q4.lt(Q3) # needs sage.rings.padics + sage: Q4.lt(Q3) True :: - sage: Q1.lt(Q4) # needs sage.rings.padics + sage: Q1.lt(Q4) True :: - sage: Q2.lt(Q4) # needs sage.rings.padics + sage: Q2.lt(Q4) False """ if not isinstance(other, Berkovich_Element_Cp_Projective): @@ -2274,7 +2276,7 @@ def join(self, other, basepoint=Infinity): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(2, 1) sage: Q2 = B(2, 2) @@ -2283,18 +2285,18 @@ def join(self, other, basepoint=Infinity): :: - sage: Q3 = B(5) # needs sage.rings.padics - sage: Q3.join(Q1) # needs sage.rings.padics + sage: Q3 = B(5) + sage: Q3.join(Q1) Type II point centered at (2 + 3 + O(3^20) : 1 + O(3^20)) of radius 3^0 :: - sage: Q3.join(Q1, basepoint=Q2) # needs sage.rings.padics + sage: Q3.join(Q1, basepoint=Q2) Type II point centered at (2 + O(3^20) : 1 + O(3^20)) of radius 3^0 TESTS:: - sage: # needs sage.rings.padics + sage: sage: Q4 = B(1/3**8 + 2, 1) sage: Q2.join(Q4, basepoint=Q1) Type III point centered at (2 + O(3^20) : 1 + O(3^20)) of radius 2.00000000000000 @@ -2318,7 +2320,7 @@ def join(self, other, basepoint=Infinity): sage: ideal = A.prime_above(3) sage: C = Berkovich_Cp_Projective(A, ideal) sage: Q10 = C(a, 1/9) - sage: Q10.join(Q9) # needs sage.rings.padics + sage: Q10.join(Q9) Traceback (most recent call last): ... ValueError: other must be a point of the same projective Berkovich line @@ -2436,49 +2438,49 @@ def involution_map(self): The involution map is 1/z on type I points:: - sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics - sage: Q1 = B(1/2) # needs sage.rings.padics - sage: Q1.involution_map() # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: Q1 = B(1/2) + sage: Q1.involution_map() Type I point centered at (2 + O(3^20) : 1 + O(3^20)) :: - sage: Q2 = B(0, 1/3) # needs sage.rings.padics - sage: Q2.involution_map() # needs sage.rings.padics + sage: Q2 = B(0, 1/3) + sage: Q2.involution_map() Type II point centered at (0 : 1 + O(3^20)) of radius 3^1 :: - sage: Q3 = B(1/3, 1/3) # needs sage.rings.padics - sage: Q3.involution_map() # needs sage.rings.padics + sage: Q3 = B(1/3, 1/3) + sage: Q3.involution_map() Type II point centered at (3 + O(3^21) : 1 + O(3^20)) of radius 3^-3 TESTS:: - sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics - sage: B((1,0)).involution_map() # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: B((1,0)).involution_map() Type I point centered at (0 : 1 + O(3^20)) :: - sage: B(0).involution_map() # needs sage.rings.padics + sage: B(0).involution_map() Type I point centered at (1 + O(3^20) : 0) :: - sage: B(1/81, 1.5).involution_map() # needs sage.rings.padics + sage: B(1/81, 1.5).involution_map() 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() # needs sage.rings.padics + sage: B([1, 2], [3, 1]).involution_map() 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() # needs sage.rings.padics + sage: B([1/81, 10/81], [10, 9]).involution_map() 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))] @@ -2535,7 +2537,7 @@ def contained_in_interval(self, start, end): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(2, 1) sage: Q2 = B(2, 4) @@ -2545,13 +2547,13 @@ def contained_in_interval(self, start, end): :: - sage: Q4 = B(1/81, 1) # needs sage.rings.padics - sage: Q2.contained_in_interval(Q1, Q4.join(Q1)) # needs sage.rings.padics + sage: Q4 = B(1/81, 1) + sage: Q2.contained_in_interval(Q1, Q4.join(Q1)) True TESTS:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Projective(3) sage: infty = B((1, 0)) sage: zero = B(0) @@ -2561,24 +2563,24 @@ def contained_in_interval(self, start, end): :: - sage: Q1 = B(1, 3) # needs sage.rings.padics - sage: infty.contained_in_interval(gauss, Q1) # needs sage.rings.padics + sage: Q1 = B(1, 3) + sage: infty.contained_in_interval(gauss, Q1) False :: - sage: zero.contained_in_interval(infty, gauss) # needs sage.rings.padics + sage: zero.contained_in_interval(infty, gauss) False :: - sage: gauss.contained_in_interval(zero, infty) # needs sage.rings.padics + sage: gauss.contained_in_interval(zero, infty) True :: - sage: Q2 = B(81, 1/3) # needs sage.rings.padics - sage: gauss.contained_in_interval(infty, Q2) # needs sage.rings.padics + sage: Q2 = B(81, 1/3) + sage: gauss.contained_in_interval(infty, Q2) 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 8bedd157474..d10639e9e7e 100644 --- a/src/sage/schemes/berkovich/berkovich_space.py +++ b/src/sage/schemes/berkovich/berkovich_space.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.rings.padics r""" Berkovich Space over `\CC_p` @@ -56,9 +57,9 @@ def is_Berkovich(space) -> bool: EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) sage: from sage.schemes.berkovich.berkovich_space import is_Berkovich - sage: is_Berkovich(B) # needs sage.rings.padics + sage: is_Berkovich(B) True """ return isinstance(space, Berkovich) @@ -75,9 +76,9 @@ def is_Berkovich_Cp(space) -> bool: EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) sage: from sage.schemes.berkovich.berkovich_space import is_Berkovich - sage: is_Berkovich(B) # needs sage.rings.padics + sage: is_Berkovich(B) True """ return isinstance(space, Berkovich_Cp) @@ -101,17 +102,18 @@ def residue_characteristic(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics - sage: B.prime() # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: B.prime() 3 :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field - sage: ideal = A.ideal(-1/2*a^2 + a - 3) # needs sage.rings.number_field - sage: B = Berkovich_Cp_Affine(A, ideal) # needs sage.rings.number_field - sage: B.residue_characteristic() # needs sage.rings.number_field + 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() 7 """ return self._p @@ -129,8 +131,8 @@ def is_padic_base(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(Qp(3)) # needs sage.rings.padics - sage: B.is_padic_base() # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(Qp(3)) + sage: B.is_padic_base() True :: @@ -152,8 +154,8 @@ def is_number_field_base(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(Qp(3)) # needs sage.rings.padics - sage: B.is_number_field_base() # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(Qp(3)) + sage: B.is_number_field_base() False :: @@ -181,11 +183,12 @@ def ideal(self): EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(z^2 + 1) # needs sage.rings.number_field - sage: ideal = A.prime_above(5) # needs sage.rings.number_field - sage: B = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field - sage: B.ideal() # needs sage.rings.number_field + sage: A. = NumberField(z^2 + 1) + sage: ideal = A.prime_above(5) + sage: B = Berkovich_Cp_Projective(A, ideal) + sage: B.ideal() Fractional ideal (-a - 2) :: @@ -196,8 +199,8 @@ def ideal(self): :: - sage: B = Berkovich_Cp_Projective(Qp(3)) # needs sage.rings.padics - sage: B.ideal() is None # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(Qp(3)) + sage: B.ideal() is None True """ return self._ideal @@ -208,7 +211,7 @@ def __eq__(self, right): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Affine(3) sage: A. = Qq(27) sage: C = Berkovich_Cp_Affine(A) @@ -217,14 +220,15 @@ def __eq__(self, right): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: A_ideal = A.prime_above(2) # needs sage.rings.number_field - sage: B. = NumberField(x^4 + 1) # needs sage.rings.number_field - sage: B_ideal = B.prime_above(2) # needs sage.rings.number_field - sage: C = Berkovich_Cp_Projective(A, A_ideal) # needs sage.rings.number_field - sage: D = Berkovich_Cp_Projective(B, B_ideal) # needs sage.rings.number_field - sage: C == D # needs sage.rings.number_field + 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 False :: @@ -256,7 +260,7 @@ def __ne__(self, right): EXAMPLES:: - sage: # needs sage.rings.padics + sage: sage: B = Berkovich_Cp_Affine(5) sage: A. = Qq(25) sage: C = Berkovich_Cp_Affine(A) @@ -271,16 +275,17 @@ def __hash__(self): EXAMPLES:: - sage: hash(Berkovich_Cp_Projective(3)) # needs sage.rings.padics + sage: hash(Berkovich_Cp_Projective(3)) 3 :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(z^2 + 1) # needs sage.rings.number_field - sage: B = Berkovich_Cp_Projective(A, A.primes_above(5)[0]) # needs sage.rings.number_field - sage: C = Berkovich_Cp_Projective(A, A.primes_above(5)[1]) # needs sage.rings.number_field - sage: hash(B) != hash(C) # needs sage.rings.number_field + 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) True """ if self._base_type == 'padic field': @@ -321,49 +326,49 @@ class Berkovich_Cp_Affine(Berkovich_Cp): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3); B # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3); B Affine Berkovich line over Cp(3) of precision 20 We can create elements:: - sage: B(-2) # needs sage.rings.padics + sage: B(-2) 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) # needs sage.rings.padics + sage: B(1, 2) 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 # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(Qp(3)); B 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 # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(Qp(3, 1)); B Affine Berkovich line over Cp(3) of precision 1 - sage: B(1/2) # needs sage.rings.padics + sage: B(1/2) 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 # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(Qp(3, 1000)); B 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) # needs sage.rings.padics - sage: A. = Qp(3).extension(x^3 - 3) # needs sage.rings.padics - sage: B(a) # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: A. = Qp(3).extension(x^3 - 3) + sage: B(a) Type I point centered at a + O(a^61) For exact computation, a number field can be used:: @@ -388,12 +393,13 @@ class Berkovich_Cp_Affine(Berkovich_Cp): field, any point of a Berkovich space backed by a number field must be centered at a point of that number field:: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field - sage: ideal = A.prime_above(3) # needs sage.rings.number_field - sage: B = Berkovich_Cp_Affine(A, ideal) # needs sage.rings.number_field - sage: C. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: B(c) # needs sage.rings.number_field + 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) Traceback (most recent call last): ... ValueError: could not convert c to Number Field in a @@ -401,14 +407,14 @@ class Berkovich_Cp_Affine(Berkovich_Cp): TESTS:: - sage: A. = AffineSpace(Qp(3), 1) # needs sage.rings.padics - sage: Berkovich_Cp_Affine(A) # needs sage.rings.padics + sage: A. = AffineSpace(Qp(3), 1) + sage: Berkovich_Cp_Affine(A) Affine Berkovich line over Cp(3) of precision 20 :: - sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics - sage: TestSuite(B).run() # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: TestSuite(B).run() """ Element = Berkovich_Element_Cp_Affine @@ -419,7 +425,7 @@ def __init__(self, base, ideal=None): EXAMPLES:: - sage: Berkovich_Cp_Affine(3) # needs sage.rings.padics + sage: Berkovich_Cp_Affine(3) Affine Berkovich line over Cp(3) of precision 20 """ if base in ZZ: @@ -465,8 +471,8 @@ def _repr_(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics - sage: B # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: B Affine Berkovich line over Cp(3) of precision 20 :: @@ -491,8 +497,8 @@ def _latex_(self): EXAMPLES: - sage: B = Berkovich_Cp_Affine(3) # needs sage.rings.padics - sage: latex(B) # needs sage.rings.padics + sage: B = Berkovich_Cp_Affine(3) + sage: latex(B) \text{Affine Berkovich line over } \Bold{C}_{3} """ return r"\text{Affine Berkovich line over } \Bold{C}_{%s}" % (self.prime()) @@ -531,36 +537,36 @@ class Berkovich_Cp_Projective(Berkovich_Cp): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3); B # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3); B Projective Berkovich line over Cp(3) of precision 20 Elements can be constructed:: - sage: B(1/2) # needs sage.rings.padics + sage: B(1/2) 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) # needs sage.rings.padics + sage: B(2, 1) 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 # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(Qp(3)); B 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) # needs sage.rings.padics - sage: B = Berkovich_Cp_Projective(S); B # needs sage.rings.padics + sage: S = Qp(3, 1) + sage: B = Berkovich_Cp_Projective(S); B Projective Berkovich line over Cp(3) of precision 1 - sage: Q1 = B(1/2); Q1 # needs sage.rings.padics + sage: Q1 = B(1/2); Q1 Type I point centered at (2 + O(3) : 1 + O(3)) Note that this point has very low precision, as S has low @@ -589,12 +595,13 @@ class Berkovich_Cp_Projective(Berkovich_Cp): field, any point of a Berkovich space backed by a number field must be centered at a point of that number field:: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field - sage: ideal = A.prime_above(3) # needs sage.rings.number_field - sage: B = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field - sage: C. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: B(c) # needs sage.rings.number_field + 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) Traceback (most recent call last): ... TypeError: could not convert c to Projective Space @@ -602,8 +609,8 @@ class Berkovich_Cp_Projective(Berkovich_Cp): TESTS:: - sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics - sage: TestSuite(B).run() # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: TestSuite(B).run() """ Element = Berkovich_Element_Cp_Projective @@ -614,7 +621,7 @@ def __init__(self, base, ideal=None): EXAMPLES:: - sage: Berkovich_Cp_Projective(3) # needs sage.rings.padics + sage: Berkovich_Cp_Projective(3) Projective Berkovich line over Cp(3) of precision 20 """ if base in ZZ: @@ -671,23 +678,24 @@ def base_ring(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics - sage: B.base_ring() # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: B.base_ring() 3-adic Field with capped relative precision 20 :: - sage: C = Berkovich_Cp_Projective(ProjectiveSpace(Qp(3, 1), 1)) # needs sage.rings.padics - sage: C.base_ring() # needs sage.rings.padics + sage: C = Berkovich_Cp_Projective(ProjectiveSpace(Qp(3, 1), 1)) + sage: C.base_ring() 3-adic Field with capped relative precision 1 :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) # needs sage.rings.number_field - sage: ideal = A.prime_above(3) # needs sage.rings.number_field - sage: D = Berkovich_Cp_Projective(A, ideal) # needs sage.rings.number_field - sage: D.base_ring() # needs sage.rings.number_field + sage: A. = NumberField(x^3 + 20) + sage: ideal = A.prime_above(3) + sage: D = Berkovich_Cp_Projective(A, ideal) + sage: D.base_ring() Number Field in a with defining polynomial x^3 + 20 """ return self.base().base_ring() @@ -698,8 +706,8 @@ def _repr_(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics - sage: B # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: B Projective Berkovich line over Cp(3) of precision 20 :: @@ -724,8 +732,8 @@ def _latex_(self): EXAMPLES: - sage: B = Berkovich_Cp_Projective(3) # needs sage.rings.padics - sage: latex(B) # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(3) + sage: latex(B) \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/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index a1568f9f333..5c3f4c58d14 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -13,7 +13,6 @@ The usual way to create and work with isogenies is illustrated with the following example:: - sage: # needs sage.rings.finite_rings sage: k = GF(11) sage: E = EllipticCurve(k, [1,1]) sage: Q = E(6,5) @@ -194,7 +193,6 @@ def isogeny_codomain_from_kernel(E, kernel, degree=None): EXAMPLES:: - sage: # needs sage.rings.finite_rings 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)[] @@ -213,7 +211,7 @@ def isogeny_codomain_from_kernel(E, kernel, degree=None): 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) # needs sage.rings.finite_rings + 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 @@ -221,7 +219,7 @@ def isogeny_codomain_from_kernel(E, kernel, degree=None): Test deprecation warning for obsolete argument:: - sage: isogeny_codomain_from_kernel(E, kernel_list, degree=4) # needs sage.rings.finite_rings + sage: isogeny_codomain_from_kernel(E, kernel_list, degree=4) doctest:warning ... DeprecationWarning: The "degree" argument to isogeny_codomain_from_kernel() does nothing and will be removed. @@ -267,7 +265,6 @@ def compute_codomain_formula(E, v, w): This formula is used by every invocation of the :class:`EllipticCurveIsogeny` constructor:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) sage: phi = EllipticCurveIsogeny(E, E((1,2)) ) sage: phi.codomain() @@ -305,7 +302,6 @@ def compute_vw_kohel_even_deg1(x0, y0, a1, a2, a4): This function will be implicitly called by the following example:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) sage: phi = EllipticCurveIsogeny(E, [9,1]); phi Isogeny of degree 2 @@ -344,7 +340,6 @@ def compute_vw_kohel_even_deg3(b2, b4, s1, s2, s3): This function will be implicitly called by the following example:: - sage: # needs sage.rings.finite_rings 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 @@ -386,7 +381,6 @@ def compute_vw_kohel_odd(b2, b4, b6, s1, s2, s3, n): This function will be implicitly called by the following example:: - sage: # needs sage.rings.finite_rings 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 @@ -424,7 +418,6 @@ def compute_codomain_kohel(E, kernel): EXAMPLES:: - sage: # needs sage.rings.finite_rings 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]) @@ -536,7 +529,6 @@ def two_torsion_part(E, psi): Every function that computes the kernel polynomial via Kohel's formulas will call this function:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) sage: R. = GF(19)[] sage: phi = EllipticCurveIsogeny(E, x + 13) @@ -620,7 +612,6 @@ class EllipticCurveIsogeny(EllipticCurveHom): A simple example of creating an isogeny of a field of small characteristic:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(7), [0,0,0,1,0]) sage: phi = EllipticCurveIsogeny(E, E((0,0)) ); phi Isogeny of degree 2 @@ -694,7 +685,6 @@ class EllipticCurveIsogeny(EllipticCurveHom): We can also create trivial isogenies with the trivial kernel:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(17), [11, 11, 4, 12, 10]) sage: phi_v = EllipticCurveIsogeny(E, E(0)) sage: phi_v.degree() @@ -707,7 +697,6 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phi_v(P) == P True - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(31), [23, 1, 22, 7, 18]) sage: phi_k = EllipticCurveIsogeny(E, [1]); phi_k Isogeny of degree 1 @@ -780,39 +769,40 @@ class EllipticCurveIsogeny(EllipticCurveHom): We can also do this same example over the number field defined by the irreducible two-torsion polynomial of `E`:: + sage: # needs sage.rings.number_field sage: E = EllipticCurve('11a1') sage: P_list = E.torsion_points() sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2* x^2 - 40*x - 158) # needs sage.rings.number_field - sage: EK = E.change_ring(K) # needs sage.rings.number_field - sage: P_list = [EK(P) for P in P_list] # needs sage.rings.number_field - sage: phi_v = EllipticCurveIsogeny(EK, P_list); phi_v # needs sage.rings.number_field + 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)) # needs sage.rings.number_field - sage: phi_v(P) # needs sage.rings.number_field + sage: P = EK((alpha/2,-1/2)) + sage: phi_v(P) (122/121*alpha^2 + 1633/242*alpha - 3920/121 : -1/2 : 1) - sage: ker_poly = phi_v.kernel_polynomial() # needs sage.rings.number_field - sage: ker_poly # needs sage.rings.number_field + sage: ker_poly = phi_v.kernel_polynomial() + sage: ker_poly x^2 - 21*x + 80 - sage: phi_k = EllipticCurveIsogeny(EK, ker_poly); phi_k # needs sage.rings.number_field + sage: phi_k = EllipticCurveIsogeny(EK, ker_poly); 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 # needs sage.rings.number_field + sage: phi_v == phi_k True - sage: phi_k(P) == phi_v(P) # needs sage.rings.number_field + sage: phi_k(P) == phi_v(P) True - sage: phi_k == phi_v # needs sage.rings.number_field + sage: phi_k == phi_v True - sage: phi_k.degree() # needs sage.rings.number_field + sage: phi_k.degree() 5 - sage: phi_v.is_separable() # needs sage.rings.number_field + sage: phi_v.is_separable() True The following example shows how to specify an isogeny from domain @@ -882,7 +872,6 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phi.codomain() Elliptic Curve defined by y^2 = x^3 - 4*x over Rational Field - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(31), [1,0,0,1,2]) sage: phi = EllipticCurveIsogeny(E, [17, 1]) sage: phi.domain() @@ -904,17 +893,18 @@ class EllipticCurveIsogeny(EllipticCurveHom): Examples over relative number fields used not to work (see :trac:`16779`):: + sage: # long time, needs sage.rings.number_field sage: pol26 = hilbert_class_polynomial(-4*26) - sage: F = NumberField(pol26,'a') # long time # needs sage.rings.number_field - sage: pol = F.optimized_representation()[0].polynomial() # long time, needs sage.rings.number_field - sage: K. = NumberField(pol) # long time # needs sage.rings.number_field - sage: j = pol26.roots(K)[0][0] # long time # needs sage.rings.number_field - sage: E = EllipticCurve(j=j) # long time # needs sage.rings.number_field - sage: L. = K.extension(x^2 + 26) # long time # needs sage.rings.number_field - sage: EL = E.change_ring(L) # long time # needs sage.rings.number_field - sage: iso2 = EL.isogenies_prime_degree(2); len(iso2) # long time # needs sage.rings.number_field + sage: F = NumberField(pol26,'a') + sage: pol = F.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) 1 - sage: iso3 = EL.isogenies_prime_degree(3); len(iso3) # long time # needs sage.rings.number_field + sage: iso3 = EL.isogenies_prime_degree(3); len(iso3) 2 Examples over function fields used not to work (see :trac:`11327`):: @@ -1031,7 +1021,7 @@ 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 # needs sage.rings.finite_rings + 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 @@ -1189,17 +1179,16 @@ def _call_(self, P): EXAMPLES:: - sage: E = EllipticCurve(GF(17), [1, 9, 5, 4, 3]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, [6,13,1]) # needs sage.rings.finite_rings - sage: phi(E((1,0))) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(17), [1, 9, 5, 4, 3]) + sage: phi = EllipticCurveIsogeny(E, [6,13,1]) + sage: phi(E((1,0))) (15 : 13 : 1) - sage: E = EllipticCurve(GF(23), [0,0,0,1,0]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings - sage: phi(E((1,5))) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(23), [0,0,0,1,0]) + sage: phi = EllipticCurveIsogeny(E, E((0,0))) + sage: phi(E((1,5))) (2 : 0 : 1) - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(QQ, [0,0,0,3,0]) sage: P = E((1,2)) sage: phi = EllipticCurveIsogeny(E, [0,1]) @@ -1208,7 +1197,6 @@ def _call_(self, P): sage: phi(-P) (4 : 4 : 1) - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(17), [0,-1,0,-3,-1]) sage: Q = E((16,0)) sage: tau = E.isogeny([Q], E) @@ -1234,7 +1222,6 @@ def _call_(self, P): Call a composed isogeny (added for :trac:`16238`):: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(j=GF(7)(0)) sage: phi = E.isogeny([E(0), E((0,1)), E((0,-1))]) sage: phi(E.points()[0]) @@ -1274,7 +1261,6 @@ def _call_(self, P): Test for :trac:`35983`:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve([1,0,0,-1,0]) sage: P = E([1,0]) sage: P.order() @@ -1348,7 +1334,6 @@ def __getitem__(self, i): sage: phi[1] y - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) sage: phi = EllipticCurveIsogeny(E, E((0,0))) sage: phi[0] @@ -1370,9 +1355,9 @@ def __iter__(self): x y - sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings - sage: for c in phi: print(c) # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) + sage: phi = EllipticCurveIsogeny(E, E((0,0))) + sage: for c in phi: print(c) (x^2 + 3)/x (x^2*y - 3*y)/x^2 """ @@ -1388,14 +1373,12 @@ def __neg__(self): The following examples inherently exercise this function:: - sage: # needs sage.rings.finite_rings 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 True - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(j=GF(19)(1728)) sage: R. = GF(19)[] sage: phi = EllipticCurveIsogeny(E, x) @@ -1417,7 +1400,6 @@ def __neg__(self): sage: phi(P) + negphi(P) == 0 True - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(23), [0,0,0,1,0]) sage: f = E.torsion_polynomial(3)/3 sage: phi = EllipticCurveIsogeny(E, f, E) @@ -1427,7 +1409,6 @@ def __neg__(self): sage: negphi.rational_maps() == E.multiplication_by_m(3) True - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(17), [-2, 3, -5, 7, -11]) sage: R. = GF(17)[] sage: f = x+6 @@ -1509,7 +1490,6 @@ def _latex_(self): sage: phi._latex_() '\\left( x , y \\right)' - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(17), [0,0,0,1,-1]) sage: R. = GF(17)[] sage: phi = EllipticCurveIsogeny(E, X + 11) @@ -1541,7 +1521,6 @@ def __clear_cached_values(self): sage: old_ratl_maps[1] == -phi.rational_maps()[1] True - sage: # needs sage.rings.finite_rings 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 @@ -1567,7 +1546,6 @@ def __perform_inheritance_housekeeping(self): The following examples will implicitly exercise this function:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(43), [2,3,5,7,11]) sage: R. = GF(43)[]; f = x + 42 sage: phi = EllipticCurveIsogeny(E, f) @@ -1595,7 +1573,6 @@ def __init_algebraic_structs(self, E): The constructor calls this function itself, so the fields it sets are already defined:: - sage: # needs sage.rings.finite_rings sage: phi._domain Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 17 sage: phi._EllipticCurveIsogeny__base_field @@ -1607,7 +1584,6 @@ def __init_algebraic_structs(self, E): Now, calling the initialization function does nothing more:: - sage: # needs sage.rings.finite_rings sage: phi._EllipticCurveIsogeny__init_algebraic_structs(E) sage: phi._domain Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 17 @@ -1630,7 +1606,6 @@ def __init_algebraic_structs(self, E): sage: phi._EllipticCurveIsogeny__mpoly_ring Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Rational Field - sage: # needs sage.rings.finite_rings sage: F = GF(19); R. = F[] sage: E = EllipticCurve(j=GF(19)(0)) sage: phi = EllipticCurveIsogeny(E, x) @@ -1661,14 +1636,12 @@ def __compute_codomain(self): These examples inherently exercise this function:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(j=GF(7)(1728)) sage: phi = EllipticCurveIsogeny(E, E((0,0))) sage: phi.codomain() Elliptic Curve defined by y^2 = x^3 + 3*x over Finite Field of size 7 sage: phi._EllipticCurveIsogeny__compute_codomain() - sage: # needs sage.rings.finite_rings sage: R. = GF(7)[] sage: phi = EllipticCurveIsogeny(E, x) sage: phi.codomain() @@ -1696,14 +1669,14 @@ def __initialize_rational_maps(self, precomputed_maps=None): The following examples inherently exercise this function:: - sage: E = EllipticCurve(j=GF(7)(1728)) # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, E((0,0))) # needs sage.rings.finite_rings - sage: phi.rational_maps() # implicit doctest # needs sage.rings.finite_rings + sage: E = EllipticCurve(j=GF(7)(1728)) + sage: phi = EllipticCurveIsogeny(E, E((0,0))) + sage: phi.rational_maps() # implicit doctest ((x^2 + 1)/x, (x^2*y - y)/x^2) - sage: R. = GF(7)[] # needs sage.rings.finite_rings - sage: phi = EllipticCurveIsogeny(E, x) # needs sage.rings.finite_rings - sage: phi.rational_maps() # implicit doctest # needs sage.rings.finite_rings + sage: R. = GF(7)[] + sage: phi = EllipticCurveIsogeny(E, x) + sage: phi.rational_maps() # implicit doctest ((x^2 + 1)/x, (x^2*y - y)/x^2) sage: E = EllipticCurve([1,2,3,4,5]) @@ -1770,7 +1743,6 @@ def __set_pre_isomorphism(self, domain, isomorphism): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(43), [2,3,5,7,11]) sage: R. = GF(43)[]; f = x + 42 sage: phi = EllipticCurveIsogeny(E, f) @@ -1815,7 +1787,6 @@ def __set_post_isomorphism(self, codomain, isomorphism): The following examples inherently exercise this function:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(j=GF(7)(1728)) sage: phi = EllipticCurveIsogeny(E, E((0,0))) sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism @@ -1852,7 +1823,6 @@ def __setup_post_isomorphism(self, codomain, model): The following examples inherently exercise this function:: - sage: # needs sage.rings.finite_rings 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 @@ -1866,7 +1836,7 @@ def __setup_post_isomorphism(self, codomain, model): 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') # needs sage.rings.finite_rings + 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 @@ -1988,7 +1958,6 @@ def __sort_kernel_list(self): The following example inherently exercises this function:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) sage: P = E((4,2)) sage: phi = EllipticCurveIsogeny(E, P); phi @@ -2041,7 +2010,6 @@ def __compute_codomain_via_velu(self): The following example inherently exercises this function:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) sage: P = E((4,2)) sage: phi = EllipticCurveIsogeny(E, P) @@ -2062,7 +2030,6 @@ def __velu_sum_helper(xQ, Qvalues, a1, a3, x, y): The following example inherently exercises this function:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) sage: P = E((4,2)) sage: phi = EllipticCurveIsogeny(E, P) @@ -2071,7 +2038,6 @@ def __velu_sum_helper(xQ, Qvalues, a1, a3, x, y): sage: phi.rational_maps() ((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: # needs sage.rings.finite_rings sage: F = GF(7) sage: E = EllipticCurve(F, [0,0,0,1,0]) sage: phi = EllipticCurveIsogeny(E, E((0,0)) ) @@ -2112,7 +2078,6 @@ def __compute_via_velu_numeric(self, xP, yP): The following example inherently exercises this function:: - sage: # needs sage.rings.finite_rings sage: F = GF(7) sage: E = EllipticCurve(F, [0,0,0,-1,0]) sage: P = E((4,2)) @@ -2140,7 +2105,6 @@ def __compute_via_velu(self, xP, yP): The following example inherently exercises this function:: - sage: # needs sage.rings.finite_rings sage: F = GF(7) sage: E = EllipticCurve(F, [0,0,0,-1,0]) sage: P = E((4,2)) @@ -2209,7 +2173,6 @@ def __initialize_rational_maps_via_velu(self): The following example inherently exercises this function:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) sage: P = E((4,2)) sage: phi = EllipticCurveIsogeny(E, P) @@ -2231,7 +2194,6 @@ def __init_kernel_polynomial_velu(self): The following example inherently exercises this function:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) sage: P = E((4,2)) sage: phi = EllipticCurveIsogeny(E, P) @@ -2275,12 +2237,12 @@ def __init_from_kernel_polynomial(self, kernel_polynomial): sage: phi._EllipticCurveIsogeny__init_from_kernel_polynomial(x) sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) - sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi # needs sage.rings.finite_rings + 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: phi._EllipticCurveIsogeny__init_from_kernel_polynomial(x+6) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_from_kernel_polynomial(x+6) """ poly_ring = self.__poly_ring E = self._domain @@ -2389,7 +2351,6 @@ def __init_even_kernel_polynomial(self, E, psi_G): sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) # needs sage.rings.finite_rings (x^3 + x, (x^3 + x)*y + x^2, 1, 0, 1, 2) - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) sage: R. = GF(7)[] sage: f = x^3 + 6*x^2 + 1 @@ -2486,13 +2447,13 @@ def __init_odd_kernel_polynomial(self, E, psi): sage: R. = GF(7)[] sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) - sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi # needs sage.rings.finite_rings + 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: phi._EllipticCurveIsogeny__init_odd_kernel_polynomial(E, x+6) # needs sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_odd_kernel_polynomial(E, x+6) (x^3 + 5*x^2 + 3*x + 2, (x^3 + 4*x^2 + x)*y, 2, 6, 1, 3) sage: # needs sage.rings.finite_rings @@ -2510,7 +2471,6 @@ def __init_odd_kernel_polynomial(self, E, psi): sage: phi._EllipticCurveIsogeny__init_odd_kernel_polynomial(E, f) # needs sage.rings.finite_rings (x^3 + (alpha^2 + 1)*x + alpha^3 + alpha^2 + alpha, (x^3 + (alpha^2 + 1)*x^2 + (alpha^2 + 1)*x + alpha)*y + (alpha^2 + alpha + 1)*x^2 + (alpha^2 + alpha)*x + alpha, alpha^2 + alpha + 1, alpha^3 + alpha^2 + alpha, 1, 3) - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(j=-262537412640768000) sage: f = E.isogenies_prime_degree()[0].kernel_polynomial() sage: f.degree() @@ -2590,12 +2550,11 @@ def __compute_omega_fast(self, E, psi, psi_pr, phi, phi_pr): sage: R. = GF(7)[] sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) - sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi # needs sage.rings.finite_rings + 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: # needs sage.rings.finite_rings sage: R. = GF(7)[] sage: psi = phi._EllipticCurveIsogeny__psi sage: psi_pr = psi.derivative() @@ -2724,7 +2683,6 @@ def __compute_via_kohel_numeric(self, xP, yP): These examples inherently exercise this private function:: - sage: # needs sage.rings.finite_rings sage: R. = GF(7)[] sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) @@ -2751,7 +2709,6 @@ def __compute_via_kohel(self, xP, yP): These examples inherently exercise this private function:: - sage: # needs sage.rings.finite_rings sage: R. = GF(7)[] sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) @@ -2781,7 +2738,6 @@ def __initialize_rational_maps_via_kohel(self): These examples inherently exercise this private function:: - sage: # needs sage.rings.finite_rings sage: R. = GF(7)[] sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) @@ -2806,7 +2762,6 @@ def __compute_codomain_via_kohel(self): These examples inherently exercise this private function:: - sage: # needs sage.rings.finite_rings sage: R. = GF(7)[] sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) @@ -2842,7 +2797,7 @@ def rational_maps(self): sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) sage: phi = EllipticCurveIsogeny(E, E((0,0))) - sage: phi.rational_maps() # needs sage.rings.finite_rings + sage: phi.rational_maps() ((x^2 + 3)/x, (x^2*y - 3*y)/x^2) """ self.__initialize_rational_maps() @@ -2971,7 +2926,6 @@ def _set_pre_isomorphism(self, preWI): TESTS:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(31), [1,1,0,1,-1]) sage: R. = GF(31)[] sage: f = x^3 + 9*x^2 + x + 30 @@ -2987,7 +2941,6 @@ def _set_pre_isomorphism(self, preWI): sage: phi(Epr((3,7))) (14 : 17 : 1) - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(29), [0,0,0,1,0]) sage: R. = GF(29)[] sage: f = x^2 + 5 @@ -3061,7 +3014,6 @@ def _set_post_isomorphism(self, postWI): TESTS:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(j=GF(31)(0)) sage: R. = GF(31)[] sage: phi = EllipticCurveIsogeny(E, x+18) @@ -3072,7 +3024,6 @@ def _set_post_isomorphism(self, postWI): 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: # needs sage.rings.finite_rings sage: E = EllipticCurve(j=GF(47)(0)) sage: f = E.torsion_polynomial(3)/3 sage: phi = EllipticCurveIsogeny(E, f) @@ -3148,7 +3099,6 @@ def dual(self): sage: (Xm, Ym) == E.multiplication_by_m(5) True - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) sage: R. = GF(37)[] sage: f = x^3 + x^2 + 28*x + 33 @@ -3165,7 +3115,6 @@ def dual(self): sage: (Xm, Ym) == E.multiplication_by_m(7) True - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(31), [0,0,0,1,8]) sage: R. = GF(31)[] sage: f = x^2 + 17*x + 29 @@ -3236,7 +3185,6 @@ def dual(self): sage: phi.dual().dual() == phi True - sage: # needs sage.rings.finite_rings sage: k = GF(103) sage: E = EllipticCurve(k,[11,11]) sage: phi = E.isogeny(E(4,4)) @@ -3249,9 +3197,9 @@ def dual(self): sage: phi.dual().dual() == phi True - sage: E = EllipticCurve(GF(103),[1,0,0,1,-1]) # needs sage.rings.finite_rings - sage: phi = E.isogeny(E(60,85)) # needs sage.rings.finite_rings - sage: phi.dual() # needs sage.rings.finite_rings + 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 @@ -3357,7 +3305,6 @@ def _composition_impl(left, right): EXAMPLES:: - sage: # needs sage.rings.finite_rings 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) @@ -3380,7 +3327,7 @@ def _composition_impl(left, right): 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) # needs sage.rings.finite_rings + sage: phi._composition_impl(iso1, iso1**-1) NotImplemented """ if isinstance(left, WeierstrassIsomorphism) and isinstance(right, EllipticCurveIsogeny): @@ -3435,7 +3382,6 @@ 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: # needs sage.rings.finite_rings 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) @@ -3444,7 +3390,6 @@ def compute_isogeny_stark(E1, E2, ell): sage: compute_isogeny_stark(E1pr, E2pr, 11) 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: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) sage: R. = GF(37)[] sage: f = (x + 14) * (x + 30) @@ -3579,7 +3524,6 @@ 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: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) sage: R. = GF(37)[] sage: f = (x + 14) * (x + 30) @@ -3590,18 +3534,18 @@ def compute_isogeny_kernel_polynomial(E1, E2, ell, algorithm="stark"): sage: f x^2 + 7*x + 13 + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0,0,0,1,0]) # needs sage.rings.number_field - sage: E2 = EllipticCurve(K, [0,0,0,16,0]) # needs sage.rings.number_field - sage: compute_isogeny_kernel_polynomial(E, E2, 4) # needs sage.rings.number_field + 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) x^3 + x TESTS: Check that :meth:`Polynomial.radical` is doing the right thing for us:: - sage: # needs sage.rings.finite_rings sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) sage: R. = GF(37)[] sage: f = (x + 10) * (x + 12) * (x + 16) @@ -3661,7 +3605,6 @@ def compute_intermediate_curves(E1, E2): EXAMPLES:: - sage: # needs sage.rings.finite_rings 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 @@ -3683,11 +3626,12 @@ def compute_intermediate_curves(E1, E2): over Finite Field of size 83 Via: (u,r,s,t) = (1, 7, 42, 42)) + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: E = EllipticCurve(K, [0,0,0,1,0]) # needs sage.rings.number_field - sage: E2 = EllipticCurve(K, [0,0,0,16,0]) # needs sage.rings.number_field - sage: compute_intermediate_curves(E, E2) # needs sage.rings.finite_rings sage.rings.number_field + 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 @@ -3791,7 +3735,6 @@ def compute_sequence_of_maps(E1, E2, ell): over Number Field in i with defining polynomial x^2 + 1, x^3 + x) - sage: # needs sage.rings.finite_rings 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) diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index 1c6444583b9..58a6760cdb9 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -1900,7 +1900,7 @@ class of curves. If the j-invariant is not unique in the isogeny sage: # needs sage.graphs sage.rings.number_field sage: K. = NumberField(x^2 - 2) # needs sage.rings.finite_rings sage: E = EllipticCurve(K, [1, 0, 1, 4, -6]) # needs sage.rings.finite_rings - sage: G2 = E.isogeny_ell_graph(2, directed=False) + sage: G2 = E.isogeny_ell_graph(2, directed=False) # needs sage.rings.finite_rings sage: G2.vertices(sort=True) ['y^2 + x*y + y = x^3 + (-130*e-356)*x + (-2000*e-2038)', 'y^2 + x*y + y = x^3 + (-36)*x + (-70)', @@ -1913,7 +1913,7 @@ class of curves. If the j-invariant is not unique in the isogeny '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 = E.isogeny_ell_graph(3, directed=False) # needs sage.rings.finite_rings sage: G3.vertices(sort=True) ['y^2 + x*y + y = x^3 + (-1)*x', 'y^2 + x*y + y = x^3 + (-171)*x + (-874)', diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py index b2b2c617de8..a16539eed1e 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py @@ -787,8 +787,8 @@ 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]) # needs sage.rings.finite_rings - sage: [phi.codomain().ainvs() for phi in isogenies_3(E)] # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(17), [1,1]) + sage: [phi.codomain().ainvs() for phi in isogenies_3(E)] [(0, 0, 0, 9, 7), (0, 0, 0, 0, 1)] sage: E = EllipticCurve(GF(17^2,'a'), [1,1]) # needs sage.rings.finite_rings @@ -955,8 +955,8 @@ def isogenies_5_1728(E, minimal_models=True): sage: isogenies_5_1728(E) [] - sage: E = EllipticCurve(GF(13), [11,0]) # needs sage.rings.finite_rings - sage: isogenies_5_1728(E) # needs sage.rings.finite_rings + 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, @@ -1112,9 +1112,9 @@ def isogenies_7_0(E, minimal_models=True): Now some examples of 7-isogenies which are not endomorphisms:: - sage: K = GF(101) # needs sage.rings.finite_rings - sage: E = EllipticCurve(K, [0,1]) # needs sage.rings.finite_rings - sage: isogenies_7_0(E) # needs sage.rings.finite_rings + 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, @@ -1223,8 +1223,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]) # needs sage.rings.finite_rings - sage: isogenies_7_1728(E) # needs sage.rings.finite_rings + 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, @@ -1376,9 +1376,9 @@ def isogenies_13_0(E, minimal_models=True): A previous implementation did not work in some characteristics:: - sage: K = GF(29) # needs sage.rings.finite_rings - sage: E = EllipticCurve(j=K(0)) # needs sage.rings.finite_rings - sage: isogenies_13_0(E) # needs sage.rings.finite_rings + 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, @@ -1388,10 +1388,10 @@ def isogenies_13_0(E, minimal_models=True): :: - sage: K = GF(101) # needs sage.rings.finite_rings - sage: E = EllipticCurve(j=K(0)); E.ainvs() # needs sage.rings.finite_rings + sage: K = GF(101) + sage: E = EllipticCurve(j=K(0)); E.ainvs() (0, 0, 0, 0, 1) - sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)] # needs sage.rings.finite_rings + sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)] [(0, 0, 0, 64, 36), (0, 0, 0, 42, 66)] :: @@ -1494,7 +1494,6 @@ def isogenies_13_1728(E, minimal_models=True): :: - sage: # needs sage.rings.finite_rings sage: K = GF(83) sage: E = EllipticCurve(K, [0,0,0,5,0]); E.ainvs() (0, 0, 0, 5, 0) @@ -1513,9 +1512,9 @@ def isogenies_13_1728(E, minimal_models=True): :: - sage: K = GF(23) # needs sage.rings.finite_rings - sage: E = EllipticCurve(K, [1,0]) # needs sage.rings.finite_rings - sage: isogenies_13_1728(E) # needs sage.rings.finite_rings + 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, @@ -1925,8 +1924,8 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): over Number Field in a with defining polynomial x^2 - 253 with a = 15.905973720586867?] - sage: E = EllipticCurve_from_j(GF(5)(1)) # needs sage.rings.finite_rings - sage: isogenies_prime_degree_genus_plus_0(E, 41) # needs sage.rings.finite_rings + 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, @@ -1968,8 +1967,8 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): over Number Field in a with defining polynomial x^2 + 66827 with a = 258.5091874576221?*I] - sage: E = EllipticCurve_from_j(GF(13)(5)) # needs sage.rings.finite_rings - sage: isogenies_prime_degree_genus_plus_0(E, 71) # needs sage.rings.finite_rings + 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, @@ -1977,8 +1976,8 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): 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]) # needs sage.rings.finite_rings - sage: isogenies_prime_degree_genus_plus_0(E) # needs sage.rings.finite_rings + 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, @@ -2360,7 +2359,6 @@ 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: # needs sage.rings.finite_rings sage: F = GF(3) sage: E = EllipticCurve(F, [0,0,0,-1,0]) sage: f13 = E.division_polynomial(13) @@ -2519,7 +2517,7 @@ 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): # needs sage.rings.finite_rings + sage: for l in prime_range(50): ....: E = EllipticCurve(GF(l),ainvs) ....: isogenies_prime_degree_general(E,l) [] @@ -2562,7 +2560,6 @@ def isogenies_prime_degree_general(E, l, minimal_models=True): factors of degree 6 each, but only two those are kernel polynomials:: - sage: # needs sage.rings.finite_rings sage: F3 = GF(3) sage: E = EllipticCurve(F3, [0,0,0,-1,0]) sage: Psi13 = E.division_polynomial(13) @@ -2735,7 +2732,7 @@ 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): # needs sage.rings.finite_rings + sage: for l in prime_range(50): ....: E = EllipticCurve(GF(l), ainvs) ....: isogenies_prime_degree(E, l) [] @@ -2787,10 +2784,10 @@ def isogenies_prime_degree(E, l, minimal_models=True): 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]) # needs sage.rings.finite_rings - sage: E.isogenies_prime_degree(71) # fast # needs sage.rings.finite_rings + sage: E = EllipticCurve(GF(101), [-3440, 77658]) + sage: E.isogenies_prime_degree(71) # fast [] - sage: E.isogenies_prime_degree(73) # long time # needs sage.rings.finite_rings + sage: E.isogenies_prime_degree(73) # long time [] Test that :trac:`32269` is fixed:: diff --git a/src/sage/schemes/toric/homset.py b/src/sage/schemes/toric/homset.py index f9ec732c334..bd535edf932 100644 --- a/src/sage/schemes/toric/homset.py +++ b/src/sage/schemes/toric/homset.py @@ -325,7 +325,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() # needs sage.rings.finite_rings + sage: P2.change_ring(GF(7)).point_set().is_finite() True """ variety = self.codomain() @@ -348,7 +348,6 @@ def _naive_enumerator(self, ring=None): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) sage: point_set = P123.point_set() sage: next(iter(point_set._naive_enumerator())) @@ -380,7 +379,6 @@ def _finite_field_enumerator(self, finite_field=None): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) sage: point_set = P123.point_set() sage: next(iter(point_set._finite_field_enumerator())) @@ -407,9 +405,9 @@ def _enumerator(self): EXAMPLES:: - sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) # needs sage.rings.finite_rings - sage: point_set = P123.point_set() # needs sage.rings.finite_rings - sage: point_set._enumerator() # needs sage.rings.finite_rings + sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) + sage: point_set = P123.point_set() + sage: point_set._enumerator() """ ring = self.domain().base_ring() @@ -451,11 +449,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)) # needs sage.rings.finite_rings - sage: point_set = X.point_set() # needs sage.rings.finite_rings - sage: point_set.cardinality() # needs sage.rings.finite_rings + sage: X = ToricVariety(fan, base_field=GF(7)) + sage: point_set = X.point_set() + sage: point_set.cardinality() 21 - sage: sorted(X.point_set().list()) # needs sage.rings.finite_rings + sage: sorted(X.point_set().list()) [[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], @@ -469,9 +467,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)) # needs sage.rings.finite_rings - sage: point_set = blowup_plane.point_set() # needs sage.rings.finite_rings - sage: sorted(point_set.list()) # needs sage.rings.finite_rings + sage: blowup_plane = ToricVariety(fan, base_ring=GF(3)) + sage: point_set = blowup_plane.point_set() + sage: sorted(point_set.list()) [[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], @@ -480,8 +478,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)) # needs sage.rings.finite_rings - sage: sorted(F_times_Fstar.point_set().list()) # needs sage.rings.finite_rings + sage: F_times_Fstar = ToricVariety(Fan([Cone([(1,0)])]), base_field=GF(3)) + sage: sorted(F_times_Fstar.point_set().list()) [[0 : 1], [0 : 2], [1 : 1], [1 : 2], [2 : 1], [2 : 2]] TESTS:: @@ -503,26 +501,25 @@ def cardinality(self): sage: o = lattice_polytope.cross_polytope(3) sage: V = ToricVariety(FaceFan(o)) - sage: V.change_ring(GF(2)).point_set().cardinality() # needs sage.rings.finite_rings + sage: V.change_ring(GF(2)).point_set().cardinality() 27 sage: V.change_ring(GF(8, "a")).point_set().cardinality() # needs sage.rings.finite_rings 729 - sage: V.change_ring(GF(101)).point_set().cardinality() # needs sage.rings.finite_rings + sage: V.change_ring(GF(101)).point_set().cardinality() 1061208 For non-smooth varieties over finite fields, the homogeneous rescalings are solved. This is somewhat slower:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_field=GF(7)) # needs sage.rings.finite_rings - sage: X.point_set().cardinality() # needs sage.rings.finite_rings + sage: X = ToricVariety(fan, base_field=GF(7)) + sage: X.point_set().cardinality() 21 Fulton's formula does not apply since the variety is not smooth. And, indeed, naive application gives a different result:: - sage: # needs sage.rings.finite_rings sage: q = X.base_ring().order() sage: n = X.dimension() sage: d = map(len, fan().cones()) @@ -575,7 +572,6 @@ def __iter__(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) sage: point_set = P123.point_set() sage: next(iter(point_set.__iter__())) @@ -600,9 +596,9 @@ def _enumerator(self): EXAMPLES:: - sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) # needs sage.rings.finite_rings - sage: point_set = P123.point_set() # needs sage.rings.finite_rings - sage: point_set._enumerator() # needs sage.rings.finite_rings + sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) + sage: point_set = P123.point_set() + sage: point_set._enumerator() """ ambient = super()._enumerator() @@ -625,7 +621,6 @@ def __iter__(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: P2. = toric_varieties.P2(base_ring=GF(5)) sage: cubic = P2.subscheme([x^3 + y^3 + z^3]) sage: list(cubic.point_set()) @@ -646,7 +641,6 @@ def cardinality(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: P2. = toric_varieties.P2(base_ring=GF(5)) sage: cubic = P2.subscheme([x^3 + y^3 + z^3]) sage: list(cubic.point_set()) diff --git a/src/sage/schemes/toric/ideal.py b/src/sage/schemes/toric/ideal.py index b048980811f..bf9eb94e331 100644 --- a/src/sage/schemes/toric/ideal.py +++ b/src/sage/schemes/toric/ideal.py @@ -218,7 +218,7 @@ def __init__(self, A, 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)) # needs sage.rings.finite_rings + sage: ToricIdeal(A, names='x', base_ring=GF(101)) 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'])) diff --git a/src/sage/schemes/toric/library.py b/src/sage/schemes/toric/library.py index 1bcaad63859..d70a3e95d5d 100644 --- a/src/sage/schemes/toric/library.py +++ b/src/sage/schemes/toric/library.py @@ -1331,7 +1331,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()) # needs sage.rings.finite_rings + sage: sorted(T3.change_ring(GF(3)).point_set().list()) [[1 : 1 : 1], [1 : 1 : 2], [1 : 2 : 1], [1 : 2 : 2], [2 : 1 : 1], [2 : 1 : 2], [2 : 2 : 1], [2 : 2 : 2]] """ diff --git a/src/sage/schemes/toric/points.py b/src/sage/schemes/toric/points.py index d2891867360..f9563bd0acc 100644 --- a/src/sage/schemes/toric/points.py +++ b/src/sage/schemes/toric/points.py @@ -14,7 +14,6 @@ EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: P2 = toric_varieties.P2(base_ring=GF(3)) sage: point_set = P2.point_set() sage: point_set.cardinality() @@ -124,8 +123,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)) # needs sage.rings.finite_rings - sage: next(iter(n)) # needs sage.rings.finite_rings + sage: n = NaiveFinitePointEnumerator(fan, GF(3)) + sage: next(iter(n)) (0, 0, 1) """ assert ring.is_finite() @@ -146,8 +145,8 @@ def rays(self): sage: fan.rays() Empty collection in 2-d lattice N - sage: n = NaiveFinitePointEnumerator(fan, GF(3)) # needs sage.rings.finite_rings - sage: n.rays() # needs sage.rings.finite_rings + sage: n = NaiveFinitePointEnumerator(fan, GF(3)) + sage: n.rays() N(1, 0), N(0, 1) in 2-d lattice N @@ -161,9 +160,9 @@ def units(self): EXAMPLES:: - sage: P2 = toric_varieties.P2(base_ring=GF(5)) # needs sage.rings.finite_rings - sage: ne = P2.point_set()._naive_enumerator() # needs sage.rings.finite_rings - sage: ne.units() # needs sage.rings.finite_rings + sage: P2 = toric_varieties.P2(base_ring=GF(5)) + sage: ne = P2.point_set()._naive_enumerator() + sage: ne.units() (1, 2, 3, 4) """ return tuple(x for x in self.ring if x != 0) @@ -184,7 +183,6 @@ def roots(self, n): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: P2 = toric_varieties.P2(base_ring=GF(5)) sage: ne = P2.point_set()._naive_enumerator() sage: ne.roots(2) @@ -208,11 +206,11 @@ def _Chow_group_free(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) # needs sage.rings.finite_rings - sage: X.Chow_group().degree(1) # needs sage.rings.finite_rings + sage: X = ToricVariety(fan, base_ring=GF(7)) + sage: X.Chow_group().degree(1) C3 x Z - sage: enum = X.point_set()._naive_enumerator() # needs sage.rings.finite_rings - sage: enum._Chow_group_free() # needs sage.rings.finite_rings + sage: enum = X.point_set()._naive_enumerator() + sage: enum._Chow_group_free() ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5), (6, 6, 6)) """ units = self.units() @@ -236,11 +234,11 @@ def _Chow_group_torsion(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) # needs sage.rings.finite_rings - sage: X.Chow_group().degree(1) # needs sage.rings.finite_rings + sage: X = ToricVariety(fan, base_ring=GF(7)) + sage: X.Chow_group().degree(1) C3 x Z - sage: enum = X.point_set()._naive_enumerator() # needs sage.rings.finite_rings - sage: enum._Chow_group_torsion() # needs sage.rings.finite_rings + sage: enum = X.point_set()._naive_enumerator() + sage: enum._Chow_group_torsion() ((1, 2, 4), (1, 4, 2)) """ if self.fan.is_smooth(): @@ -269,19 +267,19 @@ def rescalings(self): EXAMPLES:: - sage: P2_123 = toric_varieties.P2_123(base_ring=GF(5)) # needs sage.rings.finite_rings - sage: ni = P2_123.point_set()._naive_enumerator() # needs sage.rings.finite_rings - sage: ni.rescalings() # needs sage.rings.finite_rings + sage: P2_123 = toric_varieties.P2_123(base_ring=GF(5)) + sage: ni = P2_123.point_set()._naive_enumerator() + sage: ni.rescalings() ((1, 1, 1), (1, 4, 4), (4, 2, 3), (4, 3, 2)) - sage: dP8 = toric_varieties.dP8(base_ring=GF(3)) # needs sage.rings.finite_rings - sage: ni = dP8.point_set()._naive_enumerator() # needs sage.rings.finite_rings - sage: ni.rescalings() # needs sage.rings.finite_rings + sage: dP8 = toric_varieties.dP8(base_ring=GF(3)) + sage: ni = dP8.point_set()._naive_enumerator() + sage: ni.rescalings() ((1, 1, 1, 1), (1, 2, 2, 2), (2, 1, 2, 1), (2, 2, 1, 2)) - sage: P1xP1 = toric_varieties.P1xP1(base_ring=GF(3)) # needs sage.rings.finite_rings - sage: ni = P1xP1.point_set()._naive_enumerator() # needs sage.rings.finite_rings - sage: ni.rescalings() # needs sage.rings.finite_rings + sage: P1xP1 = toric_varieties.P1xP1(base_ring=GF(3)) + sage: ni = P1xP1.point_set()._naive_enumerator() + sage: ni.rescalings() ((1, 1, 1, 1), (1, 1, 2, 2), (2, 2, 1, 1), (2, 2, 2, 2)) """ free = self._Chow_group_free() @@ -305,7 +303,6 @@ def orbit(self, point): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: P2_123 = toric_varieties.P2_123(base_ring=GF(7)) sage: ne = P2_123.point_set()._naive_enumerator() sage: sorted(ne.orbit([1, 0, 0])) @@ -334,9 +331,9 @@ def cone_iter(self): EXAMPLES:: - sage: dP6 = toric_varieties.dP6(base_ring=GF(11)) # needs sage.rings.finite_rings - sage: ne = dP6.point_set()._naive_enumerator() # needs sage.rings.finite_rings - sage: for cone in ne.cone_iter(): # needs sage.rings.finite_rings + sage: dP6 = toric_varieties.dP6(base_ring=GF(11)) + sage: ne = dP6.point_set()._naive_enumerator() + sage: for cone in ne.cone_iter(): ....: print(cone.ambient_ray_indices()) (0, 1) (1, 2) @@ -367,24 +364,24 @@ def coordinate_iter(self): EXAMPLES:: - sage: P2 = toric_varieties.P2(base_ring=GF(2)) # needs sage.rings.finite_rings - sage: ni = P2.point_set()._naive_enumerator() # needs sage.rings.finite_rings - sage: list(ni.coordinate_iter()) # needs sage.rings.finite_rings + sage: P2 = toric_varieties.P2(base_ring=GF(2)) + sage: ni = P2.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: P1xP1 = toric_varieties.P1xP1(base_ring=GF(2)) # needs sage.rings.finite_rings - sage: ni = P1xP1.point_set()._naive_enumerator() # needs sage.rings.finite_rings - sage: list(ni.coordinate_iter()) # needs sage.rings.finite_rings + sage: P1xP1 = toric_varieties.P1xP1(base_ring=GF(2)) + sage: ni = P1xP1.point_set()._naive_enumerator() + sage: list(ni.coordinate_iter()) [(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)) # needs sage.rings.finite_rings - sage: ni = V.point_set()._naive_enumerator() # needs sage.rings.finite_rings - sage: list(ni.coordinate_iter()) # needs sage.rings.finite_rings + sage: V = ToricVariety(Fan([Cone([(1,1)])]), base_ring=GF(3)) + sage: ni = V.point_set()._naive_enumerator() + sage: list(ni.coordinate_iter()) [(0, 1), (0, 2), (1, 1), (1, 2), (2, 1), (2, 2)] """ units = [x for x in self.ring if x != 0] @@ -409,15 +406,15 @@ def __iter__(self): EXAMPLES:: - sage: P2 = toric_varieties.P2(base_ring=GF(2)) # needs sage.rings.finite_rings - sage: ni = P2.point_set()._naive_enumerator() # needs sage.rings.finite_rings - sage: list(ni) # needs sage.rings.finite_rings + sage: P2 = toric_varieties.P2(base_ring=GF(2)) + sage: ni = P2.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: P1xP1 = toric_varieties.P1xP1(base_ring=GF(3)) # needs sage.rings.finite_rings - sage: ni = P1xP1.point_set()._naive_enumerator() # needs sage.rings.finite_rings - sage: list(ni) # needs sage.rings.finite_rings + sage: P1xP1 = toric_varieties.P1xP1(base_ring=GF(3)) + sage: ni = P1xP1.point_set()._naive_enumerator() + sage: list(ni) [(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), @@ -466,7 +463,6 @@ def root_generator(self, n): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: point_set = toric_varieties.P2(base_ring=GF(5)).point_set() sage: ffe = point_set._finite_field_enumerator() sage: ffe.root_generator(2) @@ -504,13 +500,13 @@ def _Chow_group_free_generators(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) # needs sage.rings.finite_rings - sage: X.Chow_group().degree(1) # needs sage.rings.finite_rings + sage: X = ToricVariety(fan, base_ring=GF(7)) + sage: X.Chow_group().degree(1) C3 x Z - sage: enum = X.point_set()._finite_field_enumerator() # needs sage.rings.finite_rings - sage: enum._Chow_group_free() # needs sage.rings.finite_rings + sage: enum = X.point_set()._finite_field_enumerator() + sage: enum._Chow_group_free() ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5), (6, 6, 6)) - sage: enum._Chow_group_free_generators() # needs sage.rings.finite_rings + sage: enum._Chow_group_free_generators() ((3, 3, 3),) """ result = [] @@ -533,13 +529,13 @@ def _Chow_group_torsion_generators(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) # needs sage.rings.finite_rings - sage: X.Chow_group().degree(1) # needs sage.rings.finite_rings + sage: X = ToricVariety(fan, base_ring=GF(7)) + sage: X.Chow_group().degree(1) C3 x Z - sage: enum = X.point_set()._finite_field_enumerator() # needs sage.rings.finite_rings - sage: enum._Chow_group_torsion() # needs sage.rings.finite_rings + sage: enum = X.point_set()._finite_field_enumerator() + sage: enum._Chow_group_torsion() ((1, 2, 4), (1, 4, 2)) - sage: enum._Chow_group_torsion_generators() # needs sage.rings.finite_rings + sage: enum._Chow_group_torsion_generators() ((1, 2, 4),) """ if self.fan.is_smooth(): @@ -634,7 +630,6 @@ def rescaling_log_generators(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: point_set = toric_varieties.P2_123(base_ring=GF(5)).point_set() sage: ffe = point_set._finite_field_enumerator() sage: ffe.rescalings() @@ -663,22 +658,22 @@ def cone_points_iter(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) # needs sage.rings.finite_rings - sage: point_set = X.point_set() # needs sage.rings.finite_rings - sage: ffe = point_set._finite_field_enumerator() # needs sage.rings.finite_rings - sage: cpi = ffe.cone_points_iter() # needs sage.rings.finite_rings - sage: cone, nonzero_points, cokernel = list(cpi)[5] # needs sage.rings.finite_rings - sage: cone # needs sage.rings.finite_rings + 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 1-d cone of Rational polyhedral fan in 2-d lattice N - sage: cone.ambient_ray_indices() # needs sage.rings.finite_rings + sage: cone.ambient_ray_indices() (2,) - sage: nonzero_points # needs sage.rings.finite_rings + sage: nonzero_points [0, 1] - sage: cokernel # needs sage.rings.finite_rings + sage: cokernel Finitely generated module V/W over Integer Ring with invariants (2) - sage: list(cokernel) # needs sage.rings.finite_rings + sage: list(cokernel) [(0), (1)] - sage: [p.lift() for p in cokernel] # needs sage.rings.finite_rings + sage: [p.lift() for p in cokernel] [(0, 0), (0, 1)] """ from sage.matrix.constructor import matrix, block_matrix, identity_matrix @@ -712,22 +707,22 @@ def __iter__(self): EXAMPLES:: - sage: point_set = toric_varieties.P2(base_ring=GF(2)).point_set() # needs sage.rings.finite_rings - sage: ffe = point_set._finite_field_enumerator() # needs sage.rings.finite_rings - sage: list(ffe) # needs sage.rings.finite_rings + 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: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) # needs sage.rings.finite_rings - sage: point_set = X.point_set() # needs sage.rings.finite_rings - sage: ffe = point_set._finite_field_enumerator() # needs sage.rings.finite_rings - sage: list(ffe) # needs sage.rings.finite_rings + sage: X = ToricVariety(fan, base_ring=GF(7)) + sage: point_set = X.point_set() + sage: ffe = point_set._finite_field_enumerator() + sage: list(ffe) [(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) # needs sage.rings.finite_rings + sage: set(point_set._naive_enumerator()) == set(ffe) True """ nrays = len(self.rays()) @@ -749,10 +744,10 @@ def cardinality(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) # needs sage.rings.finite_rings - sage: point_set = X.point_set() # needs sage.rings.finite_rings - sage: ffe = point_set._finite_field_enumerator() # needs sage.rings.finite_rings - sage: ffe.cardinality() # needs sage.rings.finite_rings + sage: X = ToricVariety(fan, base_ring=GF(7)) + sage: point_set = X.point_set() + sage: ffe = point_set._finite_field_enumerator() + sage: ffe.cardinality() 21 """ n = 0 @@ -834,14 +829,14 @@ def inhomogeneous_equations(self, ring, nonzero_coordinates, cokernel): EXAMPLES:: sage: R. = QQ[] - sage: P2. = toric_varieties.P2(base_ring=GF(7)) # needs sage.rings.finite_rings - sage: X = P2.subscheme([x^3 + 2*y^3 + 3*z^3, x*y*z + x*y^2]) # needs sage.rings.finite_rings - sage: point_set = X.point_set() # needs sage.rings.finite_rings - sage: ffe = point_set._enumerator() # needs sage.rings.finite_rings - sage: cone, nonzero_coordinates, cokernel = list(ffe.ambient.cone_points_iter())[5] # needs sage.rings.finite_rings - sage: cone.ambient_ray_indices(), nonzero_coordinates # needs sage.rings.finite_rings + 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 ((2,), [0, 1]) - sage: ffe.inhomogeneous_equations(R, nonzero_coordinates, cokernel) # needs sage.rings.finite_rings + sage: ffe.inhomogeneous_equations(R, nonzero_coordinates, cokernel) [2*s^3 + 1, s^2] """ nrays = len(self.ambient.rays()) @@ -875,7 +870,6 @@ def solutions_serial(self, inhomogeneous_equations, log_range): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: R. = GF(7)[] sage: P2. = toric_varieties.P2(base_ring=GF(7)) sage: X = P2.subscheme(1) @@ -904,7 +898,6 @@ def solutions(self, inhomogeneous_equations, log_range): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: R. = GF(7)[] sage: P2. = toric_varieties.P2(base_ring=GF(7)) sage: X = P2.subscheme(1) @@ -951,7 +944,6 @@ def homogeneous_coordinates(self, log_t, nonzero_coordinates, cokernel): EXAMPLES:: - sage: # needs sage.rings.finite_rings 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() @@ -988,7 +980,6 @@ def __iter__(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings 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() @@ -1013,10 +1004,10 @@ def cardinality(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X. = ToricVariety(fan, base_ring=GF(7)) # needs sage.rings.finite_rings - sage: Y = X.subscheme(u^3 + v^3 + w^3 + u*v*w) # needs sage.rings.finite_rings - sage: point_set = Y.point_set() # needs sage.rings.finite_rings - sage: list(point_set) # needs sage.rings.finite_rings + 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) [[0 : 1 : 3], [1 : 0 : 3], [1 : 3 : 0], @@ -1024,8 +1015,8 @@ def cardinality(self): [1 : 1 : 4], [1 : 3 : 2], [1 : 3 : 5]] - sage: ffe = point_set._enumerator() # needs sage.rings.finite_rings - sage: ffe.cardinality() # needs sage.rings.finite_rings + sage: ffe = point_set._enumerator() + sage: ffe.cardinality() 7 """ n = 0 diff --git a/src/sage/schemes/toric/toric_subscheme.py b/src/sage/schemes/toric/toric_subscheme.py index abf7d1b1164..acdfd05d0d1 100644 --- a/src/sage/schemes/toric/toric_subscheme.py +++ b/src/sage/schemes/toric/toric_subscheme.py @@ -645,9 +645,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() # needs sage.rings.finite_rings + sage: P2.change_ring(GF(5)).subscheme([f]).is_nondegenerate() True - sage: P2.change_ring(GF(7)).subscheme([f]).is_nondegenerate() # needs sage.rings.finite_rings + sage: P2.change_ring(GF(7)).subscheme([f]).is_nondegenerate() False TESTS: diff --git a/src/sage/schemes/toric/variety.py b/src/sage/schemes/toric/variety.py index 727de10a43d..82d2ec7769a 100644 --- a/src/sage/schemes/toric/variety.py +++ b/src/sage/schemes/toric/variety.py @@ -1850,8 +1850,8 @@ def Stanley_Reisner_ideal(self): 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)) # needs sage.rings.finite_rings - sage: SR = X.Stanley_Reisner_ideal(); SR # needs sage.rings.finite_rings + 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 """ @@ -1874,8 +1874,8 @@ def linear_equivalence_ideal(self): 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)) # needs sage.rings.finite_rings - sage: lin = X.linear_equivalence_ideal(); lin # needs sage.rings.finite_rings + 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 """ @@ -2488,7 +2488,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) # needs sage.rings.finite_rings + sage: P2.change_ring(GF(101))._semigroup_ring(cone) (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) @@ -2740,10 +2740,10 @@ def count_points(self): sage: o = lattice_polytope.cross_polytope(3) sage: V = ToricVariety(FaceFan(o)) - sage: V2 = V.change_ring(GF(2)) # needs sage.rings.finite_rings - sage: V2.point_set().cardinality() # needs sage.rings.finite_rings + sage: V2 = V.change_ring(GF(2)) + sage: V2.point_set().cardinality() 27 - sage: V2.count_points() # needs sage.rings.finite_rings + sage: V2.count_points() 27 """ return self.point_set().cardinality() diff --git a/src/sage/schemes/toric/weierstrass_higher.py b/src/sage/schemes/toric/weierstrass_higher.py index f95b2fb2f6c..2a83234e6ca 100644 --- a/src/sage/schemes/toric/weierstrass_higher.py +++ b/src/sage/schemes/toric/weierstrass_higher.py @@ -263,7 +263,6 @@ def WeierstrassMap_P3(quadratic1, quadratic2, variables=None): TESTS:: - sage: # needs sage.rings.finite_rings 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 From bd85d0f1e8200fab390fa4ba5c9b23d62dfe0a8a Mon Sep 17 00:00:00 2001 From: dcoudert Date: Mon, 21 Aug 2023 14:10:52 +0200 Subject: [PATCH 054/423] review comment --- src/sage/graphs/planarity.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/graphs/planarity.pyx b/src/sage/graphs/planarity.pyx index af01c7a95a0..1088a7659de 100644 --- a/src/sage/graphs/planarity.pyx +++ b/src/sage/graphs/planarity.pyx @@ -167,7 +167,7 @@ def is_planar(g, kuratowski=False, set_pos=False, set_embedding=False): multiedges=g.allows_multiple_edges(), name="Kuratowski subgraph of (%s)" % g.name()) if g.get_pos(): - G.set_pos({u: g._pos[u] for u in g_dict.keys()}) + G.set_pos({u: g._pos[u] for u in g_dict}) return (False, G) if set_pos or set_embedding: From 439a4ece6b70ed55a669688bfda16bec790905ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 21 Aug 2023 15:19:46 +0200 Subject: [PATCH 055/423] using PyLong API instead of legacy PyInt API --- src/sage/arith/long.pxd | 4 +-- .../bounded_integer_sequences.pyx | 4 +-- .../geometry/triangulation/triangulations.cc | 8 ++--- .../geometry/triangulation/triangulations.h | 3 -- src/sage/libs/gmp/pylong.pyx | 3 +- src/sage/libs/mpmath/ext_impl.pyx | 1 - src/sage/libs/mpmath/ext_main.pyx | 1 - src/sage/matrix/matrix_integer_sparse.pyx | 4 +-- src/sage/modular/arithgroup/farey.cpp | 8 ++--- src/sage/modular/arithgroup/farey.hpp | 3 -- src/sage/rings/complex_arb.pyx | 6 ++-- src/sage/rings/finite_rings/integer_mod.pyx | 10 +++---- src/sage/rings/integer.pyx | 11 +++---- src/sage/rings/integer_ring.pyx | 4 +-- .../number_field/number_field_element.pyx | 2 +- src/sage/rings/padics/FM_template.pxi | 2 +- src/sage/rings/padics/FP_template.pxi | 2 +- src/sage/rings/padics/common_conversion.pyx | 8 ++--- .../rings/padics/padic_template_element.pxi | 6 ++-- .../polynomial_integer_dense_flint.pyx | 4 +-- .../polynomial/polynomial_rational_flint.pyx | 4 +-- .../polynomial/polynomial_real_mpfr_dense.pyx | 4 +-- src/sage/rings/real_arb.pyx | 10 +++---- src/sage/structure/coerce_actions.pyx | 2 +- src/sage/structure/list_clone.pyx | 4 +-- src/sage/symbolic/ginac/numeric.cpp | 30 +++++++++---------- 26 files changed, 69 insertions(+), 79 deletions(-) diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd index eda9d8c1f48..cd83089f9e5 100644 --- a/src/sage/arith/long.pxd +++ b/src/sage/arith/long.pxd @@ -17,8 +17,6 @@ Fast conversion of Python objects to C long from libc.limits cimport LONG_MIN, LONG_MAX from cpython.object cimport Py_SIZE -from cpython.int cimport PyInt_AS_LONG -from cpython.long cimport PyLong_AsLong from cpython.number cimport PyNumber_Index, PyIndex_Check from cpython.longintrepr cimport py_long, PyLong_SHIFT, digit @@ -83,7 +81,7 @@ cdef enum: cdef inline bint integer_check_long(x, long* value, int* err) except -1: """ Return whether ``x`` is some integer type. This is true for the - Python types ``int`` and ``long``, for Sage Integers and for types + Python type ``long``, for Sage Integers and for types implementing ``__index__``. If possible, compute the value of this integer as C long and store diff --git a/src/sage/data_structures/bounded_integer_sequences.pyx b/src/sage/data_structures/bounded_integer_sequences.pyx index 7e3846470c0..907f9b4298a 100644 --- a/src/sage/data_structures/bounded_integer_sequences.pyx +++ b/src/sage/data_structures/bounded_integer_sequences.pyx @@ -110,7 +110,7 @@ AUTHORS: from cysignals.signals cimport sig_check, sig_on, sig_off from sage.data_structures.bitset_base cimport * -from cpython.int cimport PyInt_FromSize_t +from cpython.long cimport PyLong_FromSize_t from cpython.slice cimport PySlice_GetIndicesEx from sage.libs.flint.flint cimport FLINT_BIT_COUNT as BIT_COUNT from sage.structure.richcmp cimport richcmp_not_equal, rich_to_bool @@ -295,7 +295,7 @@ cdef biseq_getitem_py(biseq_t S, mp_size_t index): """ cdef size_t out = biseq_getitem(S, index) - return PyInt_FromSize_t(out) + return PyLong_FromSize_t(out) cdef inline void biseq_inititem(biseq_t S, mp_size_t index, size_t item): """ diff --git a/src/sage/geometry/triangulation/triangulations.cc b/src/sage/geometry/triangulation/triangulations.cc index 68e4efa75e1..8ea306d8f7c 100644 --- a/src/sage/geometry/triangulation/triangulations.cc +++ b/src/sage/geometry/triangulation/triangulations.cc @@ -117,7 +117,7 @@ triangulations_ptr init_triangulations compact_simplices seed; for (int i=0; inext_triangulation(); PyObject* py_triang = PyTuple_New(triang.size()); for (size_t i=0; i -#define PyInt_FromLong PyLong_FromLong -#define PyInt_AsLong PyLong_AsLong -#define PyInt_AS_LONG PyLong_AS_LONG class triangulations: public std::vector { diff --git a/src/sage/libs/gmp/pylong.pyx b/src/sage/libs/gmp/pylong.pyx index 2f7ed35be9d..d5993cca5a5 100644 --- a/src/sage/libs/gmp/pylong.pyx +++ b/src/sage/libs/gmp/pylong.pyx @@ -26,7 +26,6 @@ AUTHORS: from cpython.object cimport Py_SIZE -from cpython.int cimport PyInt_FromLong from cpython.long cimport PyLong_FromLong from cpython.longintrepr cimport _PyLong_New, py_long, digit, PyLong_SHIFT from .mpz cimport * @@ -85,7 +84,7 @@ cdef mpz_get_pyintlong(mpz_srcptr z): if the value is too large. """ if mpz_fits_slong_p(z): - return PyInt_FromLong(mpz_get_si(z)) + return PyLong_FromLong(mpz_get_si(z)) return mpz_get_pylong_large(z) diff --git a/src/sage/libs/mpmath/ext_impl.pyx b/src/sage/libs/mpmath/ext_impl.pyx index 97a9ad39b9e..2d8d2470273 100644 --- a/src/sage/libs/mpmath/ext_impl.pyx +++ b/src/sage/libs/mpmath/ext_impl.pyx @@ -25,7 +25,6 @@ See if :trac:`15118` is fixed:: # http://www.gnu.org/licenses/ #***************************************************************************** -from cpython.int cimport * from cpython.long cimport * from cpython.float cimport * from cpython.complex cimport * diff --git a/src/sage/libs/mpmath/ext_main.pyx b/src/sage/libs/mpmath/ext_main.pyx index 7b907f0d603..845c85234a6 100644 --- a/src/sage/libs/mpmath/ext_main.pyx +++ b/src/sage/libs/mpmath/ext_main.pyx @@ -14,7 +14,6 @@ context class, and related utilities. # http://www.gnu.org/licenses/ #***************************************************************************** -from cpython.int cimport * from cpython.long cimport * from cpython.float cimport * from cpython.complex cimport * diff --git a/src/sage/matrix/matrix_integer_sparse.pyx b/src/sage/matrix/matrix_integer_sparse.pyx index a41677c7b6a..bfe37fd74eb 100644 --- a/src/sage/matrix/matrix_integer_sparse.pyx +++ b/src/sage/matrix/matrix_integer_sparse.pyx @@ -29,7 +29,7 @@ TESTS:: from cysignals.memory cimport check_calloc, sig_free from cysignals.signals cimport sig_on, sig_off -from cpython.int cimport PyInt_FromSize_t +from cpython.long cimport PyLong_FromSize_t from sage.ext.stdsage cimport PY_NEW from sage.ext.mod_int cimport * @@ -723,7 +723,7 @@ cdef class Matrix_integer_sparse(Matrix_sparse): del M - return PyInt_FromSize_t(r) + return PyLong_FromSize_t(r) def _det_linbox(self): r""" diff --git a/src/sage/modular/arithgroup/farey.cpp b/src/sage/modular/arithgroup/farey.cpp index 34f5e5727db..209391676de 100644 --- a/src/sage/modular/arithgroup/farey.cpp +++ b/src/sage/modular/arithgroup/farey.cpp @@ -1010,7 +1010,7 @@ PyObject* FareySymbol::word_problem(const mpz_t a, const mpz_t b, LLT_algorithm(M, p, beta1); wd = PyList_New(p.size()); for(i=0; i::const_iterator i=p.begin(); i!=p.end(); i++) { vector::const_iterator j = find(pairing.begin(), pairing.end(), *i); vector::const_iterator k = find(j+1, pairing.end(), *i); - PyObject* J = PyInt_FromLong(long(j-pairing.begin())); - PyObject* K = PyInt_FromLong(long(k-pairing.begin())); + PyObject* J = PyLong_FromLong(long(j-pairing.begin())); + PyObject* K = PyLong_FromLong(long(k-pairing.begin())); PyObject* tuple = PyTuple_New(2); PyTuple_SetItem(tuple, 0, J); PyTuple_SetItem(tuple, 1, K); diff --git a/src/sage/modular/arithgroup/farey.hpp b/src/sage/modular/arithgroup/farey.hpp index 076d5cd0504..03c03cf1434 100644 --- a/src/sage/modular/arithgroup/farey.hpp +++ b/src/sage/modular/arithgroup/farey.hpp @@ -29,9 +29,6 @@ #include #include "sl2z.hpp" -#define PyInt_FromLong PyLong_FromLong -#define PyInt_AsLong PyLong_AsLong -#define PyInt_AS_LONG PyLong_AS_LONG //--- pure virtual base class for helper class for membership test -------- diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx index ef432c1e945..83b9aee52d9 100644 --- a/src/sage/rings/complex_arb.pyx +++ b/src/sage/rings/complex_arb.pyx @@ -153,7 +153,7 @@ import sage.categories.fields cimport sage.rings.abc cimport sage.rings.rational -from cpython.int cimport PyInt_AS_LONG +from cpython.long cimport PyLong_AsLong from cpython.object cimport Py_EQ, Py_NE from cpython.complex cimport PyComplex_FromDoubles @@ -2732,7 +2732,7 @@ cdef class ComplexBall(RingElement): cdef ComplexBall self = val cdef ComplexBall res = self._new() if is_small_python_int(shift): - acb_mul_2exp_si(res.value, self.value, PyInt_AS_LONG(shift)) + acb_mul_2exp_si(res.value, self.value, PyLong_AsLong(shift)) elif isinstance(shift, Integer): sig_on() fmpz_init(tmpz) @@ -2874,7 +2874,7 @@ cdef class ComplexBall(RingElement): cdef ComplexBall res = self._new() if is_small_python_int(expo): if _do_sig(prec(self)): sig_on() - acb_pow_si(res.value, self.value, PyInt_AS_LONG(expo), prec(self)) + acb_pow_si(res.value, self.value, PyLong_AsLong(expo), prec(self)) if _do_sig(prec(self)): sig_off() elif isinstance(expo, Integer): if _do_sig(prec(self)): sig_on() diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index b9461bd362e..291bcc5bb8f 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -70,7 +70,7 @@ TESTS:: from cysignals.signals cimport sig_on, sig_off, sig_check -from cpython.int cimport * +from cpython.long cimport * from cpython.list cimport * from cpython.ref cimport * @@ -2793,8 +2793,8 @@ cdef class IntegerMod_int(IntegerMod_abstract): cdef long long_exp cdef int_fast32_t res cdef mpz_t res_mpz - if type(exp) is int and -100000 < PyInt_AS_LONG(exp) < 100000: - long_exp = PyInt_AS_LONG(exp) + if type(exp) is int and -100000 < PyLong_AsLong(exp) < 100000: + long_exp = PyLong_AsLong(exp) elif type(exp) is Integer and mpz_cmpabs_ui((exp).value, 100000) == -1: long_exp = mpz_get_si((exp).value) else: @@ -3624,8 +3624,8 @@ cdef class IntegerMod_int64(IntegerMod_abstract): cdef long long_exp cdef int_fast64_t res cdef mpz_t res_mpz - if type(exp) is int and -100000 < PyInt_AS_LONG(exp) < 100000: - long_exp = PyInt_AS_LONG(exp) + if type(exp) is int and -100000 < PyLong_AsLong(exp) < 100000: + long_exp = PyLong_AsLong(exp) elif type(exp) is Integer and mpz_cmpabs_ui((exp).value, 100000) == -1: long_exp = mpz_get_si((exp).value) else: diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index d5e87626d31..e385f64f90e 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -163,7 +163,7 @@ from sage.arith.long cimport (integer_check_long, from cpython.list cimport * from cpython.number cimport * -from cpython.int cimport * +from cpython.long cimport * from cpython.object cimport * from libc.stdint cimport uint64_t cimport sage.structure.element @@ -3451,7 +3451,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): cdef long d, res if is_small_python_int(other): - d = PyInt_AS_LONG(other) + d = PyLong_AsLong(other) if d > 0: mpz_fdiv_qr_ui(q.value, r.value, self.value, d) elif d == 0: @@ -6664,7 +6664,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): if type(y) is int: # For a Python int, we can just use the Python/C API. - n = PyInt_AS_LONG(y) + n = PyLong_AsLong(y) else: # If it's not already an Integer, try to convert it. if not isinstance(y, Integer): @@ -7407,7 +7407,7 @@ cdef class int_to_Z(Morphism): if type(a) is not int: raise TypeError("must be a Python int object") - return smallInteger(PyInt_AS_LONG(a)) + return smallInteger(PyLong_AsLong(a)) def _repr_type(self): """ @@ -7680,7 +7680,8 @@ cdef Integer zero = the_integer_ring._zero_element cdef Integer one = the_integer_ring._one_element # pool of small integer for fast sign computation -# Use the same defaults as Python, documented at https://docs.python.org/2/c-api/int.html#PyInt_FromLong +# Use the same defaults as Python3 documented at +# https://docs.python.org/3/c-api/long.html#c.PyLong_FromLong DEF small_pool_min = -5 DEF small_pool_max = 256 # we could use the above zero and one here diff --git a/src/sage/rings/integer_ring.pyx b/src/sage/rings/integer_ring.pyx index 8452beaa412..6c19b65b087 100644 --- a/src/sage/rings/integer_ring.pyx +++ b/src/sage/rings/integer_ring.pyx @@ -43,7 +43,7 @@ other types will also coerce to the integers, when it makes sense. # http://www.gnu.org/licenses/ #***************************************************************************** -from cpython.int cimport * +from cpython.long cimport * from cpython.list cimport * from cpython.object cimport Py_NE @@ -478,7 +478,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain): L = [] if type(step) is int: - istep = PyInt_AS_LONG(step) + istep = PyLong_AsLong(step) step_sign = istep else: zstep = step diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx index 27e33ad5be0..358dd6b2ddb 100644 --- a/src/sage/rings/number_field/number_field_element.pyx +++ b/src/sage/rings/number_field/number_field_element.pyx @@ -36,7 +36,7 @@ AUTHORS: import operator -from cpython.int cimport * +from cpython.long cimport * from cysignals.signals cimport sig_on, sig_off from sage.ext.stdsage cimport PY_NEW diff --git a/src/sage/rings/padics/FM_template.pxi b/src/sage/rings/padics/FM_template.pxi index ea7d4055660..b55d75a7057 100644 --- a/src/sage/rings/padics/FM_template.pxi +++ b/src/sage/rings/padics/FM_template.pxi @@ -34,7 +34,7 @@ AUTHORS: #***************************************************************************** include "padic_template_element.pxi" -from cpython.int cimport * +from cpython.long cimport * from sage.structure.element cimport Element from sage.rings.padics.common_conversion cimport comb_prec, _process_args_and_kwds diff --git a/src/sage/rings/padics/FP_template.pxi b/src/sage/rings/padics/FP_template.pxi index 57ec619b278..5961684ab0d 100644 --- a/src/sage/rings/padics/FP_template.pxi +++ b/src/sage/rings/padics/FP_template.pxi @@ -35,7 +35,7 @@ AUTHORS: from sage.ext.stdsage cimport PY_NEW include "padic_template_element.pxi" -from cpython.int cimport * +from cpython.long cimport * from sage.structure.element cimport Element from sage.rings.padics.common_conversion cimport comb_prec, _process_args_and_kwds diff --git a/src/sage/rings/padics/common_conversion.pyx b/src/sage/rings/padics/common_conversion.pyx index 4ed5570d306..0afddcc30a4 100644 --- a/src/sage/rings/padics/common_conversion.pyx +++ b/src/sage/rings/padics/common_conversion.pyx @@ -26,7 +26,7 @@ AUTHORS: # https://www.gnu.org/licenses/ # **************************************************************************** -from cpython.int cimport * +from cpython.long cimport * from sage.ext.stdsage cimport PY_NEW from sage.libs.gmp.all cimport * from sage.arith.rational_reconstruction cimport mpq_rational_reconstruction @@ -84,7 +84,7 @@ cdef long get_ordp(x, PowComputer_class prime_pow) except? -10000: if x == 0: return maxordp try: - n = PyInt_AsLong(x) + n = PyLong_AsLong(x) except OverflowError: return get_ordp(Integer(x), prime_pow) else: @@ -250,7 +250,7 @@ cdef long comb_prec(iprec, long prec) except? -10000: raise OverflowError("precision overflow") return mpz_get_si(intprec.value) if isinstance(iprec, int): - return min(PyInt_AS_LONG(iprec), prec) + return min(PyLong_AsLong(iprec), prec) return comb_prec(Integer(iprec), prec) cdef int _process_args_and_kwds(long *aprec, long *rprec, args, kwds, bint absolute, PowComputer_class prime_pow) except -1: @@ -405,7 +405,7 @@ cdef inline int cconv_shared(mpz_t out, x, long prec, long valshift, PowComputer - ``prime_pow`` -- a PowComputer for the ring. """ - if PyInt_Check(x): + if PyLong_Check(x): x = Integer(x) elif isinstance(x, pari_gen): x = x.sage() diff --git a/src/sage/rings/padics/padic_template_element.pxi b/src/sage/rings/padics/padic_template_element.pxi index a21494e5479..06cc00e73f0 100644 --- a/src/sage/rings/padics/padic_template_element.pxi +++ b/src/sage/rings/padics/padic_template_element.pxi @@ -22,7 +22,7 @@ AUTHORS: # https://www.gnu.org/licenses/ # **************************************************************************** -from cpython.int cimport * +from cpython.long cimport * from sage.libs.gmp.all cimport * import sage.rings.finite_rings.integer_mod @@ -253,7 +253,7 @@ cdef class pAdicTemplateElement(pAdicGenericElement): # The "verify that shift is an integer" part could be shared cdef long s if isinstance(shift, int): - s = PyInt_AS_LONG(shift) + s = PyLong_AsLong(shift) else: if not isinstance(shift, Integer): shift = Integer(shift) @@ -301,7 +301,7 @@ cdef class pAdicTemplateElement(pAdicGenericElement): """ cdef long s if isinstance(shift, int): - s = PyInt_AS_LONG(shift) + s = PyLong_AsLong(shift) else: if not isinstance(shift, Integer): shift = Integer(shift) diff --git a/src/sage/rings/polynomial/polynomial_integer_dense_flint.pyx b/src/sage/rings/polynomial/polynomial_integer_dense_flint.pyx index e201ac843ad..7faa7ff2271 100644 --- a/src/sage/rings/polynomial/polynomial_integer_dense_flint.pyx +++ b/src/sage/rings/polynomial/polynomial_integer_dense_flint.pyx @@ -42,7 +42,7 @@ from cysignals.signals cimport sig_on, sig_off include "sage/libs/ntl/decl.pxi" -from cpython.int cimport PyInt_AS_LONG +from cpython.long cimport PyLong_AsLong from sage.libs.gmp.mpz cimport * from sage.arith.long cimport pyobject_to_long, is_small_python_int @@ -421,7 +421,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): sig_on() fmpz_init(a_fmpz) fmpz_init(z_fmpz) - fmpz_set_si(a_fmpz, PyInt_AS_LONG(x0)) + fmpz_set_si(a_fmpz, PyLong_AsLong(x0)) fmpz_poly_evaluate_fmpz(z_fmpz, self.__poly, a_fmpz) fmpz_get_mpz(z.value, z_fmpz) fmpz_clear(a_fmpz) diff --git a/src/sage/rings/polynomial/polynomial_rational_flint.pyx b/src/sage/rings/polynomial/polynomial_rational_flint.pyx index d0dd15522e9..f37eb1751aa 100644 --- a/src/sage/rings/polynomial/polynomial_rational_flint.pyx +++ b/src/sage/rings/polynomial/polynomial_rational_flint.pyx @@ -25,7 +25,7 @@ AUTHOR: from cysignals.memory cimport check_allocarray, sig_free from cysignals.signals cimport sig_on, sig_str, sig_off -from cpython.int cimport PyInt_AS_LONG +from cpython.long cimport PyLong_AsLong from sage.arith.long cimport pyobject_to_long from sage.libs.arb.acb cimport acb_div_fmpz @@ -522,7 +522,7 @@ cdef class Polynomial_rational_flint(Polynomial): sig_str("FLINT exception") fmpz_init(tmpfz) fmpq_init(tmpfq) - fmpz_set_si(tmpfz, PyInt_AS_LONG(a)) + fmpz_set_si(tmpfz, PyLong_AsLong(a)) fmpq_poly_evaluate_fmpz(tmpfq, self.__poly, tmpfz) fmpq_get_mpq(r.value, tmpfq) fmpq_clear(tmpfq) diff --git a/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx b/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx index fbe96d186c5..4fb9fef2dbd 100644 --- a/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx +++ b/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx @@ -26,7 +26,7 @@ Check that operations with numpy elements work well (see :trac:`18076` and from cysignals.memory cimport check_allocarray, check_reallocarray, sig_free from cysignals.signals cimport sig_on, sig_off -from cpython.int cimport PyInt_AS_LONG +from cpython.long cimport PyLong_AsLong from cpython.float cimport PyFloat_AS_DOUBLE from sage.structure.parent cimport Parent @@ -151,7 +151,7 @@ cdef class PolynomialRealDense(Polynomial): if type(a) is RealNumber: mpfr_set(coeffs[i], (a).value, rnd) elif type(a) is int: - mpfr_set_si(coeffs[i], PyInt_AS_LONG(a), rnd) + mpfr_set_si(coeffs[i], PyLong_AsLong(a), rnd) elif type(a) is float: mpfr_set_d(coeffs[i], PyFloat_AS_DOUBLE(a), rnd) elif type(a) is Integer: diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx index 9eec35e882e..34f638815fd 100644 --- a/src/sage/rings/real_arb.pyx +++ b/src/sage/rings/real_arb.pyx @@ -200,7 +200,7 @@ Classes and Methods from cysignals.signals cimport sig_on, sig_str, sig_off from cpython.float cimport PyFloat_AS_DOUBLE -from cpython.int cimport PyInt_AS_LONG +from cpython.long cimport PyLong_AsLong from cpython.object cimport Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE from libc.stdlib cimport abort @@ -1385,7 +1385,7 @@ cdef class RealBall(RingElement): elif isinstance(mid, RealBall): arb_set(self.value, ( mid).value) # no rounding! elif is_small_python_int(mid): - arb_set_si(self.value, PyInt_AS_LONG(mid)) # no rounding! + arb_set_si(self.value, PyLong_AsLong(mid)) # no rounding! elif isinstance(mid, Integer): if _do_sig(prec(self)): sig_on() fmpz_init(tmpz) @@ -2617,7 +2617,7 @@ cdef class RealBall(RingElement): if isinstance(other, RealBall): res = arb_contains(self.value, ( other).value) elif is_small_python_int(other): - res = arb_contains_si(self.value, PyInt_AS_LONG(other)) + res = arb_contains_si(self.value, PyLong_AsLong(other)) elif isinstance(other, Integer): fmpz_init(tmpz) fmpz_set_mpz(tmpz, ( other).value) @@ -2907,7 +2907,7 @@ cdef class RealBall(RingElement): cdef RealBall res = self._new() if is_small_python_int(expo) and expo > 0: if _do_sig(prec(self)): sig_on() - arb_pow_ui(res.value, self.value, PyInt_AS_LONG(expo), prec(self)) + arb_pow_ui(res.value, self.value, PyLong_AsLong(expo), prec(self)) if _do_sig(prec(self)): sig_off() elif isinstance(expo, Integer): if _do_sig(prec(self)): sig_on() @@ -3074,7 +3074,7 @@ cdef class RealBall(RingElement): cdef RealBall self = val cdef RealBall res = self._new() if is_small_python_int(shift): - arb_mul_2exp_si(res.value, self.value, PyInt_AS_LONG(shift)) + arb_mul_2exp_si(res.value, self.value, PyLong_AsLong(shift)) elif isinstance(shift, Integer): sig_on() fmpz_init(tmpz) diff --git a/src/sage/structure/coerce_actions.pyx b/src/sage/structure/coerce_actions.pyx index 146c41379b7..af51c00dc90 100644 --- a/src/sage/structure/coerce_actions.pyx +++ b/src/sage/structure/coerce_actions.pyx @@ -14,7 +14,7 @@ Coerce actions import operator -from cpython.int cimport * +from cpython.long cimport * from cpython.number cimport * from cysignals.signals cimport sig_check diff --git a/src/sage/structure/list_clone.pyx b/src/sage/structure/list_clone.pyx index 61a6823fc11..ae50771c7b8 100644 --- a/src/sage/structure/list_clone.pyx +++ b/src/sage/structure/list_clone.pyx @@ -141,7 +141,7 @@ AUTHORS: # **************************************************************************** from cpython.list cimport * -from cpython.int cimport * +from cpython.long cimport * from cpython.ref cimport * from cysignals.memory cimport check_reallocarray, sig_free @@ -1391,7 +1391,7 @@ cdef class ClonableIntArray(ClonableElement): cdef list L = PyList_New(self._len) cdef object o for i in range(self._len): - o = PyInt_FromLong(self._list[i]) + o = PyLong_FromLong(self._list[i]) Py_INCREF(o) PyList_SET_ITEM(L, i, o) return L diff --git a/src/sage/symbolic/ginac/numeric.cpp b/src/sage/symbolic/ginac/numeric.cpp index b40ed64edb5..6c91497e699 100644 --- a/src/sage/symbolic/ginac/numeric.cpp +++ b/src/sage/symbolic/ginac/numeric.cpp @@ -495,9 +495,9 @@ static PyObject* py_tuple_from_numvector(const std::vector& vec) /////////////////////////////////////////////////////////////////////////////// #if PY_MAJOR_VERSION < 3 -PyObject* ZERO = PyInt_FromLong(0); // todo: never freed -PyObject* ONE = PyInt_FromLong(1); // todo: never freed -PyObject* TWO = PyInt_FromLong(2); // todo: never freed +PyObject* ZERO = PyLong_FromLong(0); // todo: never freed +PyObject* ONE = PyLong_FromLong(1); // todo: never freed +PyObject* TWO = PyLong_FromLong(2); // todo: never freed #else PyObject* ZERO = PyLong_FromLong(0); // todo: never freed PyObject* ONE = PyLong_FromLong(1); // todo: never freed @@ -815,9 +815,9 @@ numeric::numeric(PyObject* o, bool force_py) : basic(&numeric::tinfo_static) { if (o == nullptr) py_error("Error"); if (not force_py) { #if PY_MAJOR_VERSION < 3 - if (PyInt_Check(o)) { + if (PyLong_Check(o)) { t = LONG; - v._long = PyInt_AsLong(o); + v._long = PyLong_AsLong(o); hash = (v._long==-1) ? -2 : v._long; setflag(status_flags::evaluated | status_flags::expanded); Py_DECREF(o); @@ -1541,11 +1541,11 @@ const numeric numeric::div(const numeric &other) const { and py_funcs.py_is_integer(other.v._pyobject) != 0) { return *this; } - if (PyInt_Check(v._pyobject)) { - if (PyInt_Check(other.v._pyobject)) { + if (PyLong_Check(v._pyobject)) { + if (PyLong_Check(other.v._pyobject)) { // This branch happens at startup. - PyObject *o = PyNumber_TrueDivide(Integer(PyInt_AsLong(v._pyobject)), - Integer(PyInt_AsLong(other.v._pyobject))); + PyObject *o = PyNumber_TrueDivide(Integer(PyLong_AsLong(v._pyobject)), + Integer(PyLong_AsLong(other.v._pyobject))); // I don't 100% understand why I have to incref this, // but if I don't, Sage crashes on exit. Py_INCREF(o); @@ -1848,8 +1848,8 @@ const ex numeric::power(const numeric &exponent) const { // any PyObjects castable to long are casted if (exponent.t == PYOBJECT) { #if PY_MAJOR_VERSION < 3 - if (PyInt_Check(exponent.v._pyobject)) { - long si = PyInt_AsLong(exponent.v._pyobject); + if (PyLong_Check(exponent.v._pyobject)) { + long si = PyLong_AsLong(exponent.v._pyobject); if (si == -1 and PyErr_Occurred()) PyErr_Clear(); else { @@ -2486,11 +2486,11 @@ numeric & operator/=(numeric & lh, const numeric & rh) PyObject *p = lh.v._pyobject; #if PY_MAJOR_VERSION < 3 { - if (PyInt_Check(p)) { - if (PyInt_Check(rh.v._pyobject)) { + if (PyLong_Check(p)) { + if (PyLong_Check(rh.v._pyobject)) { // This branch happens at startup. - lh.v._pyobject = PyNumber_TrueDivide(Integer(PyInt_AsLong(p)), - Integer(PyInt_AsLong(rh.v._pyobject))); + lh.v._pyobject = PyNumber_TrueDivide(Integer(PyLong_AsLong(p)), + Integer(PyLong_AsLong(rh.v._pyobject))); // I don't 100% understand why I have to incref this, // but if I don't, Sage crashes on exit. if (lh.v._pyobject == nullptr) { From 852edd80540bf06bc6ea52399b9d898cc398d20c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 21 Aug 2023 15:25:17 +0200 Subject: [PATCH 056/423] doc detail --- src/sage/arith/long.pxd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd index cd83089f9e5..6df33ef79da 100644 --- a/src/sage/arith/long.pxd +++ b/src/sage/arith/long.pxd @@ -81,7 +81,7 @@ cdef enum: cdef inline bint integer_check_long(x, long* value, int* err) except -1: """ Return whether ``x`` is some integer type. This is true for the - Python type ``long``, for Sage Integers and for types + Python type ``int``, for Sage Integers and for types implementing ``__index__``. If possible, compute the value of this integer as C long and store From 7b665f30fd0f8bc5df98f97f545458f03cf5c9b7 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 10:57:18 -0700 Subject: [PATCH 057/423] sage -fixdoctests --long --fixed-point --only-tags --overwrite src/sage/{schemes,modular/{abvar,modform}} --- src/sage/modular/abvar/homspace.py | 9 +++++---- src/sage/modular/modform/element.py | 11 ++++++----- src/sage/schemes/elliptic_curves/ell_field.py | 10 +++++----- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/sage/modular/abvar/homspace.py b/src/sage/modular/abvar/homspace.py index 6d96cc0fabe..8e89399d611 100644 --- a/src/sage/modular/abvar/homspace.py +++ b/src/sage/modular/abvar/homspace.py @@ -148,14 +148,15 @@ :: - sage: T = E.image_of_hecke_algebra() # long time - sage: T.gens() # long time + sage: # long time + sage: T = E.image_of_hecke_algebra() + sage: T.gens() (Abelian variety endomorphism of Abelian variety J0(33) of dimension 3, Abelian variety endomorphism of Abelian variety J0(33) of dimension 3, Abelian variety endomorphism of Abelian variety J0(33) of dimension 3) - sage: T.index_in(E) # long time + sage: T.index_in(E) +Infinity - sage: T.index_in_saturation() # long time + sage: T.index_in_saturation() 1 AUTHORS: diff --git a/src/sage/modular/modform/element.py b/src/sage/modular/modform/element.py index fba61a0fdd8..6d10fdf47c3 100644 --- a/src/sage/modular/modform/element.py +++ b/src/sage/modular/modform/element.py @@ -2315,13 +2315,14 @@ def minimal_twist(self, p=None): sage: f.twist(chi, level=11) == g True - sage: f = Newforms(575, 2, names='a')[4] # long time - sage: g, chi = f.minimal_twist(5) # long time - sage: g # long time + sage: # long time + sage: f = Newforms(575, 2, names='a')[4] + sage: g, chi = f.minimal_twist(5) + sage: g q + a*q^2 - a*q^3 - 2*q^4 + (1/2*a + 2)*q^5 + O(q^6) - sage: chi # long time + sage: chi Dirichlet character modulo 5 of conductor 5 mapping 2 |--> 1/2*a - sage: f.twist(chi, level=g.level()) == g # long time + sage: f.twist(chi, level=g.level()) == g True """ if p is None: diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index 58a6760cdb9..e793237b8bc 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -1897,10 +1897,10 @@ class of curves. If the j-invariant is not unique in the isogeny Curve over a quadratic number field:: - sage: # needs sage.graphs sage.rings.number_field - sage: K. = NumberField(x^2 - 2) # needs sage.rings.finite_rings - sage: E = EllipticCurve(K, [1, 0, 1, 4, -6]) # needs sage.rings.finite_rings - sage: G2 = E.isogeny_ell_graph(2, directed=False) # needs sage.rings.finite_rings + sage: # needs sage.graphs sage.rings.finite_rings sage.rings.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) ['y^2 + x*y + y = x^3 + (-130*e-356)*x + (-2000*e-2038)', 'y^2 + x*y + y = x^3 + (-36)*x + (-70)', @@ -1913,7 +1913,7 @@ class of curves. If the j-invariant is not unique in the isogeny '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) # needs sage.rings.finite_rings + sage: G3 = E.isogeny_ell_graph(3, directed=False) sage: G3.vertices(sort=True) ['y^2 + x*y + y = x^3 + (-1)*x', 'y^2 + x*y + y = x^3 + (-171)*x + (-874)', From c518b471e1845f90d33b0e3baa0a5f2db49d3cbf Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Wed, 19 Oct 2022 12:49:27 +0800 Subject: [PATCH 058/423] use semi-primitive root as suggested by comment in code --- .../elliptic_curves/isogeny_small_degree.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py index ceda9840aa2..1f34bc4f69d 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py @@ -2397,14 +2397,18 @@ def is_kernel_polynomial(E, m, f): if m == 2 or m == 3: return True - # For each a in a set of generators of (Z/mZ)^* we check that the - # multiplication-by-a map permutes the roots of f. It would be - # enough to take a generating (Z/mZ)^*/{1,-1} but that is not - # implemented. If m is prime (or more generally, has a primitive - # root) then only one a will be needed. + # For each a in a set of generators of (Z/mZ)^*/{1,-1} we check + # that the multiplication-by-a map permutes the roots of f. + # If m is prime (or more generally, has a primitive root) then + # only one a will be needed. - from sage.rings.finite_rings.integer_mod_ring import Integers - for a in Integers(m).unit_gens(): + if m & 1 and m.is_prime_power(): + gens = _least_semi_primitive(m), + else: + from sage.rings.finite_rings.integer_mod_ring import Integers + gens = Integers(m).unit_gens() + + for a in gens: mu = E.multiplication_by_m(a, x_only=True) if f( S(mu.numerator()) / S(mu.denominator()) ) != 0: return False From 12ee3a4f0182aa5160800d754b534ca9ce04a791 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 17:55:29 -0700 Subject: [PATCH 059/423] src/sage/schemes/berkovich/berkovich_cp_element.py: Remove empty 'sage:' lines --- .../schemes/berkovich/berkovich_cp_element.py | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/src/sage/schemes/berkovich/berkovich_cp_element.py b/src/sage/schemes/berkovich/berkovich_cp_element.py index 65ae0aae6ce..bc8307f29e5 100644 --- a/src/sage/schemes/berkovich/berkovich_cp_element.py +++ b/src/sage/schemes/berkovich/berkovich_cp_element.py @@ -427,7 +427,6 @@ def _custom_abs(self, x): :: - sage: sage: B = Berkovich_Cp_Affine(Qp(3)) sage: Q1 = B(9) sage: Q1._custom_abs(Q1.center()) @@ -452,7 +451,6 @@ def center_function(self): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Projective(5) sage: L. = PolynomialRing(Qp(5)) sage: T = FractionField(L) @@ -481,7 +479,6 @@ def radius_function(self): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Projective(5) sage: L. = PolynomialRing(Qp(5)) sage: T = FractionField(L) @@ -635,7 +632,6 @@ def diameter(self, basepoint=Infinity): The diameter of a type IV point is the limit of the radii:: - sage: sage: R. = PolynomialRing(Qp(3)) sage: f = R(2) sage: S. = PolynomialRing(RR) @@ -646,7 +642,6 @@ def diameter(self, basepoint=Infinity): :: - sage: sage: B = Berkovich_Cp_Affine(3) sage: Q1 = B(1/81, 1) sage: Q2 = B(1/3) @@ -699,7 +694,6 @@ def path_distance_metric(self, other): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Affine(3) sage: Q1 = B(1/4, 4) sage: Q2 = B(1/4, 6) @@ -751,7 +745,6 @@ def Hsia_kernel(self, other, basepoint): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(2, 9) sage: Q2 = B(1/27, 1/27) @@ -761,7 +754,6 @@ def Hsia_kernel(self, other, basepoint): :: - sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(2, 9) sage: Q2 = B(1/2) @@ -799,7 +791,6 @@ def small_metric(self, other): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Affine(3) sage: Q1 = B(1/4, 4) sage: Q2 = B(1/4, 6) @@ -863,7 +854,6 @@ def potential_kernel(self, other, basepoint): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(27, 1) sage: Q2 = B(1/3, 2) @@ -873,7 +863,6 @@ def potential_kernel(self, other, basepoint): :: - sage: sage: B = Berkovich_Cp_Affine(3) sage: Q1 = B(27, 1) sage: Q2 = B(1/3, 2) @@ -907,7 +896,6 @@ def spherical_kernel(self, other): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(2, 2) sage: Q2 = B(1/9, 1) @@ -946,7 +934,6 @@ def Hsia_kernel_infinity(self, other): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Affine(Qp(3)) sage: Q1 = B(1/4, 4) sage: Q2 = B(1/4, 6) @@ -1188,7 +1175,6 @@ class Berkovich_Element_Cp_Affine(Berkovich_Element_Cp): Type IV points can be constructed from univariate functions, with arbitrary precision:: - sage: sage: A. = Qq(27) sage: R. = PolynomialRing(A) sage: f = (1 + t)^2*x @@ -1223,7 +1209,6 @@ class Berkovich_Element_Cp_Affine(Berkovich_Element_Cp): TESTS:: - sage: sage: A = Berkovich_Cp_Affine(3) sage: Q1 = A(3, 1); Q1 Type II point centered at 3 + O(3^21) of radius 3^0 @@ -1250,7 +1235,6 @@ class Berkovich_Element_Cp_Affine(Berkovich_Element_Cp): sage: Q5 == Q6 # needs sage.symbolic True - sage: sage: k = Qp(5) sage: R. = k[] sage: l. = k.extension(x^2 - 5) @@ -1305,7 +1289,6 @@ def as_projective_point(self): :: - sage: sage: L. = PolynomialRing(Qp(5)) sage: T = FractionField(L) sage: f = T(1/t) @@ -1341,7 +1324,6 @@ def __eq__(self, other): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(1, RR(3**(1/2))) # needs sage.symbolic sage: Q2 = B(1, 3**(1/2)) # needs sage.symbolic @@ -1392,7 +1374,6 @@ def __hash__(self): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Affine(3) sage: Q1 = B(1, RR(3**(1/2))) # needs sage.symbolic sage: Q2 = B(1, 3**(1/2)) # needs sage.symbolic @@ -1440,7 +1421,6 @@ def lt(self, other): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(5, 0.5) sage: Q2 = B(5, 1) @@ -1585,7 +1565,6 @@ def join(self, other, basepoint=Infinity): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Affine(3) sage: Q1 = B(2, 1) sage: Q2 = B(2, 2) @@ -1758,7 +1737,6 @@ def contained_in_interval(self, start, end): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Projective((3)) sage: Q1 = B(2, 1) sage: Q2 = B(2, 4) @@ -1866,7 +1844,6 @@ class Berkovich_Element_Cp_Projective(Berkovich_Element_Cp): Type IV points can be created from lists of centers and radii:: - sage: sage: b = S((3,2)) # create centers sage: c = S((4,3)) sage: d = S((2,3)) @@ -1884,7 +1861,6 @@ 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: sage: L. = PolynomialRing(Qp(5)) sage: T = FractionField(L) sage: f = T(1/t) @@ -1954,7 +1930,6 @@ def as_affine_point(self): :: - sage: sage: L. = PolynomialRing(Qp(5)) sage: T = FractionField(L) sage: f = T(1/t) @@ -1994,7 +1969,6 @@ def __eq__(self, other): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B([2, 2], RR(3**(1/2))) # needs sage.symbolic sage: Q2 = B([1, 1], 3**(1/2)) # needs sage.symbolic @@ -2047,7 +2021,6 @@ def __hash__(self): EXAMPLES:: - sage: 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))) # needs sage.symbolic @@ -2096,7 +2069,6 @@ def lt(self, other): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(5, 0.5) sage: Q2 = B(5, 1) @@ -2276,7 +2248,6 @@ def join(self, other, basepoint=Infinity): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(2, 1) sage: Q2 = B(2, 2) @@ -2296,7 +2267,6 @@ def join(self, other, basepoint=Infinity): TESTS:: - sage: sage: Q4 = B(1/3**8 + 2, 1) sage: Q2.join(Q4, basepoint=Q1) Type III point centered at (2 + O(3^20) : 1 + O(3^20)) of radius 2.00000000000000 @@ -2537,7 +2507,6 @@ def contained_in_interval(self, start, end): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Projective(3) sage: Q1 = B(2, 1) sage: Q2 = B(2, 4) @@ -2553,7 +2522,6 @@ def contained_in_interval(self, start, end): TESTS:: - sage: sage: B = Berkovich_Cp_Projective(3) sage: infty = B((1, 0)) sage: zero = B(0) From 8151bb32773c303e0a422e09f63cc9b2e45b601b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 18:01:23 -0700 Subject: [PATCH 060/423] src/sage/schemes/berkovich/berkovich_space.py: Remove empty 'sage:' lines --- src/sage/schemes/berkovich/berkovich_space.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/sage/schemes/berkovich/berkovich_space.py b/src/sage/schemes/berkovich/berkovich_space.py index d10639e9e7e..3ffdfa97a4f 100644 --- a/src/sage/schemes/berkovich/berkovich_space.py +++ b/src/sage/schemes/berkovich/berkovich_space.py @@ -211,7 +211,6 @@ def __eq__(self, right): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Affine(3) sage: A. = Qq(27) sage: C = Berkovich_Cp_Affine(A) @@ -260,7 +259,6 @@ def __ne__(self, right): EXAMPLES:: - sage: sage: B = Berkovich_Cp_Affine(5) sage: A. = Qq(25) sage: C = Berkovich_Cp_Affine(A) From 23f123e03084157ca427338d138d49bd3243f7c9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 18:06:26 -0700 Subject: [PATCH 061/423] src/sage/schemes/berkovich/berkovich_space.py: Doctest formatting fixups --- src/sage/schemes/berkovich/berkovich_space.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/sage/schemes/berkovich/berkovich_space.py b/src/sage/schemes/berkovich/berkovich_space.py index 3ffdfa97a4f..100c2807b9d 100644 --- a/src/sage/schemes/berkovich/berkovich_space.py +++ b/src/sage/schemes/berkovich/berkovich_space.py @@ -391,7 +391,7 @@ class Berkovich_Cp_Affine(Berkovich_Cp): field, any point of a Berkovich space backed by a number field must be centered at a point of that number field:: - sage: # needs sage.rings.number_field + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: A. = NumberField(x^3 + 20) sage: ideal = A.prime_above(3) @@ -469,8 +469,7 @@ def _repr_(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) - sage: B + sage: B = Berkovich_Cp_Affine(3); B Affine Berkovich line over Cp(3) of precision 20 :: @@ -704,8 +703,7 @@ def _repr_(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) - sage: B + sage: B = Berkovich_Cp_Projective(3); B Projective Berkovich line over Cp(3) of precision 20 :: From e6f9b08598571b9b66f626492311e073f2a1112d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 18:37:18 -0700 Subject: [PATCH 062/423] src/sage/schemes/curves/affine_curve.py: Remove wrong tag --- src/sage/schemes/curves/affine_curve.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/schemes/curves/affine_curve.py b/src/sage/schemes/curves/affine_curve.py index cd0f6e6b9a6..37a3784e9c3 100644 --- a/src/sage/schemes/curves/affine_curve.py +++ b/src/sage/schemes/curves/affine_curve.py @@ -846,7 +846,7 @@ def __init__(self, A, X): :: sage: A. = AffineSpace(GF(7), 3) - sage: C = Curve([x^2 - z, z - 8*x], A); C # needs sage.rings.number_field + sage: C = Curve([x^2 - z, z - 8*x], A); C Affine Curve over Finite Field of size 7 defined by x^2 - z, -x + z """ super().__init__(A, X) From 9d5dfa70bc84f37b0e1191d81af348e9740edd72 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 18:43:25 -0700 Subject: [PATCH 063/423] src/sage/schemes/plane_conics/con_field.py: Restore lost issue reference in doctest; doctest cosmetics --- src/sage/schemes/plane_conics/con_field.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sage/schemes/plane_conics/con_field.py b/src/sage/schemes/plane_conics/con_field.py index 269170c563c..8bc3d660ab9 100644 --- a/src/sage/schemes/plane_conics/con_field.py +++ b/src/sage/schemes/plane_conics/con_field.py @@ -877,7 +877,7 @@ def parametrization(self, point=None, morphism=True): Defn: Defined on coordinates by sending (x : y) to ... sage: h[0]/h[1] x/y - sage: h.is_one() # known bug + sage: h.is_one() # known bug (see :trac:`31892`) True sage: (x,y,z) = c.gens() sage: x.parent() @@ -1119,12 +1119,12 @@ def rational_point(self, algorithm='default', read_cache=True): sage: # needs sage.rings.number_field sage: F = Conic([L.gen(), 30, -20]) sage: q = F.rational_point(algorithm='magma') # optional - magma - sage: q # random # optional - magma + sage: q # random # optional - magma (-10/7*s + 40/7 : 5/7*s - 6/7 : 1) sage: p = F.rational_point(read_cache=False) sage: p # random (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 True sage: # needs sage.rings.number_field @@ -1135,14 +1135,14 @@ def rational_point(self, algorithm='default', read_cache=True): False sage: G.has_rational_point(algorithm='local', read_cache=False) False - sage: G.rational_point(algorithm='magma') # optional - magma + sage: G.rational_point(algorithm='magma') # optional - magma 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', # optional - magma + sage: G.rational_point(algorithm='magma', # optional - magma ....: read_cache=False) Traceback (most recent call last): ... From 278e3bea772991dbfba2e23fe175ab5b6ca83503 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 18:53:37 -0700 Subject: [PATCH 064/423] src/sage/schemes/plane_conics/con_field.py: Restore lost '# random' --- src/sage/schemes/plane_conics/con_field.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/sage/schemes/plane_conics/con_field.py b/src/sage/schemes/plane_conics/con_field.py index 8bc3d660ab9..3b4158f8d67 100644 --- a/src/sage/schemes/plane_conics/con_field.py +++ b/src/sage/schemes/plane_conics/con_field.py @@ -1087,7 +1087,7 @@ def rational_point(self, algorithm='default', read_cache=True): sage: K. = QuadraticField(-1) # needs sage.rings.number_field sage: D = Conic(K, [3, 2, 5]) # needs sage.rings.number_field - sage: D.rational_point(algorithm='rnfisnorm') # output is random # needs sage.rings.number_field + sage: D.rational_point(algorithm='rnfisnorm') # output is random # needs sage.rings.number_field (-3 : 4*i : 1) sage: # needs sage.rings.number_field @@ -1104,15 +1104,16 @@ def rational_point(self, algorithm='default', read_cache=True): sage: # optional - magma, needs sage.rings.number_field sage: q = C.rational_point(algorithm='magma', ....: read_cache=False) - sage: q # output is random + sage: q # output is random (1/5*b^2 : 1/5*b^2 : 1) sage: C.defining_polynomial()(list(q)) 0 sage: len(str(p)) > 1.5*len(str(q)) True - sage: D.rational_point(algorithm='magma', + sage: D.rational_point(algorithm='magma', # random + ....: read_cache=False) (1 : 2*i : 1) - sage: E.rational_point(algorithm='magma', + sage: E.rational_point(algorithm='magma', # random ....: read_cache=False) (-s : 1 : 1) @@ -1133,7 +1134,8 @@ def rational_point(self, algorithm='default', read_cache=True): False sage: G.has_rational_point(read_cache=False) False - sage: G.has_rational_point(algorithm='local', read_cache=False) + sage: G.has_rational_point(algorithm='local', + ....: read_cache=False) False sage: G.rational_point(algorithm='magma') # optional - magma Traceback (most recent call last): @@ -1157,7 +1159,7 @@ def rational_point(self, algorithm='default', read_cache=True): sage: C = Conic([1, a, -5]); C # needs 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 # needs sage.rings.finite_rings + sage: C.rational_point() # output is random # needs 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 From 4eaca5d72e59564870e17750c6f61f091c532b70 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 19:01:20 -0700 Subject: [PATCH 065/423] src/sage/schemes/projective/projective_morphism.py: Use more block tags --- .../schemes/projective/projective_morphism.py | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 2e14c997dc7..5ba47f00afa 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -613,12 +613,13 @@ def _matrix_times_polymap_(self, mat, h): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + 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 # needs sage.modules sage.rings.number_field + sage: matrix([[i,0], [0,i]]) * f # needs sage.modules 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 @@ -657,12 +658,13 @@ def _polymap_times_matrix_(self, mat, h): :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + 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]]) # needs sage.modules sage.rings.number_field + sage: f * matrix([[i,0], [0,i]]) # needs sage.modules 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 @@ -710,7 +712,7 @@ 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()) # needs sage.rings.finite_rings sage.schemes + sage: type(f.as_dynamical_system()) # needs sage.schemes :: @@ -926,10 +928,11 @@ def normalize_coordinates(self, **kwds): Check that #35797 is fixed:: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(3*x^2 + 1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([a*(z^2 + w^2), z*w]) # needs sage.rings.number_field + sage: K. = NumberField(3*x^2 + 1) + sage: P. = ProjectiveSpace(K, 1) + sage: f = DynamicalSystem_projective([a*(z^2 + w^2), z*w]) sage: f.normalize_coordinates(); f Dynamical System of Projective Space of dimension 1 over Number Field in a with defining polynomial 3*x^2 + 1 @@ -2000,6 +2003,7 @@ def indeterminacy_points(self, F=None, base=False): sage: f = H([x^2 + y^2, x*z, x^2 + y^2]) sage: f.indeterminacy_points() # needs sage.libs.singular [(0 : 0 : 1)] + sage: R. = QQ[] sage: K. = NumberField(t^2 + 1) # needs sage.rings.number_field sage: f.indeterminacy_points(F=K) # needs sage.libs.singular sage.rings.number_field From 79e2478883229b237e0a3d75e4beef0489c7fb82 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 19:15:12 -0700 Subject: [PATCH 066/423] src/sage/schemes/projective/projective_point.py: Use more block tags --- .../schemes/projective/projective_point.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/sage/schemes/projective/projective_point.py b/src/sage/schemes/projective/projective_point.py index 0a040fb9903..a8a24adb27a 100644 --- a/src/sage/schemes/projective/projective_point.py +++ b/src/sage/schemes/projective/projective_point.py @@ -236,7 +236,8 @@ def _richcmp_(self, right, op): :: - sage: PS = ProjectiveSpace(Zp(5), 1, 'x') # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: PS = ProjectiveSpace(Zp(5), 1, 'x') sage: P = PS([0, 1]) sage: P == PS(0) True @@ -327,7 +328,8 @@ def _richcmp_(self, right, op): :: - sage: PS = ProjectiveSpace(Zp(5), 1, 'x') # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: PS = ProjectiveSpace(Zp(5), 1, 'x') sage: P = PS([0, 1]) sage: P != PS(0) False @@ -509,11 +511,12 @@ def scale_by(self,t): :: + sage: # needs sage.libs.pari sage: R. = PolynomialRing(QQ) - sage: S = R.quo(R.ideal(t^3)) # needs sage.libs.pari - sage: P. = ProjectiveSpace(S, 2) # needs sage.libs.pari + sage: S = R.quo(R.ideal(t^3)) + sage: P. = ProjectiveSpace(S, 2) sage: Q = P(t, 1, 1) - sage: Q.scale_by(t);Q # needs sage.libs.pari + sage: Q.scale_by(t);Q (tbar^2 : tbar : tbar) :: @@ -551,9 +554,10 @@ def normalize_coordinates(self): :: - sage: P = ProjectiveSpace(Zp(7), 2, 'x') # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: P = ProjectiveSpace(Zp(7), 2, 'x') sage: p = P([-5, -15, -2]) - sage: p.normalize_coordinates(); p # needs sage.rings.padics + sage: p.normalize_coordinates(); p (5 + O(7^20) : 1 + 2*7 + O(7^20) : 2 + O(7^20)) :: From c6d652131472b0fcb25fb31bf254f7eca7125ca2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 20:09:02 -0700 Subject: [PATCH 067/423] build/pkgs/scipy: Update to 1.11.2 --- build/pkgs/scipy/checksums.ini | 6 +++--- build/pkgs/scipy/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/scipy/checksums.ini b/build/pkgs/scipy/checksums.ini index e56c56745e3..7015206d1e7 100644 --- a/build/pkgs/scipy/checksums.ini +++ b/build/pkgs/scipy/checksums.ini @@ -1,5 +1,5 @@ tarball=scipy-VERSION.tar.gz -sha1=ff83163396a70276c0441b541befc485b471b27b -md5=de3db61d840456634ba37f2b5816e049 -cksum=3826133895 +sha1=856f8ac8498751b72d678ef64b88e436d04a957d +md5=27baf613b6cf3f9600a05161f132151c +cksum=1656738318 upstream_url=https://pypi.io/packages/source/s/scipy/scipy-VERSION.tar.gz diff --git a/build/pkgs/scipy/package-version.txt b/build/pkgs/scipy/package-version.txt index 4dae2985b58..ca7176690dd 100644 --- a/build/pkgs/scipy/package-version.txt +++ b/build/pkgs/scipy/package-version.txt @@ -1 +1 @@ -1.10.1 +1.11.2 From 9c9de7bc869759fb885236a79257e96d96ab3538 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 20:10:26 -0700 Subject: [PATCH 068/423] build/pkgs/pythran: Update to 0.13.1 --- build/pkgs/pythran/checksums.ini | 6 +++--- build/pkgs/pythran/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/pythran/checksums.ini b/build/pkgs/pythran/checksums.ini index cb4704c4bc4..dc9beccf6b6 100644 --- a/build/pkgs/pythran/checksums.ini +++ b/build/pkgs/pythran/checksums.ini @@ -1,5 +1,5 @@ tarball=pythran-VERSION.tar.gz -sha1=71bc7c868cf011d184a013211f4195d8f9c606a2 -md5=168c31e8d108f26440b663b44cd99379 -cksum=2086161839 +sha1=dd675e9ccc93379b529687328ca558d5617eb1c6 +md5=3090288af50566af75cb058d1878aaad +cksum=3968085663 upstream_url=https://pypi.io/packages/source/p/pythran/pythran-VERSION.tar.gz diff --git a/build/pkgs/pythran/package-version.txt b/build/pkgs/pythran/package-version.txt index 34a83616bb5..c317a91891f 100644 --- a/build/pkgs/pythran/package-version.txt +++ b/build/pkgs/pythran/package-version.txt @@ -1 +1 @@ -0.12.1 +0.13.1 From e70ddfcc13716e8c57df910cf87faac95e20efcb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 20:10:34 -0700 Subject: [PATCH 069/423] build/pkgs/meson_python: Update to 0.13.2 --- build/pkgs/meson_python/checksums.ini | 6 +++--- build/pkgs/meson_python/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/meson_python/checksums.ini b/build/pkgs/meson_python/checksums.ini index 0e1c77874b7..da59c9577aa 100644 --- a/build/pkgs/meson_python/checksums.ini +++ b/build/pkgs/meson_python/checksums.ini @@ -1,5 +1,5 @@ tarball=meson_python-VERSION.tar.gz -sha1=bdaf002dc1ef314c32e2be76f3b2872f1282c4cc -md5=39be4f0b7f036e1d5db4a76fdb031355 -cksum=2636510839 +sha1=e52e84fcd84ea7dd8c11f464390786686a1be8e6 +md5=0db4483e30df43dbd465254be9c7db8a +cksum=1452585711 upstream_url=https://pypi.io/packages/source/m/meson_python/meson_python-VERSION.tar.gz diff --git a/build/pkgs/meson_python/package-version.txt b/build/pkgs/meson_python/package-version.txt index 34a83616bb5..9beb74d490b 100644 --- a/build/pkgs/meson_python/package-version.txt +++ b/build/pkgs/meson_python/package-version.txt @@ -1 +1 @@ -0.12.1 +0.13.2 From 20c90ca0dfbbb6ab878112ffe31dec25f9f5f202 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 20:10:42 -0700 Subject: [PATCH 070/423] build/pkgs/pybind11: Update to 2.11.1 --- build/pkgs/pybind11/checksums.ini | 6 +++--- build/pkgs/pybind11/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/pybind11/checksums.ini b/build/pkgs/pybind11/checksums.ini index 1cc6d36c174..c8b9c661568 100644 --- a/build/pkgs/pybind11/checksums.ini +++ b/build/pkgs/pybind11/checksums.ini @@ -1,5 +1,5 @@ tarball=pybind11-VERSION.tar.gz -sha1=d0e6e22c2ce36fad4bb60dbac4d6d498ceb464df -md5=0b181dbb44c3cc632e724cef5081cae1 -cksum=4287838207 +sha1=3c75333a9056f0be18eb612803cd46a2bb0c87fc +md5=67c58224e41c442e47fa84e7789c2c39 +cksum=419587142 upstream_url=https://pypi.io/packages/source/p/pybind11/pybind11-VERSION.tar.gz diff --git a/build/pkgs/pybind11/package-version.txt b/build/pkgs/pybind11/package-version.txt index 8bbb6e406a7..6ceb272eecd 100644 --- a/build/pkgs/pybind11/package-version.txt +++ b/build/pkgs/pybind11/package-version.txt @@ -1 +1 @@ -2.10.1 +2.11.1 From b7227e3fed558523099073122e9e42b64bb64775 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 20:11:30 -0700 Subject: [PATCH 071/423] build/pkgs/pyproject_metadata: Update to 0.7.1 --- build/pkgs/pyproject_metadata/checksums.ini | 6 +++--- build/pkgs/pyproject_metadata/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/pyproject_metadata/checksums.ini b/build/pkgs/pyproject_metadata/checksums.ini index 4fcc0ec49c2..6fb14a63679 100644 --- a/build/pkgs/pyproject_metadata/checksums.ini +++ b/build/pkgs/pyproject_metadata/checksums.ini @@ -1,5 +1,5 @@ tarball=pyproject-metadata-VERSION.tar.gz -sha1=c2b7679b1e56a341aa00c186c0d1a6bbd7bd5c2c -md5=e13b11cb723da96f8397addddca963cc -cksum=2246727402 +sha1=41fba5c33917d77b9364fadb76e590e86789634d +md5=ca5e9527cff96153a976e14530b53746 +cksum=2053869519 upstream_url=https://pypi.io/packages/source/p/pyproject_metadata/pyproject-metadata-VERSION.tar.gz diff --git a/build/pkgs/pyproject_metadata/package-version.txt b/build/pkgs/pyproject_metadata/package-version.txt index ee6cdce3c29..39e898a4f95 100644 --- a/build/pkgs/pyproject_metadata/package-version.txt +++ b/build/pkgs/pyproject_metadata/package-version.txt @@ -1 +1 @@ -0.6.1 +0.7.1 From ddf8efe277d933ba4ee287de1ab7bd4f621a8c8e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 20:17:42 -0700 Subject: [PATCH 072/423] build/pkgs/gast: Update to 0.5.4 --- build/pkgs/gast/checksums.ini | 6 +++--- build/pkgs/gast/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/gast/checksums.ini b/build/pkgs/gast/checksums.ini index 1aa653229f2..57bc0736a13 100644 --- a/build/pkgs/gast/checksums.ini +++ b/build/pkgs/gast/checksums.ini @@ -1,5 +1,5 @@ tarball=gast-VERSION.tar.gz -sha1=a84811eedebc5bca94b4eae978aab5f2c805b106 -md5=fdff900805e03e9dd76d377eb4cbaed7 -cksum=387443419 +sha1=6c113cf8d33cc654d33210335103485ab41d3dbb +md5=907c689e3fdbc7a48cc010e665195baa +cksum=218846575 upstream_url=https://pypi.io/packages/source/g/gast/gast-VERSION.tar.gz diff --git a/build/pkgs/gast/package-version.txt b/build/pkgs/gast/package-version.txt index be14282b7ff..7d8568351b4 100644 --- a/build/pkgs/gast/package-version.txt +++ b/build/pkgs/gast/package-version.txt @@ -1 +1 @@ -0.5.3 +0.5.4 From a291fee2015437d07d815963076c93384e226ab2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 20:18:50 -0700 Subject: [PATCH 073/423] build/pkgs/meson_python/patches: Remove --- .../patches/ARCHFLAGS_empty.patch | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 build/pkgs/meson_python/patches/ARCHFLAGS_empty.patch diff --git a/build/pkgs/meson_python/patches/ARCHFLAGS_empty.patch b/build/pkgs/meson_python/patches/ARCHFLAGS_empty.patch deleted file mode 100644 index 8857629f080..00000000000 --- a/build/pkgs/meson_python/patches/ARCHFLAGS_empty.patch +++ /dev/null @@ -1,21 +0,0 @@ -commit caa435144b1b4fa40c51558f15fd8dae2c0b5868 -Author: Matthias Koeppe -Date: Sat Mar 11 10:16:56 2023 -0800 - - BUG: handle ARCHFLAGS set to the empty string - -diff --git a/mesonpy/__init__.py b/mesonpy/__init__.py -index e312059..d798f4c 100644 ---- a/mesonpy/__init__.py -+++ b/mesonpy/__init__.py -@@ -686,8 +686,8 @@ class Project(): - - # setuptools-like ARCHFLAGS environment variable support - if sysconfig.get_platform().startswith('macosx-'): -- archflags = self._env.get('ARCHFLAGS') -- if archflags is not None: -+ archflags = self._env.get('ARCHFLAGS', '').strip() -+ if archflags: - arch, *other = filter(None, (x.strip() for x in archflags.split('-arch'))) - if other: - raise ConfigError(f'Multi-architecture builds are not supported but $ARCHFLAGS={archflags!r}') From cb21d9f28755ff504dca4f7fb0809212f0d6b8de Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 21:30:20 -0700 Subject: [PATCH 074/423] build/pkgs/meson: Update to 1.2.1 --- build/pkgs/meson/checksums.ini | 6 +++--- build/pkgs/meson/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/meson/checksums.ini b/build/pkgs/meson/checksums.ini index d3dbb277dba..ef8b1ec0b21 100644 --- a/build/pkgs/meson/checksums.ini +++ b/build/pkgs/meson/checksums.ini @@ -1,5 +1,5 @@ tarball=meson-VERSION.tar.gz -sha1=a2d102eb6a37307c9b67283e9764ed57cf286223 -md5=843ba549bb2a199d9e04092116a7e749 -cksum=2108460988 +sha1=087da0ecbc065bb40361ba683b55c20cb42a948a +md5=e3cc846536189aacd7d01858a45ca9af +cksum=4011973902 upstream_url=https://pypi.io/packages/source/m/meson/meson-VERSION.tar.gz diff --git a/build/pkgs/meson/package-version.txt b/build/pkgs/meson/package-version.txt index 7dea76edb3d..6085e946503 100644 --- a/build/pkgs/meson/package-version.txt +++ b/build/pkgs/meson/package-version.txt @@ -1 +1 @@ -1.0.1 +1.2.1 From d0be1a41e23ed16171ab07c51f42305fef9b3c50 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 21:30:46 -0700 Subject: [PATCH 075/423] build/pkgs/ninja_build: Update to 1.11.1 --- build/pkgs/ninja_build/checksums.ini | 6 +++--- build/pkgs/ninja_build/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/ninja_build/checksums.ini b/build/pkgs/ninja_build/checksums.ini index d3914da794a..43ddbfd6334 100644 --- a/build/pkgs/ninja_build/checksums.ini +++ b/build/pkgs/ninja_build/checksums.ini @@ -1,5 +1,5 @@ tarball=ninja_build-VERSION.tar.gz -sha1=f8c9279bdd4efc63b1a6be3b8c5a5031699af9ac -md5=7d1a1a2f5cdc06795b3054df5c17d5ef -cksum=3142198237 +sha1=938723cdfc7a6f7c8f84c83b9a2cecdf1e5e1ad3 +md5=32151c08211d7ca3c1d832064f6939b0 +cksum=4040304461 upstream_url=https://github.com/ninja-build/ninja/archive/refs/tags/vVERSION.tar.gz diff --git a/build/pkgs/ninja_build/package-version.txt b/build/pkgs/ninja_build/package-version.txt index 1cac385c6cb..720c7384c61 100644 --- a/build/pkgs/ninja_build/package-version.txt +++ b/build/pkgs/ninja_build/package-version.txt @@ -1 +1 @@ -1.11.0 +1.11.1 From 2461b37a4c505a8f7eac61f4c6f71ddfe2d12eaf Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 21:55:41 -0700 Subject: [PATCH 076/423] build/pkgs/cmake: Update to 3.27.3 --- build/pkgs/cmake/checksums.ini | 6 +++--- build/pkgs/cmake/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/cmake/checksums.ini b/build/pkgs/cmake/checksums.ini index c89abdf4277..a145b30dfb4 100644 --- a/build/pkgs/cmake/checksums.ini +++ b/build/pkgs/cmake/checksums.ini @@ -1,5 +1,5 @@ tarball=cmake-VERSION.tar.gz -sha1=256d6a57a57fa6ceaacd6a2daf708baefd33850c -md5=226dd564164372f9f7d1e21e38e6e8c5 -cksum=2080281918 +sha1=3e9b980bfb16974f57ca02b5e2b403a2ef2d4eca +md5=7228f5fcc8a858fdeac27e29bda0c144 +cksum=2027526722 upstream_url=https://github.com/Kitware/CMake/releases/download/vVERSION/cmake-VERSION.tar.gz diff --git a/build/pkgs/cmake/package-version.txt b/build/pkgs/cmake/package-version.txt index 693bd59e3e6..a155471fc06 100644 --- a/build/pkgs/cmake/package-version.txt +++ b/build/pkgs/cmake/package-version.txt @@ -1 +1 @@ -3.24.3 +3.27.3 From 548160af88a3cc39eb291508a1342749173108f7 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 21 Aug 2023 22:00:08 -0700 Subject: [PATCH 077/423] build/pkgs/scipy/install-requires.txt: Allow 1.11.x --- build/pkgs/scipy/install-requires.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/scipy/install-requires.txt b/build/pkgs/scipy/install-requires.txt index 16d57fdb9b0..dd975a870e3 100644 --- a/build/pkgs/scipy/install-requires.txt +++ b/build/pkgs/scipy/install-requires.txt @@ -4,4 +4,4 @@ # deprecations cannot be introduced in micro releases. # SciPy devs wait "at least 6 months", "in practice two (minor) releases" # from deprecation to removal of a feature. -scipy >=1.5, <1.11 +scipy >=1.5, <1.12 From 3d17e4a417ebe230fc87bc202b1860e2384ef2bd Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 22 Aug 2023 09:25:04 -0700 Subject: [PATCH 078/423] build/pkgs/meson/spkg-configure.m4: Require meson >= 1.1.0 --- build/pkgs/meson/spkg-configure.m4 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build/pkgs/meson/spkg-configure.m4 b/build/pkgs/meson/spkg-configure.m4 index efe863664f7..dbc575650fc 100644 --- a/build/pkgs/meson/spkg-configure.m4 +++ b/build/pkgs/meson/spkg-configure.m4 @@ -1,10 +1,11 @@ SAGE_SPKG_CONFIGURE( [meson], [ - AC_CACHE_CHECK([for meson >= 0.64], [ac_cv_path_MESON], [ + dnl scipy 1.11.2 needs meson >= 1.1.0 + AC_CACHE_CHECK([for meson >= 1.1.0], [ac_cv_path_MESON], [ AC_PATH_PROGS_FEATURE_CHECK([MESON], [meson], [ meson_version=`$ac_path_MESON --version 2>&1` AS_IF([test -n "$meson_version"], [ - AX_COMPARE_VERSION([$meson_version], [ge], [0.64], [ + AX_COMPARE_VERSION([$meson_version], [ge], [1.1.0], [ ac_cv_path_MESON="$ac_path_MESON" ac_path_MESON_found=: ]) From 8d3457200d025206fa19c7396ba8aa8427b46b64 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 28 Mar 2023 19:25:26 -0700 Subject: [PATCH 079/423] .github/workflows/ci-linux-incremental.yml: New --- .github/workflows/ci-linux-incremental.yml | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/ci-linux-incremental.yml diff --git a/.github/workflows/ci-linux-incremental.yml b/.github/workflows/ci-linux-incremental.yml new file mode 100644 index 00000000000..a365348ed1e --- /dev/null +++ b/.github/workflows/ci-linux-incremental.yml @@ -0,0 +1,63 @@ +name: CI Linux incremental + +## This GitHub Actions workflow runs SAGE_ROOT/tox.ini with select environments, +## whenever a GitHub pull request is opened or synchronized in a repository +## where GitHub Actions are enabled. +## +## It builds and checks some sage spkgs as defined in TARGETS. +## +## A job succeeds if there is no error. +## +## The build is run with "make V=0", so the build logs of individual packages are suppressed. +## +## At the end, all package build logs that contain an error are printed out. +## +## After all jobs have finished (or are canceled) and a short delay, +## tar files of all logs are made available as "build artifacts". + +on: + pull_request: + types: + # Defaults + - opened + - synchronize + - reopened + # When a CI label is added + - labeled + +concurrency: + # Cancel previous runs of this workflow for the same branch + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + minimal: + if: | + (github.event.action != 'labeled' && + (contains(github.event.pull_request.labels.*.name, 'c: packages: standard') || + contains(github.event.pull_request.labels.*.name, 'c: packages: optional'))) || + (github.event.action == 'labeled' && + (github.event.label.name == 'c: packages: optional' || + github.event.label.name == 'c: packages: standard')) + uses: ./.github/workflows/docker.yml + with: + # Build incrementally from published Docker image + incremental: true + free_disk_space: true + from_docker_repository: ghcr.io/sagemath/sage/ + from_docker_target: "with-targets" + from_docker_tag: "dev" + docker_targets: "with-targets" + targets: build doc-html ptest + tox_system_factors: >- + ["ubuntu-bionic-gcc_8-python3.8", + "debian-bookworm", + "ubuntu-lunar", + "fedora-31", + "fedora-37", + "gentoo-python3.9", + "debian-buster-i386"] + tox_packages_factors: >- + ["minimal"] + docker_push_repository: ghcr.io/${{ github.repository }}/ From e58476c959524c8b199a65acbc8a18813acd28a1 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 8 May 2023 22:30:21 -0700 Subject: [PATCH 080/423] .github/workflows/ci-linux-incremental.yml: Also run on: workflow_dispatch --- .github/workflows/ci-linux-incremental.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-linux-incremental.yml b/.github/workflows/ci-linux-incremental.yml index a365348ed1e..0189bfab571 100644 --- a/.github/workflows/ci-linux-incremental.yml +++ b/.github/workflows/ci-linux-incremental.yml @@ -24,6 +24,7 @@ on: - reopened # When a CI label is added - labeled + workflow_dispatch: concurrency: # Cancel previous runs of this workflow for the same branch @@ -34,12 +35,13 @@ jobs: minimal: if: | - (github.event.action != 'labeled' && - (contains(github.event.pull_request.labels.*.name, 'c: packages: standard') || - contains(github.event.pull_request.labels.*.name, 'c: packages: optional'))) || - (github.event.action == 'labeled' && - (github.event.label.name == 'c: packages: optional' || - github.event.label.name == 'c: packages: standard')) + github.event_name != 'pull_request' || + ((github.event.action != 'labeled' && + (contains(github.event.pull_request.labels.*.name, 'c: packages: standard') || + contains(github.event.pull_request.labels.*.name, 'c: packages: optional'))) || + (github.event.action == 'labeled' && + (github.event.label.name == 'c: packages: optional' || + github.event.label.name == 'c: packages: standard'))) uses: ./.github/workflows/docker.yml with: # Build incrementally from published Docker image From 37abb2ca8c7e038150458ef54df914b9e3cbc79c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 8 May 2023 22:30:52 -0700 Subject: [PATCH 081/423] .github/workflows/ci-linux-incremental.yml: Add permissions for packages --- .github/workflows/ci-linux-incremental.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci-linux-incremental.yml b/.github/workflows/ci-linux-incremental.yml index 0189bfab571..ade8158f733 100644 --- a/.github/workflows/ci-linux-incremental.yml +++ b/.github/workflows/ci-linux-incremental.yml @@ -31,6 +31,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: + packages: write + jobs: minimal: From 5cf019cc6d05cef20727be53912f3ba62d8cf3d0 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 9 May 2023 00:00:49 -0700 Subject: [PATCH 082/423] .github/workflows/ci-conda.yml: Also run on PR syncs etc when one of the trigger labels is present --- .github/workflows/ci-conda.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-conda.yml b/.github/workflows/ci-conda.yml index 2048d9c43ae..49236dd7270 100644 --- a/.github/workflows/ci-conda.yml +++ b/.github/workflows/ci-conda.yml @@ -8,6 +8,11 @@ on: - 'public/build/**-runci' pull_request: types: + # Defaults + - opened + - synchronize + - reopened + # When a CI label is added - labeled workflow_dispatch: # Allow to run manually @@ -21,13 +26,18 @@ jobs: test: name: Conda runs-on: ${{ matrix.os }} - - # Run on push, workflow dispatch and when certain labels are added + + # Run on push, workflow dispatch and when certain labels are added or are present 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_name != 'pull_request' || + ((github.event.action != 'labeled' && + (contains(github.event.pull_request.labels.*.name, 'c: packages: standard') || + contains(github.event.pull_request.labels.*.name, 'c: packages: optional') || + contains(github.event.pull_request.labels.*.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'))) strategy: fail-fast: false From 830f94f4f5c4cf12446be086ede5d5feba4886bb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 9 May 2023 12:22:38 -0700 Subject: [PATCH 083/423] ci-linux-incremental: Use gentoo-python3.11 --- .github/workflows/ci-linux-incremental.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-linux-incremental.yml b/.github/workflows/ci-linux-incremental.yml index ade8158f733..798cef6255d 100644 --- a/.github/workflows/ci-linux-incremental.yml +++ b/.github/workflows/ci-linux-incremental.yml @@ -61,7 +61,7 @@ jobs: "ubuntu-lunar", "fedora-31", "fedora-37", - "gentoo-python3.9", + "gentoo-python3.11", "debian-buster-i386"] tox_packages_factors: >- ["minimal"] From cb7a2334b5237c94cc7bdca1e00f6c86f8571740 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 23 Aug 2023 11:49:49 -0700 Subject: [PATCH 084/423] .github/workflows/docker.yml: Restore ubuntu-bionic --- .github/workflows/docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3dc4b8a4627..403093635ce 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -18,6 +18,7 @@ on: default: >- ["ubuntu-trusty-toolchain-gcc_9", "ubuntu-xenial-toolchain-gcc_9", + "ubuntu-bionic-gcc_8", "ubuntu-focal", "ubuntu-jammy", "ubuntu-kinetic", From 1bd5052b9b4988f4288e3c9d06a032e3ce303c80 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 23 Aug 2023 12:02:20 -0700 Subject: [PATCH 085/423] .github/workflows/ci-linux-incremental.yml: WIP: just test one platform --- .github/workflows/ci-linux-incremental.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-linux-incremental.yml b/.github/workflows/ci-linux-incremental.yml index 798cef6255d..dbefd520abf 100644 --- a/.github/workflows/ci-linux-incremental.yml +++ b/.github/workflows/ci-linux-incremental.yml @@ -54,15 +54,19 @@ jobs: from_docker_target: "with-targets" from_docker_tag: "dev" docker_targets: "with-targets" - targets: build doc-html ptest + targets: "build doc-html ptest" tox_system_factors: >- - ["ubuntu-bionic-gcc_8-python3.8", - "debian-bookworm", - "ubuntu-lunar", - "fedora-31", - "fedora-37", - "gentoo-python3.11", - "debian-buster-i386"] + ["ubuntu-focal"] + ## , + ## "ubuntu-jammy", + ## "ubuntu-mantic, + ## "debian-bullseye", + ## "debian-bookworm", + ## "ubuntu-mantic, + ## "fedora-30", + ## "fedora-38", + ## "gentoo-python3.11", + ## "debian-bullseye-i386"] tox_packages_factors: >- ["minimal"] docker_push_repository: ghcr.io/${{ github.repository }}/ From 94976ebe0fcd87dcc03026f212a4566cc4342742 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 23 Aug 2023 16:17:34 -0700 Subject: [PATCH 086/423] build/pkgs/libbraiding: Update to 1.2 --- build/pkgs/libbraiding/package-version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/libbraiding/package-version.txt b/build/pkgs/libbraiding/package-version.txt index 9459d4ba2a0..5625e59da88 100644 --- a/build/pkgs/libbraiding/package-version.txt +++ b/build/pkgs/libbraiding/package-version.txt @@ -1 +1 @@ -1.1 +1.2 From 848ea50232b8a245b50c61e60ab49a92b624c50b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 23 Aug 2023 16:18:34 -0700 Subject: [PATCH 087/423] build/pkgs/kissat: Update to 3.1.0 --- build/pkgs/kissat/checksums.ini | 6 +++--- build/pkgs/kissat/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/kissat/checksums.ini b/build/pkgs/kissat/checksums.ini index 66b187bb599..85929110253 100644 --- a/build/pkgs/kissat/checksums.ini +++ b/build/pkgs/kissat/checksums.ini @@ -1,5 +1,5 @@ tarball=kissat-rel-VERSION.tar.gz -sha1=abfd971d5f560ed76281ed3ed7b75e20cb445618 -md5=6ef4b2efcc60c95a32581bfe59720154 -cksum=1532123399 +sha1=49972324939761306ee50cfa3df93cd3cd530256 +md5=1d0fa246c5451e3592910f2c9a5f3476 +cksum=2570717921 upstream_url=https://github.com/arminbiere/kissat/archive/refs/tags/rel-VERSION.tar.gz diff --git a/build/pkgs/kissat/package-version.txt b/build/pkgs/kissat/package-version.txt index 4a36342fcab..fd2a01863fd 100644 --- a/build/pkgs/kissat/package-version.txt +++ b/build/pkgs/kissat/package-version.txt @@ -1 +1 @@ -3.0.0 +3.1.0 From 518322739c7535573b7816e369340bfa27d4f54e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 23 Aug 2023 16:19:29 -0700 Subject: [PATCH 088/423] .github/workflows/ci-linux-incremental.yml: Check changed packages --- .github/workflows/ci-linux-incremental.yml | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-linux-incremental.yml b/.github/workflows/ci-linux-incremental.yml index dbefd520abf..3a2ed298ac0 100644 --- a/.github/workflows/ci-linux-incremental.yml +++ b/.github/workflows/ci-linux-incremental.yml @@ -36,7 +36,32 @@ permissions: jobs: + changed_files: + runs-on: ubuntu-latest + name: List changed packages + outputs: + uninstall_targets: ${{ steps.build-targets.outputs.uninstall_targets }} + build_targets: ${{ steps.build-targets.outputs.build_targets }} + steps: + - uses: actions/checkout@v3 + - name: Get all packages that have changed + id: changed-packages + uses: tj-actions/changed-files@v38 + with: + files_yaml: | + configures: + - 'build/pkgs/*/spkg-configure.m4' + pkgs: + - 'build/pkgs/**' + - 'pkgs/**' + - name: Determine targets to build + id: build-targets + run: | + echo "uninstall_targets=$(echo $(for a in '' ${{ steps.changed-packages.outputs.configures_all_changed_files }}; do echo $a | sed -E 's,build/pkgs/([_.a-z0-9]*)/spkg-configure[.]m4 *,\1-uninstall,'; done | sort -u))" >> $GITHUB_OUTPUT + echo "build_targets=$(echo $(for a in '' ${{ steps.changed-packages.outputs.pkgs_all_changed_files }}; do echo $a | sed -E 's,(build/)?pkgs/([-_.a-z0-9]*)/[^ ]* *,\2,;s,-,_,g;'; done | sort -u))" >> $GITHUB_OUTPUT + cat $GITHUB_OUTPUT minimal: + needs: [changed_files] if: | github.event_name != 'pull_request' || ((github.event.action != 'labeled' && @@ -54,7 +79,7 @@ jobs: from_docker_target: "with-targets" from_docker_tag: "dev" docker_targets: "with-targets" - targets: "build doc-html ptest" + targets: "${{needs.changed_files.outputs.uninstall_targets}} ${{needs.changed_files.outputs.build_targets}} build doc-html ptest" tox_system_factors: >- ["ubuntu-focal"] ## , From 2c0cf43bcfabe63df3f5932fc8f3607685124e0f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 23 Aug 2023 20:30:22 -0700 Subject: [PATCH 089/423] build/make/Makefile.in: Add targets SPKG-ensure --- build/make/Makefile.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/make/Makefile.in b/build/make/Makefile.in index b6858173362..2d1a7e6c7b7 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -591,6 +591,8 @@ $$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2): $(3) $(1): $$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2) +$(1)-ensure: $(inst_$(1)) + $(1)-$(4)-no-deps: +@if [ -z '$$($(4))' ]; then \ echo "Error: The installation tree $(4) has been disabled" 2>&1; \ @@ -649,6 +651,8 @@ $(1)-build-deps: $(2) $(1): $(2) +$(MAKE_REC) $(1)-no-deps +$(1)-ensure: $(inst_$(1)) + $(1)-no-deps: $(AM_V_at)sage-logger -p 'sage --pip install -r "$$(SAGE_ROOT)/build/pkgs/$(1)/requirements.txt"' '$$(SAGE_LOGS)/$(1).log' @@ -705,6 +709,8 @@ $$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2): $(3) $(1): $$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2) +$(1)-ensure: $(inst_$(1)) + $(1)-$(4)-no-deps: $(PLUS)@if [ -z '$$($(4))' ]; then \ echo "Error: The installation tree $(4) has been disabled" 2>&1; \ From 06add6dd503769f132aa07c4544efddeb1e02b57 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 23 Aug 2023 20:31:47 -0700 Subject: [PATCH 090/423] .github/workflows/ci-linux-incremental.yml: Use targets SPKG-ensure --- .github/workflows/ci-linux-incremental.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-linux-incremental.yml b/.github/workflows/ci-linux-incremental.yml index 3a2ed298ac0..b8138c4cdf4 100644 --- a/.github/workflows/ci-linux-incremental.yml +++ b/.github/workflows/ci-linux-incremental.yml @@ -58,7 +58,7 @@ jobs: id: build-targets run: | echo "uninstall_targets=$(echo $(for a in '' ${{ steps.changed-packages.outputs.configures_all_changed_files }}; do echo $a | sed -E 's,build/pkgs/([_.a-z0-9]*)/spkg-configure[.]m4 *,\1-uninstall,'; done | sort -u))" >> $GITHUB_OUTPUT - echo "build_targets=$(echo $(for a in '' ${{ steps.changed-packages.outputs.pkgs_all_changed_files }}; do echo $a | sed -E 's,(build/)?pkgs/([-_.a-z0-9]*)/[^ ]* *,\2,;s,-,_,g;'; done | sort -u))" >> $GITHUB_OUTPUT + echo "build_targets=$(echo $(for a in '' ${{ steps.changed-packages.outputs.pkgs_all_changed_files }}; do echo $a | sed -E 's,-,_,g;s,(build/)?pkgs/([-_.a-z0-9]*)/[^ ]* *,\2-ensure,;'; done | sort -u))" >> $GITHUB_OUTPUT cat $GITHUB_OUTPUT minimal: needs: [changed_files] From 922385b115af2b113f1ae050b744d800a45096e6 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 23 Aug 2023 21:52:25 -0700 Subject: [PATCH 091/423] .github/workflows/ci-linux-incremental.yml: Add back platforms --- .github/workflows/ci-linux-incremental.yml | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci-linux-incremental.yml b/.github/workflows/ci-linux-incremental.yml index b8138c4cdf4..d0a802d3b5c 100644 --- a/.github/workflows/ci-linux-incremental.yml +++ b/.github/workflows/ci-linux-incremental.yml @@ -81,17 +81,17 @@ jobs: docker_targets: "with-targets" targets: "${{needs.changed_files.outputs.uninstall_targets}} ${{needs.changed_files.outputs.build_targets}} build doc-html ptest" tox_system_factors: >- - ["ubuntu-focal"] - ## , - ## "ubuntu-jammy", - ## "ubuntu-mantic, - ## "debian-bullseye", - ## "debian-bookworm", - ## "ubuntu-mantic, - ## "fedora-30", - ## "fedora-38", - ## "gentoo-python3.11", - ## "debian-bullseye-i386"] + ["ubuntu-focal", + "ubuntu-jammy", + "ubuntu-mantic, + "debian-bullseye", + "debian-bookworm", + "ubuntu-mantic, + "fedora-30", + "fedora-38", + "gentoo-python3.11", + "debian-bullseye-i386"] tox_packages_factors: >- - ["minimal"] + ["standard", + "minimal"] docker_push_repository: ghcr.io/${{ github.repository }}/ From 5239b7029a0e9092fceb83273809e7f80dc8a87b Mon Sep 17 00:00:00 2001 From: Gerald Teschl Date: Thu, 24 Aug 2023 09:12:50 +0200 Subject: [PATCH 092/423] Update probability_distribution.pyx --- src/sage/probability/probability_distribution.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/probability/probability_distribution.pyx b/src/sage/probability/probability_distribution.pyx index f0792385e12..005f50b992f 100644 --- a/src/sage/probability/probability_distribution.pyx +++ b/src/sage/probability/probability_distribution.pyx @@ -507,7 +507,7 @@ cdef class RealDistribution(ProbabilityDistribution): Real Double Field sage: T.distribution_function(0) 0.0 - + The gamma distribution has two parameters ``a`` and ``b``:: sage: a = 2 From 3be7da857f5032d7ce3c451748530a72e594f25d Mon Sep 17 00:00:00 2001 From: Gerald Teschl Date: Thu, 24 Aug 2023 12:45:29 +0200 Subject: [PATCH 093/423] Update probability_distribution.pyx --- src/sage/probability/probability_distribution.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/probability/probability_distribution.pyx b/src/sage/probability/probability_distribution.pyx index 005f50b992f..bfc91d94ec0 100644 --- a/src/sage/probability/probability_distribution.pyx +++ b/src/sage/probability/probability_distribution.pyx @@ -506,7 +506,7 @@ cdef class RealDistribution(ProbabilityDistribution): sage: s.parent() Real Double Field sage: T.distribution_function(0) - 0.0 + 0.5 The gamma distribution has two parameters ``a`` and ``b``:: From e955f3e6f7be7bdbbc2c77d3fb21983855872f11 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 9 Oct 2021 19:30:58 -0400 Subject: [PATCH 094/423] Trac #29665: add --enable-system-site-packages option to ./configure. This new option is experimental and disabled by default. When it is enabled, the string "--system-site-packages" is appended to a new environment variable SAGE_VENV_FLAGS that is then passed to the sage-venv command during the build using autoconf substitution. Thusly the correct setting finds its way into local/pyvenv.cfg. --- build/make/Makefile.in | 2 +- configure.ac | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/build/make/Makefile.in b/build/make/Makefile.in index b6858173362..7622c5f0f13 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -242,7 +242,7 @@ endif inst_python3_venv = $(SAGE_VENV)/pyvenv.cfg $(inst_python3_venv): - $(PYTHON_FOR_VENV) $(SAGE_ROOT)/build/bin/sage-venv "$(SAGE_VENV)" + $(PYTHON_FOR_VENV) $(SAGE_ROOT)/build/bin/sage-venv @SAGE_VENV_FLAGS@ "$(SAGE_VENV)" endif # Build everything and start Sage. diff --git a/configure.ac b/configure.ac index 4a255967fc6..a21ff354ace 100644 --- a/configure.ac +++ b/configure.ac @@ -445,6 +445,17 @@ AC_ARG_ENABLE([download-from-upstream-url], [disallow downloading packages from their upstream URL if they cannot be found on the Sage mirrors])], [], [AS_VAR_SET([enable_download_from_upstream_url], [yes])]) +AC_ARG_ENABLE( + [system-site-packages], [AS_HELP_STRING( + [--enable-system-site-packages], + [allow sage to use python packages from the system (experimental; default: no)] + )], [ + AS_IF([test "x$enable_system_site_packages" = "xyes"], [ + SAGE_VENV_FLAGS="${SAGE_VENV_FLAGS} --system-site-packages" + ]) +]) +AC_SUBST([SAGE_VENV_FLAGS]) + SAGE_SPKG_OPTIONS="" AS_IF([test "x$enable_experimental_packages" = "xyes"], [ AS_VAR_APPEND([SAGE_SPKG_OPTIONS], [" -y"]) From f80ce35bfbad7b247ac77a69c3431d4127efc872 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Oct 2021 19:41:14 -0400 Subject: [PATCH 095/423] Trac #29665: new SAGE_PYTHON_PACKAGE_CHECK() autoconf macro. This new macro encapsulates the check for system installations of python packages. It uses setuptools.version's pkg_resources to check if the contents of install-requires.txt are satisfied for the given package; and if not, tells the build system to install the SPKG instead. --- m4/sage_python_package_check.m4 | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 m4/sage_python_package_check.m4 diff --git a/m4/sage_python_package_check.m4 b/m4/sage_python_package_check.m4 new file mode 100644 index 00000000000..77b0a0cb2f6 --- /dev/null +++ b/m4/sage_python_package_check.m4 @@ -0,0 +1,49 @@ +# +# SYNOPSIS +# +# SAGE_PYTHON_PACKAGE_CHECK(package) +# +# DESCRIPTION +# +# Determine if the system copy of a python package can be used by sage. +# +# This macro uses setuptools.version's pkg_resources to check that the +# "install-requires.txt" file for the named package is satisfied, and +# it can typically fail in four ways: +# +# 1. If --enable-system-site-packages was not passed to ./configure, +# +# 2. If we are not using the system python (no $PYTHON_FOR_VENV), +# +# 3. If setuptools is not available to the system python, +# +# 4. If the contents of install-requires.txt are not met (wrong +# version, no version, etc.) by the system python. +# +# In any of those cases, we set sage_spkg_install_$package to "yes" +# so that the corresponding SPKG is installed. Otherwise, we do +# nothing, since the default value of sage_spkg_install_$package +# is "no" (to use the system copy). +# +# The SAGE_SPKG_CONFIGURE_PYTHON3() macro is AC_REQUIRE'd to ensure +# that $PYTHON_FOR_VENV is available, if it is going to be available. +# + +AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [ + AS_IF([test "${enable_system_site_packages}" = "yes"], [ + AC_REQUIRE([SAGE_SPKG_CONFIGURE_PYTHON3]) + + dnl strip all comments from install-requires.txt; this should leave + dnl only a single line containing the version specification for this + dnl package. + SAGE_PKG_VERSPEC=$(sed '/^#/d' "./build/pkgs/$1/install-requires.txt") + AC_MSG_CHECKING([for python package $1 ("${SAGE_PKG_VERSPEC}")]) + AS_IF( + ["${PYTHON_FOR_VENV}" -c "from setuptools.version import pkg_resources; pkg_resources.require('${SAGE_PKG_VERSPEC}'.splitlines())"], + [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no); sage_spkg_install_$1=yes] + ) + ], [ + sage_spkg_install_$1=yes + ]) +]) From 19fa7c8bb4d8ebae9e57f42038d198314ec4fbcc Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 9 Oct 2021 20:21:29 -0400 Subject: [PATCH 096/423] Trac #29665: standard python spkg-configure.m4 for py. --- build/pkgs/py/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/py/spkg-configure.m4 diff --git a/build/pkgs/py/spkg-configure.m4 b/build/pkgs/py/spkg-configure.m4 new file mode 100644 index 00000000000..ded70343090 --- /dev/null +++ b/build/pkgs/py/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([py], [SAGE_PYTHON_PACKAGE_CHECK([py])]) From dc39acce58ece96ed3354ad8a0a27a7a7ec66ccd Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 9 Oct 2021 20:24:15 -0400 Subject: [PATCH 097/423] Trac #29665: standard python spkg-configure.m4 for wheel. --- build/pkgs/wheel/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/wheel/spkg-configure.m4 diff --git a/build/pkgs/wheel/spkg-configure.m4 b/build/pkgs/wheel/spkg-configure.m4 new file mode 100644 index 00000000000..7897ea96cc6 --- /dev/null +++ b/build/pkgs/wheel/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([wheel], [SAGE_PYTHON_PACKAGE_CHECK([wheel])]) From 3ede90459dc9b1c106b10b2817c6318e554f6ce5 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 9 Oct 2021 20:25:15 -0400 Subject: [PATCH 098/423] Trac #29665: new spkg-configure.m4 for cvxopt. This includes a SAGE_SPKG_DEPCHECK([gsl glpk suitesparse],... because those C dependencies wind up linked into shared libraries like, /usr/.../cvxopt/glpk.cpython-39-x86_64-linux-gnu.so that could potentially conflict with (for example) the glpk SPKG. --- build/pkgs/cvxopt/spkg-configure.m4 | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 build/pkgs/cvxopt/spkg-configure.m4 diff --git a/build/pkgs/cvxopt/spkg-configure.m4 b/build/pkgs/cvxopt/spkg-configure.m4 new file mode 100644 index 00000000000..c4aa6198edb --- /dev/null +++ b/build/pkgs/cvxopt/spkg-configure.m4 @@ -0,0 +1,5 @@ +SAGE_SPKG_CONFIGURE([cvxopt], [ + SAGE_SPKG_DEPCHECK([gsl glpk suitesparse], [ + SAGE_PYTHON_PACKAGE_CHECK([cvxopt]) + ]) +]) From a172e1be7bf3dd30de818123c5fd061a8704df48 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 9 Oct 2021 20:28:10 -0400 Subject: [PATCH 099/423] Trac #29665: new spkg-configure.m4 for pyzmq. This includes a SAGE_SPKG_DEPCHECK([zeromq],... because libzmq winds up linked into shared libraries like, /usr/.../zmq/backend/cython/message.cpython-39-x86_64-linux-gnu.so that potentially conflict with the zeromq SPKG. --- build/pkgs/pyzmq/spkg-configure.m4 | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 build/pkgs/pyzmq/spkg-configure.m4 diff --git a/build/pkgs/pyzmq/spkg-configure.m4 b/build/pkgs/pyzmq/spkg-configure.m4 new file mode 100644 index 00000000000..ae2b126efb1 --- /dev/null +++ b/build/pkgs/pyzmq/spkg-configure.m4 @@ -0,0 +1,5 @@ +SAGE_SPKG_CONFIGURE([pyzmq], [ + SAGE_SPKG_DEPCHECK([zeromq], [ + SAGE_PYTHON_PACKAGE_CHECK([pyzmq]) + ]) +]) From a69bc99b29360261cea5ffd5d6a4d9de0c31b119 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 9 Oct 2021 20:31:24 -0400 Subject: [PATCH 100/423] Trac #29665: standard python spkg-configure.m4 for requests. --- build/pkgs/requests/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/requests/spkg-configure.m4 diff --git a/build/pkgs/requests/spkg-configure.m4 b/build/pkgs/requests/spkg-configure.m4 new file mode 100644 index 00000000000..f50a66cdee3 --- /dev/null +++ b/build/pkgs/requests/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([requests], [SAGE_PYTHON_PACKAGE_CHECK([requests])]) From 9a81424b6b0c05654ea20c3f895f92f78eb77172 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 10 Oct 2021 18:13:34 -0400 Subject: [PATCH 101/423] Trac #29665: standard python spkg-configure.m4 for six. --- build/pkgs/six/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/six/spkg-configure.m4 diff --git a/build/pkgs/six/spkg-configure.m4 b/build/pkgs/six/spkg-configure.m4 new file mode 100644 index 00000000000..a382b81a3dd --- /dev/null +++ b/build/pkgs/six/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([six], [SAGE_PYTHON_PACKAGE_CHECK([six])]) From 40a17dd18aef041ea8681b750e0b840315b250ef Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 10 Oct 2021 18:14:29 -0400 Subject: [PATCH 102/423] Trac #29665: standard python spkg-configure.m4 for packaging. --- build/pkgs/packaging/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/packaging/spkg-configure.m4 diff --git a/build/pkgs/packaging/spkg-configure.m4 b/build/pkgs/packaging/spkg-configure.m4 new file mode 100644 index 00000000000..398f9e13cd3 --- /dev/null +++ b/build/pkgs/packaging/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([packaging], [SAGE_PYTHON_PACKAGE_CHECK([packaging])]) From 0820e25a6e423e312064cc487647b6960c66bd70 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 10 Oct 2021 18:18:53 -0400 Subject: [PATCH 103/423] Trac #29665: new spkg-configure.m4 for numpy. This includes a SAGE_SPKG_DEPCHECK([openblas],... because blas/lapack wind up linked into shared libraries like, /usr/.../numpy/linalg/lapack_lite.cpython-39-x86_64-linux-gnu.so that potentially conflict with the openblas SPKG. --- build/pkgs/numpy/spkg-configure.m4 | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 build/pkgs/numpy/spkg-configure.m4 diff --git a/build/pkgs/numpy/spkg-configure.m4 b/build/pkgs/numpy/spkg-configure.m4 new file mode 100644 index 00000000000..16f9a90fad2 --- /dev/null +++ b/build/pkgs/numpy/spkg-configure.m4 @@ -0,0 +1,5 @@ +SAGE_SPKG_CONFIGURE([numpy], [ + SAGE_SPKG_DEPCHECK([openblas], [ + SAGE_PYTHON_PACKAGE_CHECK([numpy]) + ]) +]) From b902f1b372029ca6c48c4ab11f82d63db80f989d Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 10 Oct 2021 18:58:48 -0400 Subject: [PATCH 104/423] Trac #29665: new spkg-configure.m4 for scipy. This includes a SAGE_SPKG_DEPCHECK([openblas],... because blas/lapack wind up linked into shared libraries like, /usr/.../scipy/linalg/_flinalg.cpython-39-x86_64-linux-gnu.so that potentially conflict with the openblas SPKG. --- build/pkgs/scipy/spkg-configure.m4 | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 build/pkgs/scipy/spkg-configure.m4 diff --git a/build/pkgs/scipy/spkg-configure.m4 b/build/pkgs/scipy/spkg-configure.m4 new file mode 100644 index 00000000000..0b7294a02e8 --- /dev/null +++ b/build/pkgs/scipy/spkg-configure.m4 @@ -0,0 +1,5 @@ +SAGE_SPKG_CONFIGURE([scipy], [ + SAGE_SPKG_DEPCHECK([openblas], [ + SAGE_PYTHON_PACKAGE_CHECK([scipy]) + ]) +]) From 04cd2851649aa261c1f383595bf0c10e1fb1dac3 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Oct 2021 07:19:24 -0400 Subject: [PATCH 105/423] Trac #29665: standard python spkg-configure.m4 for pluggy. --- build/pkgs/pluggy/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pluggy/spkg-configure.m4 diff --git a/build/pkgs/pluggy/spkg-configure.m4 b/build/pkgs/pluggy/spkg-configure.m4 new file mode 100644 index 00000000000..11b1fce4f94 --- /dev/null +++ b/build/pkgs/pluggy/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([pluggy], [SAGE_PYTHON_PACKAGE_CHECK([pluggy])]) From eec1c60f1cb1912295300b2e349d7f3aa531bf4a Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Oct 2021 07:24:12 -0400 Subject: [PATCH 106/423] Trac #29665: standard python spkg-configure.m4 for pickleshare. --- build/pkgs/pickleshare/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pickleshare/spkg-configure.m4 diff --git a/build/pkgs/pickleshare/spkg-configure.m4 b/build/pkgs/pickleshare/spkg-configure.m4 new file mode 100644 index 00000000000..80e9b7ccba9 --- /dev/null +++ b/build/pkgs/pickleshare/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([pickleshare], [SAGE_PYTHON_PACKAGE_CHECK([pickleshare])]) From 2bf735f22074d5e25d055b40fbb35092a7730bc3 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Oct 2021 08:53:29 -0400 Subject: [PATCH 107/423] Trac #29665: standard python spkg-configure.m4 for html5lib. --- build/pkgs/html5lib/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/html5lib/spkg-configure.m4 diff --git a/build/pkgs/html5lib/spkg-configure.m4 b/build/pkgs/html5lib/spkg-configure.m4 new file mode 100644 index 00000000000..f421b7e87db --- /dev/null +++ b/build/pkgs/html5lib/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([html5lib], [SAGE_PYTHON_PACKAGE_CHECK([html5lib])]) From 394e7e81aa3aac3a4072e50cf72fb18aa71af882 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Oct 2021 18:30:47 -0400 Subject: [PATCH 108/423] Trac #29665: standard python spkg-configure.m4 for networkx. --- build/pkgs/networkx/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/networkx/spkg-configure.m4 diff --git a/build/pkgs/networkx/spkg-configure.m4 b/build/pkgs/networkx/spkg-configure.m4 new file mode 100644 index 00000000000..926671e166e --- /dev/null +++ b/build/pkgs/networkx/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([networkx], [SAGE_PYTHON_PACKAGE_CHECK([networkx])]) From 0fecd7841c42ae090f9d2936bf874ce4cb13435d Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Oct 2021 20:33:24 -0400 Subject: [PATCH 109/423] Trac #29665: new spkg-configure.m4 for matplotlib. This includes a SAGE_SPKG_DEPCHECK([bzip2 freetype libpng qhull],... because those dependencies wind up linked into shared libraries like, /usr/lib/.../matplotlib/ft2font.cpython-39-x86_64-linux-gnu.so that potentially conflict with their SPKG counterparts. --- build/pkgs/matplotlib/spkg-configure.m4 | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 build/pkgs/matplotlib/spkg-configure.m4 diff --git a/build/pkgs/matplotlib/spkg-configure.m4 b/build/pkgs/matplotlib/spkg-configure.m4 new file mode 100644 index 00000000000..39c2d2901d0 --- /dev/null +++ b/build/pkgs/matplotlib/spkg-configure.m4 @@ -0,0 +1,5 @@ +SAGE_SPKG_CONFIGURE([matplotlib], [ + SAGE_SPKG_DEPCHECK([bzip2 freetype libpng qhull], [ + SAGE_PYTHON_PACKAGE_CHECK([matplotlib]) + ]) +]) From 6647de2013a682fdf3192a33aef34132c04624e7 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Oct 2021 20:35:00 -0400 Subject: [PATCH 110/423] Trac #29665: standard python spkg-configure.m4 for bleach. --- build/pkgs/bleach/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/bleach/spkg-configure.m4 diff --git a/build/pkgs/bleach/spkg-configure.m4 b/build/pkgs/bleach/spkg-configure.m4 new file mode 100644 index 00000000000..3c9bb26bb05 --- /dev/null +++ b/build/pkgs/bleach/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([bleach], [SAGE_PYTHON_PACKAGE_CHECK([bleach])]) From ebb763a34d86d7e0883081563ed929a4c00931d4 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Oct 2021 20:37:03 -0400 Subject: [PATCH 111/423] Trac #29665: standard python spkg-configure.m4 for decorator. --- build/pkgs/decorator/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/decorator/spkg-configure.m4 diff --git a/build/pkgs/decorator/spkg-configure.m4 b/build/pkgs/decorator/spkg-configure.m4 new file mode 100644 index 00000000000..e062778d6db --- /dev/null +++ b/build/pkgs/decorator/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([decorator], [SAGE_PYTHON_PACKAGE_CHECK([decorator])]) From ca057c0884661bd1f3f6b6b5d7d877ac6ce4ff01 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Oct 2021 20:38:03 -0400 Subject: [PATCH 112/423] Trac #29665: standard python spkg-configure.m4 for idna. --- build/pkgs/idna/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/idna/spkg-configure.m4 diff --git a/build/pkgs/idna/spkg-configure.m4 b/build/pkgs/idna/spkg-configure.m4 new file mode 100644 index 00000000000..9d363f212e6 --- /dev/null +++ b/build/pkgs/idna/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([idna], [SAGE_PYTHON_PACKAGE_CHECK([idna])]) From f5e0319fa69b62ac7f39f99d92df30fd094fcc54 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Oct 2021 20:39:23 -0400 Subject: [PATCH 113/423] Trac #29665: standard python spkg-configure.m4 for certifi. --- build/pkgs/certifi/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/certifi/spkg-configure.m4 diff --git a/build/pkgs/certifi/spkg-configure.m4 b/build/pkgs/certifi/spkg-configure.m4 new file mode 100644 index 00000000000..ddd40613514 --- /dev/null +++ b/build/pkgs/certifi/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([certifi], [SAGE_PYTHON_PACKAGE_CHECK([certifi])]) From 745b69a4a40713996ca487d39203ba197a869f2b Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Oct 2021 20:40:59 -0400 Subject: [PATCH 114/423] Trac #29665: new spkg-configure.m4 for pillow. This includes an SAGE_SPKG_DEPCHECK([bzip2 freetype libpng zlib],... because those dependencies wind up linked into shared libraries like, /usr/.../PIL/_imagingft.cpython-39-x86_64-linux-gnu.so and potentially conflict with their SPKG counterparts. --- build/pkgs/pillow/spkg-configure.m4 | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 build/pkgs/pillow/spkg-configure.m4 diff --git a/build/pkgs/pillow/spkg-configure.m4 b/build/pkgs/pillow/spkg-configure.m4 new file mode 100644 index 00000000000..f2e68e230ac --- /dev/null +++ b/build/pkgs/pillow/spkg-configure.m4 @@ -0,0 +1,5 @@ +SAGE_SPKG_CONFIGURE([pillow], [ + SAGE_SPKG_DEPCHECK([bzip2 freetype libpng zlib], [ + SAGE_PYTHON_PACKAGE_CHECK([pillow]) + ]) +]) From ca59e08617c9f9cbc1fdc371d3780a73f74000a8 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Oct 2021 20:44:13 -0400 Subject: [PATCH 115/423] Trac #29665: standard python spkg-configure.m4 for mpmath. --- build/pkgs/mpmath/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/mpmath/spkg-configure.m4 diff --git a/build/pkgs/mpmath/spkg-configure.m4 b/build/pkgs/mpmath/spkg-configure.m4 new file mode 100644 index 00000000000..f43c8388264 --- /dev/null +++ b/build/pkgs/mpmath/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([mpmath], [SAGE_PYTHON_PACKAGE_CHECK([mpmath])]) From 6340166825cabb1ad70f7e157a5284140f62befb Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Oct 2021 20:44:56 -0400 Subject: [PATCH 116/423] Trac #29665: standard python spkg-configure.m4 for sympy. --- build/pkgs/sympy/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/sympy/spkg-configure.m4 diff --git a/build/pkgs/sympy/spkg-configure.m4 b/build/pkgs/sympy/spkg-configure.m4 new file mode 100644 index 00000000000..fa0f1f54311 --- /dev/null +++ b/build/pkgs/sympy/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([sympy], [SAGE_PYTHON_PACKAGE_CHECK([sympy])]) From 3ad0ff08242a08e6c50de0b1686813dd6c20ad60 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Oct 2021 20:47:06 -0400 Subject: [PATCH 117/423] Trac #29665: standard python spkg-configure.m4 for pygments. --- build/pkgs/pygments/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pygments/spkg-configure.m4 diff --git a/build/pkgs/pygments/spkg-configure.m4 b/build/pkgs/pygments/spkg-configure.m4 new file mode 100644 index 00000000000..99f29e3c9b3 --- /dev/null +++ b/build/pkgs/pygments/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([pygments], [SAGE_PYTHON_PACKAGE_CHECK([pygments])]) From d278e15587ab17ad7a39707ac9c1f3b794b703cc Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Oct 2021 20:48:50 -0400 Subject: [PATCH 118/423] Trac #29665: standard python spkg-configure.m4 for jinja2. --- build/pkgs/jinja2/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/jinja2/spkg-configure.m4 diff --git a/build/pkgs/jinja2/spkg-configure.m4 b/build/pkgs/jinja2/spkg-configure.m4 new file mode 100644 index 00000000000..0970d1c8bea --- /dev/null +++ b/build/pkgs/jinja2/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([jinja2], [SAGE_PYTHON_PACKAGE_CHECK([jinja2])]) From c687b66da742bceed548f925ce23e16cf15105f5 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 12 Oct 2021 08:43:24 -0400 Subject: [PATCH 119/423] Trac #29665: standard python spkg-configure.m4 for pandocfilters. --- build/pkgs/pandocfilters/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/pandocfilters/spkg-configure.m4 diff --git a/build/pkgs/pandocfilters/spkg-configure.m4 b/build/pkgs/pandocfilters/spkg-configure.m4 new file mode 100644 index 00000000000..3e9537f818c --- /dev/null +++ b/build/pkgs/pandocfilters/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([pandocfilters], [ + SAGE_PYTHON_PACKAGE_CHECK([pandocfilters]) +]) From e1bc792305bb65a405beb5616f0cb1be325f264f Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 12 Oct 2021 08:44:46 -0400 Subject: [PATCH 120/423] Trac #29665: standard python spkg-configure.m4 for webencodings. --- build/pkgs/webencodings/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/webencodings/spkg-configure.m4 diff --git a/build/pkgs/webencodings/spkg-configure.m4 b/build/pkgs/webencodings/spkg-configure.m4 new file mode 100644 index 00000000000..1b9a5c431f3 --- /dev/null +++ b/build/pkgs/webencodings/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([webencodings], [ + SAGE_PYTHON_PACKAGE_CHECK([webencodings]) +]) From d18924ae37a69c9249f56f6dc21e45b1dd20770e Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 12 Oct 2021 08:48:26 -0400 Subject: [PATCH 121/423] Trac #29665: standard python spkg-configure.m4 for pytz. --- build/pkgs/pytz/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pytz/spkg-configure.m4 diff --git a/build/pkgs/pytz/spkg-configure.m4 b/build/pkgs/pytz/spkg-configure.m4 new file mode 100644 index 00000000000..366521be957 --- /dev/null +++ b/build/pkgs/pytz/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([pytz], [SAGE_PYTHON_PACKAGE_CHECK([pytz])]) From 43fe94271f6f3a4d0718b48a212d173c6c09bc97 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 12 Oct 2021 08:51:16 -0400 Subject: [PATCH 122/423] Trac #29665: standard python spkg-configure.m4 for texttable. --- build/pkgs/texttable/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/texttable/spkg-configure.m4 diff --git a/build/pkgs/texttable/spkg-configure.m4 b/build/pkgs/texttable/spkg-configure.m4 new file mode 100644 index 00000000000..42a3de105b5 --- /dev/null +++ b/build/pkgs/texttable/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([texttable], [SAGE_PYTHON_PACKAGE_CHECK([texttable])]) From 76e58c2f3e7bdd829e92d092685a03b75ac4d1b0 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 12 Oct 2021 08:53:41 -0400 Subject: [PATCH 123/423] Trac #29665: standard python spkg-configure.m4 for babel. --- build/pkgs/babel/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/babel/spkg-configure.m4 diff --git a/build/pkgs/babel/spkg-configure.m4 b/build/pkgs/babel/spkg-configure.m4 new file mode 100644 index 00000000000..d7b9a71c811 --- /dev/null +++ b/build/pkgs/babel/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([babel], [SAGE_PYTHON_PACKAGE_CHECK([babel])]) From efa5bc467b36969e32335f8107d9729879ccb139 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 14 Oct 2021 08:06:59 -0400 Subject: [PATCH 124/423] Trac #29665: force system python3 with --enable-system-site-packages. When the python SPKG is used, the --enable-system-site-packages flag will essentially do nothing, and that may confuse users who have wasted a few hours building sage. (Generally, they will want to fix detection of their system python3 first.) To forestall that, we now set "--with-system-python3=force" whenever the "--enable-system-site-packages" flag is passed. --- configure.ac | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index a21ff354ace..81e594b9561 100644 --- a/configure.ac +++ b/configure.ac @@ -448,10 +448,19 @@ AC_ARG_ENABLE([download-from-upstream-url], AC_ARG_ENABLE( [system-site-packages], [AS_HELP_STRING( [--enable-system-site-packages], - [allow sage to use python packages from the system (experimental; default: no)] + [allow the use of python packages from the system (experimental; default: no)] )], [ AS_IF([test "x$enable_system_site_packages" = "xyes"], [ SAGE_VENV_FLAGS="${SAGE_VENV_FLAGS} --system-site-packages" + + dnl We want to raise an error if the user asked for "system site + dnl packages" but the system python will not be used. Technically + dnl that causes no problems (SAGE_PYTHON_PACKAGE_CHECK always fails, + dnl so SPKGs are used for all python packages), but it may be confusing + dnl to end users who expect the flag to actually give them access to + dnl their system python packages and who may not be paying close + dnl attention to their ./configure output. + with_system_python3="force" ]) ]) AC_SUBST([SAGE_VENV_FLAGS]) From 870939f8f4c8bdacdab63d15842f92f08570bab5 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 15 Oct 2021 01:18:35 -0400 Subject: [PATCH 125/423] Trac #29665: standard python spkg-configure.m4 for setuptools. --- build/pkgs/setuptools/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/setuptools/spkg-configure.m4 diff --git a/build/pkgs/setuptools/spkg-configure.m4 b/build/pkgs/setuptools/spkg-configure.m4 new file mode 100644 index 00000000000..a2ad8119063 --- /dev/null +++ b/build/pkgs/setuptools/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([setuptools], [SAGE_PYTHON_PACKAGE_CHECK([setuptools])]) From 22e567e9d3c3c6f5099b0efb505646fca7aaf88b Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 15 Oct 2021 01:15:48 -0400 Subject: [PATCH 126/423] Trac #29665: poison PYTHONUSERBASE when testing for "system" packages. When we're detecting system installations of python packages, we want to hide anything that was installed with e.g. "pip install --user". To accomplish that, we mimic the PYTHONUSERBASE poisoning from sage-env within the SAGE_PYTHON_PACKAGE_CHECK() macro. --- m4/sage_python_package_check.m4 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/m4/sage_python_package_check.m4 b/m4/sage_python_package_check.m4 index 77b0a0cb2f6..b8cdba48784 100644 --- a/m4/sage_python_package_check.m4 +++ b/m4/sage_python_package_check.m4 @@ -38,11 +38,27 @@ AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [ dnl package. SAGE_PKG_VERSPEC=$(sed '/^#/d' "./build/pkgs/$1/install-requires.txt") AC_MSG_CHECKING([for python package $1 ("${SAGE_PKG_VERSPEC}")]) + + dnl To prevent user-site (pip install --user) packages from being + dnl detected as "system" packages, we poison PYTHONUSERBASE. The + dnl sage-env script also does this at runtime; we mimic that + dnl implementation to ensure that the behaviors at ./configure and + dnl runtime are identical. Beware that (as in sage-env) the poisoning + dnl is skipped if PYTHONUSERBASE is non-empty. In particular, if the + dnl user points PYTHONUSERBASE to any path (even the default), then + dnl his local pip packages will be detected. + PYTHONUSERBASE_SAVED="${PYTHONUSERBASE}" + AS_IF([test -z "${PYTHONUSERBASE}"], [ + PYTHONUSERBASE="${HOME}/.sage/local" + ]) + AS_IF( - ["${PYTHON_FOR_VENV}" -c "from setuptools.version import pkg_resources; pkg_resources.require('${SAGE_PKG_VERSPEC}'.splitlines())"], + [PYTHONUSERBASE="${PYTHONUSERBASE}" "${PYTHON_FOR_VENV}" -c "from setuptools.version import pkg_resources; pkg_resources.require('${SAGE_PKG_VERSPEC}'.splitlines())" 2>/dev/null], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); sage_spkg_install_$1=yes] ) + + PYTHONUSERBASE="${PYTHONUSERBASE_SAVED}" ], [ sage_spkg_install_$1=yes ]) From fa8bef3bad67ef29ad4c5993c08e96b528c7aea4 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 15 Oct 2021 11:20:04 -0400 Subject: [PATCH 127/423] Trac #29665: run SAGE_PYTHON_PACKAGE_CHECK() inside a venv. To recreate the runtime environment as closely as possible, we now use a venv (with system site packages enabled) when checking for system copies of python packages. --- m4/sage_python_package_check.m4 | 76 ++++++++++++++++++++++----------- 1 file changed, 51 insertions(+), 25 deletions(-) diff --git a/m4/sage_python_package_check.m4 b/m4/sage_python_package_check.m4 index b8cdba48784..7cbd6c0a8f5 100644 --- a/m4/sage_python_package_check.m4 +++ b/m4/sage_python_package_check.m4 @@ -15,9 +15,11 @@ # # 2. If we are not using the system python (no $PYTHON_FOR_VENV), # -# 3. If setuptools is not available to the system python, +# 3. If we are unable to create a venv with the system python, # -# 4. If the contents of install-requires.txt are not met (wrong +# 4. If setuptools is not available to the system python, +# +# 5. If the contents of install-requires.txt are not met (wrong # version, no version, etc.) by the system python. # # In any of those cases, we set sage_spkg_install_$package to "yes" @@ -27,38 +29,62 @@ # # The SAGE_SPKG_CONFIGURE_PYTHON3() macro is AC_REQUIRE'd to ensure # that $PYTHON_FOR_VENV is available, if it is going to be available. +# The check is run inside a new venv, and with the PYTHONUSERBASE +# variable poisoned in the same manner as sage-env poisons it, to +# ensure that the ./configure- and run-time views of the system +# are as similar as possible. # AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [ AS_IF([test "${enable_system_site_packages}" = "yes"], [ AC_REQUIRE([SAGE_SPKG_CONFIGURE_PYTHON3]) - dnl strip all comments from install-requires.txt; this should leave - dnl only a single line containing the version specification for this - dnl package. - SAGE_PKG_VERSPEC=$(sed '/^#/d' "./build/pkgs/$1/install-requires.txt") - AC_MSG_CHECKING([for python package $1 ("${SAGE_PKG_VERSPEC}")]) + dnl We run this check inside a python venv, because that's ultimately + dnl how the system $PYTHON_FOR_VENV will be used. + AC_MSG_CHECKING([if we can create a python venv in config.venv]) - dnl To prevent user-site (pip install --user) packages from being - dnl detected as "system" packages, we poison PYTHONUSERBASE. The - dnl sage-env script also does this at runtime; we mimic that - dnl implementation to ensure that the behaviors at ./configure and - dnl runtime are identical. Beware that (as in sage-env) the poisoning - dnl is skipped if PYTHONUSERBASE is non-empty. In particular, if the - dnl user points PYTHONUSERBASE to any path (even the default), then - dnl his local pip packages will be detected. - PYTHONUSERBASE_SAVED="${PYTHONUSERBASE}" - AS_IF([test -z "${PYTHONUSERBASE}"], [ - PYTHONUSERBASE="${HOME}/.sage/local" - ]) + dnl Use --clear because ./configure typically clobbers its output files. + AS_IF(["${PYTHON_FOR_VENV}" -m venv --system-site-packages dnl + --clear dnl + --without-pip dnl + config.venv], [ + AC_MSG_RESULT(yes) + dnl strip all comments from install-requires.txt; this should leave + dnl only a single line containing the version specification for this + dnl package. + SAGE_PKG_VERSPEC=$(sed '/^#/d' "./build/pkgs/$1/install-requires.txt") + AC_MSG_CHECKING([for python package $1 ("${SAGE_PKG_VERSPEC}")]) + + dnl To prevent user-site (pip install --user) packages from being + dnl detected as "system" packages, we poison PYTHONUSERBASE. The + dnl sage-env script also does this at runtime; we mimic that + dnl implementation to ensure that the behaviors at ./configure and + dnl runtime are identical. Beware that (as in sage-env) the poisoning + dnl is skipped if PYTHONUSERBASE is non-empty. In particular, if the + dnl user points PYTHONUSERBASE to any path (even the default), then + dnl his local pip packages will be detected. + PYTHONUSERBASE_SAVED="${PYTHONUSERBASE}" + AS_IF([test -z "${PYTHONUSERBASE}"], [ + PYTHONUSERBASE="${HOME}/.sage/local" + ]) - AS_IF( - [PYTHONUSERBASE="${PYTHONUSERBASE}" "${PYTHON_FOR_VENV}" -c "from setuptools.version import pkg_resources; pkg_resources.require('${SAGE_PKG_VERSPEC}'.splitlines())" 2>/dev/null], - [AC_MSG_RESULT(yes)], - [AC_MSG_RESULT(no); sage_spkg_install_$1=yes] - ) + AS_IF( + [PYTHONUSERBASE="${PYTHONUSERBASE}" config.venv/bin/python3 -c dnl + "from setuptools.version import pkg_resources; dnl + pkg_resources.require('${SAGE_PKG_VERSPEC}'.splitlines())" dnl + 2>/dev/null], + [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no); sage_spkg_install_$1=yes] + ) + + PYTHONUSERBASE="${PYTHONUSERBASE_SAVED}" + ], [ + dnl failed to create a venv for some reason + AC_MSG_RESULT(no) + sage_spkg_install_$1=yes + ]) - PYTHONUSERBASE="${PYTHONUSERBASE_SAVED}" + rm -rf config.venv ], [ sage_spkg_install_$1=yes ]) From 6d56387ae05caf0fd764f43718242c586ffc8bf5 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 15 Oct 2021 11:38:08 -0400 Subject: [PATCH 128/423] Trac #29665: log SAGE_PYTHON_PACKAGE_CHECK() failures to config.log. --- m4/sage_python_package_check.m4 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/m4/sage_python_package_check.m4 b/m4/sage_python_package_check.m4 index 7cbd6c0a8f5..e0e0b9fe12d 100644 --- a/m4/sage_python_package_check.m4 +++ b/m4/sage_python_package_check.m4 @@ -47,7 +47,8 @@ AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [ AS_IF(["${PYTHON_FOR_VENV}" -m venv --system-site-packages dnl --clear dnl --without-pip dnl - config.venv], [ + config.venv dnl + 2>&AS_MESSAGE_LOG_FD], [ AC_MSG_RESULT(yes) dnl strip all comments from install-requires.txt; this should leave dnl only a single line containing the version specification for this @@ -72,7 +73,7 @@ AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [ [PYTHONUSERBASE="${PYTHONUSERBASE}" config.venv/bin/python3 -c dnl "from setuptools.version import pkg_resources; dnl pkg_resources.require('${SAGE_PKG_VERSPEC}'.splitlines())" dnl - 2>/dev/null], + 2>&AS_MESSAGE_LOG_FD], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); sage_spkg_install_$1=yes] ) From 3448ae684959e7c54a8bf9a69f54fa83dc575fc3 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 15 Oct 2021 11:45:37 -0400 Subject: [PATCH 129/423] Trac #29665: don't clobber a plain file named config.venv. When SAGE_PYTHON_PACKAGE_CHECK() is cleaning up, we no longer remove "config.venv" unconditionally. Instead, we remove it only if it is a directory. This is also how "pyvenv --clear" works. --- m4/sage_python_package_check.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/m4/sage_python_package_check.m4 b/m4/sage_python_package_check.m4 index e0e0b9fe12d..127a07812de 100644 --- a/m4/sage_python_package_check.m4 +++ b/m4/sage_python_package_check.m4 @@ -85,7 +85,9 @@ AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [ sage_spkg_install_$1=yes ]) - rm -rf config.venv + dnl Clean up config.venv, but only if we could have created it. + dnl (The --clear flag to pyvenv will not clobber a plain file.) + AS_IF([test -d config.venv], [rm -rf config.venv]) ], [ sage_spkg_install_$1=yes ]) From 28e70e2deee8d6e7e9a08171715d9aefbdd1b917 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 16 Oct 2021 08:14:42 -0400 Subject: [PATCH 130/423] Trac #29665: don't announce system python packages that won't be used. When --enable-system-site-packages was not given, the python packages using SAGE_PYTHON_PACKAGE_CHECK() in spkg-configure.m4 cannot be used. Rather than suggest that users install them anyway, that macro now hacks the value of sage_use_system_$package to be "no" when the use of system site packages is disabled at the python level. --- m4/sage_python_package_check.m4 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/m4/sage_python_package_check.m4 b/m4/sage_python_package_check.m4 index 127a07812de..7ee82a7d14f 100644 --- a/m4/sage_python_package_check.m4 +++ b/m4/sage_python_package_check.m4 @@ -89,6 +89,23 @@ AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [ dnl (The --clear flag to pyvenv will not clobber a plain file.) AS_IF([test -d config.venv], [rm -rf config.venv]) ], [ + dnl System site packages are disabled. sage_spkg_install_$1=yes + + dnl We have to retroactively hack the --with-system-foo={no,yes,force} + dnl mechanism here because it wasn't designed with the ability to + dnl disable arbitrary chunks of system packages in mind. The easy cases + dnl are "no" and "force" which require no action; "no" means we won't + dnl suggest the package anyway, and "force" will raise an error when + dnl the system-package check fails. + dnl + dnl The default of "yes" is more troubling because it is the default. To + dnl avoid prompting users to install packages that won't be used, we want + dnl to ignore "yes" when reporting the "hint: install these packages..." + dnl at the end of ./configure. To accomplish that, we change "yes" to + dnl "no" here, essentially changing the default for packages using this + dnl macro when --enable-system-site-packages is disabled. Packages with + dnl "no" are not suggested to the user. + AS_IF([test "${sage_use_system_$1}" = "yes"],[sage_use_system_$1=no]) ]) ]) From eb4bf94b30bbe498374eb2320289eb1c8f6c522d Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 17 Oct 2021 06:16:21 -0400 Subject: [PATCH 131/423] Trac #29665: add Gentoo package information for python packages. --- build/pkgs/babel/distros/gentoo.txt | 1 + build/pkgs/bleach/distros/gentoo.txt | 1 + build/pkgs/certifi/distros/gentoo.txt | 1 + build/pkgs/cvxopt/distros/gentoo.txt | 1 + build/pkgs/decorator/distros/gentoo.txt | 1 + build/pkgs/html5lib/distros/gentoo.txt | 1 + build/pkgs/idna/distros/gentoo.txt | 1 + build/pkgs/jinja2/distros/gentoo.txt | 1 + build/pkgs/matplotlib/distros/gentoo.txt | 1 + build/pkgs/mpmath/distros/gentoo.txt | 1 + build/pkgs/networkx/distros/gentoo.txt | 1 + build/pkgs/numpy/distros/gentoo.txt | 1 + build/pkgs/packaging/distros/gentoo.txt | 1 + build/pkgs/pandocfilters/distros/gentoo.txt | 1 + build/pkgs/pickleshare/distros/gentoo.txt | 1 + build/pkgs/pillow/distros/gentoo.txt | 1 + build/pkgs/pluggy/distros/gentoo.txt | 1 + build/pkgs/pygments/distros/gentoo.txt | 1 + build/pkgs/pytz/distros/gentoo.txt | 1 + build/pkgs/pyzmq/distros/gentoo.txt | 1 + build/pkgs/requests/distros/gentoo.txt | 1 + build/pkgs/scipy/distros/gentoo.txt | 1 + build/pkgs/setuptools/distros/gentoo.txt | 1 + build/pkgs/six/distros/gentoo.txt | 1 + build/pkgs/sympy/distros/gentoo.txt | 1 + build/pkgs/texttable/distros/gentoo.txt | 1 + build/pkgs/toml/distros/gentoo.txt | 1 + build/pkgs/webencodings/distros/gentoo.txt | 1 + 28 files changed, 28 insertions(+) create mode 100644 build/pkgs/babel/distros/gentoo.txt create mode 100644 build/pkgs/bleach/distros/gentoo.txt create mode 100644 build/pkgs/certifi/distros/gentoo.txt create mode 100644 build/pkgs/cvxopt/distros/gentoo.txt create mode 100644 build/pkgs/decorator/distros/gentoo.txt create mode 100644 build/pkgs/html5lib/distros/gentoo.txt create mode 100644 build/pkgs/idna/distros/gentoo.txt create mode 100644 build/pkgs/jinja2/distros/gentoo.txt create mode 100644 build/pkgs/matplotlib/distros/gentoo.txt create mode 100644 build/pkgs/mpmath/distros/gentoo.txt create mode 100644 build/pkgs/networkx/distros/gentoo.txt create mode 100644 build/pkgs/numpy/distros/gentoo.txt create mode 100644 build/pkgs/packaging/distros/gentoo.txt create mode 100644 build/pkgs/pandocfilters/distros/gentoo.txt create mode 100644 build/pkgs/pickleshare/distros/gentoo.txt create mode 100644 build/pkgs/pillow/distros/gentoo.txt create mode 100644 build/pkgs/pluggy/distros/gentoo.txt create mode 100644 build/pkgs/pygments/distros/gentoo.txt create mode 100644 build/pkgs/pytz/distros/gentoo.txt create mode 100644 build/pkgs/pyzmq/distros/gentoo.txt create mode 100644 build/pkgs/requests/distros/gentoo.txt create mode 100644 build/pkgs/scipy/distros/gentoo.txt create mode 100644 build/pkgs/setuptools/distros/gentoo.txt create mode 100644 build/pkgs/six/distros/gentoo.txt create mode 100644 build/pkgs/sympy/distros/gentoo.txt create mode 100644 build/pkgs/texttable/distros/gentoo.txt create mode 100644 build/pkgs/toml/distros/gentoo.txt create mode 100644 build/pkgs/webencodings/distros/gentoo.txt diff --git a/build/pkgs/babel/distros/gentoo.txt b/build/pkgs/babel/distros/gentoo.txt new file mode 100644 index 00000000000..2d2c34fb697 --- /dev/null +++ b/build/pkgs/babel/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/Babel diff --git a/build/pkgs/bleach/distros/gentoo.txt b/build/pkgs/bleach/distros/gentoo.txt new file mode 100644 index 00000000000..b4f9744eee9 --- /dev/null +++ b/build/pkgs/bleach/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/bleach diff --git a/build/pkgs/certifi/distros/gentoo.txt b/build/pkgs/certifi/distros/gentoo.txt new file mode 100644 index 00000000000..72e2e91c6ae --- /dev/null +++ b/build/pkgs/certifi/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/certifi diff --git a/build/pkgs/cvxopt/distros/gentoo.txt b/build/pkgs/cvxopt/distros/gentoo.txt new file mode 100644 index 00000000000..b3123912bbe --- /dev/null +++ b/build/pkgs/cvxopt/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/cvxopt diff --git a/build/pkgs/decorator/distros/gentoo.txt b/build/pkgs/decorator/distros/gentoo.txt new file mode 100644 index 00000000000..fea5a67ac9e --- /dev/null +++ b/build/pkgs/decorator/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/decorator diff --git a/build/pkgs/html5lib/distros/gentoo.txt b/build/pkgs/html5lib/distros/gentoo.txt new file mode 100644 index 00000000000..6c2be76429c --- /dev/null +++ b/build/pkgs/html5lib/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/html5lib diff --git a/build/pkgs/idna/distros/gentoo.txt b/build/pkgs/idna/distros/gentoo.txt new file mode 100644 index 00000000000..68ef51c453e --- /dev/null +++ b/build/pkgs/idna/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/idna diff --git a/build/pkgs/jinja2/distros/gentoo.txt b/build/pkgs/jinja2/distros/gentoo.txt new file mode 100644 index 00000000000..15a27aecd44 --- /dev/null +++ b/build/pkgs/jinja2/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/jinja diff --git a/build/pkgs/matplotlib/distros/gentoo.txt b/build/pkgs/matplotlib/distros/gentoo.txt new file mode 100644 index 00000000000..bcfefb5fcc4 --- /dev/null +++ b/build/pkgs/matplotlib/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/matplotlib diff --git a/build/pkgs/mpmath/distros/gentoo.txt b/build/pkgs/mpmath/distros/gentoo.txt new file mode 100644 index 00000000000..946c62d9e1a --- /dev/null +++ b/build/pkgs/mpmath/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/mpmath diff --git a/build/pkgs/networkx/distros/gentoo.txt b/build/pkgs/networkx/distros/gentoo.txt new file mode 100644 index 00000000000..dd97742cff8 --- /dev/null +++ b/build/pkgs/networkx/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/networkx diff --git a/build/pkgs/numpy/distros/gentoo.txt b/build/pkgs/numpy/distros/gentoo.txt new file mode 100644 index 00000000000..d2179d43851 --- /dev/null +++ b/build/pkgs/numpy/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/numpy diff --git a/build/pkgs/packaging/distros/gentoo.txt b/build/pkgs/packaging/distros/gentoo.txt new file mode 100644 index 00000000000..e5309ed2b25 --- /dev/null +++ b/build/pkgs/packaging/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/packaging diff --git a/build/pkgs/pandocfilters/distros/gentoo.txt b/build/pkgs/pandocfilters/distros/gentoo.txt new file mode 100644 index 00000000000..a726fda2817 --- /dev/null +++ b/build/pkgs/pandocfilters/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/pandocfilters diff --git a/build/pkgs/pickleshare/distros/gentoo.txt b/build/pkgs/pickleshare/distros/gentoo.txt new file mode 100644 index 00000000000..14fad0fa428 --- /dev/null +++ b/build/pkgs/pickleshare/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/pickleshare diff --git a/build/pkgs/pillow/distros/gentoo.txt b/build/pkgs/pillow/distros/gentoo.txt new file mode 100644 index 00000000000..12436496ed4 --- /dev/null +++ b/build/pkgs/pillow/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/pillow diff --git a/build/pkgs/pluggy/distros/gentoo.txt b/build/pkgs/pluggy/distros/gentoo.txt new file mode 100644 index 00000000000..7b338764374 --- /dev/null +++ b/build/pkgs/pluggy/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/pluggy diff --git a/build/pkgs/pygments/distros/gentoo.txt b/build/pkgs/pygments/distros/gentoo.txt new file mode 100644 index 00000000000..a584f321e71 --- /dev/null +++ b/build/pkgs/pygments/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/pygments diff --git a/build/pkgs/pytz/distros/gentoo.txt b/build/pkgs/pytz/distros/gentoo.txt new file mode 100644 index 00000000000..902a18bf73e --- /dev/null +++ b/build/pkgs/pytz/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/pytz diff --git a/build/pkgs/pyzmq/distros/gentoo.txt b/build/pkgs/pyzmq/distros/gentoo.txt new file mode 100644 index 00000000000..77c24295bd0 --- /dev/null +++ b/build/pkgs/pyzmq/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/pyzmq diff --git a/build/pkgs/requests/distros/gentoo.txt b/build/pkgs/requests/distros/gentoo.txt new file mode 100644 index 00000000000..d3dc9415e3d --- /dev/null +++ b/build/pkgs/requests/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/requests diff --git a/build/pkgs/scipy/distros/gentoo.txt b/build/pkgs/scipy/distros/gentoo.txt new file mode 100644 index 00000000000..11dabd2830f --- /dev/null +++ b/build/pkgs/scipy/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/scipy diff --git a/build/pkgs/setuptools/distros/gentoo.txt b/build/pkgs/setuptools/distros/gentoo.txt new file mode 100644 index 00000000000..3a4fa34a57f --- /dev/null +++ b/build/pkgs/setuptools/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/setuptools diff --git a/build/pkgs/six/distros/gentoo.txt b/build/pkgs/six/distros/gentoo.txt new file mode 100644 index 00000000000..f73f648ff75 --- /dev/null +++ b/build/pkgs/six/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/six diff --git a/build/pkgs/sympy/distros/gentoo.txt b/build/pkgs/sympy/distros/gentoo.txt new file mode 100644 index 00000000000..b5a5034c731 --- /dev/null +++ b/build/pkgs/sympy/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/sympy diff --git a/build/pkgs/texttable/distros/gentoo.txt b/build/pkgs/texttable/distros/gentoo.txt new file mode 100644 index 00000000000..b33a7a75d50 --- /dev/null +++ b/build/pkgs/texttable/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/texttable diff --git a/build/pkgs/toml/distros/gentoo.txt b/build/pkgs/toml/distros/gentoo.txt new file mode 100644 index 00000000000..64fcea3559f --- /dev/null +++ b/build/pkgs/toml/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/toml diff --git a/build/pkgs/webencodings/distros/gentoo.txt b/build/pkgs/webencodings/distros/gentoo.txt new file mode 100644 index 00000000000..7539b0fdcde --- /dev/null +++ b/build/pkgs/webencodings/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/webencodings From 84c61c7e214112ae362a406291482c04204a7d52 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 17 Oct 2021 18:43:04 -0700 Subject: [PATCH 132/423] build/pkgs: Add distros/fedora.txt for Python packages --- build/pkgs/babel/distros/fedora.txt | 1 + build/pkgs/bleach/distros/fedora.txt | 1 + build/pkgs/certifi/distros/fedora.txt | 1 + build/pkgs/cvxopt/distros/fedora.txt | 1 + build/pkgs/decorator/distros/fedora.txt | 1 + build/pkgs/html5lib/distros/fedora.txt | 1 + build/pkgs/idna/distros/fedora.txt | 1 + build/pkgs/jinja2/distros/fedora.txt | 1 + build/pkgs/matplotlib/distros/fedora.txt | 1 + build/pkgs/mpmath/distros/fedora.txt | 1 + build/pkgs/networkx/distros/fedora.txt | 1 + build/pkgs/numpy/distros/fedora.txt | 1 + build/pkgs/packaging/distros/fedora.txt | 1 + build/pkgs/pandocfilters/distros/fedora.txt | 1 + build/pkgs/pickleshare/distros/fedora.txt | 1 + build/pkgs/pillow/distros/fedora.txt | 1 + build/pkgs/pluggy/distros/fedora.txt | 1 + build/pkgs/py/distros/fedora.txt | 1 + build/pkgs/pygments/distros/fedora.txt | 1 + build/pkgs/pytz/distros/fedora.txt | 1 + build/pkgs/pyzmq/distros/fedora.txt | 1 + build/pkgs/requests/distros/fedora.txt | 1 + build/pkgs/scipy/distros/fedora.txt | 1 + build/pkgs/setuptools/distros/fedora.txt | 1 + build/pkgs/six/distros/fedora.txt | 1 + build/pkgs/sympy/distros/fedora.txt | 1 + build/pkgs/texttable/distros/fedora.txt | 1 + build/pkgs/toml/distros/fedora.txt | 1 + build/pkgs/webencodings/distros/fedora.txt | 1 + build/pkgs/wheel/distros/fedora.txt | 1 + 30 files changed, 30 insertions(+) create mode 100644 build/pkgs/babel/distros/fedora.txt create mode 100644 build/pkgs/bleach/distros/fedora.txt create mode 100644 build/pkgs/certifi/distros/fedora.txt create mode 100644 build/pkgs/cvxopt/distros/fedora.txt create mode 100644 build/pkgs/decorator/distros/fedora.txt create mode 100644 build/pkgs/html5lib/distros/fedora.txt create mode 100644 build/pkgs/idna/distros/fedora.txt create mode 100644 build/pkgs/jinja2/distros/fedora.txt create mode 100644 build/pkgs/matplotlib/distros/fedora.txt create mode 100644 build/pkgs/mpmath/distros/fedora.txt create mode 100644 build/pkgs/networkx/distros/fedora.txt create mode 100644 build/pkgs/numpy/distros/fedora.txt create mode 100644 build/pkgs/packaging/distros/fedora.txt create mode 100644 build/pkgs/pandocfilters/distros/fedora.txt create mode 100644 build/pkgs/pickleshare/distros/fedora.txt create mode 100644 build/pkgs/pillow/distros/fedora.txt create mode 100644 build/pkgs/pluggy/distros/fedora.txt create mode 100644 build/pkgs/py/distros/fedora.txt create mode 100644 build/pkgs/pygments/distros/fedora.txt create mode 100644 build/pkgs/pytz/distros/fedora.txt create mode 100644 build/pkgs/pyzmq/distros/fedora.txt create mode 100644 build/pkgs/requests/distros/fedora.txt create mode 100644 build/pkgs/scipy/distros/fedora.txt create mode 100644 build/pkgs/setuptools/distros/fedora.txt create mode 100644 build/pkgs/six/distros/fedora.txt create mode 100644 build/pkgs/sympy/distros/fedora.txt create mode 100644 build/pkgs/texttable/distros/fedora.txt create mode 100644 build/pkgs/toml/distros/fedora.txt create mode 100644 build/pkgs/webencodings/distros/fedora.txt create mode 100644 build/pkgs/wheel/distros/fedora.txt diff --git a/build/pkgs/babel/distros/fedora.txt b/build/pkgs/babel/distros/fedora.txt new file mode 100644 index 00000000000..98f65931c4c --- /dev/null +++ b/build/pkgs/babel/distros/fedora.txt @@ -0,0 +1 @@ +babel diff --git a/build/pkgs/bleach/distros/fedora.txt b/build/pkgs/bleach/distros/fedora.txt new file mode 100644 index 00000000000..c5422ccff0c --- /dev/null +++ b/build/pkgs/bleach/distros/fedora.txt @@ -0,0 +1 @@ +python-bleach diff --git a/build/pkgs/certifi/distros/fedora.txt b/build/pkgs/certifi/distros/fedora.txt new file mode 100644 index 00000000000..be421c8b4b2 --- /dev/null +++ b/build/pkgs/certifi/distros/fedora.txt @@ -0,0 +1 @@ +python-certifi diff --git a/build/pkgs/cvxopt/distros/fedora.txt b/build/pkgs/cvxopt/distros/fedora.txt new file mode 100644 index 00000000000..f15770f0506 --- /dev/null +++ b/build/pkgs/cvxopt/distros/fedora.txt @@ -0,0 +1 @@ +python-cvxopt diff --git a/build/pkgs/decorator/distros/fedora.txt b/build/pkgs/decorator/distros/fedora.txt new file mode 100644 index 00000000000..079560412f1 --- /dev/null +++ b/build/pkgs/decorator/distros/fedora.txt @@ -0,0 +1 @@ +python-decorator diff --git a/build/pkgs/html5lib/distros/fedora.txt b/build/pkgs/html5lib/distros/fedora.txt new file mode 100644 index 00000000000..b821491e116 --- /dev/null +++ b/build/pkgs/html5lib/distros/fedora.txt @@ -0,0 +1 @@ +python-html5lib diff --git a/build/pkgs/idna/distros/fedora.txt b/build/pkgs/idna/distros/fedora.txt new file mode 100644 index 00000000000..a73e70cade0 --- /dev/null +++ b/build/pkgs/idna/distros/fedora.txt @@ -0,0 +1 @@ +python-idna diff --git a/build/pkgs/jinja2/distros/fedora.txt b/build/pkgs/jinja2/distros/fedora.txt new file mode 100644 index 00000000000..f5f3caf99cc --- /dev/null +++ b/build/pkgs/jinja2/distros/fedora.txt @@ -0,0 +1 @@ +python-jinja2 diff --git a/build/pkgs/matplotlib/distros/fedora.txt b/build/pkgs/matplotlib/distros/fedora.txt new file mode 100644 index 00000000000..f6d856e585c --- /dev/null +++ b/build/pkgs/matplotlib/distros/fedora.txt @@ -0,0 +1 @@ +python-matplotlib diff --git a/build/pkgs/mpmath/distros/fedora.txt b/build/pkgs/mpmath/distros/fedora.txt new file mode 100644 index 00000000000..a7dc8d568f3 --- /dev/null +++ b/build/pkgs/mpmath/distros/fedora.txt @@ -0,0 +1 @@ +python-mpmath diff --git a/build/pkgs/networkx/distros/fedora.txt b/build/pkgs/networkx/distros/fedora.txt new file mode 100644 index 00000000000..293f943529a --- /dev/null +++ b/build/pkgs/networkx/distros/fedora.txt @@ -0,0 +1 @@ +python-networkx diff --git a/build/pkgs/numpy/distros/fedora.txt b/build/pkgs/numpy/distros/fedora.txt new file mode 100644 index 00000000000..c8722b9f663 --- /dev/null +++ b/build/pkgs/numpy/distros/fedora.txt @@ -0,0 +1 @@ +python-numpy diff --git a/build/pkgs/packaging/distros/fedora.txt b/build/pkgs/packaging/distros/fedora.txt new file mode 100644 index 00000000000..02ad855da9a --- /dev/null +++ b/build/pkgs/packaging/distros/fedora.txt @@ -0,0 +1 @@ +python-packaging diff --git a/build/pkgs/pandocfilters/distros/fedora.txt b/build/pkgs/pandocfilters/distros/fedora.txt new file mode 100644 index 00000000000..e7a86d0373c --- /dev/null +++ b/build/pkgs/pandocfilters/distros/fedora.txt @@ -0,0 +1 @@ +python-pandocfilters diff --git a/build/pkgs/pickleshare/distros/fedora.txt b/build/pkgs/pickleshare/distros/fedora.txt new file mode 100644 index 00000000000..6d991a27d41 --- /dev/null +++ b/build/pkgs/pickleshare/distros/fedora.txt @@ -0,0 +1 @@ +python-pickleshare diff --git a/build/pkgs/pillow/distros/fedora.txt b/build/pkgs/pillow/distros/fedora.txt new file mode 100644 index 00000000000..86dbb1d13b8 --- /dev/null +++ b/build/pkgs/pillow/distros/fedora.txt @@ -0,0 +1 @@ +python-pillow diff --git a/build/pkgs/pluggy/distros/fedora.txt b/build/pkgs/pluggy/distros/fedora.txt new file mode 100644 index 00000000000..c869e54c551 --- /dev/null +++ b/build/pkgs/pluggy/distros/fedora.txt @@ -0,0 +1 @@ +python-pluggy diff --git a/build/pkgs/py/distros/fedora.txt b/build/pkgs/py/distros/fedora.txt new file mode 100644 index 00000000000..b348d395fbd --- /dev/null +++ b/build/pkgs/py/distros/fedora.txt @@ -0,0 +1 @@ +python-py diff --git a/build/pkgs/pygments/distros/fedora.txt b/build/pkgs/pygments/distros/fedora.txt new file mode 100644 index 00000000000..f3e72a89c38 --- /dev/null +++ b/build/pkgs/pygments/distros/fedora.txt @@ -0,0 +1 @@ +python-pygments diff --git a/build/pkgs/pytz/distros/fedora.txt b/build/pkgs/pytz/distros/fedora.txt new file mode 100644 index 00000000000..2cccc9e61ec --- /dev/null +++ b/build/pkgs/pytz/distros/fedora.txt @@ -0,0 +1 @@ +python-pytz diff --git a/build/pkgs/pyzmq/distros/fedora.txt b/build/pkgs/pyzmq/distros/fedora.txt new file mode 100644 index 00000000000..23f64d1f1a3 --- /dev/null +++ b/build/pkgs/pyzmq/distros/fedora.txt @@ -0,0 +1 @@ +python-pyzmq diff --git a/build/pkgs/requests/distros/fedora.txt b/build/pkgs/requests/distros/fedora.txt new file mode 100644 index 00000000000..93a7bc19b60 --- /dev/null +++ b/build/pkgs/requests/distros/fedora.txt @@ -0,0 +1 @@ +python-requests diff --git a/build/pkgs/scipy/distros/fedora.txt b/build/pkgs/scipy/distros/fedora.txt new file mode 100644 index 00000000000..7ff2882c1bf --- /dev/null +++ b/build/pkgs/scipy/distros/fedora.txt @@ -0,0 +1 @@ +python-scipy diff --git a/build/pkgs/setuptools/distros/fedora.txt b/build/pkgs/setuptools/distros/fedora.txt new file mode 100644 index 00000000000..e1ad17860cd --- /dev/null +++ b/build/pkgs/setuptools/distros/fedora.txt @@ -0,0 +1 @@ +python-setuptools diff --git a/build/pkgs/six/distros/fedora.txt b/build/pkgs/six/distros/fedora.txt new file mode 100644 index 00000000000..787c5308ea4 --- /dev/null +++ b/build/pkgs/six/distros/fedora.txt @@ -0,0 +1 @@ +python-six diff --git a/build/pkgs/sympy/distros/fedora.txt b/build/pkgs/sympy/distros/fedora.txt new file mode 100644 index 00000000000..126c88afd85 --- /dev/null +++ b/build/pkgs/sympy/distros/fedora.txt @@ -0,0 +1 @@ +python-sympy diff --git a/build/pkgs/texttable/distros/fedora.txt b/build/pkgs/texttable/distros/fedora.txt new file mode 100644 index 00000000000..8d1ccec8c7d --- /dev/null +++ b/build/pkgs/texttable/distros/fedora.txt @@ -0,0 +1 @@ +python-texttable diff --git a/build/pkgs/toml/distros/fedora.txt b/build/pkgs/toml/distros/fedora.txt new file mode 100644 index 00000000000..821ee775ac7 --- /dev/null +++ b/build/pkgs/toml/distros/fedora.txt @@ -0,0 +1 @@ +python-toml diff --git a/build/pkgs/webencodings/distros/fedora.txt b/build/pkgs/webencodings/distros/fedora.txt new file mode 100644 index 00000000000..12ddba901a4 --- /dev/null +++ b/build/pkgs/webencodings/distros/fedora.txt @@ -0,0 +1 @@ +python-webencodings diff --git a/build/pkgs/wheel/distros/fedora.txt b/build/pkgs/wheel/distros/fedora.txt new file mode 100644 index 00000000000..ae4cbb9f52f --- /dev/null +++ b/build/pkgs/wheel/distros/fedora.txt @@ -0,0 +1 @@ +python-wheel From 62b9a10d953cfcb68cd27e24815b78bc29222672 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 17 Oct 2021 21:04:04 -0700 Subject: [PATCH 133/423] build/pkgs: Add distros/arch.txt for Python packages --- build/pkgs/babel/distros/arch.txt | 1 + build/pkgs/bleach/distros/arch.txt | 1 + build/pkgs/certifi/distros/arch.txt | 1 + build/pkgs/cvxopt/distros/arch.txt | 1 + build/pkgs/decorator/distros/arch.txt | 1 + build/pkgs/html5lib/distros/arch.txt | 1 + build/pkgs/idna/distros/arch.txt | 1 + build/pkgs/matplotlib/distros/arch.txt | 1 + build/pkgs/mpmath/distros/arch.txt | 1 + build/pkgs/networkx/distros/arch.txt | 1 + build/pkgs/numpy/distros/arch.txt | 1 + build/pkgs/packaging/distros/arch.txt | 1 + build/pkgs/pandocfilters/distros/arch.txt | 1 + build/pkgs/pickleshare/distros/arch.txt | 1 + build/pkgs/pillow/distros/arch.txt | 1 + build/pkgs/pluggy/distros/arch.txt | 1 + build/pkgs/py/distros/arch.txt | 1 + build/pkgs/pygments/distros/arch.txt | 1 + build/pkgs/pytz/distros/arch.txt | 1 + build/pkgs/pyzmq/distros/arch.txt | 1 + build/pkgs/requests/distros/arch.txt | 1 + build/pkgs/scipy/distros/arch.txt | 1 + build/pkgs/setuptools/distros/arch.txt | 1 + build/pkgs/six/distros/arch.txt | 1 + build/pkgs/sympy/distros/arch.txt | 1 + build/pkgs/texttable/distros/arch.txt | 1 + build/pkgs/toml/distros/arch.txt | 1 + build/pkgs/webencodings/distros/arch.txt | 1 + build/pkgs/wheel/distros/arch.txt | 1 + 29 files changed, 29 insertions(+) create mode 100644 build/pkgs/babel/distros/arch.txt create mode 100644 build/pkgs/bleach/distros/arch.txt create mode 100644 build/pkgs/certifi/distros/arch.txt create mode 100644 build/pkgs/cvxopt/distros/arch.txt create mode 100644 build/pkgs/decorator/distros/arch.txt create mode 100644 build/pkgs/html5lib/distros/arch.txt create mode 100644 build/pkgs/idna/distros/arch.txt create mode 100644 build/pkgs/matplotlib/distros/arch.txt create mode 100644 build/pkgs/mpmath/distros/arch.txt create mode 100644 build/pkgs/networkx/distros/arch.txt create mode 100644 build/pkgs/numpy/distros/arch.txt create mode 100644 build/pkgs/packaging/distros/arch.txt create mode 100644 build/pkgs/pandocfilters/distros/arch.txt create mode 100644 build/pkgs/pickleshare/distros/arch.txt create mode 100644 build/pkgs/pillow/distros/arch.txt create mode 100644 build/pkgs/pluggy/distros/arch.txt create mode 100644 build/pkgs/py/distros/arch.txt create mode 100644 build/pkgs/pygments/distros/arch.txt create mode 100644 build/pkgs/pytz/distros/arch.txt create mode 100644 build/pkgs/pyzmq/distros/arch.txt create mode 100644 build/pkgs/requests/distros/arch.txt create mode 100644 build/pkgs/scipy/distros/arch.txt create mode 100644 build/pkgs/setuptools/distros/arch.txt create mode 100644 build/pkgs/six/distros/arch.txt create mode 100644 build/pkgs/sympy/distros/arch.txt create mode 100644 build/pkgs/texttable/distros/arch.txt create mode 100644 build/pkgs/toml/distros/arch.txt create mode 100644 build/pkgs/webencodings/distros/arch.txt create mode 100644 build/pkgs/wheel/distros/arch.txt diff --git a/build/pkgs/babel/distros/arch.txt b/build/pkgs/babel/distros/arch.txt new file mode 100644 index 00000000000..f2d828ccc5c --- /dev/null +++ b/build/pkgs/babel/distros/arch.txt @@ -0,0 +1 @@ +python-babel diff --git a/build/pkgs/bleach/distros/arch.txt b/build/pkgs/bleach/distros/arch.txt new file mode 100644 index 00000000000..c5422ccff0c --- /dev/null +++ b/build/pkgs/bleach/distros/arch.txt @@ -0,0 +1 @@ +python-bleach diff --git a/build/pkgs/certifi/distros/arch.txt b/build/pkgs/certifi/distros/arch.txt new file mode 100644 index 00000000000..be421c8b4b2 --- /dev/null +++ b/build/pkgs/certifi/distros/arch.txt @@ -0,0 +1 @@ +python-certifi diff --git a/build/pkgs/cvxopt/distros/arch.txt b/build/pkgs/cvxopt/distros/arch.txt new file mode 100644 index 00000000000..f15770f0506 --- /dev/null +++ b/build/pkgs/cvxopt/distros/arch.txt @@ -0,0 +1 @@ +python-cvxopt diff --git a/build/pkgs/decorator/distros/arch.txt b/build/pkgs/decorator/distros/arch.txt new file mode 100644 index 00000000000..079560412f1 --- /dev/null +++ b/build/pkgs/decorator/distros/arch.txt @@ -0,0 +1 @@ +python-decorator diff --git a/build/pkgs/html5lib/distros/arch.txt b/build/pkgs/html5lib/distros/arch.txt new file mode 100644 index 00000000000..b821491e116 --- /dev/null +++ b/build/pkgs/html5lib/distros/arch.txt @@ -0,0 +1 @@ +python-html5lib diff --git a/build/pkgs/idna/distros/arch.txt b/build/pkgs/idna/distros/arch.txt new file mode 100644 index 00000000000..a73e70cade0 --- /dev/null +++ b/build/pkgs/idna/distros/arch.txt @@ -0,0 +1 @@ +python-idna diff --git a/build/pkgs/matplotlib/distros/arch.txt b/build/pkgs/matplotlib/distros/arch.txt new file mode 100644 index 00000000000..f6d856e585c --- /dev/null +++ b/build/pkgs/matplotlib/distros/arch.txt @@ -0,0 +1 @@ +python-matplotlib diff --git a/build/pkgs/mpmath/distros/arch.txt b/build/pkgs/mpmath/distros/arch.txt new file mode 100644 index 00000000000..a7dc8d568f3 --- /dev/null +++ b/build/pkgs/mpmath/distros/arch.txt @@ -0,0 +1 @@ +python-mpmath diff --git a/build/pkgs/networkx/distros/arch.txt b/build/pkgs/networkx/distros/arch.txt new file mode 100644 index 00000000000..293f943529a --- /dev/null +++ b/build/pkgs/networkx/distros/arch.txt @@ -0,0 +1 @@ +python-networkx diff --git a/build/pkgs/numpy/distros/arch.txt b/build/pkgs/numpy/distros/arch.txt new file mode 100644 index 00000000000..c8722b9f663 --- /dev/null +++ b/build/pkgs/numpy/distros/arch.txt @@ -0,0 +1 @@ +python-numpy diff --git a/build/pkgs/packaging/distros/arch.txt b/build/pkgs/packaging/distros/arch.txt new file mode 100644 index 00000000000..02ad855da9a --- /dev/null +++ b/build/pkgs/packaging/distros/arch.txt @@ -0,0 +1 @@ +python-packaging diff --git a/build/pkgs/pandocfilters/distros/arch.txt b/build/pkgs/pandocfilters/distros/arch.txt new file mode 100644 index 00000000000..e7a86d0373c --- /dev/null +++ b/build/pkgs/pandocfilters/distros/arch.txt @@ -0,0 +1 @@ +python-pandocfilters diff --git a/build/pkgs/pickleshare/distros/arch.txt b/build/pkgs/pickleshare/distros/arch.txt new file mode 100644 index 00000000000..6d991a27d41 --- /dev/null +++ b/build/pkgs/pickleshare/distros/arch.txt @@ -0,0 +1 @@ +python-pickleshare diff --git a/build/pkgs/pillow/distros/arch.txt b/build/pkgs/pillow/distros/arch.txt new file mode 100644 index 00000000000..86dbb1d13b8 --- /dev/null +++ b/build/pkgs/pillow/distros/arch.txt @@ -0,0 +1 @@ +python-pillow diff --git a/build/pkgs/pluggy/distros/arch.txt b/build/pkgs/pluggy/distros/arch.txt new file mode 100644 index 00000000000..c869e54c551 --- /dev/null +++ b/build/pkgs/pluggy/distros/arch.txt @@ -0,0 +1 @@ +python-pluggy diff --git a/build/pkgs/py/distros/arch.txt b/build/pkgs/py/distros/arch.txt new file mode 100644 index 00000000000..b348d395fbd --- /dev/null +++ b/build/pkgs/py/distros/arch.txt @@ -0,0 +1 @@ +python-py diff --git a/build/pkgs/pygments/distros/arch.txt b/build/pkgs/pygments/distros/arch.txt new file mode 100644 index 00000000000..f3e72a89c38 --- /dev/null +++ b/build/pkgs/pygments/distros/arch.txt @@ -0,0 +1 @@ +python-pygments diff --git a/build/pkgs/pytz/distros/arch.txt b/build/pkgs/pytz/distros/arch.txt new file mode 100644 index 00000000000..2cccc9e61ec --- /dev/null +++ b/build/pkgs/pytz/distros/arch.txt @@ -0,0 +1 @@ +python-pytz diff --git a/build/pkgs/pyzmq/distros/arch.txt b/build/pkgs/pyzmq/distros/arch.txt new file mode 100644 index 00000000000..23f64d1f1a3 --- /dev/null +++ b/build/pkgs/pyzmq/distros/arch.txt @@ -0,0 +1 @@ +python-pyzmq diff --git a/build/pkgs/requests/distros/arch.txt b/build/pkgs/requests/distros/arch.txt new file mode 100644 index 00000000000..93a7bc19b60 --- /dev/null +++ b/build/pkgs/requests/distros/arch.txt @@ -0,0 +1 @@ +python-requests diff --git a/build/pkgs/scipy/distros/arch.txt b/build/pkgs/scipy/distros/arch.txt new file mode 100644 index 00000000000..7ff2882c1bf --- /dev/null +++ b/build/pkgs/scipy/distros/arch.txt @@ -0,0 +1 @@ +python-scipy diff --git a/build/pkgs/setuptools/distros/arch.txt b/build/pkgs/setuptools/distros/arch.txt new file mode 100644 index 00000000000..e1ad17860cd --- /dev/null +++ b/build/pkgs/setuptools/distros/arch.txt @@ -0,0 +1 @@ +python-setuptools diff --git a/build/pkgs/six/distros/arch.txt b/build/pkgs/six/distros/arch.txt new file mode 100644 index 00000000000..787c5308ea4 --- /dev/null +++ b/build/pkgs/six/distros/arch.txt @@ -0,0 +1 @@ +python-six diff --git a/build/pkgs/sympy/distros/arch.txt b/build/pkgs/sympy/distros/arch.txt new file mode 100644 index 00000000000..126c88afd85 --- /dev/null +++ b/build/pkgs/sympy/distros/arch.txt @@ -0,0 +1 @@ +python-sympy diff --git a/build/pkgs/texttable/distros/arch.txt b/build/pkgs/texttable/distros/arch.txt new file mode 100644 index 00000000000..8d1ccec8c7d --- /dev/null +++ b/build/pkgs/texttable/distros/arch.txt @@ -0,0 +1 @@ +python-texttable diff --git a/build/pkgs/toml/distros/arch.txt b/build/pkgs/toml/distros/arch.txt new file mode 100644 index 00000000000..821ee775ac7 --- /dev/null +++ b/build/pkgs/toml/distros/arch.txt @@ -0,0 +1 @@ +python-toml diff --git a/build/pkgs/webencodings/distros/arch.txt b/build/pkgs/webencodings/distros/arch.txt new file mode 100644 index 00000000000..12ddba901a4 --- /dev/null +++ b/build/pkgs/webencodings/distros/arch.txt @@ -0,0 +1 @@ +python-webencodings diff --git a/build/pkgs/wheel/distros/arch.txt b/build/pkgs/wheel/distros/arch.txt new file mode 100644 index 00000000000..ae4cbb9f52f --- /dev/null +++ b/build/pkgs/wheel/distros/arch.txt @@ -0,0 +1 @@ +python-wheel From de1473523adf23ad5d9e4e14664c95b8e00fafb3 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 17 Oct 2021 21:20:56 -0700 Subject: [PATCH 134/423] build/pkgs: Add distros/opensuse.txt for Python packages --- build/pkgs/bleach/distros/opensuse.txt | 1 + build/pkgs/cvxopt/distros/opensuse.txt | 1 + build/pkgs/html5lib/distros/opensuse.txt | 1 + build/pkgs/idna/distros/opensuse.txt | 1 + build/pkgs/jinja2/distros/opensuse.txt | 2 +- build/pkgs/mpmath/distros/opensuse.txt | 1 + build/pkgs/numpy/distros/opensuse.txt | 1 + build/pkgs/packaging/distros/opensuse.txt | 1 + build/pkgs/pandocfilters/distros/opensuse.txt | 1 + build/pkgs/pluggy/distros/opensuse.txt | 1 + build/pkgs/py/distros/opensuse.txt | 1 + build/pkgs/pygments/distros/opensuse.txt | 2 +- build/pkgs/sympy/distros/opensuse.txt | 1 + build/pkgs/texttable/distros/opensuse.txt | 1 + build/pkgs/toml/distros/opensuse.txt | 1 + 15 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 build/pkgs/bleach/distros/opensuse.txt create mode 100644 build/pkgs/cvxopt/distros/opensuse.txt create mode 100644 build/pkgs/html5lib/distros/opensuse.txt create mode 100644 build/pkgs/idna/distros/opensuse.txt create mode 100644 build/pkgs/mpmath/distros/opensuse.txt create mode 100644 build/pkgs/numpy/distros/opensuse.txt create mode 100644 build/pkgs/packaging/distros/opensuse.txt create mode 100644 build/pkgs/pandocfilters/distros/opensuse.txt create mode 100644 build/pkgs/pluggy/distros/opensuse.txt create mode 100644 build/pkgs/py/distros/opensuse.txt create mode 100644 build/pkgs/sympy/distros/opensuse.txt create mode 100644 build/pkgs/texttable/distros/opensuse.txt create mode 100644 build/pkgs/toml/distros/opensuse.txt diff --git a/build/pkgs/bleach/distros/opensuse.txt b/build/pkgs/bleach/distros/opensuse.txt new file mode 100644 index 00000000000..6d37c4c79f0 --- /dev/null +++ b/build/pkgs/bleach/distros/opensuse.txt @@ -0,0 +1 @@ +python3-bleach diff --git a/build/pkgs/cvxopt/distros/opensuse.txt b/build/pkgs/cvxopt/distros/opensuse.txt new file mode 100644 index 00000000000..2bb6ad1e834 --- /dev/null +++ b/build/pkgs/cvxopt/distros/opensuse.txt @@ -0,0 +1 @@ +python3-cvxopt diff --git a/build/pkgs/html5lib/distros/opensuse.txt b/build/pkgs/html5lib/distros/opensuse.txt new file mode 100644 index 00000000000..6d7b8dfb001 --- /dev/null +++ b/build/pkgs/html5lib/distros/opensuse.txt @@ -0,0 +1 @@ +python3-html5lib diff --git a/build/pkgs/idna/distros/opensuse.txt b/build/pkgs/idna/distros/opensuse.txt new file mode 100644 index 00000000000..de48e70887b --- /dev/null +++ b/build/pkgs/idna/distros/opensuse.txt @@ -0,0 +1 @@ +python3-idna diff --git a/build/pkgs/jinja2/distros/opensuse.txt b/build/pkgs/jinja2/distros/opensuse.txt index 5d90a223f55..f2db865ab36 100644 --- a/build/pkgs/jinja2/distros/opensuse.txt +++ b/build/pkgs/jinja2/distros/opensuse.txt @@ -1 +1 @@ -python3-Jinja2 +python3-jinja2 diff --git a/build/pkgs/mpmath/distros/opensuse.txt b/build/pkgs/mpmath/distros/opensuse.txt new file mode 100644 index 00000000000..fbc82a97e07 --- /dev/null +++ b/build/pkgs/mpmath/distros/opensuse.txt @@ -0,0 +1 @@ +python3-mpmath diff --git a/build/pkgs/numpy/distros/opensuse.txt b/build/pkgs/numpy/distros/opensuse.txt new file mode 100644 index 00000000000..79d5c5a1429 --- /dev/null +++ b/build/pkgs/numpy/distros/opensuse.txt @@ -0,0 +1 @@ +python3-numpy diff --git a/build/pkgs/packaging/distros/opensuse.txt b/build/pkgs/packaging/distros/opensuse.txt new file mode 100644 index 00000000000..8f1c0ffc29f --- /dev/null +++ b/build/pkgs/packaging/distros/opensuse.txt @@ -0,0 +1 @@ +python3-packaging diff --git a/build/pkgs/pandocfilters/distros/opensuse.txt b/build/pkgs/pandocfilters/distros/opensuse.txt new file mode 100644 index 00000000000..d0d4c24e15e --- /dev/null +++ b/build/pkgs/pandocfilters/distros/opensuse.txt @@ -0,0 +1 @@ +python3-pandocfilters diff --git a/build/pkgs/pluggy/distros/opensuse.txt b/build/pkgs/pluggy/distros/opensuse.txt new file mode 100644 index 00000000000..43a3acf0462 --- /dev/null +++ b/build/pkgs/pluggy/distros/opensuse.txt @@ -0,0 +1 @@ +python3-pluggy diff --git a/build/pkgs/py/distros/opensuse.txt b/build/pkgs/py/distros/opensuse.txt new file mode 100644 index 00000000000..81fefe60903 --- /dev/null +++ b/build/pkgs/py/distros/opensuse.txt @@ -0,0 +1 @@ +python3-py diff --git a/build/pkgs/pygments/distros/opensuse.txt b/build/pkgs/pygments/distros/opensuse.txt index 9ff5740e79c..3ab37929b2c 100644 --- a/build/pkgs/pygments/distros/opensuse.txt +++ b/build/pkgs/pygments/distros/opensuse.txt @@ -1 +1 @@ -python3-Pygments +python3-pygments diff --git a/build/pkgs/sympy/distros/opensuse.txt b/build/pkgs/sympy/distros/opensuse.txt new file mode 100644 index 00000000000..db423c87ba7 --- /dev/null +++ b/build/pkgs/sympy/distros/opensuse.txt @@ -0,0 +1 @@ +python3-sympy diff --git a/build/pkgs/texttable/distros/opensuse.txt b/build/pkgs/texttable/distros/opensuse.txt new file mode 100644 index 00000000000..8f8e7e29d7a --- /dev/null +++ b/build/pkgs/texttable/distros/opensuse.txt @@ -0,0 +1 @@ +python3-texttable diff --git a/build/pkgs/toml/distros/opensuse.txt b/build/pkgs/toml/distros/opensuse.txt new file mode 100644 index 00000000000..543e89d2a6f --- /dev/null +++ b/build/pkgs/toml/distros/opensuse.txt @@ -0,0 +1 @@ +python3-toml From f66da0a711aad3454d49a8b72bdc4c2b1a66f62b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 17 Oct 2021 22:45:04 -0700 Subject: [PATCH 135/423] build/pkgs: Add distros/debian.txt for Python packages --- build/pkgs/babel/distros/debian.txt | 1 + build/pkgs/bleach/distros/debian.txt | 1 + build/pkgs/certifi/distros/debian.txt | 1 + build/pkgs/cvxopt/distros/debian.txt | 1 + build/pkgs/decorator/distros/debian.txt | 1 + build/pkgs/html5lib/distros/debian.txt | 1 + build/pkgs/idna/distros/debian.txt | 1 + build/pkgs/jinja2/distros/debian.txt | 1 + build/pkgs/matplotlib/distros/debian.txt | 1 + build/pkgs/mpmath/distros/debian.txt | 1 + build/pkgs/networkx/distros/debian.txt | 1 + build/pkgs/numpy/distros/debian.txt | 1 + build/pkgs/packaging/distros/debian.txt | 1 + build/pkgs/pandocfilters/distros/debian.txt | 1 + build/pkgs/pickleshare/distros/debian.txt | 1 + build/pkgs/pillow/distros/debian.txt | 1 + build/pkgs/pluggy/distros/debian.txt | 1 + build/pkgs/py/distros/debian.txt | 1 + build/pkgs/pygments/distros/debian.txt | 1 + build/pkgs/pytz/distros/debian.txt | 1 + build/pkgs/requests/distros/debian.txt | 1 + build/pkgs/scipy/distros/debian.txt | 1 + build/pkgs/setuptools/distros/debian.txt | 1 + build/pkgs/six/distros/debian.txt | 1 + build/pkgs/sympy/distros/debian.txt | 1 + build/pkgs/texttable/distros/debian.txt | 1 + build/pkgs/toml/distros/debian.txt | 1 + build/pkgs/webencodings/distros/debian.txt | 1 + build/pkgs/wheel/distros/debian.txt | 1 + 29 files changed, 29 insertions(+) create mode 100644 build/pkgs/babel/distros/debian.txt create mode 100644 build/pkgs/bleach/distros/debian.txt create mode 100644 build/pkgs/certifi/distros/debian.txt create mode 100644 build/pkgs/cvxopt/distros/debian.txt create mode 100644 build/pkgs/decorator/distros/debian.txt create mode 100644 build/pkgs/html5lib/distros/debian.txt create mode 100644 build/pkgs/idna/distros/debian.txt create mode 100644 build/pkgs/jinja2/distros/debian.txt create mode 100644 build/pkgs/matplotlib/distros/debian.txt create mode 100644 build/pkgs/mpmath/distros/debian.txt create mode 100644 build/pkgs/networkx/distros/debian.txt create mode 100644 build/pkgs/numpy/distros/debian.txt create mode 100644 build/pkgs/packaging/distros/debian.txt create mode 100644 build/pkgs/pandocfilters/distros/debian.txt create mode 100644 build/pkgs/pickleshare/distros/debian.txt create mode 100644 build/pkgs/pillow/distros/debian.txt create mode 100644 build/pkgs/pluggy/distros/debian.txt create mode 100644 build/pkgs/py/distros/debian.txt create mode 100644 build/pkgs/pygments/distros/debian.txt create mode 100644 build/pkgs/pytz/distros/debian.txt create mode 100644 build/pkgs/requests/distros/debian.txt create mode 100644 build/pkgs/scipy/distros/debian.txt create mode 100644 build/pkgs/setuptools/distros/debian.txt create mode 100644 build/pkgs/six/distros/debian.txt create mode 100644 build/pkgs/sympy/distros/debian.txt create mode 100644 build/pkgs/texttable/distros/debian.txt create mode 100644 build/pkgs/toml/distros/debian.txt create mode 100644 build/pkgs/webencodings/distros/debian.txt create mode 100644 build/pkgs/wheel/distros/debian.txt diff --git a/build/pkgs/babel/distros/debian.txt b/build/pkgs/babel/distros/debian.txt new file mode 100644 index 00000000000..e623eb68a31 --- /dev/null +++ b/build/pkgs/babel/distros/debian.txt @@ -0,0 +1 @@ +python3-babel diff --git a/build/pkgs/bleach/distros/debian.txt b/build/pkgs/bleach/distros/debian.txt new file mode 100644 index 00000000000..6d37c4c79f0 --- /dev/null +++ b/build/pkgs/bleach/distros/debian.txt @@ -0,0 +1 @@ +python3-bleach diff --git a/build/pkgs/certifi/distros/debian.txt b/build/pkgs/certifi/distros/debian.txt new file mode 100644 index 00000000000..f585a823bf3 --- /dev/null +++ b/build/pkgs/certifi/distros/debian.txt @@ -0,0 +1 @@ +python3-certifi diff --git a/build/pkgs/cvxopt/distros/debian.txt b/build/pkgs/cvxopt/distros/debian.txt new file mode 100644 index 00000000000..2bb6ad1e834 --- /dev/null +++ b/build/pkgs/cvxopt/distros/debian.txt @@ -0,0 +1 @@ +python3-cvxopt diff --git a/build/pkgs/decorator/distros/debian.txt b/build/pkgs/decorator/distros/debian.txt new file mode 100644 index 00000000000..46c478e1513 --- /dev/null +++ b/build/pkgs/decorator/distros/debian.txt @@ -0,0 +1 @@ +python3-decorator diff --git a/build/pkgs/html5lib/distros/debian.txt b/build/pkgs/html5lib/distros/debian.txt new file mode 100644 index 00000000000..6d7b8dfb001 --- /dev/null +++ b/build/pkgs/html5lib/distros/debian.txt @@ -0,0 +1 @@ +python3-html5lib diff --git a/build/pkgs/idna/distros/debian.txt b/build/pkgs/idna/distros/debian.txt new file mode 100644 index 00000000000..de48e70887b --- /dev/null +++ b/build/pkgs/idna/distros/debian.txt @@ -0,0 +1 @@ +python3-idna diff --git a/build/pkgs/jinja2/distros/debian.txt b/build/pkgs/jinja2/distros/debian.txt new file mode 100644 index 00000000000..f2db865ab36 --- /dev/null +++ b/build/pkgs/jinja2/distros/debian.txt @@ -0,0 +1 @@ +python3-jinja2 diff --git a/build/pkgs/matplotlib/distros/debian.txt b/build/pkgs/matplotlib/distros/debian.txt new file mode 100644 index 00000000000..13743297213 --- /dev/null +++ b/build/pkgs/matplotlib/distros/debian.txt @@ -0,0 +1 @@ +python3-matplotlib diff --git a/build/pkgs/mpmath/distros/debian.txt b/build/pkgs/mpmath/distros/debian.txt new file mode 100644 index 00000000000..fbc82a97e07 --- /dev/null +++ b/build/pkgs/mpmath/distros/debian.txt @@ -0,0 +1 @@ +python3-mpmath diff --git a/build/pkgs/networkx/distros/debian.txt b/build/pkgs/networkx/distros/debian.txt new file mode 100644 index 00000000000..67790667af2 --- /dev/null +++ b/build/pkgs/networkx/distros/debian.txt @@ -0,0 +1 @@ +python3-networkx diff --git a/build/pkgs/numpy/distros/debian.txt b/build/pkgs/numpy/distros/debian.txt new file mode 100644 index 00000000000..79d5c5a1429 --- /dev/null +++ b/build/pkgs/numpy/distros/debian.txt @@ -0,0 +1 @@ +python3-numpy diff --git a/build/pkgs/packaging/distros/debian.txt b/build/pkgs/packaging/distros/debian.txt new file mode 100644 index 00000000000..8f1c0ffc29f --- /dev/null +++ b/build/pkgs/packaging/distros/debian.txt @@ -0,0 +1 @@ +python3-packaging diff --git a/build/pkgs/pandocfilters/distros/debian.txt b/build/pkgs/pandocfilters/distros/debian.txt new file mode 100644 index 00000000000..d0d4c24e15e --- /dev/null +++ b/build/pkgs/pandocfilters/distros/debian.txt @@ -0,0 +1 @@ +python3-pandocfilters diff --git a/build/pkgs/pickleshare/distros/debian.txt b/build/pkgs/pickleshare/distros/debian.txt new file mode 100644 index 00000000000..a00907d167b --- /dev/null +++ b/build/pkgs/pickleshare/distros/debian.txt @@ -0,0 +1 @@ +python3-pickleshare diff --git a/build/pkgs/pillow/distros/debian.txt b/build/pkgs/pillow/distros/debian.txt new file mode 100644 index 00000000000..3319fcd7e0f --- /dev/null +++ b/build/pkgs/pillow/distros/debian.txt @@ -0,0 +1 @@ +python3-pillow diff --git a/build/pkgs/pluggy/distros/debian.txt b/build/pkgs/pluggy/distros/debian.txt new file mode 100644 index 00000000000..43a3acf0462 --- /dev/null +++ b/build/pkgs/pluggy/distros/debian.txt @@ -0,0 +1 @@ +python3-pluggy diff --git a/build/pkgs/py/distros/debian.txt b/build/pkgs/py/distros/debian.txt new file mode 100644 index 00000000000..81fefe60903 --- /dev/null +++ b/build/pkgs/py/distros/debian.txt @@ -0,0 +1 @@ +python3-py diff --git a/build/pkgs/pygments/distros/debian.txt b/build/pkgs/pygments/distros/debian.txt new file mode 100644 index 00000000000..3ab37929b2c --- /dev/null +++ b/build/pkgs/pygments/distros/debian.txt @@ -0,0 +1 @@ +python3-pygments diff --git a/build/pkgs/pytz/distros/debian.txt b/build/pkgs/pytz/distros/debian.txt new file mode 100644 index 00000000000..db209080161 --- /dev/null +++ b/build/pkgs/pytz/distros/debian.txt @@ -0,0 +1 @@ +python3-tz diff --git a/build/pkgs/requests/distros/debian.txt b/build/pkgs/requests/distros/debian.txt new file mode 100644 index 00000000000..43147b2be74 --- /dev/null +++ b/build/pkgs/requests/distros/debian.txt @@ -0,0 +1 @@ +python3-requests diff --git a/build/pkgs/scipy/distros/debian.txt b/build/pkgs/scipy/distros/debian.txt new file mode 100644 index 00000000000..12b366666d6 --- /dev/null +++ b/build/pkgs/scipy/distros/debian.txt @@ -0,0 +1 @@ +python3-scipy diff --git a/build/pkgs/setuptools/distros/debian.txt b/build/pkgs/setuptools/distros/debian.txt new file mode 100644 index 00000000000..1c0901c0374 --- /dev/null +++ b/build/pkgs/setuptools/distros/debian.txt @@ -0,0 +1 @@ +python3-setuptools diff --git a/build/pkgs/six/distros/debian.txt b/build/pkgs/six/distros/debian.txt new file mode 100644 index 00000000000..68ff8595d0b --- /dev/null +++ b/build/pkgs/six/distros/debian.txt @@ -0,0 +1 @@ +python3-six diff --git a/build/pkgs/sympy/distros/debian.txt b/build/pkgs/sympy/distros/debian.txt new file mode 100644 index 00000000000..db423c87ba7 --- /dev/null +++ b/build/pkgs/sympy/distros/debian.txt @@ -0,0 +1 @@ +python3-sympy diff --git a/build/pkgs/texttable/distros/debian.txt b/build/pkgs/texttable/distros/debian.txt new file mode 100644 index 00000000000..8f8e7e29d7a --- /dev/null +++ b/build/pkgs/texttable/distros/debian.txt @@ -0,0 +1 @@ +python3-texttable diff --git a/build/pkgs/toml/distros/debian.txt b/build/pkgs/toml/distros/debian.txt new file mode 100644 index 00000000000..543e89d2a6f --- /dev/null +++ b/build/pkgs/toml/distros/debian.txt @@ -0,0 +1 @@ +python3-toml diff --git a/build/pkgs/webencodings/distros/debian.txt b/build/pkgs/webencodings/distros/debian.txt new file mode 100644 index 00000000000..ac30c2f3307 --- /dev/null +++ b/build/pkgs/webencodings/distros/debian.txt @@ -0,0 +1 @@ +python3-webencodings diff --git a/build/pkgs/wheel/distros/debian.txt b/build/pkgs/wheel/distros/debian.txt new file mode 100644 index 00000000000..3c066725a1d --- /dev/null +++ b/build/pkgs/wheel/distros/debian.txt @@ -0,0 +1 @@ +python3-wheel From e0080c57384ddb763ad4fab3d5c10b80e2c96115 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 18 Oct 2021 07:50:34 -0400 Subject: [PATCH 136/423] Trac #29665: add more documentation for SAGE_PYTHON_PACKAGE_CHECK(). An earlier commit allows SAGE_PYTHON_PACKAGE_CHECK(package) to tweak the value of sage_use_system_$package if --enable-system-site-packages was not used. This essentially changes the default --with-system-$package=yes to "no" in that case. Here we update the documentation to reflect it. --- m4/sage_python_package_check.m4 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/m4/sage_python_package_check.m4 b/m4/sage_python_package_check.m4 index 7ee82a7d14f..95eefd0e07a 100644 --- a/m4/sage_python_package_check.m4 +++ b/m4/sage_python_package_check.m4 @@ -34,6 +34,10 @@ # ensure that the ./configure- and run-time views of the system # are as similar as possible. # +# To avoid suggesting these system packages to users who have not +# set --enable-system-site-packages, this macro also changes the +# default for --with-system-foo from "yes" to "no" in that case. +# AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [ AS_IF([test "${enable_system_site_packages}" = "yes"], [ From 6e405c43fd58da8a7c4c81a6080711314be5cece Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 18 Oct 2021 07:42:46 -0400 Subject: [PATCH 137/423] Trac #29665: improve SAGE_PYTHON_PACKAGE_CHECK() failure message. When --enable-system-site-packages is off, SAGE_PYTHON_PACKAGE_CHECK() will always install the corresponding SPKG. We improve the ./configure output in that case to make it clear that the decision was based on the value of --enable-system-site-packages and not the "real" check. --- m4/sage_python_package_check.m4 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/m4/sage_python_package_check.m4 b/m4/sage_python_package_check.m4 index 95eefd0e07a..5f0f084dd6b 100644 --- a/m4/sage_python_package_check.m4 +++ b/m4/sage_python_package_check.m4 @@ -40,7 +40,9 @@ # AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [ + AC_MSG_CHECKING([if --enable-system-site-packages was used]) AS_IF([test "${enable_system_site_packages}" = "yes"], [ + AC_MSG_RESULT(yes) AC_REQUIRE([SAGE_SPKG_CONFIGURE_PYTHON3]) dnl We run this check inside a python venv, because that's ultimately @@ -94,6 +96,7 @@ AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [ AS_IF([test -d config.venv], [rm -rf config.venv]) ], [ dnl System site packages are disabled. + AC_MSG_RESULT(no; skipping check) sage_spkg_install_$1=yes dnl We have to retroactively hack the --with-system-foo={no,yes,force} From b480c7f18955f8476fb16583add2c67d9816f380 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 24 Oct 2021 20:29:25 -0400 Subject: [PATCH 138/423] Trac #29665: use sage-venv in SAGE_PYTHON_PACKAGE_CHECK(). For consistency with the rest of the build system, we now use the build/bin/sage-venv script to create the venv in this autoconf macro rather than invoking $PYTHON_FOR_VENV with "-m venv" directly. --- m4/sage_python_package_check.m4 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/m4/sage_python_package_check.m4 b/m4/sage_python_package_check.m4 index 5f0f084dd6b..5547b35a71f 100644 --- a/m4/sage_python_package_check.m4 +++ b/m4/sage_python_package_check.m4 @@ -50,11 +50,11 @@ AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [ AC_MSG_CHECKING([if we can create a python venv in config.venv]) dnl Use --clear because ./configure typically clobbers its output files. - AS_IF(["${PYTHON_FOR_VENV}" -m venv --system-site-packages dnl - --clear dnl - --without-pip dnl - config.venv dnl - 2>&AS_MESSAGE_LOG_FD], [ + AS_IF(["${PYTHON_FOR_VENV}" build/bin/sage-venv dnl + --system-site-packages dnl + --clear dnl + config.venv dnl + 2>&AS_MESSAGE_LOG_FD], [ AC_MSG_RESULT(yes) dnl strip all comments from install-requires.txt; this should leave dnl only a single line containing the version specification for this From 659563eaaca2e4ea3b9fbb97848c92a0698deaab Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 18:10:30 -0400 Subject: [PATCH 139/423] Trac #29665: standard python spkg-configure.m4 for urllib3. --- build/pkgs/urllib3/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/urllib3/spkg-configure.m4 diff --git a/build/pkgs/urllib3/spkg-configure.m4 b/build/pkgs/urllib3/spkg-configure.m4 new file mode 100644 index 00000000000..d7ef3e1661c --- /dev/null +++ b/build/pkgs/urllib3/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([urllib3], [SAGE_PYTHON_PACKAGE_CHECK([urllib3])]) From 09486f09c1e86bdc0e16e0126b7c03bfc331a36e Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 18:15:18 -0400 Subject: [PATCH 140/423] Trac #29665: add Gentoo package information for urllib3. --- build/pkgs/urllib3/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/urllib3/distros/gentoo.txt diff --git a/build/pkgs/urllib3/distros/gentoo.txt b/build/pkgs/urllib3/distros/gentoo.txt new file mode 100644 index 00000000000..172a5357dba --- /dev/null +++ b/build/pkgs/urllib3/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/urllib3 From 527021355f3739467f2c624881baa43c0edc5299 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 18:15:58 -0400 Subject: [PATCH 141/423] Trac #29665: add Gentoo package information for nbformat. --- build/pkgs/nbformat/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/nbformat/distros/gentoo.txt diff --git a/build/pkgs/nbformat/distros/gentoo.txt b/build/pkgs/nbformat/distros/gentoo.txt new file mode 100644 index 00000000000..006b1f2fc6d --- /dev/null +++ b/build/pkgs/nbformat/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/nbformat From 59d679155714b9ffacab835fc239dcc73c575425 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 18:34:16 -0400 Subject: [PATCH 142/423] Trac #29665: standard python spkg-configure.m4 for nbformat. --- build/pkgs/nbformat/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/nbformat/spkg-configure.m4 diff --git a/build/pkgs/nbformat/spkg-configure.m4 b/build/pkgs/nbformat/spkg-configure.m4 new file mode 100644 index 00000000000..5a7f8c4ccec --- /dev/null +++ b/build/pkgs/nbformat/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([nbformat], [SAGE_PYTHON_PACKAGE_CHECK([nbformat])]) From db773cd6c4abfe4fe95f59b4cd1dfacf1153e61e Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 18:47:01 -0400 Subject: [PATCH 143/423] Trac #29665: add Gentoo package information for zipp. --- build/pkgs/zipp/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/zipp/distros/gentoo.txt diff --git a/build/pkgs/zipp/distros/gentoo.txt b/build/pkgs/zipp/distros/gentoo.txt new file mode 100644 index 00000000000..7f59450c2b7 --- /dev/null +++ b/build/pkgs/zipp/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/zipp From b155e86f556f4a971de7559c18187db364d0d8ab Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 18:47:35 -0400 Subject: [PATCH 144/423] Trac #29665: standard python spkg-configure.m4 for zipp. --- build/pkgs/zipp/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/zipp/spkg-configure.m4 diff --git a/build/pkgs/zipp/spkg-configure.m4 b/build/pkgs/zipp/spkg-configure.m4 new file mode 100644 index 00000000000..0fe3a9cd224 --- /dev/null +++ b/build/pkgs/zipp/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([zipp], [SAGE_PYTHON_PACKAGE_CHECK([zipp])]) From 35bd9935193b419a28c5696e28f84bcc8d436f18 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 18:48:37 -0400 Subject: [PATCH 145/423] Trac #29665: add Gentoo package information for wcwidth. --- build/pkgs/wcwidth/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/wcwidth/distros/gentoo.txt diff --git a/build/pkgs/wcwidth/distros/gentoo.txt b/build/pkgs/wcwidth/distros/gentoo.txt new file mode 100644 index 00000000000..edeb80b62a1 --- /dev/null +++ b/build/pkgs/wcwidth/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/wcwidth From 884fe4be23b21331727ae2c844e2604f802a26b8 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 18:51:10 -0400 Subject: [PATCH 146/423] Trac #29665: standard python spkg-configure.m4 for wcwidth. --- build/pkgs/wcwidth/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/wcwidth/spkg-configure.m4 diff --git a/build/pkgs/wcwidth/spkg-configure.m4 b/build/pkgs/wcwidth/spkg-configure.m4 new file mode 100644 index 00000000000..5bde15af224 --- /dev/null +++ b/build/pkgs/wcwidth/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([wcwidth], [SAGE_PYTHON_PACKAGE_CHECK([wcwidth])]) From b877377fd9b65ef165a58e7b17c4d60109b1694a Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 18:56:06 -0400 Subject: [PATCH 147/423] Trac #29665: add Gentoo package information for jedi. --- build/pkgs/jedi/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/jedi/distros/gentoo.txt diff --git a/build/pkgs/jedi/distros/gentoo.txt b/build/pkgs/jedi/distros/gentoo.txt new file mode 100644 index 00000000000..6c85a46cfcb --- /dev/null +++ b/build/pkgs/jedi/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/jedi From 33a4f2a0f4185e9c958d9cace5c3aa2b18c9e0d8 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:06:37 -0400 Subject: [PATCH 148/423] Trac #29665: standard python spkg-configure.m4 for jedi. --- build/pkgs/jedi/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/jedi/spkg-configure.m4 diff --git a/build/pkgs/jedi/spkg-configure.m4 b/build/pkgs/jedi/spkg-configure.m4 new file mode 100644 index 00000000000..a37dbcc92db --- /dev/null +++ b/build/pkgs/jedi/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([jedi], [SAGE_PYTHON_PACKAGE_CHECK([jedi])]) From 7b421e6ef83a81041edf5c417bb63845dbd985bf Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:07:47 -0400 Subject: [PATCH 149/423] Trac #29665: add Gentoo package information for tomli. --- build/pkgs/tomli/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/tomli/distros/gentoo.txt diff --git a/build/pkgs/tomli/distros/gentoo.txt b/build/pkgs/tomli/distros/gentoo.txt new file mode 100644 index 00000000000..0458e252a4d --- /dev/null +++ b/build/pkgs/tomli/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/tomli From 899c27f89131fab0de81345663b4b242c5f08289 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:08:12 -0400 Subject: [PATCH 150/423] Trac #29665: standard python spkg-configure.m4 for tomli. --- build/pkgs/tomli/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/tomli/spkg-configure.m4 diff --git a/build/pkgs/tomli/spkg-configure.m4 b/build/pkgs/tomli/spkg-configure.m4 new file mode 100644 index 00000000000..95a8b8b84c2 --- /dev/null +++ b/build/pkgs/tomli/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([tomli], [SAGE_PYTHON_PACKAGE_CHECK([tomli])]) From be31beda799d03c9720206de5d318ad4e53becbe Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:09:22 -0400 Subject: [PATCH 151/423] Trac #29665: add Gentoo package information for defusedxml. --- build/pkgs/defusedxml/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/defusedxml/distros/gentoo.txt diff --git a/build/pkgs/defusedxml/distros/gentoo.txt b/build/pkgs/defusedxml/distros/gentoo.txt new file mode 100644 index 00000000000..2804214449e --- /dev/null +++ b/build/pkgs/defusedxml/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/defusedxml From 03d7abcb3772f8481bba00ca3bcb77c8fea51b0b Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:11:14 -0400 Subject: [PATCH 152/423] Trac #29665: standard python spkg-configure.m4 for defusedxml. --- build/pkgs/defusedxml/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/defusedxml/spkg-configure.m4 diff --git a/build/pkgs/defusedxml/spkg-configure.m4 b/build/pkgs/defusedxml/spkg-configure.m4 new file mode 100644 index 00000000000..e02f34524ce --- /dev/null +++ b/build/pkgs/defusedxml/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([defusedxml], [SAGE_PYTHON_PACKAGE_CHECK([defusedxml])]) From 2455becd083bf35932342369e20803243cb00719 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:12:22 -0400 Subject: [PATCH 153/423] Trac #29665: add Gentoo package information for ipywidgets. --- build/pkgs/ipywidgets/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/ipywidgets/distros/gentoo.txt diff --git a/build/pkgs/ipywidgets/distros/gentoo.txt b/build/pkgs/ipywidgets/distros/gentoo.txt new file mode 100644 index 00000000000..7c76967c65b --- /dev/null +++ b/build/pkgs/ipywidgets/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/ipywidgets From 8ea7f9233a39987ef6c190f4129cb78130d38797 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:15:53 -0400 Subject: [PATCH 154/423] Trac #29665: add Gentoo package information for simplegeneric. --- build/pkgs/simplegeneric/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/simplegeneric/distros/gentoo.txt diff --git a/build/pkgs/simplegeneric/distros/gentoo.txt b/build/pkgs/simplegeneric/distros/gentoo.txt new file mode 100644 index 00000000000..a86e90d96ec --- /dev/null +++ b/build/pkgs/simplegeneric/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/simplegeneric From 031e0e49da124243c3c13e476d67ff0a6fbf4621 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:16:33 -0400 Subject: [PATCH 155/423] Trac #29665: standard python spkg-configure.m4 for simplegeneric. --- build/pkgs/simplegeneric/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/simplegeneric/spkg-configure.m4 diff --git a/build/pkgs/simplegeneric/spkg-configure.m4 b/build/pkgs/simplegeneric/spkg-configure.m4 new file mode 100644 index 00000000000..13715ab5f2b --- /dev/null +++ b/build/pkgs/simplegeneric/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([simplegeneric], [SAGE_PYTHON_PACKAGE_CHECK([simplegeneric])]) From ea5ce3eb9368b1462c56b42e812f93f7808a009c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:17:18 -0400 Subject: [PATCH 156/423] Trac #29665: add Gentoo package information for imagesize. --- build/pkgs/imagesize/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/imagesize/distros/gentoo.txt diff --git a/build/pkgs/imagesize/distros/gentoo.txt b/build/pkgs/imagesize/distros/gentoo.txt new file mode 100644 index 00000000000..54350ba2642 --- /dev/null +++ b/build/pkgs/imagesize/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/imagesize From cd93994ef6e32066b9f81838d934afa1441ab698 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:17:48 -0400 Subject: [PATCH 157/423] Trac #29665: standard python spkg-configure.m4 for imagesize. --- build/pkgs/imagesize/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/imagesize/spkg-configure.m4 diff --git a/build/pkgs/imagesize/spkg-configure.m4 b/build/pkgs/imagesize/spkg-configure.m4 new file mode 100644 index 00000000000..20210eff2f0 --- /dev/null +++ b/build/pkgs/imagesize/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([imagesize], [SAGE_PYTHON_PACKAGE_CHECK([imagesize])]) From ef9b7d03e3f8629ca8101f27eb03959e6aa23003 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:18:49 -0400 Subject: [PATCH 158/423] Trac #29665: add Gentoo package information for mistune. --- build/pkgs/mistune/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/mistune/distros/gentoo.txt diff --git a/build/pkgs/mistune/distros/gentoo.txt b/build/pkgs/mistune/distros/gentoo.txt new file mode 100644 index 00000000000..56f0a4ebced --- /dev/null +++ b/build/pkgs/mistune/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/mistune From 4b442dd63dcb2b5ce97605385361903cdcd34eb4 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:21:30 -0400 Subject: [PATCH 159/423] Trac #29665: standard python spkg-configure.m4 for mistune. --- build/pkgs/mistune/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/mistune/spkg-configure.m4 diff --git a/build/pkgs/mistune/spkg-configure.m4 b/build/pkgs/mistune/spkg-configure.m4 new file mode 100644 index 00000000000..972f33d086b --- /dev/null +++ b/build/pkgs/mistune/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([mistune], [SAGE_PYTHON_PACKAGE_CHECK([mistune])]) From efe2ab2362e5d1b7afd22ffa5654cf785b071543 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:22:48 -0400 Subject: [PATCH 160/423] Trac #29665: add Gentoo package information for backcall. --- build/pkgs/backcall/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/backcall/distros/gentoo.txt diff --git a/build/pkgs/backcall/distros/gentoo.txt b/build/pkgs/backcall/distros/gentoo.txt new file mode 100644 index 00000000000..266a222c558 --- /dev/null +++ b/build/pkgs/backcall/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/backcall From 8736fbcb886a295e371dca0f35071fa51a5a41fa Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:25:10 -0400 Subject: [PATCH 161/423] Trac #29665: standard python spkg-configure.m4 for backcall. --- build/pkgs/backcall/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/backcall/spkg-configure.m4 diff --git a/build/pkgs/backcall/spkg-configure.m4 b/build/pkgs/backcall/spkg-configure.m4 new file mode 100644 index 00000000000..d6b11c49884 --- /dev/null +++ b/build/pkgs/backcall/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([backcall], [SAGE_PYTHON_PACKAGE_CHECK([backcall])]) From 15fa92d3d02dd14ecdf2809f4fdddbd6e49bd350 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:25:58 -0400 Subject: [PATCH 162/423] Trac #29665: add Gentoo package information for parso. --- build/pkgs/parso/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/parso/distros/gentoo.txt diff --git a/build/pkgs/parso/distros/gentoo.txt b/build/pkgs/parso/distros/gentoo.txt new file mode 100644 index 00000000000..f9ce4c7f2f2 --- /dev/null +++ b/build/pkgs/parso/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/parso From e6bd185cb730ffb766c9c06c5476e1098fcb0223 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:26:22 -0400 Subject: [PATCH 163/423] Trac #29665: standard python spkg-configure.m4 for parso. --- build/pkgs/parso/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/parso/spkg-configure.m4 diff --git a/build/pkgs/parso/spkg-configure.m4 b/build/pkgs/parso/spkg-configure.m4 new file mode 100644 index 00000000000..1ca6f1b909d --- /dev/null +++ b/build/pkgs/parso/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([parso], [SAGE_PYTHON_PACKAGE_CHECK([parso])]) From f8547efa8ed34d494837d3284f3b427ae0e4b679 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:27:00 -0400 Subject: [PATCH 164/423] Trac #29665: add Gentoo package information for pyparsing. --- build/pkgs/pyparsing/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pyparsing/distros/gentoo.txt diff --git a/build/pkgs/pyparsing/distros/gentoo.txt b/build/pkgs/pyparsing/distros/gentoo.txt new file mode 100644 index 00000000000..ef0419f9cbc --- /dev/null +++ b/build/pkgs/pyparsing/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/pyparsing From a563f1a5ae9bbfd9cbbf922e0832ce27fc19f1e2 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Nov 2021 19:27:30 -0400 Subject: [PATCH 165/423] Trac #29665: standard python spkg-configure.m4 for pyparsing. --- build/pkgs/pyparsing/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pyparsing/spkg-configure.m4 diff --git a/build/pkgs/pyparsing/spkg-configure.m4 b/build/pkgs/pyparsing/spkg-configure.m4 new file mode 100644 index 00000000000..d2b4c0055e4 --- /dev/null +++ b/build/pkgs/pyparsing/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([pyparsing], [SAGE_PYTHON_PACKAGE_CHECK([pyparsing])]) From 9b18e4c4d801420e0c62b52a44740cf8b59fbc00 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:17:42 -0400 Subject: [PATCH 166/423] Trac #29665: add Gentoo package information for debugpy. --- build/pkgs/debugpy/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/debugpy/distros/gentoo.txt diff --git a/build/pkgs/debugpy/distros/gentoo.txt b/build/pkgs/debugpy/distros/gentoo.txt new file mode 100644 index 00000000000..8b797ce715f --- /dev/null +++ b/build/pkgs/debugpy/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/debugpy From cb6044ec431322551fce0d00dbf6a5242c2f127c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:21:17 -0400 Subject: [PATCH 167/423] Trac #29665: standard python spkg-configure.m4 for debugpy. --- build/pkgs/debugpy/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/debugpy/spkg-configure.m4 diff --git a/build/pkgs/debugpy/spkg-configure.m4 b/build/pkgs/debugpy/spkg-configure.m4 new file mode 100644 index 00000000000..db605ff03c8 --- /dev/null +++ b/build/pkgs/debugpy/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([debugpy], [SAGE_PYTHON_PACKAGE_CHECK([debugpy])]) From ca904f2b40db04a1a5f05a516848a7be5034fb59 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:23:56 -0400 Subject: [PATCH 168/423] Trac #29665: add Gentoo package information for tzlocal. --- build/pkgs/tzlocal/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/tzlocal/distros/gentoo.txt diff --git a/build/pkgs/tzlocal/distros/gentoo.txt b/build/pkgs/tzlocal/distros/gentoo.txt new file mode 100644 index 00000000000..2018442dcc4 --- /dev/null +++ b/build/pkgs/tzlocal/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/tzlocal From 4e313a628cdc38fa03d233e2f727069f62b81220 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:24:51 -0400 Subject: [PATCH 169/423] Trac #29665: standard python spkg-configure.m4 for tzlocal. --- build/pkgs/tzlocal/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/tzlocal/spkg-configure.m4 diff --git a/build/pkgs/tzlocal/spkg-configure.m4 b/build/pkgs/tzlocal/spkg-configure.m4 new file mode 100644 index 00000000000..e020b2823f9 --- /dev/null +++ b/build/pkgs/tzlocal/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([tzlocal], [SAGE_PYTHON_PACKAGE_CHECK([tzlocal])]) From fa170d5fb102be79ee80d79b53c28c37bdefcba7 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:26:13 -0400 Subject: [PATCH 170/423] Trac #29665: add Gentoo package information for pycparser. --- build/pkgs/pycparser/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pycparser/distros/gentoo.txt diff --git a/build/pkgs/pycparser/distros/gentoo.txt b/build/pkgs/pycparser/distros/gentoo.txt new file mode 100644 index 00000000000..5e87307c4b9 --- /dev/null +++ b/build/pkgs/pycparser/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/pycparser From 348d023035e15061c867e1b05aa924db9ee613b9 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:27:27 -0400 Subject: [PATCH 171/423] Trac #29665: standard python spkg-configure.m4 for pycparser. --- build/pkgs/pycparser/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pycparser/spkg-configure.m4 diff --git a/build/pkgs/pycparser/spkg-configure.m4 b/build/pkgs/pycparser/spkg-configure.m4 new file mode 100644 index 00000000000..4b9b90079a9 --- /dev/null +++ b/build/pkgs/pycparser/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([pycparser], [SAGE_PYTHON_PACKAGE_CHECK([pycparser])]) From b8e05860d577e1c6c3e01bdf380da76264823ce3 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:29:36 -0400 Subject: [PATCH 172/423] Trac #29665: add Gentoo package information for cycler. --- build/pkgs/cycler/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/cycler/distros/gentoo.txt diff --git a/build/pkgs/cycler/distros/gentoo.txt b/build/pkgs/cycler/distros/gentoo.txt new file mode 100644 index 00000000000..4b215438e8f --- /dev/null +++ b/build/pkgs/cycler/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/cycler From c87529f575693b781f6b2f855c3e6aa08eb41da6 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:30:27 -0400 Subject: [PATCH 173/423] Trac #29665: standard python spkg-configure.m4 for cycler. --- build/pkgs/cycler/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/cycler/spkg-configure.m4 diff --git a/build/pkgs/cycler/spkg-configure.m4 b/build/pkgs/cycler/spkg-configure.m4 new file mode 100644 index 00000000000..239571a0f10 --- /dev/null +++ b/build/pkgs/cycler/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([cycler], [SAGE_PYTHON_PACKAGE_CHECK([cycler])]) From 89a2cdbdc60cc0c7511b78768c41d199ee63cc68 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:31:19 -0400 Subject: [PATCH 174/423] Trac #29665: add Gentoo package information for traitlets. --- build/pkgs/traitlets/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/traitlets/distros/gentoo.txt diff --git a/build/pkgs/traitlets/distros/gentoo.txt b/build/pkgs/traitlets/distros/gentoo.txt new file mode 100644 index 00000000000..46bfaab6fef --- /dev/null +++ b/build/pkgs/traitlets/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/traitlets From 076bc404149974c69789e8d4daf34d0bebb01edc Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:31:50 -0400 Subject: [PATCH 175/423] Trac #29665: standard python spkg-configure.m4 for traitlets. --- build/pkgs/traitlets/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/traitlets/spkg-configure.m4 diff --git a/build/pkgs/traitlets/spkg-configure.m4 b/build/pkgs/traitlets/spkg-configure.m4 new file mode 100644 index 00000000000..df2382b8f01 --- /dev/null +++ b/build/pkgs/traitlets/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([traitlets], [SAGE_PYTHON_PACKAGE_CHECK([traitlets])]) From 7f6654be14c674b34ff8116b1a5eba4c82bdf1e3 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:36:21 -0400 Subject: [PATCH 176/423] Trac #29665: add Gentoo package information for ptyprocess. --- build/pkgs/ptyprocess/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/ptyprocess/distros/gentoo.txt diff --git a/build/pkgs/ptyprocess/distros/gentoo.txt b/build/pkgs/ptyprocess/distros/gentoo.txt new file mode 100644 index 00000000000..571a851d976 --- /dev/null +++ b/build/pkgs/ptyprocess/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/ptyprocess From ddfde004138ddbf6143c3732780cc8f09963e85c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:37:02 -0400 Subject: [PATCH 177/423] Trac #29665: standard python spkg-configure.m4 for ptyprocess. --- build/pkgs/ptyprocess/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/ptyprocess/spkg-configure.m4 diff --git a/build/pkgs/ptyprocess/spkg-configure.m4 b/build/pkgs/ptyprocess/spkg-configure.m4 new file mode 100644 index 00000000000..bfacbaed935 --- /dev/null +++ b/build/pkgs/ptyprocess/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([ptyprocess], [SAGE_PYTHON_PACKAGE_CHECK([ptyprocess])]) From a995e8efd843c83155805c1680bfb13a0df71864 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:38:22 -0400 Subject: [PATCH 178/423] Trac #29665: add Gentoo package information for attrs. --- build/pkgs/attrs/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/attrs/distros/gentoo.txt diff --git a/build/pkgs/attrs/distros/gentoo.txt b/build/pkgs/attrs/distros/gentoo.txt new file mode 100644 index 00000000000..3b906facd3a --- /dev/null +++ b/build/pkgs/attrs/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/attrs From 1a711e93d08aecc3c53fabdc3abb5f8564c4060a Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:38:55 -0400 Subject: [PATCH 179/423] Trac #29665: standard python spkg-configure.m4 for attrs. --- build/pkgs/attrs/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/attrs/spkg-configure.m4 diff --git a/build/pkgs/attrs/spkg-configure.m4 b/build/pkgs/attrs/spkg-configure.m4 new file mode 100644 index 00000000000..ba6a9b71efa --- /dev/null +++ b/build/pkgs/attrs/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([attrs], [SAGE_PYTHON_PACKAGE_CHECK([attrs])]) From 65d8485f366dc99c0166a01e1b8c44462590e078 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:40:09 -0400 Subject: [PATCH 180/423] Trac #29665: add Gentoo package information for send2trash. --- build/pkgs/send2trash/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/send2trash/distros/gentoo.txt diff --git a/build/pkgs/send2trash/distros/gentoo.txt b/build/pkgs/send2trash/distros/gentoo.txt new file mode 100644 index 00000000000..a89b1798476 --- /dev/null +++ b/build/pkgs/send2trash/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/send2trash From 0fe106305ea3c17f94653cffe50e182f983fb3a9 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:41:45 -0400 Subject: [PATCH 181/423] Trac #29665: standard python spkg-configure.m4 for send2trash. --- build/pkgs/send2trash/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/send2trash/spkg-configure.m4 diff --git a/build/pkgs/send2trash/spkg-configure.m4 b/build/pkgs/send2trash/spkg-configure.m4 new file mode 100644 index 00000000000..3bbb727e430 --- /dev/null +++ b/build/pkgs/send2trash/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([send2trash], [SAGE_PYTHON_PACKAGE_CHECK([send2trash])]) From 9e0e66fb1d1bc877ba4552826a43bcc86425b922 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:43:27 -0400 Subject: [PATCH 182/423] Trac #29665: add Gentoo package information for pyrsistent. --- build/pkgs/pyrsistent/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pyrsistent/distros/gentoo.txt diff --git a/build/pkgs/pyrsistent/distros/gentoo.txt b/build/pkgs/pyrsistent/distros/gentoo.txt new file mode 100644 index 00000000000..83439cebfe4 --- /dev/null +++ b/build/pkgs/pyrsistent/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/pyrsistent From 5799c2ccaab532e729c72d88b02a9371a14698c0 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:44:03 -0400 Subject: [PATCH 183/423] Trac #29665: standard python spkg-configure.m4 for pyrsistent. --- build/pkgs/pyrsistent/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pyrsistent/spkg-configure.m4 diff --git a/build/pkgs/pyrsistent/spkg-configure.m4 b/build/pkgs/pyrsistent/spkg-configure.m4 new file mode 100644 index 00000000000..f7ca75dbac5 --- /dev/null +++ b/build/pkgs/pyrsistent/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([pyrsistent], [SAGE_PYTHON_PACKAGE_CHECK([pyrsistent])]) From b0ec970e964e4a9994454eae2466d514a5a415d2 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:45:45 -0400 Subject: [PATCH 184/423] Trac #29665: add Gentoo package information for entrypoints. --- build/pkgs/entrypoints/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/entrypoints/distros/gentoo.txt diff --git a/build/pkgs/entrypoints/distros/gentoo.txt b/build/pkgs/entrypoints/distros/gentoo.txt new file mode 100644 index 00000000000..684ddd036ee --- /dev/null +++ b/build/pkgs/entrypoints/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/entrypoints From bc4e61e28b18606d164465c9e62b779b13e113e1 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:46:24 -0400 Subject: [PATCH 185/423] Trac #29665: standard python spkg-configure.m4 for entrypoints. --- build/pkgs/entrypoints/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/entrypoints/spkg-configure.m4 diff --git a/build/pkgs/entrypoints/spkg-configure.m4 b/build/pkgs/entrypoints/spkg-configure.m4 new file mode 100644 index 00000000000..caed658b69a --- /dev/null +++ b/build/pkgs/entrypoints/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([entrypoints], [SAGE_PYTHON_PACKAGE_CHECK([entrypoints])]) From 0ef9d5df42dc3cc48d1a6fd7f9f39430946a57cd Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:48:26 -0400 Subject: [PATCH 186/423] Trac #29665: add Gentoo package information for markupsafe. --- build/pkgs/markupsafe/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/markupsafe/distros/gentoo.txt diff --git a/build/pkgs/markupsafe/distros/gentoo.txt b/build/pkgs/markupsafe/distros/gentoo.txt new file mode 100644 index 00000000000..9654e3531b6 --- /dev/null +++ b/build/pkgs/markupsafe/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/markupsafe From a18a9c0d325532bcc855617dc43275557dcc596d Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 4 Nov 2021 18:48:55 -0400 Subject: [PATCH 187/423] Trac #29665: standard python spkg-configure.m4 for markupsafe. --- build/pkgs/markupsafe/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/markupsafe/spkg-configure.m4 diff --git a/build/pkgs/markupsafe/spkg-configure.m4 b/build/pkgs/markupsafe/spkg-configure.m4 new file mode 100644 index 00000000000..79eb8dba6f1 --- /dev/null +++ b/build/pkgs/markupsafe/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([markupsafe], [SAGE_PYTHON_PACKAGE_CHECK([markupsafe])]) From 57011651ed5e9963f8d95833e25ab904c2320a26 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 5 Nov 2021 06:30:49 -0400 Subject: [PATCH 188/423] Trac #29665: add Gentoo package information for flit_core. --- build/pkgs/flit_core/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/flit_core/distros/gentoo.txt diff --git a/build/pkgs/flit_core/distros/gentoo.txt b/build/pkgs/flit_core/distros/gentoo.txt new file mode 100644 index 00000000000..fe6bea92362 --- /dev/null +++ b/build/pkgs/flit_core/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/flit_core From 37142aa763ab1c25ff22edbe2bce1da4a49daf8d Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 5 Nov 2021 06:32:11 -0400 Subject: [PATCH 189/423] Trac #29665: standard python spkg-configure.m4 for flit_core. --- build/pkgs/flit_core/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/flit_core/spkg-configure.m4 diff --git a/build/pkgs/flit_core/spkg-configure.m4 b/build/pkgs/flit_core/spkg-configure.m4 new file mode 100644 index 00000000000..ee67557024f --- /dev/null +++ b/build/pkgs/flit_core/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([flit_core], [SAGE_PYTHON_PACKAGE_CHECK([flit_core])]) From 274335b6363b7234378313eaa6c31e53c03f9d77 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 5 Nov 2021 06:34:06 -0400 Subject: [PATCH 190/423] Trac #29665: add Gentoo package information for nest_asyncio. --- build/pkgs/nest_asyncio/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/nest_asyncio/distros/gentoo.txt diff --git a/build/pkgs/nest_asyncio/distros/gentoo.txt b/build/pkgs/nest_asyncio/distros/gentoo.txt new file mode 100644 index 00000000000..ab742d2b0bd --- /dev/null +++ b/build/pkgs/nest_asyncio/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/nest_asyncio From d5024513b31376397b05c0c507d41fbf887507af Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 5 Nov 2021 06:34:43 -0400 Subject: [PATCH 191/423] Trac #29665: standard python spkg-configure.m4 for nest_asyncio. --- build/pkgs/nest_asyncio/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/nest_asyncio/spkg-configure.m4 diff --git a/build/pkgs/nest_asyncio/spkg-configure.m4 b/build/pkgs/nest_asyncio/spkg-configure.m4 new file mode 100644 index 00000000000..4d815276dfb --- /dev/null +++ b/build/pkgs/nest_asyncio/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([nest_asyncio], [SAGE_PYTHON_PACKAGE_CHECK([nest_asyncio])]) From a92fb1350ee61e729aa8a256b49cc18b5d565c67 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 5 Nov 2021 06:37:02 -0400 Subject: [PATCH 192/423] Trac #29665: add Gentoo package information for ipython_genutils. --- build/pkgs/ipython_genutils/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/ipython_genutils/distros/gentoo.txt diff --git a/build/pkgs/ipython_genutils/distros/gentoo.txt b/build/pkgs/ipython_genutils/distros/gentoo.txt new file mode 100644 index 00000000000..01bc49d4e1a --- /dev/null +++ b/build/pkgs/ipython_genutils/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/ipython_genutils From 61c99a97a5092fcc35a5fcf2a662a08706a2d0ba Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 5 Nov 2021 06:39:20 -0400 Subject: [PATCH 193/423] Trac #29665: standard python spkg-configure.m4 for ipython_genutils. --- build/pkgs/ipython_genutils/spkg-configure.m4 | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 build/pkgs/ipython_genutils/spkg-configure.m4 diff --git a/build/pkgs/ipython_genutils/spkg-configure.m4 b/build/pkgs/ipython_genutils/spkg-configure.m4 new file mode 100644 index 00000000000..b0ba86ac7a3 --- /dev/null +++ b/build/pkgs/ipython_genutils/spkg-configure.m4 @@ -0,0 +1,4 @@ +SAGE_SPKG_CONFIGURE( + [ipython_genutils], + [SAGE_PYTHON_PACKAGE_CHECK([ipython_genutils])] +) From 78f2688342467ad25f52033c9a799815cd30ab32 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 5 Nov 2021 06:40:03 -0400 Subject: [PATCH 194/423] Trac #29665: add Gentoo package information for ipython. --- build/pkgs/ipython/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/ipython/distros/gentoo.txt diff --git a/build/pkgs/ipython/distros/gentoo.txt b/build/pkgs/ipython/distros/gentoo.txt new file mode 100644 index 00000000000..8b76f186ff8 --- /dev/null +++ b/build/pkgs/ipython/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/ipython From 2b244d0f5efa9866ac82e6c113d46995c35e4049 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 5 Nov 2021 07:37:56 -0400 Subject: [PATCH 195/423] Trac #29665: standard python spkg-configure.m4 for ipython. --- build/pkgs/ipython/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/ipython/spkg-configure.m4 diff --git a/build/pkgs/ipython/spkg-configure.m4 b/build/pkgs/ipython/spkg-configure.m4 new file mode 100644 index 00000000000..02ab89f5193 --- /dev/null +++ b/build/pkgs/ipython/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([ipython], [SAGE_PYTHON_PACKAGE_CHECK([ipython])]) From e7d2f088a3e0cc41ebe604f9e6e873751201a5c8 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 5 Nov 2021 07:51:11 -0400 Subject: [PATCH 196/423] Trac #29665: standard python spkg-configure.m4 for ipywidgets. --- build/pkgs/ipywidgets/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/ipywidgets/spkg-configure.m4 diff --git a/build/pkgs/ipywidgets/spkg-configure.m4 b/build/pkgs/ipywidgets/spkg-configure.m4 new file mode 100644 index 00000000000..51ca9be74db --- /dev/null +++ b/build/pkgs/ipywidgets/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([ipywidgets], [SAGE_PYTHON_PACKAGE_CHECK([ipywidgets])]) From 36a0ad43249b26eff921861e8e4bd9f22596142a Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 5 Nov 2021 10:05:16 -0400 Subject: [PATCH 197/423] Trac #29665: add Gentoo package information for wheel. --- build/pkgs/wheel/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/wheel/distros/gentoo.txt diff --git a/build/pkgs/wheel/distros/gentoo.txt b/build/pkgs/wheel/distros/gentoo.txt new file mode 100644 index 00000000000..ec571d59d93 --- /dev/null +++ b/build/pkgs/wheel/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/wheel From cce69258a7e66f2871c9e41f3bb7fb18d1952d86 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 08:51:44 -0500 Subject: [PATCH 198/423] Trac #29665: add Gentoo package information for terminado. --- build/pkgs/terminado/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/terminado/distros/gentoo.txt diff --git a/build/pkgs/terminado/distros/gentoo.txt b/build/pkgs/terminado/distros/gentoo.txt new file mode 100644 index 00000000000..1df16f18abb --- /dev/null +++ b/build/pkgs/terminado/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/terminado From 9bbe3d289182978af2537d6f45cae5330f2f0b9d Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 08:52:35 -0500 Subject: [PATCH 199/423] Trac #29665: standard python spkg-configure.m4 for terminado. --- build/pkgs/terminado/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/terminado/spkg-configure.m4 diff --git a/build/pkgs/terminado/spkg-configure.m4 b/build/pkgs/terminado/spkg-configure.m4 new file mode 100644 index 00000000000..5defc2ff877 --- /dev/null +++ b/build/pkgs/terminado/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([terminado], [SAGE_PYTHON_PACKAGE_CHECK([terminado])]) From 1d2fff2dcbddfc99e80d7b906d8291b5b50c8e59 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 08:56:15 -0500 Subject: [PATCH 200/423] Trac #29665: add Gentoo package information for cffi. --- build/pkgs/cffi/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/cffi/distros/gentoo.txt diff --git a/build/pkgs/cffi/distros/gentoo.txt b/build/pkgs/cffi/distros/gentoo.txt new file mode 100644 index 00000000000..81eeb8108c7 --- /dev/null +++ b/build/pkgs/cffi/distros/gentoo.txt @@ -0,0 +1 @@ +virtual/python-cffi From 60b806dc66da1ef2ce7f6509909bcd107f184ab3 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 08:57:04 -0500 Subject: [PATCH 201/423] Trac #29665: standard python spkg-configure.m4 for cffi. --- build/pkgs/cffi/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/cffi/spkg-configure.m4 diff --git a/build/pkgs/cffi/spkg-configure.m4 b/build/pkgs/cffi/spkg-configure.m4 new file mode 100644 index 00000000000..dc81875927f --- /dev/null +++ b/build/pkgs/cffi/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([cffi], [SAGE_PYTHON_PACKAGE_CHECK([cffi])]) From cdf50a54dc3bf525870a2bcc2b9c0f20c4cb00f8 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 08:57:57 -0500 Subject: [PATCH 202/423] Trac #29665: add Gentoo package information for pip. --- build/pkgs/pip/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pip/distros/gentoo.txt diff --git a/build/pkgs/pip/distros/gentoo.txt b/build/pkgs/pip/distros/gentoo.txt new file mode 100644 index 00000000000..1845454d6de --- /dev/null +++ b/build/pkgs/pip/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/pip[vanilla] From 071eb642851382d66aa0a53551be43eac9fcaf5c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 09:07:26 -0500 Subject: [PATCH 203/423] Trac #29665: new spkg-configure.m4 for pip. --- build/pkgs/pip/spkg-configure.m4 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 build/pkgs/pip/spkg-configure.m4 diff --git a/build/pkgs/pip/spkg-configure.m4 b/build/pkgs/pip/spkg-configure.m4 new file mode 100644 index 00000000000..c7a55621f48 --- /dev/null +++ b/build/pkgs/pip/spkg-configure.m4 @@ -0,0 +1,12 @@ +SAGE_SPKG_CONFIGURE([pip], [ + dnl always run this macro because it changes the default value of + dnl the --with-system- option. + SAGE_PYTHON_PACKAGE_CHECK([pip]) + + dnl if we might not install the spkg, make sure that "pip" is in + dnl the user's PATH, too. + AS_IF([test "x$sage_spkg_install_pip" != "xyes"], [ + AC_CHECK_PROG(HAVE_PIP, pip, yes, no) + AS_IF([test "x$HAVE_PIP" = "xno"], [sage_spkg_install_pip=yes]) + ]) +]) From 610ba3ad9516d3e3760474babba012c9e8792e33 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 9 Nov 2021 09:09:04 -0500 Subject: [PATCH 204/423] Trac #29665: set $SAGE_PIP_INSTALL_FLAGS for --enable-system-site-packages. We need to pass some special flags to "pip install" to make it do the right thing in the precence of system-site packages. Here we introduce a new autoconf variable, SAGE_PIP_INSTALL_FLAGS, that will be used to pass those flags to the build system. With autoconf aware of the variable, we substitute its value into the sage-build-env-config script for use in spkg-install.in. --- build/bin/sage-build-env-config.in | 1 + configure.ac | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/build/bin/sage-build-env-config.in b/build/bin/sage-build-env-config.in index b00fd2a3f99..df27cff4660 100644 --- a/build/bin/sage-build-env-config.in +++ b/build/bin/sage-build-env-config.in @@ -53,6 +53,7 @@ export SAGE_PARI_CFG="@SAGE_PARI_CFG@" export SAGE_GLPK_PREFIX="@SAGE_GLPK_PREFIX@" export SAGE_FREETYPE_PREFIX="@SAGE_FREETYPE_PREFIX@" +export SAGE_PIP_INSTALL_FLAGS="@SAGE_PIP_INSTALL_FLAGS@" export SAGE_SUITESPARSE_PREFIX="@SAGE_SUITESPARSE_PREFIX@" export SAGE_CONFIGURE_FFLAS_FFPACK="@SAGE_CONFIGURE_FFLAS_FFPACK@" diff --git a/configure.ac b/configure.ac index 81e594b9561..fad8d00829a 100644 --- a/configure.ac +++ b/configure.ac @@ -451,6 +451,14 @@ AC_ARG_ENABLE( [allow the use of python packages from the system (experimental; default: no)] )], [ AS_IF([test "x$enable_system_site_packages" = "xyes"], [ + dnl When installing python SPKGs in the presence of system-site + dnl packages, we need to --ignore-installed so that a patched SPKG + dnl can be installed in the presence of an unpatched system package + dnl that appears (to pip) to be identical. The --no-deps flag is + dnl then needed because --ignore-installed will make any installed + dnl dependencies invisible to pip, who does not appreciate that. + SAGE_PIP_INSTALL_FLAGS="${SAGE_PIP_INSTALL_FLAGS} --no-deps --ignore-installed" + SAGE_VENV_FLAGS="${SAGE_VENV_FLAGS} --system-site-packages" dnl We want to raise an error if the user asked for "system site @@ -463,6 +471,7 @@ AC_ARG_ENABLE( with_system_python3="force" ]) ]) +AC_SUBST([SAGE_PIP_INSTALL_FLAGS]) AC_SUBST([SAGE_VENV_FLAGS]) SAGE_SPKG_OPTIONS="" From cfe441f4da54639ce480b24b58733a8c5c005f25 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 9 Nov 2021 21:01:58 -0500 Subject: [PATCH 205/423] Trac #29665: pass $SAGE_PIP_INSTALL_FLAGS to sdh_pip_install. Since sdh_pip_install is usually called from spkg-install.in, the variables from sage-build-env-config will be available. Here we pass the contents of $SAGE_PIP_INSTALL_FLAGS to sage-pip-install unconditionally, and hope that the user ignores this variable unless he truly knows what he is doing. --- build/bin/sage-dist-helpers | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/bin/sage-dist-helpers b/build/bin/sage-dist-helpers index 4eac9626ffa..67a2201d31f 100644 --- a/build/bin/sage-dist-helpers +++ b/build/bin/sage-dist-helpers @@ -325,7 +325,11 @@ sdh_store_wheel() { } sdh_store_and_pip_install_wheel() { - local pip_options="" + # The $SAGE_PIP_INSTALL_FLAGS variable is set by sage-build-env-config. + # We skip sanity checking its contents since you should either let sage + # decide what it contains, or really know what you are doing. + local pip_options="${SAGE_PIP_INSTALL_FLAGS}" + while [ $# -gt 0 ]; do case $1 in -*) pip_options="$pip_options $1" From 44907bb4f74a25086c1b192f0857f7bbfc0aa72c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 13:10:46 -0500 Subject: [PATCH 206/423] Trac #29665: add Gentoo package information for pexpect. --- build/pkgs/pexpect/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pexpect/distros/gentoo.txt diff --git a/build/pkgs/pexpect/distros/gentoo.txt b/build/pkgs/pexpect/distros/gentoo.txt new file mode 100644 index 00000000000..30c4b60d014 --- /dev/null +++ b/build/pkgs/pexpect/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/pexpect From 2d99751e06d31f383b3a02ecf3374ada34fe0d7a Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 13:11:25 -0500 Subject: [PATCH 207/423] Trac #29665: standard python spkg-configure.m4 for pexpect. --- build/pkgs/pexpect/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pexpect/spkg-configure.m4 diff --git a/build/pkgs/pexpect/spkg-configure.m4 b/build/pkgs/pexpect/spkg-configure.m4 new file mode 100644 index 00000000000..6520856fbb5 --- /dev/null +++ b/build/pkgs/pexpect/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([pexpect], [SAGE_PYTHON_PACKAGE_CHECK([pexpect])]) From c76212e3713a4468e6575afdeed42a6d61384984 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 13:12:05 -0500 Subject: [PATCH 208/423] Trac #29665: add Gentoo package information for docutils. --- build/pkgs/docutils/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/docutils/distros/gentoo.txt diff --git a/build/pkgs/docutils/distros/gentoo.txt b/build/pkgs/docutils/distros/gentoo.txt new file mode 100644 index 00000000000..fe4a4524cbb --- /dev/null +++ b/build/pkgs/docutils/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/docutils From 87345a121a32893c6c775beeb3434325d882407f Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 13:12:38 -0500 Subject: [PATCH 209/423] Trac #29665: standard python spkg-configure.m4 for docutils. --- build/pkgs/docutils/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/docutils/spkg-configure.m4 diff --git a/build/pkgs/docutils/spkg-configure.m4 b/build/pkgs/docutils/spkg-configure.m4 new file mode 100644 index 00000000000..3584e4513c6 --- /dev/null +++ b/build/pkgs/docutils/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([docutils], [SAGE_PYTHON_PACKAGE_CHECK([docutils])]) From 05a92098f7236a760fb436be1298516c31265419 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 13:14:37 -0500 Subject: [PATCH 210/423] Trac #29665: add Gentoo package information for nbclient. --- build/pkgs/nbclient/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/nbclient/distros/gentoo.txt diff --git a/build/pkgs/nbclient/distros/gentoo.txt b/build/pkgs/nbclient/distros/gentoo.txt new file mode 100644 index 00000000000..06ff18d206a --- /dev/null +++ b/build/pkgs/nbclient/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/nbclient From 019ecdc8d9d6dfed6e290c239599814b4e3e946c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 13:15:11 -0500 Subject: [PATCH 211/423] Trac #29665: standard python spkg-configure.m4 for nbclient. --- build/pkgs/nbclient/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/nbclient/spkg-configure.m4 diff --git a/build/pkgs/nbclient/spkg-configure.m4 b/build/pkgs/nbclient/spkg-configure.m4 new file mode 100644 index 00000000000..14178b793d2 --- /dev/null +++ b/build/pkgs/nbclient/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([nbclient], [SAGE_PYTHON_PACKAGE_CHECK([nbclient])]) From 5d0a8bd48be5089e4c2668effa2a0686967d849c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 13:17:36 -0500 Subject: [PATCH 212/423] Trac #29665: add Gentoo package information for argon2_cffi. --- build/pkgs/argon2_cffi/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/argon2_cffi/distros/gentoo.txt diff --git a/build/pkgs/argon2_cffi/distros/gentoo.txt b/build/pkgs/argon2_cffi/distros/gentoo.txt new file mode 100644 index 00000000000..2f12ca869e4 --- /dev/null +++ b/build/pkgs/argon2_cffi/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/argon2-cffi From b1ab86ecb41323808286fd0337172c007b5962ba Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 13:18:35 -0500 Subject: [PATCH 213/423] Trac #29665: standard python spkg-configure.m4 for argon2_cffi. --- build/pkgs/argon2_cffi/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/argon2_cffi/spkg-configure.m4 diff --git a/build/pkgs/argon2_cffi/spkg-configure.m4 b/build/pkgs/argon2_cffi/spkg-configure.m4 new file mode 100644 index 00000000000..03ebc634492 --- /dev/null +++ b/build/pkgs/argon2_cffi/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([argon2_cffi], [SAGE_PYTHON_PACKAGE_CHECK([argon2_cffi])]) From 7ced44684631cf4e6444dda10c8e5a119f1a9a5c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:30:48 -0500 Subject: [PATCH 214/423] Trac #29665: fix package name in dateutil's install-requires.txt. --- build/pkgs/dateutil/install-requires.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/dateutil/install-requires.txt b/build/pkgs/dateutil/install-requires.txt index 0ae93da485e..face537605d 100644 --- a/build/pkgs/dateutil/install-requires.txt +++ b/build/pkgs/dateutil/install-requires.txt @@ -1 +1 @@ -dateutil >=2.8.1 +python-dateutil >=2.8.1 From 69900e923ed2fd92a6ef0c816ca2ec147e0dbed0 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:31:41 -0500 Subject: [PATCH 215/423] Trac #29665: add Gentoo package information for dateutil. --- build/pkgs/dateutil/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/dateutil/distros/gentoo.txt diff --git a/build/pkgs/dateutil/distros/gentoo.txt b/build/pkgs/dateutil/distros/gentoo.txt new file mode 100644 index 00000000000..e129df768dc --- /dev/null +++ b/build/pkgs/dateutil/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/python-dateutil From 6100799e084febeaacdf903e43882fe4687e469e Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:32:21 -0500 Subject: [PATCH 216/423] Trac #29665: standard python spkg-configure.m4 for dateutil. --- build/pkgs/dateutil/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/dateutil/spkg-configure.m4 diff --git a/build/pkgs/dateutil/spkg-configure.m4 b/build/pkgs/dateutil/spkg-configure.m4 new file mode 100644 index 00000000000..fdcd1273975 --- /dev/null +++ b/build/pkgs/dateutil/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([dateutil], [SAGE_PYTHON_PACKAGE_CHECK([dateutil])]) From d8d7330c380a896e8a937bd91883065838c73c43 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:33:51 -0500 Subject: [PATCH 217/423] Trac #29665: add Gentoo package information for setuptools_scm. --- build/pkgs/setuptools_scm/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/setuptools_scm/distros/gentoo.txt diff --git a/build/pkgs/setuptools_scm/distros/gentoo.txt b/build/pkgs/setuptools_scm/distros/gentoo.txt new file mode 100644 index 00000000000..89895971525 --- /dev/null +++ b/build/pkgs/setuptools_scm/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/setuptools_scm From 30ea202589dcfeb486fc4cc6b42bb7ed0a86bf43 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:34:49 -0500 Subject: [PATCH 218/423] Trac #29665: standard python spkg-configure.m4 for setuptools_scm. --- build/pkgs/setuptools_scm/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/setuptools_scm/spkg-configure.m4 diff --git a/build/pkgs/setuptools_scm/spkg-configure.m4 b/build/pkgs/setuptools_scm/spkg-configure.m4 new file mode 100644 index 00000000000..437148c2a8f --- /dev/null +++ b/build/pkgs/setuptools_scm/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([setuptools_scm], [ + SAGE_PYTHON_PACKAGE_CHECK([setuptools_scm]) +]) From 98a6e07bbc52081555792bf8819226843de556b4 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:36:33 -0500 Subject: [PATCH 219/423] Trac #29665: add Gentoo package information for nbconvert. --- build/pkgs/nbconvert/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/nbconvert/distros/gentoo.txt diff --git a/build/pkgs/nbconvert/distros/gentoo.txt b/build/pkgs/nbconvert/distros/gentoo.txt new file mode 100644 index 00000000000..6c45a107368 --- /dev/null +++ b/build/pkgs/nbconvert/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/nbconvert From 33c3c92a84df661c6314b657a5a31ae5e2beab2e Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:37:37 -0500 Subject: [PATCH 220/423] Trac #29665: standard python spkg-configure.m4 for nbconvert. --- build/pkgs/nbconvert/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/nbconvert/spkg-configure.m4 diff --git a/build/pkgs/nbconvert/spkg-configure.m4 b/build/pkgs/nbconvert/spkg-configure.m4 new file mode 100644 index 00000000000..9b5dee3b8b5 --- /dev/null +++ b/build/pkgs/nbconvert/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([nbconvert], [SAGE_PYTHON_PACKAGE_CHECK([nbconvert])]) From 751fae2695fa34a9bd92a355f5733b7a5d9cb16f Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:41:51 -0500 Subject: [PATCH 221/423] Trac #29665: add Gentoo package information for jupyter_core. --- build/pkgs/jupyter_core/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/jupyter_core/distros/gentoo.txt diff --git a/build/pkgs/jupyter_core/distros/gentoo.txt b/build/pkgs/jupyter_core/distros/gentoo.txt new file mode 100644 index 00000000000..f168c5ad7ad --- /dev/null +++ b/build/pkgs/jupyter_core/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/jupyter_core From af04655eef16fa304250a307eb36c8861491de30 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:42:48 -0500 Subject: [PATCH 222/423] Trac #29665: standard python spkg-configure.m4 for jupyter_core. --- build/pkgs/jupyter_core/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/jupyter_core/spkg-configure.m4 diff --git a/build/pkgs/jupyter_core/spkg-configure.m4 b/build/pkgs/jupyter_core/spkg-configure.m4 new file mode 100644 index 00000000000..67df9c38b5b --- /dev/null +++ b/build/pkgs/jupyter_core/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([jupyter_core], [ + SAGE_PYTHON_PACKAGE_CHECK([jupyter_core]) +]) From 6a07c20c4f9ffb0aa6a982812528e7809f623356 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:47:08 -0500 Subject: [PATCH 223/423] Trac #29665: add Gentoo package information for jupyter_client. --- build/pkgs/jupyter_client/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/jupyter_client/distros/gentoo.txt diff --git a/build/pkgs/jupyter_client/distros/gentoo.txt b/build/pkgs/jupyter_client/distros/gentoo.txt new file mode 100644 index 00000000000..4f1de883ca1 --- /dev/null +++ b/build/pkgs/jupyter_client/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/jupyter_client From 15c5ad971714451fa7815a691776dbd33df26e79 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:48:04 -0500 Subject: [PATCH 224/423] Trac #29665: standard python spkg-configure.m4 for jupyter_client. --- build/pkgs/jupyter_client/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/jupyter_client/spkg-configure.m4 diff --git a/build/pkgs/jupyter_client/spkg-configure.m4 b/build/pkgs/jupyter_client/spkg-configure.m4 new file mode 100644 index 00000000000..fbd34982c14 --- /dev/null +++ b/build/pkgs/jupyter_client/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([jupyter_client], [ + SAGE_PYTHON_PACKAGE_CHECK([jupyter_client]) +]) From 39462765f7b71ba84885cc4618551aebd06b7d46 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:48:58 -0500 Subject: [PATCH 225/423] Trac #29665: add Gentoo package information for snowballstemmer. --- build/pkgs/snowballstemmer/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/snowballstemmer/distros/gentoo.txt diff --git a/build/pkgs/snowballstemmer/distros/gentoo.txt b/build/pkgs/snowballstemmer/distros/gentoo.txt new file mode 100644 index 00000000000..63fd8513221 --- /dev/null +++ b/build/pkgs/snowballstemmer/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/snowballstemmer From 1e48d6f47b3b72ecbf19404ee2b4d529d5962c6f Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:49:38 -0500 Subject: [PATCH 226/423] Trac #29665: standard python spkg-configure.m4 for snowballstemmer. --- build/pkgs/snowballstemmer/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/snowballstemmer/spkg-configure.m4 diff --git a/build/pkgs/snowballstemmer/spkg-configure.m4 b/build/pkgs/snowballstemmer/spkg-configure.m4 new file mode 100644 index 00000000000..6aa08825d39 --- /dev/null +++ b/build/pkgs/snowballstemmer/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([snowballstemmer], [ + SAGE_PYTHON_PACKAGE_CHECK([snowballstemmer]) +]) From 97e98ca54c325a80364e1cdc8a6b77c96fb25e33 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:50:47 -0500 Subject: [PATCH 227/423] Trac #29665: add Gentoo package information for tornado. --- build/pkgs/tornado/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/tornado/distros/gentoo.txt diff --git a/build/pkgs/tornado/distros/gentoo.txt b/build/pkgs/tornado/distros/gentoo.txt new file mode 100644 index 00000000000..6ae4b9fc443 --- /dev/null +++ b/build/pkgs/tornado/distros/gentoo.txt @@ -0,0 +1 @@ +www-servers/tornado From 373f7e224982b62d18929146a122fc14ce3db423 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:51:26 -0500 Subject: [PATCH 228/423] Trac #29665: standard python spkg-configure.m4 for tornado. --- build/pkgs/tornado/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/tornado/spkg-configure.m4 diff --git a/build/pkgs/tornado/spkg-configure.m4 b/build/pkgs/tornado/spkg-configure.m4 new file mode 100644 index 00000000000..1ee5bc9f544 --- /dev/null +++ b/build/pkgs/tornado/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([tornado], [SAGE_PYTHON_PACKAGE_CHECK([tornado])]) From bd485326bdc30ba5c65666b6adf3a24f2aa9d288 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:52:21 -0500 Subject: [PATCH 229/423] Trac #29665: add Gentoo package information for jsonschema. --- build/pkgs/jsonschema/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/jsonschema/distros/gentoo.txt diff --git a/build/pkgs/jsonschema/distros/gentoo.txt b/build/pkgs/jsonschema/distros/gentoo.txt new file mode 100644 index 00000000000..d708e4c9990 --- /dev/null +++ b/build/pkgs/jsonschema/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/jsonschema From 39452a93c32a05d73e5c4ed424874a69bffd3f91 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:54:03 -0500 Subject: [PATCH 230/423] Trac #29665: standard python spkg-configure.m4 for jsonschema. --- build/pkgs/jsonschema/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/jsonschema/spkg-configure.m4 diff --git a/build/pkgs/jsonschema/spkg-configure.m4 b/build/pkgs/jsonschema/spkg-configure.m4 new file mode 100644 index 00000000000..b9e5e216a3b --- /dev/null +++ b/build/pkgs/jsonschema/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([jsonschema], [SAGE_PYTHON_PACKAGE_CHECK([jsonschema])]) From 28afd2223241619c8d8d5012e94ad193bd7a3ad9 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:55:54 -0500 Subject: [PATCH 231/423] Trac #29665: standard python spkg-configure.m4 for widgetsnbextension. --- build/pkgs/widgetsnbextension/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/widgetsnbextension/spkg-configure.m4 diff --git a/build/pkgs/widgetsnbextension/spkg-configure.m4 b/build/pkgs/widgetsnbextension/spkg-configure.m4 new file mode 100644 index 00000000000..bf82dafe209 --- /dev/null +++ b/build/pkgs/widgetsnbextension/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([widgetsnbextension], [ + SAGE_PYTHON_PACKAGE_CHECK([widgetsnbextension]) +]) From 607cc41b282480c0e91f0eaf9022d262a5df0aea Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:57:20 -0500 Subject: [PATCH 232/423] Trac #29665: add Gentoo package information for importlib_resources. --- build/pkgs/importlib_resources/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/importlib_resources/distros/gentoo.txt diff --git a/build/pkgs/importlib_resources/distros/gentoo.txt b/build/pkgs/importlib_resources/distros/gentoo.txt new file mode 100644 index 00000000000..d5e1f2cf6a8 --- /dev/null +++ b/build/pkgs/importlib_resources/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/importlib_resources From d4e513d58662ed96f56c45ff63c86a2bbb10fd42 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:58:00 -0500 Subject: [PATCH 233/423] Trac #29665: standard python spkg-configure.m4 for importlib_resources. --- build/pkgs/importlib_resources/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/importlib_resources/spkg-configure.m4 diff --git a/build/pkgs/importlib_resources/spkg-configure.m4 b/build/pkgs/importlib_resources/spkg-configure.m4 new file mode 100644 index 00000000000..50df55b4643 --- /dev/null +++ b/build/pkgs/importlib_resources/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([importlib_resources], [ + SAGE_PYTHON_PACKAGE_CHECK([importlib_resources]) +]) From c37bdcf5c413f201299b26b7989bd4a6e078ba85 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:58:38 -0500 Subject: [PATCH 234/423] Trac #29665: add Gentoo package information for kiwisolver. --- build/pkgs/kiwisolver/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/kiwisolver/distros/gentoo.txt diff --git a/build/pkgs/kiwisolver/distros/gentoo.txt b/build/pkgs/kiwisolver/distros/gentoo.txt new file mode 100644 index 00000000000..7b30c9540ec --- /dev/null +++ b/build/pkgs/kiwisolver/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/kiwisolver From 14be0d4793cd902792c08698626653b0e77c4217 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 19:59:09 -0500 Subject: [PATCH 235/423] Trac #29665: standard python spkg-configure.m4 for kiwisolver. --- build/pkgs/kiwisolver/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/kiwisolver/spkg-configure.m4 diff --git a/build/pkgs/kiwisolver/spkg-configure.m4 b/build/pkgs/kiwisolver/spkg-configure.m4 new file mode 100644 index 00000000000..4e7ac97b57d --- /dev/null +++ b/build/pkgs/kiwisolver/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([kiwisolver], [SAGE_PYTHON_PACKAGE_CHECK([kiwisolver])]) From 2f2e2e9fd63d62dcc76823201b430ffaba14092d Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:00:04 -0500 Subject: [PATCH 236/423] Trac #29665: add Gentoo package information for notebook. --- build/pkgs/notebook/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/notebook/distros/gentoo.txt diff --git a/build/pkgs/notebook/distros/gentoo.txt b/build/pkgs/notebook/distros/gentoo.txt new file mode 100644 index 00000000000..6475d72541e --- /dev/null +++ b/build/pkgs/notebook/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/notebook From 9e1e9220f3f51425d375b4c25e21e2daf92223f7 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:01:42 -0500 Subject: [PATCH 237/423] Trac #29665: standard python spkg-configure.m4 for notebook. --- build/pkgs/notebook/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/notebook/spkg-configure.m4 diff --git a/build/pkgs/notebook/spkg-configure.m4 b/build/pkgs/notebook/spkg-configure.m4 new file mode 100644 index 00000000000..a17ba95eac6 --- /dev/null +++ b/build/pkgs/notebook/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([notebook], [SAGE_PYTHON_PACKAGE_CHECK([notebook])]) From 9e464585314a4c97a29e85354299f89f25a5fd01 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:02:38 -0500 Subject: [PATCH 238/423] Trac #29665: add Gentoo package information for matplotlib_inline. --- build/pkgs/matplotlib_inline/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/matplotlib_inline/distros/gentoo.txt diff --git a/build/pkgs/matplotlib_inline/distros/gentoo.txt b/build/pkgs/matplotlib_inline/distros/gentoo.txt new file mode 100644 index 00000000000..6a5859ca074 --- /dev/null +++ b/build/pkgs/matplotlib_inline/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/matplotlib-inline From 532cd92915f9376d3d2f43f0fb981065ec64ac0f Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:03:28 -0500 Subject: [PATCH 239/423] Trac #29665: standard python spkg-configure.m4 for matplotlib_inline. --- build/pkgs/matplotlib_inline/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/matplotlib_inline/spkg-configure.m4 diff --git a/build/pkgs/matplotlib_inline/spkg-configure.m4 b/build/pkgs/matplotlib_inline/spkg-configure.m4 new file mode 100644 index 00000000000..e59658ff159 --- /dev/null +++ b/build/pkgs/matplotlib_inline/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([matplotlib_inline], [ + SAGE_PYTHON_PACKAGE_CHECK([matplotlib_inline]) +]) From 22b8e7870ddb2068104c87bbc2fde8a0efa291f7 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:04:10 -0500 Subject: [PATCH 240/423] Trac #29665: add Gentoo package information for ipykernel. --- build/pkgs/ipykernel/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/ipykernel/distros/gentoo.txt diff --git a/build/pkgs/ipykernel/distros/gentoo.txt b/build/pkgs/ipykernel/distros/gentoo.txt new file mode 100644 index 00000000000..88aab61ef39 --- /dev/null +++ b/build/pkgs/ipykernel/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/ipykernel From 4385d14ab60355f9a9636da3cbaed494a0844e59 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:04:46 -0500 Subject: [PATCH 241/423] Trac #29665: standard python spkg-configure.m4 for ipykernel. --- build/pkgs/ipykernel/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/ipykernel/spkg-configure.m4 diff --git a/build/pkgs/ipykernel/spkg-configure.m4 b/build/pkgs/ipykernel/spkg-configure.m4 new file mode 100644 index 00000000000..94ecc2dcc4e --- /dev/null +++ b/build/pkgs/ipykernel/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([ipykernel], [SAGE_PYTHON_PACKAGE_CHECK([ipykernel])]) From 95bc155048b6fa63512cbcf8f5af9a0c47887b7d Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:05:26 -0500 Subject: [PATCH 242/423] Trac #29665: add Gentoo package information for prompt_toolkit. --- build/pkgs/prompt_toolkit/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/prompt_toolkit/distros/gentoo.txt diff --git a/build/pkgs/prompt_toolkit/distros/gentoo.txt b/build/pkgs/prompt_toolkit/distros/gentoo.txt new file mode 100644 index 00000000000..6902484e74c --- /dev/null +++ b/build/pkgs/prompt_toolkit/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/prompt_toolkit From 342a1b4caebdb1731feac3a92021a58cb0d65f35 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:10:39 -0500 Subject: [PATCH 243/423] Trac #29665: standard python spkg-configure.m4 for prompt_toolkit. --- build/pkgs/prompt_toolkit/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/prompt_toolkit/spkg-configure.m4 diff --git a/build/pkgs/prompt_toolkit/spkg-configure.m4 b/build/pkgs/prompt_toolkit/spkg-configure.m4 new file mode 100644 index 00000000000..fd8c1a67015 --- /dev/null +++ b/build/pkgs/prompt_toolkit/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([prompt_toolkit], [ + SAGE_PYTHON_PACKAGE_CHECK([prompt_toolkit]) +]) From f4d8ca5bd93555faa1f2df46859b6c6cd59d0cfe Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:12:10 -0500 Subject: [PATCH 244/423] Trac #29665: add Gentoo package information for charset_normalizer. --- build/pkgs/charset_normalizer/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/charset_normalizer/distros/gentoo.txt diff --git a/build/pkgs/charset_normalizer/distros/gentoo.txt b/build/pkgs/charset_normalizer/distros/gentoo.txt new file mode 100644 index 00000000000..eefeb89e31e --- /dev/null +++ b/build/pkgs/charset_normalizer/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/charset_normalizer From 2c3707a72aff3282ccf6fbd135bf71c89f19b5b8 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:12:54 -0500 Subject: [PATCH 245/423] Trac #29665: standard python spkg-configure.m4 for charset_normalizer. --- build/pkgs/charset_normalizer/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/charset_normalizer/spkg-configure.m4 diff --git a/build/pkgs/charset_normalizer/spkg-configure.m4 b/build/pkgs/charset_normalizer/spkg-configure.m4 new file mode 100644 index 00000000000..18b18cf32b4 --- /dev/null +++ b/build/pkgs/charset_normalizer/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([charset_normalizer], [ + SAGE_PYTHON_PACKAGE_CHECK([charset_normalizer]) +]) From 66b3bf0f7b7b091afd5092b31b91da686f630edb Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:13:37 -0500 Subject: [PATCH 246/423] Trac #29665: add Gentoo package information for prometheus_client. --- build/pkgs/prometheus_client/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/prometheus_client/distros/gentoo.txt diff --git a/build/pkgs/prometheus_client/distros/gentoo.txt b/build/pkgs/prometheus_client/distros/gentoo.txt new file mode 100644 index 00000000000..aa2889c913e --- /dev/null +++ b/build/pkgs/prometheus_client/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/prometheus_client From c1930d07551ac73336a6ace6df46c0e81d190258 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:15:09 -0500 Subject: [PATCH 247/423] Trac #29665: standard python spkg-configure.m4 for prometheus_client. --- build/pkgs/prometheus_client/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/prometheus_client/spkg-configure.m4 diff --git a/build/pkgs/prometheus_client/spkg-configure.m4 b/build/pkgs/prometheus_client/spkg-configure.m4 new file mode 100644 index 00000000000..b4945889131 --- /dev/null +++ b/build/pkgs/prometheus_client/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([prometheus_client], [ + SAGE_PYTHON_PACKAGE_CHECK([prometheus_client]) +]) From 8089c92e0cd571471473d18056bc668cd1ade1d2 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:17:23 -0500 Subject: [PATCH 248/423] Trac #29665: add Gentoo package information for pybind11. --- build/pkgs/pybind11/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pybind11/distros/gentoo.txt diff --git a/build/pkgs/pybind11/distros/gentoo.txt b/build/pkgs/pybind11/distros/gentoo.txt new file mode 100644 index 00000000000..0c500b3c84d --- /dev/null +++ b/build/pkgs/pybind11/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/pybind11 From 251b381025e9838efcf3fe6874cf05a49e636e64 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:17:51 -0500 Subject: [PATCH 249/423] Trac #29665: standard python spkg-configure.m4 for pybind11. --- build/pkgs/pybind11/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pybind11/spkg-configure.m4 diff --git a/build/pkgs/pybind11/spkg-configure.m4 b/build/pkgs/pybind11/spkg-configure.m4 new file mode 100644 index 00000000000..cce1cf5cff8 --- /dev/null +++ b/build/pkgs/pybind11/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([pybind11], [SAGE_PYTHON_PACKAGE_CHECK([pybind11])]) From ecad13c8da95099364736cac44c14aa08ea4f395 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:19:23 -0500 Subject: [PATCH 250/423] Trac #29665: add Gentoo package information for pkgconfig. --- build/pkgs/pkgconfig/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pkgconfig/distros/gentoo.txt diff --git a/build/pkgs/pkgconfig/distros/gentoo.txt b/build/pkgs/pkgconfig/distros/gentoo.txt new file mode 100644 index 00000000000..32e86187155 --- /dev/null +++ b/build/pkgs/pkgconfig/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/pkgconfig From 9036a5eada0d45f4b588b8b15fa16142d0c58890 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:19:54 -0500 Subject: [PATCH 251/423] Trac #29665: standard python spkg-configure.m4 for pkgconfig. --- build/pkgs/pkgconfig/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pkgconfig/spkg-configure.m4 diff --git a/build/pkgs/pkgconfig/spkg-configure.m4 b/build/pkgs/pkgconfig/spkg-configure.m4 new file mode 100644 index 00000000000..67082934525 --- /dev/null +++ b/build/pkgs/pkgconfig/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([pkgconfig], [SAGE_PYTHON_PACKAGE_CHECK([pkgconfig])]) From 028e48a21bc6398c629c4662214ecd01cd1d67b3 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:21:10 -0500 Subject: [PATCH 252/423] Trac #29665: add Gentoo package information for sphinxcontrib_serializinghtml. --- build/pkgs/sphinxcontrib_serializinghtml/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/sphinxcontrib_serializinghtml/distros/gentoo.txt diff --git a/build/pkgs/sphinxcontrib_serializinghtml/distros/gentoo.txt b/build/pkgs/sphinxcontrib_serializinghtml/distros/gentoo.txt new file mode 100644 index 00000000000..38bca8f1dcb --- /dev/null +++ b/build/pkgs/sphinxcontrib_serializinghtml/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/sphinxcontrib-serializinghtml From 0eeedf4a76c55fba43a980e687ef4cc6d86d7cd8 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:21:54 -0500 Subject: [PATCH 253/423] Trac #29665: standard python spkg-configure.m4 for sphinxcontrib_serializinghtml. --- build/pkgs/sphinxcontrib_serializinghtml/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/sphinxcontrib_serializinghtml/spkg-configure.m4 diff --git a/build/pkgs/sphinxcontrib_serializinghtml/spkg-configure.m4 b/build/pkgs/sphinxcontrib_serializinghtml/spkg-configure.m4 new file mode 100644 index 00000000000..be8e62555ac --- /dev/null +++ b/build/pkgs/sphinxcontrib_serializinghtml/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([sphinxcontrib_serializinghtml], [ + SAGE_PYTHON_PACKAGE_CHECK([sphinxcontrib_serializinghtml]) +]) From 0743475de2c3919aba374f1920e130448bb52d04 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:22:54 -0500 Subject: [PATCH 254/423] Trac #29665: add Gentoo package information for sphinxcontrib_jsmath. --- build/pkgs/sphinxcontrib_jsmath/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/sphinxcontrib_jsmath/distros/gentoo.txt diff --git a/build/pkgs/sphinxcontrib_jsmath/distros/gentoo.txt b/build/pkgs/sphinxcontrib_jsmath/distros/gentoo.txt new file mode 100644 index 00000000000..041a4710e66 --- /dev/null +++ b/build/pkgs/sphinxcontrib_jsmath/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/sphinxcontrib-jsmath From bfb3ec22f3f58ac25b3ddc01b336210859e9eb1e Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:23:49 -0500 Subject: [PATCH 255/423] Trac #29665: standard python spkg-configure.m4 for sphinxcontrib_jsmath. --- build/pkgs/sphinxcontrib_jsmath/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/sphinxcontrib_jsmath/spkg-configure.m4 diff --git a/build/pkgs/sphinxcontrib_jsmath/spkg-configure.m4 b/build/pkgs/sphinxcontrib_jsmath/spkg-configure.m4 new file mode 100644 index 00000000000..e46bde2bd9d --- /dev/null +++ b/build/pkgs/sphinxcontrib_jsmath/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([sphinxcontrib_jsmath], [ + SAGE_PYTHON_PACKAGE_CHECK([sphinxcontrib_jsmath]) +]) From 1d82256c89966ccefd04ef579e696d5ca921fb56 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:24:26 -0500 Subject: [PATCH 256/423] Trac #29665: add Gentoo package information for sphinxcontrib_devhelp. --- build/pkgs/sphinxcontrib_devhelp/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/sphinxcontrib_devhelp/distros/gentoo.txt diff --git a/build/pkgs/sphinxcontrib_devhelp/distros/gentoo.txt b/build/pkgs/sphinxcontrib_devhelp/distros/gentoo.txt new file mode 100644 index 00000000000..9b5c899a706 --- /dev/null +++ b/build/pkgs/sphinxcontrib_devhelp/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/sphinxcontrib-devhelp From 7317583856b4893bb1544fc83cb242848576605a Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:25:04 -0500 Subject: [PATCH 257/423] Trac #29665: standard python spkg-configure.m4 for sphinxcontrib_devhelp. --- build/pkgs/sphinxcontrib_devhelp/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/sphinxcontrib_devhelp/spkg-configure.m4 diff --git a/build/pkgs/sphinxcontrib_devhelp/spkg-configure.m4 b/build/pkgs/sphinxcontrib_devhelp/spkg-configure.m4 new file mode 100644 index 00000000000..8728136e92e --- /dev/null +++ b/build/pkgs/sphinxcontrib_devhelp/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([sphinxcontrib_devhelp], [ + SAGE_PYTHON_PACKAGE_CHECK([sphinxcontrib_devhelp]) +]) From 223a9806e0f6383f0e4d9f0c39849c656d53863c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:25:53 -0500 Subject: [PATCH 258/423] Trac #29665: add Gentoo package information for sphinxcontrib_qthelp. --- build/pkgs/sphinxcontrib_qthelp/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/sphinxcontrib_qthelp/distros/gentoo.txt diff --git a/build/pkgs/sphinxcontrib_qthelp/distros/gentoo.txt b/build/pkgs/sphinxcontrib_qthelp/distros/gentoo.txt new file mode 100644 index 00000000000..7210099b087 --- /dev/null +++ b/build/pkgs/sphinxcontrib_qthelp/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/sphinxcontrib-qthelp From 998f5b31a75537b629121e3cc824170f44c7d1bd Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:26:28 -0500 Subject: [PATCH 259/423] Trac #29665: standard python spkg-configure.m4 for sphinxcontrib_qthelp. --- build/pkgs/sphinxcontrib_qthelp/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/sphinxcontrib_qthelp/spkg-configure.m4 diff --git a/build/pkgs/sphinxcontrib_qthelp/spkg-configure.m4 b/build/pkgs/sphinxcontrib_qthelp/spkg-configure.m4 new file mode 100644 index 00000000000..81ea5e1269f --- /dev/null +++ b/build/pkgs/sphinxcontrib_qthelp/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([sphinxcontrib_qthelp], [ + SAGE_PYTHON_PACKAGE_CHECK([sphinxcontrib_qthelp]) +]) From 477e3e339e76e74a46689f6a18a69ca81e76acda Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:26:54 -0500 Subject: [PATCH 260/423] Trac #29665: add Gentoo package information for sphinxcontrib_applehelp. --- build/pkgs/sphinxcontrib_applehelp/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/sphinxcontrib_applehelp/distros/gentoo.txt diff --git a/build/pkgs/sphinxcontrib_applehelp/distros/gentoo.txt b/build/pkgs/sphinxcontrib_applehelp/distros/gentoo.txt new file mode 100644 index 00000000000..66ac8da7340 --- /dev/null +++ b/build/pkgs/sphinxcontrib_applehelp/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/sphinxcontrib-applehelp From d4f1faadcd2c1ddd5a0494a8e6610f3acbffe7c7 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:27:19 -0500 Subject: [PATCH 261/423] Trac #29665: standard python spkg-configure.m4 for sphinxcontrib_applehelp. --- build/pkgs/sphinxcontrib_applehelp/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/sphinxcontrib_applehelp/spkg-configure.m4 diff --git a/build/pkgs/sphinxcontrib_applehelp/spkg-configure.m4 b/build/pkgs/sphinxcontrib_applehelp/spkg-configure.m4 new file mode 100644 index 00000000000..e834aed8fd8 --- /dev/null +++ b/build/pkgs/sphinxcontrib_applehelp/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([sphinxcontrib_applehelp], [ + SAGE_PYTHON_PACKAGE_CHECK([sphinxcontrib_applehelp]) +]) From 8698129ed0cd8dd3a56ce8951bb83266cd155d17 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:27:46 -0500 Subject: [PATCH 262/423] Trac #29665: add Gentoo package information for sphinxcontrib_htmlhelp. --- build/pkgs/sphinxcontrib_htmlhelp/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/sphinxcontrib_htmlhelp/distros/gentoo.txt diff --git a/build/pkgs/sphinxcontrib_htmlhelp/distros/gentoo.txt b/build/pkgs/sphinxcontrib_htmlhelp/distros/gentoo.txt new file mode 100644 index 00000000000..e080bacf8ba --- /dev/null +++ b/build/pkgs/sphinxcontrib_htmlhelp/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/sphinxcontrib-htmlhelp From ab239f6316ab99bfe125ee36d2fdfddb6a18229f Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:29:18 -0500 Subject: [PATCH 263/423] Trac #29665: standard python spkg-configure.m4 for sphinxcontrib_htmlhelp. --- build/pkgs/sphinxcontrib_htmlhelp/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/sphinxcontrib_htmlhelp/spkg-configure.m4 diff --git a/build/pkgs/sphinxcontrib_htmlhelp/spkg-configure.m4 b/build/pkgs/sphinxcontrib_htmlhelp/spkg-configure.m4 new file mode 100644 index 00000000000..c77b003dc37 --- /dev/null +++ b/build/pkgs/sphinxcontrib_htmlhelp/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([sphinxcontrib_htmlhelp], [ + SAGE_PYTHON_PACKAGE_CHECK([sphinxcontrib_htmlhelp]) +]) From 7b1aa03b95696f1d2de9e41fb95a3cf35ba7c63b Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:30:23 -0500 Subject: [PATCH 264/423] Trac #29665: add Gentoo package information for jupyterlab_pygments. --- build/pkgs/jupyterlab_pygments/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/jupyterlab_pygments/distros/gentoo.txt diff --git a/build/pkgs/jupyterlab_pygments/distros/gentoo.txt b/build/pkgs/jupyterlab_pygments/distros/gentoo.txt new file mode 100644 index 00000000000..c57b4f13403 --- /dev/null +++ b/build/pkgs/jupyterlab_pygments/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/jupyterlab_pygments From 7ba34034bb87ea443d2a0e6870506cf65a596346 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Nov 2021 20:31:13 -0500 Subject: [PATCH 265/423] Trac #29665: standard python spkg-configure.m4 for jupyterlab_pygments. --- build/pkgs/jupyterlab_pygments/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/jupyterlab_pygments/spkg-configure.m4 diff --git a/build/pkgs/jupyterlab_pygments/spkg-configure.m4 b/build/pkgs/jupyterlab_pygments/spkg-configure.m4 new file mode 100644 index 00000000000..e46e21f461e --- /dev/null +++ b/build/pkgs/jupyterlab_pygments/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([jupyterlab_pygments], [ + SAGE_PYTHON_PACKAGE_CHECK([jupyterlab_pygments]) +]) From dfa9cbf87c201c7857cd1a510f6401f0963c7567 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 30 Dec 2021 20:29:15 -0500 Subject: [PATCH 266/423] Trac #29665: standard python spkg-configure.m4 for ply. --- build/pkgs/ply/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/ply/spkg-configure.m4 diff --git a/build/pkgs/ply/spkg-configure.m4 b/build/pkgs/ply/spkg-configure.m4 new file mode 100644 index 00000000000..ffb0030d013 --- /dev/null +++ b/build/pkgs/ply/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([ply], [SAGE_PYTHON_PACKAGE_CHECK([ply])]) From c99e9faf5647216a2611203e4db32a53d33f7c03 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 30 Dec 2021 20:29:51 -0500 Subject: [PATCH 267/423] Trac #29665: add Gentoo package information for ply. --- build/pkgs/ply/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/ply/distros/gentoo.txt diff --git a/build/pkgs/ply/distros/gentoo.txt b/build/pkgs/ply/distros/gentoo.txt new file mode 100644 index 00000000000..c8b16309b09 --- /dev/null +++ b/build/pkgs/ply/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/ply From 3b2805b0f3beb58dca93eba3606f9b7915ea4efa Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 30 Dec 2021 20:30:33 -0500 Subject: [PATCH 268/423] Trac #29665: standard python spkg-configure.m4 for gast. --- build/pkgs/gast/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/gast/spkg-configure.m4 diff --git a/build/pkgs/gast/spkg-configure.m4 b/build/pkgs/gast/spkg-configure.m4 new file mode 100644 index 00000000000..26ec59feaee --- /dev/null +++ b/build/pkgs/gast/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([gast], [SAGE_PYTHON_PACKAGE_CHECK([gast])]) From 958367b7c55cf41f7105b3e9297891b03e0505c8 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 30 Dec 2021 20:31:15 -0500 Subject: [PATCH 269/423] Trac #29665: add Gentoo package information for gast. --- build/pkgs/gast/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/gast/distros/gentoo.txt diff --git a/build/pkgs/gast/distros/gentoo.txt b/build/pkgs/gast/distros/gentoo.txt new file mode 100644 index 00000000000..3be5e7e785c --- /dev/null +++ b/build/pkgs/gast/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/gast From 5060d45170f3dba6c2968794089cdc384103730b Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 30 Dec 2021 20:32:20 -0500 Subject: [PATCH 270/423] Trac #29665: standard python spkg-configure.m4 for pythran. --- build/pkgs/pythran/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pythran/spkg-configure.m4 diff --git a/build/pkgs/pythran/spkg-configure.m4 b/build/pkgs/pythran/spkg-configure.m4 new file mode 100644 index 00000000000..592e95bcb3d --- /dev/null +++ b/build/pkgs/pythran/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([pythran], [SAGE_PYTHON_PACKAGE_CHECK([pythran])]) From 728d207b91a1108a137164b78a4e141a53cf8605 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 30 Dec 2021 20:32:55 -0500 Subject: [PATCH 271/423] Trac #29665: add Gentoo package information for pythran. --- build/pkgs/pythran/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/pythran/distros/gentoo.txt diff --git a/build/pkgs/pythran/distros/gentoo.txt b/build/pkgs/pythran/distros/gentoo.txt new file mode 100644 index 00000000000..1bb7cdcd4eb --- /dev/null +++ b/build/pkgs/pythran/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/pythran From 284caa41841a793291ca25ff70e04681e19b4551 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 30 Dec 2021 20:33:50 -0500 Subject: [PATCH 272/423] Trac #29665: standard python spkg-configure.m4 for beniget. --- build/pkgs/beniget/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/beniget/spkg-configure.m4 diff --git a/build/pkgs/beniget/spkg-configure.m4 b/build/pkgs/beniget/spkg-configure.m4 new file mode 100644 index 00000000000..8ae6101333e --- /dev/null +++ b/build/pkgs/beniget/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([beniget], [SAGE_PYTHON_PACKAGE_CHECK([beniget])]) From b0ae5fa287126a65d82f9abd02cfef46d3848aef Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 30 Dec 2021 20:34:22 -0500 Subject: [PATCH 273/423] Trac #29665: add Gentoo package information for beniget. --- build/pkgs/beniget/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/beniget/distros/gentoo.txt diff --git a/build/pkgs/beniget/distros/gentoo.txt b/build/pkgs/beniget/distros/gentoo.txt new file mode 100644 index 00000000000..1a5972cd23f --- /dev/null +++ b/build/pkgs/beniget/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/beniget From e9530c488491bcd69aefc7ca0185fafe3ad04cf4 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 30 Dec 2021 20:35:37 -0500 Subject: [PATCH 274/423] Trac #29665: standard python spkg-configure.m4 for alabaster. --- build/pkgs/alabaster/spkg-configure.m4 | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/alabaster/spkg-configure.m4 diff --git a/build/pkgs/alabaster/spkg-configure.m4 b/build/pkgs/alabaster/spkg-configure.m4 new file mode 100644 index 00000000000..4eca6e05a5f --- /dev/null +++ b/build/pkgs/alabaster/spkg-configure.m4 @@ -0,0 +1 @@ +SAGE_SPKG_CONFIGURE([alabaster], [SAGE_PYTHON_PACKAGE_CHECK([alabaster])]) From a2262c59cab3da3d2152229879c81296ee7ec525 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 30 Dec 2021 20:36:06 -0500 Subject: [PATCH 275/423] Trac #29665: add Gentoo package information for alabaster. --- build/pkgs/alabaster/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/alabaster/distros/gentoo.txt diff --git a/build/pkgs/alabaster/distros/gentoo.txt b/build/pkgs/alabaster/distros/gentoo.txt new file mode 100644 index 00000000000..cffece61b27 --- /dev/null +++ b/build/pkgs/alabaster/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/alabaster From 2cbead4861a791da0cbbba1d08ab70b443af07c5 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 30 Dec 2021 20:43:59 -0500 Subject: [PATCH 276/423] Trac #29665: standard python spkg-configure.m4 for importlib_metadata. --- build/pkgs/importlib_metadata/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build/pkgs/importlib_metadata/spkg-configure.m4 diff --git a/build/pkgs/importlib_metadata/spkg-configure.m4 b/build/pkgs/importlib_metadata/spkg-configure.m4 new file mode 100644 index 00000000000..0554e522252 --- /dev/null +++ b/build/pkgs/importlib_metadata/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([importlib_metadata], [ + SAGE_PYTHON_PACKAGE_CHECK([importlib_metadata]) +]) From a8a154470822fb701dd9d8ae038c695ebaced2cb Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 30 Dec 2021 20:44:28 -0500 Subject: [PATCH 277/423] Trac #29665: add Gentoo package information for importlib_metadata. --- build/pkgs/importlib_metadata/distros/gentoo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/importlib_metadata/distros/gentoo.txt diff --git a/build/pkgs/importlib_metadata/distros/gentoo.txt b/build/pkgs/importlib_metadata/distros/gentoo.txt new file mode 100644 index 00000000000..4f927864c2b --- /dev/null +++ b/build/pkgs/importlib_metadata/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/importlib_metadata From 5c60ddf026059ee52bde7720453f40e31cee64fe Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 25 Aug 2023 01:51:31 -0400 Subject: [PATCH 278/423] m4/sage_python_package_check.m4: update pkg_resources import The pkg_resources module is now imported with, import pkg_resources instead of import setuptools.version.pkg_resources --- m4/sage_python_package_check.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m4/sage_python_package_check.m4 b/m4/sage_python_package_check.m4 index 5547b35a71f..e0713512ea0 100644 --- a/m4/sage_python_package_check.m4 +++ b/m4/sage_python_package_check.m4 @@ -77,7 +77,7 @@ AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [ AS_IF( [PYTHONUSERBASE="${PYTHONUSERBASE}" config.venv/bin/python3 -c dnl - "from setuptools.version import pkg_resources; dnl + "import pkg_resources; dnl pkg_resources.require('${SAGE_PKG_VERSPEC}'.splitlines())" dnl 2>&AS_MESSAGE_LOG_FD], [AC_MSG_RESULT(yes)], From d87feed8f8ecf975bffe1184594a921a9317beb1 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 25 Aug 2023 02:36:55 -0400 Subject: [PATCH 279/423] build/pkgs/pip/distros/gentoo.txt: drop USE=vanilla requirement --- build/pkgs/pip/distros/gentoo.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/pip/distros/gentoo.txt b/build/pkgs/pip/distros/gentoo.txt index 1845454d6de..793fb731829 100644 --- a/build/pkgs/pip/distros/gentoo.txt +++ b/build/pkgs/pip/distros/gentoo.txt @@ -1 +1 @@ -dev-python/pip[vanilla] +dev-python/pip From 3cd6cb69ed457889b93fb71e0aea75ad060c786d Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 25 Aug 2023 08:04:26 -0400 Subject: [PATCH 280/423] build/pkgs/ipython/install-requires.txt: reject =7.13.0 +ipython >=7.13.0, <8.11.0 From 0f07a78e6472b19c9436669376653264e2cccb1e Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 26 Aug 2023 20:17:05 -0400 Subject: [PATCH 281/423] configure.ac: set/subst a variable for --enable-system-site-packages We now set ENABLE_SYSTEM_SITE_PACKAGES=yes and call AC_SUBST on it when --enable-system-site-packages was passed to ./configure. This will let us reference it in the build scripts that list available system packages. --- configure.ac | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index fad8d00829a..26515d45839 100644 --- a/configure.ac +++ b/configure.ac @@ -469,8 +469,13 @@ AC_ARG_ENABLE( dnl their system python packages and who may not be paying close dnl attention to their ./configure output. with_system_python3="force" + + dnl This is substituted in to build/bin/sage-build-env-config.in for use + dnl by build/bin/sage-get-system-packages + ENABLE_SYSTEM_SITE_PACKAGES=yes ]) ]) +AC_SUBST([ENABLE_SYSTEM_SITE_PACKAGES]) AC_SUBST([SAGE_PIP_INSTALL_FLAGS]) AC_SUBST([SAGE_VENV_FLAGS]) From b68a4d55aa115773957cb2e37639fcd9afba2b99 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 26 Aug 2023 20:19:22 -0400 Subject: [PATCH 282/423] build/bin/sage-build-env-config.in: export ENABLE_SYSTEM_SITE_PACKAGES This variable is set in configure.ac when --enable-system-site-packages was passed to ./configure. Having it in the build config allows us to prune the list of system packages based on that ./configure flag. --- build/bin/sage-build-env-config.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/bin/sage-build-env-config.in b/build/bin/sage-build-env-config.in index df27cff4660..b2f59343d25 100644 --- a/build/bin/sage-build-env-config.in +++ b/build/bin/sage-build-env-config.in @@ -60,3 +60,5 @@ export SAGE_CONFIGURE_FFLAS_FFPACK="@SAGE_CONFIGURE_FFLAS_FFPACK@" export CONFIGURED_SAGE_EDITABLE="@SAGE_EDITABLE@" export CONFIGURED_SAGE_WHEELS="@SAGE_WHEELS@" + +export ENABLE_SYSTEM_SITE_PACKAGES="@ENABLE_SYSTEM_SITE_PACKAGES@" From 174def6e458e69b9e22ab47b929e8164be46a750 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 26 Aug 2023 20:21:22 -0400 Subject: [PATCH 283/423] build/bin/sage-get-system-packages: optionally skip python packages Packages calling SAGE_PYTHON_PACKAGE_CHECK in spkg-configure.m4 are python packages whose detection is enabled by passing the --enable-system-site-packages flag to ./configure. But when the flag is NOT passed, we don't want to list the corresponding packages in the output of sage-get-system-packages. This commit checks for the presence of such an spkg-configure.m4 file and filters those packages according to the ENABLE_SYSTEM_SITE_PACKAGES variable. --- build/bin/sage-get-system-packages | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/build/bin/sage-get-system-packages b/build/bin/sage-get-system-packages index c51c36ceab9..ffb3d339f98 100755 --- a/build/bin/sage-get-system-packages +++ b/build/bin/sage-get-system-packages @@ -1,4 +1,5 @@ #!/bin/sh + SYSTEM=$1 if [ -z "$SYSTEM" ]; then echo >&2 "usage: $0 {auto|debian|arch|conda|pip|...} SPKGS..." @@ -10,6 +11,12 @@ SPKGS="$*" if [ -z "$SAGE_ROOT" ]; then SAGE_ROOT=`pwd` fi + +# We source sage-build-env-config because we need to know if +# --enable-system-site-packages was passed to ./configure. +# (If not, we want to hide those packages.) +. "${SAGE_ROOT}/build/bin/sage-build-env-config" + case "$SYSTEM" in install-requires) # Collect install-requires.txt (falling back to requirements.txt) and output it in the format @@ -44,6 +51,17 @@ case "$SYSTEM" in ;; esac for PKG_BASE in $SPKGS; do + + # Skip this package if it uses the SAGE_PYTHON_PACKAGE_CHECK + # macro and if --enable-system-site-packages was NOT passed + # to ./configure. + SPKG_CONFIGURE="${SAGE_ROOT}/build/pkgs/${PKG_BASE}/spkg-configure.m4" + if grep -q SAGE_PYTHON_PACKAGE_CHECK "${SPKG_CONFIGURE}" 2>/dev/null; then + if [ -z "${ENABLE_SYSTEM_SITE_PACKAGES}" ]; then + continue; + fi + fi + for NAME in $SYSTEM_PACKAGES_FILE_NAMES; do SYSTEM_PACKAGES_FILE="$SAGE_ROOT"/build/pkgs/$PKG_BASE/$NAME if [ -f $SYSTEM_PACKAGES_FILE ]; then From d2360b3b7a06991be6ec5b90d1172a39637a634a Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 26 Aug 2023 22:58:04 -0400 Subject: [PATCH 284/423] build/bin/write-dockerfile.sh: refactor using sage-get-system-packages This avoids duplicating the check for ENABLE_SYSTEM_SITE_PACKAGES. --- build/bin/write-dockerfile.sh | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/build/bin/write-dockerfile.sh b/build/bin/write-dockerfile.sh index 14cbaf786eb..2c705f842c6 100755 --- a/build/bin/write-dockerfile.sh +++ b/build/bin/write-dockerfile.sh @@ -5,7 +5,7 @@ set -e SYSTEM="${1:-debian}" shopt -s extglob -SAGE_PACKAGE_LIST_ARGS="${2:- --has-file=spkg-configure.m4 :standard:}" +SAGE_PACKAGE_LIST_ARGS="${2:-:standard:}" WITH_SYSTEM_SPKG="${3:-yes}" IGNORE_MISSING_SYSTEM_PACKAGES="${4:-no}" EXTRA_SAGE_PACKAGES="${5:-_bootstrap}" @@ -15,17 +15,14 @@ SAGE_ROOT=. export PATH="$SAGE_ROOT"/build/bin:$PATH SYSTEM_PACKAGES=$EXTRA_SYSTEM_PACKAGES CONFIGURE_ARGS="--enable-option-checking " -for PKG_BASE in $(sage-package list --has-file=distros/$SYSTEM.txt $SAGE_PACKAGE_LIST_ARGS) $EXTRA_SAGE_PACKAGES; do - PKG_SCRIPTS="$SAGE_ROOT"/build/pkgs/$PKG_BASE - if [ -d $PKG_SCRIPTS ]; then - SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/distros/$SYSTEM.txt - PKG_SYSTEM_PACKAGES=$(echo $(${STRIP_COMMENTS} $SYSTEM_PACKAGES_FILE)) - if [ -n "PKG_SYSTEM_PACKAGES" ]; then - SYSTEM_PACKAGES+=" $PKG_SYSTEM_PACKAGES" - if [ -f $PKG_SCRIPTS/spkg-configure.m4 ]; then - CONFIGURE_ARGS+="--with-system-$PKG_BASE=${WITH_SYSTEM_SPKG} " - fi - fi +for SPKG in $(sage-package list $SAGE_PACKAGE_LIST_ARGS) $EXTRA_SAGE_PACKAGES; do + SYSTEM_PACKAGE=$(sage-get-system-packages $SYSTEM $SPKG) + if [ -n "${SYSTEM_PACKAGE}" ]; then + # SYSTEM_PACKAGE can be empty if, for example, it corresponds + # to a python package and --enable-system-site-packages was + # not passed to ./configure. + SYSTEM_PACKAGES+=" ${SYSTEM_PACKAGE}" + CONFIGURE_ARGS+="--with-system-${SPKG}=${WITH_SYSTEM_SPKG} " fi done echo "# Automatically generated by SAGE_ROOT/build/bin/write-dockerfile.sh" From f8f6a80613799bdf85ac0d4fb227d00314dea790 Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Sun, 27 Aug 2023 09:29:42 +0100 Subject: [PATCH 285/423] lb version in install-requires.txt for flit --- build/pkgs/flit_core/install-requires.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/flit_core/install-requires.txt b/build/pkgs/flit_core/install-requires.txt index 14ccfd92035..88b912bf11a 100644 --- a/build/pkgs/flit_core/install-requires.txt +++ b/build/pkgs/flit_core/install-requires.txt @@ -1 +1 @@ -flit-core +flit-core >= 3.7.1 From 1c1000ad85b49195471f4922ccc02264cc6131e7 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 27 Aug 2023 08:50:13 -0400 Subject: [PATCH 286/423] build/bin/write-dockerfile.sh: don't mention --enable-system-site-packages Since this script can be invoked outside of a sage environment, we mention the environment variable ENABLE_SYSTEM_SITE_PACKAGES instead. --- build/bin/write-dockerfile.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build/bin/write-dockerfile.sh b/build/bin/write-dockerfile.sh index 2c705f842c6..74006a314ae 100755 --- a/build/bin/write-dockerfile.sh +++ b/build/bin/write-dockerfile.sh @@ -18,9 +18,8 @@ CONFIGURE_ARGS="--enable-option-checking " for SPKG in $(sage-package list $SAGE_PACKAGE_LIST_ARGS) $EXTRA_SAGE_PACKAGES; do SYSTEM_PACKAGE=$(sage-get-system-packages $SYSTEM $SPKG) if [ -n "${SYSTEM_PACKAGE}" ]; then - # SYSTEM_PACKAGE can be empty if, for example, it corresponds - # to a python package and --enable-system-site-packages was - # not passed to ./configure. + # SYSTEM_PACKAGE can be empty if, for example, the environment + # variable ENABLE_SYSTEM_SITE_PACKAGES is empty. SYSTEM_PACKAGES+=" ${SYSTEM_PACKAGE}" CONFIGURE_ARGS+="--with-system-${SPKG}=${WITH_SYSTEM_SPKG} " fi From 5eafbaa04ffc858c1e1a714c3b8dff8ceffe41e9 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 27 Aug 2023 08:51:13 -0400 Subject: [PATCH 287/423] build/bin/write-dockerfile.sh: skip packages without spkg-configure.m4 We can't add --with-system-foo if foo doesn't have an spkg-configure.m4 file. --- build/bin/write-dockerfile.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/bin/write-dockerfile.sh b/build/bin/write-dockerfile.sh index 74006a314ae..85b51245b29 100755 --- a/build/bin/write-dockerfile.sh +++ b/build/bin/write-dockerfile.sh @@ -15,7 +15,7 @@ SAGE_ROOT=. export PATH="$SAGE_ROOT"/build/bin:$PATH SYSTEM_PACKAGES=$EXTRA_SYSTEM_PACKAGES CONFIGURE_ARGS="--enable-option-checking " -for SPKG in $(sage-package list $SAGE_PACKAGE_LIST_ARGS) $EXTRA_SAGE_PACKAGES; do +for SPKG in $(sage-package list --has-file=spkg-configure.m4 $SAGE_PACKAGE_LIST_ARGS) $EXTRA_SAGE_PACKAGES; do SYSTEM_PACKAGE=$(sage-get-system-packages $SYSTEM $SPKG) if [ -n "${SYSTEM_PACKAGE}" ]; then # SYSTEM_PACKAGE can be empty if, for example, the environment From 17455620020f7e524893a4c1c63dd6d5b684711d Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 27 Aug 2023 09:04:27 -0400 Subject: [PATCH 288/423] build/bin/sage-get-system-packages: don't source build-env-config Since sage-get-system-packages is expected to work before ./configure has been run, we instead rely on ENABLE_SYSTEM_SITE_PACKAGES having already been set in the environment. When ./configure has not been run, that variable will be empty, and the python packages will be omitted from the list. --- build/bin/sage-get-system-packages | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/build/bin/sage-get-system-packages b/build/bin/sage-get-system-packages index ffb3d339f98..800c47976f7 100755 --- a/build/bin/sage-get-system-packages +++ b/build/bin/sage-get-system-packages @@ -12,11 +12,6 @@ if [ -z "$SAGE_ROOT" ]; then SAGE_ROOT=`pwd` fi -# We source sage-build-env-config because we need to know if -# --enable-system-site-packages was passed to ./configure. -# (If not, we want to hide those packages.) -. "${SAGE_ROOT}/build/bin/sage-build-env-config" - case "$SYSTEM" in install-requires) # Collect install-requires.txt (falling back to requirements.txt) and output it in the format @@ -54,7 +49,7 @@ for PKG_BASE in $SPKGS; do # Skip this package if it uses the SAGE_PYTHON_PACKAGE_CHECK # macro and if --enable-system-site-packages was NOT passed - # to ./configure. + # to ./configure (or if ./configure has not yet been run). SPKG_CONFIGURE="${SAGE_ROOT}/build/pkgs/${PKG_BASE}/spkg-configure.m4" if grep -q SAGE_PYTHON_PACKAGE_CHECK "${SPKG_CONFIGURE}" 2>/dev/null; then if [ -z "${ENABLE_SYSTEM_SITE_PACKAGES}" ]; then From 1038a63da308ca49dd8a7df9263c95cabfef2f78 Mon Sep 17 00:00:00 2001 From: Antonio Rojas Date: Sun, 27 Aug 2023 18:36:02 +0200 Subject: [PATCH 289/423] Fix test with gmp < 6.2 --- src/sage/ext/memory.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/ext/memory.pyx b/src/sage/ext/memory.pyx index c5b16168d04..b95130b19dd 100644 --- a/src/sage/ext/memory.pyx +++ b/src/sage/ext/memory.pyx @@ -10,7 +10,7 @@ ridiculously large integer, see :trac:`15363`:: ....: 2^(2^63-3) ....: except (OverflowError, RuntimeError, FloatingPointError): ....: print ('Overflow error') - Overflow error + ...Overflow error AUTHORS: From 4fe6c2c1c3875cea2b0deae82f14c31f570144ed Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 27 Aug 2023 13:42:39 -0400 Subject: [PATCH 290/423] build/bin/sage-get-system-packages: swap two "if" statements It's faster to read a variable than it is to launch grep, so we should do the easy one first (in case the hard one can be skipped). --- build/bin/sage-get-system-packages | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/build/bin/sage-get-system-packages b/build/bin/sage-get-system-packages index 800c47976f7..c8b9314c3fe 100755 --- a/build/bin/sage-get-system-packages +++ b/build/bin/sage-get-system-packages @@ -51,10 +51,11 @@ for PKG_BASE in $SPKGS; do # macro and if --enable-system-site-packages was NOT passed # to ./configure (or if ./configure has not yet been run). SPKG_CONFIGURE="${SAGE_ROOT}/build/pkgs/${PKG_BASE}/spkg-configure.m4" - if grep -q SAGE_PYTHON_PACKAGE_CHECK "${SPKG_CONFIGURE}" 2>/dev/null; then - if [ -z "${ENABLE_SYSTEM_SITE_PACKAGES}" ]; then - continue; - fi + if [ -z "${ENABLE_SYSTEM_SITE_PACKAGES}" ]; then + if grep -q SAGE_PYTHON_PACKAGE_CHECK "${SPKG_CONFIGURE}" 2>/dev/null; + then + continue; + fi fi for NAME in $SYSTEM_PACKAGES_FILE_NAMES; do From 0960b9e15df23f0fac185ab07dc5d83c40ed270a Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 27 Aug 2023 13:57:14 -0400 Subject: [PATCH 291/423] build/bin/sage-spkg-info: mention --enable-system-site-packages Instead of saying that Python packages will never be used, we update the output of this script to suggest --enable-system-site-packages when a Python package is queried (and it has an spkg-configure.m4). --- build/bin/sage-spkg-info | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/build/bin/sage-spkg-info b/build/bin/sage-spkg-info index d02b3ac347f..7e25f70dc32 100755 --- a/build/bin/sage-spkg-info +++ b/build/bin/sage-spkg-info @@ -111,16 +111,17 @@ if [ -z "$system" ]; then else echo if [ -f "$PKG_SCRIPTS"/spkg-configure.m4 ]; then - echo "If the system package is installed, ./configure will check whether it can be used." - else - echo "However, these system packages will not be used for building Sage" if [ -f "$PKG_SCRIPTS"/install-requires.txt ]; then - echo "because using Python site-packages is not supported by the Sage distribution;" - echo "see https://github.com/sagemath/sage/issues/29023" + echo "If the system package is installed and if --enable-system-site-packages" + echo "is passed to ./configure, then ./configure will check if it can be used." else - echo "because spkg-configure.m4 has not been written for this package;" - echo "see https://github.com/sagemath/sage/issues/27330" + echo "If the system package is installed, ./configure will check if it can be used." fi + + else + echo "However, these system packages will not be used for building Sage" + echo "because spkg-configure.m4 has not been written for this package;" + echo "see https://github.com/sagemath/sage/issues/27330" fi fi echo From 0619e4cc2d9af7eb5f27e5ec336f800f7fda69dc Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 27 Aug 2023 14:19:11 -0400 Subject: [PATCH 292/423] build/bin/sage-spkg-info: improve test for system site packages To avoid false positives with packages like tox (which has an install-requires.txt but can also be detected without passing --enable-system-site-packages), we update the test in this script to grep spkg-configure.m4 rather than simply rely on the presence of both spkg-configure.m4 and install-requires.txt. --- build/bin/sage-spkg-info | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build/bin/sage-spkg-info b/build/bin/sage-spkg-info index 7e25f70dc32..e43e516dc5b 100755 --- a/build/bin/sage-spkg-info +++ b/build/bin/sage-spkg-info @@ -110,14 +110,15 @@ if [ -z "$system" ]; then echo "(none known)" else echo - if [ -f "$PKG_SCRIPTS"/spkg-configure.m4 ]; then - if [ -f "$PKG_SCRIPTS"/install-requires.txt ]; then - echo "If the system package is installed and if --enable-system-site-packages" - echo "is passed to ./configure, then ./configure will check if it can be used." + SPKG_CONFIGURE="${PKG_SCRIPTS}/spkg-configure.m4" + if [ -f "${SPKG_CONFIGURE}" ]; then + if grep -q SAGE_PYTHON_PACKAGE_CHECK "${SPKG_CONFIGURE}"; then + echo "If the system package is installed and if the (experimental) option" + echo "--enable-system-site-packages is passed to ./configure, then ./configure" + echo "will check if the system package can be used." else echo "If the system package is installed, ./configure will check if it can be used." fi - else echo "However, these system packages will not be used for building Sage" echo "because spkg-configure.m4 has not been written for this package;" From e9c4710791e4d85d6d547351454d34efd9c1e128 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 27 Aug 2023 11:40:40 -0700 Subject: [PATCH 293/423] tox.ini: Add packages factor 'sitepackages' --- tox.ini | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 9c74d31bbe5..94b42e39c25 100644 --- a/tox.ini +++ b/tox.ini @@ -187,6 +187,8 @@ setenv = develop: EXTRA_SAGE_PACKAGES_4=_develop $(head -n 1 build/pkgs/_develop/dependencies) minimal: SAGE_PACKAGE_LIST_ARGS=_prereq maximal: SAGE_PACKAGE_LIST_ARGS=:standard: :optional: + sitepackages: ENABLE_SYSTEM_SITE_PACKAGES=yes + sitepackages: CONFIG_CONFIGURE_ARGS_SITEPACKAGES=--enable-system-site-packages conda-environment: SAGE_PACKAGE_LIST_ARGS=_prereq # Whether to add the system packages needed for bootstrapping EXTRA_SAGE_PACKAGES_0=_bootstrap @@ -601,7 +603,7 @@ setenv = # # Resulting full configuration args, including EXTRA_CONFIGURE_ARGS from the user environment # - CONFIGURE_ARGS=--enable-experimental-packages --enable-download-from-upstream-url {env:CONFIG_CONFIGURE_ARGS_ROOT:} {env:CONFIG_CONFIGURE_ARGS_1:} {env:CONFIG_CONFIGURE_ARGS_2:} {env:EXTRA_CONFIGURE_ARGS:} + CONFIGURE_ARGS=--enable-experimental-packages --enable-download-from-upstream-url {env:CONFIG_CONFIGURE_ARGS_ROOT:} {env:CONFIG_CONFIGURE_ARGS_SITEPACKAGES:} {env:CONFIG_CONFIGURE_ARGS_1:} {env:CONFIG_CONFIGURE_ARGS_2:} {env:EXTRA_CONFIGURE_ARGS:} # # Resulting EXTRA_SAGE_PACKAGES # From 10a8b142eac263063f033d0caf7158b84e7f953a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 28 Aug 2023 21:00:28 +0200 Subject: [PATCH 294/423] adding Coxeter arrangement --- src/doc/en/reference/references/index.rst | 4 + .../hyperplane_arrangement/library.py | 87 ++++++++++++++++++- 2 files changed, 87 insertions(+), 4 deletions(-) diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst index 94ebc11620f..ede570759cd 100644 --- a/src/doc/en/reference/references/index.rst +++ b/src/doc/en/reference/references/index.rst @@ -351,6 +351,10 @@ REFERENCES: *Characteristic polynomials of subspace arrangements and finite fields*. Advances in Mathematics, 122(2):193-233, 1996. +.. [Ath2000] \C. A. Athanasiadis, + *Deformations of Coxeter hyperplane arrangements and their characteristic polynomials*. + Adv. Stud. Pure Math., 27, 2000. + .. [Av2000] \D. Avis, *A revised implementation of the reverse search vertex enumeration algorithm.* Polytopes-combinatorics and computation. Birkhauser Basel, 2000. diff --git a/src/sage/geometry/hyperplane_arrangement/library.py b/src/sage/geometry/hyperplane_arrangement/library.py index 83c4f80c325..e122f871d5f 100644 --- a/src/sage/geometry/hyperplane_arrangement/library.py +++ b/src/sage/geometry/hyperplane_arrangement/library.py @@ -5,12 +5,12 @@ :mod:`sage.geometry.hyperplane_arrangement.arrangement` for details about how to construct your own hyperplane arrangements. """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2013 David Perkinson # # Distributed under the terms of the GNU General Public License (GPL) -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# **************************************************************************** from sage.graphs.graph_generators import graphs from sage.matrix.constructor import matrix, random_matrix @@ -233,6 +233,85 @@ def coordinate(self, n, K=QQ, names=None): x = H.gens() return H(x) + def Coxeter(self, data, K=QQ, names=None, m=1): + r""" + Return the Coxeter arrangement. + + This generalizes the braid arrangements to crystallographic + root systems. + + INPUT: + + - ``data`` -- either an integer or a Cartan type (or coercible + into; see "CartanType") + + - ``K`` -- field (default:``QQ``) + + - ``names`` -- tuple of strings or ``None`` (default); the + variable names for the ambient space + + OUTPUT: + + - If ``data`` is an integer `n`, return the braid arrangement in + dimension `n`, i.e. the set of `n(n-1)` hyperplanes: + `\{ x_i - x_j = 0,1 : 1 \leq i \leq j \leq n \}`. This corresponds + to the Coxeter arrangement of Cartan type `A_{n-1}`. + + - If ``data`` is a Cartan type, return the Coxeter arrangement of given + type. + + The Coxeter arrangement of a given crystallographic + Cartan type is defined by the inner products + `\langle a,x \rangle = 0` where + `a \in \Phi^+` runs over positive roots of the root system `\Phi`. + + EXAMPLES:: + + sage: # needs sage.combinat + sage: hyperplane_arrangements.Coxeter(4) + Arrangement of 12 hyperplanes of dimension 4 and rank 3 + sage: hyperplane_arrangements.Shi("B4") + Arrangement of 12 hyperplanes of dimension 4 and rank 3 + sage: hyperplane_arrangements.Shi("A3", m=2) + + If the Cartan type is not crystallographic, the Coxeter arrangement + is not implemented yet:: + + sage: hyperplane_arrangements.Coxeter("H3") + Traceback (most recent call last): + ... + NotImplementedError: Coxeter arrangements are not implemented for non crystallographic Cartan types + + The characteristic polynomial is pre-computed using the results + of Terao, see []_:: + + sage: # needs sage.combinat + sage: hyperplane_arrangements.Coxeter("A3").characteristic_polynomial() + x^4 - 12*x^3 + 48*x^2 - 64*x + """ + from sage.combinat.root_system.weyl_group import WeylGroup + if data in NN: + cartan_type = CartanType(["A", data - 1]) + else: + cartan_type = CartanType(data) + if not cartan_type.is_crystallographic(): + raise NotImplementedError("Coxeter arrangements are not implemented for non crystallographic Cartan types") + W = WeylGroup(cartan_type) + Ra = RootSystem(cartan_type).ambient_space() + PR = Ra.positive_roots() + d = Ra.dimension() + H = make_parent(K, d, names) + x = H.gens() + hyperplanes = [] + + for a in PR: + hyperplanes.append(sum(a[j] * x[j] for j in range(d))) + A = H(*hyperplanes) + x = polygen(QQ, 'x') + charpoly = prod(x - d + 1 for d in W.degrees()) + A.characteristic_polynomial.set_cache(charpoly) + return A + def G_semiorder(self, G, K=QQ, names=None): r""" Return the semiorder hyperplane arrangement of a graph. @@ -699,7 +778,7 @@ def Shi(self, data, K=QQ, names=None, m=1): x^3 - 54*x^2 + 972*x - 5832 """ if data in NN: - cartan_type = CartanType(["A",data-1]) + cartan_type = CartanType(["A", data - 1]) else: cartan_type = CartanType(data) if not cartan_type.is_crystallographic(): From c4630f83b973e4a6af22b13f3f36f74e04f3be17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 28 Aug 2023 21:04:34 +0200 Subject: [PATCH 295/423] fix doctests --- src/sage/geometry/hyperplane_arrangement/library.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sage/geometry/hyperplane_arrangement/library.py b/src/sage/geometry/hyperplane_arrangement/library.py index e122f871d5f..54bb665eecd 100644 --- a/src/sage/geometry/hyperplane_arrangement/library.py +++ b/src/sage/geometry/hyperplane_arrangement/library.py @@ -269,10 +269,11 @@ def Coxeter(self, data, K=QQ, names=None, m=1): sage: # needs sage.combinat sage: hyperplane_arrangements.Coxeter(4) - Arrangement of 12 hyperplanes of dimension 4 and rank 3 + Arrangement of 6 hyperplanes of dimension 4 and rank 3 sage: hyperplane_arrangements.Shi("B4") - Arrangement of 12 hyperplanes of dimension 4 and rank 3 + Arrangement of 32 hyperplanes of dimension 4 and rank 4 sage: hyperplane_arrangements.Shi("A3", m=2) + Arrangement of 24 hyperplanes of dimension 4 and rank 3 If the Cartan type is not crystallographic, the Coxeter arrangement is not implemented yet:: @@ -287,7 +288,7 @@ def Coxeter(self, data, K=QQ, names=None, m=1): sage: # needs sage.combinat sage: hyperplane_arrangements.Coxeter("A3").characteristic_polynomial() - x^4 - 12*x^3 + 48*x^2 - 64*x + x^3 - 6*x^2 + 11*x - 6 """ from sage.combinat.root_system.weyl_group import WeylGroup if data in NN: From a11dfb65b0d28cc03025db92a9defe74fc453411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 28 Aug 2023 21:06:30 +0200 Subject: [PATCH 296/423] add ref --- src/sage/geometry/hyperplane_arrangement/library.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/geometry/hyperplane_arrangement/library.py b/src/sage/geometry/hyperplane_arrangement/library.py index 54bb665eecd..916e08791b3 100644 --- a/src/sage/geometry/hyperplane_arrangement/library.py +++ b/src/sage/geometry/hyperplane_arrangement/library.py @@ -284,7 +284,7 @@ def Coxeter(self, data, K=QQ, names=None, m=1): NotImplementedError: Coxeter arrangements are not implemented for non crystallographic Cartan types The characteristic polynomial is pre-computed using the results - of Terao, see []_:: + of Terao, see [Ath2000]_:: sage: # needs sage.combinat sage: hyperplane_arrangements.Coxeter("A3").characteristic_polynomial() From cde4f0252ba3e1fcc235354a9c98199e32ff56d8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 31 May 2023 23:16:15 -0700 Subject: [PATCH 297/423] sage.rings: More # optional --- src/sage/rings/power_series_poly.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/rings/power_series_poly.pyx b/src/sage/rings/power_series_poly.pyx index 7c93168d4b1..46d7bbf1303 100644 --- a/src/sage/rings/power_series_poly.pyx +++ b/src/sage/rings/power_series_poly.pyx @@ -34,9 +34,9 @@ cdef class PowerSeries_poly(PowerSeries): Check that :trac:`22216` is fixed:: sage: R. = PowerSeriesRing(QQ) - sage: R(pari('1 + O(T)')) + sage: R(pari('1 + O(T)')) # optional - sage.libs.pari 1 + O(T) - sage: R(pari('1/T + O(T)')) + sage: R(pari('1/T + O(T)')) # optional - sage.libs.pari Traceback (most recent call last): ... ValueError: series has negative valuation From 32310c736497294d401d50cd99a1bbd91fc420c8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 1 Jun 2023 23:01:56 -0700 Subject: [PATCH 298/423] sage.rings: More # optional --- src/sage/rings/complex_mpfr.pyx | 6 +- src/sage/rings/morphism.pyx | 10 +- src/sage/rings/rational_field.py | 2 +- src/sage/rings/real_mpfr.pyx | 40 +- src/sage/rings/ring_extension.pyx | 740 ++++++++++--------- src/sage/rings/ring_extension_conversion.pyx | 2 + src/sage/rings/ring_extension_element.pyx | 421 +++++------ src/sage/rings/ring_extension_homset.py | 8 +- src/sage/rings/ring_extension_morphism.pyx | 293 ++++---- 9 files changed, 769 insertions(+), 753 deletions(-) diff --git a/src/sage/rings/complex_mpfr.pyx b/src/sage/rings/complex_mpfr.pyx index 33d73d81b12..49f10a44373 100644 --- a/src/sage/rings/complex_mpfr.pyx +++ b/src/sage/rings/complex_mpfr.pyx @@ -493,9 +493,9 @@ class ComplexField_class(sage.rings.abc.ComplexField): Check that :trac:`14989` is fixed:: sage: x = polygen(ZZ, 'x') - sage: QQi = NumberField(x^2 + 1, 'i', embedding=CC(0,1)) - sage: i = QQi.order(QQi.gen()).gen(1) - sage: CC(i) + sage: QQi = NumberField(x^2 + 1, 'i', embedding=CC(0,1)) # optional - sage.rings.number_field + sage: i = QQi.order(QQi.gen()).gen(1) # optional - sage.rings.number_field + sage: CC(i) # optional - sage.rings.number_field 1.00000000000000*I TESTS:: diff --git a/src/sage/rings/morphism.pyx b/src/sage/rings/morphism.pyx index ba341f7f93a..9a88fccc29f 100644 --- a/src/sage/rings/morphism.pyx +++ b/src/sage/rings/morphism.pyx @@ -109,16 +109,16 @@ A map from a multivariate polynomial ring to itself:: An endomorphism of a quotient of a multi-variate polynomial ring:: sage: R. = PolynomialRing(QQ) - sage: S. = quo(R, ideal(1 + y^2)) - sage: phi = S.hom([a^2, -b]) - sage: phi + sage: S. = quo(R, ideal(1 + y^2)) # optional - sage.libs.singular + sage: phi = S.hom([a^2, -b]) # optional - sage.libs.singular + sage: phi # optional - sage.libs.singular Ring endomorphism of Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (y^2 + 1) Defn: a |--> a^2 b |--> -b - sage: phi(b) + sage: phi(b) # optional - sage.libs.singular -b - sage: phi(a^2 + b^2) + sage: phi(a^2 + b^2) # optional - sage.libs.singular a^4 - 1 The reduction map from the integers to the integers modulo 8, viewed as diff --git a/src/sage/rings/rational_field.py b/src/sage/rings/rational_field.py index cbd5a4ba483..6c7ba63c29f 100644 --- a/src/sage/rings/rational_field.py +++ b/src/sage/rings/rational_field.py @@ -326,7 +326,7 @@ def completion(self, p, prec, extras={}): sage: QQ.completion(infinity, 53) Real Field with 53 bits of precision - sage: QQ.completion(5, 15, {'print_mode': 'bars'}) + sage: QQ.completion(5, 15, {'print_mode': 'bars'}) # optional - sage.rings.padics 5-adic Field with capped relative precision 15 """ from sage.rings.infinity import Infinity diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index ea7ff07a216..837ec08319d 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -719,7 +719,7 @@ cdef class RealField_class(sage.rings.abc.RealField): TESTS:: - sage: 1.0 - ZZ(1) - int(1) - 1 - QQ(1) - RealField(100)(1) - AA(1) - RLF(1) + sage: 1.0 - ZZ(1) - int(1) - 1 - QQ(1) - RealField(100)(1) - AA(1) - RLF(1) # optional - sage.rings.number_field -6.00000000000000 sage: R = RR['x'] # Hold reference to avoid garbage collection, see Issue #24709 sage: R.get_action(ZZ) @@ -920,7 +920,7 @@ cdef class RealField_class(sage.rings.abc.RealField): False sage: RR._is_valid_homomorphism_(CC,[CC(1)]) True - sage: RR._is_valid_homomorphism_(GF(2),GF(2)(1)) + sage: RR._is_valid_homomorphism_(GF(2),GF(2)(1)) # optional - sage.rings.finite_rings False """ @@ -2385,7 +2385,10 @@ cdef class RealNumber(sage.structure.element.RingElement): """ if have_same_parent(left, right): return ( left)._add_(right) - from .real_mpfi import RealIntervalFieldElement + try: + from .real_mpfi import RealIntervalFieldElement + except ImportError: + RealIntervalFieldElement = None if type(right) is RealIntervalFieldElement: return right.__add__(left) elif isinstance(left, RealNumber): @@ -2406,7 +2409,10 @@ cdef class RealNumber(sage.structure.element.RingElement): """ if have_same_parent(left, right): return ( left)._sub_(right) - from .real_mpfi import RealIntervalFieldElement + try: + from .real_mpfi import RealIntervalFieldElement + except ImportError: + RealIntervalFieldElement = None if type(right) is RealIntervalFieldElement: return (-right).__add__(left) elif isinstance(left, RealNumber): @@ -2427,7 +2433,10 @@ cdef class RealNumber(sage.structure.element.RingElement): """ if have_same_parent(left, right): return ( left)._mul_(right) - from .real_mpfi import RealIntervalFieldElement + try: + from .real_mpfi import RealIntervalFieldElement + except ImportError: + RealIntervalFieldElement = None if type(right) is RealIntervalFieldElement: return right.__mul__(left) elif isinstance(left, RealNumber): @@ -2448,7 +2457,10 @@ cdef class RealNumber(sage.structure.element.RingElement): """ if have_same_parent(left, right): return ( left)._div_(right) - from .real_mpfi import RealIntervalFieldElement + try: + from .real_mpfi import RealIntervalFieldElement + except ImportError: + RealIntervalFieldElement = None if type(right) is RealIntervalFieldElement: return right.__rtruediv__(left) elif isinstance(left, RealNumber): @@ -3236,7 +3248,7 @@ cdef class RealNumber(sage.structure.element.RingElement): EXAMPLES:: - sage: RR(pi).__int__() + sage: RR(pi).__int__() # optional - sage.symbolic 3 sage: type(RR(pi).__int__()) <... 'int'> @@ -3254,7 +3266,7 @@ cdef class RealNumber(sage.structure.element.RingElement): EXAMPLES:: - sage: RR(pi).__complex__() + sage: RR(pi).__complex__() # optional - sage.symbolic (3.141592653589793+0j) sage: type(RR(pi).__complex__()) <... 'complex'> @@ -3268,7 +3280,7 @@ cdef class RealNumber(sage.structure.element.RingElement): EXAMPLES:: - sage: RR(pi)._complex_number_() + sage: RR(pi)._complex_number_() # optional - sage.symbolic 3.14159265358979 sage: parent(RR(pi)._complex_number_()) Complex Field with 53 bits of precision @@ -5340,11 +5352,11 @@ cdef class RealNumber(sage.structure.element.RingElement): Computing zeta using PARI is much more efficient in difficult cases. Here's how to compute zeta with at least a given precision:: - sage: z = pari(2).zeta(precision=53); z + sage: z = pari(2).zeta(precision=53); z # optional - sage.libs.pari 1.64493406684823 - sage: pari(2).zeta(precision=128).sage().prec() + sage: pari(2).zeta(precision=128).sage().prec() # optional - sage.libs.pari 128 - sage: pari(2).zeta(precision=65).sage().prec() + sage: pari(2).zeta(precision=65).sage().prec() # optional - sage.libs.pari 128 # 64-bit 96 # 32-bit @@ -5356,9 +5368,9 @@ cdef class RealNumber(sage.structure.element.RingElement): :: - sage: type(z) + sage: type(z) # optional - sage.libs.pari - sage: R(z) + sage: R(z) # optional - sage.libs.pari 1.64493406684823 """ cdef RealNumber x = self._new() diff --git a/src/sage/rings/ring_extension.pyx b/src/sage/rings/ring_extension.pyx index ddd675e8a3e..8143d84d3ee 100644 --- a/src/sage/rings/ring_extension.pyx +++ b/src/sage/rings/ring_extension.pyx @@ -11,41 +11,40 @@ that is `L`. For example, the following line constructs the extension of finite fields `\mathbf{F}_{5^4}/\mathbf{F}_{5^2}`:: - sage: GF(5^4).over(GF(5^2)) + sage: GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base By default, Sage reuses the canonical generator of the top ring (here `z_4 \in \mathbf{F}_{5^4}`), together with its name. However, the user can customize them by passing in appropriate arguments:: - sage: F = GF(5^2) - sage: k = GF(5^4) - sage: z4 = k.gen() - sage: K. = k.over(F, gen = 1-z4) - sage: K + sage: F = GF(5^2) # optional - sage.rings.finite_rings + sage: k = GF(5^4) # optional - sage.rings.finite_rings + sage: z4 = k.gen() # optional - sage.rings.finite_rings + sage: K. = k.over(F, gen=1-z4); K # optional - sage.rings.finite_rings Field in a with defining polynomial x^2 + z2*x + 4 over its base The base of the extension is available via the method :meth:`base` (or equivalently :meth:`base_ring`):: - sage: K.base() + sage: K.base() # optional - sage.rings.finite_rings Finite Field in z2 of size 5^2 It is also possible to build an extension on top of another extension, obtaining this way a tower of extensions:: - sage: L. = GF(5^8).over(K) - sage: L + sage: L. = GF(5^8).over(K) # optional - sage.rings.finite_rings + sage: L # optional - sage.rings.finite_rings Field in b with defining polynomial x^2 + (4*z2 + 3*a)*x + 1 - a over its base - sage: L.base() + sage: L.base() # optional - sage.rings.finite_rings Field in a with defining polynomial x^2 + z2*x + 4 over its base - sage: L.base().base() + sage: L.base().base() # optional - sage.rings.finite_rings Finite Field in z2 of size 5^2 The method :meth:`bases` gives access to the complete list of rings in a tower:: - sage: L.bases() + sage: L.bases() # optional - sage.rings.finite_rings [Field in b with defining polynomial x^2 + (4*z2 + 3*a)*x + 1 - a over its base, Field in a with defining polynomial x^2 + z2*x + 4 over its base, Finite Field in z2 of size 5^2] @@ -54,44 +53,44 @@ Once we have constructed an extension (or a tower of extensions), we have interesting methods attached to it. As a basic example, one can compute a basis of the top ring over any base in the tower:: - sage: L.basis_over(K) + sage: L.basis_over(K) # optional - sage.rings.finite_rings [1, b] - sage: L.basis_over(F) + sage: L.basis_over(F) # optional - sage.rings.finite_rings [1, a, b, a*b] When the base is omitted, the default is the natural base of the extension:: - sage: L.basis_over() + sage: L.basis_over() # optional - sage.rings.finite_rings [1, b] The method :meth:`sage.rings.ring_extension_element.RingExtensionWithBasis.vector` computes the coordinates of an element according to the above basis:: - sage: u = a + 2*b + 3*a*b - sage: u.vector() # over K + sage: u = a + 2*b + 3*a*b # optional - sage.rings.finite_rings + sage: u.vector() # over K # optional - sage.rings.finite_rings (a, 2 + 3*a) - sage: u.vector(F) + sage: u.vector(F) # optional - sage.rings.finite_rings (0, 1, 2, 3) One can also compute traces and norms with respect to any base of the tower:: - sage: u.trace() # over K + sage: u.trace() # over K # optional - sage.rings.finite_rings (2*z2 + 1) + (2*z2 + 1)*a - sage: u.trace(F) + sage: u.trace(F) # optional - sage.rings.finite_rings z2 + 1 - sage: u.trace().trace() # over K, then over F + sage: u.trace().trace() # over K, then over F # optional - sage.rings.finite_rings z2 + 1 - sage: u.norm() # over K + sage: u.norm() # over K # optional - sage.rings.finite_rings (z2 + 1) + (4*z2 + 2)*a - sage: u.norm(F) + sage: u.norm(F) # optional - sage.rings.finite_rings 2*z2 + 2 And minimal polynomials:: - sage: u.minpoly() + sage: u.minpoly() # optional - sage.rings.finite_rings x^2 + ((3*z2 + 4) + (3*z2 + 4)*a)*x + (z2 + 1) + (4*z2 + 2)*a - sage: u.minpoly(F) + sage: u.minpoly(F) # optional - sage.rings.finite_rings x^4 + (4*z2 + 4)*x^3 + x^2 + (z2 + 1)*x + 2*z2 + 2 @@ -165,9 +164,9 @@ def tower_bases(ring, degree): ([Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Rational Field], [1]) - sage: K. = Qq(5^2) - sage: L. = K.extension(x^3 - 5) - sage: tower_bases(L, True) + sage: K. = Qq(5^2) # optional - sage.rings.padics + sage: L. = K.extension(x^3 - 5) # optional - sage.rings.padics + sage: tower_bases(L, True) # optional - sage.rings.padics ([5-adic Eisenstein Extension Field in w defined by x^3 - 5 over its base field, 5-adic Unramified Extension Field in a defined by x^2 + 4*x + 2, 5-adic Field with capped relative precision 20], @@ -213,12 +212,12 @@ def common_base(K, L, degree): sage: from sage.rings.ring_extension import common_base - sage: common_base(GF(5^3), GF(5^7), False) + sage: common_base(GF(5^3), GF(5^7), False) # optional - sage.rings.finite_rings Finite Field of size 5 - sage: common_base(GF(5^3), GF(5^7), True) + sage: common_base(GF(5^3), GF(5^7), True) # optional - sage.rings.finite_rings (Finite Field of size 5, 3, 7) - sage: common_base(GF(5^3), GF(7^5), False) + sage: common_base(GF(5^3), GF(7^5), False) # optional - sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError: unable to find a common base @@ -337,8 +336,7 @@ class RingExtensionFactory(UniqueFactory): sage: x = polygen(ZZ, 'x') sage: K. = QQ.extension(x^2 - 2) - sage: E = K.over(QQ) - sage: E + sage: E = K.over(QQ); E Field in a with defining polynomial x^2 - 2 over its base sage: E2. = K.over(QQ) @@ -381,7 +379,8 @@ class RingExtensionFactory(UniqueFactory): {'is_backend_exposed': True, 'print_options': {'print_elements_as': None, 'print_parent_as': None}})]}) - sage: RingExtension.create_key_and_extra_args(GF(5^4), GF(5^2), names=('a',)) + sage: RingExtension.create_key_and_extra_args(GF(5^4), GF(5^2), # optional - sage.rings.finite_rings + ....: names=('a',)) ((Ring morphism: From: Finite Field in z2 of size 5^2 To: Finite Field in z4 of size 5^4 @@ -560,8 +559,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): ... TypeError: only commutative rings are accepted - sage: K = GF(5^3) - sage: K.over(K.frobenius_endomorphism()) + sage: K = GF(5^3) # optional - sage.rings.finite_rings + sage: K.over(K.frobenius_endomorphism()) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: exotic defining morphism between two rings in the tower; consider using another variable name @@ -693,8 +692,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES: - sage: E = GF(5^3).over() - sage: hash(E) # random + sage: E = GF(5^3).over() # optional - sage.rings.finite_rings + sage: hash(E) # random # optional - sage.rings.finite_rings 140257667982632 """ return hash_by_id(self) @@ -706,10 +705,10 @@ cdef class RingExtension_generic(CommutativeAlgebra): TESTS:: - sage: K = GF(7^3).over() - sage: type(K) + sage: K = GF(7^3).over() # optional - sage.rings.finite_rings + sage: type(K) # optional - sage.rings.finite_rings - sage: loads(dumps(K)) is K + sage: loads(dumps(K)) is K # optional - sage.rings.finite_rings True """ (defining_morphism, gens, names) = self._factory_data[2] @@ -722,8 +721,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: E = GF(5^3).over() - sage: E.construction() + sage: E = GF(5^3).over() # optional - sage.rings.finite_rings + sage: E.construction() # optional - sage.rings.finite_rings """ # One could define a construction functor K' -> K' otimes_K L, but we leave this to another issue @@ -764,18 +763,18 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: k = GF(5) - sage: K. = GF(5^2).over(k) - sage: L. = GF(5^4).over(K) + sage: k = GF(5) # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over(k) # optional - sage.rings.finite_rings + sage: L. = GF(5^4).over(K) # optional - sage.rings.finite_rings - sage: x = L.from_base_ring(k(2)); x + sage: x = L.from_base_ring(k(2)); x # optional - sage.rings.finite_rings 2 - sage: x.parent() + sage: x.parent() # optional - sage.rings.finite_rings Field in v with defining polynomial x^2 + (3 - u)*x + u over its base - sage: x = L.from_base_ring(u); x + sage: x = L.from_base_ring(u); x # optional - sage.rings.finite_rings u - sage: x.parent() + sage: x.parent() # optional - sage.rings.finite_rings Field in v with defining polynomial x^2 + (3 - u)*x + u over its base """ if r not in self._base: @@ -797,24 +796,24 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: A. = GF(5^2).over() # over GF(5) - sage: B. = GF(5^4).over(A) - sage: C. = GF(5^12).over(B) - sage: D. = GF(5^24).over(C) + sage: A. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: B. = GF(5^4).over(A) # optional - sage.rings.finite_rings + sage: C. = GF(5^12).over(B) # optional - sage.rings.finite_rings + sage: D. = GF(5^24).over(C) # optional - sage.rings.finite_rings Observe what happens when we modify the option ``over``:: - sage: D + sage: D # optional - sage.rings.finite_rings Field in d with defining polynomial x^2 + ((1 - a) + ((1 + 2*a) - b)*c + ((2 + a) + (1 - a)*b)*c^2)*x + c over its base - sage: D.print_options(over=2) - sage: D + sage: D.print_options(over=2) # optional - sage.rings.finite_rings + sage: D # optional - sage.rings.finite_rings Field in d with defining polynomial x^2 + ((1 - a) + ((1 + 2*a) - b)*c + ((2 + a) + (1 - a)*b)*c^2)*x + c over Field in c with defining polynomial x^3 + (1 + (2 - a)*b)*x^2 + (2 + 2*b)*x - b over Field in b with defining polynomial x^2 + (3 - a)*x + a over its base - sage: D.print_options(over=Infinity) - sage: D + sage: D.print_options(over=Infinity) # optional - sage.rings.finite_rings + sage: D # optional - sage.rings.finite_rings Field in d with defining polynomial x^2 + ((1 - a) + ((1 + 2*a) - b)*c + ((2 + a) + (1 - a)*b)*c^2)*x + c over Field in c with defining polynomial x^3 + (1 + (2 - a)*b)*x^2 + (2 + 2*b)*x - b over Field in b with defining polynomial x^2 + (3 - a)*x + a over @@ -823,19 +822,19 @@ cdef class RingExtension_generic(CommutativeAlgebra): Now the option ``base``:: - sage: d^2 + sage: d^2 # optional - sage.rings.finite_rings -c + ((-1 + a) + ((-1 + 3*a) + b)*c + ((3 - a) + (-1 + a)*b)*c^2)*d - sage: D.basis_over(B) + sage: D.basis_over(B) # optional - sage.rings.finite_rings [1, c, c^2, d, c*d, c^2*d] - sage: D.print_options(base=B) - sage: d^2 + sage: D.print_options(base=B) # optional - sage.rings.finite_rings + sage: d^2 # optional - sage.rings.finite_rings -c + (-1 + a)*d + ((-1 + 3*a) + b)*c*d + ((3 - a) + (-1 + a)*b)*c^2*d - sage: D.basis_over(A) + sage: D.basis_over(A) # optional - sage.rings.finite_rings [1, b, c, b*c, c^2, b*c^2, d, b*d, c*d, b*c*d, c^2*d, b*c^2*d] - sage: D.print_options(base=A) - sage: d^2 + sage: D.print_options(base=A) # optional - sage.rings.finite_rings + sage: d^2 # optional - sage.rings.finite_rings -c + (-1 + a)*d + (-1 + 3*a)*c*d + b*c*d + (3 - a)*c^2*d + (-1 + a)*b*c^2*d """ for (name, value) in options.items(): @@ -1039,21 +1038,21 @@ cdef class RingExtension_generic(CommutativeAlgebra): TESTS:: - sage: E1 = GF(3^6).over(GF(3^3)) - sage: E1.coerce_map_from(GF(3^3)) # indirect doctest + sage: E1 = GF(3^6).over(GF(3^3)) # optional - sage.rings.finite_rings + sage: E1.coerce_map_from(GF(3^3)) # indirect doctest # optional - sage.rings.finite_rings Ring morphism: From: Finite Field in z3 of size 3^3 To: Field in z6 with defining polynomial x^2 + (2*z3 + 1)*x + z3 over its base Defn: z3 |--> z3 - sage: E1.coerce_map_from(GF(3)) # indirect doctest + sage: E1.coerce_map_from(GF(3)) # indirect doctest # optional - sage.rings.finite_rings Ring morphism: From: Finite Field of size 3 To: Field in z6 with defining polynomial x^2 + (2*z3 + 1)*x + z3 over its base Defn: 1 |--> 1 - sage: E2 = GF(3^18).over(GF(3^9)) - sage: E2.coerce_map_from(E1) # indirect doctest + sage: E2 = GF(3^18).over(GF(3^9)) # optional - sage.rings.finite_rings + sage: E2.coerce_map_from(E1) # indirect doctest # optional - sage.rings.finite_rings Ring morphism: From: Field in z6 with defining polynomial x^2 + (2*z3 + 1)*x + z3 over its base To: Field in z18 with defining polynomial x^2 + (z9^8 + 2*z9^7 + z9^5 + 2*z9^4 + z9^2 + z9 + 1)*x + z9 over its base @@ -1061,11 +1060,11 @@ cdef class RingExtension_generic(CommutativeAlgebra): A test with iterated extensions:: - sage: A = GF(3^18).over(GF(3^3)) # simple extension GF(3^3) -> GF(3^18) - sage: B = GF(3^18).over(E1) # iterated extension GF(3^3) -> GF(3^6) -> GF(3^18) - sage: A.has_coerce_map_from(B) + sage: A = GF(3^18).over(GF(3^3)) # simple extension GF(3^3) -> GF(3^18) # optional - sage.rings.finite_rings + sage: B = GF(3^18).over(E1) # iterated extension GF(3^3) -> GF(3^6) -> GF(3^18) # optional - sage.rings.finite_rings + sage: A.has_coerce_map_from(B) # optional - sage.rings.finite_rings False - sage: B.has_coerce_map_from(A) + sage: B.has_coerce_map_from(A) # optional - sage.rings.finite_rings True """ @@ -1085,17 +1084,17 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2) - sage: K = GF(5^4).over(F) - sage: K.base() + sage: F = GF(5^2) # optional - sage.rings.finite_rings + sage: K = GF(5^4).over(F) # optional - sage.rings.finite_rings + sage: K.base() # optional - sage.rings.finite_rings Finite Field in z2 of size 5^2 In case of iterated extensions, the base is itself an extension:: - sage: L = GF(5^8).over(K) - sage: L.base() + sage: L = GF(5^8).over(K) # optional - sage.rings.finite_rings + sage: L.base() # optional - sage.rings.finite_rings Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base - sage: L.base() is K + sage: L.base() is K # optional - sage.rings.finite_rings True .. SEEALSO:: @@ -1111,20 +1110,20 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2).over() # over GF(5) - sage: K = GF(5^4).over(F) - sage: L = GF(5^12).over(K) + sage: F = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: K = GF(5^4).over(F) # optional - sage.rings.finite_rings + sage: L = GF(5^12).over(K) # optional - sage.rings.finite_rings - sage: F.bases() + sage: F.bases() # optional - sage.rings.finite_rings [Field in z2 with defining polynomial x^2 + 4*x + 2 over its base, Finite Field of size 5] - sage: K.bases() + sage: K.bases() # optional - sage.rings.finite_rings [Field in z4 with defining polynomial x^2 + (3 - z2)*x + z2 over its base, Field in z2 with defining polynomial x^2 + 4*x + 2 over its base, Finite Field of size 5] - sage: L.bases() + sage: L.bases() # optional - sage.rings.finite_rings [Field in z12 with defining polynomial x^3 + (1 + (2 - z2)*z4)*x^2 + (2 + 2*z4)*x - z4 over its base, Field in z4 with defining polynomial x^2 + (3 - z2)*x + z2 over its base, Field in z2 with defining polynomial x^2 + 4*x + 2 over its base, @@ -1150,15 +1149,15 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2).over() # over GF(5) - sage: K = GF(5^4).over(F) - sage: L = GF(5^12).over(K) + sage: F = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: K = GF(5^4).over(F) # optional - sage.rings.finite_rings + sage: L = GF(5^12).over(K) # optional - sage.rings.finite_rings - sage: F.absolute_base() + sage: F.absolute_base() # optional - sage.rings.finite_rings Finite Field of size 5 - sage: K.absolute_base() + sage: K.absolute_base() # optional - sage.rings.finite_rings Finite Field of size 5 - sage: L.absolute_base() + sage: L.absolute_base() # optional - sage.rings.finite_rings Finite Field of size 5 .. SEEALSO:: @@ -1179,28 +1178,28 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: A = GF(5^4).over(GF(5^2)) - sage: B = GF(5^12).over(A) + sage: A = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings + sage: B = GF(5^12).over(A) # optional - sage.rings.finite_rings - sage: A.is_defined_over(GF(5^2)) + sage: A.is_defined_over(GF(5^2)) # optional - sage.rings.finite_rings True - sage: A.is_defined_over(GF(5)) + sage: A.is_defined_over(GF(5)) # optional - sage.rings.finite_rings False - sage: B.is_defined_over(A) + sage: B.is_defined_over(A) # optional - sage.rings.finite_rings True - sage: B.is_defined_over(GF(5^4)) + sage: B.is_defined_over(GF(5^4)) # optional - sage.rings.finite_rings True - sage: B.is_defined_over(GF(5^2)) + sage: B.is_defined_over(GF(5^2)) # optional - sage.rings.finite_rings True - sage: B.is_defined_over(GF(5)) + sage: B.is_defined_over(GF(5)) # optional - sage.rings.finite_rings False Note that an extension is defined over itself:: - sage: A.is_defined_over(A) + sage: A.is_defined_over(A) # optional - sage.rings.finite_rings True - sage: A.is_defined_over(GF(5^4)) + sage: A.is_defined_over(GF(5^4)) # optional - sage.rings.finite_rings True .. SEEALSO:: @@ -1231,26 +1230,26 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2) - sage: K = GF(5^4).over(F) - sage: L = GF(5^12).over(K) - sage: L.bases() + sage: F = GF(5^2) # optional - sage.rings.finite_rings + sage: K = GF(5^4).over(F) # optional - sage.rings.finite_rings + sage: L = GF(5^12).over(K) # optional - sage.rings.finite_rings + sage: L.bases() # optional - sage.rings.finite_rings [Field in z12 with defining polynomial x^3 + (1 + (4*z2 + 2)*z4)*x^2 + (2 + 2*z4)*x - z4 over its base, Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base, Finite Field in z2 of size 5^2] - sage: L._check_base(K) + sage: L._check_base(K) # optional - sage.rings.finite_rings Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base - sage: L._check_base(GF(5^4)) + sage: L._check_base(GF(5^4)) # optional - sage.rings.finite_rings Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base - sage: L._check_base(GF(5^4)) is K + sage: L._check_base(GF(5^4)) is K # optional - sage.rings.finite_rings True When ``base`` is ``None``, the base of the extension is returned:: - sage: L._check_base(None) + sage: L._check_base(None) # optional - sage.rings.finite_rings Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base - sage: L._check_base(None) is L.base() + sage: L._check_base(None) is L.base() # optional - sage.rings.finite_rings True """ @@ -1276,17 +1275,17 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2) - sage: K = GF(5^4).over(F) - sage: L = GF(5^12).over(K) + sage: F = GF(5^2) # optional - sage.rings.finite_rings + sage: K = GF(5^4).over(F) # optional - sage.rings.finite_rings + sage: L = GF(5^12).over(K) # optional - sage.rings.finite_rings - sage: K.defining_morphism() + sage: K.defining_morphism() # optional - sage.rings.finite_rings Ring morphism: From: Finite Field in z2 of size 5^2 To: Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base Defn: z2 |--> z2 - sage: L.defining_morphism() + sage: L.defining_morphism() # optional - sage.rings.finite_rings Ring morphism: From: Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base To: Field in z12 with defining polynomial x^3 + (1 + (4*z2 + 2)*z4)*x^2 + (2 + 2*z4)*x - z4 over its base @@ -1295,13 +1294,13 @@ cdef class RingExtension_generic(CommutativeAlgebra): One can also pass in a base over which the extension is explicitly defined (see also :meth:`is_defined_over`):: - sage: L.defining_morphism(F) + sage: L.defining_morphism(F) # optional - sage.rings.finite_rings Ring morphism: From: Finite Field in z2 of size 5^2 To: Field in z12 with defining polynomial x^3 + (1 + (4*z2 + 2)*z4)*x^2 + (2 + 2*z4)*x - z4 over its base Defn: z2 |--> z2 - sage: L.defining_morphism(GF(5)) + sage: L.defining_morphism(GF(5)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field of size 5 @@ -1338,13 +1337,13 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) - sage: K.gens() + sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: K.gens() # optional - sage.rings.finite_rings (a,) - sage: L. = GF(5^4).over(K) - sage: L.gens() + sage: L. = GF(5^4).over(K) # optional - sage.rings.finite_rings + sage: L.gens() # optional - sage.rings.finite_rings (b,) - sage: L.gens(GF(5)) + sage: L.gens(GF(5)) # optional - sage.rings.finite_rings (b, a) sage: S. = QQ[] @@ -1368,16 +1367,16 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^2).over() # over GF(5) - sage: K.gens() + sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: K.gens() # optional - sage.rings.finite_rings (z2,) - sage: K.ngens() + sage: K.ngens() # optional - sage.rings.finite_rings 1 - sage: L = GF(5^4).over(K) - sage: L.gens(GF(5)) + sage: L = GF(5^4).over(K) # optional - sage.rings.finite_rings + sage: L.gens(GF(5)) # optional - sage.rings.finite_rings (z4, z2) - sage: L.ngens(GF(5)) + sage: L.ngens(GF(5)) # optional - sage.rings.finite_rings 2 """ return len(self.gens(base)) @@ -1388,15 +1387,15 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^2).over() # over GF(5) - sage: x =K.gen(); x + sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: x =K.gen(); x # optional - sage.rings.finite_rings z2 Observe that the generator lives in the extension:: - sage: x.parent() + sage: x.parent() # optional - sage.rings.finite_rings Field in z2 with defining polynomial x^2 + 4*x + 2 over its base - sage: x.parent() is K + sage: x.parent() is K # optional - sage.rings.finite_rings True """ return self.gens()[0] @@ -1407,13 +1406,13 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^2).over() # over GF(5) - sage: x = K.random_element(); x # random + sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: x = K.random_element(); x # random # optional - sage.rings.finite_rings 3 + z2 - sage: x.parent() + sage: x.parent() # optional - sage.rings.finite_rings Field in z2 with defining polynomial x^2 + 4*x + 2 over its base - sage: x.parent() is K + sage: x.parent() is K # optional - sage.rings.finite_rings True """ elt = self._backend.random_element() @@ -1430,29 +1429,29 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2) - sage: K = GF(5^4).over(F) - sage: L = GF(5^12).over(K) + sage: F = GF(5^2) # optional - sage.rings.finite_rings + sage: K = GF(5^4).over(F) # optional - sage.rings.finite_rings + sage: L = GF(5^12).over(K) # optional - sage.rings.finite_rings - sage: K.degree_over(F) + sage: K.degree_over(F) # optional - sage.rings.finite_rings 2 - sage: L.degree_over(K) + sage: L.degree_over(K) # optional - sage.rings.finite_rings 3 - sage: L.degree_over(F) + sage: L.degree_over(F) # optional - sage.rings.finite_rings 6 If ``base`` is omitted, the degree is computed over the base of the extension:: - sage: K.degree_over() + sage: K.degree_over() # optional - sage.rings.finite_rings 2 - sage: L.degree_over() + sage: L.degree_over() # optional - sage.rings.finite_rings 3 Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: K.degree_over(GF(5)) + sage: K.degree_over(GF(5)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field of size 5 @@ -1496,20 +1495,20 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: A = GF(5^4).over(GF(5^2)) - sage: B = GF(5^12).over(A) + sage: A = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings + sage: B = GF(5^12).over(A) # optional - sage.rings.finite_rings - sage: A.degree(GF(5^2)) + sage: A.degree(GF(5^2)) # optional - sage.rings.finite_rings 2 - sage: B.degree(A) + sage: B.degree(A) # optional - sage.rings.finite_rings 3 - sage: B.degree(GF(5^2)) + sage: B.degree(GF(5^2)) # optional - sage.rings.finite_rings 6 Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: A.degree(GF(5)) + sage: A.degree(GF(5)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field of size 5 @@ -1526,8 +1525,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: A = GF(5^4).over(GF(5^2)) - sage: A.relative_degree() + sage: A = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings + sage: A.relative_degree() # optional - sage.rings.finite_rings 2 .. SEEALSO:: @@ -1542,12 +1541,12 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: A = GF(5^4).over(GF(5^2)) - sage: B = GF(5^12).over(A) + sage: A = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings + sage: B = GF(5^12).over(A) # optional - sage.rings.finite_rings - sage: A.absolute_degree() + sage: A.absolute_degree() # optional - sage.rings.finite_rings 2 - sage: B.absolute_degree() + sage: B.absolute_degree() # optional - sage.rings.finite_rings 6 .. SEEALSO:: @@ -1567,18 +1566,18 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^2).over() # over GF(5) - sage: L = GF(5^4).over(K) + sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: L = GF(5^4).over(K) # optional - sage.rings.finite_rings - sage: L.is_finite_over(K) + sage: L.is_finite_over(K) # optional - sage.rings.finite_rings True - sage: L.is_finite_over(GF(5)) + sage: L.is_finite_over(GF(5)) # optional - sage.rings.finite_rings True If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: L.is_finite_over() + sage: L.is_finite_over() # optional - sage.rings.finite_rings True """ cdef CommutativeRing b @@ -1612,8 +1611,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): TESTS:: - sage: K = GF(5^2).over() # over GF(5) - sage: K.is_finite_over() # indirect doctest + sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: K.is_finite_over() # indirect doctest # optional - sage.rings.finite_rings True """ raise NotImplementedError @@ -1630,18 +1629,18 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^2).over() # over GF(5) - sage: L = GF(5^4).over(K) + sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: L = GF(5^4).over(K) # optional - sage.rings.finite_rings - sage: L.is_free_over(K) + sage: L.is_free_over(K) # optional - sage.rings.finite_rings True - sage: L.is_free_over(GF(5)) + sage: L.is_free_over(GF(5)) # optional - sage.rings.finite_rings True If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: L.is_free_over() + sage: L.is_free_over() # optional - sage.rings.finite_rings True """ cdef CommutativeRing b @@ -1675,8 +1674,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): TESTS:: - sage: K = GF(5^2).over() # over GF(5) - sage: K.is_free_over() # indirect doctest + sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: K.is_free_over() # indirect doctest # optional - sage.rings.finite_rings True """ raise NotImplementedError @@ -1691,17 +1690,17 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^5).over() # over GF(5) - sage: K.is_field() + sage: K = GF(5^5).over() # over GF(5) # optional - sage.rings.finite_rings + sage: K.is_field() # optional - sage.rings.finite_rings True - sage: S. = QQ[] - sage: A = S.over(QQ) - sage: A.is_field() + sage: S. = QQ[] # optional - sage.rings.finite_rings + sage: A = S.over(QQ) # optional - sage.rings.finite_rings + sage: A.is_field() # optional - sage.rings.finite_rings False - sage: B = A.fraction_field() - sage: B.is_field() + sage: B = A.fraction_field() # optional - sage.rings.finite_rings + sage: B.is_field() # optional - sage.rings.finite_rings True """ return self._backend.is_field(proof=proof) @@ -1728,43 +1727,45 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 5) - sage: OK = A.over() # over ZZ - sage: OK + sage: A. = ZZ.extension(x^2 - 5) # optional - sage.rings.number_field + sage: OK = A.over() # over ZZ # optional - sage.rings.number_field + sage: OK # optional - sage.rings.number_field Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K1 = OK.fraction_field() - sage: K1 - Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K1.bases() - [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, + sage: K1 = OK.fraction_field(); K1 # optional - sage.rings.number_field + Fraction Field of Order in Number Field in a + with defining polynomial x^2 - 5 over its base + sage: K1.bases() # optional - sage.rings.number_field + [Fraction Field of Order in Number Field in a + with defining polynomial x^2 - 5 over its base, Order in Number Field in a with defining polynomial x^2 - 5 over its base, Integer Ring] - sage: K2 = OK.fraction_field(extend_base=True) - sage: K2 - Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K2.bases() - [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, + sage: K2 = OK.fraction_field(extend_base=True); K2 # optional - sage.rings.number_field + Fraction Field of Order in Number Field in a + with defining polynomial x^2 - 5 over its base + sage: K2.bases() # optional - sage.rings.number_field + [Fraction Field of Order in Number Field in a + with defining polynomial x^2 - 5 over its base, Rational Field] Note that there is no coercion between `K_1` and `K_2`:: - sage: K1.has_coerce_map_from(K2) + sage: K1.has_coerce_map_from(K2) # optional - sage.rings.number_field False - sage: K2.has_coerce_map_from(K1) + sage: K2.has_coerce_map_from(K1) # optional - sage.rings.number_field False We check that when the extension is a field, its fraction field does not change:: - sage: K1.fraction_field() is K1 + sage: K1.fraction_field() is K1 # optional - sage.rings.number_field True - sage: K2.fraction_field() is K2 + sage: K2.fraction_field() is K2 # optional - sage.rings.number_field True TESTS:: - sage: A = GF(5).over(ZZ) + sage: A = GF(5).over(ZZ) # optional - sage.rings.finite_rings sage: A.fraction_field(extend_base=True) Traceback (most recent call last): ... @@ -1790,8 +1791,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): TESTS:: - sage: K = GF(5^2).over() - sage: K.fraction_field() # indirect doctest + sage: K = GF(5^2).over() # optional - sage.rings.finite_rings + sage: K.fraction_field() # indirect doctest # optional - sage.rings.finite_rings Field in z2 with defining polynomial x^2 + 4*x + 2 over its base sage: K = QQ.over(ZZ) @@ -1825,15 +1826,15 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2) - sage: K = GF(5^4).over(F) - sage: L = GF(5^12).over(F) + sage: F = GF(5^2) # optional - sage.rings.finite_rings + sage: K = GF(5^4).over(F) # optional - sage.rings.finite_rings + sage: L = GF(5^12).over(F) # optional - sage.rings.finite_rings - sage: K.Hom(L) # indirect doctest + sage: K.Hom(L) # indirect doctest # optional - sage.rings.finite_rings Set of Homomorphisms from Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base to Field in z12 with defining polynomial x^6 + (4*z2 + 3)*x^5 + x^4 + (3*z2 + 1)*x^3 + x^2 + (4*z2 + 1)*x + z2 over its base - sage: K.Hom(L, category=Sets()) + sage: K.Hom(L, category=Sets()) # optional - sage.rings.finite_rings Set of Morphisms from Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base to Field in z12 with defining polynomial x^6 + (4*z2 + 3)*x^5 + x^4 + (3*z2 + 1)*x^3 + x^2 + (4*z2 + 1)*x + z2 over its base in Category of sets @@ -1869,12 +1870,12 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) - sage: L. = GF(5^6).over(K) + sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings We define (by hand) the relative Frobenius endomorphism of the extension `L/K`:: - sage: L.hom([b^25]) + sage: L.hom([b^25]) # optional - sage.rings.finite_rings Ring endomorphism of Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: b |--> 2 + 2*a*b + (2 - a)*b^2 @@ -1882,16 +1883,15 @@ cdef class RingExtension_generic(CommutativeAlgebra): because it is not a homomorphism of `K`-algebras. For this reason, the construction ``L.hom([b^5])`` fails:: - sage: L.hom([b^5]) + sage: L.hom([b^5]) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: images do not define a valid homomorphism What we need is to specify a base map:: - sage: FrobK = K.hom([a^5]) - sage: FrobL = L.hom([b^5], base_map=FrobK) - sage: FrobL + sage: FrobK = K.hom([a^5]) # optional - sage.rings.finite_rings + sage: FrobL = L.hom([b^5], base_map=FrobK); FrobL # optional - sage.rings.finite_rings Ring endomorphism of Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: b |--> (-1 + a) + (1 + 2*a)*b + a*b^2 with map on base ring: @@ -1899,13 +1899,12 @@ cdef class RingExtension_generic(CommutativeAlgebra): As a shortcut, we may use the following construction:: - sage: phi = L.hom([b^5, a^5]) - sage: phi + sage: phi = L.hom([b^5, a^5]); phi # optional - sage.rings.finite_rings Ring endomorphism of Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: b |--> (-1 + a) + (1 + 2*a)*b + a*b^2 with map on base ring: a |--> 1 - a - sage: phi == FrobL + sage: phi == FrobL # optional - sage.rings.finite_rings True """ if codomain is None: @@ -1924,14 +1923,14 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2).over() # over GF(5) - sage: K = GF(5^4).over(F) - sage: L = GF(5^12).over(K) - sage: F.characteristic() + sage: F = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: K = GF(5^4).over(F) # optional - sage.rings.finite_rings + sage: L = GF(5^12).over(K) # optional - sage.rings.finite_rings + sage: F.characteristic() # optional - sage.rings.finite_rings 5 - sage: K.characteristic() + sage: K.characteristic() # optional - sage.rings.finite_rings 5 - sage: L.characteristic() + sage: L.characteristic() # optional - sage.rings.finite_rings 5 :: @@ -1942,28 +1941,30 @@ cdef class RingExtension_generic(CommutativeAlgebra): :: - sage: F = GF(11) - sage: A. = F[] - sage: K = Frac(F).over(F) - sage: K.characteristic() + sage: F = GF(11) # optional - sage.rings.finite_rings + sage: A. = F[] # optional - sage.rings.finite_rings + sage: K = Frac(F).over(F) # optional - sage.rings.finite_rings + sage: K.characteristic() # optional - sage.rings.finite_rings 11 :: - sage: E = GF(7).over(ZZ) - sage: E.characteristic() + sage: E = GF(7).over(ZZ) # optional - sage.rings.finite_rings + sage: E.characteristic() # optional - sage.rings.finite_rings 7 TESTS: Ensure issue :trac:`34692` is fixed:: - sage: Fq = GF(11) - sage: FqX. = Fq[] - sage: k = Frac(FqX) - sage: K = k.over(FqX) - sage: K.frobenius_endomorphism() - Frobenius endomorphism x |--> x^11 of Fraction Field of Univariate Polynomial Ring in X over Finite Field of size 11 over its base + sage: Fq = GF(11) # optional - sage.rings.finite_rings + sage: FqX. = Fq[] # optional - sage.rings.finite_rings + sage: k = Frac(FqX) # optional - sage.rings.finite_rings + sage: K = k.over(FqX) # optional - sage.rings.finite_rings + sage: K.frobenius_endomorphism() # optional - sage.rings.finite_rings + Frobenius endomorphism x |--> x^11 of + Fraction Field of Univariate Polynomial Ring in X over + Finite Field of size 11 over its base """ return self._backend.characteristic() @@ -2004,13 +2005,13 @@ cdef class RingExtensionFractionField(RingExtension_generic): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) - sage: OK = A.over() - sage: K = OK.fraction_field() - sage: K - Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2 over its base + sage: A. = ZZ.extension(x^2 - 2) # optional - sage.rings.number_field + sage: OK = A.over() # optional - sage.rings.number_field + sage: K = OK.fraction_field(); K # optional - sage.rings.number_field + Fraction Field of + Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: TestSuite(K).run() + sage: TestSuite(K).run() # optional - sage.rings.number_field """ RingExtension_generic.__init__(self, defining_morphism, **kwargs) @@ -2026,15 +2027,15 @@ cdef class RingExtensionFractionField(RingExtension_generic): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) - sage: OK = A.over() - sage: K = OK.fraction_field() - sage: K - Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2 over its base + sage: A. = ZZ.extension(x^2 - 2) # optional - sage.rings.number_field + sage: OK = A.over() # optional - sage.rings.number_field + sage: K = OK.fraction_field(); K # optional - sage.rings.number_field + Fraction Field of + Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: K.ring() + sage: K.ring() # optional - sage.rings.number_field Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: K.ring() is OK + sage: K.ring() is OK # optional - sage.rings.number_field True """ return self._ring @@ -2046,11 +2047,11 @@ cdef class RingExtensionFractionField(RingExtension_generic): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) - sage: OK = A.over() - sage: K = OK.fraction_field() + sage: A. = ZZ.extension(x^2 - 2) # optional - sage.rings.number_field + sage: OK = A.over() # optional - sage.rings.number_field + sage: K = OK.fraction_field() # optional - sage.rings.number_field - sage: K._repr_topring() + sage: K._repr_topring() # optional - sage.rings.number_field 'Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2' """ if isinstance(self._ring, RingExtension_generic): @@ -2090,11 +2091,10 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: - sage: E = GF(5^4).over(GF(5^2)) - sage: E + sage: E = GF(5^4).over(GF(5^2)); E # optional - sage.rings.finite_rings Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base - sage: TestSuite(E).run() + sage: TestSuite(E).run() # optional - sage.rings.finite_rings """ Element = RingExtensionWithBasisElement @@ -2117,12 +2117,11 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: sage: x = polygen(ZZ, 'x') - sage: K. = QQ.extension(x^3 - 2) - sage: E = K.over() - sage: E + sage: K. = QQ.extension(x^3 - 2) # optional - sage.rings.number_field + sage: E = K.over(); E # optional - sage.rings.number_field Field in a with defining polynomial x^3 - 2 over its base - sage: TestSuite(E).run() + sage: TestSuite(E).run() # optional - sage.rings.number_field """ RingExtension_generic.__init__(self, defining_morphism, **kwargs) self._basis = [ self(b) for b in basis ] @@ -2162,26 +2161,26 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: - sage: F = GF(5) - sage: K = GF(5^2).over(F) - sage: L = GF(5^4).over(K) + sage: F = GF(5) # optional - sage.rings.finite_rings + sage: K = GF(5^2).over(F) # optional - sage.rings.finite_rings + sage: L = GF(5^4).over(K) # optional - sage.rings.finite_rings - sage: L._print_option_base(F) is F + sage: L._print_option_base(F) is F # optional - sage.rings.finite_rings True - sage: L._print_option_base(K) is K + sage: L._print_option_base(K) is K # optional - sage.rings.finite_rings True - sage: L._print_option_base(GF(5^2)) is K + sage: L._print_option_base(GF(5^2)) is K # optional - sage.rings.finite_rings True - sage: L._print_option_base(None) is K + sage: L._print_option_base(None) is K # optional - sage.rings.finite_rings True - sage: L._print_option_base(L) + sage: L._print_option_base(L) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: base must be strict - sage: K._print_option_base(L) + sage: K._print_option_base(L) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Field in z4 with defining polynomial x^2 + (3 - z2)*x + z2 over its base @@ -2236,8 +2235,8 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: - sage: K = GF(5^2).over() # over GF(5) - sage: K.is_finite_over() # indirect doctest + sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: K.is_finite_over() # indirect doctest # optional - sage.rings.finite_rings True """ if base is self or base is self._base: @@ -2255,8 +2254,8 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: - sage: K = GF(5^2).over() # over GF(5) - sage: K.is_free_over() # indirect doctest + sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: K.is_free_over() # indirect doctest # optional - sage.rings.finite_rings True """ if base is self or base is self._base: @@ -2274,32 +2273,32 @@ cdef class RingExtensionWithBasis(RingExtension_generic): EXAMPLES:: - sage: F. = GF(5^2).over() # over GF(5) - sage: K. = GF(5^4).over(F) - sage: L. = GF(5^12).over(K) + sage: F. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: K. = GF(5^4).over(F) # optional - sage.rings.finite_rings + sage: L. = GF(5^12).over(K) # optional - sage.rings.finite_rings - sage: L.basis_over(K) + sage: L.basis_over(K) # optional - sage.rings.finite_rings [1, c, c^2] - sage: L.basis_over(F) + sage: L.basis_over(F) # optional - sage.rings.finite_rings [1, b, c, b*c, c^2, b*c^2] - sage: L.basis_over(GF(5)) + sage: L.basis_over(GF(5)) # optional - sage.rings.finite_rings [1, a, b, a*b, c, a*c, b*c, a*b*c, c^2, a*c^2, b*c^2, a*b*c^2] If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: L.basis_over() + sage: L.basis_over() # optional - sage.rings.finite_rings [1, c, c^2] - sage: K.basis_over() + sage: K.basis_over() # optional - sage.rings.finite_rings [1, b] Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: L.degree_over(GF(5^6)) + sage: L.degree_over(GF(5^6)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z6 of size 5^6 @@ -2358,54 +2357,60 @@ cdef class RingExtensionWithBasis(RingExtension_generic): EXAMPLES:: - sage: F = GF(11) - sage: K. = GF(11^2).over() - sage: L. = GF(11^6).over(K) + sage: F = GF(11) # optional - sage.rings.finite_rings + sage: K. = GF(11^2).over() # optional - sage.rings.finite_rings + sage: L. = GF(11^6).over(K) # optional - sage.rings.finite_rings Forgetting a part of the multiplicative structure, the field L can be viewed as a vector space of dimension 3 over K, equipped with a distinguished basis, namely `(1, b, b^2)`:: - sage: V, i, j = L.free_module(K) - sage: V - Vector space of dimension 3 over Field in a with defining polynomial x^2 + 7*x + 2 over its base - sage: i + sage: V, i, j = L.free_module(K) # optional - sage.rings.finite_rings + sage: V # optional - sage.rings.finite_rings + Vector space of dimension 3 over + Field in a with defining polynomial x^2 + 7*x + 2 over its base + sage: i # optional - sage.rings.finite_rings Generic map: - From: Vector space of dimension 3 over Field in a with defining polynomial x^2 + 7*x + 2 over its base - To: Field in b with defining polynomial x^3 + (7 + 2*a)*x^2 + (2 - a)*x - a over its base - sage: j + From: Vector space of dimension 3 over + Field in a with defining polynomial x^2 + 7*x + 2 over its base + To: Field in b with defining polynomial + x^3 + (7 + 2*a)*x^2 + (2 - a)*x - a over its base + sage: j # optional - sage.rings.finite_rings Generic map: - From: Field in b with defining polynomial x^3 + (7 + 2*a)*x^2 + (2 - a)*x - a over its base - To: Vector space of dimension 3 over Field in a with defining polynomial x^2 + 7*x + 2 over its base + From: Field in b with defining polynomial + x^3 + (7 + 2*a)*x^2 + (2 - a)*x - a over its base + To: Vector space of dimension 3 over + Field in a with defining polynomial x^2 + 7*x + 2 over its base - sage: j(b) + sage: j(b) # optional - sage.rings.finite_rings (0, 1, 0) - sage: i((1, a, a+1)) + sage: i((1, a, a+1)) # optional - sage.rings.finite_rings 1 + a*b + (1 + a)*b^2 Similarly, one can view L as a F-vector space of dimension 6:: - sage: V, i, j, = L.free_module(F) - sage: V + sage: V, i, j, = L.free_module(F) # optional - sage.rings.finite_rings + sage: V # optional - sage.rings.finite_rings Vector space of dimension 6 over Finite Field of size 11 In this case, the isomorphisms between `V` and `L` are given by the basis `(1, a, b, ab, b^2, ab^2)`: - sage: j(a*b) + sage: j(a*b) # optional - sage.rings.finite_rings (0, 0, 0, 1, 0, 0) - sage: i((1,2,3,4,5,6)) + sage: i((1,2,3,4,5,6)) # optional - sage.rings.finite_rings (1 + 2*a) + (3 + 4*a)*b + (5 + 6*a)*b^2 When ``base`` is omitted, the default is the base of this extension:: - sage: L.free_module(map=False) - Vector space of dimension 3 over Field in a with defining polynomial x^2 + 7*x + 2 over its base + sage: L.free_module(map=False) # optional - sage.rings.finite_rings + Vector space of dimension 3 over + Field in a with defining polynomial x^2 + 7*x + 2 over its base Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: L.degree(GF(11^3)) + sage: L.degree(GF(11^3)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z3 of size 11^3 @@ -2441,9 +2446,9 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: - sage: K = GF(7^5).over() - sage: L = GF(7^15).over(K) - sage: for base in L.bases(): + sage: K = GF(7^5).over() # optional - sage.rings.finite_rings + sage: L = GF(7^15).over(K) # optional - sage.rings.finite_rings + sage: for base in L.bases(): # optional - sage.rings.finite_rings ....: V, i, j = L.free_module(base) ....: assert([ i(v) for v in V.basis() ] == L.basis_over(base)) ....: assert([ j(x) for x in L.basis_over(base) ] == V.basis()) @@ -2477,43 +2482,45 @@ cdef class RingExtensionWithBasis(RingExtension_generic): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 5) - sage: OK = A.over() # over ZZ - sage: OK + sage: A. = ZZ.extension(x^2 - 5) # optional - sage.rings.number_field + sage: OK = A.over() # over ZZ # optional - sage.rings.number_field + sage: OK # optional - sage.rings.number_field Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K1 = OK.fraction_field() - sage: K1 - Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K1.bases() - [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, + sage: K1 = OK.fraction_field(); K1 # optional - sage.rings.number_field + Fraction Field of Order in Number Field in a + with defining polynomial x^2 - 5 over its base + sage: K1.bases() # optional - sage.rings.number_field + [Fraction Field of Order in Number Field in a + with defining polynomial x^2 - 5 over its base, Order in Number Field in a with defining polynomial x^2 - 5 over its base, Integer Ring] - sage: K2 = OK.fraction_field(extend_base=True) - sage: K2 - Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K2.bases() - [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, + sage: K2 = OK.fraction_field(extend_base=True); K2 # optional - sage.rings.number_field + Fraction Field of Order in Number Field in a + with defining polynomial x^2 - 5 over its base + sage: K2.bases() # optional - sage.rings.number_field + [Fraction Field of Order in Number Field in a + with defining polynomial x^2 - 5 over its base, Rational Field] Note that there is no coercion map between `K_1` and `K_2`:: - sage: K1.has_coerce_map_from(K2) + sage: K1.has_coerce_map_from(K2) # optional - sage.rings.number_field False - sage: K2.has_coerce_map_from(K1) + sage: K2.has_coerce_map_from(K1) # optional - sage.rings.number_field False We check that when the extension is a field, its fraction field does not change:: - sage: K1.fraction_field() is K1 + sage: K1.fraction_field() is K1 # optional - sage.rings.number_field True - sage: K2.fraction_field() is K2 + sage: K2.fraction_field() is K2 # optional - sage.rings.number_field True TESTS:: - sage: A = GF(5).over(ZZ) + sage: A = GF(5).over(ZZ) # optional - sage.rings.finite_rings sage: A.fraction_field(extend_base=True) Traceback (most recent call last): ... @@ -2544,13 +2551,13 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^3 - 7) - sage: K = A.over() + sage: A. = QQ.extension(x^3 - 7) # optional - sage.rings.number_field + sage: K = A.over() # optional - sage.rings.number_field - sage: type(K) + sage: type(K) # optional - sage.rings.number_field - sage: TestSuite(K).run() + sage: TestSuite(K).run() # optional - sage.rings.number_field """ def __init__(self, defining_morphism, gen, names, check=True, **kwargs): @@ -2572,12 +2579,11 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): TESTS:: sage: x = polygen(ZZ, 'x') - sage: K. = QQ.extension(x^3 + 3*x + 1) - sage: E = K.over() - sage: E + sage: K. = QQ.extension(x^3 + 3*x + 1) # optional - sage.rings.number_field + sage: E = K.over(); E # optional - sage.rings.number_field Field in a with defining polynomial x^3 + 3*x + 1 over its base - sage: TestSuite(E).run() + sage: TestSuite(E).run() # optional - sage.rings.number_field """ self._name = names[0] backend_base = backend_parent(defining_morphism.domain()) @@ -2604,12 +2610,12 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): EXAMPLES:: - sage: K. = GF(5^3).over() - sage: K._repr_topring() + sage: K. = GF(5^3).over() # optional - sage.rings.finite_rings + sage: K._repr_topring() # optional - sage.rings.finite_rings 'Field in a with defining polynomial x^3 + 3*x + 3' - sage: L. = GF(5^9).over(K) - sage: L._repr_topring() + sage: L. = GF(5^9).over(K) # optional - sage.rings.finite_rings + sage: L._repr_topring() # optional - sage.rings.finite_rings 'Field in b with defining polynomial x^3 + (1 + 3*a^2)*x^2 + (3 + 2*a + 2*a^2)*x - a' """ if self._name is None: @@ -2622,12 +2628,12 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): EXAMPLES:: - sage: K. = GF(5^3).over() - sage: K._latex_topring() + sage: K. = GF(5^3).over() # optional - sage.rings.finite_rings + sage: K._latex_topring() # optional - sage.rings.finite_rings '\\Bold{F}_{5}[a]' - sage: L. = GF(5^9).over(K) - sage: L._latex_topring() + sage: L. = GF(5^9).over(K) # optional - sage.rings.finite_rings + sage: L._latex_topring() # optional - sage.rings.finite_rings '\\Bold{F}_{5}[a][b]' """ if self._name is None: @@ -2648,18 +2654,18 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): EXAMPLES:: - sage: K. = GF(7^10).over(GF(7^2)) - sage: K - Field in u with defining polynomial x^5 + (6*z2 + 4)*x^4 + (3*z2 + 5)*x^3 + (2*z2 + 2)*x^2 + 4*x + 6*z2 over its base + sage: K. = GF(7^10).over(GF(7^2)); K # optional - sage.rings.finite_rings + Field in u with defining polynomial x^5 + (6*z2 + 4)*x^4 + + (3*z2 + 5)*x^3 + (2*z2 + 2)*x^2 + 4*x + 6*z2 over its base - sage: P = K.modulus(); P + sage: P = K.modulus(); P # optional - sage.rings.finite_rings x^5 + (6*z2 + 4)*x^4 + (3*z2 + 5)*x^3 + (2*z2 + 2)*x^2 + 4*x + 6*z2 - sage: P(u) + sage: P(u) # optional - sage.rings.finite_rings 0 We can use a different variable name:: - sage: K.modulus('y') + sage: K.modulus('y') # optional - sage.rings.finite_rings y^5 + (6*z2 + 4)*y^4 + (3*z2 + 5)*y^3 + (2*z2 + 2)*y^2 + 4*y + 6*z2 """ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing @@ -2680,14 +2686,14 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) - sage: K.gens() + sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: K.gens() # optional - sage.rings.finite_rings (a,) - sage: L. = GF(5^4).over(K) - sage: L.gens() + sage: L. = GF(5^4).over(K) # optional - sage.rings.finite_rings + sage: L.gens() # optional - sage.rings.finite_rings (b,) - sage: L.gens(GF(5)) + sage: L.gens(GF(5)) # optional - sage.rings.finite_rings (b, a) """ if base is None: @@ -2722,43 +2728,45 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 5) - sage: OK = A.over() # over ZZ - sage: OK + sage: A. = ZZ.extension(x^2 - 5) # optional - sage.rings.number_field + sage: OK = A.over() # over ZZ # optional - sage.rings.number_field + sage: OK # optional - sage.rings.number_field Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K1 = OK.fraction_field() - sage: K1 - Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K1.bases() - [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, + sage: K1 = OK.fraction_field(); K1 # optional - sage.rings.number_field + Fraction Field of Order in Number Field in a + with defining polynomial x^2 - 5 over its base + sage: K1.bases() # optional - sage.rings.number_field + [Fraction Field of Order in Number Field in a + with defining polynomial x^2 - 5 over its base, Order in Number Field in a with defining polynomial x^2 - 5 over its base, Integer Ring] - sage: K2 = OK.fraction_field(extend_base=True) - sage: K2 - Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K2.bases() - [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, + sage: K2 = OK.fraction_field(extend_base=True); K2 # optional - sage.rings.number_field + Fraction Field of Order in Number Field in a + with defining polynomial x^2 - 5 over its base + sage: K2.bases() # optional - sage.rings.number_field + [Fraction Field of Order in Number Field in a + with defining polynomial x^2 - 5 over its base, Rational Field] Note that there is no coercion map between `K_1` and `K_2`:: - sage: K1.has_coerce_map_from(K2) + sage: K1.has_coerce_map_from(K2) # optional - sage.rings.number_field False - sage: K2.has_coerce_map_from(K1) + sage: K2.has_coerce_map_from(K1) # optional - sage.rings.number_field False We check that when the extension is a field, its fraction field does not change:: - sage: K1.fraction_field() is K1 + sage: K1.fraction_field() is K1 # optional - sage.rings.number_field True - sage: K2.fraction_field() is K2 + sage: K2.fraction_field() is K2 # optional - sage.rings.number_field True TESTS:: - sage: A = GF(5).over(ZZ) + sage: A = GF(5).over(ZZ) # optional - sage.rings.finite_rings sage: A.fraction_field(extend_base=True) Traceback (most recent call last): ... diff --git a/src/sage/rings/ring_extension_conversion.pyx b/src/sage/rings/ring_extension_conversion.pyx index 9d94fb7567d..6ea90ddbdb5 100644 --- a/src/sage/rings/ring_extension_conversion.pyx +++ b/src/sage/rings/ring_extension_conversion.pyx @@ -1,3 +1,5 @@ +# sage.doctest: optional - sage.rings.finite_rings + ############################################################################# # Copyright (C) 2019 Xavier Caruso # diff --git a/src/sage/rings/ring_extension_element.pyx b/src/sage/rings/ring_extension_element.pyx index 4b1809a8db5..aa6bfc45be3 100644 --- a/src/sage/rings/ring_extension_element.pyx +++ b/src/sage/rings/ring_extension_element.pyx @@ -43,9 +43,9 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K = GF(5^4).over() - sage: x = K.random_element() - sage: TestSuite(x).run() + sage: K = GF(5^4).over() # optional - sage.rings.finite_rings + sage: x = K.random_element() # optional - sage.rings.finite_rings + sage: TestSuite(x).run() # optional - sage.rings.finite_rings """ def __init__(self, RingExtension_generic parent, x, *args, **kwds): @@ -86,11 +86,11 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K = GF(5^3).over() - sage: x = K.random_element() - sage: type(x) + sage: K = GF(5^3).over() # optional - sage.rings.finite_rings + sage: x = K.random_element() # optional - sage.rings.finite_rings + sage: type(x) # optional - sage.rings.finite_rings - sage: loads(dumps(x)) == x + sage: loads(dumps(x)) == x # optional - sage.rings.finite_rings True """ return self._parent, (self._backend,) @@ -173,8 +173,8 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES: - sage: E. = GF(5^3).over() - sage: hash(a) + sage: E. = GF(5^3).over() # optional - sage.rings.finite_rings + sage: hash(a) # optional - sage.rings.finite_rings 5 """ return hash(self._backend) @@ -188,9 +188,9 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K. = GF(5^2).over() - sage: L. = GF(5^4).over(K) - sage: b._repr_() + sage: K. = GF(5^2).over() # optional - sage.rings.finite_rings + sage: L. = GF(5^4).over(K) # optional - sage.rings.finite_rings + sage: b._repr_() # optional - sage.rings.finite_rings 'b' """ cdef RingExtension_generic parent = self._parent @@ -232,9 +232,9 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K. = GF(5^2).over() - sage: L. = GF(5^4).over(K) - sage: b._latex_() + sage: K. = GF(5^2).over() # optional - sage.rings.finite_rings + sage: L. = GF(5^4).over(K) # optional - sage.rings.finite_rings + sage: b._latex_() # optional - sage.rings.finite_rings 'b' """ cdef RingExtension_generic parent = self._parent @@ -370,13 +370,13 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: - sage: K. = GF(5^2).over() - sage: x = K.random_element() - sage: x == x + sage: K. = GF(5^2).over() # optional - sage.rings.finite_rings + sage: x = K.random_element() # optional - sage.rings.finite_rings + sage: x == x # optional - sage.rings.finite_rings True - sage: x == x + 1 + sage: x == x + 1 # optional - sage.rings.finite_rings False - sage: x == x^25 + sage: x == x^25 # optional - sage.rings.finite_rings True """ return left._backend._richcmp_(backend_element(right), op) @@ -387,13 +387,13 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K = GF(5^4).over(GF(5^2)) - sage: x = K.random_element() - sage: y = K.random_element() + sage: K = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings + sage: x = K.random_element() # optional - sage.rings.finite_rings + sage: y = K.random_element() # optional - sage.rings.finite_rings - sage: (x+y).parent() is K + sage: (x+y).parent() is K # optional - sage.rings.finite_rings True - sage: x + y == y + x + sage: x + y == y + x # optional - sage.rings.finite_rings True """ cdef RingExtensionElement ans = PY_NEW(type(self)) @@ -407,13 +407,13 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K = GF(5^4).over(GF(5^2)) - sage: x = K.random_element() + sage: K = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings + sage: x = K.random_element() # optional - sage.rings.finite_rings - sage: y = -x - sage: y.parent() is K + sage: y = -x # optional - sage.rings.finite_rings + sage: y.parent() is K # optional - sage.rings.finite_rings True - sage: x + y == 0 + sage: x + y == 0 # optional - sage.rings.finite_rings True """ cdef RingExtensionElement ans = PY_NEW(type(self)) @@ -427,13 +427,13 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K = GF(5^4).over(GF(5^2)) - sage: x = K.random_element() - sage: y = K.random_element() + sage: K = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings + sage: x = K.random_element() # optional - sage.rings.finite_rings + sage: y = K.random_element() # optional - sage.rings.finite_rings - sage: (x-y).parent() is K + sage: (x-y).parent() is K # optional - sage.rings.finite_rings True - sage: x - y == x + (-y) + sage: x - y == x + (-y) # optional - sage.rings.finite_rings True """ cdef RingExtensionElement ans = PY_NEW(type(self)) @@ -447,13 +447,13 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K = GF(5^4).over(GF(5^2)) - sage: x = K.random_element() - sage: y = K.random_element() + sage: K = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings + sage: x = K.random_element() # optional - sage.rings.finite_rings + sage: y = K.random_element() # optional - sage.rings.finite_rings - sage: (x*y).parent() is K + sage: (x*y).parent() is K # optional - sage.rings.finite_rings True - sage: x * y == y * x + sage: x * y == y * x # optional - sage.rings.finite_rings True """ cdef RingExtensionElement ans = PY_NEW(type(self)) @@ -469,15 +469,16 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) - sage: OK = A.over() - sage: a = OK(a) + sage: A. = ZZ.extension(x^2 - 2) # optional - sage.rings.number_field + sage: OK = A.over() # optional - sage.rings.number_field + sage: a = OK(a) # optional - sage.rings.number_field - sage: b = 1/a; b + sage: b = 1/a; b # optional - sage.rings.number_field a/2 - sage: b.parent() - Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: a*b + sage: b.parent() # optional - sage.rings.number_field + Fraction Field of + Order in Number Field in a with defining polynomial x^2 - 2 over its base + sage: a*b # optional - sage.rings.number_field 1 """ cdef RingExtensionElement ans @@ -496,8 +497,8 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: - sage: K. = GF(5^4).over(GF(5^2)) - sage: a.additive_order() + sage: K. = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings + sage: a.additive_order() # optional - sage.rings.finite_rings 5 """ return self._backend.additive_order() @@ -508,8 +509,8 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: - sage: K. = GF(5^4).over(GF(5^2)) - sage: a.multiplicative_order() + sage: K. = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings + sage: a.multiplicative_order() # optional - sage.rings.finite_rings 624 """ return self._backend.multiplicative_order() @@ -570,16 +571,16 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: - sage: K. = GF(5^3).over() - sage: a.is_square() + sage: K. = GF(5^3).over() # optional - sage.rings.finite_rings + sage: a.is_square() # optional - sage.rings.finite_rings False - sage: a.is_square(root=True) + sage: a.is_square(root=True) # optional - sage.rings.finite_rings (False, None) - sage: b = a + 1 - sage: b.is_square() + sage: b = a + 1 # optional - sage.rings.finite_rings + sage: b.is_square() # optional - sage.rings.finite_rings True - sage: b.is_square(root=True) + sage: b.is_square(root=True) # optional - sage.rings.finite_rings (True, 2 + 3*a + a^2) """ is_sq = self._backend.is_square() @@ -599,7 +600,7 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): - ``extend`` -- a boolean (default: ``True``); if "True", return a square root in an extension ring, if necessary. - Otherwise, raise a ``ValueError`` if the root is not in + Otherwise, raise a :class:`ValueError` if the root is not in the ring - ``all`` -- a boolean (default: ``False``); if ``True``, @@ -610,15 +611,15 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): .. NOTE:: - The option `extend=True` is often not implemented. + The option ``extend=True`` is often not implemented. EXAMPLES:: - sage: K. = GF(5^3).over() - sage: b = a + 1 - sage: b.sqrt() + sage: K. = GF(5^3).over() # optional - sage.rings.finite_rings + sage: b = a + 1 # optional - sage.rings.finite_rings + sage: b.sqrt() # optional - sage.rings.finite_rings 2 + 3*a + a^2 - sage: b.sqrt(all=True) + sage: b.sqrt(all=True) # optional - sage.rings.finite_rings [2 + 3*a + a^2, 3 + 2*a - a^2] """ sq = self._backend.sqrt(extend=extend, all=all) @@ -664,8 +665,8 @@ cdef class RingExtensionFractionFieldElement(RingExtensionElement): EXAMPLES: - sage: E. = GF(5^3).over() - sage: hash(a) + sage: E. = GF(5^3).over() # optional - sage.rings.finite_rings + sage: hash(a) # optional - sage.rings.finite_rings 5 """ return hash(self._backend) @@ -745,29 +746,29 @@ cdef class RingExtensionFractionFieldElement(RingExtensionElement): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) - sage: OK = A.over() # over ZZ - sage: K = OK.fraction_field() - sage: K - Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2 over its base + sage: A. = ZZ.extension(x^2 - 2) # optional - sage.rings.number_field + sage: OK = A.over() # over ZZ # optional - sage.rings.number_field + sage: K = OK.fraction_field(); K # optional - sage.rings.number_field + Fraction Field of Order in Number Field in a + with defining polynomial x^2 - 2 over its base - sage: x = K(1/a); x + sage: x = K(1/a); x # optional - sage.rings.number_field a/2 - sage: num = x.numerator(); num + sage: num = x.numerator(); num # optional - sage.rings.number_field a The numerator is an element of the ring which was used to construct the fraction field:: - sage: num.parent() + sage: num.parent() # optional - sage.rings.number_field Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: num.parent() is OK + sage: num.parent() is OK # optional - sage.rings.number_field True TESTS:: - sage: x = K.random_element() - sage: x == x.numerator() / x.denominator() + sage: x = K.random_element() # optional - sage.rings.number_field + sage: x == x.numerator() / x.denominator() # optional - sage.rings.number_field True """ ring = (self._parent)._ring @@ -781,29 +782,29 @@ cdef class RingExtensionFractionFieldElement(RingExtensionElement): EXAMPLES:: sage: R. = ZZ[] - sage: A. = ZZ.extension(x^2 - 2) - sage: OK = A.over() # over ZZ - sage: K = OK.fraction_field() - sage: K - Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2 over its base + sage: A. = ZZ.extension(x^2 - 2) # optional - sage.rings.number_field + sage: OK = A.over() # over ZZ # optional - sage.rings.number_field + sage: K = OK.fraction_field(); K # optional - sage.rings.number_field + Fraction Field of Order in Number Field in a + with defining polynomial x^2 - 2 over its base - sage: x = K(1/a); x + sage: x = K(1/a); x # optional - sage.rings.number_field a/2 - sage: denom = x.denominator(); denom + sage: denom = x.denominator(); denom # optional - sage.rings.number_field 2 The denominator is an element of the ring which was used to construct the fraction field:: - sage: denom.parent() + sage: denom.parent() # optional - sage.rings.number_field Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: denom.parent() is OK + sage: denom.parent() is OK # optional - sage.rings.number_field True TESTS:: - sage: x = K.random_element() - sage: x == x.numerator() / x.denominator() + sage: x = K.random_element() # optional - sage.rings.number_field + sage: x == x.numerator() / x.denominator() # optional - sage.rings.number_field True """ ring = (self._parent)._ring @@ -820,11 +821,11 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): TESTS:: - sage: K. = GF(5^3).over() - sage: L. = GF(5^9).over(K) - sage: type(b) + sage: K. = GF(5^3).over() # optional - sage.rings.finite_rings + sage: L. = GF(5^9).over(K) # optional - sage.rings.finite_rings + sage: type(b) # optional - sage.rings.finite_rings - sage: TestSuite(b).run() + sage: TestSuite(b).run() # optional - sage.rings.finite_rings """ def __hash__(self): """ @@ -832,8 +833,8 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES: - sage: E. = GF(5^3).over() - sage: hash(a) + sage: E. = GF(5^3).over() # optional - sage.rings.finite_rings + sage: hash(a) # optional - sage.rings.finite_rings 5 """ return hash(self._backend) @@ -851,13 +852,13 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: K. = GF(5^3).over() - sage: L. = GF(5^9).over(K) - sage: u = 1/(a+b) + sage: K. = GF(5^3).over() # optional - sage.rings.finite_rings + sage: L. = GF(5^9).over(K) # optional - sage.rings.finite_rings + sage: u = 1/(a+b) # optional - sage.rings.finite_rings - sage: u._repr_extension(base=K) + sage: u._repr_extension(base=K) # optional - sage.rings.finite_rings '(2 + 2*a) + (-1 + a - a^2)*b + (2 + 3*a + 3*a^2)*b^2' - sage: u._repr_extension(base=GF(5)) + sage: u._repr_extension(base=GF(5)) # optional - sage.rings.finite_rings '2 + 2*a - b + a*b - a^2*b + 2*b^2 + 3*a*b^2 + 3*a^2*b^2' """ cdef RingExtensionWithBasis parent = self._parent @@ -929,13 +930,13 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: K. = GF(5^3).over() - sage: L. = GF(5^9).over(K) - sage: u = 1/(a+b) + sage: K. = GF(5^3).over() # optional - sage.rings.finite_rings + sage: L. = GF(5^9).over(K) # optional - sage.rings.finite_rings + sage: u = 1/(a+b) # optional - sage.rings.finite_rings - sage: u._latex_extension(base=K) + sage: u._latex_extension(base=K) # optional - sage.rings.finite_rings \left( 2 + 2 a \right) + \left( -1 + a - a^{2} \right) b + \left( 2 + 3 a + 3 a^{2} \right) b^{2} - sage: u._latex_extension(base=GF(5)) + sage: u._latex_extension(base=GF(5)) # optional - sage.rings.finite_rings 2 + 2 a - b + ab - a^{2}b + 2 b^{2} + 3 ab^{2} + 3 a^{2}b^{2} """ cdef RingExtensionWithBasis parent = self._parent @@ -995,28 +996,28 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: F = GF(5) - sage: K. = GF(5^2).over() # over F - sage: L. = GF(5^6).over(K) - sage: x = (a+b)^4; x + sage: F = GF(5) # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # over F # optional - sage.rings.finite_rings + sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings + sage: x = (a+b)^4; x # optional - sage.rings.finite_rings (-1 + a) + (3 + a)*b + (1 - a)*b^2 - sage: x.vector(K) # basis is (1, b, b^2) + sage: x.vector(K) # basis is (1, b, b^2) # optional - sage.rings.finite_rings (-1 + a, 3 + a, 1 - a) - sage: x.vector(F) # basis is (1, a, b, a*b, b^2, a*b^2) + sage: x.vector(F) # basis is (1, a, b, a*b, b^2, a*b^2) # optional - sage.rings.finite_rings (4, 1, 3, 1, 1, 4) If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: x.vector() + sage: x.vector() # optional - sage.rings.finite_rings (-1 + a, 3 + a, 1 - a) Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: x.vector(GF(5^3)) + sage: x.vector(GF(5^3)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z3 of size 5^3 @@ -1036,11 +1037,11 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): TESTS:: - sage: K = GF(11^10).over(GF(11^2)) - sage: x = K.random_element() - sage: coeffs = x.vector() - sage: basis = K.basis_over() - sage: x == sum(coeffs[i]*basis[i] for i in range(5)) + sage: K = GF(11^10).over(GF(11^2)) # optional - sage.rings.finite_rings + sage: x = K.random_element() # optional - sage.rings.finite_rings + sage: coeffs = x.vector() # optional - sage.rings.finite_rings + sage: basis = K.basis_over() # optional - sage.rings.finite_rings + sage: x == sum(coeffs[i]*basis[i] for i in range(5)) # optional - sage.rings.finite_rings True """ _, _, j = (self._parent)._free_module(base, map=True) @@ -1059,55 +1060,55 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: F. = GF(5^2).over() # over GF(5) - sage: K. = GF(5^4).over(F) - sage: L. = GF(5^12).over(K) - sage: u = 1/(a + b + c); u + sage: F. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: K. = GF(5^4).over(F) # optional - sage.rings.finite_rings + sage: L. = GF(5^12).over(K) # optional - sage.rings.finite_rings + sage: u = 1/(a + b + c); u # optional - sage.rings.finite_rings (2 + (-1 - a)*b) + ((2 + 3*a) + (1 - a)*b)*c + ((-1 - a) - a*b)*c^2 - sage: P = u.polynomial(K); P + sage: P = u.polynomial(K); P # optional - sage.rings.finite_rings ((-1 - a) - a*b)*x^2 + ((2 + 3*a) + (1 - a)*b)*x + 2 + (-1 - a)*b - sage: P.base_ring() is K + sage: P.base_ring() is K # optional - sage.rings.finite_rings True - sage: P(c) == u + sage: P(c) == u # optional - sage.rings.finite_rings True When the base is `F`, we obtain a bivariate polynomial:: - sage: P = u.polynomial(F); P + sage: P = u.polynomial(F); P # optional - sage.rings.finite_rings (-a)*x0^2*x1 + (-1 - a)*x0^2 + (1 - a)*x0*x1 + (2 + 3*a)*x0 + (-1 - a)*x1 + 2 We check that its value at the generators is the element we started with:: - sage: L.gens(F) + sage: L.gens(F) # optional - sage.rings.finite_rings (c, b) - sage: P(c, b) == u + sage: P(c, b) == u # optional - sage.rings.finite_rings True Similarly, when the base is ``GF(5)``, we get a trivariate polynomial: - sage: P = u.polynomial(GF(5)); P + sage: P = u.polynomial(GF(5)); P # optional - sage.rings.finite_rings -x0^2*x1*x2 - x0^2*x2 - x0*x1*x2 - x0^2 + x0*x1 - 2*x0*x2 - x1*x2 + 2*x0 - x1 + 2 - sage: P(c, b, a) == u + sage: P(c, b, a) == u # optional - sage.rings.finite_rings True Different variable names can be specified:: - sage: u.polynomial(GF(5), var='y') + sage: u.polynomial(GF(5), var='y') # optional - sage.rings.finite_rings -y0^2*y1*y2 - y0^2*y2 - y0*y1*y2 - y0^2 + y0*y1 - 2*y0*y2 - y1*y2 + 2*y0 - y1 + 2 - sage: u.polynomial(GF(5), var=['x','y','z']) + sage: u.polynomial(GF(5), var=['x','y','z']) # optional - sage.rings.finite_rings -x^2*y*z - x^2*z - x*y*z - x^2 + x*y - 2*x*z - y*z + 2*x - y + 2 If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: u.polynomial() + sage: u.polynomial() # optional - sage.rings.finite_rings ((-1 - a) - a*b)*x^2 + ((2 + 3*a) + (1 - a)*b)*x + 2 + (-1 - a)*b Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: u.polynomial(GF(5^3)) + sage: u.polynomial(GF(5^3)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z3 of size 5^3 @@ -1148,19 +1149,19 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: K. = GF(5^3).over() # over GF(5) - sage: L. = GF(5^6).over(K) - sage: u = a/(1+b) + sage: K. = GF(5^3).over() # over GF(5) # optional - sage.rings.finite_rings + sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings + sage: u = a/(1+b) # optional - sage.rings.finite_rings - sage: u + sage: u # optional - sage.rings.finite_rings (2 + a + 3*a^2) + (3 + 3*a + a^2)*b - sage: b*u + sage: b*u # optional - sage.rings.finite_rings (3 + 2*a^2) + (2 + 2*a - a^2)*b - sage: u.matrix(K) + sage: u.matrix(K) # optional - sage.rings.finite_rings [2 + a + 3*a^2 3 + 3*a + a^2] [ 3 + 2*a^2 2 + 2*a - a^2] - sage: u.matrix(GF(5)) + sage: u.matrix(GF(5)) # optional - sage.rings.finite_rings [2 1 3 3 3 1] [1 3 1 2 0 3] [2 3 3 1 3 0] @@ -1171,14 +1172,14 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: u.matrix() + sage: u.matrix() # optional - sage.rings.finite_rings [2 + a + 3*a^2 3 + 3*a + a^2] [ 3 + 2*a^2 2 + 2*a - a^2] Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: u.matrix(GF(5^2)) + sage: u.matrix(GF(5^2)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z2 of size 5^2 @@ -1204,11 +1205,11 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): TESTS:: - sage: F = GF(11^2) - sage: K = GF(11^6).over(F) - sage: L = GF(11^18).over(K) + sage: F = GF(11^2) # optional - sage.rings.finite_rings + sage: K = GF(11^6).over(F) # optional - sage.rings.finite_rings + sage: L = GF(11^18).over(K) # optional - sage.rings.finite_rings - sage: for base in L.bases(): + sage: for base in L.bases(): # optional - sage.rings.finite_rings ....: x = L.random_element() ....: y = L.random_element() ....: assert((x+y).matrix(base) == x.matrix(base) + y.matrix(base)) @@ -1232,41 +1233,41 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: F = GF(5) - sage: K. = GF(5^3).over(F) - sage: L. = GF(5^6).over(K) - sage: u = a/(1+b) + sage: F = GF(5) # optional - sage.rings.finite_rings + sage: K. = GF(5^3).over(F) # optional - sage.rings.finite_rings + sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings + sage: u = a/(1+b) # optional - sage.rings.finite_rings - sage: tr = u.trace(K); tr + sage: tr = u.trace(K); tr # optional - sage.rings.finite_rings -1 + 3*a + 2*a^2 We check that the trace lives in the base ring:: - sage: tr.parent() + sage: tr.parent() # optional - sage.rings.finite_rings Field in a with defining polynomial x^3 + 3*x + 3 over its base - sage: tr.parent() is K + sage: tr.parent() is K # optional - sage.rings.finite_rings True Similarly, one can compute the trace over F:: - sage: u.trace(F) + sage: u.trace(F) # optional - sage.rings.finite_rings 0 We check the transitivity of the trace:: - sage: u.trace(F) == tr.trace(F) + sage: u.trace(F) == tr.trace(F) # optional - sage.rings.finite_rings True If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: u.trace() + sage: u.trace() # optional - sage.rings.finite_rings -1 + 3*a + 2*a^2 Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: u.trace(GF(5^2)) + sage: u.trace(GF(5^2)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z2 of size 5^2 @@ -1291,15 +1292,15 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): TESTS:: - sage: F = GF(11^2) - sage: K = GF(11^6).over(F) - sage: L = GF(11^18).over(K) + sage: F = GF(11^2) # optional - sage.rings.finite_rings + sage: K = GF(11^6).over(F) # optional - sage.rings.finite_rings + sage: L = GF(11^18).over(K) # optional - sage.rings.finite_rings - sage: x = L.random_element() - sage: x.trace(F) == x.trace().trace() + sage: x = L.random_element() # optional - sage.rings.finite_rings + sage: x.trace(F) == x.trace().trace() # optional - sage.rings.finite_rings True - sage: for base in L.bases(): + sage: for base in L.bases(): # optional - sage.rings.finite_rings ....: x = L.random_element() ....: y = L.random_element() ....: assert(x.trace(base) == x.matrix(base).trace()) @@ -1326,41 +1327,41 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: F = GF(5) - sage: K. = GF(5^3).over(F) - sage: L. = GF(5^6).over(K) - sage: u = a/(1+b) + sage: F = GF(5) # optional - sage.rings.finite_rings + sage: K. = GF(5^3).over(F) # optional - sage.rings.finite_rings + sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings + sage: u = a/(1+b) # optional - sage.rings.finite_rings - sage: nr = u.norm(K); nr + sage: nr = u.norm(K); nr # optional - sage.rings.finite_rings 3 + 2*a^2 We check that the norm lives in the base ring:: - sage: nr.parent() + sage: nr.parent() # optional - sage.rings.finite_rings Field in a with defining polynomial x^3 + 3*x + 3 over its base - sage: nr.parent() is K + sage: nr.parent() is K # optional - sage.rings.finite_rings True Similarly, one can compute the norm over F:: - sage: u.norm(F) + sage: u.norm(F) # optional - sage.rings.finite_rings 4 We check the transitivity of the norm:: - sage: u.norm(F) == nr.norm(F) + sage: u.norm(F) == nr.norm(F) # optional - sage.rings.finite_rings True If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: u.norm() + sage: u.norm() # optional - sage.rings.finite_rings 3 + 2*a^2 Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: u.norm(GF(5^2)) + sage: u.norm(GF(5^2)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z2 of size 5^2 @@ -1385,15 +1386,15 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): TESTS:: - sage: F = GF(11^2) - sage: K = GF(11^6).over(F) - sage: L = GF(11^18).over(K) + sage: F = GF(11^2) # optional - sage.rings.finite_rings + sage: K = GF(11^6).over(F) # optional - sage.rings.finite_rings + sage: L = GF(11^18).over(K) # optional - sage.rings.finite_rings - sage: x = L.random_element() - sage: x.norm(F) == x.norm().norm() + sage: x = L.random_element() # optional - sage.rings.finite_rings + sage: x.norm(F) == x.norm().norm() # optional - sage.rings.finite_rings True - sage: for base in L.bases(): + sage: for base in L.bases(): # optional - sage.rings.finite_rings ....: x = L.random_element() ....: y = L.random_element() ....: assert(x.norm(base) == x.matrix(base).determinant()) @@ -1420,46 +1421,46 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: F = GF(5) - sage: K. = GF(5^3).over(F) - sage: L. = GF(5^6).over(K) - sage: u = a/(1+b) + sage: F = GF(5) # optional - sage.rings.finite_rings + sage: K. = GF(5^3).over(F) # optional - sage.rings.finite_rings + sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings + sage: u = a/(1+b) # optional - sage.rings.finite_rings - sage: chi = u.charpoly(K); chi + sage: chi = u.charpoly(K); chi # optional - sage.rings.finite_rings x^2 + (1 + 2*a + 3*a^2)*x + 3 + 2*a^2 We check that the charpoly has coefficients in the base ring:: - sage: chi.base_ring() + sage: chi.base_ring() # optional - sage.rings.finite_rings Field in a with defining polynomial x^3 + 3*x + 3 over its base - sage: chi.base_ring() is K + sage: chi.base_ring() is K # optional - sage.rings.finite_rings True and that it annihilates u:: - sage: chi(u) + sage: chi(u) # optional - sage.rings.finite_rings 0 Similarly, one can compute the characteristic polynomial over F:: - sage: u.charpoly(F) + sage: u.charpoly(F) # optional - sage.rings.finite_rings x^6 + x^4 + 2*x^3 + 3*x + 4 A different variable name can be specified:: - sage: u.charpoly(F, var='t') + sage: u.charpoly(F, var='t') # optional - sage.rings.finite_rings t^6 + t^4 + 2*t^3 + 3*t + 4 If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: u.charpoly() + sage: u.charpoly() # optional - sage.rings.finite_rings x^2 + (1 + 2*a + 3*a^2)*x + 3 + 2*a^2 Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: u.charpoly(GF(5^2)) + sage: u.charpoly(GF(5^2)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z2 of size 5^2 @@ -1469,9 +1470,9 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): We check that the characteristic polynomial of an element in the base ring is a power of a polynomial of degree 1:: - sage: S. = K[] - sage: u = K.random_element() - sage: L(u).charpoly() == (x - u)^2 + sage: S. = K[] # optional - sage.rings.finite_rings + sage: u = K.random_element() # optional - sage.rings.finite_rings + sage: L(u).charpoly() == (x - u)^2 # optional - sage.rings.finite_rings True """ return self.matrix(base).charpoly(var) @@ -1487,46 +1488,46 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: F = GF(5) - sage: K. = GF(5^3).over(F) - sage: L. = GF(5^6).over(K) - sage: u = 1 / (a+b) + sage: F = GF(5) # optional - sage.rings.finite_rings + sage: K. = GF(5^3).over(F) # optional - sage.rings.finite_rings + sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings + sage: u = 1 / (a+b) # optional - sage.rings.finite_rings - sage: chi = u.minpoly(K); chi + sage: chi = u.minpoly(K); chi # optional - sage.rings.finite_rings x^2 + (2*a + a^2)*x - 1 + a We check that the minimal polynomial has coefficients in the base ring:: - sage: chi.base_ring() + sage: chi.base_ring() # optional - sage.rings.finite_rings Field in a with defining polynomial x^3 + 3*x + 3 over its base - sage: chi.base_ring() is K + sage: chi.base_ring() is K # optional - sage.rings.finite_rings True and that it annihilates u:: - sage: chi(u) + sage: chi(u) # optional - sage.rings.finite_rings 0 Similarly, one can compute the minimal polynomial over F:: - sage: u.minpoly(F) + sage: u.minpoly(F) # optional - sage.rings.finite_rings x^6 + 4*x^5 + x^4 + 2*x^2 + 3 A different variable name can be specified:: - sage: u.minpoly(F, var='t') + sage: u.minpoly(F, var='t') # optional - sage.rings.finite_rings t^6 + 4*t^5 + t^4 + 2*t^2 + 3 If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: u.minpoly() + sage: u.minpoly() # optional - sage.rings.finite_rings x^2 + (2*a + a^2)*x - 1 + a Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: u.minpoly(GF(5^2)) + sage: u.minpoly(GF(5^2)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z2 of size 5^2 @@ -1536,15 +1537,15 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): We check that the minimal polynomial of an element in the base ring has degree 1:: - sage: S. = K[] - sage: u = K.random_element() - sage: L(u).minpoly() == x - u + sage: S. = K[] # optional - sage.rings.finite_rings + sage: u = K.random_element() # optional - sage.rings.finite_rings + sage: L(u).minpoly() == x - u # optional - sage.rings.finite_rings True In a similar fashion, the minimal polynomial over `F` of an element of `K` should have degree 1 or 3:: - sage: L(u).minpoly(F).degree() in [ 1, 3 ] + sage: L(u).minpoly(F).degree() in [ 1, 3 ] # optional - sage.rings.finite_rings True """ cdef RingExtensionWithBasis parent = self._parent diff --git a/src/sage/rings/ring_extension_homset.py b/src/sage/rings/ring_extension_homset.py index 28b2b736dd8..65c39803caa 100644 --- a/src/sage/rings/ring_extension_homset.py +++ b/src/sage/rings/ring_extension_homset.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.rings.finite_rings r""" Homset between extensions of rings @@ -29,7 +30,9 @@ class RingExtensionHomset(RingHomset_generic): sage: L = GF(5^8).over(K) sage: H = Hom(K,L) sage: H - Set of Homomorphisms from Field in z2 with defining polynomial x^2 + 4*x + 2 over its base to Field in z8 with defining polynomial x^4 + (3 - z2)*x + z2 over its base + Set of Homomorphisms + from Field in z2 with defining polynomial x^2 + 4*x + 2 over its base + to Field in z8 with defining polynomial x^4 + (3 - z2)*x + z2 over its base sage: type(H) <... 'sage.rings.ring_extension_homset.RingExtensionHomset_with_category'> @@ -44,7 +47,8 @@ def __call__(self, *args, **kwargs): sage: K. = GF(5^2).over() sage: L. = GF(5^4).over(K) sage: Hom(L,L)([b^5, a^5]) - Ring endomorphism of Field in b with defining polynomial x^2 + (3 - a)*x + a over its base + Ring endomorphism of + Field in b with defining polynomial x^2 + (3 - a)*x + a over its base Defn: b |--> (2 + a) + 2*b with map on base ring: a |--> 1 - a diff --git a/src/sage/rings/ring_extension_morphism.pyx b/src/sage/rings/ring_extension_morphism.pyx index 04d2aa4a650..bd5b012cfaa 100644 --- a/src/sage/rings/ring_extension_morphism.pyx +++ b/src/sage/rings/ring_extension_morphism.pyx @@ -83,19 +83,19 @@ cdef class RingExtensionHomomorphism(RingMap): TESTS:: - sage: K. = GF(5^2).over() - sage: L. = GF(5^4).over(K) - sage: phi = L.hom([b^5, a^5]) - sage: phi - Ring endomorphism of Field in b with defining polynomial x^2 + (3 - a)*x + a over its base + sage: K. = GF(5^2).over() # optional - sage.rings.finite_rings + sage: L. = GF(5^4).over(K) # optional - sage.rings.finite_rings + sage: phi = L.hom([b^5, a^5]); phi # optional - sage.rings.finite_rings + Ring endomorphism of Field in b + with defining polynomial x^2 + (3 - a)*x + a over its base Defn: b |--> (2 + a) + 2*b with map on base ring: a |--> 1 - a - sage: type(phi) + sage: type(phi) # optional - sage.rings.finite_rings - sage: TestSuite(phi).run() + sage: TestSuite(phi).run() # optional - sage.rings.finite_rings """ def __init__(self, parent, defn, base_map=None, check=True): @@ -117,8 +117,7 @@ cdef class RingExtensionHomomorphism(RingMap): sage: S. = QQ[] sage: T. = QQ[] - sage: f = T.hom([x^2, y^2]) - sage: f + sage: f = T.hom([x^2, y^2]); f Ring endomorphism of Multivariate Polynomial Ring in x, y over Rational Field Defn: x |--> x^2 y |--> y^2 @@ -220,13 +219,12 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) - sage: f = K.hom([a^5]) - sage: f + sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: f = K.hom([a^5]); f # optional - sage.rings.finite_rings Ring endomorphism of Field in a with defining polynomial x^2 + 4*x + 2 over its base Defn: a |--> 1 - a - sage: f._repr_type() + sage: f._repr_type() # optional - sage.rings.finite_rings 'Ring' """ return "Ring" @@ -242,20 +240,19 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: sage: x = polygen(QQ, 'x') - sage: A. = QQ.extension(x^2 - 2) - sage: K. = A.over() - sage: f = K.hom([-sqrt2]) - sage: f + sage: A. = QQ.extension(x^2 - 2) # optional - sage.rings.number_field + sage: K. = A.over() # optional - sage.rings.number_field + sage: f = K.hom([-sqrt2]); f # optional - sage.rings.number_field Ring endomorphism of Field in sqrt2 with defining polynomial x^2 - 2 over its base Defn: sqrt2 |--> -sqrt2 - sage: f(sqrt2) + sage: f(sqrt2) # optional - sage.rings.number_field -sqrt2 TESTS:: sage: a = QQ.random_element() sage: b = QQ.random_element() - sage: f(a + b*sqrt2) == a - b*sqrt2 + sage: f(a + b*sqrt2) == a - b*sqrt2 # optional - sage.rings.number_field True """ y = self._backend(backend_element(x)) @@ -271,19 +268,19 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: - sage: F = GF(5) - sage: K. = GF(5^2).over(F) - sage: L. = GF(5^6).over(K) + sage: F = GF(5) # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over(F) # optional - sage.rings.finite_rings + sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings We define the absolute Frobenius of L:: - sage: FrobL = L.hom([b^5, a^5]) - sage: FrobL - Ring endomorphism of Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base + sage: FrobL = L.hom([b^5, a^5]); FrobL # optional - sage.rings.finite_rings + Ring endomorphism of + Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: b |--> (-1 + a) + (1 + 2*a)*b + a*b^2 with map on base ring: a |--> 1 - a - sage: FrobL.base_map() + sage: FrobL.base_map() # optional - sage.rings.finite_rings Ring morphism: From: Field in a with defining polynomial x^2 + 4*x + 2 over its base To: Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base @@ -292,11 +289,11 @@ cdef class RingExtensionHomomorphism(RingMap): The square of ``FrobL`` acts trivially on K; in other words, it has a trivial base map:: - sage: phi = FrobL^2 - sage: phi - Ring endomorphism of Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base + sage: phi = FrobL^2; phi # optional - sage.rings.finite_rings + Ring endomorphism of + Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: b |--> 2 + 2*a*b + (2 - a)*b^2 - sage: phi.base_map() + sage: phi.base_map() # optional - sage.rings.finite_rings """ domain = self.domain() @@ -335,15 +332,15 @@ cdef class RingExtensionHomomorphism(RingMap): TESTS:: - sage: K. = GF(5^2).over() # over GF(5) - sage: L. = GF(5^6).over(K) + sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings - sage: FrobK = K.hom([a^5]) - sage: FrobL = L.hom([b^5], base_map=FrobK) + sage: FrobK = K.hom([a^5]) # optional - sage.rings.finite_rings + sage: FrobL = L.hom([b^5], base_map=FrobK) # optional - sage.rings.finite_rings - sage: FrobK^2 == End(K).identity() + sage: FrobK^2 == End(K).identity() # optional - sage.rings.finite_rings True - sage: FrobL^6 == End(L).identity() + sage: FrobL^6 == End(L).identity() # optional - sage.rings.finite_rings True """ eq = are_equal_morphisms(self._backend, backend_morphism(other)) @@ -359,23 +356,22 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) - sage: FrobK = K.hom([a^5]) - sage: FrobK.is_identity() + sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: FrobK = K.hom([a^5]) # optional - sage.rings.finite_rings + sage: FrobK.is_identity() # optional - sage.rings.finite_rings False - sage: (FrobK^2).is_identity() + sage: (FrobK^2).is_identity() # optional - sage.rings.finite_rings True Coercion maps are not considered as identity morphisms:: - sage: L. = GF(5^6).over(K) - sage: iota = L.defining_morphism() - sage: iota + sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings + sage: iota = L.defining_morphism(); iota # optional - sage.rings.finite_rings Ring morphism: From: Field in a with defining polynomial x^2 + 4*x + 2 over its base To: Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: a |--> a - sage: iota.is_identity() + sage: iota.is_identity() # optional - sage.rings.finite_rings False """ if self.domain() is not self.codomain(): @@ -388,24 +384,23 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: - sage: K = GF(5^10).over(GF(5^5)) - sage: iota = K.defining_morphism() - sage: iota + sage: K = GF(5^10).over(GF(5^5)) # optional - sage.rings.finite_rings + sage: iota = K.defining_morphism(); iota # optional - sage.rings.finite_rings Ring morphism: From: Finite Field in z5 of size 5^5 - To: Field in z10 with defining polynomial x^2 + (2*z5^3 + 2*z5^2 + 4*z5 + 4)*x + z5 over its base + To: Field in z10 with defining polynomial + x^2 + (2*z5^3 + 2*z5^2 + 4*z5 + 4)*x + z5 over its base Defn: z5 |--> z5 - sage: iota.is_injective() + sage: iota.is_injective() # optional - sage.rings.finite_rings True - sage: K = GF(7).over(ZZ) - sage: iota = K.defining_morphism() - sage: iota + sage: K = GF(7).over(ZZ) # optional - sage.rings.finite_rings + sage: iota = K.defining_morphism(); iota # optional - sage.rings.finite_rings Ring morphism: From: Integer Ring To: Finite Field of size 7 over its base Defn: 1 |--> 1 - sage: iota.is_injective() + sage: iota.is_injective() # optional - sage.rings.finite_rings False """ return self._backend.is_injective() @@ -416,24 +411,23 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: - sage: K = GF(5^10).over(GF(5^5)) - sage: iota = K.defining_morphism() - sage: iota + sage: K = GF(5^10).over(GF(5^5)) # optional - sage.rings.finite_rings + sage: iota = K.defining_morphism(); iota # optional - sage.rings.finite_rings Ring morphism: From: Finite Field in z5 of size 5^5 - To: Field in z10 with defining polynomial x^2 + (2*z5^3 + 2*z5^2 + 4*z5 + 4)*x + z5 over its base + To: Field in z10 with defining polynomial + x^2 + (2*z5^3 + 2*z5^2 + 4*z5 + 4)*x + z5 over its base Defn: z5 |--> z5 - sage: iota.is_surjective() + sage: iota.is_surjective() # optional - sage.rings.finite_rings False - sage: K = GF(7).over(ZZ) - sage: iota = K.defining_morphism() - sage: iota + sage: K = GF(7).over(ZZ) # optional - sage.rings.finite_rings + sage: iota = K.defining_morphism(); iota # optional - sage.rings.finite_rings Ring morphism: From: Integer Ring To: Finite Field of size 7 over its base Defn: 1 |--> 1 - sage: iota.is_surjective() + sage: iota.is_surjective() # optional - sage.rings.finite_rings True """ return self._backend.is_surjective() @@ -447,11 +441,11 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) - sage: L. = GF(5^6).over(K) - sage: FrobL = L.hom([b^5, a^5]) # absolute Frobenius + sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings + sage: FrobL = L.hom([b^5, a^5]) # absolute Frobenius # optional - sage.rings.finite_rings - sage: print(FrobL._repr_defn()) + sage: print(FrobL._repr_defn()) # optional - sage.rings.finite_rings b |--> (-1 + a) + (1 + 2*a)*b + a*b^2 with map on base ring: a |--> 1 - a @@ -479,14 +473,13 @@ cdef class RingExtensionHomomorphism(RingMap): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 5) - sage: K. = A.over() - sage: f = K.hom([-sqrt5]) - sage: f + sage: A. = QQ.extension(x^2 - 5) # optional - sage.rings.number_field + sage: K. = A.over() # optional - sage.rings.number_field + sage: f = K.hom([-sqrt5]); f # optional - sage.rings.number_field Ring endomorphism of Field in sqrt5 with defining polynomial x^2 - 5 over its base Defn: sqrt5 |--> -sqrt5 - sage: f^2 # indirect doctest + sage: f^2 # indirect doctest # optional - sage.rings.number_field Ring endomorphism of Field in sqrt5 with defining polynomial x^2 - 5 over its base Defn: sqrt5 |--> sqrt5 """ @@ -505,13 +498,13 @@ cdef class RingExtensionHomomorphism(RingMap): TESTS:: - sage: K. = GF(5^2).over() # over GF(5) - sage: f = K.hom([a^5]) + sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: f = K.hom([a^5]) # optional - sage.rings.finite_rings - sage: g = copy(f) # indirect doctest - sage: f == g + sage: g = copy(f) # indirect doctest # optional - sage.rings.finite_rings + sage: f == g # optional - sage.rings.finite_rings True - sage: f is g + sage: f is g # optional - sage.rings.finite_rings False """ self._backend = _slots['_backend'] @@ -523,9 +516,9 @@ cdef class RingExtensionHomomorphism(RingMap): TESTS:: - sage: K. = GF(5^2).over() # over GF(5) - sage: f = K.hom([a^5]) - sage: loads(dumps(f)) == f + sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: f = K.hom([a^5]) # optional - sage.rings.finite_rings + sage: loads(dumps(f)) == f # optional - sage.rings.finite_rings True """ slots = RingMap._extra_slots(self) @@ -540,17 +533,17 @@ cdef class RingExtensionBackendIsomorphism(RingExtensionHomomorphism): TESTS:: - sage: K = GF(11^9).over(GF(11^3)) - sage: f = K.coerce_map_from(GF(11^9)) - sage: f + sage: K = GF(11^9).over(GF(11^3)) # optional - sage.rings.finite_rings + sage: f = K.coerce_map_from(GF(11^9)); f # optional - sage.rings.finite_rings Coercion morphism: From: Finite Field in z9 of size 11^9 - To: Field in z9 with defining polynomial x^3 + (9*z3^2 + 5*z3 + 1)*x^2 + (4*z3 + 3)*x + 10*z3 over its base + To: Field in z9 with defining polynomial + x^3 + (9*z3^2 + 5*z3 + 1)*x^2 + (4*z3 + 3)*x + 10*z3 over its base - sage: type(f) + sage: type(f) # optional - sage.rings.finite_rings - sage: TestSuite(f).run() + sage: TestSuite(f).run() # optional - sage.rings.finite_rings """ def __init__(self, parent): r""" @@ -559,9 +552,9 @@ cdef class RingExtensionBackendIsomorphism(RingExtensionHomomorphism): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 5) - sage: K = A.over() - sage: K.coerce_map_from(A) + sage: A. = QQ.extension(x^2 - 5) # optional - sage.rings.number_field + sage: K = A.over() # optional - sage.rings.number_field + sage: K.coerce_map_from(A) # optional - sage.rings.number_field Coercion morphism: From: Number Field in a with defining polynomial x^2 - 5 To: Field in a with defining polynomial x^2 - 5 over its base @@ -576,14 +569,13 @@ cdef class RingExtensionBackendIsomorphism(RingExtensionHomomorphism): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) - sage: f = K.coerce_map_from(GF(5^2)) - sage: f + sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: f = K.coerce_map_from(GF(5^2)); f # optional - sage.rings.finite_rings Coercion morphism: From: Finite Field in z2 of size 5^2 To: Field in a with defining polynomial x^2 + 4*x + 2 over its base - sage: f._repr_type() + sage: f._repr_type() # optional - sage.rings.finite_rings 'Coercion' """ return "Coercion" @@ -594,14 +586,13 @@ cdef class RingExtensionBackendIsomorphism(RingExtensionHomomorphism): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) - sage: f = K.coerce_map_from(GF(5^2)) - sage: f + sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: f = K.coerce_map_from(GF(5^2)); f # optional - sage.rings.finite_rings Coercion morphism: From: Finite Field in z2 of size 5^2 To: Field in a with defining polynomial x^2 + 4*x + 2 over its base - sage: f._repr_defn() + sage: f._repr_defn() # optional - sage.rings.finite_rings '' """ return "" @@ -616,9 +607,9 @@ cdef class RingExtensionBackendIsomorphism(RingExtensionHomomorphism): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) - sage: f = K.coerce_map_from(GF(5^2)) - sage: f(GF(5^2).gen()) + sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: f = K.coerce_map_from(GF(5^2)) # optional - sage.rings.finite_rings + sage: f(GF(5^2).gen()) # optional - sage.rings.finite_rings a """ codomain = self.codomain() @@ -632,17 +623,17 @@ cdef class RingExtensionBackendReverseIsomorphism(RingExtensionHomomorphism): TESTS:: - sage: K = GF(11^9).over(GF(11^3)) - sage: f = GF(11^9).convert_map_from(K) - sage: f + sage: K = GF(11^9).over(GF(11^3)) # optional - sage.rings.finite_rings + sage: f = GF(11^9).convert_map_from(K); f # optional - sage.rings.finite_rings Canonical morphism: - From: Field in z9 with defining polynomial x^3 + (9*z3^2 + 5*z3 + 1)*x^2 + (4*z3 + 3)*x + 10*z3 over its base + From: Field in z9 with defining polynomial + x^3 + (9*z3^2 + 5*z3 + 1)*x^2 + (4*z3 + 3)*x + 10*z3 over its base To: Finite Field in z9 of size 11^9 - sage: type(f) + sage: type(f) # optional - sage.rings.finite_rings - sage: TestSuite(f).run() + sage: TestSuite(f).run() # optional - sage.rings.finite_rings """ def __init__(self, parent): @@ -652,9 +643,9 @@ cdef class RingExtensionBackendReverseIsomorphism(RingExtensionHomomorphism): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 5) - sage: K = A.over() - sage: A.convert_map_from(K) + sage: A. = QQ.extension(x^2 - 5) # optional - sage.rings.number_field + sage: K = A.over() # optional - sage.rings.number_field + sage: A.convert_map_from(K) # optional - sage.rings.number_field Canonical morphism: From: Field in a with defining polynomial x^2 - 5 over its base To: Number Field in a with defining polynomial x^2 - 5 @@ -669,14 +660,13 @@ cdef class RingExtensionBackendReverseIsomorphism(RingExtensionHomomorphism): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) - sage: f = GF(5^2).convert_map_from(K) - sage: f + sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: f = GF(5^2).convert_map_from(K); f # optional - sage.rings.finite_rings Canonical morphism: From: Field in a with defining polynomial x^2 + 4*x + 2 over its base To: Finite Field in z2 of size 5^2 - sage: f._repr_type() + sage: f._repr_type() # optional - sage.rings.finite_rings 'Canonical' """ return "Canonical" @@ -687,14 +677,13 @@ cdef class RingExtensionBackendReverseIsomorphism(RingExtensionHomomorphism): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) - sage: f = GF(5^2).convert_map_from(K) - sage: f + sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: f = GF(5^2).convert_map_from(K); f # optional - sage.rings.finite_rings Canonical morphism: From: Field in a with defining polynomial x^2 + 4*x + 2 over its base To: Finite Field in z2 of size 5^2 - sage: f._repr_defn() + sage: f._repr_defn() # optional - sage.rings.finite_rings '' """ return "" @@ -709,9 +698,9 @@ cdef class RingExtensionBackendReverseIsomorphism(RingExtensionHomomorphism): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) - sage: f = GF(5^2).convert_map_from(K) - sage: f(a) + sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings + sage: f = GF(5^2).convert_map_from(K) # optional - sage.rings.finite_rings + sage: f(a) # optional - sage.rings.finite_rings z2 """ return (x)._backend @@ -724,9 +713,9 @@ cdef class MapFreeModuleToRelativeRing(Map): TESTS:: - sage: K = GF(5^2).over() - sage: V, i, j = K.free_module() - sage: type(i) + sage: K = GF(5^2).over() # optional - sage.rings.finite_rings + sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings + sage: type(i) # optional - sage.rings.finite_rings """ @@ -742,9 +731,9 @@ cdef class MapFreeModuleToRelativeRing(Map): TESTS:: - sage: K = GF(11^6).over(GF(11^3)) - sage: V, i, j = K.free_module() - sage: i + sage: K = GF(11^6).over(GF(11^3)) # optional - sage.rings.finite_rings + sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings + sage: i # optional - sage.rings.finite_rings Generic map: From: Vector space of dimension 2 over Finite Field in z3 of size 11^3 To: Field in z6 with defining polynomial x^2 + (10*z3^2 + z3 + 6)*x + z3 over its base @@ -762,9 +751,9 @@ cdef class MapFreeModuleToRelativeRing(Map): EXAMPLES:: - sage: K = GF(11^6).over(GF(11^3)) - sage: V, i, j = K.free_module() - sage: i.is_injective() + sage: K = GF(11^6).over(GF(11^3)) # optional - sage.rings.finite_rings + sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings + sage: i.is_injective() # optional - sage.rings.finite_rings True """ return True @@ -775,9 +764,9 @@ cdef class MapFreeModuleToRelativeRing(Map): EXAMPLES:: - sage: K = GF(11^6).over(GF(11^3)) - sage: V, i, j = K.free_module() - sage: i.is_surjective() + sage: K = GF(11^6).over(GF(11^3)) # optional - sage.rings.finite_rings + sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings + sage: i.is_surjective() # optional - sage.rings.finite_rings True """ return True @@ -792,9 +781,9 @@ cdef class MapFreeModuleToRelativeRing(Map): EXAMPLES:: - sage: K. = GF(11^6).over(GF(11^3)) - sage: V, i, j = K.free_module() - sage: i((0,1)) + sage: K. = GF(11^6).over(GF(11^3)) # optional - sage.rings.finite_rings + sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings + sage: i((0,1)) # optional - sage.rings.finite_rings a """ cdef Element elt @@ -811,9 +800,9 @@ cdef class MapRelativeRingToFreeModule(Map): TESTS:: - sage: K = GF(5^2).over() - sage: V, i, j = K.free_module() - sage: type(j) + sage: K = GF(5^2).over() # optional - sage.rings.finite_rings + sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings + sage: type(j) # optional - sage.rings.finite_rings """ @@ -829,9 +818,9 @@ cdef class MapRelativeRingToFreeModule(Map): TESTS:: - sage: K = GF(11^6).over(GF(11^3)) - sage: V, i, j = K.free_module() - sage: j + sage: K = GF(11^6).over(GF(11^3)) # optional - sage.rings.finite_rings + sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings + sage: j # optional - sage.rings.finite_rings Generic map: From: Field in z6 with defining polynomial x^2 + (10*z3^2 + z3 + 6)*x + z3 over its base To: Vector space of dimension 2 over Finite Field in z3 of size 11^3 @@ -871,9 +860,9 @@ cdef class MapRelativeRingToFreeModule(Map): EXAMPLES:: - sage: K = GF(11^6).over(GF(11^3)) - sage: V, i, j = K.free_module() - sage: j.is_injective() + sage: K = GF(11^6).over(GF(11^3)) # optional - sage.rings.finite_rings + sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings + sage: j.is_injective() # optional - sage.rings.finite_rings True """ return True @@ -884,9 +873,9 @@ cdef class MapRelativeRingToFreeModule(Map): EXAMPLES:: - sage: K = GF(11^6).over(GF(11^3)) - sage: V, i, j = K.free_module() - sage: j.is_surjective() + sage: K = GF(11^6).over(GF(11^3)) # optional - sage.rings.finite_rings + sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings + sage: j.is_surjective() # optional - sage.rings.finite_rings True """ return True @@ -901,9 +890,9 @@ cdef class MapRelativeRingToFreeModule(Map): EXAMPLES:: - sage: K. = GF(11^6).over(GF(11^3)) - sage: V, i, j = K.free_module() - sage: j(a) + sage: K. = GF(11^6).over(GF(11^3)) # optional - sage.rings.finite_rings + sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings + sage: j(a) # optional - sage.rings.finite_rings (0, 1) """ coeffs = self.backend_coefficients(x) @@ -920,9 +909,9 @@ cdef class MapRelativeRingToFreeModule(Map): TESTS:: - sage: K. = GF(11^9).over(GF(11^3)) - sage: V, i, j = K.free_module() - sage: j(a + 2*a^2) # indirect doctest + sage: K. = GF(11^9).over(GF(11^3)) # optional - sage.rings.finite_rings + sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings + sage: j(a + 2*a^2) # indirect doctest # optional - sage.rings.finite_rings (0, 1, 2) """ cdef list coeffs = [ ] From 4f1383c36353b1adc3079998a079868e4522a968 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 1 Jun 2023 23:35:47 -0700 Subject: [PATCH 299/423] Fix # optional --- src/sage/rings/ring_extension.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/rings/ring_extension.pyx b/src/sage/rings/ring_extension.pyx index 8143d84d3ee..cbbfd2903f8 100644 --- a/src/sage/rings/ring_extension.pyx +++ b/src/sage/rings/ring_extension.pyx @@ -2521,7 +2521,7 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: sage: A = GF(5).over(ZZ) # optional - sage.rings.finite_rings - sage: A.fraction_field(extend_base=True) + sage: A.fraction_field(extend_base=True) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: the morphism is not injective @@ -2767,7 +2767,7 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): TESTS:: sage: A = GF(5).over(ZZ) # optional - sage.rings.finite_rings - sage: A.fraction_field(extend_base=True) + sage: A.fraction_field(extend_base=True) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: the morphism is not injective From 6c47ef7ee060aaf4aa7be8a2f0031208d0c55056 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 2 Jun 2023 11:09:51 -0700 Subject: [PATCH 300/423] sage.rings: More # optional --- src/sage/rings/ring_extension.pyx | 105 +++++++++++++++++------------- 1 file changed, 59 insertions(+), 46 deletions(-) diff --git a/src/sage/rings/ring_extension.pyx b/src/sage/rings/ring_extension.pyx index cbbfd2903f8..4b88454f611 100644 --- a/src/sage/rings/ring_extension.pyx +++ b/src/sage/rings/ring_extension.pyx @@ -33,8 +33,7 @@ equivalently :meth:`base_ring`):: It is also possible to build an extension on top of another extension, obtaining this way a tower of extensions:: - sage: L. = GF(5^8).over(K) # optional - sage.rings.finite_rings - sage: L # optional - sage.rings.finite_rings + sage: L. = GF(5^8).over(K); L # optional - sage.rings.finite_rings Field in b with defining polynomial x^2 + (4*z2 + 3*a)*x + 1 - a over its base sage: L.base() # optional - sage.rings.finite_rings Field in a with defining polynomial x^2 + z2*x + 4 over its base @@ -156,12 +155,14 @@ def tower_bases(ring, degree): sage: S. = QQ[] sage: T. = S[] sage: tower_bases(T, False) - ([Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Rational Field, + ([Univariate Polynomial Ring in y over + Univariate Polynomial Ring in x over Rational Field, Univariate Polynomial Ring in x over Rational Field, Rational Field], []) sage: tower_bases(T, True) - ([Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Rational Field], + ([Univariate Polynomial Ring in y over + Univariate Polynomial Ring in x over Rational Field], [1]) sage: K. = Qq(5^2) # optional - sage.rings.padics @@ -335,12 +336,12 @@ class RingExtensionFactory(UniqueFactory): True sage: x = polygen(ZZ, 'x') - sage: K. = QQ.extension(x^2 - 2) - sage: E = K.over(QQ); E + sage: K. = QQ.extension(x^2 - 2) # optional - sage.rings.number_field + sage: E = K.over(QQ); E # optional - sage.rings.number_field Field in a with defining polynomial x^2 - 2 over its base - sage: E2. = K.over(QQ) - sage: E2 is E + sage: E2. = K.over(QQ) # optional - sage.rings.number_field + sage: E2 is E # optional - sage.rings.number_field False """ def create_key_and_extra_args(self, ring, defining_morphism=None, gens=None, names=None, constructors=None): @@ -376,8 +377,9 @@ class RingExtensionFactory(UniqueFactory): To: Rational Field Defn: 1 |--> 1, (), ()), {'constructors': [(, - {'is_backend_exposed': True, - 'print_options': {'print_elements_as': None, 'print_parent_as': None}})]}) + {'is_backend_exposed': True, + 'print_options': {'print_elements_as': None, + 'print_parent_as': None}})]}) sage: RingExtension.create_key_and_extra_args(GF(5^4), GF(5^2), # optional - sage.rings.finite_rings ....: names=('a',)) @@ -386,7 +388,7 @@ class RingExtensionFactory(UniqueFactory): To: Finite Field in z4 of size 5^4 Defn: z2 |--> z4^3 + z4^2 + z4 + 3, (z4,), ('a',)), {'constructors': [(, - {'gen': z4, 'is_backend_exposed': True, 'names': ('a',)})]}) + {'gen': z4, 'is_backend_exposed': True, 'names': ('a',)})]}) """ use_generic_constructor = True is_backend_exposed = True @@ -535,9 +537,9 @@ cdef class RingExtension_generic(CommutativeAlgebra): .. NOTE: - The attribute `is_backend_exposed` is only used for printing; + The attribute ``is_backend_exposed`` is only used for printing; when it is ``False``, printing an element like its backend is - disabled (and a ``RuntimeError`` is raised when it would occur). + disabled (and a :class:`RuntimeError` is raised when it would occur). OUTPUT: @@ -623,12 +625,12 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: K. = QQ.extension(x^2 - 2) - sage: E = K.over() # over QQ + sage: K. = QQ.extension(x^2 - 2) # optional - sage.rings.number_field + sage: E = K.over() # over QQ # optional - sage.rings.number_field - sage: hasattr(E, 'automorphisms') + sage: hasattr(E, 'automorphisms') # optional - sage.rings.number_field True - sage: E.automorphisms() + sage: E.automorphisms() # optional - sage.rings.number_field [Ring endomorphism of Field in a with defining polynomial x^2 - 2 over its base Defn: a |--> a, Ring endomorphism of Field in a with defining polynomial x^2 - 2 over its base @@ -660,10 +662,10 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 2) - sage: K. = A.over() + sage: A. = QQ.extension(x^2 - 2) # optional - sage.rings.number_field + sage: K. = A.over() # optional - sage.rings.number_field - sage: dir(K) + sage: dir(K) # optional - sage.rings.number_field ['CartesianProduct', 'Element', 'Hom', @@ -804,7 +806,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): Observe what happens when we modify the option ``over``:: sage: D # optional - sage.rings.finite_rings - Field in d with defining polynomial x^2 + ((1 - a) + ((1 + 2*a) - b)*c + ((2 + a) + (1 - a)*b)*c^2)*x + c over its base + Field in d with defining polynomial + x^2 + ((1 - a) + ((1 + 2*a) - b)*c + ((2 + a) + (1 - a)*b)*c^2)*x + c over its base sage: D.print_options(over=2) # optional - sage.rings.finite_rings sage: D # optional - sage.rings.finite_rings @@ -1124,7 +1127,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): Finite Field of size 5] sage: L.bases() # optional - sage.rings.finite_rings - [Field in z12 with defining polynomial x^3 + (1 + (2 - z2)*z4)*x^2 + (2 + 2*z4)*x - z4 over its base, + [Field in z12 with defining polynomial + x^3 + (1 + (2 - z2)*z4)*x^2 + (2 + 2*z4)*x - z4 over its base, Field in z4 with defining polynomial x^2 + (3 - z2)*x + z2 over its base, Field in z2 with defining polynomial x^2 + 4*x + 2 over its base, Finite Field of size 5] @@ -1288,7 +1292,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): sage: L.defining_morphism() # optional - sage.rings.finite_rings Ring morphism: From: Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base - To: Field in z12 with defining polynomial x^3 + (1 + (4*z2 + 2)*z4)*x^2 + (2 + 2*z4)*x - z4 over its base + To: Field in z12 with defining polynomial + x^3 + (1 + (4*z2 + 2)*z4)*x^2 + (2 + 2*z4)*x - z4 over its base Defn: z4 |--> z4 One can also pass in a base over which the extension is explicitly @@ -1297,7 +1302,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): sage: L.defining_morphism(F) # optional - sage.rings.finite_rings Ring morphism: From: Finite Field in z2 of size 5^2 - To: Field in z12 with defining polynomial x^3 + (1 + (4*z2 + 2)*z4)*x^2 + (2 + 2*z4)*x - z4 over its base + To: Field in z12 with defining polynomial + x^3 + (1 + (4*z2 + 2)*z4)*x^2 + (2 + 2*z4)*x - z4 over its base Defn: z2 |--> z2 sage: L.defining_morphism(GF(5)) # optional - sage.rings.finite_rings @@ -1473,11 +1479,11 @@ cdef class RingExtension_generic(CommutativeAlgebra): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 2) - sage: B. = QQ.extension(x^6 - 2) - sage: f = A.hom([b^3]) - sage: E = B.over(f) - sage: E.degree_over() # indirect doctest + sage: A. = QQ.extension(x^2 - 2) # optional - sage.rings.number_field + sage: B. = QQ.extension(x^6 - 2) # optional - sage.rings.number_field + sage: f = A.hom([b^3]) # optional - sage.rings.number_field + sage: E = B.over(f) # optional - sage.rings.number_field + sage: E.degree_over() # indirect doctest # optional - sage.rings.number_field 3 """ if base is self: @@ -1766,7 +1772,7 @@ cdef class RingExtension_generic(CommutativeAlgebra): TESTS:: sage: A = GF(5).over(ZZ) # optional - sage.rings.finite_rings - sage: A.fraction_field(extend_base=True) + sage: A.fraction_field(extend_base=True) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: the morphism is not injective @@ -1831,13 +1837,17 @@ cdef class RingExtension_generic(CommutativeAlgebra): sage: L = GF(5^12).over(F) # optional - sage.rings.finite_rings sage: K.Hom(L) # indirect doctest # optional - sage.rings.finite_rings - Set of Homomorphisms from Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base - to Field in z12 with defining polynomial x^6 + (4*z2 + 3)*x^5 + x^4 + (3*z2 + 1)*x^3 + x^2 + (4*z2 + 1)*x + z2 over its base + Set of Homomorphisms + from Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base + to Field in z12 with defining polynomial x^6 + (4*z2 + 3)*x^5 + x^4 + + (3*z2 + 1)*x^3 + x^2 + (4*z2 + 1)*x + z2 over its base sage: K.Hom(L, category=Sets()) # optional - sage.rings.finite_rings - Set of Morphisms from Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base - to Field in z12 with defining polynomial x^6 + (4*z2 + 3)*x^5 + x^4 + (3*z2 + 1)*x^3 + x^2 + (4*z2 + 1)*x + z2 over its base - in Category of sets + Set of Morphisms + from Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base + to Field in z12 with defining polynomial x^6 + (4*z2 + 3)*x^5 + x^4 + + (3*z2 + 1)*x^3 + x^2 + (4*z2 + 1)*x + z2 over its base + in Category of sets """ from sage.rings.ring_extension_homset import RingExtensionHomset @@ -1876,7 +1886,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): We define (by hand) the relative Frobenius endomorphism of the extension `L/K`:: sage: L.hom([b^25]) # optional - sage.rings.finite_rings - Ring endomorphism of Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base + Ring endomorphism of + Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: b |--> 2 + 2*a*b + (2 - a)*b^2 Defining the absolute Frobenius of `L` is a bit more complicated @@ -1892,7 +1903,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): sage: FrobK = K.hom([a^5]) # optional - sage.rings.finite_rings sage: FrobL = L.hom([b^5], base_map=FrobK); FrobL # optional - sage.rings.finite_rings - Ring endomorphism of Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base + Ring endomorphism of + Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: b |--> (-1 + a) + (1 + 2*a)*b + a*b^2 with map on base ring: a |--> 1 - a @@ -1900,7 +1912,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): As a shortcut, we may use the following construction:: sage: phi = L.hom([b^5, a^5]); phi # optional - sage.rings.finite_rings - Ring endomorphism of Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base + Ring endomorphism of + Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: b |--> (-1 + a) + (1 + 2*a)*b + a*b^2 with map on base ring: a |--> 1 - a @@ -2210,11 +2223,11 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 2) - sage: B. = QQ.extension(x^6 - 2) - sage: f = A.hom([b^3]) - sage: E = B.over(f) - sage: E.degree_over() # indirect doctest + sage: A. = QQ.extension(x^2 - 2) # optional - sage.rings.number_field + sage: B. = QQ.extension(x^6 - 2) # optional - sage.rings.number_field + sage: f = A.hom([b^3]) # optional - sage.rings.number_field + sage: E = B.over(f) # optional - sage.rings.number_field + sage: E.degree_over() # indirect doctest # optional - sage.rings.number_field 3 """ if base is self: @@ -2318,9 +2331,9 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^3 - 2) - sage: K. = A.over() - sage: K.basis_over() + sage: A. = QQ.extension(x^3 - 2) # optional - sage.rings.number_field + sage: K. = A.over() # optional - sage.rings.number_field + sage: K.basis_over() # optional - sage.rings.number_field [1, u, u^2] """ if base is self: From cb68414c991ff3c37304c67063dea2fdabd67629 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 3 Jun 2023 17:00:24 -0700 Subject: [PATCH 301/423] sage.rings: More # optional --- src/sage/rings/lazy_series.py | 488 +++++++++++----------- src/sage/rings/lazy_series_ring.py | 182 ++++---- src/sage/rings/ring_extension_element.pyx | 14 +- 3 files changed, 344 insertions(+), 340 deletions(-) diff --git a/src/sage/rings/lazy_series.py b/src/sage/rings/lazy_series.py index b58e21e655c..8698af54927 100644 --- a/src/sage/rings/lazy_series.py +++ b/src/sage/rings/lazy_series.py @@ -1459,12 +1459,12 @@ def _ascii_art_(self): EXAMPLES:: - sage: e = SymmetricFunctions(QQ).e() # optional - sage.combinat - sage: L. = LazyLaurentSeriesRing(e) # optional - sage.combinat - sage: L.options.display_length = 3 # optional - sage.combinat - sage: ascii_art(1 / (1 - e[1]*z)) # optional - sage.combinat + sage: e = SymmetricFunctions(QQ).e() # optional - sage.combinat sage.modules + sage: L. = LazyLaurentSeriesRing(e) # optional - sage.combinat sage.modules + sage: L.options.display_length = 3 # optional - sage.combinat sage.modules + sage: ascii_art(1 / (1 - e[1]*z)) # optional - sage.combinat sage.modules e[] + e[1]*z + e[1, 1]*z^2 + O(e[]*z^3) - sage: L.options._reset() # optional - sage.combinat + sage: L.options._reset() # optional - sage.combinat sage.modules """ from sage.typeset.ascii_art import ascii_art, AsciiArt if isinstance(self._coeff_stream, Stream_zero): @@ -1479,12 +1479,12 @@ def _unicode_art_(self): EXAMPLES:: - sage: e = SymmetricFunctions(QQ).e() # optional - sage.combinat - sage: L. = LazyLaurentSeriesRing(e) # optional - sage.combinat - sage: L.options.display_length = 3 # optional - sage.combinat - sage: unicode_art(1 / (1 - e[1]*z)) # optional - sage.combinat + sage: e = SymmetricFunctions(QQ).e() # optional - sage.combinat sage.modules + sage: L. = LazyLaurentSeriesRing(e) # optional - sage.combinat sage.modules + sage: L.options.display_length = 3 # optional - sage.combinat sage.modules + sage: unicode_art(1 / (1 - e[1]*z)) # optional - sage.combinat sage.modules e[] + e[1]*z + e[1, 1]*z^2 + O(e[]*z^3) - sage: L.options._reset() # optional - sage.combinat + sage: L.options._reset() # optional - sage.combinat sage.modules """ from sage.typeset.unicode_art import unicode_art, UnicodeArt if isinstance(self._coeff_stream, Stream_zero): @@ -2028,8 +2028,8 @@ def cos(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") - sage: cos(z)[0:6] == cos(x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # optional - sage.symbolic + sage: cos(z)[0:6] == cos(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ from .lazy_series_ring import LazyLaurentSeriesRing @@ -2054,8 +2054,8 @@ def tan(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") - sage: tan(z)[0:6] == tan(x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # optional - sage.symbolic + sage: tan(z)[0:6] == tan(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ return self.sin() / self.cos() @@ -2076,8 +2076,8 @@ def cot(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") - sage: cot(z)[0:6] == cot(x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # optional - sage.symbolic + sage: cot(z)[0:6] == cot(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ return ~self.tan() @@ -2098,8 +2098,8 @@ def csc(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") - sage: (z*csc(z))[0:6] == (x*csc(x)).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # optional - sage.symbolic + sage: (z*csc(z))[0:6] == (x*csc(x)).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ return ~self.sin() @@ -2120,8 +2120,8 @@ def sec(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") - sage: sec(z)[0:6] == sec(x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # optional - sage.symbolic + sage: sec(z)[0:6] == sec(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ return ~self.cos() @@ -2146,8 +2146,8 @@ def arcsin(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") - sage: asin(z)[0:6] == asin(x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # optional - sage.symbolic + sage: asin(z)[0:6] == asin(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ from .lazy_series_ring import LazyLaurentSeriesRing @@ -2183,8 +2183,8 @@ def arccos(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") - sage: acos(z)[0:6] == acos(x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic + sage: acos(z)[0:6] == acos(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ from sage.symbolic.constants import pi @@ -2207,8 +2207,8 @@ def arctan(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") - sage: atan(z)[0:6] == atan(x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # optional - sage.symbolic + sage: atan(z)[0:6] == atan(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ from .lazy_series_ring import LazyLaurentSeriesRing @@ -2246,8 +2246,8 @@ def arccot(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") - sage: acot(z)[0:6] == acot(x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic + sage: acot(z)[0:6] == acot(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ from sage.symbolic.constants import pi @@ -2273,8 +2273,8 @@ def sinh(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") - sage: sinh(z)[0:6] == sinh(x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic + sage: sinh(z)[0:6] == sinh(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ from .lazy_series_ring import LazyLaurentSeriesRing @@ -2300,8 +2300,8 @@ def cosh(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") - sage: cosh(z)[0:6] == cosh(x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic + sage: cosh(z)[0:6] == cosh(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ from .lazy_series_ring import LazyLaurentSeriesRing @@ -2327,8 +2327,8 @@ def tanh(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") - sage: tanh(z)[0:6] == tanh(x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic + sage: tanh(z)[0:6] == tanh(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ from sage.arith.misc import bernoulli @@ -2358,8 +2358,8 @@ def coth(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") - sage: coth(z)[0:6] == coth(x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic + sage: coth(z)[0:6] == coth(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ from sage.arith.misc import bernoulli @@ -2390,8 +2390,8 @@ def sech(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") - sage: sech(z)[0:6] == sech(x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic + sage: sech(z)[0:6] == sech(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ from sage.combinat.combinat import euler_number @@ -2421,8 +2421,8 @@ def csch(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") - sage: csch(z)[0:6] == csch(x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic + sage: csch(z)[0:6] == csch(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ from sage.arith.misc import bernoulli @@ -2460,8 +2460,8 @@ def arcsinh(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") - sage: asinh(z)[0:6] == asinh(x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic + sage: asinh(z)[0:6] == asinh(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ @@ -2498,8 +2498,8 @@ def arctanh(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") - sage: atanh(z)[0:6] == atanh(x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic + sage: atanh(z)[0:6] == atanh(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ @@ -2533,8 +2533,8 @@ def hypergeometric(self, a, b): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") - sage: z.hypergeometric([1,1],[1])[0:6] == hypergeometric([1,1],[1], x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic + sage: z.hypergeometric([1,1],[1])[0:6] == hypergeometric([1,1],[1], x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True """ @@ -2685,10 +2685,9 @@ def sqrt(self): This also works for Dirichlet series:: - sage: D = LazyDirichletSeriesRing(SR, "s") - sage: Z = D(constant=1) - sage: f = sqrt(Z) - sage: f # optional - sage.symbolic + sage: D = LazyDirichletSeriesRing(SR, "s") # optional - sage.symbolic + sage: Z = D(constant=1) # optional - sage.symbolic + sage: f = sqrt(Z); f # optional - sage.symbolic 1 + 1/2/2^s + 1/2/3^s + 3/8/4^s + 1/2/5^s + 1/4/6^s + 1/2/7^s + O(1/(8^s)) sage: f*f - Z # optional - sage.symbolic O(1/(8^s)) @@ -2799,22 +2798,22 @@ def _mul_(self, other): Multiplication of series with eventually constant coefficients may yield another such series:: - sage: L. = LazyLaurentSeriesRing(SR) - sage: var("a b c d e u v w") + sage: L. = LazyLaurentSeriesRing(SR) # optional - sage.symbolic + sage: var("a b c d e u v w") # optional - sage.symbolic (a, b, c, d, e, u, v, w) - sage: s = a/z^2 + b*z + c*z^2 + d*z^3 + e*z^4 - sage: t = L([u, v], constant=w, valuation=-1) - sage: s1 = s.approximate_series(44) - sage: t1 = t.approximate_series(44) - sage: s1 * t1 - (s * t).approximate_series(42) + sage: s = a/z^2 + b*z + c*z^2 + d*z^3 + e*z^4 # optional - sage.symbolic + sage: t = L([u, v], constant=w, valuation=-1) # optional - sage.symbolic + sage: s1 = s.approximate_series(44) # optional - sage.symbolic + sage: t1 = t.approximate_series(44) # optional - sage.symbolic + sage: s1 * t1 - (s * t).approximate_series(42) # optional - sage.symbolic O(z^42) Check products with exact series:: - sage: L([1], constant=3)^2 + sage: L([1], constant=3)^2 # optional - sage.symbolic 1 + 6*z + 15*z^2 + 24*z^3 + 33*z^4 + 42*z^5 + 51*z^6 + O(z^7) - sage: (1+z) * L([1,0,1], constant=1) + sage: (1+z) * L([1,0,1], constant=1) # optional - sage.symbolic 1 + z + z^2 + 2*z^3 + 2*z^4 + 2*z^5 + O(z^6) """ P = self.parent() @@ -2935,8 +2934,8 @@ def __pow__(self, n): We also support the general case:: - sage: L. = LazyLaurentSeriesRing(SR) - sage: (1 + z)^(1 + z) + sage: L. = LazyLaurentSeriesRing(SR) # optional - sage.symbolic + sage: (1 + z)^(1 + z) # optional - sage.symbolic 1 + z + z^2 + 1/2*z^3 + 1/3*z^4 + 1/12*z^5 + 3/40*z^6 + O(z^7) """ @@ -2996,14 +2995,14 @@ def __invert__(self): We can also compute the multiplicative inverse of a symmetric function:: - sage: h = SymmetricFunctions(QQ).h() - sage: p = SymmetricFunctions(QQ).p() - sage: L = LazySymmetricFunctions(p) - sage: E = L(lambda n: h[n]) - sage: (~E)[:4] + sage: h = SymmetricFunctions(QQ).h() # optional - sage.modules + sage: p = SymmetricFunctions(QQ).p() # optional - sage.modules + sage: L = LazySymmetricFunctions(p) # optional - sage.modules + sage: E = L(lambda n: h[n]) # optional - sage.modules + sage: (~E)[:4] # optional - sage.modules [p[], -p[1], 1/2*p[1, 1] - 1/2*p[2], -1/6*p[1, 1, 1] + 1/2*p[2, 1] - 1/3*p[3]] - sage: (E * ~E)[:6] + sage: (E * ~E)[:6] # optional - sage.modules [p[], 0, 0, 0, 0, 0] TESTS:: @@ -3115,8 +3114,8 @@ def _div_(self, other): An example over the ring of symmetric functions:: sage: e = SymmetricFunctions(QQ).e() - sage: R. = LazyLaurentSeriesRing(e) - sage: 1 / (1 - e[1]*z) + sage: R. = LazyLaurentSeriesRing(e) # optional - sage.modules + sage: 1 / (1 - e[1]*z) # optional - sage.modules e[] + e[1]*z + e[1, 1]*z^2 + e[1, 1, 1]*z^3 + e[1, 1, 1, 1]*z^4 + e[1, 1, 1, 1, 1]*z^5 + e[1, 1, 1, 1, 1, 1]*z^6 + O(e[]*z^7) @@ -3369,11 +3368,11 @@ def log(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") - sage: log(1+z)[0:6] == log(1+x).series(x, 6).coefficients(sparse=False) + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # optional - sage.symbolic + sage: log(1+z)[0:6] == log(1+x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic True - sage: log(z) + sage: log(z) # optional - sage.symbolic Traceback (most recent call last): ... ValueError: can only compose with a positive valuation series @@ -5314,19 +5313,19 @@ def xgcd(self, f): sage: g == s * a + t * b True - sage: L. = LazyPowerSeriesRing(GF(2)) - sage: a = L(lambda n: n % 2, valuation=3); a + sage: L. = LazyPowerSeriesRing(GF(2)) # optional - sage.rings.finite_rings + sage: a = L(lambda n: n % 2, valuation=3); a # optional - sage.rings.finite_rings x^3 + x^5 + x^7 + x^9 + O(x^10) - sage: b = L(lambda n: binomial(n,2) % 2, valuation=3); b + sage: b = L(lambda n: binomial(n,2) % 2, valuation=3); b # optional - sage.rings.finite_rings x^3 + x^6 + x^7 + O(x^10) - sage: g, s, t = a.xgcd(b) - sage: g + sage: g, s, t = a.xgcd(b) # optional - sage.rings.finite_rings + sage: g # optional - sage.rings.finite_rings x^3 - sage: s + sage: s # optional - sage.rings.finite_rings 1 + x + x^3 + x^4 + x^5 + O(x^7) - sage: t + sage: t # optional - sage.rings.finite_rings x + x^2 + x^4 + x^5 + x^6 + O(x^8) - sage: g == s * a + t * b + sage: g == s * a + t * b # optional - sage.rings.finite_rings True sage: LazyPowerSeriesRing.options._reset() # reset the options @@ -5368,11 +5367,11 @@ def _format_series(self, formatter, format_strings=False): TESTS:: - sage: h = SymmetricFunctions(ZZ).h() - sage: e = SymmetricFunctions(ZZ).e() - sage: L = LazySymmetricFunctions(tensor([h, e])) - sage: f = L(lambda n: sum(tensor([h[k], e[n-k]]) for k in range(n+1))) - sage: f._format_series(repr) + sage: h = SymmetricFunctions(ZZ).h() # optional - sage.modules + sage: e = SymmetricFunctions(ZZ).e() # optional - sage.modules + sage: L = LazySymmetricFunctions(tensor([h, e])) # optional - sage.modules + sage: f = L(lambda n: sum(tensor([h[k], e[n-k]]) for k in range(n+1))) # optional - sage.modules + sage: f._format_series(repr) # optional - sage.modules '(h[]#e[]) + (h[]#e[1]+h[1]#e[]) + (h[]#e[2]+h[1]#e[1]+h[2]#e[]) @@ -5443,8 +5442,8 @@ class LazySymmetricFunction(LazyCompletionGradedAlgebraElement): EXAMPLES:: - sage: s = SymmetricFunctions(ZZ).s() - sage: L = LazySymmetricFunctions(s) + sage: s = SymmetricFunctions(ZZ).s() # optional - sage.modules + sage: L = LazySymmetricFunctions(s) # optional - sage.modules """ def is_unit(self): """ @@ -5452,22 +5451,22 @@ def is_unit(self): EXAMPLES:: - sage: m = SymmetricFunctions(ZZ).m() - sage: L = LazySymmetricFunctions(m) + sage: m = SymmetricFunctions(ZZ).m() # optional - sage.modules + sage: L = LazySymmetricFunctions(m) # optional - sage.modules - sage: L(2*m[1]).is_unit() + sage: L(2*m[1]).is_unit() # optional - sage.modules False - sage: L(-1 + 2*m[1]).is_unit() + sage: L(-1 + 2*m[1]).is_unit() # optional - sage.modules True - sage: L(2 + m[1]).is_unit() + sage: L(2 + m[1]).is_unit() # optional - sage.modules False - sage: m = SymmetricFunctions(QQ).m() - sage: L = LazySymmetricFunctions(m) + sage: m = SymmetricFunctions(QQ).m() # optional - sage.modules + sage: L = LazySymmetricFunctions(m) # optional - sage.modules - sage: L(2 + 3*m[1]).is_unit() + sage: L(2 + 3*m[1]).is_unit() # optional - sage.modules True """ if self.is_zero(): # now 0 != 1 @@ -5511,54 +5510,54 @@ def __call__(self, *args, check=True): EXAMPLES:: sage: P. = QQ[] - sage: s = SymmetricFunctions(P).s() - sage: L = LazySymmetricFunctions(s) - sage: f = s[2] - sage: g = s[3] - sage: L(f)(L(g)) - L(f(g)) + sage: s = SymmetricFunctions(P).s() # optional - sage.modules + sage: L = LazySymmetricFunctions(s) # optional - sage.modules + sage: f = s[2] # optional - sage.modules + sage: g = s[3] # optional - sage.modules + sage: L(f)(L(g)) - L(f(g)) # optional - sage.modules 0 - sage: f = s[2] + s[2,1] - sage: g = s[1] + s[2,2] - sage: L(f)(L(g)) - L(f(g)) + sage: f = s[2] + s[2,1] # optional - sage.modules + sage: g = s[1] + s[2,2] # optional - sage.modules + sage: L(f)(L(g)) - L(f(g)) # optional - sage.modules 0 - sage: L(f)(g) - L(f(g)) + sage: L(f)(g) - L(f(g)) # optional - sage.modules 0 - sage: f = s[2] + s[2,1] - sage: g = s[1] + s[2,2] - sage: L(f)(L(q*g)) - L(f(q*g)) + sage: f = s[2] + s[2,1] # optional - sage.modules + sage: g = s[1] + s[2,2] # optional - sage.modules + sage: L(f)(L(q*g)) - L(f(q*g)) # optional - sage.modules 0 The Frobenius character of the permutation action on set partitions is a plethysm:: - sage: s = SymmetricFunctions(QQ).s() - sage: S = LazySymmetricFunctions(s) - sage: E1 = S(lambda n: s[n], valuation=1) - sage: E = 1 + E1 - sage: P = E(E1) - sage: P[:5] + sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules + sage: S = LazySymmetricFunctions(s) # optional - sage.modules + sage: E1 = S(lambda n: s[n], valuation=1) # optional - sage.modules + sage: E = 1 + E1 # optional - sage.modules + sage: P = E(E1) # optional - sage.modules + sage: P[:5] # optional - sage.modules [s[], s[1], 2*s[2], s[2, 1] + 3*s[3], 2*s[2, 2] + 2*s[3, 1] + 5*s[4]] The plethysm with a tensor product is also implemented:: - sage: s = SymmetricFunctions(QQ).s() - sage: X = tensor([s[1],s[[]]]) - sage: Y = tensor([s[[]],s[1]]) - sage: S = LazySymmetricFunctions(s) - sage: S2 = LazySymmetricFunctions(tensor([s, s])) - sage: A = S(s[1,1,1]) - sage: B = S2(X+Y) - sage: A(B) + sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules + sage: X = tensor([s[1],s[[]]]) # optional - sage.modules + sage: Y = tensor([s[[]],s[1]]) # optional - sage.modules + sage: S = LazySymmetricFunctions(s) # optional - sage.modules + sage: S2 = LazySymmetricFunctions(tensor([s, s])) # optional - sage.modules + sage: A = S(s[1,1,1]) # optional - sage.modules + sage: B = S2(X+Y) # optional - sage.modules + sage: A(B) # optional - sage.modules (s[]#s[1,1,1]+s[1]#s[1,1]+s[1,1]#s[1]+s[1,1,1]#s[]) - sage: H = S(lambda n: s[n]) - sage: H(S2(X*Y)) + sage: H = S(lambda n: s[n]) # optional - sage.modules + sage: H(S2(X*Y)) # optional - sage.modules (s[]#s[]) + (s[1]#s[1]) + (s[1,1]#s[1,1]+s[2]#s[2]) + (s[1,1,1]#s[1,1,1]+s[2,1]#s[2,1]+s[3]#s[3]) + O^7 - sage: H(S2(X+Y)) + sage: H(S2(X+Y)) # optional - sage.modules (s[]#s[]) + (s[]#s[1]+s[1]#s[]) + (s[]#s[2]+s[1]#s[1]+s[2]#s[]) + (s[]#s[3]+s[1]#s[2]+s[2]#s[1]+s[3]#s[]) + (s[]#s[4]+s[1]#s[3]+s[2]#s[2]+s[3]#s[1]+s[4]#s[]) @@ -5568,24 +5567,24 @@ def __call__(self, *args, check=True): TESTS:: - sage: s = SymmetricFunctions(QQ).s() - sage: S = LazySymmetricFunctions(s) - sage: f = 1 / (1 - S(s[2])) - sage: g = f(s[2]); g + sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules + sage: S = LazySymmetricFunctions(s) # optional - sage.modules + sage: f = 1 / (1 - S(s[2])) # optional - sage.modules + sage: g = f(s[2]); g # optional - sage.modules s[] + (s[2,2]+s[4]) + O^7 - sage: S(sum(f[i](s[2]) for i in range(5))).truncate(10) == g.truncate(10) + sage: S(sum(f[i](s[2]) for i in range(5))).truncate(10) == g.truncate(10) # optional - sage.modules True - sage: f = 1 / (1 - S(s[2])) - sage: g = S(s[1]) / (1 - S(s[1])) - sage: f(g) + sage: f = 1 / (1 - S(s[2])) # optional - sage.modules + sage: g = S(s[1]) / (1 - S(s[1])) # optional - sage.modules + sage: f(g) # optional - sage.modules s[] + s[2] + (s[1,1,1]+2*s[2,1]+s[3]) + (2*s[1,1,1,1]+4*s[2,1,1]+5*s[2,2]+5*s[3,1]+3*s[4]) + (2*s[1,1,1,1,1]+10*s[2,1,1,1]+14*s[2,2,1]+18*s[3,1,1]+16*s[3,2]+14*s[4,1]+4*s[5]) + (3*s[1,1,1,1,1,1]+22*s[2,1,1,1,1]+38*s[2,2,1,1]+28*s[2,2,2]+48*s[3,1,1,1]+82*s[3,2,1]+25*s[3,3]+51*s[4,1,1]+56*s[4,2]+31*s[5,1]+9*s[6]) + O^7 - sage: f(0) + sage: f(0) # optional - sage.modules 1 - sage: f(s(1)) + sage: f(s(1)) # optional - sage.modules Traceback (most recent call last): ... ValueError: can only compose with a positive valuation series @@ -5593,22 +5592,22 @@ def __call__(self, *args, check=True): Check that composing the zero series with anything yields zero in the correct parent:: - sage: e = SymmetricFunctions(QQ).e() - sage: h = SymmetricFunctions(QQ).h() - sage: s = SymmetricFunctions(QQ).s() - sage: p = SymmetricFunctions(QQ).p() - sage: L = LazySymmetricFunctions(tensor([e, h])) - sage: r = (L(0)(s[1], p[1])); r + sage: e = SymmetricFunctions(QQ).e() # optional - sage.modules + sage: h = SymmetricFunctions(QQ).h() # optional - sage.modules + sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules + sage: p = SymmetricFunctions(QQ).p() # optional - sage.modules + sage: L = LazySymmetricFunctions(tensor([e, h])) # optional - sage.modules + sage: r = (L(0)(s[1], p[1])); r # optional - sage.modules 0 - sage: r.parent() + sage: r.parent() # optional - sage.modules Symmetric Functions over Rational Field in the Schur basis Check that composing `f` with zero series yields the constant term of `f`:: - sage: f = 3*L(tensor([s[1], s[1]])) - sage: f(0, 0) + sage: f = 3*L(tensor([s[1], s[1]])) # optional - sage.modules + sage: f(0, 0) # optional - sage.modules 0 - sage: (3+f)(0, 0) + sage: (3+f)(0, 0) # optional - sage.modules 3 """ fP = parent(self) @@ -5695,39 +5694,39 @@ def revert(self): EXAMPLES:: - sage: h = SymmetricFunctions(QQ).h() - sage: L = LazySymmetricFunctions(h) - sage: f = L(lambda n: h[n]) - 1 - sage: f(f.revert()) + sage: h = SymmetricFunctions(QQ).h() # optional - sage.modules + sage: L = LazySymmetricFunctions(h) # optional - sage.modules + sage: f = L(lambda n: h[n]) - 1 # optional - sage.modules + sage: f(f.revert()) # optional - sage.modules h[1] + O^8 TESTS:: - sage: f = L(lambda n: h[n]) - 1 - h[1] - sage: g = f.revert() - sage: g[1] + sage: f = L(lambda n: h[n]) - 1 - h[1] # optional - sage.modules + sage: g = f.revert() # optional - sage.modules + sage: g[1] # optional - sage.modules Traceback (most recent call last): ... ValueError: compositional inverse does not exist - sage: R. = QQ[] - sage: p = SymmetricFunctions(R.fraction_field()).p() - sage: L = LazySymmetricFunctions(p) - sage: f = L(a + b*p[1]) - sage: f.revert() + sage: R. = QQ[] # optional - sage.modules + sage: p = SymmetricFunctions(R.fraction_field()).p() # optional - sage.modules + sage: L = LazySymmetricFunctions(p) # optional - sage.modules + sage: f = L(a + b*p[1]) # optional - sage.modules + sage: f.revert() # optional - sage.modules (((-a)/b)*p[]) + 1/b*p[1] - sage: f = L(2*p[1]) - sage: f.revert() + sage: f = L(2*p[1]) # optional - sage.modules + sage: f.revert() # optional - sage.modules 1/2*p[1] - sage: f = L(2*p[1] + p[1,1]) - sage: f.revert() + sage: f = L(2*p[1] + p[1,1]) # optional - sage.modules + sage: f.revert() # optional - sage.modules 1/2*p[1] + (-1/8*p[1,1]) + (1/16*p[1,1,1]) + (-5/128*p[1,1,1,1]) + (7/256*p[1,1,1,1,1]) + (-21/1024*p[1,1,1,1,1,1]) + (33/2048*p[1,1,1,1,1,1,1]) + O^8 - sage: f.revert()(f) + sage: f.revert()(f) # optional - sage.modules p[1] + O^8 ALGORITHM: @@ -5820,32 +5819,33 @@ def derivative_with_respect_to_p1(self, n=1): The species `E` of sets satisfies the relationship `E' = E`:: - sage: h = SymmetricFunctions(QQ).h() - sage: T = LazySymmetricFunctions(h) - sage: E = T(lambda n: h[n]) - sage: E - E.derivative_with_respect_to_p1() + sage: h = SymmetricFunctions(QQ).h() # optional - sage.modules + sage: T = LazySymmetricFunctions(h) # optional - sage.modules + sage: E = T(lambda n: h[n]) # optional - sage.modules + sage: E - E.derivative_with_respect_to_p1() # optional - sage.modules O^6 The species `C` of cyclic orderings and the species `L` of linear orderings satisfy the relationship `C' = L`:: - sage: p = SymmetricFunctions(QQ).p() - sage: C = T(lambda n: (sum(euler_phi(k)*p([k])**(n//k) for k in divisors(n))/n if n > 0 else 0)) - sage: L = T(lambda n: p([1]*n)) - sage: L - C.derivative_with_respect_to_p1() + sage: p = SymmetricFunctions(QQ).p() # optional - sage.modules + sage: C = T(lambda n: (sum(euler_phi(k)*p([k])**(n//k) + ....: for k in divisors(n))/n if n > 0 else 0)) + sage: L = T(lambda n: p([1]*n)) # optional - sage.modules + sage: L - C.derivative_with_respect_to_p1() # optional - sage.modules O^6 TESTS:: - sage: T = LazySymmetricFunctions(p) - sage: a = T(p([1,1,1])) - sage: a.derivative_with_respect_to_p1() + sage: T = LazySymmetricFunctions(p) # optional - sage.modules + sage: a = T(p([1,1,1])) # optional - sage.modules + sage: a.derivative_with_respect_to_p1() # optional - sage.modules (3*p[1,1]) + O^9 - sage: a.derivative_with_respect_to_p1(1) + sage: a.derivative_with_respect_to_p1(1) # optional - sage.modules (3*p[1,1]) + O^9 - sage: a.derivative_with_respect_to_p1(2) + sage: a.derivative_with_respect_to_p1(2) # optional - sage.modules 6*p[1] + O^8 - sage: a.derivative_with_respect_to_p1(3) + sage: a.derivative_with_respect_to_p1(3) # optional - sage.modules 6*p[] + O^7 """ P = self.parent() @@ -5900,12 +5900,12 @@ def functorial_composition(self, *args): :class:`~sage.combinat.species.subset_species.SubsetSpecies`.:: sage: R. = QQ[] - sage: h = SymmetricFunctions(R).h() - sage: m = SymmetricFunctions(R).m() - sage: L = LazySymmetricFunctions(m) - sage: P = L(lambda n: sum(q^k*h[n-k]*h[k] for k in range(n+1))) - sage: P2 = L(lambda n: h[2]*h[n-2], valuation=2) - sage: P.functorial_composition(P2)[:4] + sage: h = SymmetricFunctions(R).h() # optional - sage.modules + sage: m = SymmetricFunctions(R).m() # optional - sage.modules + sage: L = LazySymmetricFunctions(m) # optional - sage.modules + sage: P = L(lambda n: sum(q^k*h[n-k]*h[k] for k in range(n+1))) # optional - sage.modules + sage: P2 = L(lambda n: h[2]*h[n-2], valuation=2) # optional - sage.modules + sage: P.functorial_composition(P2)[:4] # optional - sage.modules [m[], m[1], (q+1)*m[1, 1] + (q+1)*m[2], @@ -5913,12 +5913,12 @@ def functorial_composition(self, *args): For example, there are:: - sage: P.functorial_composition(P2)[4].coefficient([4])[3] + sage: P.functorial_composition(P2)[4].coefficient([4])[3] # optional - sage.modules 3 unlabelled graphs on 4 vertices and 3 edges, and:: - sage: P.functorial_composition(P2)[4].coefficient([2,2])[3] + sage: P.functorial_composition(P2)[4].coefficient([2,2])[3] # optional - sage.modules 8 labellings of their vertices with two 1's and two 2's. @@ -5926,43 +5926,43 @@ def functorial_composition(self, *args): The symmetric function `h_1 \sum_n h_n` is the neutral element with respect to functorial composition:: - sage: p = SymmetricFunctions(QQ).p() - sage: h = SymmetricFunctions(QQ).h() - sage: e = SymmetricFunctions(QQ).e() - sage: L = LazySymmetricFunctions(h) - sage: E = L(lambda n: h[n]) - sage: Ep = p[1]*E.derivative_with_respect_to_p1(); Ep + sage: p = SymmetricFunctions(QQ).p() # optional - sage.modules + sage: h = SymmetricFunctions(QQ).h() # optional - sage.modules + sage: e = SymmetricFunctions(QQ).e() # optional - sage.modules + sage: L = LazySymmetricFunctions(h) # optional - sage.modules + sage: E = L(lambda n: h[n]) # optional - sage.modules + sage: Ep = p[1]*E.derivative_with_respect_to_p1(); Ep # optional - sage.modules h[1] + (h[1,1]) + (h[2,1]) + (h[3,1]) + (h[4,1]) + (h[5,1]) + O^7 - sage: f = L(lambda n: h[n-n//2, n//2]) - sage: f - Ep.functorial_composition(f) + sage: f = L(lambda n: h[n-n//2, n//2]) # optional - sage.modules + sage: f - Ep.functorial_composition(f) # optional - sage.modules O^7 The functorial composition distributes over the sum:: - sage: F1 = L(lambda n: h[n]) - sage: F2 = L(lambda n: e[n]) - sage: f1 = F1.functorial_composition(f) - sage: f2 = F2.functorial_composition(f) - sage: (F1 + F2).functorial_composition(f) - f1 - f2 # long time + sage: F1 = L(lambda n: h[n]) # optional - sage.modules + sage: F2 = L(lambda n: e[n]) # optional - sage.modules + sage: f1 = F1.functorial_composition(f) # optional - sage.modules + sage: f2 = F2.functorial_composition(f) # optional - sage.modules + sage: (F1 + F2).functorial_composition(f) - f1 - f2 # long time # optional - sage.modules O^7 TESTS: Check a corner case:: - sage: h = SymmetricFunctions(QQ).h() - sage: L = LazySymmetricFunctions(h) - sage: L(h[2,1]).functorial_composition(3*h[0]) + sage: h = SymmetricFunctions(QQ).h() # optional - sage.modules + sage: L = LazySymmetricFunctions(h) # optional - sage.modules + sage: L(h[2,1]).functorial_composition(3*h[0]) # optional - sage.modules 3*h[] + O^7 Check an instance of a non-group action:: - sage: s = SymmetricFunctions(QQ).s() - sage: p = SymmetricFunctions(QQ).p() - sage: L = LazySymmetricFunctions(p) - sage: f = L(lambda n: s[n]) - sage: g = 2*s[2, 1, 1] + s[2, 2] + 3*s[4] - sage: r = f.functorial_composition(g); r[4] + sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules + sage: p = SymmetricFunctions(QQ).p() # optional - sage.modules + sage: L = LazySymmetricFunctions(p) # optional - sage.modules + sage: f = L(lambda n: s[n]) # optional - sage.modules + sage: g = 2*s[2, 1, 1] + s[2, 2] + 3*s[4] # optional - sage.modules + sage: r = f.functorial_composition(g); r[4] # optional - sage.modules Traceback (most recent call last): ... ValueError: the argument is not the Frobenius character of a permutation representation @@ -6111,14 +6111,14 @@ def arithmetic_product(self, *args, check=True): consistent for all the lists in the structure. :: sage: R. = QQ[] - sage: p = SymmetricFunctions(R).p() - sage: m = SymmetricFunctions(R).m() - sage: L = LazySymmetricFunctions(m) - - sage: C = species.CycleSpecies().cycle_index_series() - sage: c = L(lambda n: C[n]) - sage: Lplus = L(lambda n: p([1]*n), valuation=1) - sage: r = c.arithmetic_product(Lplus); r + sage: p = SymmetricFunctions(R).p() # optional - sage.modules + sage: m = SymmetricFunctions(R).m() # optional - sage.modules + sage: L = LazySymmetricFunctions(m) # optional - sage.modules + + sage: C = species.CycleSpecies().cycle_index_series() # optional - sage.modules + sage: c = L(lambda n: C[n]) # optional - sage.modules + sage: Lplus = L(lambda n: p([1]*n), valuation=1) # optional - sage.modules + sage: r = c.arithmetic_product(Lplus); r # optional - sage.modules m[1] + (3*m[1,1]+2*m[2]) + (8*m[1,1,1]+4*m[2,1]+2*m[3]) + (42*m[1,1,1,1]+21*m[2,1,1]+12*m[2,2]+7*m[3,1]+3*m[4]) @@ -6128,7 +6128,7 @@ def arithmetic_product(self, *args, check=True): In particular, the number of regular octopuses is:: - sage: [r[n].coefficient([1]*n) for n in range(8)] + sage: [r[n].coefficient([1]*n) for n in range(8)] # optional - sage.modules [0, 1, 3, 8, 42, 144, 1440, 5760] It is shown in [MM2008]_ that the exponential generating @@ -6136,7 +6136,7 @@ def arithmetic_product(self, *args, check=True): (x) = \sum_{n \geq 1} \sigma (n) (n - 1)! \frac{x^{n}}{n!}` (where `\sigma (n)` is the sum of the divisors of `n`). :: - sage: [sum(divisors(i))*factorial(i-1) for i in range(1,8)] + sage: [sum(divisors(i))*factorial(i-1) for i in range(1,8)] # optional - sage.modules [1, 3, 8, 42, 144, 1440, 5760] AUTHORS: @@ -6151,37 +6151,37 @@ def arithmetic_product(self, *args, check=True): Check that the product with zero works:: - sage: s = SymmetricFunctions(QQ).s() - sage: L = LazySymmetricFunctions(s) - sage: L(0).arithmetic_product(s[2]) + sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules + sage: L = LazySymmetricFunctions(s) # optional - sage.modules + sage: L(0).arithmetic_product(s[2]) # optional - sage.modules 0 - sage: L(s[2]).arithmetic_product(0) + sage: L(s[2]).arithmetic_product(0) # optional - sage.modules 0 Check that the arithmetic product of symmetric functions of finite support works:: - sage: L(s([2])).arithmetic_product(s([1,1,1])) + sage: L(s([2])).arithmetic_product(s([1,1,1])) # optional - sage.modules s[2, 2, 1, 1] + s[3, 1, 1, 1] + s[3, 2, 1] + s[3, 3] + 2*s[4, 1, 1] - sage: f = 1/(1-L(s[1])) - sage: f.arithmetic_product(s[1]) - f + sage: f = 1/(1-L(s[1])) # optional - sage.modules + sage: f.arithmetic_product(s[1]) - f # optional - sage.modules O^7 Check that the arithmetic product of symmetric functions with constant a term works as advertised:: - sage: p = SymmetricFunctions(QQ).p() - sage: L = LazySymmetricFunctions(p) - sage: L(5).arithmetic_product(3*p[2,1]) + sage: p = SymmetricFunctions(QQ).p() # optional - sage.modules + sage: L = LazySymmetricFunctions(p) # optional - sage.modules + sage: L(5).arithmetic_product(3*p[2,1]) # optional - sage.modules 15*p[] Check the arithmetic product of symmetric functions over a finite field works:: - sage: s = SymmetricFunctions(FiniteField(2)).s() - sage: L = LazySymmetricFunctions(s) - sage: L(s([2])).arithmetic_product(s([1,1,1])) + sage: s = SymmetricFunctions(FiniteField(2)).s() # optional - sage.modules + sage: L = LazySymmetricFunctions(s) # optional - sage.modules + sage: L(s([2])).arithmetic_product(s([1,1,1])) # optional - sage.modules s[2, 2, 1, 1] + s[3, 1, 1, 1] + s[3, 2, 1] + s[3, 3] """ @@ -6278,36 +6278,36 @@ def symmetric_function(self, degree=None): EXAMPLES:: - sage: s = SymmetricFunctions(QQ).s() - sage: S = LazySymmetricFunctions(s) - sage: elt = S(s[2]) - sage: elt.symmetric_function() + sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules + sage: S = LazySymmetricFunctions(s) # optional - sage.modules + sage: elt = S(s[2]) # optional - sage.modules + sage: elt.symmetric_function() # optional - sage.modules s[2] TESTS:: - sage: s = SymmetricFunctions(QQ).s() - sage: S = LazySymmetricFunctions(s) - sage: elt = S(s[2]) - sage: elt.symmetric_function() + sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules + sage: S = LazySymmetricFunctions(s) # optional - sage.modules + sage: elt = S(s[2]) # optional - sage.modules + sage: elt.symmetric_function() # optional - sage.modules s[2] - sage: f = 1 / (1 - elt) - sage: f + sage: f = 1 / (1 - elt) # optional - sage.modules + sage: f # optional - sage.modules s[] + s[2] + (s[2,2]+s[3,1]+s[4]) + (s[2,2,2]+2*s[3,2,1]+s[3,3]+s[4,1,1]+3*s[4,2]+2*s[5,1]+s[6]) + O^7 - sage: f.symmetric_function() + sage: f.symmetric_function() # optional - sage.modules Traceback (most recent call last): ... ValueError: not a symmetric function - sage: f4 = f.truncate(5); f4 + sage: f4 = f.truncate(5); f4 # optional - sage.modules s[] + s[2] + (s[2,2]+s[3,1]+s[4]) - sage: f4.symmetric_function() + sage: f4.symmetric_function() # optional - sage.modules s[] + s[2] + s[2, 2] + s[3, 1] + s[4] - sage: f4.symmetric_function() == f.symmetric_function(4) + sage: f4.symmetric_function() == f.symmetric_function(4) # optional - sage.modules True - sage: S.zero().symmetric_function() + sage: S.zero().symmetric_function() # optional - sage.modules 0 - sage: f4.symmetric_function(0) + sage: f4.symmetric_function(0) # optional - sage.modules s[] """ diff --git a/src/sage/rings/lazy_series_ring.py b/src/sage/rings/lazy_series_ring.py index 32545f65574..e1358b0704b 100644 --- a/src/sage/rings/lazy_series_ring.py +++ b/src/sage/rings/lazy_series_ring.py @@ -712,9 +712,9 @@ def one(self): sage: L.one() 1 - sage: m = SymmetricFunctions(ZZ).m() - sage: L = LazySymmetricFunctions(m) - sage: L.one() + sage: m = SymmetricFunctions(ZZ).m() # optional - sage.modules + sage: L = LazySymmetricFunctions(m) # optional - sage.modules + sage: L.one() # optional - sage.modules m[] """ @@ -733,9 +733,9 @@ def zero(self): sage: L.zero() 0 - sage: s = SymmetricFunctions(ZZ).s() - sage: L = LazySymmetricFunctions(s) - sage: L.zero() + sage: s = SymmetricFunctions(ZZ).s() # optional - sage.modules + sage: L = LazySymmetricFunctions(s) # optional - sage.modules + sage: L.zero() # optional - sage.modules 0 sage: L = LazyDirichletSeriesRing(ZZ, 'z') @@ -807,11 +807,11 @@ def _coerce_map_from_(self, S): sage: L.has_coerce_map_from(GF(2)) # optional - sage.rings.finite_rings True - sage: s = SymmetricFunctions(GF(2)).s() # optional - sage.rings.finite_rings - sage: L = LazySymmetricFunctions(s) # optional - sage.rings.finite_rings - sage: L.has_coerce_map_from(ZZ) # optional - sage.rings.finite_rings + sage: s = SymmetricFunctions(GF(2)).s() # optional - sage.modules sage.rings.finite_rings + sage: L = LazySymmetricFunctions(s) # optional - sage.modules sage.rings.finite_rings + sage: L.has_coerce_map_from(ZZ) # optional - sage.modules sage.rings.finite_rings True - sage: L.has_coerce_map_from(GF(2)) # optional - sage.rings.finite_rings + sage: L.has_coerce_map_from(GF(2)) # optional - sage.modules sage.rings.finite_rings True """ if self.base_ring().has_coerce_map_from(S): @@ -2237,27 +2237,26 @@ class LazyCompletionGradedAlgebra(LazySeriesRing): EXAMPLES:: - sage: NCSF = NonCommutativeSymmetricFunctions(QQ) - sage: S = NCSF.Complete() - sage: L = S.formal_series_ring() - sage: L - Lazy completion of Non-Commutative Symmetric Functions over the Rational Field in the Complete basis + sage: NCSF = NonCommutativeSymmetricFunctions(QQ) # optional - sage.modules + sage: S = NCSF.Complete() # optional - sage.modules + sage: L = S.formal_series_ring(); L # optional - sage.modules + Lazy completion of Non-Commutative Symmetric Functions + over the Rational Field in the Complete basis - sage: f = 1 / (1 - L(S[1])) - sage: f - S[] + S[1] + (S[1,1]) + (S[1,1,1]) + (S[1,1,1,1]) + (S[1,1,1,1,1]) + (S[1,1,1,1,1,1]) + O^7 - sage: g = 1 / (1 - L(S[2])) - sage: g + sage: f = 1 / (1 - L(S[1])); f # optional - sage.modules + S[] + S[1] + (S[1,1]) + (S[1,1,1]) + (S[1,1,1,1]) + (S[1,1,1,1,1]) + + (S[1,1,1,1,1,1]) + O^7 + sage: g = 1 / (1 - L(S[2])); g # optional - sage.modules S[] + S[2] + (S[2,2]) + (S[2,2,2]) + O^7 - sage: f * g + sage: f * g # optional - sage.modules S[] + S[1] + (S[1,1]+S[2]) + (S[1,1,1]+S[1,2]) + (S[1,1,1,1]+S[1,1,2]+S[2,2]) + (S[1,1,1,1,1]+S[1,1,1,2]+S[1,2,2]) + (S[1,1,1,1,1,1]+S[1,1,1,1,2]+S[1,1,2,2]+S[2,2,2]) + O^7 - sage: g * f + sage: g * f # optional - sage.modules S[] + S[1] + (S[1,1]+S[2]) + (S[1,1,1]+S[2,1]) + (S[1,1,1,1]+S[2,1,1]+S[2,2]) + (S[1,1,1,1,1]+S[2,1,1,1]+S[2,2,1]) + (S[1,1,1,1,1,1]+S[2,1,1,1,1]+S[2,2,1,1]+S[2,2,2]) + O^7 - sage: f * g - g * f + sage: f * g - g * f # optional - sage.modules (S[1,2]-S[2,1]) + (S[1,1,2]-S[2,1,1]) + (S[1,1,1,2]+S[1,2,2]-S[2,1,1,1]-S[2,2,1]) + (S[1,1,1,1,2]+S[1,1,2,2]-S[2,1,1,1,1]-S[2,2,1,1]) + O^7 @@ -2272,23 +2271,23 @@ def __init__(self, basis, sparse=True, category=None): sage: LazySymmetricFunctions.options.halting_precision(6) - sage: s = SymmetricFunctions(QQ).s() - sage: L = LazySymmetricFunctions(s) - sage: TestSuite(L).run() + sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules + sage: L = LazySymmetricFunctions(s) # optional - sage.modules + sage: TestSuite(L).run() # optional - sage.modules - sage: p = SymmetricFunctions(GF(5)).p() # optional - sage.rings.finite_rings - sage: L = LazySymmetricFunctions(p) # optional - sage.rings.finite_rings - sage: TestSuite(L).run() # optional - sage.rings.finite_rings + sage: p = SymmetricFunctions(GF(5)).p() # optional - sage.modules sage.rings.finite_rings + sage: L = LazySymmetricFunctions(p) # optional - sage.modules sage.rings.finite_rings + sage: TestSuite(L).run() # optional - sage.modules sage.rings.finite_rings Reversion will only work when the base ring is a field:: - sage: s = SymmetricFunctions(ZZ).s() - sage: L = LazySymmetricFunctions(s) - sage: TestSuite(L).run(skip=['_test_revert']) + sage: s = SymmetricFunctions(ZZ).s() # optional - sage.modules + sage: L = LazySymmetricFunctions(s) # optional - sage.modules + sage: TestSuite(L).run(skip=['_test_revert']) # optional - sage.modules - sage: s = SymmetricFunctions(QQ["q"]).s() - sage: L = LazySymmetricFunctions(s) - sage: TestSuite(L).run(skip=['_test_revert']) + sage: s = SymmetricFunctions(QQ["q"]).s() # optional - sage.modules + sage: L = LazySymmetricFunctions(s) # optional - sage.modules + sage: TestSuite(L).run(skip=['_test_revert']) # optional - sage.modules Options are remembered across doctests:: @@ -2297,15 +2296,15 @@ def __init__(self, basis, sparse=True, category=None): Check that :trac:`34470` is fixed. The ideal generated by `p[1]` and `p[2]` is not principal:: - sage: p = SymmetricFunctions(QQ).p() - sage: L = LazySymmetricFunctions(s) - sage: L in PrincipalIdealDomains + sage: p = SymmetricFunctions(QQ).p() # optional - sage.modules + sage: L = LazySymmetricFunctions(s) # optional - sage.modules + sage: L in PrincipalIdealDomains # optional - sage.modules False Check that a basis which is not graded is not enough:: - sage: ht = SymmetricFunctions(ZZ).ht() - sage: L = LazySymmetricFunctions(ht) + sage: ht = SymmetricFunctions(ZZ).ht() # optional - sage.modules + sage: L = LazySymmetricFunctions(ht) # optional - sage.modules Traceback (most recent call last): ... ValueError: basis should be in GradedAlgebrasWithBasis @@ -2344,8 +2343,8 @@ def _repr_(self): EXAMPLES:: - sage: s = SymmetricFunctions(GF(2)).s() # optional - sage.rings.finite_rings - sage: LazySymmetricFunctions(s) # optional - sage.rings.finite_rings + sage: s = SymmetricFunctions(GF(2)).s() # optional - sage.modules sage.rings.finite_rings + sage: LazySymmetricFunctions(s) # optional - sage.modules sage.rings.finite_rings Lazy completion of Symmetric Functions over Finite Field of size 2 in the Schur basis """ return "Lazy completion of {}".format(self._laurent_poly_ring) @@ -2356,9 +2355,9 @@ def _latex_(self): EXAMPLES:: - sage: s = SymmetricFunctions(GF(2)).s() # optional - sage.rings.finite_rings - sage: L = LazySymmetricFunctions(s) # optional - sage.rings.finite_rings - sage: latex(L) # optional - sage.rings.finite_rings + sage: s = SymmetricFunctions(GF(2)).s() # optional - sage.modules sage.rings.finite_rings + sage: L = LazySymmetricFunctions(s) # optional - sage.modules sage.rings.finite_rings + sage: latex(L) # optional - sage.modules sage.rings.finite_rings \text{\texttt{Symmetric{ }Functions{ }over{ }Finite{ }Field{ }of{ }size{ }2{ }in{ }the{ }Schur{ }basis}} """ from sage.misc.latex import latex @@ -2370,10 +2369,10 @@ def _monomial(self, c, n): EXAMPLES:: - sage: m = SymmetricFunctions(ZZ).m() - sage: s = SymmetricFunctions(ZZ).s() - sage: L = LazySymmetricFunctions(m) - sage: L._monomial(s[2,1], 3) + sage: m = SymmetricFunctions(ZZ).m() # optional - sage.modules + sage: s = SymmetricFunctions(ZZ).s() # optional - sage.modules + sage: L = LazySymmetricFunctions(m) # optional - sage.modules + sage: L._monomial(s[2,1], 3) # optional - sage.modules 2*m[1, 1, 1] + m[2, 1] """ L = self._laurent_poly_ring @@ -2395,63 +2394,66 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No EXAMPLES:: - sage: m = SymmetricFunctions(GF(2)).m() # optional - sage.rings.finite_rings - sage: L = LazySymmetricFunctions(m) # optional - sage.rings.finite_rings - sage: L(2) # optional - sage.rings.finite_rings + sage: m = SymmetricFunctions(GF(2)).m() # optional - sage.modules sage.rings.finite_rings + sage: L = LazySymmetricFunctions(m) # optional - sage.modules sage.rings.finite_rings + sage: L(2) # optional - sage.modules sage.rings.finite_rings 0 - sage: L(3) # optional - sage.rings.finite_rings + sage: L(3) # optional - sage.modules sage.rings.finite_rings m[] - sage: m = SymmetricFunctions(ZZ).m() - sage: L = LazySymmetricFunctions(m) - sage: f = L(lambda i: m([i]), valuation=5, degree=10); f + sage: m = SymmetricFunctions(ZZ).m() # optional - sage.modules + sage: L = LazySymmetricFunctions(m) # optional - sage.modules + sage: f = L(lambda i: m([i]), valuation=5, degree=10); f # optional - sage.modules m[5] + m[6] + m[7] + m[8] + m[9] - sage: f.coefficient(6) + sage: f.coefficient(6) # optional - sage.modules m[6] - sage: f[20] + sage: f[20] # optional - sage.modules 0 Alternatively, ``x`` can be a list of elements of the base ring. Then these elements are read as coefficients of the terms of degrees starting from the ``valuation``:: - sage: f = L([m[1],m[2],m[3]], valuation=1); f + sage: f = L([m[1],m[2],m[3]], valuation=1); f # optional - sage.modules m[1] + m[2] + m[3] Finally, ``x`` can be a symmetric function:: - sage: m = SymmetricFunctions(ZZ).m() - sage: s = SymmetricFunctions(ZZ).s() - sage: L = LazySymmetricFunctions(m) - sage: L(s.an_element()) + sage: m = SymmetricFunctions(ZZ).m() # optional - sage.modules + sage: s = SymmetricFunctions(ZZ).s() # optional - sage.modules + sage: L = LazySymmetricFunctions(m) # optional - sage.modules + sage: L(s.an_element()) # optional - sage.modules 2*m[] + 2*m[1] + (3*m[1,1]+3*m[2]) TESTS:: - sage: e = SymmetricFunctions(ZZ).e() - sage: h = SymmetricFunctions(ZZ).h() - sage: L = LazySymmetricFunctions(tensor([h, e])) - sage: L(lambda n: 0) + sage: e = SymmetricFunctions(ZZ).e() # optional - sage.modules + sage: h = SymmetricFunctions(ZZ).h() # optional - sage.modules + sage: L = LazySymmetricFunctions(tensor([h, e])) # optional - sage.modules + sage: L(lambda n: 0) # optional - sage.modules O^7 - sage: L(lambda n: tensor([h[n], e([])]) + tensor([h([]), e[n]]), degree=3) + sage: L(lambda n: tensor([h[n], e([])]) + tensor([h([]), e[n]]), degree=3) # optional - sage.modules (2*h[]#e[]) + (h[]#e[1]+h[1]#e[]) + (h[]#e[2]+h[2]#e[]) - sage: L(lambda n: n)[3]; + sage: L(lambda n: n)[3]; # optional - sage.modules Traceback (most recent call last): ... - ValueError: coefficient 3*h[] # e[] should be an element of homogeneous degree 3 but has degree 0 + ValueError: coefficient 3*h[] # e[] should be an element + of homogeneous degree 3 but has degree 0 - sage: L([1, 2, 3]); + sage: L([1, 2, 3]); # optional - sage.modules Traceback (most recent call last): ... - ValueError: coefficient 2*h[] # e[] should be an element of homogeneous degree 1 but has degree 0 + ValueError: coefficient 2*h[] # e[] should be an element + of homogeneous degree 1 but has degree 0 - sage: L(lambda n: n, degree=3); + sage: L(lambda n: n, degree=3); # optional - sage.modules Traceback (most recent call last): ... - ValueError: coefficient h[] # e[] should be an element of homogeneous degree 1 but has degree 0 + ValueError: coefficient h[] # e[] should be an element + of homogeneous degree 1 but has degree 0 """ if valuation is None: valuation = 0 @@ -2566,9 +2568,9 @@ def _an_element_(self): EXAMPLES:: - sage: m = SymmetricFunctions(ZZ).m() - sage: L = LazySymmetricFunctions(m) - sage: L.an_element() + sage: m = SymmetricFunctions(ZZ).m() # optional - sage.modules + sage: L = LazySymmetricFunctions(m) # optional - sage.modules + sage: L.an_element() # optional - sage.modules 2*m[] + 2*m[1] + 3*m[2] """ return self(self._laurent_poly_ring.an_element()) @@ -2579,9 +2581,9 @@ def some_elements(self): EXAMPLES:: - sage: m = SymmetricFunctions(GF(5)).m() # optional - sage.rings.finite_rings - sage: L = LazySymmetricFunctions(m) # optional - sage.rings.finite_rings - sage: L.some_elements()[:5] # optional - sage.rings.finite_rings + sage: m = SymmetricFunctions(GF(5)).m() # optional - sage.modules sage.rings.finite_rings + sage: L = LazySymmetricFunctions(m) # optional - sage.modules sage.rings.finite_rings + sage: L.some_elements()[:5] # optional - sage.modules sage.rings.finite_rings [0, m[], 2*m[] + 2*m[1] + 3*m[2], 2*m[1] + 3*m[2], 3*m[] + 2*m[1] + (m[1,1]+m[2]) + (2*m[1,1,1]+m[3]) @@ -2590,10 +2592,10 @@ def some_elements(self): + (2*m[2,2,1,1]+m[2,2,2]+2*m[3,2,1]+2*m[3,3]+m[4,1,1]+3*m[4,2]+4*m[5,1]+4*m[6]) + O^7] - sage: NCSF = NonCommutativeSymmetricFunctions(QQ) - sage: S = NCSF.Complete() - sage: L = S.formal_series_ring() - sage: L.some_elements()[:4] + sage: NCSF = NonCommutativeSymmetricFunctions(QQ) # optional - sage.modules + sage: S = NCSF.Complete() # optional - sage.modules + sage: L = S.formal_series_ring() # optional - sage.modules + sage: L.some_elements()[:4] # optional - sage.modules [0, S[], 2*S[] + 2*S[1] + (3*S[1,1]), 2*S[1] + (3*S[1,1])] """ @@ -2632,13 +2634,15 @@ class LazySymmetricFunctions(LazyCompletionGradedAlgebra): EXAMPLES:: - sage: s = SymmetricFunctions(ZZ).s() - sage: LazySymmetricFunctions(s) + sage: s = SymmetricFunctions(ZZ).s() # optional - sage.modules + sage: LazySymmetricFunctions(s) # optional - sage.modules Lazy completion of Symmetric Functions over Integer Ring in the Schur basis - sage: m = SymmetricFunctions(ZZ).m() - sage: LazySymmetricFunctions(tensor([s, m])) - Lazy completion of Symmetric Functions over Integer Ring in the Schur basis # Symmetric Functions over Integer Ring in the monomial basis + sage: m = SymmetricFunctions(ZZ).m() # optional - sage.modules + sage: LazySymmetricFunctions(tensor([s, m])) # optional - sage.modules + Lazy completion of + Symmetric Functions over Integer Ring in the Schur basis + # Symmetric Functions over Integer Ring in the monomial basis """ Element = LazySymmetricFunction diff --git a/src/sage/rings/ring_extension_element.pyx b/src/sage/rings/ring_extension_element.pyx index aa6bfc45be3..d2ca2bec4a3 100644 --- a/src/sage/rings/ring_extension_element.pyx +++ b/src/sage/rings/ring_extension_element.pyx @@ -104,12 +104,12 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 2) - sage: K. = A.over() # over QQ + sage: A. = QQ.extension(x^2 - 2) # optional - sage.rings.number_field + sage: K. = A.over() # over QQ # optional - sage.rings.number_field - sage: hasattr(a, 'continued_fraction') + sage: hasattr(a, 'continued_fraction') # optional - sage.rings.number_field True - sage: a.continued_fraction() + sage: a.continued_fraction() # optional - sage.rings.number_field [1; (2)*] """ try: @@ -138,10 +138,10 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 2) - sage: K. = A.over() + sage: A. = QQ.extension(x^2 - 2) # optional - sage.rings.number_field + sage: K. = A.over() # optional - sage.rings.number_field - sage: dir(a) + sage: dir(a) # optional - sage.rings.number_field ['__abs__', '__add__', ... From cddaa1aaed4c3594cbaa10d87db39c68e8f3faa2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 4 Jun 2023 15:27:44 -0700 Subject: [PATCH 302/423] More # optional --- src/sage/rings/ideal.py | 24 +++++++++++----------- src/sage/rings/morphism.pyx | 41 +++++++++++++++++++------------------ 2 files changed, 33 insertions(+), 32 deletions(-) diff --git a/src/sage/rings/ideal.py b/src/sage/rings/ideal.py index 2bb3a47e4d3..de0525c3e1d 100644 --- a/src/sage/rings/ideal.py +++ b/src/sage/rings/ideal.py @@ -510,30 +510,30 @@ def apply_morphism(self, phi): TESTS:: sage: x = polygen(ZZ) - sage: K. = NumberField(x^2 + 1) - sage: A = K.ideal(a) - sage: taus = K.embeddings(K) - sage: A.apply_morphism(taus[0]) # identity + sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_fields + sage: A = K.ideal(a) # optional - sage.rings.number_fields + sage: taus = K.embeddings(K) # optional - sage.rings.number_fields + sage: A.apply_morphism(taus[0]) # identity # optional - sage.rings.number_fields Fractional ideal (a) - sage: A.apply_morphism(taus[1]) # complex conjugation + sage: A.apply_morphism(taus[1]) # complex conjugation # optional - sage.rings.number_fields Fractional ideal (-a) - sage: A.apply_morphism(taus[0]) == A.apply_morphism(taus[1]) + sage: A.apply_morphism(taus[0]) == A.apply_morphism(taus[1]) # optional - sage.rings.number_fields True :: - sage: K. = NumberField(x^2 + 5) - sage: B = K.ideal([2, a + 1]); B + sage: K. = NumberField(x^2 + 5) # optional - sage.rings.number_fields + sage: B = K.ideal([2, a + 1]); B # optional - sage.rings.number_fields Fractional ideal (2, a + 1) - sage: taus = K.embeddings(K) - sage: B.apply_morphism(taus[0]) # identity + sage: taus = K.embeddings(K) # optional - sage.rings.number_fields + sage: B.apply_morphism(taus[0]) # identity # optional - sage.rings.number_fields Fractional ideal (2, a + 1) Since 2 is totally ramified, complex conjugation fixes it:: - sage: B.apply_morphism(taus[1]) # complex conjugation + sage: B.apply_morphism(taus[1]) # complex conjugation # optional - sage.rings.number_fields Fractional ideal (2, a + 1) - sage: taus[1](B) + sage: taus[1](B) # optional - sage.rings.number_fields Fractional ideal (2, a + 1) """ from sage.categories.morphism import is_Morphism diff --git a/src/sage/rings/morphism.pyx b/src/sage/rings/morphism.pyx index 9a88fccc29f..9e5b1b0f551 100644 --- a/src/sage/rings/morphism.pyx +++ b/src/sage/rings/morphism.pyx @@ -200,23 +200,24 @@ Inclusion from `\QQ` to the 3-adic field:: An automorphism of a quotient of a univariate polynomial ring:: sage: R. = PolynomialRing(QQ) - sage: S. = R.quo(x^2 - 2) - sage: sqrt2^2 + sage: S. = R.quo(x^2 - 2) # optional - sage.libs.pari + sage: sqrt2^2 # optional - sage.libs.pari 2 - sage: (3+sqrt2)^10 + sage: (3+sqrt2)^10 # optional - sage.libs.pari 993054*sqrt2 + 1404491 - sage: c = S.hom([-sqrt2]) - sage: c(1+sqrt2) + sage: c = S.hom([-sqrt2]) # optional - sage.libs.pari + sage: c(1+sqrt2) # optional - sage.libs.pari -sqrt2 + 1 Note that Sage verifies that the morphism is valid:: - sage: (1 - sqrt2)^2 + sage: (1 - sqrt2)^2 # optional - sage.libs.pari -2*sqrt2 + 3 - sage: c = S.hom([1-sqrt2]) # this is not valid + sage: c = S.hom([1 - sqrt2]) # this is not valid # optional - sage.libs.pari Traceback (most recent call last): ... - ValueError: relations do not all (canonically) map to 0 under map determined by images of generators + ValueError: relations do not all (canonically) map to 0 + under map determined by images of generators Endomorphism of power series ring:: @@ -278,35 +279,35 @@ positive:: Complex conjugation on cyclotomic fields:: - sage: K. = CyclotomicField(7) - sage: c = K.hom([1/zeta7]); c + sage: K. = CyclotomicField(7) # optional - sage.rings.number_field + sage: c = K.hom([1/zeta7]); c # optional - sage.rings.number_field Ring endomorphism of Cyclotomic Field of order 7 and degree 6 Defn: zeta7 |--> -zeta7^5 - zeta7^4 - zeta7^3 - zeta7^2 - zeta7 - 1 - sage: a = (1+zeta7)^5; a + sage: a = (1+zeta7)^5; a # optional - sage.rings.number_field zeta7^5 + 5*zeta7^4 + 10*zeta7^3 + 10*zeta7^2 + 5*zeta7 + 1 - sage: c(a) + sage: c(a) # optional - sage.rings.number_field 5*zeta7^5 + 5*zeta7^4 - 4*zeta7^2 - 5*zeta7 - 4 - sage: c(zeta7 + 1/zeta7) # this element is obviously fixed by inversion + sage: c(zeta7 + 1/zeta7) # this element is obviously fixed by inversion # optional - sage.rings.number_field -zeta7^5 - zeta7^4 - zeta7^3 - zeta7^2 - 1 - sage: zeta7 + 1/zeta7 + sage: zeta7 + 1/zeta7 # optional - sage.rings.number_field -zeta7^5 - zeta7^4 - zeta7^3 - zeta7^2 - 1 Embedding a number field into the reals:: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^3 - 2) - sage: alpha = RR(2)^(1/3); alpha + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: alpha = RR(2)^(1/3); alpha # optional - sage.rings.number_field 1.25992104989487 - sage: i = K.hom([alpha],check=False); i + sage: i = K.hom([alpha],check=False); i # optional - sage.rings.number_field Ring morphism: From: Number Field in beta with defining polynomial x^3 - 2 To: Real Field with 53 bits of precision Defn: beta |--> 1.25992104989487 - sage: i(beta) + sage: i(beta) # optional - sage.rings.number_field 1.25992104989487 - sage: i(beta^3) + sage: i(beta^3) # optional - sage.rings.number_field 2.00000000000000 - sage: i(beta^2 + 1) + sage: i(beta^2 + 1) # optional - sage.rings.number_field 2.58740105196820 An example from Jim Carlson:: From 6360ca7aa57f6c0a3435b60a1dae431cc5435e67 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 4 Jun 2023 23:30:25 -0700 Subject: [PATCH 303/423] sage.rings: More # optional --- src/sage/rings/complex_mpfr.pyx | 42 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/sage/rings/complex_mpfr.pyx b/src/sage/rings/complex_mpfr.pyx index 49f10a44373..4551a330989 100644 --- a/src/sage/rings/complex_mpfr.pyx +++ b/src/sage/rings/complex_mpfr.pyx @@ -2371,37 +2371,35 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): First we compute `\eta(1+i)`:: sage: i = CC.0 - sage: z = 1+i; z.eta() + sage: z = 1 + i; z.eta() # optional - sage.libs.pari 0.742048775836565 + 0.198831370229911*I We compute eta to low precision directly from the definition:: - sage: z = 1 + i; z.eta() - 0.742048775836565 + 0.198831370229911*I - sage: pi = CC(pi) # otherwise we will get a symbolic result. - sage: exp(pi * i * z / 12) * prod([1-exp(2*pi*i*n*z) for n in range(1,10)]) + sage: pi = CC(pi) # otherwise we will get a symbolic result. # optional - sage.symbolic + sage: exp(pi * i * z / 12) * prod(1 - exp(2*pi*i*n*z) # optional - sage.symbolic + ....: for n in range(1,10)) 0.742048775836565 + 0.198831370229911*I The optional argument allows us to omit the fractional part:: - sage: z = 1 + i - sage: z.eta(omit_frac=True) + sage: z.eta(omit_frac=True) # optional - sage.libs.pari 0.998129069925959 - sage: prod([1-exp(2*pi*i*n*z) for n in range(1,10)]) + sage: prod(1 - exp(2*pi*i*n*z) for n in range(1,10)) # optional - sage.symbolic 0.998129069925958 + 4.59099857829247e-19*I We illustrate what happens when `z` is not in the upper half plane:: sage: z = CC(1) - sage: z.eta() + sage: z.eta() # optional - sage.libs.pari Traceback (most recent call last): ... ValueError: value must be in the upper half plane You can also use functional notation:: - sage: eta(1+CC(I)) + sage: eta(1 + CC(I)) # optional - sage.libs.pari 0.742048775836565 + 0.198831370229911*I """ try: @@ -2586,7 +2584,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): 1.62780548487271 + 0.136827548397369*I sage: a.agm(b, algorithm="principal") 1.62780548487271 + 0.136827548397369*I - sage: a.agm(b, algorithm="pari") + sage: a.agm(b, algorithm="pari") # optional - sage.libs.pari 1.62780548487271 + 0.136827548397369*I An example to show that the returned value depends on the algorithm @@ -2604,7 +2602,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): 0.490319232466314 sage: a.agm(b, algorithm="principal").abs() 0.338446122230459 - sage: a.agm(b, algorithm="pari").abs() + sage: a.agm(b, algorithm="pari").abs() # optional - sage.libs.pari 0.490319232466314 TESTS: @@ -2871,17 +2869,17 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: sage: i = ComplexField(30).0 - sage: (1+i).gamma() + sage: (1 + i).gamma() # optional - sage.libs.pari 0.49801567 - 0.15494983*I TESTS:: - sage: CC(0).gamma() + sage: CC(0).gamma() # optional - sage.libs.pari Infinity :: - sage: CC(-1).gamma() + sage: CC(-1).gamma() # optional - sage.libs.pari Infinity """ try: @@ -2898,13 +2896,13 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: sage: C, i = ComplexField(30).objgen() - sage: (1+i).gamma_inc(2 + 3*i) # abs tol 2e-10 + sage: (1+i).gamma_inc(2 + 3*i) # abs tol 2e-10 # optional - sage.libs.pari 0.0020969149 - 0.059981914*I - sage: (1+i).gamma_inc(5) + sage: (1+i).gamma_inc(5) # optional - sage.libs.pari -0.0013781309 + 0.0065198200*I - sage: C(2).gamma_inc(1 + i) + sage: C(2).gamma_inc(1 + i) # optional - sage.libs.pari 0.70709210 - 0.42035364*I - sage: CC(2).gamma_inc(5) + sage: CC(2).gamma_inc(5) # optional - sage.libs.pari 0.0404276819945128 TESTS: @@ -2912,7 +2910,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): Check that :trac:`7099` is fixed:: sage: C = ComplexField(400) - sage: C(2 + I).gamma_inc(C(3 + I)) # abs tol 1e-120 + sage: C(2 + I).gamma_inc(C(3 + I)) # abs tol 1e-120 # optional - sage.libs.pari 0.121515644664508695525971545977439666159749344176962379708992904126499444842886620664991650378432544392118359044438541515 + 0.101533909079826033296475736021224621546966200987295663190553587086145836461236284668967411665020429964946098113930918850*I """ @@ -3246,9 +3244,9 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): sage: i = ComplexField(30).gen() sage: z = 1 + i - sage: z.zeta() + sage: z.zeta() # optional - sage.libs.pari 0.58215806 - 0.92684856*I - sage: zeta(z) + sage: zeta(z) # optional - sage.libs.pari 0.58215806 - 0.92684856*I sage: CC(1).zeta() From f768cb0d45cf6d446abd975ea958a94e896bd955 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 7 Jun 2023 17:57:55 -0700 Subject: [PATCH 304/423] sage.rings: More # optional --- src/sage/rings/abc.pyx | 8 +-- src/sage/rings/complex_double.pyx | 54 +++++++++---------- src/sage/rings/complex_mpfr.pyx | 46 ++++++++-------- src/sage/rings/continued_fraction.py | 2 +- src/sage/rings/laurent_series_ring.py | 4 +- .../rings/laurent_series_ring_element.pyx | 8 +-- src/sage/rings/puiseux_series_ring.py | 4 +- 7 files changed, 63 insertions(+), 63 deletions(-) diff --git a/src/sage/rings/abc.pyx b/src/sage/rings/abc.pyx index d967cfbb95c..d62d23f7645 100644 --- a/src/sage/rings/abc.pyx +++ b/src/sage/rings/abc.pyx @@ -202,12 +202,12 @@ class RealBallField(Field): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(RBF, sage.rings.abc.RealBallField) + sage: isinstance(RBF, sage.rings.abc.RealBallField) # optional - sage.libs.flint True By design, there is a unique direct subclass:: - sage: sage.rings.abc.RealBallField.__subclasses__() + sage: sage.rings.abc.RealBallField.__subclasses__() # optional - sage.libs.flint [] sage: len(sage.rings.abc.RealBallField.__subclasses__()) <= 1 @@ -302,12 +302,12 @@ class ComplexBallField(Field): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(CBF, sage.rings.abc.ComplexBallField) + sage: isinstance(CBF, sage.rings.abc.ComplexBallField) # optional - sage.libs.flint True By design, there is a unique direct subclass:: - sage: sage.rings.abc.ComplexBallField.__subclasses__() + sage: sage.rings.abc.ComplexBallField.__subclasses__() # optional - sage.libs.flint [] sage: len(sage.rings.abc.ComplexBallField.__subclasses__()) <= 1 diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx index 132ae733eb9..1e679393c80 100644 --- a/src/sage/rings/complex_double.pyx +++ b/src/sage/rings/complex_double.pyx @@ -1145,13 +1145,13 @@ cdef class ComplexDoubleElement(FieldElement): EXAMPLES:: - sage: CDF(1,2).__pari__() + sage: CDF(1,2).__pari__() # optional - sage.libs.pari 1.00000000000000 + 2.00000000000000*I - sage: pari(CDF(1,2)) + sage: pari(CDF(1,2)) # optional - sage.libs.pari 1.00000000000000 + 2.00000000000000*I - sage: pari(CDF(2.0)) + sage: pari(CDF(2.0)) # optional - sage.libs.pari 2.00000000000000 - sage: pari(CDF(I)) + sage: pari(CDF(I)) # optional - sage.libs.pari 1.00000000000000*I """ global new_gen_from_complex_double_element @@ -2194,30 +2194,30 @@ cdef class ComplexDoubleElement(FieldElement): We compute a few values of :meth:`eta()`:: - sage: CDF(0,1).eta() + sage: CDF(0,1).eta() # optional - sage.libs.pari 0.7682254223260566 - sage: CDF(1,1).eta() + sage: CDF(1,1).eta() # optional - sage.libs.pari 0.7420487758365647 + 0.1988313702299107*I - sage: CDF(25,1).eta() + sage: CDF(25,1).eta() # optional - sage.libs.pari 0.7420487758365647 + 0.1988313702299107*I :meth:`eta()` works even if the inputs are large:: sage: CDF(0, 10^15).eta() 0.0 - sage: CDF(10^15, 0.1).eta() # abs tol 1e-10 + sage: CDF(10^15, 0.1).eta() # abs tol 1e-10 # optional - sage.libs.pari -0.115342592727 - 0.19977923088*I We compute a few values of :meth:`eta()`, but with the fractional power of `e` omitted:: - sage: CDF(0,1).eta(True) + sage: CDF(0,1).eta(True) # optional - sage.libs.pari 0.9981290699259585 We compute :meth:`eta()` to low precision directly from the definition:: - sage: z = CDF(1,1); z.eta() + sage: z = CDF(1,1); z.eta() # optional - sage.libs.pari 0.7420487758365647 + 0.1988313702299107*I sage: i = CDF(0,1); pi = CDF(pi) sage: exp(pi * i * z / 12) * prod([1-exp(2*pi*i*n*z) for n in range(1,10)]) @@ -2225,7 +2225,7 @@ cdef class ComplexDoubleElement(FieldElement): The optional argument allows us to omit the fractional part:: - sage: z.eta(omit_frac=True) + sage: z.eta(omit_frac=True) # optional - sage.libs.pari 0.9981290699259585 sage: pi = CDF(pi) sage: prod([1-exp(2*pi*i*n*z) for n in range(1,10)]) # abs tol 1e-12 @@ -2242,7 +2242,7 @@ cdef class ComplexDoubleElement(FieldElement): You can also use functional notation:: sage: z = CDF(1,1) - sage: eta(z) + sage: eta(z) # optional - sage.libs.pari 0.7420487758365647 + 0.1988313702299107*I """ if GSL_IMAG(self._complex) <= 0: @@ -2372,9 +2372,9 @@ cdef class ComplexDoubleElement(FieldElement): EXAMPLES:: - sage: CDF(1,2).dilog() + sage: CDF(1,2).dilog() # optional - sage.libs.pari -0.059474798673809476 + 2.0726479717747566*I - sage: CDF(10000000,10000000).dilog() + sage: CDF(10000000,10000000).dilog() # optional - sage.libs.pari -134.411774490731 + 38.79396299904504*I """ global complex_double_element_dilog @@ -2389,13 +2389,13 @@ cdef class ComplexDoubleElement(FieldElement): EXAMPLES:: - sage: CDF(5,0).gamma() + sage: CDF(5,0).gamma() # optional - sage.libs.pari 24.0 - sage: CDF(1,1).gamma() + sage: CDF(1,1).gamma() # optional - sage.libs.pari 0.49801566811835607 - 0.15494982830181067*I - sage: CDF(0).gamma() + sage: CDF(0).gamma() # optional - sage.libs.pari Infinity - sage: CDF(-1,0).gamma() + sage: CDF(-1,0).gamma() # optional - sage.libs.pari Infinity """ if not GSL_IMAG(self._complex): @@ -2420,11 +2420,11 @@ cdef class ComplexDoubleElement(FieldElement): EXAMPLES:: - sage: CDF(1,1).gamma_inc(CDF(2,3)) + sage: CDF(1,1).gamma_inc(CDF(2,3)) # optional - sage.libs.pari 0.0020969148636468277 - 0.059981913655449706*I - sage: CDF(1,1).gamma_inc(5) + sage: CDF(1,1).gamma_inc(5) # optional - sage.libs.pari -0.001378130936215849 + 0.006519820023119819*I - sage: CDF(2,0).gamma_inc(CDF(1,1)) + sage: CDF(2,0).gamma_inc(CDF(1,1)) # optional - sage.libs.pari 0.7070920963459381 - 0.4203536409598115*I """ global complex_double_element_gamma_inc @@ -2439,11 +2439,11 @@ cdef class ComplexDoubleElement(FieldElement): EXAMPLES:: sage: z = CDF(1, 1) - sage: z.zeta() + sage: z.zeta() # optional - sage.libs.pari 0.5821580597520036 - 0.9268485643308071*I - sage: zeta(z) + sage: zeta(z) # optional - sage.libs.pari 0.5821580597520036 - 0.9268485643308071*I - sage: zeta(CDF(1)) + sage: zeta(CDF(1)) # optional - sage.libs.pari Infinity """ if GSL_REAL(self._complex) == 1 and GSL_IMAG(self._complex) == 0: @@ -2469,16 +2469,16 @@ cdef class ComplexDoubleElement(FieldElement): sage: z = (1/2)*(1 + RDF(sqrt(3)) *CDF.0); z # abs tol 1e-16 0.5 + 0.8660254037844387*I - sage: p = z.algdep(5); p + sage: p = z.algdep(5); p # optional - sage.libs.pari sage.symbolic x^2 - x + 1 sage: abs(z^2 - z + 1) < 1e-14 True :: - sage: CDF(0,2).algdep(10) + sage: CDF(0,2).algdep(10) # optional - sage.libs.pari x^2 + 4 - sage: CDF(1,5).algdep(2) + sage: CDF(1,5).algdep(2) # optional - sage.libs.pari x^2 - 2*x + 26 """ from sage.arith.misc import algdep diff --git a/src/sage/rings/complex_mpfr.pyx b/src/sage/rings/complex_mpfr.pyx index 4551a330989..236df6a6b2e 100644 --- a/src/sage/rings/complex_mpfr.pyx +++ b/src/sage/rings/complex_mpfr.pyx @@ -2111,7 +2111,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: (1+CC(I)).arccos() + sage: (1+CC(I)).arccos() # optional - sage.libs.pari 0.904556894302381 - 1.06127506190504*I """ return self._parent(self.__pari__().acos()) @@ -2122,7 +2122,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: (1+CC(I)).arccosh() + sage: (1+CC(I)).arccosh() # optional - sage.libs.pari 1.06127506190504 + 0.904556894302381*I """ return self._parent(self.__pari__().acosh()) @@ -2133,7 +2133,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: (1+CC(I)).arcsin() + sage: (1+CC(I)).arcsin() # optional - sage.libs.pari 0.666239432492515 + 1.06127506190504*I """ return self._parent(self.__pari__().asin()) @@ -2144,7 +2144,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: (1+CC(I)).arcsinh() + sage: (1+CC(I)).arcsinh() # optional - sage.libs.pari 1.06127506190504 + 0.666239432492515*I """ return self._parent(self.__pari__().asinh()) @@ -2155,7 +2155,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: (1+CC(I)).arctan() + sage: (1+CC(I)).arctan() # optional - sage.libs.pari 1.01722196789785 + 0.402359478108525*I """ return self._parent(self.__pari__().atan()) @@ -2166,7 +2166,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: (1+CC(I)).arctanh() + sage: (1+CC(I)).arctanh() # optional - sage.libs.pari 0.402359478108525 + 1.01722196789785*I """ return self._parent(self.__pari__().atanh()) @@ -2177,7 +2177,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: ComplexField(100)(1,1).coth() + sage: ComplexField(100)(1,1).coth() # optional - sage.libs.pari 0.86801414289592494863584920892 - 0.21762156185440268136513424361*I """ return ~(self.tanh()) @@ -2188,7 +2188,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: ComplexField(100)(1,1).arccoth() + sage: ComplexField(100)(1,1).arccoth() # optional - sage.libs.pari 0.40235947810852509365018983331 - 0.55357435889704525150853273009*I """ return (~self).arctanh() @@ -2199,7 +2199,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: ComplexField(100)(1,1).csc() + sage: ComplexField(100)(1,1).csc() # optional - sage.libs.pari 0.62151801717042842123490780586 - 0.30393100162842645033448560451*I """ return ~(self.sin()) @@ -2210,7 +2210,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: ComplexField(100)(1,1).csch() + sage: ComplexField(100)(1,1).csch() # optional - sage.libs.pari 0.30393100162842645033448560451 - 0.62151801717042842123490780586*I """ return ~(self.sinh()) @@ -2221,7 +2221,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: ComplexField(100)(1,1).arccsch() + sage: ComplexField(100)(1,1).arccsch() # optional - sage.libs.pari 0.53063753095251782601650945811 - 0.45227844715119068206365839783*I """ return (~self).arcsinh() @@ -2232,7 +2232,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: ComplexField(100)(1,1).sec() + sage: ComplexField(100)(1,1).sec() # optional - sage.libs.pari 0.49833703055518678521380589177 + 0.59108384172104504805039169297*I """ return ~(self.cos()) @@ -2243,7 +2243,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: ComplexField(100)(1,1).sech() + sage: ComplexField(100)(1,1).sech() # optional - sage.libs.pari 0.49833703055518678521380589177 - 0.59108384172104504805039169297*I """ return ~(self.cosh()) @@ -2254,7 +2254,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: ComplexField(100)(1,1).arcsech() + sage: ComplexField(100)(1,1).arcsech() # optional - sage.libs.pari 0.53063753095251782601650945811 - 1.1185178796437059371676632938*I """ return (~self).arccosh() @@ -2265,13 +2265,13 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: (1+CC(I)).cot() + sage: (1+CC(I)).cot() # optional - sage.libs.pari 0.217621561854403 - 0.868014142895925*I - sage: i = ComplexField(200).0 - sage: (1+i).cot() + sage: i = ComplexField(200).0 # optional - sage.libs.pari + sage: (1+i).cot() # optional - sage.libs.pari 0.21762156185440268136513424360523807352075436916785404091068 - 0.86801414289592494863584920891627388827343874994609327121115*I - sage: i = ComplexField(220).0 - sage: (1+i).cot() + sage: i = ComplexField(220).0 # optional - sage.libs.pari + sage: (1+i).cot() # optional - sage.libs.pari 0.21762156185440268136513424360523807352075436916785404091068124239 - 0.86801414289592494863584920891627388827343874994609327121115071646*I TESTS: @@ -2596,7 +2596,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): -0.371591652351761 + 0.319894660206830*I sage: a.agm(b, algorithm="principal") 0.338175462986180 - 0.0135326969565405*I - sage: a.agm(b, algorithm="pari") + sage: a.agm(b, algorithm="pari") # optional - sage.libs.pari -0.371591652351761 + 0.319894660206830*I sage: a.agm(b, algorithm="optimal").abs() 0.490319232466314 @@ -2819,7 +2819,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: sage: a = ComplexNumber(1,0) - sage: a.dilog() + sage: a.dilog() # optional - sage.libs.pari 1.64493406684823 sage: float(pi^2/6) # optional - sage.symbolic 1.6449340668482262 @@ -2827,13 +2827,13 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): :: sage: b = ComplexNumber(0,1) - sage: b.dilog() + sage: b.dilog() # optional - sage.libs.pari -0.205616758356028 + 0.915965594177219*I :: sage: c = ComplexNumber(0,0) - sage: c.dilog() + sage: c.dilog() # optional - sage.libs.pari 0.000000000000000 """ return self._parent(self.__pari__().dilog()) diff --git a/src/sage/rings/continued_fraction.py b/src/sage/rings/continued_fraction.py index c5298a34ae4..696a99753bb 100644 --- a/src/sage/rings/continued_fraction.py +++ b/src/sage/rings/continued_fraction.py @@ -1744,7 +1744,7 @@ def __neg__(self): sage: quots2 = [((),(1,)), ((), (1,2)), ((0,),(1,)), ....: ((),(2,1)), ((3,),(2,1))] - sage: for q in quots2: + sage: for q in quots2: # optional - sage.rings.number_field ....: cf = continued_fraction(q) ....: ncf = -cf ....: nncf = -ncf diff --git a/src/sage/rings/laurent_series_ring.py b/src/sage/rings/laurent_series_ring.py index e2a5c524cfe..46c86bf378d 100644 --- a/src/sage/rings/laurent_series_ring.py +++ b/src/sage/rings/laurent_series_ring.py @@ -442,8 +442,8 @@ def _element_constructor_(self, x, n=0, prec=infinity): Check that :trac:`28993` is fixed:: - sage: from sage.modular.etaproducts import qexp_eta - sage: qexp_eta(S, prec=30) + sage: from sage.modular.etaproducts import qexp_eta # optional - sage.modular + sage: qexp_eta(S, prec=30) # optional - sage.modular 1 - t - t^2 + t^5 + t^7 - t^12 - t^15 + t^22 + t^26 + O(t^30) When converting from `R((z))` to `R((z))((w))`, the variable diff --git a/src/sage/rings/laurent_series_ring_element.pyx b/src/sage/rings/laurent_series_ring_element.pyx index 8e950478045..fa08abe8d99 100644 --- a/src/sage/rings/laurent_series_ring_element.pyx +++ b/src/sage/rings/laurent_series_ring_element.pyx @@ -1701,11 +1701,11 @@ cdef class LaurentSeries(AlgebraElement): sage: (x^-2 + 1 + x).nth_root(2)**2 x^-2 + 1 + x + O(x^18) - sage: j = j_invariant_qexp() - sage: q = j.parent().gen() - sage: j(q^3).nth_root(3) + sage: j = j_invariant_qexp() # optional - sage.modular + sage: q = j.parent().gen() # optional - sage.modular + sage: j(q^3).nth_root(3) # optional - sage.modular q^-1 + 248*q^2 + 4124*q^5 + ... + O(q^29) - sage: (j(q^2) - 1728).nth_root(2) + sage: (j(q^2) - 1728).nth_root(2) # optional - sage.modular q^-1 - 492*q - 22590*q^3 - ... + O(q^19) """ if prec is None: diff --git a/src/sage/rings/puiseux_series_ring.py b/src/sage/rings/puiseux_series_ring.py index 27a91d6a187..fdad0caef39 100644 --- a/src/sage/rings/puiseux_series_ring.py +++ b/src/sage/rings/puiseux_series_ring.py @@ -302,8 +302,8 @@ def _element_constructor_(self, x, e=1, prec=infinity): sage: P(z) + y**(1/2) 3 + y^(1/2) + 2*y + y^2 + 2*y^3 + O(y^5) - sage: from sage.modular.etaproducts import qexp_eta - sage: y^(1/24)*qexp_eta(P, prec=30) + sage: from sage.modular.etaproducts import qexp_eta # optional - sage.modular + sage: y^(1/24)*qexp_eta(P, prec=30) # optional - sage.modular y^(1/24) - y^(25/24) - y^(49/24) + y^(121/24) + y^(169/24) - y^(289/24) - y^(361/24) + y^(529/24) + y^(625/24) + O(y^(721/24)) """ P = parent(x) From bee4da57cf80ab5f4c1c7ca3ff864cf1ede20b9b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 9 Jun 2023 00:55:41 -0700 Subject: [PATCH 305/423] More # optional --- src/sage/rings/real_lazy.pyx | 1 + src/sage/rings/ring_extension_element.pyx | 4 ++-- src/sage/rings/semirings/tropical_semiring.pyx | 14 +++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/sage/rings/real_lazy.pyx b/src/sage/rings/real_lazy.pyx index b6ff3f64015..9fd6d547625 100644 --- a/src/sage/rings/real_lazy.pyx +++ b/src/sage/rings/real_lazy.pyx @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.rings.real_mpfr """ Lazy real and complex numbers diff --git a/src/sage/rings/ring_extension_element.pyx b/src/sage/rings/ring_extension_element.pyx index d2ca2bec4a3..98539da208f 100644 --- a/src/sage/rings/ring_extension_element.pyx +++ b/src/sage/rings/ring_extension_element.pyx @@ -553,9 +553,9 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): sage: A. = PolynomialRing(QQ) sage: E = A.over(QQ) - sage: E(x^2+1).is_prime() + sage: E(x^2 + 1).is_prime() # optional - sage.libs.pari True - sage: E(x^2-1).is_prime() + sage: E(x^2 - 1).is_prime() # optional - sage.libs.pari False """ return self._backend.is_prime() diff --git a/src/sage/rings/semirings/tropical_semiring.pyx b/src/sage/rings/semirings/tropical_semiring.pyx index 5beff3cff55..19d2fc1cde2 100644 --- a/src/sage/rings/semirings/tropical_semiring.pyx +++ b/src/sage/rings/semirings/tropical_semiring.pyx @@ -555,9 +555,9 @@ class TropicalSemiring(Parent, UniqueRepresentation): EXAMPLES:: - sage: TR = TropicalSemiring(RR) - sage: T60 = TropicalSemiring(RealField(60)) - sage: TR.has_coerce_map_from(T60) + sage: TR = TropicalSemiring(RR) # optional - sage.rings.real_mpfr + sage: T60 = TropicalSemiring(RealField(60)) # optional - sage.rings.real_mpfr + sage: TR.has_coerce_map_from(T60) # optional - sage.rings.real_mpfr True sage: TQ = TropicalSemiring(QQ) sage: TQ.has_coerce_map_from(TropicalSemiring(ZZ)) @@ -570,15 +570,15 @@ class TropicalSemiring(Parent, UniqueRepresentation): True sage: TR.has_coerce_map_from(float) False - sage: TR.has_coerce_map_from(RR) + sage: TR.has_coerce_map_from(RR) # optional - sage.rings.real_mpfr False sage: TR.has_coerce_map_from(QQ) False - sage: TR.coerce_map_from(T60)(T60(2)) + sage: TR.coerce_map_from(T60)(T60(2)) # optional - sage.rings.real_mpfr 2.00000000000000 - sage: TR.coerce(T60(3.4)) + sage: TR.coerce(T60(3.4)) # optional - sage.rings.real_mpfr 3.40000000000000 - sage: TR.coerce(T60.infinity()) + sage: TR.coerce(T60.infinity()) # optional - sage.rings.real_mpfr +infinity sage: TQ.coerce(TR(3.4)) Traceback (most recent call last): From c19447c89eaa324fbf5a9ec20d6a2f0718231107 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 10 Jun 2023 17:49:30 -0700 Subject: [PATCH 306/423] More # optional --- src/sage/rings/lazy_series.py | 10 +++++----- src/sage/rings/quotient_ring_element.py | 8 ++++---- src/sage/rings/semirings/tropical_semiring.pyx | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/sage/rings/lazy_series.py b/src/sage/rings/lazy_series.py index 8698af54927..cf9c4f9cb20 100644 --- a/src/sage/rings/lazy_series.py +++ b/src/sage/rings/lazy_series.py @@ -3113,7 +3113,7 @@ def _div_(self, other): An example over the ring of symmetric functions:: - sage: e = SymmetricFunctions(QQ).e() + sage: e = SymmetricFunctions(QQ).e() # optional - sage.modules sage: R. = LazyLaurentSeriesRing(e) # optional - sage.modules sage: 1 / (1 - e[1]*z) # optional - sage.modules e[] + e[1]*z + e[1, 1]*z^2 + e[1, 1, 1]*z^3 + e[1, 1, 1, 1]*z^4 @@ -5829,7 +5829,7 @@ def derivative_with_respect_to_p1(self, n=1): orderings satisfy the relationship `C' = L`:: sage: p = SymmetricFunctions(QQ).p() # optional - sage.modules - sage: C = T(lambda n: (sum(euler_phi(k)*p([k])**(n//k) + sage: C = T(lambda n: (sum(euler_phi(k)*p([k])**(n//k) # optional - sage.modules ....: for k in divisors(n))/n if n > 0 else 0)) sage: L = T(lambda n: p([1]*n)) # optional - sage.modules sage: L - C.derivative_with_respect_to_p1() # optional - sage.modules @@ -6339,7 +6339,7 @@ class LazyDirichletSeries(LazyModuleElement): sage: f = L(constant=1)^2 sage: f # optional - sage.symbolic 1 + 2/2^z + 2/3^z + 3/4^z + 2/5^z + 4/6^z + 2/7^z + O(1/(8^z)) - sage: f.coefficient(100) == number_of_divisors(100) + sage: f.coefficient(100) == number_of_divisors(100) # optional - sage.libs.pari True Lazy Dirichlet series is picklable:: @@ -6385,9 +6385,9 @@ def valuation(self): EXAMPLES:: sage: L = LazyDirichletSeriesRing(ZZ, "z") - sage: mu = L(moebius); mu.valuation() + sage: mu = L(moebius); mu.valuation() # optional - sage.libs.pari 0 - sage: (mu - mu).valuation() + sage: (mu - mu).valuation() # optional - sage.libs.pari +Infinity sage: g = L(constant=1, valuation=2) sage: g.valuation() diff --git a/src/sage/rings/quotient_ring_element.py b/src/sage/rings/quotient_ring_element.py index 27ceb3ceaf9..8ef6d665a29 100644 --- a/src/sage/rings/quotient_ring_element.py +++ b/src/sage/rings/quotient_ring_element.py @@ -644,10 +644,10 @@ def _richcmp_(self, other, op): See :trac:`7797`:: - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat - sage: Q = F.quo(I) # optional - sage.combinat sage.libs.singular - sage: Q.0^4 # indirect doctest # optional - sage.combinat sage.libs.singular + sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.libs.singular sage.modules + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.libs.singular sage.modules + sage: Q = F.quo(I) # optional - sage.combinat sage.libs.singular sage.modules + sage: Q.0^4 # indirect doctest # optional - sage.combinat sage.libs.singular sage.modules ybar*zbar*zbar*xbar + ybar*zbar*zbar*ybar + ybar*zbar*zbar*zbar The issue from :trac:`8005` was most likely fixed as part of diff --git a/src/sage/rings/semirings/tropical_semiring.pyx b/src/sage/rings/semirings/tropical_semiring.pyx index 19d2fc1cde2..519f3213bd6 100644 --- a/src/sage/rings/semirings/tropical_semiring.pyx +++ b/src/sage/rings/semirings/tropical_semiring.pyx @@ -562,17 +562,17 @@ class TropicalSemiring(Parent, UniqueRepresentation): sage: TQ = TropicalSemiring(QQ) sage: TQ.has_coerce_map_from(TropicalSemiring(ZZ)) True - sage: TR.has_coerce_map_from(TR) + sage: TR.has_coerce_map_from(TR) # optional - sage.rings.real_mpfr True sage: TQ.has_coerce_map_from(TQ) True - sage: TR.has_coerce_map_from(TQ) + sage: TR.has_coerce_map_from(TQ) # optional - sage.rings.real_mpfr True - sage: TR.has_coerce_map_from(float) + sage: TR.has_coerce_map_from(float) # optional - sage.rings.real_mpfr False sage: TR.has_coerce_map_from(RR) # optional - sage.rings.real_mpfr False - sage: TR.has_coerce_map_from(QQ) + sage: TR.has_coerce_map_from(QQ) # optional - sage.rings.real_mpfr False sage: TR.coerce_map_from(T60)(T60(2)) # optional - sage.rings.real_mpfr 2.00000000000000 @@ -580,7 +580,7 @@ class TropicalSemiring(Parent, UniqueRepresentation): 3.40000000000000 sage: TR.coerce(T60.infinity()) # optional - sage.rings.real_mpfr +infinity - sage: TQ.coerce(TR(3.4)) + sage: TQ.coerce(TR(3.4)) # optional - sage.rings.real_mpfr Traceback (most recent call last): ... TypeError: no canonical coercion from Tropical semiring over From c476af4ff49eabe388187dd22888816cf71622f3 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 11 Jun 2023 00:23:10 -0700 Subject: [PATCH 307/423] src/sage/rings/integer_ring.pyx: Docstring cosmetics --- src/sage/rings/integer_ring.pyx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sage/rings/integer_ring.pyx b/src/sage/rings/integer_ring.pyx index b4046098436..c7eb8b053cc 100644 --- a/src/sage/rings/integer_ring.pyx +++ b/src/sage/rings/integer_ring.pyx @@ -600,10 +600,11 @@ cdef class IntegerRing_class(PrincipalIdealDomain): - ``x``, ``y`` integers -- bounds for the result. - ``distribution``-- a string: - - ``'uniform'`` - - ``'mpz_rrandomb'`` - - ``'1/n'`` - - ``'gaussian'`` + + - ``'uniform'`` + - ``'mpz_rrandomb'`` + - ``'1/n'`` + - ``'gaussian'`` OUTPUT: From 31bc15e7ce544fcbecce09fabea93d9fb6e15a36 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 11 Jun 2023 10:48:25 -0700 Subject: [PATCH 308/423] sage.rings: More # optional --- src/sage/rings/complex_mpfr.pyx | 12 ++++++------ src/sage/rings/fraction_field_element.pyx | 8 ++++---- src/sage/rings/localization.py | 6 +++--- src/sage/rings/rational.pyx | 16 ++++++++-------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/sage/rings/complex_mpfr.pyx b/src/sage/rings/complex_mpfr.pyx index 236df6a6b2e..64e3fe9cf3c 100644 --- a/src/sage/rings/complex_mpfr.pyx +++ b/src/sage/rings/complex_mpfr.pyx @@ -849,17 +849,17 @@ class ComplexField_class(sage.rings.abc.ComplexField): sage: k = ComplexField(100) sage: R. = k[] - sage: k._factor_univariate_polynomial( x ) + sage: k._factor_univariate_polynomial( x ) # optional - sage.libs.pari x - sage: k._factor_univariate_polynomial( 2*x ) + sage: k._factor_univariate_polynomial( 2*x ) # optional - sage.libs.pari (2.0000000000000000000000000000) * x - sage: k._factor_univariate_polynomial( x^2 ) + sage: k._factor_univariate_polynomial( x^2 ) # optional - sage.libs.pari x^2 - sage: k._factor_univariate_polynomial( x^2 + 3 ) + sage: k._factor_univariate_polynomial( x^2 + 3 ) # optional - sage.libs.pari (x - 1.7320508075688772935274463415*I) * (x + 1.7320508075688772935274463415*I) - sage: k._factor_univariate_polynomial( x^2 + 1 ) + sage: k._factor_univariate_polynomial( x^2 + 1 ) # optional - sage.libs.pari (x - I) * (x + I) - sage: k._factor_univariate_polynomial( k(I) * (x^2 + 1) ) + sage: k._factor_univariate_polynomial( k(I) * (x^2 + 1) ) # optional - sage.libs.pari (1.0000000000000000000000000000*I) * (x - I) * (x + I) """ diff --git a/src/sage/rings/fraction_field_element.pyx b/src/sage/rings/fraction_field_element.pyx index 11a2b646d35..368162e9119 100644 --- a/src/sage/rings/fraction_field_element.pyx +++ b/src/sage/rings/fraction_field_element.pyx @@ -857,15 +857,15 @@ cdef class FractionFieldElement(FieldElement): sage: x,y = FR.gens() sage: a = x^2; a x^2 - sage: type(a.numerator()) + sage: type(a.numerator()) # optional - sage.lings.singular - sage: type(a.denominator()) + sage: type(a.denominator()) # optional - sage.lings.singular sage: a = x^(-2); a 1/x^2 - sage: type(a.numerator()) + sage: type(a.numerator()) # optional - sage.lings.singular - sage: type(a.denominator()) + sage: type(a.denominator()) # optional - sage.lings.singular sage: x^0 1 diff --git a/src/sage/rings/localization.py b/src/sage/rings/localization.py index 3062c9439d8..a0659202ac6 100644 --- a/src/sage/rings/localization.py +++ b/src/sage/rings/localization.py @@ -267,9 +267,9 @@ def __init__(self, parent, x): sage: from sage.rings.localization import LocalizationElement sage: P. = RR[] - sage: L = Localization(P, x**2+x+1) - sage: l = LocalizationElement(L, (x**2+1)/(x**2+x+1)) - sage: l._value == (x**2+1)/(x**2+x+1) + sage: L = Localization(P, x**2 + x + 1) # optional - sage.libs.pari + sage: l = LocalizationElement(L, (x**2+1)/(x**2+x+1)) # optional - sage.libs.pari + sage: l._value == (x**2+1)/(x**2+x+1) # optional - sage.libs.pari True """ IntegralDomainElement.__init__(self, parent) diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx index 313ace10d98..326bd258b06 100644 --- a/src/sage/rings/rational.pyx +++ b/src/sage/rings/rational.pyx @@ -3131,21 +3131,21 @@ cdef class Rational(sage.structure.element.FieldElement): 3*log(5)/log(3) sage: QQ(8).log(1/2) -3 - sage: (1/8).log(1/2) + sage: (1/8).log(1/2) # optional - sage.libs.pari 3 - sage: (1/2).log(1/8) + sage: (1/2).log(1/8) # optional - sage.libs.pari 1/3 - sage: (1/2).log(8) + sage: (1/2).log(8) # optional - sage.libs.pari -1/3 - sage: (16/81).log(8/27) + sage: (16/81).log(8/27) # optional - sage.libs.pari 4/3 - sage: (8/27).log(16/81) + sage: (8/27).log(16/81) # optional - sage.libs.pari 3/4 - sage: log(27/8, 16/81) + sage: log(27/8, 16/81) # optional - sage.libs.pari -3/4 - sage: log(16/81, 27/8) + sage: log(16/81, 27/8) # optional - sage.libs.pari -4/3 - sage: (125/8).log(5/2) + sage: (125/8).log(5/2) # optional - sage.libs.pari 3 sage: (125/8).log(5/2, prec=53) 3.00000000000000 From fa68888101ef0f96e2c3d9705e1480fd01afe72c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 11 Jun 2023 23:45:21 -0700 Subject: [PATCH 309/423] sage.rings: More # optional --- src/sage/rings/fraction_field.py | 8 +- src/sage/rings/fraction_field_element.pyx | 6 +- src/sage/rings/infinity.py | 4 +- src/sage/rings/integer_ring.pyx | 6 +- src/sage/rings/lazy_series_ring.py | 19 ++-- .../rings/multi_power_series_ring_element.py | 4 +- src/sage/rings/quotient_ring.py | 101 +++++++++--------- src/sage/rings/rational_field.py | 8 +- src/sage/rings/real_double.pyx | 18 ++-- src/sage/rings/ring.pyx | 6 +- 10 files changed, 91 insertions(+), 89 deletions(-) diff --git a/src/sage/rings/fraction_field.py b/src/sage/rings/fraction_field.py index 1aff655bed8..15691eabe39 100644 --- a/src/sage/rings/fraction_field.py +++ b/src/sage/rings/fraction_field.py @@ -314,13 +314,13 @@ def _coerce_map_from_(self, S): Coercion from a localization:: sage: R. = ZZ[] - sage: L = Localization(R, (x**2 + 1,7)) - sage: F = L.fraction_field() - sage: f = F.coerce_map_from(L); f + sage: L = Localization(R, (x**2 + 1,7)) # optional - sage.libs.pari + sage: F = L.fraction_field() # optional - sage.libs.pari + sage: f = F.coerce_map_from(L); f # optional - sage.libs.pari Coercion map: From: Univariate Polynomial Ring in x over Integer Ring localized at (7, x^2 + 1) To: Fraction Field of Univariate Polynomial Ring in x over Integer Ring - sage: f(L(1/7)) == 1/7 + sage: f(L(1/7)) == 1/7 # optional - sage.libs.pari True """ from sage.rings.rational_field import QQ diff --git a/src/sage/rings/fraction_field_element.pyx b/src/sage/rings/fraction_field_element.pyx index 368162e9119..78b13455d56 100644 --- a/src/sage/rings/fraction_field_element.pyx +++ b/src/sage/rings/fraction_field_element.pyx @@ -173,10 +173,10 @@ cdef class FractionFieldElement(FieldElement): EXAMPLES:: - sage: R. = RealField(10)[] - sage: f = (x^2+2*x+1)/(x+1); f + sage: R. = RealField(10)[] # optional - sage.rings.real_mpfr + sage: f = (x^2+2*x+1)/(x+1); f # optional - sage.rings.real_mpfr (x^2 + 2.0*x + 1.0)/(x + 1.0) - sage: f.reduce(); f + sage: f.reduce(); f # optional - sage.rings.real_mpfr x + 1.0 TESTS: diff --git a/src/sage/rings/infinity.py b/src/sage/rings/infinity.py index d4cbe9372bb..4e3f27784a2 100644 --- a/src/sage/rings/infinity.py +++ b/src/sage/rings/infinity.py @@ -1769,8 +1769,8 @@ def test_comparison(ring): EXAMPLES:: sage: from sage.rings.infinity import test_comparison - sage: rings = [ZZ, QQ, RR, RealField(200), RDF, RLF, RIF] - sage: for R in rings: + sage: rings = [ZZ, QQ, RR, RealField(200), RDF, RLF, RIF] # optional - sage.rings.real_mpfr + sage: for R in rings: # optional - sage.rings.real_mpfr ....: print('testing {}'.format(R)) ....: test_comparison(R) testing Integer Ring diff --git a/src/sage/rings/integer_ring.pyx b/src/sage/rings/integer_ring.pyx index c7eb8b053cc..68933ce7fa5 100644 --- a/src/sage/rings/integer_ring.pyx +++ b/src/sage/rings/integer_ring.pyx @@ -719,7 +719,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain): We return a sample from a discrete Gaussian distribution:: - sage: ZZ.random_element(11.0, distribution="gaussian").parent() is ZZ + sage: ZZ.random_element(11.0, distribution="gaussian").parent() is ZZ # optional - sage.modules True TESTS: @@ -728,7 +728,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain): sage: ZZ.random_element(5, -5, distribution="1/n").parent() is ZZ True - sage: ZZ.random_element(5, -5, distribution="gaussian").parent() is ZZ + sage: ZZ.random_element(5, -5, distribution="gaussian").parent() is ZZ # optional - sage.modules True sage: ZZ.random_element(5, -5, distribution="mpz_rrandomb").parent() is ZZ True @@ -737,7 +737,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain): Traceback (most recent call last): ... TypeError: x must be > 0 - sage: ZZ.random_element(-10, -5, distribution="gaussian") + sage: ZZ.random_element(-10, -5, distribution="gaussian") # optional - sage.modules Traceback (most recent call last): ... TypeError: x must be > 0 diff --git a/src/sage/rings/lazy_series_ring.py b/src/sage/rings/lazy_series_ring.py index e1358b0704b..e105188d7fe 100644 --- a/src/sage/rings/lazy_series_ring.py +++ b/src/sage/rings/lazy_series_ring.py @@ -1197,7 +1197,7 @@ def __init__(self, base_ring, names, sparse=True, category=None): and Category of infinite sets sage: L = LazyLaurentSeriesRing(ZZ['x, y'], 't') - sage: TestSuite(L).run() + sage: TestSuite(L).run() # optional - sage.libs.singular sage: L.category() Category of infinite commutative no zero divisors algebras over (unique factorization domains and commutative algebras over @@ -1220,8 +1220,8 @@ def __init__(self, base_ring, names, sparse=True, category=None): (finite commutative rings and subquotients of monoids and quotients of semigroups and finite enumerated sets) - sage: E. = ExteriorAlgebra(QQ) - sage: L = LazyLaurentSeriesRing(E, 't') # not tested + sage: E. = ExteriorAlgebra(QQ) # optional - sage.modules + sage: L = LazyLaurentSeriesRing(E, 't') # not tested # optional - sage.modules sage: LazyLaurentSeriesRing.options._reset() # reset the options """ @@ -1603,7 +1603,7 @@ def euler(self): sage: P = 1 / phi; P 1 + q + 2*q^2 + 3*q^3 + 5*q^4 + 7*q^5 + 11*q^6 + O(q^7) - sage: P[:20] == [Partitions(n).cardinality() for n in range(20)] + sage: P[:20] == [Partitions(n).cardinality() for n in range(20)] # optional - sage.libs.flint True TESTS:: @@ -1937,11 +1937,11 @@ def _element_constructor_(self, x=None, valuation=None, constant=None, degree=No (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) + sage: L(f) # optional - sage.libs.singular 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) + sage: L(f) == (1 + aa + bb) / (1 + aa*bb + cc^3) # optional - sage.libs.singular True TESTS:: @@ -2743,10 +2743,10 @@ def __init__(self, base_ring, names, sparse=True, category=None): sage: LazyDirichletSeriesRing.options.halting_precision(12) sage: L = LazyDirichletSeriesRing(ZZ, 't') - sage: TestSuite(L).run() + sage: TestSuite(L).run() # optional - sage.symbolic sage: L = LazyDirichletSeriesRing(QQ, 't') - sage: TestSuite(L).run() + sage: TestSuite(L).run() # optional - sage.symbolic sage: LazyDirichletSeriesRing.options._reset() # reset the options @@ -2990,8 +2990,7 @@ def _monomial(self, c, n): EXAMPLES:: sage: L = LazyDirichletSeriesRing(ZZ, 'z') - sage: m = L._monomial(5, 3) - sage: m # optional - sage.symbolic + sage: m = L._monomial(5, 3); m # optional - sage.symbolic 5/3^z """ try: diff --git a/src/sage/rings/multi_power_series_ring_element.py b/src/sage/rings/multi_power_series_ring_element.py index 9aa3f6ea5a4..0251356ecd1 100644 --- a/src/sage/rings/multi_power_series_ring_element.py +++ b/src/sage/rings/multi_power_series_ring_element.py @@ -516,8 +516,8 @@ def _subs_formal(self, *x, **kwds): -2/33*z^3 - 1/5*z^5 sage: f(z,1) #indirect doctest -1/5 - 2/33*z + z^2 - z^5 - sage: RF = RealField(10) - sage: f(z,RF(1)) #indirect doctest + sage: RF = RealField(10) # optional - sage.rings.real_mpfr + sage: f(z, RF(1)) # indirect doctest # optional - sage.rings.real_mpfr -0.20 - 0.061*z + 1.0*z^2 - 0.00*z^3 - 0.00*z^4 - 1.0*z^5 sage: m = matrix(QQ,[[1,0,1],[0,2,1],[-1,0,0]]) diff --git a/src/sage/rings/quotient_ring.py b/src/sage/rings/quotient_ring.py index 178cae67a22..f90dcc6c9aa 100644 --- a/src/sage/rings/quotient_ring.py +++ b/src/sage/rings/quotient_ring.py @@ -84,17 +84,19 @@ easily:: sage: from itertools import product - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.modules - sage: Q3 = F.quo(F*[F.prod(m) for m in product(F.gens(), repeat=3)]*F) # optional - sage.combinat sage.modules - sage: Q3 # optional - sage.combinat sage.modules + sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.libs.singular sage.modules + sage: Q3 = F.quo(F*[F.prod(m) for m in product(F.gens(), repeat=3)]*F) # optional - sage.combinat sage.libs.singular sage.modules + sage: Q3 # optional - sage.combinat sage.libs.singular sage.modules Quotient of Free Associative Unital Algebra on 3 generators (x, y, z) - over Rational Field by the ideal (x*x*x, x*x*y, x*x*z, x*y*x, x*y*y, x*y*z, x*z*x, x*z*y, x*z*z, y*x*x, y*x*y, y*x*z, y*y*x, y*y*y, y*y*z, y*z*x, y*z*y, y*z*z, z*x*x, z*x*y, z*x*z, z*y*x, z*y*y, z*y*z, z*z*x, z*z*y, z*z*z) - sage: Q3.0*Q3.1 - Q3.1*Q3.0 # optional - sage.combinat sage.modules + over Rational Field by the ideal (x*x*x, x*x*y, x*x*z, x*y*x, x*y*y, x*y*z, + x*z*x, x*z*y, x*z*z, y*x*x, y*x*y, y*x*z, y*y*x, y*y*y, y*y*z, y*z*x, y*z*y, + y*z*z, z*x*x, z*x*y, z*x*z, z*y*x, z*y*y, z*y*z, z*z*x, z*z*y, z*z*z) + sage: Q3.0*Q3.1 - Q3.1*Q3.0 # optional - sage.combinat sage.libs.singular sage.modules xbar*ybar - ybar*xbar - sage: Q3.0*(Q3.1*Q3.2) - (Q3.1*Q3.2)*Q3.0 # optional - sage.combinat sage.modules + sage: Q3.0*(Q3.1*Q3.2) - (Q3.1*Q3.2)*Q3.0 # optional - sage.combinat sage.libs.singular sage.modules 0 - sage: Q2 = F.quo(F*[F.prod(m) for m in product(F.gens(), repeat=2)]*F) # optional - sage.combinat sage.modules - sage: Q2.is_commutative() # optional - sage.combinat sage.modules + sage: Q2 = F.quo(F*[F.prod(m) for m in product(F.gens(), repeat=2)]*F) # optional - sage.combinat sage.libs.singular sage.modules + sage: Q2.is_commutative() # optional - sage.combinat sage.libs.singular sage.modules True """ @@ -246,23 +248,23 @@ def QuotientRing(R, I, names=None, **kwds): Here is an example of the quotient of a free algebra by a twosided homogeneous ideal (see :trac:`7797`):: - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.modules - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.modules - sage: Q. = F.quo(I); Q # optional - sage.combinat sage.modules + sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.libs.singular sage.modules + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.libs.singular sage.modules + sage: Q. = F.quo(I); Q # optional - sage.combinat sage.libs.singular sage.modules Quotient of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field by the ideal (x*y + y*z, x*x + x*y - y*x - y*y) - sage: a*b # optional - sage.combinat sage.modules + sage: a*b # optional - sage.combinat sage.libs.singular sage.modules -b*c - sage: a^3 # optional - sage.combinat sage.modules + sage: a^3 # optional - sage.combinat sage.libs.singular sage.modules -b*c*a - b*c*b - b*c*c - sage: J = Q * [a^3 - b^3] * Q # optional - sage.combinat sage.modules - sage: R. = Q.quo(J); R # optional - sage.combinat sage.modules + sage: J = Q * [a^3 - b^3] * Q # optional - sage.combinat sage.libs.singular sage.modules + sage: R. = Q.quo(J); R # optional - sage.combinat sage.libs.singular sage.modules Quotient of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field by the ideal (-y*y*z - y*z*x - 2*y*z*z, x*y + y*z, x*x + x*y - y*x - y*y) - sage: i^3 # optional - sage.combinat sage.modules + sage: i^3 # optional - sage.combinat sage.libs.singular sage.modules -j*k*i - j*k*j - j*k*k - sage: j^3 # optional - sage.combinat sage.modules + sage: j^3 # optional - sage.combinat sage.libs.singular sage.modules -j*k*i - j*k*j - j*k*k Check that :trac:`5978` is fixed by if we quotient by the zero ideal `(0)` @@ -348,12 +350,12 @@ def is_QuotientRing(x): :: - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.modules - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.modules - sage: Q = F.quo(I) # optional - sage.combinat sage.modules - sage: is_QuotientRing(Q) # optional - sage.combinat sage.modules + sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.libs.singular sage.modules + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.libs.singular sage.modules + sage: Q = F.quo(I) # optional - sage.combinat sage.libs.singular sage.modules + sage: is_QuotientRing(Q) # optional - sage.combinat sage.libs.singular sage.modules True - sage: is_QuotientRing(F) # optional - sage.combinat sage.modules + sage: is_QuotientRing(F) # optional - sage.combinat sage.libs.singular sage.modules False """ return isinstance(x, QuotientRing_nc) @@ -376,26 +378,27 @@ class QuotientRing_nc(ring.Ring, sage.structure.parent_gens.ParentWithGens): Here is a quotient of a free algebra by a twosided homogeneous ideal:: - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.modules - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2]*F # optional - sage.combinat sage.modules - sage: Q. = F.quo(I); Q # optional - sage.combinat sage.modules + sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.libs.singular sage.modules + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2]*F # optional - sage.combinat sage.libs.singular sage.modules + sage: Q. = F.quo(I); Q # optional - sage.combinat sage.libs.singular sage.modules Quotient of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field by the ideal (x*y + y*z, x*x + x*y - y*x - y*y) - sage: a*b # optional - sage.combinat sage.modules + sage: a*b # optional - sage.combinat sage.libs.singular sage.modules -b*c - sage: a^3 # optional - sage.combinat sage.modules + sage: a^3 # optional - sage.combinat sage.libs.singular sage.modules -b*c*a - b*c*b - b*c*c A quotient of a quotient is just the quotient of the original top ring by the sum of two ideals:: - sage: J = Q * [a^3 - b^3] * Q # optional - sage.combinat sage.modules - sage: R. = Q.quo(J); R # optional - sage.combinat sage.modules - Quotient of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field + sage: J = Q * [a^3 - b^3] * Q # optional - sage.combinat sage.libs.singular sage.modules + sage: R. = Q.quo(J); R # optional - sage.combinat sage.libs.singular sage.modules + Quotient of + Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field by the ideal (-y*y*z - y*z*x - 2*y*z*z, x*y + y*z, x*x + x*y - y*x - y*y) - sage: i^3 # optional - sage.combinat sage.modules + sage: i^3 # optional - sage.combinat sage.libs.singular sage.modules -j*k*i - j*k*j - j*k*k - sage: j^3 # optional - sage.combinat sage.modules + sage: j^3 # optional - sage.combinat sage.libs.singular sage.modules -j*k*i - j*k*j - j*k*k For rings that *do* inherit from :class:`~sage.rings.ring.CommutativeRing`, @@ -449,15 +452,15 @@ def __init__(self, R, I, names, category=None): EXAMPLES:: - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.modules - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.modules - sage: Q. = F.quo(I); Q # optional - sage.combinat sage.modules + sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.libs.singular sage.modules + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.libs.singular sage.modules + sage: Q. = F.quo(I); Q # optional - sage.combinat sage.libs.singular sage.modules Quotient of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field by the ideal (x*y + y*z, x*x + x*y - y*x - y*y) - sage: a*b # optional - sage.combinat sage.modules + sage: a*b # optional - sage.combinat sage.libs.singular sage.modules -b*c - sage: a^3 # optional - sage.combinat sage.modules + sage: a^3 # optional - sage.combinat sage.libs.singular sage.modules -b*c*a - b*c*b - b*c*c """ @@ -504,10 +507,10 @@ def construction(self): sage: I = R.ideal([4 + 3*x + x^2, 1 + x^2]) sage: R.quotient_ring(I).construction() (QuotientFunctor, Univariate Polynomial Ring in x over Integer Ring) - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.modules - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.modules - sage: Q = F.quo(I) # optional - sage.combinat sage.modules - sage: Q.construction() # optional - sage.combinat sage.modules + sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.libs.singular sage.modules + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.libs.singular sage.modules + sage: Q = F.quo(I) # optional - sage.combinat sage.libs.singular sage.modules + sage: Q.construction() # optional - sage.combinat sage.libs.singular sage.modules (QuotientFunctor, Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field) @@ -589,19 +592,19 @@ def is_commutative(self): The non-commutative case is more interesting:: - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.modules - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.modules - sage: Q = F.quo(I) # optional - sage.combinat sage.modules - sage: Q.is_commutative() # optional - sage.combinat sage.modules + sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.libs.singular sage.modules + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.libs.singular sage.modules + sage: Q = F.quo(I) # optional - sage.combinat sage.libs.singular sage.modules + sage: Q.is_commutative() # optional - sage.combinat sage.libs.singular sage.modules False - sage: Q.1*Q.2 == Q.2*Q.1 # optional - sage.combinat sage.modules + sage: Q.1*Q.2 == Q.2*Q.1 # optional - sage.combinat sage.libs.singular sage.modules False In the next example, the generators apparently commute:: - sage: J = F * [x*y - y*x, x*z - z*x, y*z - z*y, x^3 - y^3] * F # optional - sage.combinat sage.modules - sage: R = F.quo(J) # optional - sage.combinat sage.modules - sage: R.is_commutative() # optional - sage.combinat sage.modules + sage: J = F * [x*y - y*x, x*z - z*x, y*z - z*y, x^3 - y^3] * F # optional - sage.combinat sage.libs.singular sage.modules + sage: R = F.quo(J) # optional - sage.combinat sage.libs.singular sage.modules + sage: R.is_commutative() # optional - sage.combinat sage.libs.singular sage.modules True """ diff --git a/src/sage/rings/rational_field.py b/src/sage/rings/rational_field.py index 6c7ba63c29f..5d74779c564 100644 --- a/src/sage/rings/rational_field.py +++ b/src/sage/rings/rational_field.py @@ -657,7 +657,7 @@ def places(self, all_complex=False, prec=None): EXAMPLES:: - sage: QQ.places() + sage: QQ.places() # optional - sage.rings.real_mpfr [Ring morphism: From: Rational Field To: Real Field with 53 bits of precision @@ -667,7 +667,7 @@ def places(self, all_complex=False, prec=None): From: Rational Field To: Real Double Field Defn: 1 |--> 1.0] - sage: QQ.places(prec=200, all_complex=True) + sage: QQ.places(prec=200, all_complex=True) # optional - sage.rings.real_mpfr [Ring morphism: From: Rational Field To: Complex Field with 200 bits of precision @@ -696,12 +696,12 @@ def complex_embedding(self, prec=53): EXAMPLES:: - sage: QQ.complex_embedding() + sage: QQ.complex_embedding() # optional - sage.rings.real_mpfr Ring morphism: From: Rational Field To: Complex Field with 53 bits of precision Defn: 1 |--> 1.00000000000000 - sage: QQ.complex_embedding(20) + sage: QQ.complex_embedding(20) # optional - sage.rings.real_mpfr Ring morphism: From: Rational Field To: Complex Field with 20 bits of precision diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index ec4af251254..11de275ce72 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -84,7 +84,7 @@ def is_RealDoubleField(x): use isinstance(..., sage.rings.abc.RealDoubleField) instead See https://github.com/sagemath/sage/issues/32610 for details. True - sage: is_RealDoubleField(RealField(53)) + sage: is_RealDoubleField(RealField(53)) # optional - sage.rings.real_mpfr False """ from sage.misc.superseded import deprecation @@ -128,15 +128,15 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): numbers and higher-precision ones, though of course there may be loss of precision:: - sage: a = RealField(200)(2).sqrt(); a + sage: a = RealField(200)(2).sqrt(); a # optional - sage.rings.real_mpfr 1.4142135623730950488016887242096980785696718753769480731767 - sage: b = RDF(a); b + sage: b = RDF(a); b # optional - sage.rings.real_mpfr 1.4142135623730951 - sage: a.parent()(b) + sage: a.parent()(b) # optional - sage.rings.real_mpfr 1.4142135623730951454746218587388284504413604736328125000000 - sage: a.parent()(b) == b + sage: a.parent()(b) == b # optional - sage.rings.real_mpfr True - sage: b == RR(a) + sage: b == RR(a) # optional - sage.rings.real_mpfr True TESTS:: @@ -446,7 +446,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): EXAMPLES:: - sage: RDF.to_prec(52) + sage: RDF.to_prec(52) # optional - sage.rings.real_mpfr Real Field with 52 bits of precision sage: RDF.to_prec(53) Real Double Field @@ -1167,8 +1167,8 @@ cdef class RealDoubleElement(FieldElement): sage: RDF(2.1)._im_gens_(RR, [RR(1)]) 2.10000000000000 - sage: R = RealField(20) - sage: RDF(2.1)._im_gens_(R, [R(1)]) + sage: R = RealField(20) # optional - sage.rings.real_mpfr + sage: RDF(2.1)._im_gens_(R, [R(1)]) # optional - sage.rings.real_mpfr 2.1000 """ return codomain(self) # since 1 |--> 1 diff --git a/src/sage/rings/ring.pyx b/src/sage/rings/ring.pyx index 4cba2c9ba7f..8780f23483e 100644 --- a/src/sage/rings/ring.pyx +++ b/src/sage/rings/ring.pyx @@ -1123,9 +1123,9 @@ cdef class Ring(ParentWithGens): sage: RDF.epsilon() 2.220446049250313e-16 - sage: ComplexField(53).epsilon() + sage: ComplexField(53).epsilon() # optional - sage.rings.real_mpfr 2.22044604925031e-16 - sage: RealField(10).epsilon() + sage: RealField(10).epsilon() # optional - sage.rings.real_mpfr 0.0020 For exact rings, zero is returned:: @@ -1142,7 +1142,7 @@ cdef class Ring(ParentWithGens): For the symbolic ring, there is no reasonable answer:: - sage: SR.epsilon() # optional - sage.symbolics + sage: SR.epsilon() # optional - sage.symbolic Traceback (most recent call last): ... NotImplementedError From 74deb0fd0bd6afccd71bc07b418286582f726eae Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 12 Jun 2023 09:16:40 -0700 Subject: [PATCH 310/423] src/sage/rings/multi_power_series_ring_element.py: Add # optional --- src/sage/rings/multi_power_series_ring_element.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/sage/rings/multi_power_series_ring_element.py b/src/sage/rings/multi_power_series_ring_element.py index 0251356ecd1..eeca8245b90 100644 --- a/src/sage/rings/multi_power_series_ring_element.py +++ b/src/sage/rings/multi_power_series_ring_element.py @@ -520,22 +520,21 @@ def _subs_formal(self, *x, **kwds): sage: f(z, RF(1)) # indirect doctest # optional - sage.rings.real_mpfr -0.20 - 0.061*z + 1.0*z^2 - 0.00*z^3 - 0.00*z^4 - 1.0*z^5 - sage: m = matrix(QQ,[[1,0,1],[0,2,1],[-1,0,0]]) - sage: m + sage: m = matrix(QQ,[[1,0,1],[0,2,1],[-1,0,0]]); m # optional - sage.modules [ 1 0 1] [ 0 2 1] [-1 0 0] - sage: f(m,m) #indirect doctest + sage: f(m,m) # indirect doctest # optional - sage.modules [ 2/33 0 1/5] [ 131/55 -1136/165 -24/11] [ -1/5 0 -23/165] - sage: f(m,m) == -2/33*m^3 - 1/5*m^5 #indirect doctest + sage: f(m,m) == -2/33*m^3 - 1/5*m^5 # indirect doctest # optional - sage.modules True sage: f = f.add_bigoh(10) sage: f(z,z) -2/33*z^3 - 1/5*z^5 + O(z^10) - sage: f(m,m) + sage: f(m,m) # optional - sage.modules Traceback (most recent call last): ... AttributeError: 'sage.matrix.matrix_rational_dense.Matrix_rational_dense' object has no attribute 'add_bigoh' From 608def5b6f425022895eb74170c37bc18d0dba35 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 14 Jun 2023 18:25:01 -0700 Subject: [PATCH 311/423] sage.rings: More # optional --- src/sage/rings/ideal.py | 12 ++-- src/sage/rings/laurent_series_ring.py | 5 +- .../rings/laurent_series_ring_element.pyx | 3 +- src/sage/rings/rational.pyx | 62 +++++++++---------- src/sage/rings/rational_field.py | 12 ++-- src/sage/rings/ring.pyx | 12 ++-- 6 files changed, 52 insertions(+), 54 deletions(-) diff --git a/src/sage/rings/ideal.py b/src/sage/rings/ideal.py index de0525c3e1d..72204ac3dec 100644 --- a/src/sage/rings/ideal.py +++ b/src/sage/rings/ideal.py @@ -486,14 +486,14 @@ def apply_morphism(self, phi): EXAMPLES:: - sage: psi = CC['x'].hom([-CC['x'].0]) - sage: J = ideal([CC['x'].0 + 1]); J + sage: psi = CC['x'].hom([-CC['x'].0]) # optional - sage.rings.real_mpfr + sage: J = ideal([CC['x'].0 + 1]); J # optional - sage.rings.real_mpfr Principal ideal (x + 1.00000000000000) of Univariate Polynomial Ring in x over Complex Field with 53 bits of precision - sage: psi(J) + sage: psi(J) # optional - sage.rings.real_mpfr Principal ideal (x - 1.00000000000000) of Univariate Polynomial Ring in x over Complex Field with 53 bits of precision - sage: J.apply_morphism(psi) + sage: J.apply_morphism(psi) # optional - sage.rings.real_mpfr Principal ideal (x - 1.00000000000000) of Univariate Polynomial Ring in x over Complex Field with 53 bits of precision @@ -965,8 +965,8 @@ def is_trivial(self): :: - sage: I = CC['x'].ideal(0) - sage: I.is_trivial() + sage: I = CC['x'].ideal(0) # optional - sage.rings.real_mpfr + sage: I.is_trivial() # optional - sage.rings.real_mpfr True This test addresses issue :trac:`20514`:: diff --git a/src/sage/rings/laurent_series_ring.py b/src/sage/rings/laurent_series_ring.py index 46c86bf378d..90f926035d7 100644 --- a/src/sage/rings/laurent_series_ring.py +++ b/src/sage/rings/laurent_series_ring.py @@ -114,10 +114,9 @@ class LaurentSeriesRing(UniqueRepresentation, CommutativeRing): sage: W is T # optional - sage.rings.padics False - sage: K = LaurentSeriesRing(CC, 'q') - sage: K + sage: K = LaurentSeriesRing(CC, 'q'); K # optional - sage.rings.real_mpfr Laurent Series Ring in q over Complex Field with 53 bits of precision - sage: loads(K.dumps()) == K + sage: loads(K.dumps()) == K # optional - sage.rings.real_mpfr True sage: P = QQ[['x']] sage: F = Frac(P) diff --git a/src/sage/rings/laurent_series_ring_element.pyx b/src/sage/rings/laurent_series_ring_element.pyx index fa08abe8d99..20419196b31 100644 --- a/src/sage/rings/laurent_series_ring_element.pyx +++ b/src/sage/rings/laurent_series_ring_element.pyx @@ -21,8 +21,7 @@ We compute with a Laurent series over the complex mpfr numbers. :: - sage: K. = Frac(CC[['q']]) - sage: K + sage: K. = Frac(CC[['q']]); K # optional - sage.rings.real_mpfr Laurent Series Ring in q over Complex Field with 53 bits of precision sage: q 1.00000000000000*q diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx index 326bd258b06..8adb1f632ed 100644 --- a/src/sage/rings/rational.pyx +++ b/src/sage/rings/rational.pyx @@ -805,9 +805,9 @@ cdef class Rational(sage.structure.element.FieldElement): sage: a = (355/113).continued_fraction(); a [3; 7, 16] - sage: a.n(digits=10) + sage: a.n(digits=10) # optional - sage.rings.real_mpfr 3.141592920 - sage: pi.n(digits=10) + sage: pi.n(digits=10) # optional - sage.rings.real_mpfr sage.symbolic 3.141592654 It's almost pi! @@ -1196,11 +1196,11 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: sage: a = QQ(25/6) - sage: a.local_height(2) + sage: a.local_height(2) # optional - sage.rings.real_mpfr 0.693147180559945 - sage: a.local_height(3) + sage: a.local_height(3) # optional - sage.rings.real_mpfr 1.09861228866811 - sage: a.local_height(5) + sage: a.local_height(5) # optional - sage.rings.real_mpfr 0.000000000000000 """ from sage.rings.real_mpfr import RealField @@ -1234,11 +1234,11 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: sage: a = QQ(6/25) - sage: a.local_height_arch() + sage: a.local_height_arch() # optional - sage.rings.real_mpfr 0.000000000000000 - sage: (1/a).local_height_arch() + sage: (1/a).local_height_arch() # optional - sage.rings.real_mpfr 1.42711635564015 - sage: (1/a).local_height_arch(100) + sage: (1/a).local_height_arch(100) # optional - sage.rings.real_mpfr 1.4271163556401457483890413081 """ from sage.rings.real_mpfr import RealField @@ -1277,11 +1277,11 @@ cdef class Rational(sage.structure.element.FieldElement): sage: a = QQ(5/6) sage: a.support() [2, 3, 5] - sage: a.global_height_non_arch() + sage: a.global_height_non_arch() # optional - sage.rings.real_mpfr 1.79175946922805 - sage: [a.local_height(p) for p in a.support()] + sage: [a.local_height(p) for p in a.support()] # optional - sage.rings.real_mpfr [0.693147180559945, 1.09861228866811, 0.000000000000000] - sage: sum([a.local_height(p) for p in a.support()]) + sage: sum([a.local_height(p) for p in a.support()]) # optional - sage.rings.real_mpfr 1.79175946922805 """ from sage.rings.real_mpfr import RealField @@ -1318,11 +1318,11 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: sage: a = QQ(6/25) - sage: a.global_height_arch() + sage: a.global_height_arch() # optional - sage.rings.real_mpfr 0.000000000000000 - sage: (1/a).global_height_arch() + sage: (1/a).global_height_arch() # optional - sage.rings.real_mpfr 1.42711635564015 - sage: (1/a).global_height_arch(100) + sage: (1/a).global_height_arch(100) # optional - sage.rings.real_mpfr 1.4271163556401457483890413081 """ return self.local_height_arch(prec) @@ -1350,15 +1350,15 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: sage: a = QQ(6/25) - sage: a.global_height_arch() + a.global_height_non_arch() + sage: a.global_height_arch() + a.global_height_non_arch() # optional - sage.rings.real_mpfr 3.21887582486820 - sage: a.global_height() + sage: a.global_height() # optional - sage.rings.real_mpfr 3.21887582486820 - sage: (1/a).global_height() + sage: (1/a).global_height() # optional - sage.rings.real_mpfr 3.21887582486820 - sage: QQ(0).global_height() + sage: QQ(0).global_height() # optional - sage.rings.real_mpfr 0.000000000000000 - sage: QQ(1).global_height() + sage: QQ(1).global_height() # optional - sage.rings.real_mpfr 0.000000000000000 """ from sage.rings.real_mpfr import RealField @@ -1910,13 +1910,13 @@ cdef class Rational(sage.structure.element.FieldElement): sage: n = 2/3 sage: n.sqrt() # optional - sage.symbolic sqrt(2/3) - sage: n.sqrt(prec=10) + sage: n.sqrt(prec=10) # optional - sage.rings.real_mpfr 0.82 - sage: n.sqrt(prec=100) + sage: n.sqrt(prec=100) # optional - sage.rings.real_mpfr 0.81649658092772603273242802490 - sage: n.sqrt(prec=100)^2 + sage: n.sqrt(prec=100)^2 # optional - sage.rings.real_mpfr 0.66666666666666666666666666667 - sage: n.sqrt(prec=53, all=True) + sage: n.sqrt(prec=53, all=True) # optional - sage.rings.real_mpfr [0.816496580927726, -0.816496580927726] sage: n.sqrt(extend=False, all=True) Traceback (most recent call last): @@ -1924,9 +1924,9 @@ cdef class Rational(sage.structure.element.FieldElement): ValueError: square root of 2/3 not a rational number sage: sqrt(-2/3, all=True) # optional - sage.symbolic [sqrt(-2/3), -sqrt(-2/3)] - sage: sqrt(-2/3, prec=53) + sage: sqrt(-2/3, prec=53) # optional - sage.rings.real_mpfr 0.816496580927726*I - sage: sqrt(-2/3, prec=53, all=True) + sage: sqrt(-2/3, prec=53, all=True) # optional - sage.rings.real_mpfr [0.816496580927726*I, -0.816496580927726*I] AUTHORS: @@ -2193,12 +2193,12 @@ cdef class Rational(sage.structure.element.FieldElement): Test that conversion agrees with `RR`:: sage: Q = [a/b for a in [-99..99] for b in [1..99]] - sage: all(RDF(q) == RR(q) for q in Q) + sage: all(RDF(q) == RR(q) for q in Q) # optional - sage.rings.real_mpfr True Test that the conversion has correct rounding on simple rationals:: - sage: for p in [-100..100]: + sage: for p in [-100..100]: # optional - sage.rings.real_mpfr ....: for q in [1..100]: ....: r = RDF(p/q) ....: assert (RR(r).exact_rational() - p/q) <= r.ulp()/2 @@ -3121,7 +3121,7 @@ cdef class Rational(sage.structure.element.FieldElement): sage: (124/345).log(5) # optional - sage.symbolic log(124/345)/log(5) - sage: (124/345).log(5, 100) + sage: (124/345).log(5, 100) # optional - sage.rings.real_mpfr -0.63578895682825611710391773754 sage: log(QQ(125)) # optional - sage.symbolic 3*log(5) @@ -3147,7 +3147,7 @@ cdef class Rational(sage.structure.element.FieldElement): -4/3 sage: (125/8).log(5/2) # optional - sage.libs.pari 3 - sage: (125/8).log(5/2, prec=53) + sage: (125/8).log(5/2, prec=53) # optional - sage.rings.real_mpfr 3.00000000000000 TESTS:: @@ -3236,9 +3236,9 @@ cdef class Rational(sage.structure.element.FieldElement): This function accepts an optional precision argument:: - sage: (1/3).gamma(prec=100) + sage: (1/3).gamma(prec=100) # optional - sage.rings.real_mpfr 2.6789385347077476336556929410 - sage: (1/2).gamma(prec=100) + sage: (1/2).gamma(prec=100) # optional - sage.rings.real_mpfr 1.7724538509055160272981674833 TESTS: diff --git a/src/sage/rings/rational_field.py b/src/sage/rings/rational_field.py index 5d74779c564..4c7725aaead 100644 --- a/src/sage/rings/rational_field.py +++ b/src/sage/rings/rational_field.py @@ -16,11 +16,11 @@ :: - sage: RealField(9).pi() + sage: RealField(9).pi() # optional - sage.rings.real_mpfr 3.1 - sage: QQ(RealField(9).pi()) + sage: QQ(RealField(9).pi()) # optional - sage.rings.real_mpfr 22/7 - sage: QQ(RealField().pi()) + sage: QQ(RealField().pi()) # optional - sage.rings.real_mpfr 245850922/78256779 sage: QQ(35) 35 @@ -98,11 +98,11 @@ class RationalField(Singleton, number_field_base.NumberField): :: - sage: QQ(RR(3929329/32)) + sage: QQ(RR(3929329/32)) # optional - sage.rings.real_mpfr 3929329/32 - sage: QQ(-RR(3929329/32)) + sage: QQ(-RR(3929329/32)) # optional - sage.rings.real_mpfr -3929329/32 - sage: QQ(RR(1/7)) - 1/7 + sage: QQ(RR(1/7)) - 1/7 # optional - sage.rings.real_mpfr 0 If you specify the optional second argument ``base``, then the string diff --git a/src/sage/rings/ring.pyx b/src/sage/rings/ring.pyx index 8780f23483e..30933870522 100644 --- a/src/sage/rings/ring.pyx +++ b/src/sage/rings/ring.pyx @@ -786,16 +786,16 @@ cdef class Ring(ParentWithGens): sage: QQbar.is_subring(QQbar) # optional - sage.rings.number_field True - sage: RR.is_subring(RR) + sage: RR.is_subring(RR) # optional - sage.rings.real_mpfr True - sage: CC.is_subring(CC) + sage: CC.is_subring(CC) # optional - sage.rings.real_mpfr True sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^3 - x + 1/10) # optional - sage.rings.number_field sage: K.is_subring(K) # optional - sage.rings.number_field True - sage: R. = RR[] - sage: R.is_subring(R) + sage: R. = RR[] # optional - sage.rings.real_mpfr + sage: R.is_subring(R) # optional - sage.rings.real_mpfr True """ if self is other: @@ -2131,9 +2131,9 @@ cdef class Field(PrincipalIdealDomain): sage: QQ.fraction_field() Rational Field - sage: RR.fraction_field() + sage: RR.fraction_field() # optional - sage.rings.real_mpfr Real Field with 53 bits of precision - sage: CC.fraction_field() + sage: CC.fraction_field() # optional - sage.rings.real_mpfr Complex Field with 53 bits of precision sage: x = polygen(ZZ, 'x') From 0e70ba3426a02359b89d21e1ae0a4adcbfac37ca Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 15 Jun 2023 21:39:35 -0700 Subject: [PATCH 312/423] sage.rings: More # optional --- src/sage/rings/abc.pyx | 4 ++-- src/sage/rings/fraction_field.py | 12 ++++++------ src/sage/rings/laurent_series_ring_element.pyx | 6 +++--- src/sage/rings/localization.py | 10 +++++----- src/sage/rings/multi_power_series_ring.py | 4 ++-- src/sage/rings/power_series_poly.pyx | 5 ++--- 6 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/sage/rings/abc.pyx b/src/sage/rings/abc.pyx index d62d23f7645..4893c29d1fc 100644 --- a/src/sage/rings/abc.pyx +++ b/src/sage/rings/abc.pyx @@ -177,7 +177,7 @@ cdef class RealField(Field): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(RR, sage.rings.abc.RealField) + sage: isinstance(RR, sage.rings.abc.RealField) # optional - sage.rings.real_mpfr True By design, there is a unique direct subclass:: @@ -277,7 +277,7 @@ cdef class ComplexField(Field): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(CC, sage.rings.abc.ComplexField) + sage: isinstance(CC, sage.rings.abc.ComplexField) # optional - sage.rings.real_mpfr True By design, there is a unique direct subclass:: diff --git a/src/sage/rings/fraction_field.py b/src/sage/rings/fraction_field.py index 15691eabe39..31d51c3195c 100644 --- a/src/sage/rings/fraction_field.py +++ b/src/sage/rings/fraction_field.py @@ -25,11 +25,11 @@ The GCD is not taken (since it doesn't converge sometimes) in the inexact case:: - sage: Z. = CC[] - sage: I = CC.gen() - sage: (1+I+z)/(z+0.1*I) + sage: Z. = CC[] # optional - sage.rings.real_mpfr + sage: I = CC.gen() # optional - sage.rings.real_mpfr + sage: (1+I+z)/(z+0.1*I) # optional - sage.rings.real_mpfr (z + 1.00000000000000 + I)/(z + 0.100000000000000*I) - sage: (1+I*z)/(z+1.1) + sage: (1+I*z)/(z+1.1) # optional - sage.rings.real_mpfr (I*z + 1.00000000000000)/(z + 1.10000000000000) TESTS:: @@ -306,8 +306,8 @@ def _coerce_map_from_(self, S): Test for :trac:`31320`:: sage: FQt = Frac(QQ['t']) - sage: LCt = LaurentPolynomialRing(CC,'t') - sage: coercion_model.common_parent(FQt, LCt) + sage: LCt = LaurentPolynomialRing(CC,'t') # optional - sage.rings.real_mpfr + sage: coercion_model.common_parent(FQt, LCt) # optional - sage.rings.real_mpfr Fraction Field of Univariate Polynomial Ring in t over Complex Field with 53 bits of precision diff --git a/src/sage/rings/laurent_series_ring_element.pyx b/src/sage/rings/laurent_series_ring_element.pyx index 20419196b31..63cac5bce7a 100644 --- a/src/sage/rings/laurent_series_ring_element.pyx +++ b/src/sage/rings/laurent_series_ring_element.pyx @@ -23,16 +23,16 @@ We compute with a Laurent series over the complex mpfr numbers. sage: K. = Frac(CC[['q']]); K # optional - sage.rings.real_mpfr Laurent Series Ring in q over Complex Field with 53 bits of precision - sage: q + sage: q # optional - sage.rings.real_mpfr 1.00000000000000*q Saving and loading. :: - sage: loads(q.dumps()) == q + sage: loads(q.dumps()) == q # optional - sage.rings.real_mpfr True - sage: loads(K.dumps()) == K + sage: loads(K.dumps()) == K # optional - sage.rings.real_mpfr True IMPLEMENTATION: Laurent series in Sage are represented internally diff --git a/src/sage/rings/localization.py b/src/sage/rings/localization.py index a0659202ac6..bda24010204 100644 --- a/src/sage/rings/localization.py +++ b/src/sage/rings/localization.py @@ -282,14 +282,14 @@ def _repr_(self): EXAMPLES:: sage: from sage.rings.localization import LocalizationElement - sage: P. = CC[] - sage: L = Localization(P, x**2+x+1) - sage: l = LocalizationElement(L, (x**2+1)/(x**2+x+1)) - sage: l._repr_() == str(l) + sage: P. = CC[] # optional - sage.rings.real_mpfr + sage: L = Localization(P, x**2 + x + 1) # optional - sage.rings.real_mpfr + sage: l = LocalizationElement(L, (x**2+1)/(x**2+x+1)) # optional - sage.rings.real_mpfr + sage: l._repr_() == str(l) # optional - sage.rings.real_mpfr True sage: R. = ZZ[] - sage: L. = R.localization(X-Y) + sage: L. = R.localization(X - Y) sage: x*y/(x-y) x*y/(x - y) """ diff --git a/src/sage/rings/multi_power_series_ring.py b/src/sage/rings/multi_power_series_ring.py index 410de0bbff0..e8b58284316 100644 --- a/src/sage/rings/multi_power_series_ring.py +++ b/src/sage/rings/multi_power_series_ring.py @@ -117,7 +117,7 @@ sage: R. = PowerSeriesRing(QQ); R Multivariate Power Series Ring in t, u, v over Rational Field - sage: R.base_extend(RR) + sage: R.base_extend(RR) # optional - sage.rings.real_mpfr Multivariate Power Series Ring in t, u, v over Real Field with 53 bits of precision sage: R.change_ring(IntegerModRing(10)) @@ -543,7 +543,7 @@ def change_ring(self, R): sage: R. = PowerSeriesRing(QQ); R Multivariate Power Series Ring in t, u, v over Rational Field - sage: R.base_extend(RR) + sage: R.base_extend(RR) # optional - sage.rings.real_mpfr Multivariate Power Series Ring in t, u, v over Real Field with 53 bits of precision sage: R.change_ring(IntegerModRing(10)) diff --git a/src/sage/rings/power_series_poly.pyx b/src/sage/rings/power_series_poly.pyx index 46d7bbf1303..63d26c53757 100644 --- a/src/sage/rings/power_series_poly.pyx +++ b/src/sage/rings/power_series_poly.pyx @@ -16,10 +16,9 @@ cdef class PowerSeries_poly(PowerSeries): """ EXAMPLES:: - sage: R. = PowerSeriesRing(CC) - sage: R + sage: R. = PowerSeriesRing(CC); R # optional - sage.rings.real_mpfr Power Series Ring in q over Complex Field with 53 bits of precision - sage: loads(q.dumps()) == q + sage: loads(q.dumps()) == q # optional - sage.rings.real_mpfr True sage: R. = QQ[[]] From 8153ac0dd63e95c72ba040a5d8f49b8421177164 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 19 Jun 2023 00:11:47 -0700 Subject: [PATCH 313/423] More # optional --- src/sage/rings/infinity.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/sage/rings/infinity.py b/src/sage/rings/infinity.py index 4e3f27784a2..2d812f5dd1c 100644 --- a/src/sage/rings/infinity.py +++ b/src/sage/rings/infinity.py @@ -691,11 +691,11 @@ def _element_constructor_(self, x): A number less than infinity sage: UnsignedInfinityRing(RDF(oo)), UnsignedInfinityRing(RDF(-oo)) (Infinity, Infinity) - sage: UnsignedInfinityRing(RR(oo)), UnsignedInfinityRing(RR(-oo)) + sage: UnsignedInfinityRing(RR(oo)), UnsignedInfinityRing(RR(-oo)) # optional - sage.rings.real_mpfr (Infinity, Infinity) sage: UnsignedInfinityRing(CDF(oo)), UnsignedInfinityRing(CDF(-oo)) (Infinity, Infinity) - sage: UnsignedInfinityRing(CC(oo)), UnsignedInfinityRing(CC(-oo)) + sage: UnsignedInfinityRing(CC(oo)), UnsignedInfinityRing(CC(-oo)) # optional - sage.rings.real_mpfr (Infinity, Infinity) sage: UnsignedInfinityRing(RIF(oo)), UnsignedInfinityRing(RIF(-oo)) (Infinity, Infinity) @@ -746,7 +746,7 @@ def _coerce_map_from_(self, R): sage: UnsignedInfinityRing.has_coerce_map_from(int) # indirect doctest True - sage: UnsignedInfinityRing.has_coerce_map_from(CC) + sage: UnsignedInfinityRing.has_coerce_map_from(CC) # optional - sage.rings.real_mpfr True sage: UnsignedInfinityRing.has_coerce_map_from(QuadraticField(-163, 'a')) # optional - sage.rings.number_field True @@ -983,7 +983,7 @@ def is_Infinite(x): True sage: sage.rings.infinity.is_Infinite(3) False - sage: sage.rings.infinity.is_Infinite(RR(infinity)) + sage: sage.rings.infinity.is_Infinite(RR(infinity)) # optional - sage.rings.real_mpfr False sage: sage.rings.infinity.is_Infinite(ZZ) False @@ -1137,7 +1137,7 @@ def _element_constructor_(self, x): A negative finite number sage: InfinityRing(RDF(oo)), InfinityRing(RDF(-oo)) (+Infinity, -Infinity) - sage: InfinityRing(RR(oo)), InfinityRing(RR(-oo)) + sage: InfinityRing(RR(oo)), InfinityRing(RR(-oo)) # optional - sage.rings.real_mpfr (+Infinity, -Infinity) sage: InfinityRing(RIF(oo)), InfinityRing(RIF(-oo)) (+Infinity, -Infinity) @@ -1149,7 +1149,7 @@ def _element_constructor_(self, x): The following rings have ``is_positive_infinity`` / ``is_negative_infinity`` methods:: - sage: RR(oo).is_positive_infinity(), RR(-oo).is_negative_infinity() + sage: RR(oo).is_positive_infinity(), RR(-oo).is_negative_infinity() # optional - sage.rings.real_mpfr (True, True) sage: SR(oo).is_positive_infinity(), SR(-oo).is_negative_infinity() # optional - sage.symbolic (True, True) @@ -1157,10 +1157,10 @@ def _element_constructor_(self, x): Complex infinity raises an exception. This is fine (there is no coercion, so there is no promise of functoriality):: - sage: i_infinity = CC(0, oo) - sage: InfinityRing(CC(oo)), InfinityRing(CC(-oo)) + sage: i_infinity = CC(0, oo) # optional - sage.rings.real_mpfr + sage: InfinityRing(CC(oo)), InfinityRing(CC(-oo)) # optional - sage.rings.real_mpfr (+Infinity, -Infinity) - sage: InfinityRing(i_infinity) + sage: InfinityRing(i_infinity) # optional - sage.rings.real_mpfr Traceback (most recent call last): ... ValueError: infinite but not with +/- phase @@ -1263,9 +1263,9 @@ def _coerce_map_from_(self, R): sage: InfinityRing.has_coerce_map_from(CDF) False - sage: InfinityRing.has_coerce_map_from(CC) + sage: InfinityRing.has_coerce_map_from(CC) # optional - sage.rings.real_mpfr False - sage: CC(0, oo) < CC(1) # does not coerce to infinity ring + sage: CC(0, oo) < CC(1) # does not coerce to infinity ring # optional - sage.rings.real_mpfr True """ from sage.structure.coerce import parent_is_real_numerical From c7dc6a3f5126f25e2b6247f31bbded35c6df0aaf Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 20 Jun 2023 15:20:32 -0700 Subject: [PATCH 314/423] More # optional --- src/sage/rings/real_double.pyx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index 11de275ce72..7fcfad0ceaf 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -650,29 +650,29 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): TESTS:: sage: R. = RDF[] - sage: RDF._factor_univariate_polynomial(x) + sage: RDF._factor_univariate_polynomial(x) # optional - numpy x - sage: RDF._factor_univariate_polynomial(2*x) + sage: RDF._factor_univariate_polynomial(2*x) # optional - numpy (2.0) * x - sage: RDF._factor_univariate_polynomial(x^2) + sage: RDF._factor_univariate_polynomial(x^2) # optional - numpy x^2 - sage: RDF._factor_univariate_polynomial(x^2 + 1) + sage: RDF._factor_univariate_polynomial(x^2 + 1) # optional - numpy x^2 + 1.0 - sage: RDF._factor_univariate_polynomial(x^2 - 1) + sage: RDF._factor_univariate_polynomial(x^2 - 1) # optional - numpy (x - 1.0) * (x + 1.0) The implementation relies on the ``roots()`` method which often reports roots not to be real even though they are:: sage: f = (x-1)^3 - sage: f.roots(ring=CDF) # abs tol 2e-5 + sage: f.roots(ring=CDF) # abs tol 2e-5 # optional - numpy [(1.0000065719436413, 1), (0.9999967140281792 - 5.691454546815028e-06*I, 1), (0.9999967140281792 + 5.691454546815028e-06*I, 1)] This leads to the following incorrect factorization:: - sage: f.factor() # abs tol 2e-5 + sage: f.factor() # abs tol 2e-5 # optional - numpy (x - 1.0000065719436413) * (x^2 - 1.9999934280563585*x + 0.9999934280995487) """ roots = f.roots(sage.rings.complex_double.CDF) From 3a0d43f9f75f382e87e1df601bf78d4f2bb9edaf Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 25 Jun 2023 22:55:43 -0700 Subject: [PATCH 315/423] More # optional --- src/sage/rings/power_series_ring_element.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/rings/power_series_ring_element.pyx b/src/sage/rings/power_series_ring_element.pyx index 54314d538ed..c9a73a18665 100644 --- a/src/sage/rings/power_series_ring_element.pyx +++ b/src/sage/rings/power_series_ring_element.pyx @@ -152,7 +152,7 @@ cdef class PowerSeries(AlgebraElement): EXAMPLES:: - sage: PowerSeriesRing(CC, 'q') + sage: PowerSeriesRing(CC, 'q') # optional - sage.rings.real_mpfr Power Series Ring in q over Complex Field with 53 bits of precision sage: T = PowerSeriesRing(GF(3), 5, 't'); T # optional - sage.rings.finite_rings Multivariate Power Series Ring in t0, t1, t2, t3, t4 From b572224427326a68a20987114ce1d9ac86b335e1 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 29 Jun 2023 19:55:48 -0700 Subject: [PATCH 316/423] sage.schemes: Update # needs --- src/sage/rings/real_double.pyx | 114 ++++++++++++++++----------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index 7fcfad0ceaf..bb5b06d489c 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -5,21 +5,21 @@ EXAMPLES: We create the real double vector space of dimension `3`:: - sage: V = RDF^3; V # optional - sage.modules + sage: V = RDF^3; V # needs sage.modules Vector space of dimension 3 over Real Double Field Notice that this space is unique:: - sage: V is RDF^3 # optional - sage.modules + sage: V is RDF^3 # needs sage.modules True - sage: V is FreeModule(RDF, 3) # optional - sage.modules + sage: V is FreeModule(RDF, 3) # needs sage.modules True - sage: V is VectorSpace(RDF, 3) # optional - sage.modules + sage: V is VectorSpace(RDF, 3) # needs sage.modules True Also, you can instantly create a space of large dimension:: - sage: V = RDF^10000 # optional - sage.modules + sage: V = RDF^10000 # needs sage.modules TESTS: @@ -27,8 +27,8 @@ Test NumPy conversions:: sage: RDF(1).__array_interface__ {'typestr': '=f8'} - sage: import numpy # optional - numpy - sage: numpy.array([RDF.pi()]).dtype # optional - numpy + sage: import numpy # needs numpy + sage: numpy.array([RDF.pi()]).dtype # needs numpy dtype('float64') """ @@ -84,7 +84,7 @@ def is_RealDoubleField(x): use isinstance(..., sage.rings.abc.RealDoubleField) instead See https://github.com/sagemath/sage/issues/32610 for details. True - sage: is_RealDoubleField(RealField(53)) # optional - sage.rings.real_mpfr + sage: is_RealDoubleField(RealField(53)) # needs sage.rings.real_mpfr False """ from sage.misc.superseded import deprecation @@ -128,15 +128,15 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): numbers and higher-precision ones, though of course there may be loss of precision:: - sage: a = RealField(200)(2).sqrt(); a # optional - sage.rings.real_mpfr + sage: a = RealField(200)(2).sqrt(); a # needs sage.rings.real_mpfr 1.4142135623730950488016887242096980785696718753769480731767 - sage: b = RDF(a); b # optional - sage.rings.real_mpfr + sage: b = RDF(a); b # needs sage.rings.real_mpfr 1.4142135623730951 - sage: a.parent()(b) # optional - sage.rings.real_mpfr + sage: a.parent()(b) # needs sage.rings.real_mpfr 1.4142135623730951454746218587388284504413604736328125000000 - sage: a.parent()(b) == b # optional - sage.rings.real_mpfr + sage: a.parent()(b) == b # needs sage.rings.real_mpfr True - sage: b == RR(a) # optional - sage.rings.real_mpfr + sage: b == RR(a) # needs sage.rings.real_mpfr True TESTS:: @@ -329,22 +329,22 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): sage: RLF(2/3) + RDF(1) 1.6666666666666665 - sage: import numpy # optional - numpy - sage: RDF.coerce(numpy.int8('1')) # optional - numpy + sage: import numpy # needs numpy + sage: RDF.coerce(numpy.int8('1')) # needs numpy 1.0 - sage: RDF.coerce(numpy.float64('1')) # optional - numpy + sage: RDF.coerce(numpy.float64('1')) # needs numpy 1.0 - sage: RDF.coerce(pi) + sage: RDF.coerce(pi) # needs sage.symbolic Traceback (most recent call last): ... TypeError: no canonical coercion from Symbolic Ring to Real Double Field Test that :trac:`15695` is fixed (see also :trac:`18076`):: - sage: 1j + numpy.float64(2) + sage: 1j + numpy.float64(2) # needs numpy 2.00000000000000 + 1.00000000000000*I - sage: parent(_) + sage: parent(_) # needs numpy Complex Field with 53 bits of precision """ if S is int or S is float: @@ -446,7 +446,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): EXAMPLES:: - sage: RDF.to_prec(52) # optional - sage.rings.real_mpfr + sage: RDF.to_prec(52) # needs sage.rings.real_mpfr Real Field with 52 bits of precision sage: RDF.to_prec(53) Real Double Field @@ -650,29 +650,29 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): TESTS:: sage: R. = RDF[] - sage: RDF._factor_univariate_polynomial(x) # optional - numpy + sage: RDF._factor_univariate_polynomial(x) # needs numpy x - sage: RDF._factor_univariate_polynomial(2*x) # optional - numpy + sage: RDF._factor_univariate_polynomial(2*x) # needs numpy (2.0) * x - sage: RDF._factor_univariate_polynomial(x^2) # optional - numpy + sage: RDF._factor_univariate_polynomial(x^2) # needs numpy x^2 - sage: RDF._factor_univariate_polynomial(x^2 + 1) # optional - numpy + sage: RDF._factor_univariate_polynomial(x^2 + 1) # needs numpy x^2 + 1.0 - sage: RDF._factor_univariate_polynomial(x^2 - 1) # optional - numpy + sage: RDF._factor_univariate_polynomial(x^2 - 1) # needs numpy (x - 1.0) * (x + 1.0) The implementation relies on the ``roots()`` method which often reports roots not to be real even though they are:: sage: f = (x-1)^3 - sage: f.roots(ring=CDF) # abs tol 2e-5 # optional - numpy + sage: f.roots(ring=CDF) # abs tol 2e-5 # needs numpy [(1.0000065719436413, 1), (0.9999967140281792 - 5.691454546815028e-06*I, 1), (0.9999967140281792 + 5.691454546815028e-06*I, 1)] This leads to the following incorrect factorization:: - sage: f.factor() # abs tol 2e-5 # optional - numpy + sage: f.factor() # abs tol 2e-5 # needs numpy (x - 1.0000065719436413) * (x^2 - 1.9999934280563585*x + 0.9999934280995487) """ roots = f.roots(sage.rings.complex_double.CDF) @@ -790,20 +790,20 @@ cdef class RealDoubleElement(FieldElement): EXAMPLES:: - sage: a = RDF(pi) # optional - sage.symbolic - sage: a.ulp() # optional - sage.symbolic + sage: a = RDF(pi) # needs sage.symbolic + sage: a.ulp() # needs sage.symbolic 4.440892098500626e-16 - sage: b = a + a.ulp() # optional - sage.symbolic + sage: b = a + a.ulp() # needs sage.symbolic Adding or subtracting an ulp always gives a different number:: - sage: a + a.ulp() == a # optional - sage.symbolic + sage: a + a.ulp() == a # needs sage.symbolic False - sage: a - a.ulp() == a # optional - sage.symbolic + sage: a - a.ulp() == a # needs sage.symbolic False - sage: b + b.ulp() == b # optional - sage.symbolic + sage: b + b.ulp() == b # needs sage.symbolic False - sage: b - b.ulp() == b # optional - sage.symbolic + sage: b - b.ulp() == b # needs sage.symbolic False Since the default rounding mode is round-to-nearest, adding or @@ -812,13 +812,13 @@ cdef class RealDoubleElement(FieldElement): can only happen if the input number is (up to sign) exactly a power of 2:: - sage: a - a.ulp()/3 == a # optional - sage.symbolic + sage: a - a.ulp()/3 == a # needs sage.symbolic True - sage: a + a.ulp()/3 == a # optional - sage.symbolic + sage: a + a.ulp()/3 == a # needs sage.symbolic True - sage: b - b.ulp()/3 == b # optional - sage.symbolic + sage: b - b.ulp()/3 == b # needs sage.symbolic True - sage: b + b.ulp()/3 == b # optional - sage.symbolic + sage: b + b.ulp()/3 == b # needs sage.symbolic True sage: c = RDF(1) sage: c - c.ulp()/3 == c @@ -977,11 +977,11 @@ cdef class RealDoubleElement(FieldElement): EXAMPLES:: - sage: s1 = RDF(sin(1)); s1 # optional - sage.symbolic + sage: s1 = RDF(sin(1)); s1 # needs sage.symbolic 0.8414709848078965 - sage: s1._interface_init_() # optional - sage.symbolic + sage: s1._interface_init_() # needs sage.symbolic '0.8414709848078965' - sage: s1 == RDF(gp(s1)) # optional - sage.libs.pari sage.symbolic + sage: s1 == RDF(gp(s1)) # needs sage.libs.pari sage.symbolic True """ return repr(self._value) @@ -1006,7 +1006,7 @@ cdef class RealDoubleElement(FieldElement): EXAMPLES:: - sage: sage_input(RDF(NaN)) # optional - sage.symbolic + sage: sage_input(RDF(NaN)) # needs sage.symbolic RDF(NaN) sage: sage_input(RDF(-infinity), verify=True) # Verified @@ -1014,13 +1014,13 @@ cdef class RealDoubleElement(FieldElement): sage: sage_input(RDF(-infinity)*polygen(RDF)) R. = RDF[] -RDF(infinity)*x + RDF(NaN) - sage: sage_input(RDF(pi), verify=True) + sage: sage_input(RDF(pi), verify=True) # needs sage.symbolic # Verified RDF(3.1415926535897931) - sage: sage_input(RDF(-e), verify=True, preparse=False) + sage: sage_input(RDF(-e), verify=True, preparse=False) # needs sage.symbolic # Verified -RDF(2.718281828459045...) - sage: sage_input(RDF(pi)*polygen(RDF), verify=True, preparse=None) # optional - sage.symbolic + sage: sage_input(RDF(pi)*polygen(RDF), verify=True, preparse=None) # needs sage.symbolic # Verified R = RDF['x'] x = R.gen() @@ -1167,8 +1167,8 @@ cdef class RealDoubleElement(FieldElement): sage: RDF(2.1)._im_gens_(RR, [RR(1)]) 2.10000000000000 - sage: R = RealField(20) # optional - sage.rings.real_mpfr - sage: RDF(2.1)._im_gens_(R, [R(1)]) # optional - sage.rings.real_mpfr + sage: R = RealField(20) # needs sage.rings.real_mpfr + sage: RDF(2.1)._im_gens_(R, [R(1)]) # needs sage.rings.real_mpfr 2.1000 """ return codomain(self) # since 1 |--> 1 @@ -1265,12 +1265,12 @@ cdef class RealDoubleElement(FieldElement): EXAMPLES:: - sage: a = RDF(exp(1.0)); a # optional - sage.symbolic + sage: a = RDF(exp(1.0)); a # needs sage.symbolic 2.718281828459045 - sage: sign,mantissa,exponent = RDF(exp(1.0)).sign_mantissa_exponent() # optional - sage.symbolic - sage: sign,mantissa,exponent # optional - sage.symbolic + sage: sign,mantissa,exponent = RDF(exp(1.0)).sign_mantissa_exponent() # needs sage.symbolic + sage: sign,mantissa,exponent # needs sage.symbolic (1, 6121026514868073, -51) - sage: sign*mantissa*(2**exponent) == a # optional - sage.symbolic + sage: sign*mantissa*(2**exponent) == a # needs sage.symbolic True The mantissa is always a nonnegative number:: @@ -1649,9 +1649,9 @@ cdef class RealDoubleElement(FieldElement): EXAMPLES:: sage: a = RDF(1/3) - sage: CC(a) + sage: CC(a) # needs sage.rings.real_mpfr 0.333333333333333 - sage: a._complex_mpfr_field_(CC) + sage: a._complex_mpfr_field_(CC) # needs sage.rings.real_mpfr 0.333333333333333 If we coerce to a higher-precision field the extra bits appear @@ -1659,9 +1659,9 @@ cdef class RealDoubleElement(FieldElement): :: - sage: a._complex_mpfr_field_(ComplexField(100)) + sage: a._complex_mpfr_field_(ComplexField(100)) # needs sage.rings.real_mpfr 0.33333333333333331482961625625 - sage: a._complex_mpfr_field_(ComplexField(100)).str(2) + sage: a._complex_mpfr_field_(ComplexField(100)).str(2) # needs sage.rings.real_mpfr '0.01010101010101010101010101010101010101010101010101010100000000000000000000000000000000000000000000000' """ return CC(self._value) @@ -1683,7 +1683,7 @@ cdef class RealDoubleElement(FieldElement): EXAMPLES:: - sage: RDF(1.5).__pari__() # optional - sage.libs.pari + sage: RDF(1.5).__pari__() # needs sage.libs.pari 1.50000000000000 """ global new_gen_from_real_double_element @@ -1969,7 +1969,7 @@ cdef class RealDoubleElement(FieldElement): sage: r = sqrt(RDF(2)); r 1.4142135623730951 - sage: r.algebraic_dependency(5) # optional - sage.libs.pari + sage: r.algebraic_dependency(5) # needs sage.libs.pari x^2 - 2 """ return sage.arith.all.algdep(self,n) From 84afcb53f049c4416406fca1313293155fe1dcd4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 1 Jul 2023 15:42:59 -0700 Subject: [PATCH 317/423] Update # optional / # needs --- src/sage/rings/tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/rings/tests.py b/src/sage/rings/tests.py index d7d14aa4e0a..85977bf587b 100644 --- a/src/sage/rings/tests.py +++ b/src/sage/rings/tests.py @@ -392,9 +392,9 @@ def test_random_arith(level=MAX_LEVEL, trials=1): a -2*a - 1 2*a - 30164 - sage: sage.rings.tests.test_random_arith(trials=10) + sage: sage.rings.tests.test_random_arith(trials=10) # optional - sage.rings.finite_rings survived 0 tests... - sage: sage.rings.tests.test_random_arith(trials=1000) # long time (5 seconds?) + sage: sage.rings.tests.test_random_arith(trials=1000) # long time (5 seconds?), optional - sage.rings.finite_rings survived 0 tests... """ i = 0 From 58f08045c0c29caf551811b54a5017dc69f992a2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 2 Jul 2023 00:58:02 -0700 Subject: [PATCH 318/423] sage.rings: Update # optional / # needs --- src/sage/rings/abc.pyx | 8 ++-- src/sage/rings/integer.pyx | 12 ++--- src/sage/rings/noncommutative_ideals.pyx | 56 ++++++++++++++---------- src/sage/rings/rational.pyx | 8 ++-- src/sage/rings/rational_field.py | 49 ++++++++++++--------- src/sage/rings/real_double.pyx | 16 +++---- src/sage/rings/ring.pyx | 12 ++--- 7 files changed, 89 insertions(+), 72 deletions(-) diff --git a/src/sage/rings/abc.pyx b/src/sage/rings/abc.pyx index 4893c29d1fc..d0785dff8c2 100644 --- a/src/sage/rings/abc.pyx +++ b/src/sage/rings/abc.pyx @@ -182,7 +182,7 @@ cdef class RealField(Field): By design, there is a unique direct subclass:: - sage: sage.rings.abc.RealField.__subclasses__() + sage: sage.rings.abc.RealField.__subclasses__() # optional - sage.rings.real_mpfr [] sage: len(sage.rings.abc.RealField.__subclasses__()) <= 1 @@ -282,7 +282,7 @@ cdef class ComplexField(Field): By design, there is a unique direct subclass:: - sage: sage.rings.abc.ComplexField.__subclasses__() + sage: sage.rings.abc.ComplexField.__subclasses__() # optional - sage.rings.real_mpfr [] sage: len(sage.rings.abc.ComplexField.__subclasses__()) <= 1 @@ -352,12 +352,12 @@ cdef class ComplexDoubleField(Field): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(CDF, sage.rings.abc.ComplexDoubleField) + sage: isinstance(CDF, sage.rings.abc.ComplexDoubleField) # optional - sage.rings.complex_double True By design, there is a unique direct subclass:: - sage: sage.rings.abc.ComplexDoubleField.__subclasses__() + sage: sage.rings.abc.ComplexDoubleField.__subclasses__() # optional - sage.rings.complex_double [] sage: len(sage.rings.abc.ComplexDoubleField.__subclasses__()) <= 1 diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index d5e87626d31..c2414413fda 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -2766,11 +2766,11 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): sage: Integer(124).log(5) # optional - sage.symbolic log(124)/log(5) - sage: Integer(124).log(5, 100) + sage: Integer(124).log(5, 100) # optional - sage.rings.real_mpfr 2.9950093311241087454822446806 sage: Integer(125).log(5) 3 - sage: Integer(125).log(5, prec=53) + sage: Integer(125).log(5, prec=53) # optional - sage.rings.real_mpfr 3.00000000000000 sage: log(Integer(125)) # optional - sage.symbolic 3*log(5) @@ -2791,16 +2791,16 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): But approximations are probably more useful in this case, and work to as high a precision as we desire:: - sage: x.log(3, 53) # default precision for RealField + sage: x.log(3, 53) # default precision for RealField # optional - sage.rings.real_mpfr 100000.000000000 - sage: (x + 1).log(3, 53) + sage: (x + 1).log(3, 53) # optional - sage.rings.real_mpfr 100000.000000000 - sage: (x + 1).log(3, 1000) + sage: (x + 1).log(3, 1000) # optional - sage.rings.real_mpfr 100000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 We can use non-integer bases, with default e:: - sage: x.log(2.5, prec=53) + sage: x.log(2.5, prec=53) # optional - sage.rings.real_mpfr 119897.784671579 We also get logarithms of negative integers, via the diff --git a/src/sage/rings/noncommutative_ideals.pyx b/src/sage/rings/noncommutative_ideals.pyx index af27882313d..ec2e9292d55 100644 --- a/src/sage/rings/noncommutative_ideals.pyx +++ b/src/sage/rings/noncommutative_ideals.pyx @@ -39,6 +39,7 @@ algebras. TESTS:: + sage: # needs sage.combinat sage: A = SteenrodAlgebra(2) sage: IL = A*[A.1+A.2,A.1^2]; IL Left Ideal (Sq(2) + Sq(4), Sq(1,1)) of mod 2 Steenrod algebra, milnor basis @@ -115,6 +116,7 @@ class IdealMonoid_nc(IdealMonoid_c): TESTS:: + sage: # needs sage.combinat sage: A = SteenrodAlgebra(2) # indirect doctest sage: IL = A*[A.1+A.2,A.1^2]; IL Left Ideal (Sq(2) + Sq(4), Sq(1,1)) of mod 2 Steenrod algebra, milnor basis @@ -128,6 +130,7 @@ class IdealMonoid_nc(IdealMonoid_c): :: + sage: # needs sage.combinat sage: IL == loads(dumps(IL)) True sage: IR == loads(dumps(IR)) @@ -244,6 +247,7 @@ class Ideal_nc(Ideal_generic): TESTS:: + sage: # needs sage.combinat sage: A = SteenrodAlgebra(2) sage: A*[A.1+A.2,A.1^2] # indirect doctest Left Ideal (Sq(2) + Sq(4), Sq(1,1)) of mod 2 Steenrod algebra, milnor basis @@ -263,14 +267,15 @@ class Ideal_nc(Ideal_generic): EXAMPLES:: - sage: A = SteenrodAlgebra(2) - sage: IR = [A.1+A.2,A.1^2]*A - sage: IL = A*[A.1+A.2,A.1^2] - sage: IT = A*[A.1+A.2,A.1^2]*A - sage: IT == IL - False - sage: IR == [A.1+A.2,A.1^2]*A - True + sage: # needs sage.combinat + sage: A = SteenrodAlgebra(2) + sage: IR = [A.1+A.2,A.1^2]*A + sage: IL = A*[A.1+A.2,A.1^2] + sage: IT = A*[A.1+A.2,A.1^2]*A + sage: IT == IL + False + sage: IR == [A.1+A.2,A.1^2]*A + True """ if not isinstance(right, Ideal_nc): return False @@ -289,14 +294,15 @@ class Ideal_nc(Ideal_generic): EXAMPLES:: - sage: A = SteenrodAlgebra(2) - sage: IR = [A.1+A.2,A.1^2]*A - sage: IL = A*[A.1+A.2,A.1^2] - sage: IT = A*[A.1+A.2,A.1^2]*A - sage: IT != IL - True - sage: IR != [A.1+A.2,A.1^2]*A - False + sage: # needs sage.combinat + sage: A = SteenrodAlgebra(2) + sage: IR = [A.1+A.2,A.1^2]*A + sage: IL = A*[A.1+A.2,A.1^2] + sage: IT = A*[A.1+A.2,A.1^2]*A + sage: IT != IL + True + sage: IR != [A.1+A.2,A.1^2]*A + False """ return not self.__eq__(right) @@ -306,14 +312,15 @@ class Ideal_nc(Ideal_generic): EXAMPLES:: - sage: A = SteenrodAlgebra(2) - sage: IR = [A.1+A.2,A.1^2]*A - sage: IL = A*[A.1+A.2,A.1^2] - sage: IT = A*[A.1+A.2,A.1^2]*A - sage: hash(IT) == hash(IL) - False - sage: hash(IR) == hash([A.1^2,A.1+A.2]*A) - True + sage: # needs sage.combinat + sage: A = SteenrodAlgebra(2) + sage: IR = [A.1+A.2,A.1^2]*A + sage: IL = A*[A.1+A.2,A.1^2] + sage: IT = A*[A.1+A.2,A.1^2]*A + sage: hash(IT) == hash(IL) + False + sage: hash(IR) == hash([A.1^2,A.1+A.2]*A) + True """ return hash((self.parent(), self.__side, frozenset(self.gens()))) @@ -323,6 +330,7 @@ class Ideal_nc(Ideal_generic): EXAMPLES:: + sage: # needs sage.combinat sage: A = SteenrodAlgebra(2) sage: IL = A*[A.1+A.2,A.1^2] sage: IR = [A.1+A.2,A.1^2]*A diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx index 8adb1f632ed..f08b37d6d45 100644 --- a/src/sage/rings/rational.pyx +++ b/src/sage/rings/rational.pyx @@ -1990,20 +1990,20 @@ cdef class Rational(sage.structure.element.FieldElement): sage: (1/7).period() # optional - sage.libs.pari 6 - sage: RR(1/7) + sage: RR(1/7) # optional - sage.rings.real_mpfr 0.142857142857143 sage: (1/8).period() # optional - sage.libs.pari 1 - sage: RR(1/8) + sage: RR(1/8) # optional - sage.rings.real_mpfr 0.125000000000000 - sage: RR(1/6) + sage: RR(1/6) # optional - sage.rings.real_mpfr 0.166666666666667 sage: (1/6).period() # optional - sage.libs.pari 1 sage: x = 333/106 sage: x.period() # optional - sage.libs.pari 13 - sage: RealField(200)(x) + sage: RealField(200)(x) # optional - sage.rings.real_mpfr 3.1415094339622641509433962264150943396226415094339622641509 """ cdef unsigned int alpha, beta diff --git a/src/sage/rings/rational_field.py b/src/sage/rings/rational_field.py index 4c7725aaead..ee665002556 100644 --- a/src/sage/rings/rational_field.py +++ b/src/sage/rings/rational_field.py @@ -110,25 +110,26 @@ class RationalField(Singleton, number_field_base.NumberField): :: - sage: QQ(23.2, 2) + sage: QQ(23.2, 2) # optional - sage.rings.real_mpfr 6530219459687219/281474976710656 - sage: 6530219459687219.0/281474976710656 + sage: 6530219459687219.0/281474976710656 # optional - sage.rings.real_mpfr 23.20000000000000 - sage: a = 23.2; a + sage: a = 23.2; a # optional - sage.rings.real_mpfr 23.2000000000000 - sage: QQ(a, 10) + sage: QQ(a, 10) # optional - sage.rings.real_mpfr 116/5 Here's a nice example involving elliptic curves:: - sage: E = EllipticCurve('11a') - sage: L = E.lseries().at1(300)[0]; L + sage: # optional - sage.rings.real_mpfr sage.schemes + sage: E = EllipticCurve('11a') # optional - sage.schemes + sage: L = E.lseries().at1(300)[0]; L # optional - sage.schemes 0.2538418608559106843377589233... - sage: O = E.period_lattice().omega(); O + sage: O = E.period_lattice().omega(); O # optional - sage.schemes 1.26920930427955 - sage: t = L/O; t + sage: t = L/O; t # optional - sage.schemes 0.200000000000000 - sage: QQ(RealField(45)(t)) + sage: QQ(RealField(45)(t)) # optional - sage.rings.real_mpfr sage.schemes 1/5 """ def __new__(cls): @@ -324,7 +325,7 @@ def completion(self, p, prec, extras={}): EXAMPLES:: - sage: QQ.completion(infinity, 53) + sage: QQ.completion(infinity, 53) # optional - sage.rings.real_mpfr Real Field with 53 bits of precision sage: QQ.completion(5, 15, {'print_mode': 'bars'}) # optional - sage.rings.padics 5-adic Field with capped relative precision 15 @@ -675,19 +676,27 @@ def places(self, all_complex=False, prec=None): """ from sage.rings.infinity import Infinity if prec is None: - from sage.rings.real_mpfr import RR as R - from sage.rings.cc import CC as C + if all_complex: + from sage.rings.cc import CC as domain + else: + from sage.rings.real_mpfr import RR as domain elif prec == 53: - from sage.rings.real_double import RDF as R - from sage.rings.complex_double import CDF as C + if all_complex: + from sage.rings.complex_double import CDF as domain + else: + from sage.rings.real_double import RDF as domain elif prec == Infinity: - from sage.rings.qqbar import AA as R, QQbar as C + if all_complex: + from sage.rings.qqbar import QQbar as domain + else: + from sage.rings.qqbar import AA as domain else: - from sage.rings.real_mpfr import RealField - from sage.rings.complex_mpfr import ComplexField - R = RealField(prec) - C = ComplexField(prec) - domain = C if all_complex else R + if all_complex: + from sage.rings.complex_mpfr import ComplexField + domain = ComplexField(prec) + else: + from sage.rings.real_mpfr import RealField + domain = RealField(prec) return [self.hom([domain(1)])] def complex_embedding(self, prec=53): diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index bb5b06d489c..ffa28ed5866 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -103,7 +103,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): EXAMPLES:: - sage: RR == RDF + sage: RR == RDF # needs sage.rings.real_mpfr False sage: RDF == RealDoubleField() # RDF is the shorthand True @@ -281,7 +281,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): EXAMPLES:: - sage: RDF.complex_field() + sage: RDF.complex_field() # needs sage.rings.complex_double Complex Double Field """ from sage.rings.complex_double import CDF @@ -294,7 +294,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): EXAMPLES:: - sage: RDF.algebraic_closure() + sage: RDF.algebraic_closure() # needs sage.rings.complex_double Complex Double Field """ from sage.rings.complex_double import CDF @@ -320,11 +320,11 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): 9499294.0 sage: RDF.coerce(61/3) 20.333333333333332 - sage: parent(RDF(3) + CDF(5)) + sage: parent(RDF(3) + CDF(5)) # needs sage.rings.complex_double Complex Double Field - sage: parent(CDF(5) + RDF(3)) + sage: parent(CDF(5) + RDF(3)) # needs sage.rings.complex_double Complex Double Field - sage: CDF.gen(0) + 5.0 + sage: CDF.gen(0) + 5.0 # needs sage.rings.complex_double 5.0 + 1.0*I sage: RLF(2/3) + RDF(1) 1.6666666666666665 @@ -1027,9 +1027,9 @@ cdef class RealDoubleElement(FieldElement): 3.1415926535897931*x sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() - sage: RDF(22/7)._sage_input_(sib, True) + sage: RDF(22/7)._sage_input_(sib, True) # needs sage.sage.rings.real_mpfr {atomic:3.1428571428571428} - sage: RDF(22/7)._sage_input_(sib, False) + sage: RDF(22/7)._sage_input_(sib, False) # needs sage.sage.rings.real_mpfr {call: {atomic:RDF}({atomic:3.1428571428571428})} """ cdef bint isinf = libc.math.isinf(self._value) diff --git a/src/sage/rings/ring.pyx b/src/sage/rings/ring.pyx index 30933870522..48f7e967326 100644 --- a/src/sage/rings/ring.pyx +++ b/src/sage/rings/ring.pyx @@ -158,7 +158,7 @@ cdef class Ring(ParentWithGens): False sage: QQ._repr_option('element_is_atomic') True - sage: CDF._repr_option('element_is_atomic') + sage: CDF._repr_option('element_is_atomic') # optional - sage.rings.complex_double False Check that categories correctly implement `is_finite` and `cardinality`:: @@ -167,8 +167,8 @@ cdef class Ring(ParentWithGens): False sage: GF(2^10, 'a').is_finite() # optional - sage.rings.finite_rings True - sage: R. = GF(7)[] # optional - sage.rings.finite_rings - sage: R.is_finite() # optional - sage.rings.finite_rings + sage: R. = GF(7)[] + sage: R.is_finite() False sage: S. = R.quo(x^2 + 1) # optional - sage.rings.finite_rings sage: S.is_finite() # optional - sage.rings.finite_rings @@ -879,11 +879,11 @@ cdef class Ring(ParentWithGens): sage: x = polygen(ZZ, 'x') sage: R. = ZZ['x'].quo(x^2) # optional - sage.libs.pari - sage: R.fraction_field() + sage: R.fraction_field() # optional - sage.libs.pari Traceback (most recent call last): ... TypeError: self must be an integral domain. - sage: R.is_integral_domain() + sage: R.is_integral_domain() # optional - sage.libs.pari False Forward the proof flag to ``is_field``, see :trac:`22910`:: @@ -1135,7 +1135,7 @@ cdef class Ring(ParentWithGens): This also works over derived rings:: - sage: RR['x'].epsilon() + sage: RR['x'].epsilon() # optional - sage.rings.real_mpfr 2.22044604925031e-16 sage: QQ['x'].epsilon() 0 From c5509e2d1629e5138e2aced5aa634edfb26bd028 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 2 Jul 2023 19:33:41 -0700 Subject: [PATCH 319/423] Update # optional / # needs --- src/sage/rings/noncommutative_ideals.pyx | 2 +- src/sage/rings/real_mpfr.pyx | 161 ++++++++++++----------- 2 files changed, 84 insertions(+), 79 deletions(-) diff --git a/src/sage/rings/noncommutative_ideals.pyx b/src/sage/rings/noncommutative_ideals.pyx index ec2e9292d55..6965f1c6c61 100644 --- a/src/sage/rings/noncommutative_ideals.pyx +++ b/src/sage/rings/noncommutative_ideals.pyx @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.modules +# sage.doctest: needs sage.modules """ Ideals of non-commutative rings diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index 837ec08319d..15fa8bdffe9 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -654,7 +654,7 @@ cdef class RealField_class(sage.rings.abc.RealField): Traceback (most recent call last): ... ValueError: can only convert signed infinity to RR - sage: R(CIF(NaN)) + sage: R(CIF(NaN)) # needs sage.symbolic NaN sage: R(complex(1.7)) 1.7000 @@ -719,7 +719,7 @@ cdef class RealField_class(sage.rings.abc.RealField): TESTS:: - sage: 1.0 - ZZ(1) - int(1) - 1 - QQ(1) - RealField(100)(1) - AA(1) - RLF(1) # optional - sage.rings.number_field + sage: 1.0 - ZZ(1) - int(1) - 1 - QQ(1) - RealField(100)(1) - AA(1) - RLF(1) # needs sage.rings.number_field -6.00000000000000 sage: R = RR['x'] # Hold reference to avoid garbage collection, see Issue #24709 sage: R.get_action(ZZ) @@ -920,7 +920,7 @@ cdef class RealField_class(sage.rings.abc.RealField): False sage: RR._is_valid_homomorphism_(CC,[CC(1)]) True - sage: RR._is_valid_homomorphism_(GF(2),GF(2)(1)) # optional - sage.rings.finite_rings + sage: RR._is_valid_homomorphism_(GF(2),GF(2)(1)) False """ @@ -1438,12 +1438,12 @@ cdef class RealNumber(sage.structure.element.RingElement): EXAMPLES:: - sage: import numpy # optional - numpy - sage: numpy.arange(10.0) # optional - numpy + sage: import numpy # needs numpy + sage: numpy.arange(10.0) # needs numpy array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]) - sage: numpy.array([1.0, 1.1, 1.2]).dtype # optional - numpy + sage: numpy.array([1.0, 1.1, 1.2]).dtype # needs numpy dtype('float64') - sage: numpy.array([1.000000000000000000000000000000000000]).dtype # optional - numpy + sage: numpy.array([1.000000000000000000000000000000000000]).dtype # needs numpy dtype('O') """ if (self._parent).__prec <= 53: @@ -1604,7 +1604,7 @@ cdef class RealNumber(sage.structure.element.RingElement): 'Infinity' sage: format(RR(-oo), '.4') '-Infinity' - sage: format(RR(NaN), '.4') + sage: format(RR(NaN), '.4') # needs sage.symbolic 'NaN' sage: '{}'.format(RR(oo)) '+infinity' @@ -1652,11 +1652,11 @@ cdef class RealNumber(sage.structure.element.RingElement): sage: n = 1.3939494594 sage: n._interface_init_() '1.3939494593999999' - sage: s1 = RR(sin(1)); s1 + sage: s1 = RR(sin(1)); s1 # needs sage.symbolic 0.841470984807897 - sage: s1._interface_init_() + sage: s1._interface_init_() # needs sage.symbolic '0.84147098480789650' - sage: s1 == RR(gp(s1)) + sage: s1 == RR(gp(s1)) # needs sage.symbolic True """ return self.str(10, no_sci=True) @@ -1680,6 +1680,8 @@ cdef class RealNumber(sage.structure.element.RingElement): EXAMPLES:: + sage: values = [-infinity, -20, 0, 1, 2^500, -2^4000, -2^-500, 2^-4000] + sage: values += [NaN, -e] # needs sage.symbolic sage: for prec in (2, 53, 200): ....: for rnd_dir in ('RNDN', 'RNDD', 'RNDU', 'RNDZ'): ....: fld = RealField(prec, rnd=rnd_dir) @@ -1694,7 +1696,7 @@ cdef class RealNumber(sage.structure.element.RingElement): sage: RR60 = RealField(60) sage: RR(-infinity)._sage_input_(sib, True) {unop:- {call: {atomic:RR}({atomic:Infinity})}} - sage: RR(NaN)._sage_input_(sib, True) + sage: RR(NaN)._sage_input_(sib, True) # needs sage.symbolic {call: {atomic:RR}({atomic:NaN})} sage: RR(12345)._sage_input_(sib, True) {atomic:12345} @@ -1712,9 +1714,9 @@ cdef class RealNumber(sage.structure.element.RingElement): {call: {atomic:RR}({atomic:1.579})} sage: RR(1.579)._sage_input_(sib_np, 2) {atomic:1.579} - sage: RealField(150)(pi)._sage_input_(sib, True) + sage: RealField(150)(pi)._sage_input_(sib, True) # needs sage.symbolic {atomic:3.1415926535897932384626433832795028841971694008} - sage: RealField(150)(pi)._sage_input_(sib_np, True) + sage: RealField(150)(pi)._sage_input_(sib_np, True) # needs sage.symbolic {call: {call: {atomic:RealField}({atomic:150})}({atomic:'3.1415926535897932384626433832795028841971694008'})} """ # We have a bewildering array of conditions to deal with: @@ -2336,7 +2338,7 @@ cdef class RealNumber(sage.structure.element.RingElement): EXAMPLES:: - sage: [x.fp_rank_delta(x.nextabove()) for x in + sage: [x.fp_rank_delta(x.nextabove()) for x in # needs sage.symbolic ....: (RR(-infinity), -1.0, 0.0, 1.0, RR(pi), RR(infinity))] [1, 1, 1, 1, 1, 0] @@ -2517,22 +2519,22 @@ cdef class RealNumber(sage.structure.element.RingElement): EXAMPLES:: - sage: RealField(100)(1/7)._sympy_() + sage: RealField(100)(1/7)._sympy_() # needs sympy 0.14285714285714285714285714286 - sage: type(_) + sage: type(_) # needs sympy TESTS: An indirect doctest to check this (see :trac:`14915`):: - sage: x,y = var('x, y') - sage: integrate(y, y, 0.5, 8*log(x), algorithm='sympy') + sage: x,y = var('x, y') # needs sage.symbolic + sage: integrate(y, y, 0.5, 8*log(x), algorithm='sympy') # needs sympy sage.symbolic 32*log(x)^2 - 0.125000000000000 Check that :trac:`28903` is fixed:: - sage: (10.0^400)._sympy_() + sage: (10.0^400)._sympy_() # needs sympy 1.00000000000000e+400 """ import sympy @@ -3138,11 +3140,11 @@ cdef class RealNumber(sage.structure.element.RingElement): sage: RR(infinity).nexttoward(0) 2.09857871646739e323228496 # 32-bit 5.87565378911159e1388255822130839282 # 64-bit - sage: RR(pi).str() + sage: RR(pi).str() # needs sage.symbolic '3.1415926535897931' - sage: RR(pi).nexttoward(22/7).str() + sage: RR(pi).nexttoward(22/7).str() # needs sage.symbolic '3.1415926535897936' - sage: RR(pi).nexttoward(21/7).str() + sage: RR(pi).nexttoward(21/7).str() # needs sage.symbolic '3.1415926535897927' """ cdef RealNumber other_rn @@ -3172,9 +3174,9 @@ cdef class RealNumber(sage.structure.element.RingElement): 8.50969131174084e-1388255822130839284 # 64-bit sage: RR('+infinity').nextabove() +infinity - sage: RR(-sqrt(2)).str() + sage: RR(-sqrt(2)).str() # needs sage.symbolic '-1.4142135623730951' - sage: RR(-sqrt(2)).nextabove().str() + sage: RR(-sqrt(2)).nextabove().str() # needs sage.symbolic '-1.4142135623730949' """ @@ -3198,9 +3200,9 @@ cdef class RealNumber(sage.structure.element.RingElement): sage: RR('+infinity').nextbelow() 2.09857871646739e323228496 # 32-bit 5.87565378911159e1388255822130839282 # 64-bit - sage: RR(-sqrt(2)).str() + sage: RR(-sqrt(2)).str() # needs sage.symbolic '-1.4142135623730951' - sage: RR(-sqrt(2)).nextbelow().str() + sage: RR(-sqrt(2)).nextbelow().str() # needs sage.symbolic '-1.4142135623730954' """ @@ -3220,9 +3222,9 @@ cdef class RealNumber(sage.structure.element.RingElement): EXAMPLES:: - sage: RR(pi).__float__() + sage: RR(pi).__float__() # needs sage.symbolic 3.141592653589793 - sage: type(RR(pi).__float__()) + sage: type(RR(pi).__float__()) # needs sage.symbolic <... 'float'> """ return mpfr_get_d(self.value, (self._parent).rnd) @@ -3248,9 +3250,9 @@ cdef class RealNumber(sage.structure.element.RingElement): EXAMPLES:: - sage: RR(pi).__int__() # optional - sage.symbolic + sage: RR(pi).__int__() # needs sage.symbolic 3 - sage: type(RR(pi).__int__()) + sage: type(RR(pi).__int__()) # needs sage.symbolic <... 'int'> """ if not mpfr_number_p(self.value): @@ -3266,9 +3268,9 @@ cdef class RealNumber(sage.structure.element.RingElement): EXAMPLES:: - sage: RR(pi).__complex__() # optional - sage.symbolic + sage: RR(pi).__complex__() # needs sage.symbolic (3.141592653589793+0j) - sage: type(RR(pi).__complex__()) + sage: type(RR(pi).__complex__()) # needs sage.symbolic <... 'complex'> """ @@ -3280,9 +3282,9 @@ cdef class RealNumber(sage.structure.element.RingElement): EXAMPLES:: - sage: RR(pi)._complex_number_() # optional - sage.symbolic + sage: RR(pi)._complex_number_() # needs sage.symbolic 3.14159265358979 - sage: parent(RR(pi)._complex_number_()) + sage: parent(RR(pi)._complex_number_()) # needs sage.symbolic Complex Field with 53 bits of precision """ from sage.rings.complex_mpfr import ComplexField @@ -3295,11 +3297,11 @@ cdef class RealNumber(sage.structure.element.RingElement): EXAMPLES:: sage: R = RealField(100) - sage: R(pi) + sage: R(pi) # needs sage.symbolic 3.1415926535897932384626433833 - sage: axiom(R(pi)) # optional - axiom # indirect doctest + sage: axiom(R(pi)) # optional - axiom # needs sage.symbolic 3.1415926535 8979323846 26433833 - sage: fricas(R(pi)) # optional - fricas + sage: fricas(R(pi)) # optional - fricas # needs sage.symbolic 3.1415926535_8979323846_26433833 """ @@ -3320,48 +3322,48 @@ cdef class RealNumber(sage.structure.element.RingElement): EXAMPLES:: - sage: RR(2.0).__pari__() + sage: RR(2.0).__pari__() # needs sage.libs.pari 2.00000000000000 The current Pari precision affects the printing of this number, but Pari does maintain the same 250-bit number on both 32-bit and 64-bit platforms:: - sage: RealField(250).pi().__pari__() + sage: RealField(250).pi().__pari__() # needs sage.libs.pari 3.14159265358979 - sage: RR(0.0).__pari__() + sage: RR(0.0).__pari__() # needs sage.libs.pari 0.E-19 - sage: RR(-1.234567).__pari__() + sage: RR(-1.234567).__pari__() # needs sage.libs.pari -1.23456700000000 - sage: RR(2.0).sqrt().__pari__() + sage: RR(2.0).sqrt().__pari__() # needs sage.libs.pari 1.41421356237310 - sage: RR(2.0).sqrt().__pari__().sage() + sage: RR(2.0).sqrt().__pari__().sage() # needs sage.libs.pari 1.41421356237309515 - sage: RR(2.0).sqrt().__pari__().sage().prec() + sage: RR(2.0).sqrt().__pari__().sage().prec() # needs sage.libs.pari 64 - sage: RealField(70)(pi).__pari__().sage().prec() + sage: RealField(70)(pi).__pari__().sage().prec() # needs sage.libs.pari sage.symbolic 96 # 32-bit 128 # 64-bit - sage: for i in range(100, 200): + sage: for i in range(100, 200): # needs sage.libs.pari ....: assert(RR(i).sqrt() == RR(i).sqrt().__pari__().sage()) TESTS: Check that we create real zeros without mantissa:: - sage: RDF(0).__pari__().sizeword() + sage: RDF(0).__pari__().sizeword() # needs sage.libs.pari 2 - sage: RealField(100)(0.0).__pari__().sizeword() + sage: RealField(100)(0.0).__pari__().sizeword() # needs sage.libs.pari 2 Check that the largest and smallest exponents representable by PARI convert correctly:: - sage: a = pari(0.5) << (sys.maxsize+1)/4 - sage: RR(a) >> (sys.maxsize+1)/4 + sage: a = pari(0.5) << (sys.maxsize+1)/4 # needs sage.libs.pari + sage: RR(a) >> (sys.maxsize+1)/4 # needs sage.libs.pari 0.500000000000000 - sage: a = pari(0.5) >> (sys.maxsize-3)/4 - sage: RR(a) << (sys.maxsize-3)/4 + sage: a = pari(0.5) >> (sys.maxsize-3)/4 # needs sage.libs.pari + sage: RR(a) << (sys.maxsize-3)/4 # needs sage.libs.pari 0.500000000000000 """ # This uses interfaces of MPFR and PARI which are documented @@ -3516,7 +3518,7 @@ cdef class RealNumber(sage.structure.element.RingElement): 42391158275216203520420085760 sage: RR(3^60).exact_rational() - 3^60 6125652559 - sage: RealField(5)(-pi).exact_rational() + sage: RealField(5)(-pi).exact_rational() # needs sage.symbolic -25/8 TESTS:: @@ -3620,9 +3622,9 @@ cdef class RealNumber(sage.structure.element.RingElement): -1/3 sage: check(RR(-1/3)) -1/3 - sage: check(RealField(20)(pi)) + sage: check(RealField(20)(pi)) # needs sage.symbolic 355/113 - sage: check(RR(pi)) + sage: check(RR(pi)) # needs sage.symbolic 245850922/78256779 sage: check(RR(2).sqrt()) 131836323/93222358 @@ -3786,13 +3788,13 @@ cdef class RealNumber(sage.structure.element.RingElement): -333/1000 sage: RR(3/4).nearby_rational(max_denominator=2) 1 - sage: RR(pi).nearby_rational(max_denominator=120) + sage: RR(pi).nearby_rational(max_denominator=120) # needs sage.symbolic 355/113 - sage: RR(pi).nearby_rational(max_denominator=10000) + sage: RR(pi).nearby_rational(max_denominator=10000) # needs sage.symbolic 355/113 - sage: RR(pi).nearby_rational(max_denominator=100000) + sage: RR(pi).nearby_rational(max_denominator=100000) # needs sage.symbolic 312689/99532 - sage: RR(pi).nearby_rational(max_denominator=1) + sage: RR(pi).nearby_rational(max_denominator=1) # needs sage.symbolic 3 sage: RR(-3.5).nearby_rational(max_denominator=1) -3 @@ -4096,7 +4098,7 @@ cdef class RealNumber(sage.structure.element.RingElement): True sage: RR('-100').is_real() True - sage: RR(NaN).is_real() + sage: RR(NaN).is_real() # needs sage.symbolic False """ return not mpfr_nan_p(self.value) @@ -4241,7 +4243,7 @@ cdef class RealNumber(sage.structure.element.RingElement): :: sage: r = 4344 - sage: r.sqrt() + sage: r.sqrt() # needs sage.symbolic 2*sqrt(1086) :: @@ -4357,10 +4359,10 @@ cdef class RealNumber(sage.structure.element.RingElement): We raise a real number to a symbolic object:: - sage: x, y = var('x,y') - sage: 1.5^x + sage: x, y = var('x,y') # needs sage.symbolic + sage: 1.5^x # needs sage.symbolic 1.50000000000000^x - sage: -2.3^(x+y^3+sin(x)) + sage: -2.3^(x+y^3+sin(x)) # needs sage.symbolic -2.30000000000000^(y^3 + x + sin(x)) TESTS: @@ -4418,21 +4420,21 @@ cdef class RealNumber(sage.structure.element.RingElement): 0.693147180559945 sage: log(RR(2), "e") 0.693147180559945 - sage: log(RR(2), e) + sage: log(RR(2), e) # needs sage.symbolic 0.693147180559945 :: sage: r = R(-1); r.log() 3.14159265358979*I - sage: log(RR(-1),e) + sage: log(RR(-1), e) # needs sage.symbolic 3.14159265358979*I sage: r.log(2) 4.53236014182719*I For the error value NaN (Not A Number), log will return NaN:: - sage: r = R(NaN); r.log() + sage: r = R(NaN); r.log() # needs sage.symbolic NaN """ @@ -5121,8 +5123,8 @@ cdef class RealNumber(sage.structure.element.RingElement): :: sage: m = (a-b)^2/(a+b)^2 - sage: E = numerical_integral(1/sqrt(1-m*sin(x)^2), 0, RR.pi()/2)[0] - sage: RR.pi()/4 * (a+b)/E + sage: E = numerical_integral(1/sqrt(1-m*sin(x)^2), 0, RR.pi()/2)[0] # needs sage.symbolic + sage: RR.pi()/4 * (a+b)/E # needs sage.symbolic 1.96811775182478 TESTS:: @@ -5352,11 +5354,11 @@ cdef class RealNumber(sage.structure.element.RingElement): Computing zeta using PARI is much more efficient in difficult cases. Here's how to compute zeta with at least a given precision:: - sage: z = pari(2).zeta(precision=53); z # optional - sage.libs.pari + sage: z = pari(2).zeta(precision=53); z # needs sage.libs.pari 1.64493406684823 - sage: pari(2).zeta(precision=128).sage().prec() # optional - sage.libs.pari + sage: pari(2).zeta(precision=128).sage().prec() # needs sage.libs.pari 128 - sage: pari(2).zeta(precision=65).sage().prec() # optional - sage.libs.pari + sage: pari(2).zeta(precision=65).sage().prec() # needs sage.libs.pari 128 # 64-bit 96 # 32-bit @@ -5368,9 +5370,9 @@ cdef class RealNumber(sage.structure.element.RingElement): :: - sage: type(z) # optional - sage.libs.pari + sage: type(z) # needs sage.libs.pari - sage: R(z) # optional - sage.libs.pari + sage: R(z) # needs sage.libs.pari 1.64493406684823 """ cdef RealNumber x = self._new() @@ -5523,8 +5525,11 @@ cdef class RealNumber(sage.structure.element.RingElement): sage: check(RealField(20)(22/7), 19) [1.0621, 1.0621, 1.0622, 1.0621] - sage: check(RealField(200)(e), 4) - [1.2840254166877414840734205680624364583362808652814630892175, 1.2840254166877414840734205680624364583362808652814630892175, 1.2840254166877414840734205680624364583362808652814630892176, 1.2840254166877414840734205680624364583362808652814630892175] + sage: check(RealField(200)(e), 4) # needs sage.symbolic + [1.2840254166877414840734205680624364583362808652814630892175, + 1.2840254166877414840734205680624364583362808652814630892175, + 1.2840254166877414840734205680624364583362808652814630892176, + 1.2840254166877414840734205680624364583362808652814630892175] Check that :trac:`12105` is fixed:: @@ -5937,7 +5942,7 @@ def is_RealNumber(x): False sage: is_RealNumber(RDF(2)) False - sage: is_RealNumber(pi) + sage: is_RealNumber(pi) # needs sage.symbolic False """ return isinstance(x, RealNumber) From d32e0de03cf7b08cc97568f24046053e796804c1 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 3 Jul 2023 00:26:23 -0700 Subject: [PATCH 320/423] sage.schemes: Update # needs --- src/sage/rings/laurent_series_ring.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/rings/laurent_series_ring.py b/src/sage/rings/laurent_series_ring.py index 90f926035d7..ccf3e9fa271 100644 --- a/src/sage/rings/laurent_series_ring.py +++ b/src/sage/rings/laurent_series_ring.py @@ -405,7 +405,6 @@ def _element_constructor_(self, x, n=0, prec=infinity): EXAMPLES:: sage: R. = LaurentSeriesRing(Qp(5, 10)) # optional - sage.rings.padics - sage: S. = LaurentSeriesRing(RationalField()) # optional - sage.rings.padics sage: R(t + t^2 + O(t^3)) # optional - sage.rings.padics (1 + O(5^10))*u + (1 + O(5^10))*u^2 + O(u^3) sage: R(t + t^2 + O(t^3), prec=2) # optional - sage.rings.padics @@ -442,6 +441,7 @@ def _element_constructor_(self, x, n=0, prec=infinity): Check that :trac:`28993` is fixed:: sage: from sage.modular.etaproducts import qexp_eta # optional - sage.modular + sage: S. = LaurentSeriesRing(RationalField()) sage: qexp_eta(S, prec=30) # optional - sage.modular 1 - t - t^2 + t^5 + t^7 - t^12 - t^15 + t^22 + t^26 + O(t^30) From aea10e2b74e8327f6c32eadd900d4c9a765936f4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 11 Jul 2023 13:50:00 -0700 Subject: [PATCH 321/423] src/sage/rings/laurent_series_ring.py: Restore a lost doctest line --- src/sage/rings/laurent_series_ring.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sage/rings/laurent_series_ring.py b/src/sage/rings/laurent_series_ring.py index ccf3e9fa271..b8d7ec38f40 100644 --- a/src/sage/rings/laurent_series_ring.py +++ b/src/sage/rings/laurent_series_ring.py @@ -405,6 +405,7 @@ def _element_constructor_(self, x, n=0, prec=infinity): EXAMPLES:: sage: R. = LaurentSeriesRing(Qp(5, 10)) # optional - sage.rings.padics + sage: S. = LaurentSeriesRing(RationalField()) # optional - sage.rings.padics sage: R(t + t^2 + O(t^3)) # optional - sage.rings.padics (1 + O(5^10))*u + (1 + O(5^10))*u^2 + O(u^3) sage: R(t + t^2 + O(t^3), prec=2) # optional - sage.rings.padics From b22ee693f576cbcb254eb378a84859b866c5467a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 12 Jul 2023 18:39:31 -0700 Subject: [PATCH 322/423] ./sage -fixdoctests --distribution sagemath-categories --probe all --only-tags src/sage/rings/*.{py,pyx} --- src/sage/rings/abc.pyx | 84 +- src/sage/rings/big_oh.py | 2 +- src/sage/rings/complex_arb.pyx | 151 +-- src/sage/rings/complex_conversion.pyx | 2 +- src/sage/rings/complex_double.pyx | 130 +-- src/sage/rings/complex_interval.pyx | 39 +- src/sage/rings/complex_interval_field.py | 4 +- src/sage/rings/complex_mpc.pyx | 22 +- src/sage/rings/complex_mpfr.pyx | 159 +-- src/sage/rings/continued_fraction.py | 414 ++++---- src/sage/rings/continued_fraction_gosper.py | 27 +- src/sage/rings/derivation.py | 174 ++-- src/sage/rings/factorint.pyx | 17 +- src/sage/rings/fraction_field.py | 143 +-- src/sage/rings/fraction_field_element.pyx | 128 +-- src/sage/rings/ideal.py | 232 ++--- src/sage/rings/ideal_monoid.py | 75 +- src/sage/rings/infinity.py | 137 +-- src/sage/rings/integer.pyx | 500 +++++----- src/sage/rings/integer_ring.pyx | 88 +- src/sage/rings/laurent_series_ring.py | 114 ++- .../rings/laurent_series_ring_element.pyx | 95 +- src/sage/rings/lazy_series.py | 792 ++++++++------- src/sage/rings/lazy_series_ring.py | 354 +++---- src/sage/rings/localization.py | 257 ++--- src/sage/rings/monomials.py | 4 +- src/sage/rings/morphism.pyx | 941 +++++++++--------- src/sage/rings/multi_power_series_ring.py | 99 +- .../rings/multi_power_series_ring_element.py | 238 ++--- src/sage/rings/numbers_abc.py | 16 +- src/sage/rings/power_series_poly.pyx | 127 +-- src/sage/rings/power_series_ring.py | 112 ++- src/sage/rings/power_series_ring_element.pyx | 233 ++--- src/sage/rings/puiseux_series_ring.py | 22 +- .../rings/puiseux_series_ring_element.pyx | 25 +- src/sage/rings/qqbar.py | 786 ++++++++------- src/sage/rings/quotient_ring.py | 357 +++---- src/sage/rings/quotient_ring_element.py | 380 +++---- src/sage/rings/rational.pyx | 250 ++--- src/sage/rings/rational_field.py | 144 +-- src/sage/rings/real_arb.pyx | 132 +-- src/sage/rings/real_double.pyx | 41 +- src/sage/rings/real_double_element_gsl.pyx | 12 +- src/sage/rings/real_lazy.pyx | 30 +- src/sage/rings/real_mpfi.pyx | 138 +-- src/sage/rings/real_mpfr.pyx | 26 +- src/sage/rings/ring.pyx | 416 ++++---- src/sage/rings/ring_extension.pyx | 716 ++++++------- src/sage/rings/ring_extension_element.pyx | 435 ++++---- src/sage/rings/ring_extension_morphism.pyx | 253 ++--- src/sage/rings/tate_algebra_ideal.pyx | 16 +- src/sage/rings/tests.py | 64 +- src/sage/rings/universal_cyclotomic_field.py | 20 +- 53 files changed, 5257 insertions(+), 4916 deletions(-) diff --git a/src/sage/rings/abc.pyx b/src/sage/rings/abc.pyx index d0785dff8c2..860827b5ca5 100644 --- a/src/sage/rings/abc.pyx +++ b/src/sage/rings/abc.pyx @@ -14,13 +14,13 @@ class NumberField_quadratic(Field): EXAMPLES:: sage: import sage.rings.abc - sage: K. = QuadraticField(2) # optional - sage.rings.number_field - sage: isinstance(K, sage.rings.abc.NumberField_quadratic) # optional - sage.rings.number_field + sage: K. = QuadraticField(2) # needs sage.rings.number_field + sage: isinstance(K, sage.rings.abc.NumberField_quadratic) # needs sage.rings.number_field True By design, there is a unique direct subclass:: - sage: sage.rings.abc.NumberField_quadratic.__subclasses__() # optional - sage.rings.number_field + sage: sage.rings.abc.NumberField_quadratic.__subclasses__() # needs sage.rings.number_field [] sage: len(sage.rings.abc.NumberField_quadratic.__subclasses__()) <= 1 @@ -40,13 +40,13 @@ class NumberField_cyclotomic(Field): EXAMPLES:: sage: import sage.rings.abc - sage: K. = CyclotomicField(15) # optional - sage.rings.number_field - sage: isinstance(K, sage.rings.abc.NumberField_cyclotomic) # optional - sage.rings.number_field + sage: K. = CyclotomicField(15) # needs sage.rings.number_field + sage: isinstance(K, sage.rings.abc.NumberField_cyclotomic) # needs sage.rings.number_field True By design, there is a unique direct subclass:: - sage: sage.rings.abc.NumberField_cyclotomic.__subclasses__() # optional - sage.rings.number_field + sage: sage.rings.abc.NumberField_cyclotomic.__subclasses__() # needs sage.rings.number_field [] sage: len(sage.rings.abc.NumberField_cyclotomic.__subclasses__()) <= 1 @@ -66,13 +66,13 @@ class UniversalCyclotomicField(Field): EXAMPLES:: sage: import sage.rings.abc - sage: K = UniversalCyclotomicField() # optional - sage.rings.number_field - sage: isinstance(K, sage.rings.abc.UniversalCyclotomicField) # optional - sage.rings.number_field + sage: K = UniversalCyclotomicField() # needs sage.rings.number_field + sage: isinstance(K, sage.rings.abc.UniversalCyclotomicField) # needs sage.rings.number_field True By design, there is a unique direct subclass:: - sage: sage.rings.abc.UniversalCyclotomicField.__subclasses__() # optional - sage.rings.number_field + sage: sage.rings.abc.UniversalCyclotomicField.__subclasses__() # needs sage.rings.number_field [] sage: len(sage.rings.abc.NumberField_cyclotomic.__subclasses__()) <= 1 @@ -92,16 +92,16 @@ class AlgebraicField_common(Field): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(QQbar, sage.rings.abc.AlgebraicField_common) # optional - sage.rings.number_field + sage: isinstance(QQbar, sage.rings.abc.AlgebraicField_common) # needs sage.rings.number_field True - sage: isinstance(AA, sage.rings.abc.AlgebraicField_common) # optional - sage.rings.number_field + sage: isinstance(AA, sage.rings.abc.AlgebraicField_common) # needs sage.rings.number_field True By design, other than the abstract subclasses :class:`~sage.rings.abc.AlgebraicField` and :class:`~sage.rings.abc.AlgebraicRealField`, there is only one direct implementation subclass:: - sage: sage.rings.abc.AlgebraicField_common.__subclasses__() # optional - sage.rings.number_field + sage: sage.rings.abc.AlgebraicField_common.__subclasses__() # needs sage.rings.number_field [, , ] @@ -123,14 +123,14 @@ class AlgebraicField(AlgebraicField_common): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(QQbar, sage.rings.abc.AlgebraicField) # optional - sage.rings.number_field + sage: isinstance(QQbar, sage.rings.abc.AlgebraicField) # needs sage.rings.number_field True - sage: isinstance(AA, sage.rings.abc.AlgebraicField) # optional - sage.rings.number_field + sage: isinstance(AA, sage.rings.abc.AlgebraicField) # needs sage.rings.number_field False By design, there is a unique direct subclass:: - sage: sage.rings.abc.AlgebraicField.__subclasses__() # optional - sage.rings.number_field + sage: sage.rings.abc.AlgebraicField.__subclasses__() # needs sage.rings.number_field [] sage: len(sage.rings.abc.AlgebraicField.__subclasses__()) <= 1 @@ -150,14 +150,14 @@ class AlgebraicRealField(AlgebraicField_common): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(QQbar, sage.rings.abc.AlgebraicRealField) # optional - sage.rings.number_field + sage: isinstance(QQbar, sage.rings.abc.AlgebraicRealField) # needs sage.rings.number_field False - sage: isinstance(AA, sage.rings.abc.AlgebraicRealField) # optional - sage.rings.number_field + sage: isinstance(AA, sage.rings.abc.AlgebraicRealField) # needs sage.rings.number_field True By design, there is a unique direct subclass:: - sage: sage.rings.abc.AlgebraicRealField.__subclasses__() # optional - sage.rings.number_field + sage: sage.rings.abc.AlgebraicRealField.__subclasses__() # needs sage.rings.number_field [] sage: len(sage.rings.abc.AlgebraicRealField.__subclasses__()) <= 1 @@ -177,12 +177,12 @@ cdef class RealField(Field): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(RR, sage.rings.abc.RealField) # optional - sage.rings.real_mpfr + sage: isinstance(RR, sage.rings.abc.RealField) # needs sage.rings.real_mpfr True By design, there is a unique direct subclass:: - sage: sage.rings.abc.RealField.__subclasses__() # optional - sage.rings.real_mpfr + sage: sage.rings.abc.RealField.__subclasses__() # needs sage.rings.real_mpfr [] sage: len(sage.rings.abc.RealField.__subclasses__()) <= 1 @@ -202,12 +202,12 @@ class RealBallField(Field): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(RBF, sage.rings.abc.RealBallField) # optional - sage.libs.flint + sage: isinstance(RBF, sage.rings.abc.RealBallField) # needs sage.libs.flint True By design, there is a unique direct subclass:: - sage: sage.rings.abc.RealBallField.__subclasses__() # optional - sage.libs.flint + sage: sage.rings.abc.RealBallField.__subclasses__() # needs sage.libs.flint [] sage: len(sage.rings.abc.RealBallField.__subclasses__()) <= 1 @@ -277,12 +277,12 @@ cdef class ComplexField(Field): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(CC, sage.rings.abc.ComplexField) # optional - sage.rings.real_mpfr + sage: isinstance(CC, sage.rings.abc.ComplexField) # needs sage.rings.real_mpfr True By design, there is a unique direct subclass:: - sage: sage.rings.abc.ComplexField.__subclasses__() # optional - sage.rings.real_mpfr + sage: sage.rings.abc.ComplexField.__subclasses__() # needs sage.rings.real_mpfr [] sage: len(sage.rings.abc.ComplexField.__subclasses__()) <= 1 @@ -302,12 +302,12 @@ class ComplexBallField(Field): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(CBF, sage.rings.abc.ComplexBallField) # optional - sage.libs.flint + sage: isinstance(CBF, sage.rings.abc.ComplexBallField) # needs sage.libs.flint True By design, there is a unique direct subclass:: - sage: sage.rings.abc.ComplexBallField.__subclasses__() # optional - sage.libs.flint + sage: sage.rings.abc.ComplexBallField.__subclasses__() # needs sage.libs.flint [] sage: len(sage.rings.abc.ComplexBallField.__subclasses__()) <= 1 @@ -352,12 +352,12 @@ cdef class ComplexDoubleField(Field): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(CDF, sage.rings.abc.ComplexDoubleField) # optional - sage.rings.complex_double + sage: isinstance(CDF, sage.rings.abc.ComplexDoubleField) # needs sage.rings.complex_double True By design, there is a unique direct subclass:: - sage: sage.rings.abc.ComplexDoubleField.__subclasses__() # optional - sage.rings.complex_double + sage: sage.rings.abc.ComplexDoubleField.__subclasses__() # needs sage.rings.complex_double [] sage: len(sage.rings.abc.ComplexDoubleField.__subclasses__()) <= 1 @@ -403,13 +403,13 @@ class Order: sage: import sage.rings.abc sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 + 1); O = K.order(2*a) # optional - sage.rings.number_field - sage: isinstance(O, sage.rings.abc.Order) # optional - sage.rings.number_field + sage: K. = NumberField(x^2 + 1); O = K.order(2*a) # needs sage.rings.number_field + sage: isinstance(O, sage.rings.abc.Order) # needs sage.rings.number_field True By design, there is a unique direct subclass:: - sage: sage.rings.abc.Order.__subclasses__() # optional - sage.rings.number_field + sage: sage.rings.abc.Order.__subclasses__() # needs sage.rings.number_field [] sage: len(sage.rings.abc.Order.__subclasses__()) <= 1 @@ -429,14 +429,14 @@ class pAdicRing(EuclideanDomain): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(Zp(5), sage.rings.abc.pAdicRing) # optional - sage.rings.padics + sage: isinstance(Zp(5), sage.rings.abc.pAdicRing) # needs sage.rings.padics True - sage: isinstance(Qp(5), sage.rings.abc.pAdicRing) # optional - sage.rings.padics + sage: isinstance(Qp(5), sage.rings.abc.pAdicRing) # needs sage.rings.padics False By design, there is a unique direct subclass:: - sage: sage.rings.abc.pAdicRing.__subclasses__() # optional - sage.rings.padics + sage: sage.rings.abc.pAdicRing.__subclasses__() # needs sage.rings.padics [] sage: len(sage.rings.abc.pAdicRing.__subclasses__()) <= 1 @@ -456,14 +456,14 @@ class pAdicField(Field): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(Zp(5), sage.rings.abc.pAdicField) # optional - sage.rings.padics + sage: isinstance(Zp(5), sage.rings.abc.pAdicField) # needs sage.rings.padics False - sage: isinstance(Qp(5), sage.rings.abc.pAdicField) # optional - sage.rings.padics + sage: isinstance(Qp(5), sage.rings.abc.pAdicField) # needs sage.rings.padics True By design, there is a unique direct subclass:: - sage: sage.rings.abc.pAdicField.__subclasses__() # optional - sage.rings.padics + sage: sage.rings.abc.pAdicField.__subclasses__() # needs sage.rings.padics [] sage: len(sage.rings.abc.pAdicField.__subclasses__()) <= 1 @@ -483,13 +483,13 @@ cdef class SymbolicRing(CommutativeRing): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(SR, sage.rings.abc.SymbolicRing) # optional - sage.symbolic + sage: isinstance(SR, sage.rings.abc.SymbolicRing) # needs sage.symbolic True By design, other than the abstract subclass :class:`~sage.rings.abc.CallableSymbolicExpressionRing`, there is only one direct implementation subclass:: - sage: sage.rings.abc.SymbolicRing.__subclasses__() # optional - sage.symbolic + sage: sage.rings.abc.SymbolicRing.__subclasses__() # needs sage.symbolic [, ] @@ -510,13 +510,13 @@ class CallableSymbolicExpressionRing(SymbolicRing): EXAMPLES:: sage: import sage.rings.abc - sage: f = x.function(x).parent() # optional - sage.symbolic - sage: isinstance(f, sage.rings.abc.CallableSymbolicExpressionRing) # optional - sage.symbolic + sage: f = x.function(x).parent() # needs sage.symbolic + sage: isinstance(f, sage.rings.abc.CallableSymbolicExpressionRing) # needs sage.symbolic True By design, there is a unique direct subclass:: - sage: sage.rings.abc.CallableSymbolicExpressionRing.__subclasses__() # optional - sage.symbolic + sage: sage.rings.abc.CallableSymbolicExpressionRing.__subclasses__() # needs sage.symbolic [] sage: len(sage.rings.abc.CallableSymbolicExpressionRing.__subclasses__()) <= 1 diff --git a/src/sage/rings/big_oh.py b/src/sage/rings/big_oh.py index 21938a2256b..e9b22e77b37 100644 --- a/src/sage/rings/big_oh.py +++ b/src/sage/rings/big_oh.py @@ -119,7 +119,7 @@ def O(*x, **kwds): Traceback (most recent call last): ... ArithmeticError: O(y) not defined - sage: O(x, y) # needs sage.symbolic + sage: O(x, y) Traceback (most recent call last): ... ArithmeticError: O(x, y) not defined diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx index ef432c1e945..f8d490f12c3 100644 --- a/src/sage/rings/complex_arb.pyx +++ b/src/sage/rings/complex_arb.pyx @@ -101,13 +101,14 @@ Coercion Automatic coercions work as expected:: - sage: bpol = 1/3*CBF(i) + AA(sqrt(2)) # optional - sage.symbolic - sage: bpol += polygen(RealBallField(20), 'x') + QQbar(i) # optional - sage.symbolic - sage: bpol # optional - sage.symbolic + sage: # needs sage.symbolic + sage: bpol = 1/3*CBF(i) + AA(sqrt(2)) + sage: bpol += polygen(RealBallField(20), 'x') + QQbar(i) + sage: bpol x + [1.41421 +/- ...e-6] + [1.33333 +/- ...e-6]*I - sage: bpol.parent() # optional - sage.symbolic + sage: bpol.parent() Univariate Polynomial Ring in x over Complex ball field with 20 bits of precision - sage: bpol/3 # optional - sage.symbolic + sage: bpol/3 ([0.333333 +/- ...e-7])*x + [0.47140 +/- ...e-6] + [0.44444 +/- ...e-6]*I TESTS:: @@ -117,12 +118,12 @@ TESTS:: :: - sage: SR.coerce(CBF(0.42 + 3.33*I)) # optional - sage.symbolic + sage: SR.coerce(CBF(0.42 + 3.33*I)) # needs sage.symbolic [0.4200000000000000 +/- ...e-17] + [3.330000000000000 +/- ...e-17]*I Check that :trac:`19839` is fixed:: - sage: log(SR(CBF(0.42))).pyobject().parent() # optional - sage.symbolic + sage: log(SR(CBF(0.42))).pyobject().parent() # needs sage.symbolic Complex ball field with 53 bits of precision :trac:`24621`:: @@ -591,15 +592,15 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField): 1.000000000000000 sage: CBF(1, 1) 1.000000000000000 + 1.000000000000000*I - sage: CBF(pi, sqrt(2)) # optional - sage.symbolic + sage: CBF(pi, sqrt(2)) # needs sage.symbolic [3.141592653589793 +/- ...e-16] + [1.414213562373095 +/- ...e-16]*I sage: CBF(I) 1.000000000000000*I - sage: CBF(pi + I/3) # optional - sage.symbolic + sage: CBF(pi + I/3) # needs sage.symbolic [3.141592653589793 +/- ...e-16] + [0.3333333333333333 +/- ...e-17]*I sage: CBF(QQbar(i/7)) # abs tol 1e-16 [0.1428571428571429 +/- 4.29e-17]*I - sage: CBF(AA(sqrt(2))) # optional - sage.symbolic + sage: CBF(AA(sqrt(2))) # needs sage.symbolic [1.414213562373095 +/- ...e-16] sage: CBF(CIF(0, 1)) 1.000000000000000*I @@ -616,9 +617,9 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField): sage: NF. = QuadraticField(-2) sage: CBF(1/5 + a/2) [0.2000000000000000 +/- ...e-17] + [0.707106781186547 +/- ...e-16]*I - sage: CBF(infinity, NaN) + sage: CBF(infinity, NaN) # needs sage.symbolic [+/- inf] + nan*I - sage: CBF(x) + sage: CBF(x) # needs sage.symbolic Traceback (most recent call last): ... TypeError: unable to convert x to a ComplexBall @@ -636,13 +637,14 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField): The following conversions used to yield incorrect enclosures:: - sage: a = CBF(airy_ai(1)); a # optional - sage.symbolic + sage: # needs sage.symbolic + sage: a = CBF(airy_ai(1)); a [0.1352924163128814 +/- 6.95e-17] - sage: a.overlaps(ComplexBallField(100).one().airy_ai()) # optional - sage.symbolic + sage: a.overlaps(ComplexBallField(100).one().airy_ai()) True - sage: v = CBF(zetaderiv(1, 3/2)); v # optional - sage.symbolic + sage: v = CBF(zetaderiv(1, 3/2)); v [-3.932239737431101 +/- 5.58e-16] - sage: v.overlaps(ComplexBallField(100)(3/2).zetaderiv(1)) # optional - sage.symbolic + sage: v.overlaps(ComplexBallField(100)(3/2).zetaderiv(1)) True """ try: @@ -1077,7 +1079,7 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField): ....: return CBF(NaN) ....: else: ....: return z.sqrt() - sage: CBF.integral(my_sqrt, -1 + CBF(i), -1 - CBF(i)) + sage: CBF.integral(my_sqrt, -1 + CBF(i), -1 - CBF(i)) # needs sage.symbolic [+/- ...e-14] + [-0.4752076627926 +/- 5...e-14]*I Note, though, that proper handling of the ``analytic`` flag is required @@ -1085,7 +1087,7 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField): sage: correct = CBF.integral(my_sqrt, 1, 2); correct [1.21895141649746 +/- ...e-15] - sage: RBF(integral(sqrt(x), x, 1, 2)) # long time # optional - sage.symbolic + sage: RBF(integral(sqrt(x), x, 1, 2)) # long time # needs sage.symbolic [1.21895141649746 +/- ...e-15] sage: wrong = CBF.integral(lambda z, _: z.sqrt(), 1, 2) # WRONG! sage: correct - wrong @@ -1348,7 +1350,7 @@ cdef class ComplexBall(RingElement): 0 sage: ComplexBall(CBF100, ComplexBall(CBF53, ComplexBall(CBF100, 1/3))) [0.333333333333333333333333333333 +/- ...e-31] - sage: ComplexBall(CBF100, RBF(pi)) + sage: ComplexBall(CBF100, RBF(pi)) # needs sage.symbolic [3.141592653589793 +/- ...e-16] sage: ComplexBall(CBF100, -3r) @@ -1512,7 +1514,7 @@ cdef class ComplexBall(RingElement): TESTS:: - sage: [loads(dumps(b)).identical(b) for b in + sage: [loads(dumps(b)).identical(b) for b in # needs sage.symbolic ....: [ComplexBallField(60)(1/3 + i*pi), CBF(NaN)]] [True, True] """ @@ -2104,9 +2106,9 @@ cdef class ComplexBall(RingElement): sage: CBF(17, 1023).nbits() 10 - sage: CBF(1/3, NaN).nbits() + sage: CBF(1/3, NaN).nbits() # needs sage.symbolic 53 - sage: CBF(NaN).nbits() + sage: CBF(NaN).nbits() # needs sage.symbolic 0 """ return acb_bits(self.value) @@ -2121,13 +2123,13 @@ cdef class ComplexBall(RingElement): their parent's nominal precision (see :mod:`~sage.rings.real_arb` for more information):: - sage: b = CBF(exp(I*pi/3).n(100)) - sage: b.mid() + sage: b = CBF(exp(I*pi/3).n(100)) # needs sage.symbolic + sage: b.mid() # needs sage.symbolic 0.50000000000000000000000000000 + 0.86602540378443864676372317075*I The ``round()`` method rounds such a ball to its parent's precision:: - sage: b.round().mid() + sage: b.round().mid() # needs sage.symbolic 0.500000000000000 + 0.866025403784439*I .. SEEALSO:: :meth:`trim` @@ -2150,7 +2152,7 @@ cdef class ComplexBall(RingElement): EXAMPLES:: - sage: CBF(exp(I*pi/3)).accuracy() + sage: CBF(exp(I*pi/3)).accuracy() # needs sage.symbolic 51 sage: CBF(I/2).accuracy() == CBF.base().maximal_accuracy() True @@ -2218,7 +2220,7 @@ cdef class ComplexBall(RingElement): EXAMPLES:: - sage: CBF(NaN).is_NaN() + sage: CBF(NaN).is_NaN() # needs sage.symbolic True sage: CBF(-5).gamma().is_NaN() True @@ -2261,7 +2263,7 @@ cdef class ComplexBall(RingElement): EXAMPLES:: - sage: CBF(pi, 1/3).is_nonzero() + sage: CBF(pi, 1/3).is_nonzero() # needs sage.symbolic True sage: CBF(RIF(-0.5, 0.5), 1/3).is_nonzero() True @@ -2505,7 +2507,7 @@ cdef class ComplexBall(RingElement): sage: CBF(1).contains_exact(CBF(1)) True - sage: CBF(sqrt(2)).contains_exact(sqrt(2)) # optional - sage.symbolic + sage: CBF(sqrt(2)).contains_exact(sqrt(2)) # needs sage.symbolic Traceback (most recent call last): ... TypeError: unsupported type: @@ -2805,7 +2807,7 @@ cdef class ComplexBall(RingElement): sage: CBF(-1)**(1/2) 1.000000000000000*I - sage: CBF(e)**CBF(i*pi) + sage: CBF(e)**CBF(i*pi) # needs sage.symbolic [-1.00000000000000 +/- ...e-16] + [+/- ...e-15]*I sage: CBF(0, 1)**AA(2)**(1/2) [-0.60569986707881 +/- ...e-15] + [0.79569320156748 +/- ...e-15]*I @@ -2824,13 +2826,13 @@ cdef class ComplexBall(RingElement): TESTS:: - sage: (CBF(e)**CBF(i))**RBF(pi) + sage: (CBF(e)**CBF(i))**RBF(pi) # needs sage.symbolic [-1.0000000000000 +/- ...e-15] + [+/- ...e-15]*I sage: CBF(2*i)**10r -1024.000000000000 sage: CBF(1,1) ^ -1r 0.5000000000000000 - 0.5000000000000000*I - sage: CBF(2)**SR.var('x') # optional - sage.symbolic + sage: CBF(2)**SR.var('x') # needs sage.symbolic 2.000000000000000^x """ if (isinstance(base, ComplexBall) @@ -2864,7 +2866,7 @@ cdef class ComplexBall(RingElement): TESTS:: - sage: CBF(2).pow(SR.var('x')) # optional - sage.symbolic + sage: CBF(2).pow(SR.var('x')) # needs sage.symbolic Traceback (most recent call last): ... TypeError: no canonical coercion from Symbolic Ring to Complex ball @@ -3119,7 +3121,7 @@ cdef class ComplexBall(RingElement): EXAMPLES:: - sage: CBF(i*pi).exp() + sage: CBF(i*pi).exp() # needs sage.symbolic [-1.00000000000000 +/- ...e-16] + [+/- ...e-16]*I """ cdef ComplexBall res = self._new() @@ -3136,7 +3138,7 @@ cdef class ComplexBall(RingElement): sage: CBF(1/2).exppii() 1.000000000000000*I - sage: CBF(0, -1/pi).exppii() + sage: CBF(0, -1/pi).exppii() # needs sage.symbolic [2.71828182845904 +/- ...e-15] """ cdef ComplexBall res = self._new() @@ -3151,7 +3153,7 @@ cdef class ComplexBall(RingElement): EXAMPLES:: - sage: CBF(i*pi).sin() + sage: CBF(i*pi).sin() # needs sage.symbolic [11.54873935725775 +/- ...e-15]*I """ cdef ComplexBall res = self._new() @@ -3166,7 +3168,7 @@ cdef class ComplexBall(RingElement): EXAMPLES:: - sage: CBF(i*pi).cos() + sage: CBF(i*pi).cos() # needs sage.symbolic [11.59195327552152 +/- ...e-15] """ cdef ComplexBall res = self._new() @@ -3181,9 +3183,9 @@ cdef class ComplexBall(RingElement): EXAMPLES:: - sage: CBF(pi/2, 1/10).tan() + sage: CBF(pi/2, 1/10).tan() # needs sage.symbolic [+/- ...e-14] + [10.03331113225399 +/- ...e-15]*I - sage: CBF(pi/2).tan() + sage: CBF(pi/2).tan() # needs sage.symbolic nan """ cdef ComplexBall res = self._new() @@ -3198,9 +3200,9 @@ cdef class ComplexBall(RingElement): EXAMPLES:: - sage: CBF(pi, 1/10).cot() + sage: CBF(pi, 1/10).cot() # needs sage.symbolic [+/- ...e-14] + [-10.03331113225399 +/- ...e-15]*I - sage: CBF(pi).cot() + sage: CBF(pi).cot() # needs sage.symbolic nan """ cdef ComplexBall res = self._new() @@ -3277,7 +3279,7 @@ cdef class ComplexBall(RingElement): sage: CBF(1, 1).tanh() [1.083923327338694 +/- ...e-16] + [0.2717525853195117 +/- ...e-17]*I - sage: CBF(0, pi/2).tanh() + sage: CBF(0, pi/2).tanh() # needs sage.symbolic nan*I """ cdef ComplexBall res = self._new() @@ -3294,7 +3296,7 @@ cdef class ComplexBall(RingElement): sage: CBF(1, 1).coth() [0.868014142895925 +/- ...e-16] + [-0.2176215618544027 +/- ...e-17]*I - sage: CBF(0, pi).coth() + sage: CBF(0, pi).coth() # needs sage.symbolic nan*I """ cdef ComplexBall res = self._new() @@ -3309,7 +3311,7 @@ cdef class ComplexBall(RingElement): EXAMPLES:: - sage: CBF(pi/2, 1/10).sech() + sage: CBF(pi/2, 1/10).sech() # needs sage.symbolic [0.397174529918189 +/- ...e-16] + [-0.0365488656274242 +/- ...e-17]*I """ cdef ComplexBall res = self._new() @@ -3326,7 +3328,7 @@ cdef class ComplexBall(RingElement): sage: CBF(1, 1).csch() [0.303931001628426 +/- ...e-16] + [-0.621518017170428 +/- ...e-16]*I - sage: CBF(i*pi).csch() + sage: CBF(i*pi).csch() # needs sage.symbolic nan*I """ cdef ComplexBall res = self._new() @@ -3837,15 +3839,15 @@ cdef class ComplexBall(RingElement): EXAMPLES:: - sage: CBF(1, pi/2).hypergeometric([], []) + sage: CBF(1, pi/2).hypergeometric([], []) # needs sage.symbolic [+/- ...e-16] + [2.71828182845904 +/- ...e-15]*I - sage: CBF(1, pi).hypergeometric([1/4], [1/4]) + sage: CBF(1, pi).hypergeometric([1/4], [1/4]) # needs sage.symbolic [-2.7182818284590 +/- ...e-14] + [+/- ...e-14]*I - sage: CBF(1000, 1000).hypergeometric([10], [AA(sqrt(2))]) # optional - sage.symbolic + sage: CBF(1000, 1000).hypergeometric([10], [AA(sqrt(2))]) # needs sage.symbolic [9.79300951360e+454 +/- ...e+442] + [5.522579106816e+455 +/- ...e+442]*I - sage: CBF(1000, 1000).hypergeometric([100], [AA(sqrt(2))]) # optional - sage.symbolic + sage: CBF(1000, 1000).hypergeometric([100], [AA(sqrt(2))]) # needs sage.symbolic [1.27967355557e+590 +/- ...e+578] + [-9.32333491987e+590 +/- ...e+578]*I sage: CBF(0, 1).hypergeometric([], [1/2, 1/3, 1/4]) @@ -3879,7 +3881,7 @@ cdef class ComplexBall(RingElement): TESTS:: - sage: CBF(0, 1).hypergeometric([QQbar(sqrt(2)), RLF(pi)], [1r, 1/2]) # optional - sage.symbolic + sage: CBF(0, 1).hypergeometric([QQbar(sqrt(2)), RLF(pi)], [1r, 1/2]) # needs sage.symbolic [-8.7029449215408 +/- ...e-14] + [-0.8499070546106 +/- ...e-14]*I """ @@ -3953,7 +3955,7 @@ cdef class ComplexBall(RingElement): EXAMPLES:: - sage: CBF(1000, 1000).hypergeometric_U(RLF(pi), -100) + sage: CBF(1000, 1000).hypergeometric_U(RLF(pi), -100) # needs sage.symbolic [-7.261605907166e-11 +/- ...e-24] + [-7.928136216391e-11 +/- ...e-24]*I sage: CBF(1000, 1000).hypergeometric_U(0, -100) 1.000000000000000 @@ -4006,7 +4008,7 @@ cdef class ComplexBall(RingElement): EXAMPLES:: - sage: CBF(10*pi).airy() + sage: CBF(10*pi).airy() # needs sage.symbolic ([1.2408955946101e-52 +/- ...e-66], [-6.965048886977e-52 +/- ...e-65], [2.2882956833435e+50 +/- ...e+36], @@ -4218,7 +4220,7 @@ cdef class ComplexBall(RingElement): TESTS: - sage: CBF(Ei(I)) # abs tol 1e-16 + sage: CBF(Ei(I)) # abs tol 1e-16 # needs sage.symbolic [0.337403922900968 +/- 3.76e-16] + [2.51687939716208 +/- 2.01e-15]*I """ cdef ComplexBall result = self._new() @@ -4242,7 +4244,7 @@ cdef class ComplexBall(RingElement): TESTS: - sage: CBF(Si(I)) + sage: CBF(Si(I)) # needs sage.symbolic [1.05725087537573 +/- 2.77e-15]*I """ cdef ComplexBall result = self._new() @@ -4268,7 +4270,7 @@ cdef class ComplexBall(RingElement): TESTS: - sage: CBF(Ci(I)) # abs tol 1e-17 + sage: CBF(Ci(I)) # abs tol 1e-17 # needs sage.symbolic [0.837866940980208 +/- 4.72e-16] + [1.570796326794897 +/- 5.54e-16]*I """ cdef ComplexBall result = self._new() @@ -4294,7 +4296,7 @@ cdef class ComplexBall(RingElement): TESTS: - sage: CBF(Shi(I)) # abs tol 1e-15 + sage: CBF(Shi(I)) # abs tol 1e-15 # needs sage.symbolic [0.946083070367183 +/- 9.22e-16]*I """ cdef ComplexBall result = self._new() @@ -4320,7 +4322,7 @@ cdef class ComplexBall(RingElement): TESTS: - sage: CBF(Chi(I)) # abs tol 1e-16 + sage: CBF(Chi(I)) # abs tol 1e-16 # needs sage.symbolic [0.337403922900968 +/- 3.25e-16] + [1.570796326794897 +/- 5.54e-16]*I """ cdef ComplexBall result = self._new() @@ -4347,16 +4349,16 @@ cdef class ComplexBall(RingElement): 0 sage: CBF(0).li(offset=True) [-1.045163780117493 +/- ...e-16] - sage: li(0).n() + sage: li(0).n() # needs sage.symbolic 0.000000000000000 - sage: Li(0).n() + sage: Li(0).n() # needs sage.symbolic -1.04516378011749 TESTS:: - sage: CBF(li(0)) + sage: CBF(li(0)) # needs sage.symbolic 0 - sage: CBF(Li(0)) + sage: CBF(Li(0)) # needs sage.symbolic [-1.04516378011749...] """ cdef ComplexBall result = self._new() @@ -4375,9 +4377,9 @@ cdef class ComplexBall(RingElement): sage: CBF(0).Li() [-1.045163780117493 +/- ...e-16] - sage: li(0).n() + sage: li(0).n() # needs sage.symbolic 0.000000000000000 - sage: Li(0).n() + sage: Li(0).n() # needs sage.symbolic -1.04516378011749 """ cdef ComplexBall result = self._new() @@ -4479,12 +4481,13 @@ cdef class ComplexBall(RingElement): EXAMPLES:: - sage: tau = CBF(sqrt(2),pi) # optional - sage.symbolic - sage: tau.modular_lambda() # optional - sage.symbolic + sage: # needs sage.symbolic + sage: tau = CBF(sqrt(2),pi) + sage: tau.modular_lambda() [-0.00022005123884157 +/- ...e-18] + [-0.00079787346459944 +/- ...e-18]*I - sage: (tau + 2).modular_lambda() # optional - sage.symbolic + sage: (tau + 2).modular_lambda() [-0.00022005123884157 +/- ...e-18] + [-0.00079787346459944 +/- ...e-18]*I - sage: (tau / (1 - 2*tau)).modular_lambda() # optional - sage.symbolic + sage: (tau / (1 - 2*tau)).modular_lambda() [-0.00022005123884 +/- ...e-15] + [-0.00079787346460 +/- ...e-15]*I """ @@ -4564,19 +4567,19 @@ cdef class ComplexBall(RingElement): EXAMPLES:: sage: tau = CBF(1,4) - sage: z = CBF(sqrt(2), sqrt(3)) # optional - sage.symbolic - sage: z.elliptic_p(tau) # optional - sage.symbolic + sage: z = CBF(sqrt(2), sqrt(3)) # needs sage.symbolic + sage: z.elliptic_p(tau) # needs sage.symbolic [-3.28920996772709 +/- ...e-15] + [-0.0003673767302933 +/- ...e-17]*I - sage: (z + tau).elliptic_p(tau) # optional - sage.symbolic + sage: (z + tau).elliptic_p(tau) # needs sage.symbolic [-3.28920996772709 +/- ...e-15] + [-0.000367376730293 +/- ...e-16]*I - sage: (z + 1).elliptic_p(tau) # optional - sage.symbolic + sage: (z + 1).elliptic_p(tau) # needs sage.symbolic [-3.28920996772709 +/- ...e-15] + [-0.0003673767302933 +/- ...e-17]*I - sage: z.elliptic_p(tau, 3) # optional - sage.symbolic + sage: z.elliptic_p(tau, 3) # needs sage.symbolic [[-3.28920996772709 +/- ...e-15] + [-0.0003673767302933 +/- ...e-17]*I, [0.002473055794309 +/- ...e-16] + [0.003859554040267 +/- ...e-16]*I, [-0.01299087561709 +/- ...e-15] + [0.00725027521915 +/- ...e-15]*I] - sage: (z + 3 + 4*tau).elliptic_p(tau, 3) # optional - sage.symbolic + sage: (z + 3 + 4*tau).elliptic_p(tau, 3) # needs sage.symbolic [[-3.28920996772709 +/- ...e-15] + [-0.00036737673029 +/- ...e-15]*I, [0.0024730557943 +/- ...e-14] + [0.0038595540403 +/- ...e-14]*I, [-0.01299087562 +/- ...e-12] + [0.00725027522 +/- ...e-12]*I] @@ -4615,7 +4618,7 @@ cdef class ComplexBall(RingElement): sage: CBF(0,1).elliptic_invariants() ([189.07272012923 +/- ...e-12], [+/- ...e-12]) - sage: CBF(sqrt(2)/2, sqrt(2)/2).elliptic_invariants() # optional - sage.symbolic + sage: CBF(sqrt(2)/2, sqrt(2)/2).elliptic_invariants() # needs sage.symbolic ([+/- ...e-12] + [-332.5338031465...]*I, [1254.46842157...] + [1254.46842157...]*I) """ diff --git a/src/sage/rings/complex_conversion.pyx b/src/sage/rings/complex_conversion.pyx index a11f86a7735..abf179064c6 100644 --- a/src/sage/rings/complex_conversion.pyx +++ b/src/sage/rings/complex_conversion.pyx @@ -12,7 +12,7 @@ cdef class CCtoCDF(Map): sage: f = CCtoCDF(CC, CDF) # indirect doctest sage: f(CC.0) 1.0*I - sage: f(exp(pi*CC.0/4)) + sage: f(exp(pi*CC.0/4)) # needs sage.symbolic 0.7071067811865476 + 0.7071067811865475*I """ z = ComplexDoubleElement.__new__(ComplexDoubleElement) diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx index 1e679393c80..1cabe39fedf 100644 --- a/src/sage/rings/complex_double.pyx +++ b/src/sage/rings/complex_double.pyx @@ -24,7 +24,7 @@ EXAMPLES:: Complex Double Field sage: type(CDF.0) - sage: ComplexDoubleElement(sqrt(2),3) + sage: ComplexDoubleElement(sqrt(2), 3) # needs sage.symbolic 1.4142135623730951 + 3.0*I sage: parent(CDF(-2)) Complex Double Field @@ -421,16 +421,16 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): Thus the sum of a CDF and a symbolic object is symbolic:: - sage: a = pi + CDF.0; a + sage: a = pi + CDF.0; a # needs sage.symbolic pi + 1.0*I - sage: parent(a) + sage: parent(a) # needs sage.symbolic Symbolic Ring TESTS:: sage: CDF(1) + RR(1) 2.0 - sage: CDF.0 - CC(1) - int(1) - RR(1) - QQbar(1) + sage: CDF.0 - CC(1) - int(1) - RR(1) - QQbar(1) # needs sage.rings.number_field -4.0 + 1.0*I sage: CDF.has_coerce_map_from(ComplexField(20)) False @@ -476,7 +476,7 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): 'ComplexField(53 : Bits := true)' sage: magma(CDF) # optional - magma Complex field of precision 15 - sage: floor(RR(log(2**53, 10))) + sage: floor(RR(log(2**53, 10))) # needs sage.symbolic 15 sage: magma(CDF).sage() # optional - magma Complex Field with 53 bits of precision @@ -890,13 +890,14 @@ cdef class ComplexDoubleElement(FieldElement): EXAMPLES:: - sage: CDF((1.2, 0.3))._magma_init_(magma) # optional - magma + sage: # optional - magma + sage: CDF((1.2, 0.3))._magma_init_(magma) 'ComplexField(53 : Bits := true)![1.2, 0.3]' - sage: magma(CDF(1.2, 0.3)) # optional - magma # indirect doctest + sage: magma(CDF(1.2, 0.3)) 1.20000000000000 + 0.300000000000000*$.1 - sage: s = magma(CDF(1.2, 0.3)).sage(); s # optional - magma # indirect doctest + sage: s = magma(CDF(1.2, 0.3)).sage(); s 1.20000000000000 + 0.300000000000000*I - sage: s.parent() # optional - magma + sage: s.parent() Complex Field with 53 bits of precision """ return "%s![%s, %s]" % (self.parent()._magma_init_(magma), self.real(), self.imag()) @@ -981,11 +982,11 @@ cdef class ComplexDoubleElement(FieldElement): EXAMPLES:: - sage: s1 = CDF(exp(I)); s1 + sage: s1 = CDF(exp(I)); s1 # needs sage.symbolic 0.5403023058681398 + 0.8414709848078965*I - sage: s1._interface_init_() + sage: s1._interface_init_() # needs sage.symbolic '0.54030230586813977 + 0.84147098480789650*I' - sage: s1 == CDF(gp(s1)) + sage: s1 == CDF(gp(s1)) # needs sage.symbolic True """ # Sending to another computer algebra system is slow anyway, right? @@ -1025,11 +1026,11 @@ cdef class ComplexDoubleElement(FieldElement): EXAMPLES:: - sage: CDF(1, 0)._sympy_() + sage: CDF(1, 0)._sympy_() # needs sympy 1.00000000000000 - sage: CDF(1/3, 1)._sympy_() + sage: CDF(1/3, 1)._sympy_() # needs sympy 0.333333333333333 + 1.0*I - sage: type(_) + sage: type(_) # needs sympy """ x = GSL_REAL(self._complex) @@ -1145,13 +1146,14 @@ cdef class ComplexDoubleElement(FieldElement): EXAMPLES:: - sage: CDF(1,2).__pari__() # optional - sage.libs.pari + sage: # needs sage.libs.pari + sage: CDF(1,2).__pari__() 1.00000000000000 + 2.00000000000000*I - sage: pari(CDF(1,2)) # optional - sage.libs.pari + sage: pari(CDF(1,2)) 1.00000000000000 + 2.00000000000000*I - sage: pari(CDF(2.0)) # optional - sage.libs.pari + sage: pari(CDF(2.0)) 2.00000000000000 - sage: pari(CDF(I)) # optional - sage.libs.pari + sage: pari(CDF(I)) 1.00000000000000*I """ global new_gen_from_complex_double_element @@ -1628,7 +1630,7 @@ cdef class ComplexDoubleElement(FieldElement): sage: CDF(1, 2).is_NaN() False - sage: CDF(NaN).is_NaN() + sage: CDF(NaN).is_NaN() # needs sage.symbolic True sage: (1/CDF(0, 0)).is_NaN() True @@ -1663,11 +1665,11 @@ cdef class ComplexDoubleElement(FieldElement): We raise to symbolic powers:: - sage: var('x, n') + sage: var('x, n') # needs sage.symbolic (x, n) - sage: CDF(1.2)^x + sage: CDF(1.2)^x # needs sage.symbolic 1.2^x - sage: CDF(1.2)^(x^n + n^x) + sage: CDF(1.2)^(x^n + n^x) # needs sage.symbolic 1.2^(n^x + x^n) A real number powered to an exact integer always yields a real @@ -1739,9 +1741,9 @@ cdef class ComplexDoubleElement(FieldElement): We numerically verify a famous identity to the precision of a double:: - sage: z = CDF(0, 2*pi); z + sage: z = CDF(0, 2*pi); z # needs sage.symbolic 6.283185307179586*I - sage: exp(z) # rel tol 1e-4 + sage: exp(z) # rel tol 1e-4 # needs sage.symbolic 1.0 - 2.4492935982947064e-16*I """ return self._new_c(gsl_complex_exp(self._complex)) @@ -2194,41 +2196,42 @@ cdef class ComplexDoubleElement(FieldElement): We compute a few values of :meth:`eta()`:: - sage: CDF(0,1).eta() # optional - sage.libs.pari + sage: CDF(0,1).eta() # needs sage.libs.pari 0.7682254223260566 - sage: CDF(1,1).eta() # optional - sage.libs.pari + sage: CDF(1,1).eta() # needs sage.libs.pari 0.7420487758365647 + 0.1988313702299107*I - sage: CDF(25,1).eta() # optional - sage.libs.pari + sage: CDF(25,1).eta() # needs sage.libs.pari 0.7420487758365647 + 0.1988313702299107*I :meth:`eta()` works even if the inputs are large:: sage: CDF(0, 10^15).eta() 0.0 - sage: CDF(10^15, 0.1).eta() # abs tol 1e-10 # optional - sage.libs.pari + sage: CDF(10^15, 0.1).eta() # abs tol 1e-10 # needs sage.libs.pari -0.115342592727 - 0.19977923088*I We compute a few values of :meth:`eta()`, but with the fractional power of `e` omitted:: - sage: CDF(0,1).eta(True) # optional - sage.libs.pari + sage: CDF(0,1).eta(True) # needs sage.libs.pari 0.9981290699259585 We compute :meth:`eta()` to low precision directly from the definition:: - sage: z = CDF(1,1); z.eta() # optional - sage.libs.pari + sage: z = CDF(1,1); z.eta() # needs sage.libs.pari 0.7420487758365647 + 0.1988313702299107*I - sage: i = CDF(0,1); pi = CDF(pi) - sage: exp(pi * i * z / 12) * prod([1-exp(2*pi*i*n*z) for n in range(1,10)]) + sage: i = CDF(0,1); pi = CDF(pi) # needs sage.symbolic + sage: exp(pi * i * z / 12) * prod(1 - exp(2*pi*i*n*z) # needs sage.libs.pari sage.symbolic + ....: for n in range(1, 10)) 0.7420487758365647 + 0.19883137022991068*I The optional argument allows us to omit the fractional part:: - sage: z.eta(omit_frac=True) # optional - sage.libs.pari + sage: z.eta(omit_frac=True) # needs sage.libs.pari 0.9981290699259585 - sage: pi = CDF(pi) - sage: prod([1-exp(2*pi*i*n*z) for n in range(1,10)]) # abs tol 1e-12 + sage: pi = CDF(pi) # needs sage.symbolic + sage: prod(1 - exp(2*pi*i*n*z) for n in range(1,10)) # abs tol 1e-12 # needs sage.libs.pari sage.symbolic 0.998129069926 + 4.59084695545e-19*I We illustrate what happens when `z` is not in the upper half plane:: @@ -2242,7 +2245,7 @@ cdef class ComplexDoubleElement(FieldElement): You can also use functional notation:: sage: z = CDF(1,1) - sage: eta(z) # optional - sage.libs.pari + sage: eta(z) # needs sage.libs.pari 0.7420487758365647 + 0.1988313702299107*I """ if GSL_IMAG(self._complex) <= 0: @@ -2372,9 +2375,9 @@ cdef class ComplexDoubleElement(FieldElement): EXAMPLES:: - sage: CDF(1,2).dilog() # optional - sage.libs.pari + sage: CDF(1,2).dilog() # needs sage.libs.pari -0.059474798673809476 + 2.0726479717747566*I - sage: CDF(10000000,10000000).dilog() # optional - sage.libs.pari + sage: CDF(10000000,10000000).dilog() # needs sage.libs.pari -134.411774490731 + 38.79396299904504*I """ global complex_double_element_dilog @@ -2389,13 +2392,14 @@ cdef class ComplexDoubleElement(FieldElement): EXAMPLES:: - sage: CDF(5,0).gamma() # optional - sage.libs.pari + sage: # needs sage.libs.pari + sage: CDF(5,0).gamma() 24.0 - sage: CDF(1,1).gamma() # optional - sage.libs.pari + sage: CDF(1,1).gamma() 0.49801566811835607 - 0.15494982830181067*I - sage: CDF(0).gamma() # optional - sage.libs.pari + sage: CDF(0).gamma() Infinity - sage: CDF(-1,0).gamma() # optional - sage.libs.pari + sage: CDF(-1,0).gamma() Infinity """ if not GSL_IMAG(self._complex): @@ -2420,11 +2424,11 @@ cdef class ComplexDoubleElement(FieldElement): EXAMPLES:: - sage: CDF(1,1).gamma_inc(CDF(2,3)) # optional - sage.libs.pari + sage: CDF(1,1).gamma_inc(CDF(2,3)) # needs sage.libs.pari 0.0020969148636468277 - 0.059981913655449706*I - sage: CDF(1,1).gamma_inc(5) # optional - sage.libs.pari + sage: CDF(1,1).gamma_inc(5) # needs sage.libs.pari -0.001378130936215849 + 0.006519820023119819*I - sage: CDF(2,0).gamma_inc(CDF(1,1)) # optional - sage.libs.pari + sage: CDF(2,0).gamma_inc(CDF(1,1)) # needs sage.libs.pari 0.7070920963459381 - 0.4203536409598115*I """ global complex_double_element_gamma_inc @@ -2439,11 +2443,11 @@ cdef class ComplexDoubleElement(FieldElement): EXAMPLES:: sage: z = CDF(1, 1) - sage: z.zeta() # optional - sage.libs.pari + sage: z.zeta() # needs sage.libs.pari 0.5821580597520036 - 0.9268485643308071*I - sage: zeta(z) # optional - sage.libs.pari + sage: zeta(z) # needs sage.libs.pari 0.5821580597520036 - 0.9268485643308071*I - sage: zeta(CDF(1)) # optional - sage.libs.pari + sage: zeta(CDF(1)) # needs sage.libs.pari Infinity """ if GSL_REAL(self._complex) == 1 and GSL_IMAG(self._complex) == 0: @@ -2467,18 +2471,18 @@ cdef class ComplexDoubleElement(FieldElement): EXAMPLES:: - sage: z = (1/2)*(1 + RDF(sqrt(3)) *CDF.0); z # abs tol 1e-16 + sage: z = (1/2)*(1 + RDF(sqrt(3)) * CDF.0); z # abs tol 1e-16 # needs sage.symbolic 0.5 + 0.8660254037844387*I - sage: p = z.algdep(5); p # optional - sage.libs.pari sage.symbolic + sage: p = z.algdep(5); p # needs sage.libs.pari sage.symbolic x^2 - x + 1 - sage: abs(z^2 - z + 1) < 1e-14 + sage: abs(z^2 - z + 1) < 1e-14 # needs sage.symbolic True :: - sage: CDF(0,2).algdep(10) # optional - sage.libs.pari + sage: CDF(0,2).algdep(10) # needs sage.libs.pari x^2 + 4 - sage: CDF(1,5).algdep(2) # optional - sage.libs.pari + sage: CDF(1,5).algdep(2) # needs sage.libs.pari x^2 - 2*x + 26 """ from sage.arith.misc import algdep @@ -2569,11 +2573,11 @@ cdef class ComplexToCDF(Morphism): EXAMPLES:: - sage: import numpy # optional - numpy - sage: f = CDF.coerce_map_from(numpy.complex_) # optional - numpy - sage: f(numpy.complex_(I)) # optional - numpy + sage: import numpy # needs numpy + sage: f = CDF.coerce_map_from(numpy.complex_) # needs numpy + sage: f(numpy.complex_(I)) # needs numpy 1.0*I - sage: f(numpy.complex_(I)).parent() # optional - numpy + sage: f(numpy.complex_(I)).parent() # needs numpy Complex Double Field """ def __init__(self, R): @@ -2589,8 +2593,8 @@ cdef class ComplexToCDF(Morphism): EXAMPLES:: - sage: import numpy # optional - numpy - sage: CDF(numpy.complex_(I)) # indirect doctest # optional - numpy + sage: import numpy # needs numpy + sage: CDF(numpy.complex_(I)) # indirect doctest # needs numpy 1.0*I """ cdef ComplexDoubleElement z = ComplexDoubleElement.__new__(ComplexDoubleElement) @@ -2603,9 +2607,9 @@ cdef class ComplexToCDF(Morphism): EXAMPLES:: - sage: import numpy # optional - numpy - sage: f = sage.rings.complex_double.ComplexToCDF(numpy.complex_) # optional - numpy - sage: f._repr_type() # optional - numpy + sage: import numpy # needs numpy + sage: f = sage.rings.complex_double.ComplexToCDF(numpy.complex_) # needs numpy + sage: f._repr_type() # needs numpy 'Native' """ return "Native" diff --git a/src/sage/rings/complex_interval.pyx b/src/sage/rings/complex_interval.pyx index 12e32fc2d90..05c77675c53 100644 --- a/src/sage/rings/complex_interval.pyx +++ b/src/sage/rings/complex_interval.pyx @@ -230,7 +230,7 @@ cdef class ComplexIntervalFieldElement(FieldElement): '-2.5000000000000000?*I' sage: CIF(1.5).str(base=3) '1.1111111111111111111111111111111112?' - sage: CIF(1, pi).str(style='brackets') + sage: CIF(1, pi).str(style='brackets') # needs sage.symbolic '[1.0000000000000000 .. 1.0000000000000000] + [3.1415926535897931 .. 3.1415926535897936]*I' .. SEEALSO:: @@ -285,23 +285,24 @@ cdef class ComplexIntervalFieldElement(FieldElement): EXAMPLES:: - sage: sum(plot(CIF(RIF(1/k, 1/k), RIF(-k, k))) for k in [1..10]) + sage: sum(plot(CIF(RIF(1/k, 1/k), RIF(-k, k))) for k in [1..10]) # needs sage.plot Graphics object consisting of 20 graphics primitives Exact and nearly exact points are still visible:: - sage: plot(CIF(pi, 1), color='red') + plot(CIF(1, e), color='purple') + plot(CIF(-1, -1)) + sage: plot(CIF(pi, 1), color='red') + plot(CIF(1, e), color='purple') + plot(CIF(-1, -1)) # needs sage.plot Graphics object consisting of 6 graphics primitives A demonstration that `z \mapsto z^2` acts chaotically on `|z|=1`:: + sage: # needs sage.symbolic sage: z = CIF(0, 2*pi/1000).exp() - sage: g = Graphics() - sage: for i in range(40): + sage: g = Graphics() # needs sage.plot + sage: for i in range(40): # needs sage.plot ....: z = z^2 ....: g += z.plot(color=(1./(40-i), 0, 1)) ... - sage: g + sage: g # needs sage.plot Graphics object consisting of 80 graphics primitives """ from sage.plot.polygon import polygon2d @@ -351,15 +352,15 @@ cdef class ComplexIntervalFieldElement(FieldElement): (2.50000000000000, 3.00000000000000) (-4.50000000000000, -4.00000000000000) - sage: z = CIF(RIF(sqrt(2), sqrt(3)), RIF(e, pi)) - sage: a, b, c, d = z.bisection() - sage: a.intersection(b).intersection(c).intersection(d) == CIF(z.center()) + sage: z = CIF(RIF(sqrt(2), sqrt(3)), RIF(e, pi)) # needs sage.symbolic + sage: a, b, c, d = z.bisection() # needs sage.symbolic + sage: a.intersection(b).intersection(c).intersection(d) == CIF(z.center()) # needs sage.symbolic True - sage: zz = a.union(b).union(c).union(c) - sage: zz.real().endpoints() == z.real().endpoints() + sage: zz = a.union(b).union(c).union(c) # needs sage.symbolic + sage: zz.real().endpoints() == z.real().endpoints() # needs sage.symbolic True - sage: zz.imag().endpoints() == z.imag().endpoints() + sage: zz.imag().endpoints() == z.imag().endpoints() # needs sage.symbolic True """ a00 = self._new() @@ -399,9 +400,9 @@ cdef class ComplexIntervalFieldElement(FieldElement): True sage: CIF(-5, 0).sqrt().is_exact() False - sage: CIF(0, 2*pi).is_exact() + sage: CIF(0, 2*pi).is_exact() # needs sage.symbolic False - sage: CIF(e).is_exact() + sage: CIF(e).is_exact() # needs sage.symbolic False sage: CIF(1e100).is_exact() True @@ -985,7 +986,7 @@ cdef class ComplexIntervalFieldElement(FieldElement): Here a conversion to Maxima happens, which results in a ``TypeError``:: sage: a = CIF(2.3) - sage: maxima(a) + sage: maxima(a) # needs sage.symbolic Traceback (most recent call last): ... TypeError @@ -999,7 +1000,7 @@ cdef class ComplexIntervalFieldElement(FieldElement): EXAMPLES:: - sage: sage_input(CIF(RIF(e, pi), RIF(sqrt(2), sqrt(3))), verify=True) + sage: sage_input(CIF(RIF(e, pi), RIF(sqrt(2), sqrt(3))), verify=True) # needs sage.symbolic # Verified CIF(RIF(RR(2.7182818284590451), RR(3.1415926535897936)), RIF(RR(1.4142135623730949), RR(1.7320508075688774))) sage: sage_input(ComplexIntervalField(64)(2)^I, preparse=False, verify=True) @@ -1997,7 +1998,7 @@ cdef class ComplexIntervalFieldElement(FieldElement): sage: CIF(2, 1).is_NaN() False - sage: CIF(NaN).is_NaN() + sage: CIF(NaN).is_NaN() # needs sage.symbolic True sage: (1 / CIF(0, 0)).is_NaN() True @@ -2019,7 +2020,7 @@ cdef class ComplexIntervalFieldElement(FieldElement): Check that :trac:`17285` is fixed:: - sage: CIF(cos(2/3)) + sage: CIF(cos(2/3)) # needs sage.symbolic 0.7858872607769480? ALGORITHM: @@ -2061,7 +2062,7 @@ cdef class ComplexIntervalFieldElement(FieldElement): Check that :trac:`17825` is fixed:: - sage: CIF(sin(2/3)) + sage: CIF(sin(2/3)) # needs sage.symbolic 0.618369803069737? ALGORITHM: diff --git a/src/sage/rings/complex_interval_field.py b/src/sage/rings/complex_interval_field.py index 7cbf5d60929..2d1aef3160d 100644 --- a/src/sage/rings/complex_interval_field.py +++ b/src/sage/rings/complex_interval_field.py @@ -304,7 +304,7 @@ def _magma_init_(self, magma): sage: magma(ComplexIntervalField(100)) # optional - magma # indirect doctest Complex field of precision 30 - sage: floor(RR(log(2**100, 10))) + sage: floor(RR(log(2**100, 10))) # needs sage.symbolic 30 """ return "ComplexField(%s : Bits := true)" % self.prec() @@ -445,7 +445,7 @@ def __call__(self, x=None, im=None, **kwds): TypeError: unable to convert '1+I' to real interval sage: CIF(2,3) 2 + 3*I - sage: CIF(pi, e) + sage: CIF(pi, e) # needs sage.symbolic 3.141592653589794? + 2.718281828459046?*I sage: ComplexIntervalField(100)(CIF(RIF(2,3))) 3.? diff --git a/src/sage/rings/complex_mpc.pyx b/src/sage/rings/complex_mpc.pyx index b3681ff724f..477fc0fbccf 100644 --- a/src/sage/rings/complex_mpc.pyx +++ b/src/sage/rings/complex_mpc.pyx @@ -1195,27 +1195,27 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): sage: MPC = MPComplexField() sage: a = MPC(2,1) - sage: a.__pari__() + sage: a.__pari__() # needs sage.libs.pari 2.00000000000000 + 1.00000000000000*I - sage: pari(a) + sage: pari(a) # needs sage.libs.pari 2.00000000000000 + 1.00000000000000*I - sage: pari(a).type() + sage: pari(a).type() # needs sage.libs.pari 't_COMPLEX' - sage: a = MPC(pi) - sage: pari(a) + sage: a = MPC(pi) # needs sage.libs.pari sage.symbolic + sage: pari(a) # needs sage.libs.pari sage.symbolic 3.14159265358979 - sage: pari(a).type() + sage: pari(a).type() # needs sage.libs.pari sage.symbolic 't_REAL' sage: a = MPC(-2).sqrt() - sage: pari(a) + sage: pari(a) # needs sage.libs.pari 1.41421356237310*I The precision is preserved, rounded up to the wordsize:: sage: MPC = MPComplexField(250) - sage: MPC(1,2).__pari__().bitprecision() + sage: MPC(1,2).__pari__().bitprecision() # needs sage.libs.pari 256 - sage: MPC(pi).__pari__().bitprecision() + sage: MPC(pi).__pari__().bitprecision() # needs sage.libs.pari 256 """ if mpfr_zero_p(self.value.re): @@ -1520,7 +1520,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): 2.23606797749979 sage: a.__abs__() 2.23606797749979 - sage: float(sqrt(2^2 + 1^1)) + sage: float(sqrt(2^2 + 1^1)) # needs sage.symbolic 2.23606797749979 sage: b = MPC(42,0) @@ -2212,7 +2212,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): sage: a = MPC(1,0) sage: a.dilog() 1.64493406684823 - sage: float(pi^2/6) + sage: float(pi^2/6) # needs sage.symbolic 1.6449340668482262 :: diff --git a/src/sage/rings/complex_mpfr.pyx b/src/sage/rings/complex_mpfr.pyx index 64e3fe9cf3c..8ab4706ff1a 100644 --- a/src/sage/rings/complex_mpfr.pyx +++ b/src/sage/rings/complex_mpfr.pyx @@ -493,9 +493,9 @@ class ComplexField_class(sage.rings.abc.ComplexField): Check that :trac:`14989` is fixed:: sage: x = polygen(ZZ, 'x') - sage: QQi = NumberField(x^2 + 1, 'i', embedding=CC(0,1)) # optional - sage.rings.number_field - sage: i = QQi.order(QQi.gen()).gen(1) # optional - sage.rings.number_field - sage: CC(i) # optional - sage.rings.number_field + sage: QQi = NumberField(x^2 + 1, 'i', embedding=CC(0,1)) # needs sage.rings.number_field + sage: i = QQi.order(QQi.gen()).gen(1) # needs sage.rings.number_field + sage: CC(i) # needs sage.rings.number_field 1.00000000000000*I TESTS:: @@ -715,8 +715,8 @@ class ComplexField_class(sage.rings.abc.ComplexField): sage: re, im = CC6.random_element(2^-20) sage: -2^-20 <= re <= 2^-20, -2^-20 <= im <= 2^-20 (True, True) - sage: re, im = CC6.random_element(pi^20) - sage: bool(-pi^20 <= re <= pi^20), bool(-pi^20 <= im <= pi^20) + sage: re, im = CC6.random_element(pi^20) # needs sage.symbolic + sage: bool(-pi^20 <= re <= pi^20), bool(-pi^20 <= im <= pi^20) # needs sage.symbolic (True, True) Passes extra positional or keyword arguments through:: @@ -849,17 +849,17 @@ class ComplexField_class(sage.rings.abc.ComplexField): sage: k = ComplexField(100) sage: R. = k[] - sage: k._factor_univariate_polynomial( x ) # optional - sage.libs.pari + sage: k._factor_univariate_polynomial( x ) # needs sage.libs.pari x - sage: k._factor_univariate_polynomial( 2*x ) # optional - sage.libs.pari + sage: k._factor_univariate_polynomial( 2*x ) # needs sage.libs.pari (2.0000000000000000000000000000) * x - sage: k._factor_univariate_polynomial( x^2 ) # optional - sage.libs.pari + sage: k._factor_univariate_polynomial( x^2 ) # needs sage.libs.pari x^2 - sage: k._factor_univariate_polynomial( x^2 + 3 ) # optional - sage.libs.pari + sage: k._factor_univariate_polynomial( x^2 + 3 ) # needs sage.libs.pari (x - 1.7320508075688772935274463415*I) * (x + 1.7320508075688772935274463415*I) - sage: k._factor_univariate_polynomial( x^2 + 1 ) # optional - sage.libs.pari + sage: k._factor_univariate_polynomial( x^2 + 1 ) # needs sage.libs.pari (x - I) * (x + I) - sage: k._factor_univariate_polynomial( k(I) * (x^2 + 1) ) # optional - sage.libs.pari + sage: k._factor_univariate_polynomial( k(I) * (x^2 + 1) ) # needs sage.libs.pari (1.0000000000000000000000000000*I) * (x - I) * (x + I) """ @@ -1038,10 +1038,10 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: import numpy # optional - numpy - sage: numpy.array([1.0, 2.5j]).dtype # optional - numpy + sage: import numpy # needs numpy + sage: numpy.array([1.0, 2.5j]).dtype # needs numpy dtype('complex128') - sage: numpy.array([1.000000000000000000000000000000000000j]).dtype # optional - numpy + sage: numpy.array([1.000000000000000000000000000000000000j]).dtype # needs numpy dtype('O') """ if self._prec <= 53: @@ -1265,19 +1265,19 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: a = CC(pi + I*e); a # optional - sage.symbolic + sage: a = CC(pi + I*e); a # needs sage.symbolic 3.14159265358979 + 2.71828182845905*I - sage: a.str(truncate=True) # optional - sage.symbolic + sage: a.str(truncate=True) # needs sage.symbolic '3.14159265358979 + 2.71828182845905*I' - sage: a.str() # optional - sage.symbolic + sage: a.str() # needs sage.symbolic '3.1415926535897931 + 2.7182818284590451*I' - sage: a.str(base=2) # optional - sage.symbolic + sage: a.str(base=2) # needs sage.symbolic '11.001001000011111101101010100010001000010110100011000 + 10.101101111110000101010001011000101000101011101101001*I' - sage: CC(0.5 + 0.625*I).str(base=2) # optional - sage.symbolic + sage: CC(0.5 + 0.625*I).str(base=2) # needs sage.symbolic '0.10000000000000000000000000000000000000000000000000000 + 0.10100000000000000000000000000000000000000000000000000*I' - sage: a.str(base=16) # optional - sage.symbolic + sage: a.str(base=16) # needs sage.symbolic '3.243f6a8885a30 + 2.b7e151628aed2*I' - sage: a.str(base=36) # optional - sage.symbolic + sage: a.str(base=36) # needs sage.symbolic '3.53i5ab8p5fc + 2.puw5nggjf8f*I' sage: CC(0) 0.000000000000000 @@ -1390,23 +1390,23 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): Coerce the object using the ``pari`` function:: sage: a = ComplexNumber(2,1) - sage: pari(a) # optional - sage.libs.pari + sage: pari(a) # needs sage.libs.pari 2.00000000000000 + 1.00000000000000*I - sage: pari(a).type() # optional - sage.libs.pari + sage: pari(a).type() # needs sage.libs.pari 't_COMPLEX' - sage: type(pari(a)) # optional - sage.libs.pari + sage: type(pari(a)) # needs sage.libs.pari - sage: a.__pari__() # optional - sage.libs.pari + sage: a.__pari__() # needs sage.libs.pari 2.00000000000000 + 1.00000000000000*I - sage: type(a.__pari__()) # optional - sage.libs.pari + sage: type(a.__pari__()) # needs sage.libs.pari - sage: a = CC(pi) # optional - sage.symbolic - sage: pari(a) # optional - sage.libs.pari sage.symbolic + sage: a = CC(pi) # needs sage.symbolic + sage: pari(a) # needs sage.libs.pari sage.symbolic 3.14159265358979 - sage: pari(a).type() # optional - sage.libs.pari sage.symbolic + sage: pari(a).type() # needs sage.libs.pari sage.symbolic 't_REAL' sage: a = CC(-2).sqrt() - sage: pari(a) # optional - sage.libs.pari + sage: pari(a) # needs sage.libs.pari 1.41421356237310*I """ if self.is_real(): @@ -1473,11 +1473,11 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: CC(1, 0)._sympy_() # optional - sympy + sage: CC(1, 0)._sympy_() # needs sympy 1.00000000000000 - sage: CC(1/3, 1)._sympy_() # optional - sympy + sage: CC(1/3, 1)._sympy_() # needs sympy 0.333333333333333 + 1.0*I - sage: type(_) # optional - sympy + sage: type(_) # needs sympy """ import sympy @@ -1879,7 +1879,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): 2.23606797749979 sage: a.__abs__() 2.23606797749979 - sage: float(sqrt(2^2 + 1^1)) + sage: float(sqrt(2^2 + 1^1)) # needs sage.symbolic 2.23606797749979 :: @@ -2089,13 +2089,13 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): You can either use the indirect:: sage: z = CC(0,1) - sage: plot(z) # optional - sage.plot + sage: plot(z) # needs sage.plot Graphics object consisting of 1 graphics primitive or the more direct:: sage: z = CC(0,1) - sage: z.plot() # optional - sage.plot + sage: z.plot() # needs sage.plot Graphics object consisting of 1 graphics primitive """ return sage.plot.point.point2d((self.real(), self.imag()), **kargs) @@ -2111,7 +2111,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: (1+CC(I)).arccos() # optional - sage.libs.pari + sage: (1+CC(I)).arccos() # needs sage.libs.pari 0.904556894302381 - 1.06127506190504*I """ return self._parent(self.__pari__().acos()) @@ -2122,7 +2122,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: (1+CC(I)).arccosh() # optional - sage.libs.pari + sage: (1+CC(I)).arccosh() # needs sage.libs.pari 1.06127506190504 + 0.904556894302381*I """ return self._parent(self.__pari__().acosh()) @@ -2133,7 +2133,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: (1+CC(I)).arcsin() # optional - sage.libs.pari + sage: (1+CC(I)).arcsin() # needs sage.libs.pari 0.666239432492515 + 1.06127506190504*I """ return self._parent(self.__pari__().asin()) @@ -2144,7 +2144,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: (1+CC(I)).arcsinh() # optional - sage.libs.pari + sage: (1+CC(I)).arcsinh() # needs sage.libs.pari 1.06127506190504 + 0.666239432492515*I """ return self._parent(self.__pari__().asinh()) @@ -2155,7 +2155,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: (1+CC(I)).arctan() # optional - sage.libs.pari + sage: (1+CC(I)).arctan() # needs sage.libs.pari 1.01722196789785 + 0.402359478108525*I """ return self._parent(self.__pari__().atan()) @@ -2166,7 +2166,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: (1+CC(I)).arctanh() # optional - sage.libs.pari + sage: (1+CC(I)).arctanh() # needs sage.libs.pari 0.402359478108525 + 1.01722196789785*I """ return self._parent(self.__pari__().atanh()) @@ -2177,7 +2177,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: ComplexField(100)(1,1).coth() # optional - sage.libs.pari + sage: ComplexField(100)(1,1).coth() # needs sage.libs.pari 0.86801414289592494863584920892 - 0.21762156185440268136513424361*I """ return ~(self.tanh()) @@ -2188,7 +2188,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: ComplexField(100)(1,1).arccoth() # optional - sage.libs.pari + sage: ComplexField(100)(1,1).arccoth() # needs sage.libs.pari 0.40235947810852509365018983331 - 0.55357435889704525150853273009*I """ return (~self).arctanh() @@ -2199,7 +2199,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: ComplexField(100)(1,1).csc() # optional - sage.libs.pari + sage: ComplexField(100)(1,1).csc() # needs sage.libs.pari 0.62151801717042842123490780586 - 0.30393100162842645033448560451*I """ return ~(self.sin()) @@ -2210,7 +2210,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: ComplexField(100)(1,1).csch() # optional - sage.libs.pari + sage: ComplexField(100)(1,1).csch() # needs sage.libs.pari 0.30393100162842645033448560451 - 0.62151801717042842123490780586*I """ return ~(self.sinh()) @@ -2221,7 +2221,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: ComplexField(100)(1,1).arccsch() # optional - sage.libs.pari + sage: ComplexField(100)(1,1).arccsch() # needs sage.libs.pari 0.53063753095251782601650945811 - 0.45227844715119068206365839783*I """ return (~self).arcsinh() @@ -2232,7 +2232,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: ComplexField(100)(1,1).sec() # optional - sage.libs.pari + sage: ComplexField(100)(1,1).sec() # needs sage.libs.pari 0.49833703055518678521380589177 + 0.59108384172104504805039169297*I """ return ~(self.cos()) @@ -2243,7 +2243,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: ComplexField(100)(1,1).sech() # optional - sage.libs.pari + sage: ComplexField(100)(1,1).sech() # needs sage.libs.pari 0.49833703055518678521380589177 - 0.59108384172104504805039169297*I """ return ~(self.cosh()) @@ -2254,7 +2254,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: ComplexField(100)(1,1).arcsech() # optional - sage.libs.pari + sage: ComplexField(100)(1,1).arcsech() # needs sage.libs.pari 0.53063753095251782601650945811 - 1.1185178796437059371676632938*I """ return (~self).arccosh() @@ -2265,13 +2265,14 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: (1+CC(I)).cot() # optional - sage.libs.pari + sage: # needs sage.libs.pari + sage: (1+CC(I)).cot() 0.217621561854403 - 0.868014142895925*I - sage: i = ComplexField(200).0 # optional - sage.libs.pari - sage: (1+i).cot() # optional - sage.libs.pari + sage: i = ComplexField(200).0 + sage: (1+i).cot() 0.21762156185440268136513424360523807352075436916785404091068 - 0.86801414289592494863584920891627388827343874994609327121115*I - sage: i = ComplexField(220).0 # optional - sage.libs.pari - sage: (1+i).cot() # optional - sage.libs.pari + sage: i = ComplexField(220).0 + sage: (1+i).cot() 0.21762156185440268136513424360523807352075436916785404091068124239 - 0.86801414289592494863584920891627388827343874994609327121115071646*I TESTS: @@ -2371,35 +2372,35 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): First we compute `\eta(1+i)`:: sage: i = CC.0 - sage: z = 1 + i; z.eta() # optional - sage.libs.pari + sage: z = 1 + i; z.eta() # needs sage.libs.pari 0.742048775836565 + 0.198831370229911*I We compute eta to low precision directly from the definition:: - sage: pi = CC(pi) # otherwise we will get a symbolic result. # optional - sage.symbolic - sage: exp(pi * i * z / 12) * prod(1 - exp(2*pi*i*n*z) # optional - sage.symbolic + sage: pi = CC(pi) # otherwise we will get a symbolic result. # needs sage.symbolic + sage: exp(pi * i * z / 12) * prod(1 - exp(2*pi*i*n*z) # needs sage.libs.pari sage.symbolic ....: for n in range(1,10)) 0.742048775836565 + 0.198831370229911*I The optional argument allows us to omit the fractional part:: - sage: z.eta(omit_frac=True) # optional - sage.libs.pari + sage: z.eta(omit_frac=True) # needs sage.libs.pari 0.998129069925959 - sage: prod(1 - exp(2*pi*i*n*z) for n in range(1,10)) # optional - sage.symbolic + sage: prod(1 - exp(2*pi*i*n*z) for n in range(1,10)) # needs sage.libs.pari sage.symbolic 0.998129069925958 + 4.59099857829247e-19*I We illustrate what happens when `z` is not in the upper half plane:: sage: z = CC(1) - sage: z.eta() # optional - sage.libs.pari + sage: z.eta() # needs sage.libs.pari Traceback (most recent call last): ... ValueError: value must be in the upper half plane You can also use functional notation:: - sage: eta(1 + CC(I)) # optional - sage.libs.pari + sage: eta(1 + CC(I)) # needs sage.libs.pari 0.742048775836565 + 0.198831370229911*I """ try: @@ -2584,7 +2585,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): 1.62780548487271 + 0.136827548397369*I sage: a.agm(b, algorithm="principal") 1.62780548487271 + 0.136827548397369*I - sage: a.agm(b, algorithm="pari") # optional - sage.libs.pari + sage: a.agm(b, algorithm="pari") # needs sage.libs.pari 1.62780548487271 + 0.136827548397369*I An example to show that the returned value depends on the algorithm @@ -2596,13 +2597,13 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): -0.371591652351761 + 0.319894660206830*I sage: a.agm(b, algorithm="principal") 0.338175462986180 - 0.0135326969565405*I - sage: a.agm(b, algorithm="pari") # optional - sage.libs.pari + sage: a.agm(b, algorithm="pari") # needs sage.libs.pari -0.371591652351761 + 0.319894660206830*I sage: a.agm(b, algorithm="optimal").abs() 0.490319232466314 sage: a.agm(b, algorithm="principal").abs() 0.338446122230459 - sage: a.agm(b, algorithm="pari").abs() # optional - sage.libs.pari + sage: a.agm(b, algorithm="pari").abs() # needs sage.libs.pari 0.490319232466314 TESTS: @@ -2819,21 +2820,21 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: sage: a = ComplexNumber(1,0) - sage: a.dilog() # optional - sage.libs.pari + sage: a.dilog() # needs sage.libs.pari 1.64493406684823 - sage: float(pi^2/6) # optional - sage.symbolic + sage: float(pi^2/6) # needs sage.symbolic 1.6449340668482262 :: sage: b = ComplexNumber(0,1) - sage: b.dilog() # optional - sage.libs.pari + sage: b.dilog() # needs sage.libs.pari -0.205616758356028 + 0.915965594177219*I :: sage: c = ComplexNumber(0,0) - sage: c.dilog() # optional - sage.libs.pari + sage: c.dilog() # needs sage.libs.pari 0.000000000000000 """ return self._parent(self.__pari__().dilog()) @@ -2869,17 +2870,17 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: sage: i = ComplexField(30).0 - sage: (1 + i).gamma() # optional - sage.libs.pari + sage: (1 + i).gamma() # needs sage.libs.pari 0.49801567 - 0.15494983*I TESTS:: - sage: CC(0).gamma() # optional - sage.libs.pari + sage: CC(0).gamma() # needs sage.libs.pari Infinity :: - sage: CC(-1).gamma() # optional - sage.libs.pari + sage: CC(-1).gamma() # needs sage.libs.pari Infinity """ try: @@ -2896,13 +2897,13 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: sage: C, i = ComplexField(30).objgen() - sage: (1+i).gamma_inc(2 + 3*i) # abs tol 2e-10 # optional - sage.libs.pari + sage: (1+i).gamma_inc(2 + 3*i) # abs tol 2e-10 # needs sage.libs.pari 0.0020969149 - 0.059981914*I - sage: (1+i).gamma_inc(5) # optional - sage.libs.pari + sage: (1+i).gamma_inc(5) # needs sage.libs.pari -0.0013781309 + 0.0065198200*I - sage: C(2).gamma_inc(1 + i) # optional - sage.libs.pari + sage: C(2).gamma_inc(1 + i) # needs sage.libs.pari 0.70709210 - 0.42035364*I - sage: CC(2).gamma_inc(5) # optional - sage.libs.pari + sage: CC(2).gamma_inc(5) # needs sage.libs.pari 0.0404276819945128 TESTS: @@ -2910,7 +2911,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): Check that :trac:`7099` is fixed:: sage: C = ComplexField(400) - sage: C(2 + I).gamma_inc(C(3 + I)) # abs tol 1e-120 # optional - sage.libs.pari + sage: C(2 + I).gamma_inc(C(3 + I)) # abs tol 1e-120 # needs sage.libs.pari 0.121515644664508695525971545977439666159749344176962379708992904126499444842886620664991650378432544392118359044438541515 + 0.101533909079826033296475736021224621546966200987295663190553587086145836461236284668967411665020429964946098113930918850*I """ @@ -3244,9 +3245,9 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): sage: i = ComplexField(30).gen() sage: z = 1 + i - sage: z.zeta() # optional - sage.libs.pari + sage: z.zeta() # needs sage.libs.pari 0.58215806 - 0.92684856*I - sage: zeta(z) # optional - sage.libs.pari + sage: zeta(z) # needs sage.libs.pari 0.58215806 - 0.92684856*I sage: CC(1).zeta() diff --git a/src/sage/rings/continued_fraction.py b/src/sage/rings/continued_fraction.py index 696a99753bb..c25a89cfd90 100644 --- a/src/sage/rings/continued_fraction.py +++ b/src/sage/rings/continued_fraction.py @@ -67,14 +67,14 @@ sage: 0 + 1/(2 + 1/22) 22/45 - sage: continued_fraction(pi) + sage: continued_fraction(pi) # needs sage.symbolic [3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, ...] - sage: continued_fraction_list(pi, nterms=5) + sage: continued_fraction_list(pi, nterms=5) # needs sage.symbolic [3, 7, 15, 1, 292] sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 5, embedding=1.709) # optional - sage.rings.number_field - sage: continued_fraction(cbrt5) # optional - sage.rings.number_field + sage: K. = NumberField(x^3 - 5, embedding=1.709) # needs sage.rings.number_field + sage: continued_fraction(cbrt5) # needs sage.rings.number_field [1; 1, 2, 2, 4, 3, 3, 1, 5, 1, 1, 4, 10, 17, 1, 14, 1, 1, 3052, 1, ...] It is also possible to create a continued fraction from a list of partial @@ -85,10 +85,9 @@ Even infinite:: - sage: w = words.ThueMorseWord([1,2]) - sage: w + sage: w = words.ThueMorseWord([1,2]); w # needs sage.combinat word: 1221211221121221211212211221211221121221... - sage: continued_fraction(w) + sage: continued_fraction(w) # needs sage.combinat [1; 2, 2, 1, 2, 1, 1, 2, 2, 1...] To go back and forth between the value (as a real number) and the partial @@ -101,18 +100,18 @@ sage: cf.value() 13/27 - sage: cf = continued_fraction(pi) - sage: cf.quotients() + sage: cf = continued_fraction(pi) # needs sage.symbolic + sage: cf.quotients() # needs sage.symbolic lazy list [3, 7, 15, ...] - sage: cf.value() + sage: cf.value() # needs sage.symbolic pi + sage: # needs sage.combinat sage: w = words.FibonacciWord([1,2]) sage: cf = continued_fraction(w) sage: cf.quotients() word: 1211212112112121121211211212112112121121... - sage: v = cf.value() - sage: v + sage: v = cf.value(); v 1.387954587967143? sage: v.n(digits=100) 1.387954587967142336919313859873185477878152452498532271894917289826418577622648932169885237034242967 @@ -122,6 +121,7 @@ Recall that quadratic numbers correspond to ultimately periodic continued fractions. For them special methods give access to preperiod and period:: + sage: # needs sage.rings.number_field sage: K. = QuadraticField(2) sage: cf = continued_fraction(sqrt2); cf [1; (2)*] @@ -132,18 +132,18 @@ sage: cf.period() (2,) - sage: cf = (3*sqrt2 + 1/2).continued_fraction(); cf + sage: cf = (3*sqrt2 + 1/2).continued_fraction(); cf # needs sage.rings.number_field [4; (1, 2, 1, 7)*] sage: cf = continued_fraction([(1,2,3),(1,4)]); cf [1; 2, 3, (1, 4)*] - sage: cf.value() + sage: cf.value() # needs sage.rings.number_field -2/23*sqrt2 + 36/23 On the following we can remark how the tail may change even in the same quadratic field:: - sage: for i in range(20): print(continued_fraction(i*sqrt2)) + sage: for i in range(20): print(continued_fraction(i*sqrt2)) # needs sage.rings.number_field [0] [1; (2)*] [2; (1, 4)*] @@ -157,6 +157,7 @@ Nevertheless, the tail is preserved under invertible integer homographies:: + sage: # needs sage.rings.number_field sage: apply_homography = lambda m,z: (m[0,0]*z + m[0,1]) / (m[1,0]*z + m[1,1]) sage: m1 = SL2Z([60,13,83,18]) sage: m2 = SL2Z([27,80,28,83]) @@ -361,7 +362,7 @@ def str(self, nterms=10, unicode=False, join=True): EXAMPLES:: - sage: print(continued_fraction(pi).str()) + sage: print(continued_fraction(pi).str()) # needs sage.symbolic 1 3 + ---------------------------------------------------- 1 @@ -381,9 +382,9 @@ def str(self, nterms=10, unicode=False, join=True): 1 2 + --------- 1 + ... - sage: print(continued_fraction(pi).str(nterms=1)) + sage: print(continued_fraction(pi).str(nterms=1)) # needs sage.symbolic 3 + ... - sage: print(continued_fraction(pi).str(nterms=2)) + sage: print(continued_fraction(pi).str(nterms=2)) # needs sage.symbolic 1 3 + --------- 7 + ... @@ -505,8 +506,8 @@ def _latex_(self, nterms=10): r""" EXAMPLES:: - sage: cf_pi = continued_fraction(pi) - sage: latex(cf_pi) + sage: cf_pi = continued_fraction(pi) # needs sage.symbolic + sage: latex(cf_pi) # needs sage.symbolic 3 + \frac{\displaystyle 1}{\displaystyle 7 + \frac{\displaystyle 1}{\displaystyle 15 @@ -518,7 +519,7 @@ def _latex_(self, nterms=10): + \frac{\displaystyle 1}{\displaystyle 2 + \frac{\displaystyle 1}{\displaystyle 1 + \frac{\displaystyle 1}{\displaystyle \dots}}}}}}}}}} - sage: print(cf_pi._latex_(nterms=3)) + sage: print(cf_pi._latex_(nterms=3)) # needs sage.symbolic 3 + \frac{\displaystyle 1}{\displaystyle 7 + \frac{\displaystyle 1}{\displaystyle 15 @@ -594,18 +595,19 @@ def _mpfr_(self, R): EXAMPLES:: - sage: continued_fraction(1/2).n() + sage: continued_fraction(1/2).n() # needs sage.rings.real_mpfr 0.500000000000000 - sage: continued_fraction([0,4]).n() + sage: continued_fraction([0,4]).n() # needs sage.rings.real_mpfr 0.250000000000000 - sage: continued_fraction([12,1,3,4,2,2,3,1,2]).n(digits=4) + sage: continued_fraction([12,1,3,4,2,2,3,1,2]).n(digits=4) # needs sage.rings.real_mpfr 12.76 - sage: continued_fraction(12/7).n(digits=13) == (12/7).n(digits=13) + sage: continued_fraction(12/7).n(digits=13) == (12/7).n(digits=13) # needs sage.rings.real_mpfr True - sage: continued_fraction(-14/333).n(digits=21) == (-14/333).n(digits=21) + sage: continued_fraction(-14/333).n(digits=21) == (-14/333).n(digits=21) # needs sage.rings.real_mpfr True + sage: # needs sage.symbolic sage: a = (106*pi - 333) / (355 - 113*pi) - 292 sage: cf = continued_fraction(a); cf [0; 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, 1, 84, 2, 1, ...] @@ -623,23 +625,23 @@ def _mpfr_(self, R): 0.63459101 sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2, 'a', embedding=1.25) # optional - sage.rings.number_field - sage: b = 504/253*a^2 + 635/253*a + 661/253 # optional - sage.rings.number_field - sage: cf = continued_fraction(b); cf # optional - sage.rings.number_field + sage: K. = NumberField(x^3 - 2, 'a', embedding=1.25) # needs sage.rings.number_field + sage: b = 504/253*a^2 + 635/253*a + 661/253 # needs sage.rings.number_field + sage: cf = continued_fraction(b); cf # needs sage.rings.number_field [8; 1, 14, 1, 10, 2, 1, 4, 12, 2, 3, 2, 1, 3, 4, 1, 1, 2, 14, 3, ...] - sage: cf.n(digits=3) + sage: cf.n(digits=3) # needs sage.rings.number_field 8.94 - sage: cf.n(digits=6) + sage: cf.n(digits=6) # needs sage.rings.number_field 8.93715 - sage: cf.n(digits=7) + sage: cf.n(digits=7) # needs sage.rings.number_field 8.937154 - sage: cf.n(digits=8) + sage: cf.n(digits=8) # needs sage.rings.number_field 8.9371541 - sage: cf.n(digits=9) + sage: cf.n(digits=9) # needs sage.rings.number_field 8.93715414 - sage: cf.n(digits=10) + sage: cf.n(digits=10) # needs sage.rings.number_field 8.937154138 - sage: cf.n(digits=11) + sage: cf.n(digits=11) # needs sage.rings.number_field 8.9371541378 TESTS: @@ -648,7 +650,7 @@ def _mpfr_(self, R): rational case):: sage: fields = [] - sage: for prec in [17, 24, 53, 128, 256]: + sage: for prec in [17, 24, 53, 128, 256]: # needs sage.rings.real_mpfr ....: for rnd in ['RNDN', 'RNDD', 'RNDU', 'RNDZ', 'RNDA']: ....: fields.append(RealField(prec=prec, rnd=rnd)) sage: for n in range(3000): # long time, not tested, known bug (see :trac:`29957`) @@ -745,7 +747,7 @@ def __float__(self): sage: a = continued_fraction(-17/389); a [-1; 1, 21, 1, 7, 2] - sage: float(a) + sage: float(a) # needs sage.rings.real_mpfr -0.043701799485861184 sage: float(-17/389) -0.043701799485861184 @@ -759,6 +761,7 @@ def numerator(self, n): EXAMPLES:: + sage: # needs sage.symbolic sage: c = continued_fraction(pi); c [3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, ...] sage: c.numerator(0) @@ -793,6 +796,7 @@ def denominator(self, n): EXAMPLES:: + sage: # needs sage.symbolic sage: c = continued_fraction(pi); c [3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, ...] sage: c.denominator(0) @@ -815,11 +819,11 @@ def convergent(self, n): EXAMPLES:: - sage: a = continued_fraction(pi); a + sage: a = continued_fraction(pi); a # needs sage.symbolic [3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, ...] - sage: a.convergent(3) + sage: a.convergent(3) # needs sage.symbolic 355/113 - sage: a.convergent(15) + sage: a.convergent(15) # needs sage.symbolic 411557987/131002976 """ return self.numerator(n) / self.denominator(n) @@ -883,15 +887,15 @@ def __getitem__(self, n): TESTS:: - sage: cf1 = continued_fraction(pi); cf1 + sage: cf1 = continued_fraction(pi); cf1 # needs sage.symbolic [3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, ...] - sage: cf2 = continued_fraction(QuadraticField(2).gen()); cf2 + sage: cf2 = continued_fraction(QuadraticField(2).gen()); cf2 # needs sage.rings.number_field [1; (2)*] sage: cf3 = continued_fraction(4/17); cf3 [0; 4, 4] - sage: cf1[3:17] + sage: cf1[3:17] # needs sage.symbolic [1; 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2] - sage: cf2[:10] + sage: cf2[:10] # needs sage.rings.number_field [1; 2, 2, 2, 2, 2, 2, 2, 2, 2] sage: cf3[1:16] [4; 4] @@ -899,7 +903,7 @@ def __getitem__(self, n): Be careful that the truncation of an infinite continued fraction might be shorter by one:: - sage: len(continued_fraction(golden_ratio)[:8]) + sage: len(continued_fraction(golden_ratio)[:8]) # needs sage.symbolic 7 """ if isinstance(n, slice): @@ -926,6 +930,7 @@ def __iter__(self): EXAMPLES:: + sage: # needs sage.symbolic sage: cf = continued_fraction(pi) sage: i = iter(cf) sage: [next(i) for _ in range(10)] @@ -964,7 +969,7 @@ def sign(self): EXAMPLES:: - sage: continued_fraction(tan(pi/7)).sign() + sage: continued_fraction(tan(pi/7)).sign() # needs sage.symbolic 1 sage: continued_fraction(-34/2115).sign() -1 @@ -1032,7 +1037,7 @@ def is_zero(self): False sage: continued_fraction(-1/2).is_zero() False - sage: continued_fraction(pi).is_zero() + sage: continued_fraction(pi).is_zero() # needs sage.symbolic False """ return self.quotient(0) == ZZ_0 and self.quotient(1) is Infinity @@ -1049,7 +1054,7 @@ def is_one(self): False sage: continued_fraction(0).is_one() False - sage: continued_fraction(pi).is_one() + sage: continued_fraction(pi).is_one() # needs sage.symbolic False """ return self.quotient(0) == ZZ_1 and self.quotient(1) is Infinity @@ -1098,7 +1103,7 @@ def multiplicative_order(self): 2 sage: continued_fraction(1).multiplicative_order() 1 - sage: continued_fraction(pi).multiplicative_order() + sage: continued_fraction(pi).multiplicative_order() # needs sage.symbolic +Infinity """ if self.is_zero(): @@ -1128,18 +1133,17 @@ def numerical_approx(self, prec=None, digits=None, algorithm=None): EXAMPLES:: - sage: w = words.FibonacciWord([1,3]) - sage: cf = continued_fraction(w) - sage: cf + sage: w = words.FibonacciWord([1,3]) # needs sage.combinat + sage: cf = continued_fraction(w); cf # needs sage.combinat [1; 3, 1, 1, 3, 1, 3, 1, 1, 3, 1, 1, 3, 1, 3, 1, 1, 3, 1, 3...] - sage: cf.numerical_approx(prec=53) + sage: cf.numerical_approx(prec=53) # needs sage.combinat 1.28102513329557 The method `n` is a shortcut to this one:: - sage: cf.n(digits=25) + sage: cf.n(digits=25) # needs sage.combinat 1.281025133295569815552930 - sage: cf.n(digits=33) + sage: cf.n(digits=33) # needs sage.combinat 1.28102513329556981555293038097590 """ from sage.arith.numerical_approx import (digits_to_bits, @@ -1174,22 +1178,20 @@ def apply_homography(self, a, b, c, d, forward_value=False): We demonstrate now the effect of the optional argument ``forward_value``:: - sage: cf = continued_fraction(pi) - sage: h1 = cf.apply_homography(35, -27, 12, -5) - sage: h1 + sage: cf = continued_fraction(pi) # needs sage.symbolic + sage: h1 = cf.apply_homography(35, -27, 12, -5); h1 # needs sage.symbolic [2; 1, 1, 6, 3, 1, 2, 1, 5, 3, 1, 1, 1, 1, 9, 12, 1, 1, 1, 3...] - sage: h1.value() + sage: h1.value() # needs sage.symbolic 2.536941776086946? - sage: h2 = cf.apply_homography(35, -27, 12, -5, forward_value=True) - sage: h2 + sage: h2 = cf.apply_homography(35, -27, 12, -5, forward_value=True); h2 # needs sage.symbolic [2; 1, 1, 6, 3, 1, 2, 1, 5, 3, 1, 1, 1, 1, 9, 12, 1, 1, 1, 3...] - sage: h2.value() + sage: h2.value() # needs sage.symbolic (35*pi - 27)/(12*pi - 5) TESTS:: - sage: CF = [continued_fraction(x) for x in [sqrt(2), AA(3).sqrt(), + sage: CF = [continued_fraction(x) for x in [sqrt(2), AA(3).sqrt(), # needs sage.rings.number_field sage.symbolic ....: AA(3)**(1/3), QuadraticField(37).gen(), pi, 113/27, ....: [3,1,2,2], words.FibonacciWord([1,3])]] sage: for _ in range(100): # not tested, known bug (see :trac:`32086`) @@ -1211,7 +1213,7 @@ def apply_homography(self, a, b, c, d, forward_value=False): ... ValueError: continued fraction can not represent infinity - sage: continued_fraction(pi).apply_homography(0, 1, 0, 0) + sage: continued_fraction(pi).apply_homography(0, 1, 0, 0) # needs sage.symbolic Traceback (most recent call last): ... ZeroDivisionError: division by zero @@ -1262,9 +1264,9 @@ def __neg__(self): EXAMPLES:: - sage: -continued_fraction(e) + sage: -continued_fraction(e) # needs sage.symbolic [-3; 3, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, 1, 10, 1, 1, 12, 1, 1, 14...] - sage: -continued_fraction(sqrt(7)) + sage: -continued_fraction(sqrt(7)) # needs sage.symbolic [-3; 2, 1, 4, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1, 1, 4...] """ return self.apply_homography(-1, 0, 0, 1) @@ -1275,9 +1277,9 @@ def __invert__(self): EXAMPLES:: - sage: ~continued_fraction(e) + sage: ~continued_fraction(e) # needs sage.symbolic [0; 2, 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, 1, 10, 1, 1, 12, 1...] - sage: ~continued_fraction(sqrt(7)) + sage: ~continued_fraction(sqrt(7)) # needs sage.symbolic [0; 2, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1...] """ return self.apply_homography(0, 1, 1, 0) @@ -1327,13 +1329,13 @@ def period(self): EXAMPLES:: - sage: K. = QuadraticField(3) - sage: cf = continued_fraction(sqrt3); cf + sage: K. = QuadraticField(3) # needs sage.rings.number_field + sage: cf = continued_fraction(sqrt3); cf # needs sage.rings.number_field [1; (1, 2)*] - sage: cf.period() + sage: cf.period() # needs sage.rings.number_field (1, 2) - sage: for k in xsrange(2,40): + sage: for k in xsrange(2,40): # needs sage.rings.number_field ....: if not k.is_square(): ....: s = QuadraticField(k).gen() ....: cf = continued_fraction(s) @@ -1365,15 +1367,15 @@ def preperiod(self): EXAMPLES:: - sage: K. = QuadraticField(3) - sage: cf = continued_fraction(sqrt3); cf + sage: K. = QuadraticField(3) # needs sage.rings.number_field + sage: cf = continued_fraction(sqrt3); cf # needs sage.rings.number_field [1; (1, 2)*] - sage: cf.preperiod() + sage: cf.preperiod() # needs sage.rings.number_field (1,) - sage: cf = continued_fraction(sqrt3/7); cf + sage: cf = continued_fraction(sqrt3/7); cf # needs sage.rings.number_field [0; 4, (24, 8)*] - sage: cf.preperiod() + sage: cf.preperiod() # needs sage.rings.number_field (0, 4) """ return self._x1 @@ -1448,6 +1450,7 @@ def __richcmp__(self, other, op): EXAMPLES:: + sage: # needs sage.rings.real_mpfr sage: a = continued_fraction([(0,),(1,2,3,1,2,3,1)]); a.n() 0.694249167819459 sage: b = continued_fraction([(0,),(1,2,3)]); b.n() @@ -1492,49 +1495,49 @@ def value(self): sage: cf = continued_fraction([(),(2,)]); cf [(2)*] - sage: v = cf.value(); v + sage: v = cf.value(); v # needs sage.rings.number_field sqrt2 + 1 - sage: v.continued_fraction() + sage: v.continued_fraction() # needs sage.rings.number_field [(2)*] sage: cf = continued_fraction([(),(1,2)]); cf [(1, 2)*] - sage: v = cf.value(); v + sage: v = cf.value(); v # needs sage.rings.number_field 1/2*sqrt3 + 1/2 - sage: v.continued_fraction() + sage: v.continued_fraction() # needs sage.rings.number_field [(1, 2)*] The number ``sqrt3`` that appear above is actually internal to the continued fraction. In order to be access it from the console:: - sage: cf.value().parent().inject_variables() + sage: cf.value().parent().inject_variables() # needs sage.rings.number_field Defining sqrt3 - sage: sqrt3 + sage: sqrt3 # needs sage.rings.number_field sqrt3 - sage: ((sqrt3+1)/2).continued_fraction() + sage: ((sqrt3+1)/2).continued_fraction() # needs sage.rings.number_field [(1, 2)*] Some ultimately periodic but non periodic examples:: sage: cf = continued_fraction([(1,),(2,)]); cf [1; (2)*] - sage: v = cf.value(); v + sage: v = cf.value(); v # needs sage.rings.number_field sqrt2 - sage: v.continued_fraction() + sage: v.continued_fraction() # needs sage.rings.number_field [1; (2)*] sage: cf = continued_fraction([(1,3),(1,2)]); cf [1; 3, (1, 2)*] - sage: v = cf.value(); v + sage: v = cf.value(); v # needs sage.rings.number_field -sqrt3 + 3 - sage: v.continued_fraction() + sage: v.continued_fraction() # needs sage.rings.number_field [1; 3, (1, 2)*] sage: cf = continued_fraction([(-5,18), (1,3,1,5)]) - sage: cf.value().continued_fraction() == cf + sage: cf.value().continued_fraction() == cf # needs sage.rings.number_field True sage: cf = continued_fraction([(-1,),(1,)]) - sage: cf.value().continued_fraction() == cf + sage: cf.value().continued_fraction() == cf # needs sage.rings.number_field True TESTS:: @@ -1544,7 +1547,7 @@ def value(self): sage: a3 = ((1,),(1,2)) sage: a4 = ((-2,2),(1,124,13)) sage: a5 = ((0,),(1,)) - sage: for a in a1,a2,a3,a4,a5: + sage: for a in a1,a2,a3,a4,a5: # needs sage.rings.number_field ....: cf = continued_fraction(a) ....: assert cf.value().continued_fraction() == cf """ @@ -1575,10 +1578,10 @@ def _repr_(self): r""" TESTS:: - sage: a = continued_fraction(pi.n()); a + sage: a = continued_fraction(pi.n()); a # needs sage.symbolic [3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 3] - sage: a.rename('continued fraction of pi') - sage: a + sage: a.rename('continued fraction of pi') # needs sage.symbolic + sage: a # needs sage.symbolic continued fraction of pi sage: continued_fraction([(0,1),(2,)]) @@ -1656,10 +1659,10 @@ def _latex_(self): + \frac{\displaystyle 1}{\displaystyle 7 + \frac{\displaystyle 1}{\displaystyle 2 }}}}} - sage: K. = QuadraticField(1234) - sage: cf=continued_fraction(a); cf + sage: K. = QuadraticField(1234) # needs sage.rings.number_field + sage: cf = continued_fraction(a); cf # needs sage.rings.number_field [35; (7, 1, 3, 1, 4, 4, 2, 9, 1, 1, 2, 3, 1, 1, 34, 1, 1, 3, 2, 1, 1, 9, 2, 4, 4, 1, 3, 1, 7, 70)*] - sage: latex(cf) + sage: latex(cf) # needs sage.rings.number_field 35 + \frac{\displaystyle 1}{\displaystyle 7 + \frac{\displaystyle 1}{\displaystyle 1 @@ -1701,6 +1704,7 @@ def __invert__(self): sage: a.value() * (~a).value() 1 + sage: # needs sage.rings.number_field sage: K. = QuadraticField(5) sage: a1 = (sqrt5+1)/2 sage: c1 = a1.continued_fraction(); c1 @@ -1710,9 +1714,9 @@ def __invert__(self): sage: c1.value() * (~c1).value() 1 - sage: c2 = (sqrt5/3 + 1/7).continued_fraction(); c2 + sage: c2 = (sqrt5/3 + 1/7).continued_fraction(); c2 # needs sage.rings.number_field [0; 1, (7, 1, 17, ..., 1, 2)*] - sage: c2.value() * (~c2).value() + sage: c2.value() * (~c2).value() # needs sage.rings.number_field 1 """ if not self: @@ -1744,7 +1748,7 @@ def __neg__(self): sage: quots2 = [((),(1,)), ((), (1,2)), ((0,),(1,)), ....: ((),(2,1)), ((3,),(2,1))] - sage: for q in quots2: # optional - sage.rings.number_field + sage: for q in quots2: # needs sage.rings.number_field ....: cf = continued_fraction(q) ....: ncf = -cf ....: nncf = -ncf @@ -1795,16 +1799,14 @@ class ContinuedFraction_real(ContinuedFraction_base): EXAMPLES:: - sage: cf = continued_fraction(pi) - sage: cf + sage: cf = continued_fraction(pi); cf # needs sage.symbolic [3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, ...] - sage: cf.value() + sage: cf.value() # needs sage.symbolic pi - sage: cf = continued_fraction(e) - sage: cf + sage: cf = continued_fraction(e); cf # needs sage.symbolic [2; 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, 1, 10, 1, 1, 12, 1, 1, ...] - sage: cf.value() + sage: cf.value() # needs sage.symbolic e """ def __init__(self, x): @@ -1815,7 +1817,7 @@ def __init__(self, x): TESTS:: - sage: TestSuite(continued_fraction(pi)).run() + sage: TestSuite(continued_fraction(pi)).run() # needs sage.symbolic """ ContinuedFraction_base.__init__(self) self._x0 = x @@ -1833,7 +1835,7 @@ def length(self): EXAMPLES:: - sage: continued_fraction(pi).length() + sage: continued_fraction(pi).length() # needs sage.symbolic +Infinity """ return Infinity @@ -1842,7 +1844,7 @@ def __len__(self): r""" TESTS:: - sage: len(continued_fraction(pi)) + sage: len(continued_fraction(pi)) # needs sage.symbolic Traceback (most recent call last): ... ValueError: the length is infinite! @@ -1855,9 +1857,9 @@ def __richcmp__(self, other, op): EXAMPLES:: - sage: continued_fraction(pi) > continued_fraction(e) + sage: continued_fraction(pi) > continued_fraction(e) # needs sage.symbolic True - sage: continued_fraction(pi) > continued_fraction(e+4) + sage: continued_fraction(pi) > continued_fraction(e+4) # needs sage.symbolic False """ try: @@ -1875,7 +1877,7 @@ def _repr_(self): EXAMPLES:: - sage: continued_fraction(pi) # indirect doctest + sage: continued_fraction(pi) # indirect doctest # needs sage.symbolic [3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, ...] """ return '[%d; ' % self.quotient(0) + ', '.join(str(self.quotient(i)) for i in range(1, 20)) + ", ...]" @@ -1886,12 +1888,13 @@ def quotient(self, n): EXAMPLES:: + sage: # needs sage.symbolic sage: cf = continued_fraction(pi) sage: cf.quotient(27) 13 sage: cf.quotient(2552) 152 - sage: cf.quotient(10000) # long time + sage: cf.quotient(10000) # long time 5 The algorithm is not efficient with element of the symbolic ring and, @@ -1900,6 +1903,7 @@ def quotient(self, n): evaluate in ``RIF`` an expression of the form ``(a*x+b)/(c*x+d)`` where both the numerator and the denominator are extremely small:: + sage: # needs sage.symbolic sage: a1 = pi sage: c1 = continued_fraction(a1) sage: p0 = c1.numerator(12); q0 = c1.denominator(12) @@ -1916,23 +1920,24 @@ def quotient(self, n): ``pi`` gives a very satisfactory answer:: sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2, embedding=1.25) # optional - sage.rings.number_field - sage: c2 = continued_fraction(a2) # optional - sage.rings.number_field - sage: p0 = c2.numerator(111); q0 = c2.denominator(111) # optional - sage.rings.number_field - sage: p1 = c2.numerator(112); q1 = c2.denominator(112) # optional - sage.rings.number_field - sage: num = (q0*a2 - p0); num.n() # optional - sage.rings.number_field + sage: K. = NumberField(x^3 - 2, embedding=1.25) # needs sage.rings.number_field + sage: c2 = continued_fraction(a2) # needs sage.rings.number_field + sage: p0 = c2.numerator(111); q0 = c2.denominator(111) # needs sage.rings.number_field + sage: p1 = c2.numerator(112); q1 = c2.denominator(112) # needs sage.rings.number_field + sage: num = (q0*a2 - p0); num.n() # needs sage.rings.number_field -4.56719261665907e46 - sage: den = (q1*a2 - p1); den.n() + sage: den = (q1*a2 - p1); den.n() # needs sage.rings.number_field -3.65375409332726e47 - sage: a2 = -num/den - sage: b2 = RIF(a2); b2 + sage: a2 = -num/den # needs sage.rings.number_field + sage: b2 = RIF(a2); b2 # needs sage.rings.number_field 1.002685823312715? - sage: b2.absolute_diameter() + sage: b2.absolute_diameter() # needs sage.rings.number_field 8.88178419700125e-16 The consequence is that the precision needed with ``c1`` grows when we compute larger and larger partial quotients:: + sage: # needs sage.symbolic sage: c1.quotient(100) 2 sage: c1._xa.parent() @@ -1946,6 +1951,7 @@ def quotient(self, n): sage: c1._xa.parent() Real Interval Field with 1053 bits of precision + sage: # needs sage.rings.number_field sage: c2.quotient(200) 6 sage: c2._xa.parent() @@ -1995,8 +2001,8 @@ def value(self): EXAMPLES:: - sage: cf = continued_fraction(e) - sage: cf.value() + sage: cf = continued_fraction(e) # needs sage.symbolic + sage: cf.value() # needs sage.symbolic e """ return self._x0 @@ -2008,16 +2014,16 @@ class ContinuedFraction_infinite(ContinuedFraction_base): EXAMPLES:: - sage: t = continued_fraction(words.ThueMorseWord([1,2])); t + sage: t = continued_fraction(words.ThueMorseWord([1,2])); t # needs sage.combinat [1; 2, 2, 1, 2, 1, 1, 2, 2, 1...] - sage: t.n(digits=100) + sage: t.n(digits=100) # needs sage.combinat 1.422388736882785488341547116024565825306879108991711829311892452916456747272565883312455412962072042 We check that comparisons work well:: - sage: t > continued_fraction(1) and t < continued_fraction(3/2) + sage: t > continued_fraction(1) and t < continued_fraction(3/2) # needs sage.combinat True - sage: t < continued_fraction(1) or t > continued_fraction(2) + sage: t < continued_fraction(1) or t > continued_fraction(2) # needs sage.combinat False Can also be called with a ``value`` option:: @@ -2025,16 +2031,14 @@ class ContinuedFraction_infinite(ContinuedFraction_base): sage: def f(n): ....: if n % 3 == 2: return 2*(n+1)//3 ....: return 1 - sage: w = Word(f, alphabet=NN) - sage: w + sage: w = Word(f, alphabet=NN); w # needs sage.combinat word: 1,1,2,1,1,4,1,1,6,1,1,8,1,1,10,1,1,12,1,1,14,1,1,16,1,1,18,1,1,20,1,1,22,1,1,24,1,1,26,1,... - sage: cf = continued_fraction(w, value=e-1) - sage: cf + sage: cf = continued_fraction(w, value=e-1); cf # needs sage.combinat sage.symbolic [1; 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, 1, 10, 1, 1, 12, 1, 1...] In that case a small check is done on the input:: - sage: cf = continued_fraction(w, value=pi) + sage: cf = continued_fraction(w, value=pi) # needs sage.combinat sage.symbolic Traceback (most recent call last): ... ValueError: value evaluates to 3.141592653589794? while the continued @@ -2056,32 +2060,32 @@ def __init__(self, w, value=None, check=True): TESTS:: - sage: w = words.FibonacciWord(['a','b']) - sage: continued_fraction(w) + sage: w = words.FibonacciWord(['a','b']) # needs sage.combinat + sage: continued_fraction(w) # needs sage.combinat Traceback (most recent call last): ... ValueError: the sequence must consist of integers sage: from itertools import count - sage: w = Word(count(), length="infinite") - sage: continued_fraction(w) + sage: w = Word(count(), length="infinite") # needs sage.combinat + sage: continued_fraction(w) # needs sage.combinat [0; 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19...] - sage: w = Word(count(), length="unknown") - sage: continued_fraction(w) + sage: w = Word(count(), length="unknown") # needs sage.combinat + sage: continued_fraction(w) # needs sage.combinat Traceback (most recent call last): ... ValueError: word with unknown length cannot be converted to continued fractions - sage: continued_fraction(words.FibonacciWord([0,1])) + sage: continued_fraction(words.FibonacciWord([0,1])) # needs sage.combinat Traceback (most recent call last): ... ValueError: only the first partial quotient can be null - sage: w = words.ThueMorseWord([int(1), int(2)]) - sage: t = continued_fraction(w) - sage: type(t.quotient(1)) + sage: w = words.ThueMorseWord([int(1), int(2)]) # needs sage.combinat + sage: t = continued_fraction(w) # needs sage.combinat + sage: type(t.quotient(1)) # needs sage.combinat """ ContinuedFraction_base.__init__(self) @@ -2118,8 +2122,8 @@ def _repr_(self): EXAMPLES:: - sage: w = words.FibonacciWord([3,13]) - sage: cf = continued_fraction(w); cf + sage: w = words.FibonacciWord([3,13]) # needs sage.combinat + sage: cf = continued_fraction(w); cf # needs sage.combinat [3; 13, 3, 3, 13, 3, 13, 3, 3, 13, 3, 3, 13, 3, 13, 3, 3, 13, 3, 13...] """ return "[" + str(self._w[0]) + "; " + ", ".join(map(str, self._w[1:20])) + "...]" @@ -2130,9 +2134,9 @@ def length(self): EXAMPLES:: - sage: w = words.FibonacciWord([3,13]) - sage: cf = continued_fraction(w) - sage: cf.length() + sage: w = words.FibonacciWord([3,13]) # needs sage.combinat + sage: cf = continued_fraction(w) # needs sage.combinat + sage: cf.length() # needs sage.combinat +Infinity """ return Infinity @@ -2147,6 +2151,7 @@ def quotient(self, n): EXAMPLES:: + sage: # needs sage.combinat sage: w = words.FibonacciWord([1,3]) sage: cf = continued_fraction(w) sage: cf.quotient(0) @@ -2164,9 +2169,9 @@ def quotients(self): EXAMPLES:: - sage: w = words.FibonacciWord([1,5]) - sage: cf = continued_fraction(w) - sage: cf.quotients() + sage: w = words.FibonacciWord([1,5]) # needs sage.combinat + sage: cf = continued_fraction(w) # needs sage.combinat + sage: cf.quotients() # needs sage.combinat word: 1511515115115151151511511515115115151151... """ return self._w @@ -2181,6 +2186,7 @@ def _Integer_quotient(self, n): EXAMPLES:: + sage: # needs sage.combinat sage: w = words.ThueMorseWord([int(1), int(2)]) sage: t = continued_fraction(w) sage: t.quotient(0) @@ -2204,20 +2210,17 @@ def value(self): sage: def f(n): ....: if n % 3 == 2: return 2*(n+1)//3 ....: return 1 - sage: w = Word(f, alphabet=NN) - sage: w + sage: w = Word(f, alphabet=NN); w # needs sage.combinat word: 1,1,2,1,1,4,1,1,6,1,1,8,1,1,10,1,1,12,1,1,14,1,1,16,1,1,18,1,1,20,1,1,22,1,1,24,1,1,26,1,... - sage: cf = continued_fraction(w, value=e-1) - sage: cf + sage: cf = continued_fraction(w, value=e-1); cf # needs sage.combinat sage.symbolic [1; 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, 1, 10, 1, 1, 12, 1, 1...] - sage: cf.value() + sage: cf.value() # needs sage.combinat sage.symbolic e - 1 - sage: w = words.FibonacciWord([2,5]) - sage: cf = continued_fraction(w) - sage: cf + sage: w = words.FibonacciWord([2,5]) # needs sage.combinat + sage: cf = continued_fraction(w); cf # needs sage.combinat [2; 5, 2, 2, 5, 2, 5, 2, 2, 5, 2, 2, 5, 2, 5, 2, 2, 5, 2, 5...] - sage: cf.value() + sage: cf.value() # needs sage.combinat 2.184951302409338? """ if self._value is not None: @@ -2234,12 +2237,12 @@ def __neg__(self): EXAMPLES:: - sage: -continued_fraction(words.FibonacciWord([2,5])) + sage: -continued_fraction(words.FibonacciWord([2,5])) # needs sage.combinat [-3; 1, 4, 2, 2, 5, 2, 5, 2, 2, 5, 2, 2, 5, 2, 5, 2, 2, 5, 2...] sage: from sage.misc.lazy_list import lazy_list sage: l = lazy_list(lambda n: (n**2)%17) - sage: -continued_fraction(l) + sage: -continued_fraction(l) # needs sage.combinat [-1; 5, 9, 16, 8, 2, 15, 13, 13, 15, 2, 8, 16, 9, 4, 1, 0, 1, 4, 9...] """ from sage.combinat.words.word import Word @@ -2381,32 +2384,34 @@ def continued_fraction_list(x, type="std", partial_convergents=False, Specifying ``bits`` or ``nterms`` modify the length of the output:: - sage: continued_fraction_list(e, bits=20) + sage: continued_fraction_list(e, bits=20) # needs sage.symbolic [2, 1, 2, 1, 1, 4, 2] - sage: continued_fraction_list(sqrt(2)+sqrt(3), bits=30) + sage: continued_fraction_list(sqrt(2)+sqrt(3), bits=30) # needs sage.symbolic [3, 6, 1, 5, 7, 2] - sage: continued_fraction_list(pi, bits=53) + sage: continued_fraction_list(pi, bits=53) # needs sage.symbolic [3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14] - sage: continued_fraction_list(log(3/2), nterms=15) + sage: continued_fraction_list(log(3/2), nterms=15) # needs sage.symbolic [0, 2, 2, 6, 1, 11, 2, 1, 2, 2, 1, 4, 3, 1, 1] - sage: continued_fraction_list(tan(sqrt(pi)), nterms=20) + sage: continued_fraction_list(tan(sqrt(pi)), nterms=20) # needs sage.symbolic [-5, 9, 4, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 2, 4, 3, 1, 63] When the continued fraction is infinite (ie ``x`` is an irrational number) and the parameters ``bits`` and ``nterms`` are not specified then a warning is raised:: - sage: continued_fraction_list(sqrt(2)) - doctest:...: UserWarning: the continued fraction of sqrt(2) seems infinite, return only the first 20 terms + sage: continued_fraction_list(sqrt(2)) # needs sage.symbolic + doctest:...: UserWarning: the continued fraction of sqrt(2) seems infinite, + return only the first 20 terms [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] - sage: continued_fraction_list(sqrt(4/19)) - doctest:...: UserWarning: the continued fraction of 2*sqrt(1/19) seems infinite, return only the first 20 terms + sage: continued_fraction_list(sqrt(4/19)) # needs sage.symbolic + doctest:...: UserWarning: the continued fraction of 2*sqrt(1/19) seems infinite, + return only the first 20 terms [0, 2, 5, 1, 1, 2, 1, 16, 1, 2, 1, 1, 5, 4, 5, 1, 1, 2, 1, 16] An examples with the list of partial convergents:: - sage: continued_fraction_list(RR(pi), partial_convergents=True) + sage: continued_fraction_list(RR(pi), partial_convergents=True) # needs sage.symbolic ([3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 3], [(3, 1), (22, 7), @@ -2427,11 +2432,11 @@ def continued_fraction_list(x, type="std", partial_convergents=False, sage: continued_fraction_list(1 + 10^-10, nterms=3) [1, 10000000000] - sage: continued_fraction_list(1 + 10^-20 - e^-100, nterms=3) + sage: continued_fraction_list(1 + 10^-20 - e^-100, nterms=3) # needs sage.symbolic [1, 100000000000000000000, 2688] - sage: continued_fraction_list(1 + 10^-20 - e^-100, nterms=5) + sage: continued_fraction_list(1 + 10^-20 - e^-100, nterms=5) # needs sage.symbolic [1, 100000000000000000000, 2688, 8, 1] - sage: continued_fraction_list(1 + 10^-20 - e^-100, nterms=5) + sage: continued_fraction_list(1 + 10^-20 - e^-100, nterms=5) # needs sage.symbolic [1, 100000000000000000000, 2688, 8, 1] Fixed :trac:`18901`:: @@ -2444,7 +2449,7 @@ def continued_fraction_list(x, type="std", partial_convergents=False, Check that this works for arb elements (:trac:`20069`):: - sage: continued_fraction(RBF(e)) + sage: continued_fraction(RBF(e)) # needs sage.symbolic [2; 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, 1, 10, 1, 1, 12] """ from .rational_field import QQ @@ -2537,31 +2542,33 @@ def continued_fraction(x, value=None): It can be called with elements defined from symbolic values, in which case the partial quotients are evaluated in a lazy way:: - sage: c = continued_fraction(golden_ratio); c # optional - sage.symbolic + sage: c = continued_fraction(golden_ratio); c # needs sage.symbolic [1; 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...] - sage: c.convergent(12) # optional - sage.symbolic + sage: c.convergent(12) # needs sage.symbolic 377/233 - sage: fibonacci(14)/fibonacci(13) + sage: fibonacci(14)/fibonacci(13) # needs sage.libs.pari 377/233 - sage: continued_fraction(pi) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: continued_fraction(pi) [3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, ...] - sage: c = continued_fraction(pi); c # optional - sage.symbolic + sage: c = continued_fraction(pi); c [3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, ...] - sage: a = c.convergent(3); a # optional - sage.symbolic + sage: a = c.convergent(3); a 355/113 - sage: a.n() # optional - sage.symbolic + sage: a.n() 3.14159292035398 - sage: pi.n() # optional - sage.symbolic + sage: pi.n() 3.14159265358979 - sage: continued_fraction(sqrt(2)) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: continued_fraction(sqrt(2)) [1; 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ...] - sage: continued_fraction(tan(1)) # optional - sage.symbolic + sage: continued_fraction(tan(1)) [1; 1, 1, 3, 1, 5, 1, 7, 1, 9, 1, 11, 1, 13, 1, 15, 1, 17, 1, 19, ...] - sage: continued_fraction(tanh(1)) # optional - sage.symbolic + sage: continued_fraction(tanh(1)) [0; 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, ...] - sage: continued_fraction(e) # optional - sage.symbolic + sage: continued_fraction(e) [2; 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, 1, 10, 1, 1, 12, 1, 1, ...] If you want to play with quadratic numbers (such as ``golden_ratio`` and @@ -2569,21 +2576,22 @@ def continued_fraction(x, value=None): follows since preperiods and periods are computed:: sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 - 5, embedding=2.23) # optional - sage.rings.number_field - sage: my_golden_ratio = (1 + sqrt5)/2 # optional - sage.rings.number_field - sage: cf = continued_fraction((1+sqrt5)/2); cf # optional - sage.rings.number_field + sage: K. = NumberField(x^2 - 5, embedding=2.23) # needs sage.rings.number_field + sage: my_golden_ratio = (1 + sqrt5)/2 # needs sage.rings.number_field + sage: cf = continued_fraction((1+sqrt5)/2); cf # needs sage.rings.number_field [(1)*] - sage: cf.convergent(12) + sage: cf.convergent(12) # needs sage.rings.number_field 377/233 - sage: cf.period() + sage: cf.period() # needs sage.rings.number_field (1,) - sage: cf = continued_fraction(2/3+sqrt5/5); cf + sage: cf = continued_fraction(2/3+sqrt5/5); cf # needs sage.rings.number_field [1; 8, (1, 3, 1, 1, 3, 9)*] - sage: cf.preperiod() + sage: cf.preperiod() # needs sage.rings.number_field (1, 8) - sage: cf.period() + sage: cf.period() # needs sage.rings.number_field (1, 3, 1, 1, 3, 9) + sage: # needs sage.rings.number_field sage: L. = NumberField(x^2 - 2, embedding=1.41) sage: cf = continued_fraction(sqrt2); cf [1; (2)*] @@ -2600,20 +2608,20 @@ def continued_fraction(x, value=None): sage: cf = continued_fraction([(1,1), (2,8)]); cf [1; 1, (2, 8)*] - sage: cf.value() + sage: cf.value() # needs sage.rings.number_field 2/11*sqrt5 + 14/11 It is possible to deal with higher degree number fields but in that case the continued fraction expansion is known to be aperiodic:: - sage: K. = NumberField(x^3 - 2, embedding=1.25) - sage: cf = continued_fraction(a); cf + sage: K. = NumberField(x^3 - 2, embedding=1.25) # needs sage.rings.number_field + sage: cf = continued_fraction(a); cf # needs sage.rings.number_field [1; 3, 1, 5, 1, 1, 4, 1, 1, 8, 1, 14, 1, 10, 2, 1, 4, 12, 2, 3, ...] Note that initial rounding can result in incorrect trailing partial quotients:: - sage: continued_fraction(RealField(39)(e)) + sage: continued_fraction(RealField(39)(e)) # needs sage.symbolic [2; 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, 1, 10, 2] Note the value returned for floating point number is the continued fraction @@ -2635,8 +2643,8 @@ def continued_fraction(x, value=None): Constants in symbolic subrings work like constants in ``SR``:: - sage: SCR = SR.subring(no_variables=True) # optional - sage.symbolic - sage: continued_fraction(SCR(pi)) # optional - sage.symbolic + sage: SCR = SR.subring(no_variables=True) # needs sage.symbolic + sage: continued_fraction(SCR(pi)) # needs sage.symbolic [3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, ...] """ diff --git a/src/sage/rings/continued_fraction_gosper.py b/src/sage/rings/continued_fraction_gosper.py index 08d5dd34658..4f86b3d9da6 100644 --- a/src/sage/rings/continued_fraction_gosper.py +++ b/src/sage/rings/continued_fraction_gosper.py @@ -4,12 +4,13 @@ EXAMPLES:: + sage: # needs sage.symbolic sage: from sage.rings.continued_fraction_gosper import gosper_iterator sage: x = continued_fraction(pi) sage: it = iter(gosper_iterator(3,2,3,1,x)) - sage: Word(it, length='infinite') + sage: Word(it, length='infinite') # needs sage.combinat word: 1,10,2,2,1,4,1,1,1,97,4,1,2,1,2,45,6,4,9,1,27,2,6,1,4,2,3,1,3,1,15,2,1,1,2,1,1,2,32,1,... - sage: continued_fraction((3*pi + 2) / (3*pi + 1)) + sage: continued_fraction((3*pi + 2) / (3*pi + 1)) # needs sage.combinat [1; 10, 2, 2, 1, 4, 1, 1, 1, 97, 4, 1, 2, 1, 2, 45, 6, 4, 9, 1, ...] REFERENCES: @@ -104,9 +105,9 @@ def __iter__(self): sage: from sage.rings.continued_fraction_gosper import gosper_iterator sage: a, b, c, d = (Integer(randint(-100,100)) for _ in range(4)) - sage: ig = iter(gosper_iterator(a, b, c, d, continued_fraction(pi))) - sage: icf = iter(continued_fraction((a*pi + b) / (c*pi + d))); - sage: for i in range(10): + sage: ig = iter(gosper_iterator(a, b, c, d, continued_fraction(pi))) # needs sage.symbolic + sage: icf = iter(continued_fraction((a*pi + b) / (c*pi + d))); # needs sage.symbolic + sage: for i in range(10): # needs sage.symbolic ....: try: ....: assert next(ig) == next(icf) ....: except StopIteration: @@ -121,8 +122,8 @@ def __next__(self): TESTS:: sage: from sage.rings.continued_fraction_gosper import gosper_iterator - sage: it = gosper_iterator(1, 0, 0, 1, continued_fraction(pi)) - sage: list(next(it) for _ in range(10)) + sage: it = gosper_iterator(1, 0, 0, 1, continued_fraction(pi)) # needs sage.symbolic + sage: list(next(it) for _ in range(10)) # needs sage.symbolic [3, 7, 15, 1, 292, 1, 1, 1, 2, 1] """ while True: @@ -156,10 +157,10 @@ def emit(self, q): sage: a = Integer(randint(-100,100)); b = Integer(randint(-100,100)); sage: c = Integer(randint(-100,100)); d = Integer(randint(-100,100)); sage: from sage.rings.continued_fraction_gosper import gosper_iterator - sage: gi = gosper_iterator(a,b,c,d,continued_fraction(pi)) - sage: for i in range(10): + sage: gi = gosper_iterator(a, b, c, d, continued_fraction(pi)) # needs sage.symbolic + sage: for i in range(10): # needs sage.symbolic ....: gi.emit(i) - sage: gi.currently_emitted + sage: gi.currently_emitted # needs sage.symbolic 10 """ self.currently_emitted += 1 @@ -182,10 +183,10 @@ def ingest(self): sage: a = Integer(randint(-100,100)); b = Integer(randint(-100,100)); sage: c = Integer(randint(-100,100)); d = Integer(randint(-100,100)); sage: from sage.rings.continued_fraction_gosper import gosper_iterator - sage: gi = gosper_iterator(a,b,c,d,continued_fraction(pi)) - sage: for i in range(10): + sage: gi = gosper_iterator(a, b, c, d, continued_fraction(pi)) # needs sage.symbolic + sage: for i in range(10): # needs sage.symbolic ....: gi.ingest() - sage: gi.currently_read + sage: gi.currently_read # needs sage.symbolic 10 """ try: diff --git a/src/sage/rings/derivation.py b/src/sage/rings/derivation.py index 74903e6072f..136c8c40307 100644 --- a/src/sage/rings/derivation.py +++ b/src/sage/rings/derivation.py @@ -231,32 +231,32 @@ def __init__(self, domain, codomain, twist=None): sage: TestSuite(M).run() sage: from sage.rings.derivation import RingDerivationModule - sage: R5. = GF(5)[] # optional - sage.rings.finite_rings - sage: R25. = GF(25)[] # optional - sage.rings.finite_rings - sage: R7. = GF(7)[] # optional - sage.rings.finite_rings + sage: R5. = GF(5)[] # needs sage.rings.finite_rings + sage: R25. = GF(25)[] # needs sage.rings.finite_rings + sage: R7. = GF(7)[] # needs sage.rings.finite_rings - sage: RingDerivationModule(R5, R25) # optional - sage.rings.finite_rings + sage: RingDerivationModule(R5, R25) # needs sage.rings.finite_rings Module of derivations from Univariate Polynomial Ring in x over Finite Field of size 5 to Univariate Polynomial Ring in x over Finite Field in z2 of size 5^2 - sage: RingDerivationModule(R5, R5^2) # optional - sage.rings.finite_rings + sage: RingDerivationModule(R5, R5^2) # needs sage.rings.finite_rings Traceback (most recent call last): ... TypeError: the codomain must be an algebra over the domain or a morphism with the correct domain - sage: RingDerivationModule(R5, R7) # optional - sage.rings.finite_rings + sage: RingDerivationModule(R5, R7) # needs sage.rings.finite_rings Traceback (most recent call last): ... TypeError: the codomain must be an algebra over the domain or a morphism with the correct domain - sage: theta = R5.hom([R5.gen()^2]) # optional - sage.rings.finite_rings - sage: RingDerivationModule(R5, R25, twist=theta) # optional - sage.rings.finite_rings + sage: theta = R5.hom([R5.gen()^2]) # needs sage.rings.finite_rings + sage: RingDerivationModule(R5, R25, twist=theta) # needs sage.rings.finite_rings Module of twisted derivations from Univariate Polynomial Ring in x over Finite Field of size 5 to Univariate Polynomial Ring in x over Finite Field in z2 of size 5^2 (twisting morphism: x |--> x^2) - sage: RingDerivationModule(R7, R7, twist=theta) # optional - sage.rings.finite_rings + sage: RingDerivationModule(R7, R7, twist=theta) # needs sage.rings.finite_rings Traceback (most recent call last): ... TypeError: the domain of the derivation must coerce to the domain of the twisting homomorphism @@ -1074,10 +1074,10 @@ def _richcmp_(self, other, op): EXAMPLES:: - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: D = sum(v*R.derivation(v) for v in R.gens()); D # optional - sage.rings.finite_rings + sage: R. = GF(5)[] # needs sage.rings.finite_rings + sage: D = sum(v*R.derivation(v) for v in R.gens()); D # needs sage.rings.finite_rings x*d/dx + y*d/dy + z*d/dz - sage: D.pth_power() == D # optional - sage.rings.finite_rings + sage: D.pth_power() == D # needs sage.rings.finite_rings True """ @@ -1149,17 +1149,18 @@ def pth_power(self): EXAMPLES:: - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: Dx = R.derivation(x) # optional - sage.rings.finite_rings - sage: Dx.pth_power() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(5)[] + sage: Dx = R.derivation(x) + sage: Dx.pth_power() 0 - sage: (x*Dx).pth_power() # optional - sage.rings.finite_rings + sage: (x*Dx).pth_power() x*d/dx - sage: (x^6*Dx).pth_power() # optional - sage.rings.finite_rings + sage: (x^6*Dx).pth_power() x^26*d/dx - sage: Dy = R.derivation(y) # optional - sage.rings.finite_rings - sage: (x*Dx + y*Dy).pth_power() # optional - sage.rings.finite_rings + sage: Dy = R.derivation(y) # needs sage.rings.finite_rings + sage: (x*Dx + y*Dy).pth_power() # needs sage.rings.finite_rings x*d/dx + y*d/dy An error is raised if the domain has characteristic zero:: @@ -1182,14 +1183,15 @@ def pth_power(self): TESTS:: - sage: R. = GF(3)[] # optional - sage.rings.finite_rings - sage: D = R.derivation_module().random_element() # optional - sage.rings.finite_rings - sage: Dp = D.pth_power() # optional - sage.rings.finite_rings - sage: f = R.random_element() # optional - sage.rings.finite_rings - sage: Dp(f) == D(D(D(f))) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(3)[] + sage: D = R.derivation_module().random_element() + sage: Dp = D.pth_power() + sage: f = R.random_element() + sage: Dp(f) == D(D(D(f))) True - sage: D.bracket(Dp) # optional - sage.rings.finite_rings + sage: D.bracket(Dp) # needs sage.rings.finite_rings 0 """ @@ -1578,15 +1580,16 @@ def __init__(self, parent, arg=None): TESTS:: + sage: # needs sage.rings.finite_rings sage: from sage.rings.derivation import RingDerivationWithoutTwist_wrapper - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: S = R.quo([x^5, y^5]) # optional - sage.rings.finite_rings - sage: M = S.derivation_module() # optional - sage.rings.finite_rings - sage: der = M.random_element() # optional - sage.rings.finite_rings - sage: isinstance(der, RingDerivationWithoutTwist_wrapper) # optional - sage.rings.finite_rings + sage: R. = GF(5)[] + sage: S = R.quo([x^5, y^5]) + sage: M = S.derivation_module() + sage: der = M.random_element() + sage: isinstance(der, RingDerivationWithoutTwist_wrapper) True - sage: TestSuite(der).run() # optional - sage.rings.finite_rings + sage: TestSuite(der).run() # needs sage.rings.finite_rings """ if isinstance(arg, list) and len(arg) == 1 and isinstance(arg[0], RingDerivation): @@ -1617,11 +1620,12 @@ def _add_(self, other): EXAMPLES:: - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: S. = R.quo([X^5, Y^5]) # optional - sage.rings.finite_rings - sage: Dx = S.derivation(x) # optional - sage.rings.finite_rings - sage: Dy = S.derivation(y) # optional - sage.rings.finite_rings - sage: Dx + Dy # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(5)[] + sage: S. = R.quo([X^5, Y^5]) + sage: Dx = S.derivation(x) + sage: Dy = S.derivation(y) + sage: Dx + Dy d/dx + d/dy """ @@ -1633,11 +1637,12 @@ def _sub_(self, other): EXAMPLES:: - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: S. = R.quo([X^5, Y^5]) # optional - sage.rings.finite_rings - sage: Dx = S.derivation(x) # optional - sage.rings.finite_rings - sage: Dy = S.derivation(y) # optional - sage.rings.finite_rings - sage: Dx - Dy # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(5)[] + sage: S. = R.quo([X^5, Y^5]) + sage: Dx = S.derivation(x) + sage: Dy = S.derivation(y) + sage: Dx - Dy d/dx - d/dy """ @@ -1649,10 +1654,11 @@ def _neg_(self): EXAMPLES:: - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: S. = R.quo([X^5, Y^5]) # optional - sage.rings.finite_rings - sage: Dx = S.derivation(x) # optional - sage.rings.finite_rings - sage: -Dx # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(5)[] + sage: S. = R.quo([X^5, Y^5]) + sage: Dx = S.derivation(x) + sage: -Dx -d/dx """ @@ -1664,12 +1670,13 @@ def _lmul_(self, factor): EXAMPLES:: - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: S. = R.quo([X^5, Y^5]) # optional - sage.rings.finite_rings - sage: Dx = S.derivation(x) # optional - sage.rings.finite_rings - sage: Dx * 2 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(5)[] + sage: S. = R.quo([X^5, Y^5]) + sage: Dx = S.derivation(x) + sage: Dx * 2 2*d/dx - sage: Dx * x^2 # optional - sage.rings.finite_rings + sage: Dx * x^2 x^2*d/dx """ @@ -1681,12 +1688,13 @@ def _rmul_(self, factor): EXAMPLES:: - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: S. = R.quo([X^5, Y^5]) # optional - sage.rings.finite_rings - sage: Dx = S.derivation(x) # optional - sage.rings.finite_rings - sage: 2 * Dx # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(5)[] + sage: S. = R.quo([X^5, Y^5]) + sage: Dx = S.derivation(x) + sage: 2 * Dx 2*d/dx - sage: x^2 * Dx # optional - sage.rings.finite_rings + sage: x^2 * Dx x^2*d/dx """ @@ -1699,20 +1707,21 @@ def list(self): EXAMPLES:: - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: S. = R.quo([X^5, Y^5]) # optional - sage.rings.finite_rings - sage: M = S.derivation_module() # optional - sage.rings.finite_rings - sage: M.basis() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(5)[] + sage: S. = R.quo([X^5, Y^5]) + sage: M = S.derivation_module() + sage: M.basis() Family (d/dx, d/dy) - sage: S.derivation(x).list() # optional - sage.rings.finite_rings + sage: S.derivation(x).list() # needs sage.rings.finite_rings [1, 0] - sage: S.derivation(y).list() # optional - sage.rings.finite_rings + sage: S.derivation(y).list() # needs sage.rings.finite_rings [0, 1] - sage: f = x*S.derivation(x) + y*S.derivation(y); f # optional - sage.rings.finite_rings + sage: f = x*S.derivation(x) + y*S.derivation(y); f # needs sage.rings.finite_rings x*d/dx + y*d/dy - sage: f.list() # optional - sage.rings.finite_rings + sage: f.list() # needs sage.rings.finite_rings [x, y] """ @@ -1906,19 +1915,19 @@ def list(self): EXAMPLES:: - sage: R. = GF(5)[[]] # optional - sage.rings.finite_rings - sage: M = R.derivation_module() # optional - sage.rings.finite_rings - sage: M.basis() # optional - sage.rings.finite_rings + sage: R. = GF(5)[[]] # needs sage.rings.finite_rings + sage: M = R.derivation_module() # needs sage.rings.finite_rings + sage: M.basis() # needs sage.rings.finite_rings Family (d/dx, d/dy) - sage: R.derivation(x).list() # optional - sage.rings.finite_rings + sage: R.derivation(x).list() # needs sage.rings.finite_rings [1, 0] - sage: R.derivation(y).list() # optional - sage.rings.finite_rings + sage: R.derivation(y).list() # needs sage.rings.finite_rings [0, 1] - sage: f = x*R.derivation(x) + y*R.derivation(y); f # optional - sage.rings.finite_rings + sage: f = x*R.derivation(x) + y*R.derivation(y); f # needs sage.rings.finite_rings x*d/dx + y*d/dy - sage: f.list() # optional - sage.rings.finite_rings + sage: f.list() # needs sage.rings.finite_rings [x, y] """ @@ -1991,11 +2000,12 @@ def _call_(self, x): EXAMPLES:: - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: S. = R.quo([X^5, Y^5]) # optional - sage.rings.finite_rings - sage: f = x^3*S.derivation(); f # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(5)[] + sage: S. = R.quo([X^5, Y^5]) + sage: f = x^3*S.derivation(); f x^3*d/dx - sage: f(x^3) # optional - sage.rings.finite_rings + sage: f(x^3) 0 """ @@ -2091,10 +2101,11 @@ def _latex_(self): EXAMPLES:: - sage: k. = GF(5^3) # optional - sage.rings.finite_rings - sage: Frob = k.frobenius_endomorphism() # optional - sage.rings.finite_rings - sage: der = k.derivation(a + 1, twist=Frob) # optional - sage.rings.finite_rings - sage: latex(der) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: k. = GF(5^3) + sage: Frob = k.frobenius_endomorphism() + sage: der = k.derivation(a + 1, twist=Frob) + sage: latex(der) \left(a + 1\right) \left(\left[a \mapsto a^{5}\right] - \text{id}\right) """ scalar = self._scalar @@ -2370,13 +2381,12 @@ def extend_to_fraction_field(self): sage: d x*([x |--> y, y |--> x] - id) - sage: D = d.extend_to_fraction_field() - sage: D + sage: D = d.extend_to_fraction_field(); D # needs sage.libs.singular x*([x |--> y, y |--> x] - id) - sage: D.domain() + sage: D.domain() # needs sage.libs.singular Fraction Field of Multivariate Polynomial Ring in x, y over Integer Ring - sage: D(1/x) + sage: D(1/x) # needs sage.libs.singular (x - y)/y """ parent = self.parent() diff --git a/src/sage/rings/factorint.pyx b/src/sage/rings/factorint.pyx index fea5b444b00..d4df0e5ea05 100644 --- a/src/sage/rings/factorint.pyx +++ b/src/sage/rings/factorint.pyx @@ -129,25 +129,26 @@ cpdef factor_aurifeuillian(n, check=True): EXAMPLES:: + sage: # needs sage.libs.pari sage: from sage.rings.factorint import factor_aurifeuillian as fa - sage: fa(2^6 + 1) # optional - sage.libs.pari + sage: fa(2^6 + 1) [5, 13] - sage: fa(2^58 + 1) # optional - sage.libs.pari + sage: fa(2^58 + 1) [536838145, 536903681] - sage: fa(3^3 + 1) # optional - sage.libs.pari + sage: fa(3^3 + 1) [4, 1, 7] - sage: fa(5^5 - 1) # optional - sage.libs.pari + sage: fa(5^5 - 1) [4, 11, 71] - sage: prod(_) == 5^5 - 1 # optional - sage.libs.pari + sage: prod(_) == 5^5 - 1 True - sage: fa(2^4 + 1) # optional - sage.libs.pari + sage: fa(2^4 + 1) [17] - sage: fa((6^2*3)^3 + 1) # optional - sage.libs.pari + sage: fa((6^2*3)^3 + 1) [109, 91, 127] TESTS:: - sage: for n in [2,3,5,6,30,31,33]: # optional - sage.libs.pari + sage: for n in [2,3,5,6,30,31,33]: # needs sage.libs.pari ....: for m in [8,96,109201283]: ....: s = -1 if n % 4 == 1 else 1 ....: y = (m^2*n)^n + s diff --git a/src/sage/rings/fraction_field.py b/src/sage/rings/fraction_field.py index 31d51c3195c..5d7e4cfab4d 100644 --- a/src/sage/rings/fraction_field.py +++ b/src/sage/rings/fraction_field.py @@ -25,11 +25,12 @@ The GCD is not taken (since it doesn't converge sometimes) in the inexact case:: - sage: Z. = CC[] # optional - sage.rings.real_mpfr - sage: I = CC.gen() # optional - sage.rings.real_mpfr - sage: (1+I+z)/(z+0.1*I) # optional - sage.rings.real_mpfr + sage: # needs sage.rings.real_mpfr + sage: Z. = CC[] + sage: I = CC.gen() + sage: (1+I+z)/(z+0.1*I) (z + 1.00000000000000 + I)/(z + 0.100000000000000*I) - sage: (1+I*z)/(z+1.1) # optional - sage.rings.real_mpfr + sage: (1+I*z)/(z+1.1) (I*z + 1.00000000000000)/(z + 1.10000000000000) TESTS:: @@ -264,11 +265,11 @@ def _coerce_map_from_(self, S): number fields:: sage: _. = ZZ[] - sage: K. = NumberField(x^5 - 3*x^4 + 2424*x^3 + 2*x - 232) # optional - sage.rings.number_field - sage: R = K.ring_of_integers() # optional - sage.rings.number_field - sage: S. = R[] # optional - sage.rings.number_field - sage: F = FractionField(S) # optional - sage.rings.number_field - sage: F(1/a) # optional - sage.rings.number_field + sage: K. = NumberField(x^5 - 3*x^4 + 2424*x^3 + 2*x - 232) # needs sage.rings.number_field + sage: R = K.ring_of_integers() # needs sage.rings.number_field + sage: S. = R[] # needs sage.rings.number_field + sage: F = FractionField(S) # needs sage.rings.number_field + sage: F(1/a) # needs sage.rings.number_field (a^4 - 3*a^3 + 2424*a^2 + 2)/232 Some corner cases have been known to fail in the past (:trac:`5917`):: @@ -296,6 +297,7 @@ def _coerce_map_from_(self, S): sage: 1/(R.gen() + 1) 1/(x + 1) + sage: # needs sage.modules sage: R = LaurentPolynomialRing(ZZ, 'x,y') sage: FF = FractionField(PolynomialRing(ZZ, 'x,y')) sage: prod(R.gens()) + prod(FF.gens()) @@ -306,21 +308,21 @@ def _coerce_map_from_(self, S): Test for :trac:`31320`:: sage: FQt = Frac(QQ['t']) - sage: LCt = LaurentPolynomialRing(CC,'t') # optional - sage.rings.real_mpfr - sage: coercion_model.common_parent(FQt, LCt) # optional - sage.rings.real_mpfr + sage: LCt = LaurentPolynomialRing(CC,'t') # needs sage.rings.real_mpfr + sage: coercion_model.common_parent(FQt, LCt) # needs sage.rings.real_mpfr Fraction Field of Univariate Polynomial Ring in t over Complex Field with 53 bits of precision Coercion from a localization:: sage: R. = ZZ[] - sage: L = Localization(R, (x**2 + 1,7)) # optional - sage.libs.pari - sage: F = L.fraction_field() # optional - sage.libs.pari - sage: f = F.coerce_map_from(L); f # optional - sage.libs.pari + sage: L = Localization(R, (x**2 + 1,7)) # needs sage.libs.pari + sage: F = L.fraction_field() + sage: f = F.coerce_map_from(L); f # needs sage.libs.pari Coercion map: From: Univariate Polynomial Ring in x over Integer Ring localized at (7, x^2 + 1) To: Fraction Field of Univariate Polynomial Ring in x over Integer Ring - sage: f(L(1/7)) == 1/7 # optional - sage.libs.pari + sage: f(L(1/7)) == 1/7 # needs sage.libs.pari True """ from sage.rings.rational_field import QQ @@ -394,11 +396,11 @@ def _number_field_to_frac_of_ring_of_integers(self, x): number fields:: sage: _. = ZZ[] - sage: K. = NumberField(x^5 - 3*x^4 + 2424*x^3 + 2*x - 232) # optional - sage.rings.number_field - sage: R = K.ring_of_integers() # optional - sage.rings.number_field - sage: S. = R[] # optional - sage.rings.number_field - sage: F = FractionField(S) # indirect doctest # optional - sage.rings.number_field - sage: F(1/a) # optional - sage.rings.number_field + sage: K. = NumberField(x^5 - 3*x^4 + 2424*x^3 + 2*x - 232) # needs sage.rings.number_field + sage: R = K.ring_of_integers() # needs sage.rings.number_field + sage: S. = R[] # needs sage.rings.number_field + sage: F = FractionField(S) # indirect doctest # needs sage.rings.number_field + sage: F(1/a) # needs sage.rings.number_field (a^4 - 3*a^3 + 2424*a^2 + 2)/232 """ f = x.polynomial() # Polynomial over QQ @@ -459,7 +461,7 @@ def characteristic(self): Integer Ring sage: R = Frac(ZZ['t']); R.characteristic() 0 - sage: R = Frac(GF(5)['w']); R.characteristic() # optional - sage.rings.finite_rings + sage: R = Frac(GF(5)['w']); R.characteristic() 5 """ return self._R.characteristic() @@ -481,7 +483,7 @@ def _latex_(self): EXAMPLES:: - sage: latex(Frac(GF(7)['x,y,z'])) # indirect doctest # optional - sage.rings.finite_rings + sage: latex(Frac(GF(7)['x,y,z'])) # indirect doctest \mathrm{Frac}(\Bold{F}_{7}[x, y, z]) """ return "\\mathrm{Frac}(%s)" % latex.latex(self._R) @@ -494,7 +496,7 @@ def _magma_init_(self, magma): sage: QQ['x'].fraction_field()._magma_init_(magma) # optional - magma 'SageCreateWithNames(FieldOfFractions(SageCreateWithNames(PolynomialRing(_sage_ref...),["x"])),["x"])' - sage: GF(9,'a')['x,y,z'].fraction_field()._magma_init_(magma) # optional - magma # optional - sage.rings.finite_rings + sage: GF(9,'a')['x,y,z'].fraction_field()._magma_init_(magma) # optional - magma, needs sage.rings.finite_rings 'SageCreateWithNames(FieldOfFractions(SageCreateWithNames(PolynomialRing(_sage_ref...,3,"grevlex"),["x","y","z"])),["x","y","z"])' ``_magma_init_`` gets called implicitly below:: @@ -538,7 +540,7 @@ def is_exact(self): sage: Frac(ZZ['x']).is_exact() True - sage: Frac(CDF['x']).is_exact() + sage: Frac(CDF['x']).is_exact() # needs sage.rings.complex_double False """ return self.ring().is_exact() @@ -571,17 +573,17 @@ def _element_constructor_(self, x, y=None, coerce=True): The next example failed before :trac:`4376`:: - sage: K(pari((x + 1)/(x^2 + x + 1))) # optional - sage.libs.pari + sage: K(pari((x + 1)/(x^2 + x + 1))) # needs sage.libs.pari (x + 1)/(x^2 + x + 1) These examples failed before :trac:`11368`:: sage: R. = PolynomialRing(QQ) sage: S = R.fraction_field() - sage: S(pari((x + y)/y)) # optional - sage.libs.pari + sage: S(pari((x + y)/y)) # needs sage.libs.pari (x + y)/y - sage: S(pari(x + y + 1/z)) # optional - sage.libs.pari + sage: S(pari(x + y + 1/z)) # needs sage.libs.pari (x*z + y*z + 1)/z This example failed before :trac:`23664`:: @@ -607,19 +609,19 @@ def _element_constructor_(self, x, y=None, coerce=True): sage: A. = Frac(PolynomialRing(QQ,'a,c')) sage: B. = PolynomialRing(A,'d,e') sage: R. = PolynomialRing(B,'x') - sage: (a*d*x^2+a+e+1).resultant(-4*c^2*x+1) + sage: (a*d*x^2+a+e+1).resultant(-4*c^2*x+1) # needs sage.libs.pari a*d + (16*c^4)*e + (16*a*c^4 + 16*c^4) Check that :trac:`24539` is fixed:: sage: tau = polygen(QQ, 'tau') - sage: PolynomialRing(CyclotomicField(2), 'z').fraction_field()(tau/(1+tau)) # optional - sage.rings.number_field + sage: PolynomialRing(CyclotomicField(2), 'z').fraction_field()(tau/(1+tau)) # needs sage.rings.number_field z/(z + 1) Check that :trac:`26150` is fixed:: - sage: z = SR.var('z') # optional - sage.symbolic - sage: CyclotomicField(2)['z'].fraction_field()(2*(4*z + 5)/((z + 1)*(z - 1)^4)) # optional - sage.rings.number_field sage.symbolic + sage: z = SR.var('z') # needs sage.symbolic + sage: CyclotomicField(2)['z'].fraction_field()(2*(4*z + 5)/((z + 1)*(z - 1)^4)) # needs sage.rings.number_field sage.symbolic (8*z + 10)/(z^5 - 3*z^4 + 2*z^3 + 2*z^2 - 3*z + 1) :: @@ -731,12 +733,12 @@ def construction(self): sage: Frac(ZZ['x']).construction() (FractionField, Univariate Polynomial Ring in x over Integer Ring) - sage: K = Frac(GF(3)['t']) # optional - sage.rings.finite_rings - sage: f, R = K.construction() # optional - sage.rings.finite_rings - sage: f(R) # optional - sage.rings.finite_rings + sage: K = Frac(GF(3)['t']) + sage: f, R = K.construction() + sage: f(R) Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 3 - sage: f(R) == K # optional - sage.rings.finite_rings + sage: f(R) == K True """ from sage.categories.pushout import FractionField @@ -986,8 +988,8 @@ def ring_of_integers(self): EXAMPLES:: - sage: K = FractionField(GF(5)['t']) # optional - sage.rings.finite_rings - sage: K.ring_of_integers() # optional - sage.rings.finite_rings + sage: K = FractionField(GF(5)['t']) + sage: K.ring_of_integers() Univariate Polynomial Ring in t over Finite Field of size 5 """ return self._R @@ -998,8 +1000,8 @@ def maximal_order(self): EXAMPLES:: - sage: K = FractionField(GF(5)['t']) # optional - sage.rings.finite_rings - sage: K.maximal_order() # optional - sage.rings.finite_rings + sage: K = FractionField(GF(5)['t']) + sage: K.maximal_order() Univariate Polynomial Ring in t over Finite Field of size 5 """ return self._R @@ -1010,8 +1012,8 @@ def class_number(self): EXAMPLES:: - sage: R. = GF(5)[]; K = R.fraction_field() # optional - sage.rings.finite_rings - sage: K.class_number() # optional - sage.rings.finite_rings + sage: R. = GF(5)[]; K = R.fraction_field() + sage: K.class_number() 1 """ return 1 @@ -1022,11 +1024,12 @@ def _factor_univariate_polynomial(self, f): EXAMPLES:: - sage: k. = GF(9) # optional - sage.rings.finite_rings - sage: K = k['t'].fraction_field() # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: f = x^3 + a # optional - sage.rings.finite_rings - sage: f.factor() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: k. = GF(9) + sage: K = k['t'].fraction_field() + sage: R. = K[] + sage: f = x^3 + a + sage: f.factor() (x + 2*a + 1)^3 """ @@ -1041,9 +1044,9 @@ def function_field(self): EXAMPLES:: - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: K = R.fraction_field() # optional - sage.rings.finite_rings - sage: K.function_field() # optional - sage.rings.finite_rings + sage: R. = GF(5)[] + sage: K = R.fraction_field() + sage: K.function_field() Rational function field in t over Finite Field of size 5 .. SEEALSO:: @@ -1060,15 +1063,16 @@ def _coerce_map_from_(self, R): EXAMPLES:: - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: K = R.fraction_field() # optional - sage.rings.finite_rings - sage: L = K.function_field() # optional - sage.rings.finite_rings - sage: f = K.coerce_map_from(L); f # indirect doctest # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(5)[] + sage: K = R.fraction_field() + sage: L = K.function_field() + sage: f = K.coerce_map_from(L); f # indirect doctest Isomorphism: From: Rational function field in t over Finite Field of size 5 To: Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5 - sage: f(~L.gen()) # optional - sage.rings.finite_rings + sage: f(~L.gen()) 1/t """ @@ -1166,12 +1170,12 @@ def _richcmp_(self, other, op): sage: R. = QQ[] sage: f = R.fraction_field().coerce_map_from(R) - sage: S. = GF(2)[] # optional - sage.rings.finite_rings - sage: g = S.fraction_field().coerce_map_from(S) # optional - sage.rings.finite_rings + sage: S. = GF(2)[] + sage: g = S.fraction_field().coerce_map_from(S) - sage: f == g # indirect doctest # optional - sage.rings.finite_rings + sage: f == g # indirect doctest False - sage: f == f # optional - sage.rings.finite_rings + sage: f == f True """ @@ -1236,19 +1240,20 @@ def _call_(self, x, check=True): Over inexact rings, we have to take the precision of the denominators into account:: - sage: R = ZpCR(2) # optional - sage.rings.padics - sage: S. = R[] # optional - sage.rings.padics - sage: f = x/S(R(3, absprec=2)) # optional - sage.rings.padics - sage: S(f) # optional - sage.rings.padics + sage: # needs sage.rings.padics + sage: R = ZpCR(2) + sage: S. = R[] + sage: f = x/S(R(3, absprec=2)) + sage: S(f) (1 + 2 + O(2^2))*x Test for Localization:: sage: R. = ZZ[] - sage: L = Localization(R, x**2 + 2*x + 1) # optional - sage.libs.pari - sage: 1/(x + 1) in L # indirect doctest # optional - sage.libs.pari + sage: L = Localization(R, x**2 + 2*x + 1) # needs sage.libs.pari + sage: 1/(x + 1) in L # indirect doctest # needs sage.libs.pari True - sage: 1/(x + 2) in L # indirect doctest # optional - sage.libs.pari + sage: 1/(x + 2) in L # indirect doctest # needs sage.libs.pari False """ codom = self.codomain() @@ -1298,12 +1303,12 @@ def _richcmp_(self, other, op): sage: R. = QQ[] sage: f = R.fraction_field().coerce_map_from(R).section() - sage: S. = GF(2)[] # optional - sage.rings.finite_rings - sage: g = S.fraction_field().coerce_map_from(S).section() # optional - sage.rings.finite_rings + sage: S. = GF(2)[] + sage: g = S.fraction_field().coerce_map_from(S).section() - sage: f == g # indirect doctest # optional - sage.rings.finite_rings + sage: f == g # indirect doctest False - sage: f == f # optional - sage.rings.finite_rings + sage: f == f True """ diff --git a/src/sage/rings/fraction_field_element.pyx b/src/sage/rings/fraction_field_element.pyx index 78b13455d56..d8517147070 100644 --- a/src/sage/rings/fraction_field_element.pyx +++ b/src/sage/rings/fraction_field_element.pyx @@ -64,9 +64,9 @@ cdef class FractionFieldElement(FieldElement): Test if :trac:`5451` is fixed:: - sage: A = FiniteField(9,'theta')['t'] # optional - sage.rings.finite_rings - sage: K. = FractionField(A) # optional - sage.rings.finite_rings - sage: f = 2/(t^2 + 2*t); g = t^9/(t^18 + t^10 + t^2); f + g # optional - sage.rings.finite_rings + sage: A = FiniteField(9,'theta')['t'] # needs sage.rings.finite_rings + sage: K. = FractionField(A) # needs sage.rings.finite_rings + sage: f = 2/(t^2 + 2*t); g = t^9/(t^18 + t^10 + t^2); f + g # needs sage.rings.finite_rings (2*t^15 + 2*t^14 + 2*t^13 + 2*t^12 + 2*t^11 + 2*t^10 + 2*t^9 + t^7 + t^6 + t^5 + t^4 + t^3 + t^2 + t + 1)/(t^17 + t^9 + t) Test if :trac:`8671` is fixed:: @@ -99,8 +99,8 @@ cdef class FractionFieldElement(FieldElement): sage: f.numerator() 'hi' - sage: x = var('x') # optional - sage.symbolic - sage: K((x + 1)/(x^2 + x + 1)) # optional - sage.symbolic + sage: x = var('x') # needs sage.symbolic + sage: K((x + 1)/(x^2 + x + 1)) (x + 1)/(x^2 + x + 1) sage: K(355/113) 355/113 @@ -127,31 +127,31 @@ cdef class FractionFieldElement(FieldElement): sage: F = ZZ['x,y'].fraction_field() sage: x,y = F.gens() - sage: K = GF(7)['a,b'].fraction_field() # optional - sage.rings.finite_rings - sage: a,b = K.gens() # optional - sage.rings.finite_rings + sage: K = GF(7)['a,b'].fraction_field() + sage: a,b = K.gens() :: - sage: phi = F.hom([a + b, a*b], K) # optional - sage.rings.finite_rings - sage: phi(x+y) # indirect doctest # optional - sage.rings.finite_rings + sage: phi = F.hom([a + b, a*b], K) + sage: phi(x+y) # indirect doctest a*b + a + b :: - sage: (x^2/y)._im_gens_(K, [a + b, a*b]) # optional - sage.rings.finite_rings + sage: (x^2/y)._im_gens_(K, [a + b, a*b]) (a^2 + 2*a*b + b^2)/(a*b) - sage: (x^2/y)._im_gens_(K, [a, a*b]) # optional - sage.rings.finite_rings + sage: (x^2/y)._im_gens_(K, [a, a*b]) a/b :: sage: Zx. = ZZ[] - sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field - sage: cc = K.hom([-i]) # optional - sage.rings.number_field - sage: R. = K[] # optional - sage.rings.number_field - sage: F = R.fraction_field() # optional - sage.rings.number_field - sage: phi = F.hom([F(b), F(a)], base_map=cc) # optional - sage.rings.number_field - sage: phi(i/a) # optional - sage.rings.number_field + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: cc = K.hom([-i]) # needs sage.rings.number_field + sage: R. = K[] # needs sage.rings.number_field + sage: F = R.fraction_field() # needs sage.rings.number_field + sage: phi = F.hom([F(b), F(a)], base_map=cc) # needs sage.rings.number_field + sage: phi(i/a) # needs sage.rings.number_field ((-i))/b """ nnum = codomain.coerce(self.__numerator._im_gens_(codomain, im_gens, base_map=base_map)) @@ -173,10 +173,10 @@ cdef class FractionFieldElement(FieldElement): EXAMPLES:: - sage: R. = RealField(10)[] # optional - sage.rings.real_mpfr - sage: f = (x^2+2*x+1)/(x+1); f # optional - sage.rings.real_mpfr + sage: R. = RealField(10)[] # needs sage.rings.real_mpfr + sage: f = (x^2+2*x+1)/(x+1); f # needs sage.rings.real_mpfr (x^2 + 2.0*x + 1.0)/(x + 1.0) - sage: f.reduce(); f # optional - sage.rings.real_mpfr + sage: f.reduce(); f # needs sage.rings.real_mpfr x + 1.0 TESTS: @@ -393,10 +393,10 @@ cdef class FractionFieldElement(FieldElement): Check that :trac:`25199` is fixed:: - sage: R. = QQbar[] # optional - sage.rings.number_field - sage: hash(R.0) == hash(FractionField(R).0) # optional - sage.rings.number_field + sage: R. = QQbar[] # needs sage.rings.number_field + sage: hash(R.0) == hash(FractionField(R).0) True - sage: ((x+1)/(x^2+1)).subs({x: 1}) # optional - sage.rings.number_field + sage: ((x+1)/(x^2+1)).subs({x: 1}) 1 """ if self.__denominator.is_one(): @@ -568,13 +568,13 @@ cdef class FractionFieldElement(FieldElement): (x + y)/(x*y) sage: 1/x + 1/(x*y) (y + 1)/(x*y) - sage: Frac(CDF['x']).gen() + 3 + sage: Frac(CDF['x']).gen() + 3 # needs sage.rings.complex_double x + 3.0 Subtraction is implemented by adding the negative:: - sage: K. = Frac(GF(7)['t']) # optional - sage.rings.finite_rings - sage: t - 1/t # indirect doctest # optional - sage.rings.finite_rings + sage: K. = Frac(GF(7)['t']) + sage: t - 1/t # indirect doctest (t^2 + 6)/t """ rnum = self.__numerator @@ -646,10 +646,11 @@ cdef class FractionFieldElement(FieldElement): EXAMPLES:: - sage: K. = Frac(GF(7)['t']) # optional - sage.rings.finite_rings - sage: a = t/(1+t) # optional - sage.rings.finite_rings - sage: b = 3/t # optional - sage.rings.finite_rings - sage: a * b # indirect doctest # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = Frac(GF(7)['t']) + sage: a = t/(1+t) + sage: b = 3/t + sage: a * b # indirect doctest 3/(t + 1) """ rnum = self.__numerator @@ -775,7 +776,7 @@ cdef class FractionFieldElement(FieldElement): TESTS:: sage: K = Frac(ZZ['x']) - sage: QQ(K(x) / K(2*x)) # optional - sage.symbolic + sage: QQ(K(x) / K(2*x)) # needs sage.symbolic 1/2 """ return self._conversion(QQ) @@ -811,15 +812,16 @@ cdef class FractionFieldElement(FieldElement): 3/2 sage: x = polygen(QQ) - sage: A. = NumberField(x^3 - 2) # optional - sage.rings.number_field - sage: A((x+3) / (2*x - 1)) # optional - sage.rings.number_field + sage: A. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: A((x+3) / (2*x - 1)) # needs sage.rings.number_field 14/15*u^2 + 7/15*u + 11/15 - sage: B = A['y'].fraction_field() # optional - sage.rings.number_field - sage: A(B(u)) # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: B = A['y'].fraction_field() + sage: A(B(u)) u - sage: C = A['x,y'].fraction_field() # optional - sage.rings.number_field - sage: A(C(u)) # optional - sage.rings.number_field + sage: C = A['x,y'].fraction_field() + sage: A(C(u)) u """ if self.__denominator.is_one(): @@ -857,15 +859,15 @@ cdef class FractionFieldElement(FieldElement): sage: x,y = FR.gens() sage: a = x^2; a x^2 - sage: type(a.numerator()) # optional - sage.lings.singular + sage: type(a.numerator()) # needs sage.lings.singular - sage: type(a.denominator()) # optional - sage.lings.singular + sage: type(a.denominator()) # needs sage.lings.singular sage: a = x^(-2); a 1/x^2 - sage: type(a.numerator()) # optional - sage.lings.singular + sage: type(a.numerator()) # needs sage.lings.singular - sage: type(a.denominator()) # optional - sage.lings.singular + sage: type(a.denominator()) # needs sage.lings.singular sage: x^0 1 @@ -897,10 +899,10 @@ cdef class FractionFieldElement(FieldElement): """ EXAMPLES:: - sage: K. = Frac(GF(5)['t']) # optional - sage.rings.finite_rings - sage: f = (t^2+t)/(t+2); f # optional - sage.rings.finite_rings + sage: K. = Frac(GF(5)['t']) + sage: f = (t^2+t)/(t+2); f (t^2 + t)/(t + 2) - sage: -f # optional - sage.rings.finite_rings + sage: -f (4*t^2 + 4*t)/(t + 2) """ return self.__class__(self._parent, @@ -921,9 +923,9 @@ cdef class FractionFieldElement(FieldElement): """ EXAMPLES:: - sage: K. = Frac(GF(7)['t']) # optional - sage.rings.finite_rings - sage: f = (t^2+5)/(t-1) # optional - sage.rings.finite_rings - sage: ~f # optional - sage.rings.finite_rings + sage: K. = Frac(GF(7)['t']) + sage: f = (t^2+5)/(t-1) + sage: ~f (t + 6)/(t^2 + 5) """ if self.is_zero(): @@ -935,12 +937,13 @@ cdef class FractionFieldElement(FieldElement): """ EXAMPLES:: - sage: K. = Frac(GF(7)['t']) # optional - sage.rings.finite_rings - sage: t/t == 1 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = Frac(GF(7)['t']) + sage: t/t == 1 True - sage: t + 1/t == (t^2+1)/t # optional - sage.rings.finite_rings + sage: t + 1/t == (t^2+1)/t True - sage: t == t/5 # optional - sage.rings.finite_rings + sage: t == t/5 False :: @@ -1039,9 +1042,9 @@ cdef class FractionFieldElement(FieldElement): sage: x,y = F.gens() sage: elt = (2*x + 2*y) / (3*x - 3*y); elt (2*x + 2*y)/(3*x - 3*y) - sage: elt._symbolic_(SR) # optional - sage.symbolic + sage: elt._symbolic_(SR) # needs sage.symbolic 2/3*(x + y)/(x - y) - sage: symbolic_expression(elt) # optional - sage.symbolic + sage: symbolic_expression(elt) # needs sage.symbolic 2/3*(x + y)/(x - y) """ return ring(self.__numerator)/ring(self.__denominator) @@ -1098,18 +1101,19 @@ cdef class FractionFieldElement(FieldElement): Check that :trac:`25440` has been resolved:: - sage: R. = GF(2)[] # optional - sage.rings.finite_rings - sage: S. = R.fraction_field()[] # optional - sage.rings.finite_rings - sage: (y+1)(R.one()) # optional - sage.rings.finite_rings + sage: R. = GF(2)[] + sage: S. = R.fraction_field()[] + sage: (y+1)(R.one()) 0 Check that inexact elements are treated correctly:: - sage: K = Qp(2, 5) # optional - sage.rings.padics - sage: R. = K[] # optional - sage.rings.padics - sage: L = R.fraction_field() # optional - sage.rings.padics - sage: S. = L[] # optional - sage.rings.padics - sage: y(K(1,1)/x) # optional - sage.rings.padics + sage: # needs sage.rings.padics + sage: K = Qp(2, 5) + sage: R. = K[] + sage: L = R.fraction_field() + sage: S. = L[] + sage: y(K(1,1)/x) (1 + O(2))/((1 + O(2))*x) """ if self.numerator().is_one(): @@ -1204,7 +1208,7 @@ cdef class FractionFieldElement_1poly_field(FractionFieldElement): sage: R. = QQ[] sage: h = (t^14 + 2*t^12 - 4*t^11 - 8*t^9 + 6*t^8 + 12*t^6 - 4*t^5 ....: - 8*t^3 + t^2 + 2)/(t^6 + 6*t^5 + 9*t^4 - 2*t^2 - 12*t - 18) - sage: h.support() # optional - sage.libs.pari + sage: h.support() # needs sage.libs.pari [t - 1, t + 3, t^2 + 2, t^2 + t + 1, t^4 - 2] """ L = [fac[0] for fac in self.numerator().factor()] + [fac[0] for fac in self.denominator().factor()] diff --git a/src/sage/rings/ideal.py b/src/sage/rings/ideal.py index 72204ac3dec..97694acde35 100644 --- a/src/sage/rings/ideal.py +++ b/src/sage/rings/ideal.py @@ -125,9 +125,9 @@ def Ideal(*args, **kwds): Note that some rings use different ideal implementations than the standard, even if they are PIDs.:: - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: I = R * (x^2 + 3) # optional - sage.rings.finite_rings - sage: type(I) # optional - sage.rings.finite_rings + sage: R. = GF(5)[] + sage: I = R * (x^2 + 3) + sage: type(I) You can also pass in a specific ideal type:: @@ -163,11 +163,11 @@ def Ideal(*args, **kwds): sage: J = R.ideal([2*x + 2*x^2]) sage: J Principal ideal (x^2 + x) of Univariate Polynomial Ring in x over Rational Field - sage: S = R.quotient_ring(I) # optional - sage.libs.pari - sage: U = R.quotient_ring(J) # optional - sage.libs.pari + sage: S = R.quotient_ring(I) # needs sage.libs.pari + sage: U = R.quotient_ring(J) # needs sage.libs.pari sage: I == J True - sage: S == U # optional - sage.libs.pari + sage: S == U # needs sage.libs.pari True """ if len(args) == 0: @@ -295,8 +295,8 @@ def _repr_short(self): the generators are not represented from left to right but from top to bottom. This is the case, e.g., for matrices:: - sage: MS = MatrixSpace(QQ, 2, 2) # optional - sage.modules - sage: MS * [MS.1, 2] # optional - sage.modules + sage: MS = MatrixSpace(QQ, 2, 2) # needs sage.modules + sage: MS * [MS.1, 2] # needs sage.modules Left Ideal ( [0 1] @@ -337,9 +337,9 @@ def random_element(self, *args, **kwds): EXAMPLES:: - sage: P. = GF(5)[[]] # optional - sage.rings.finite_rings - sage: I = P.ideal([a^2, a*b + c, c^3]) # optional - sage.rings.finite_rings - sage: I.random_element() # random # optional - sage.rings.finite_rings + sage: P. = GF(5)[[]] + sage: I = P.ideal([a^2, a*b + c, c^3]) + sage: I.random_element() # random 2*a^5*c + a^2*b*c^4 + ... + O(a, b, c)^13 """ @@ -377,10 +377,10 @@ def __contains__(self, x): sage: P. = QQ[] sage: I = P * [a, b] - sage: a + b in I # optional - sage.libs.singular + sage: a + b in I # needs sage.libs.singular True sage: P2. = QQ[] - sage: x + 2*y + w*z in I # optional - sage.libs.singular + sage: x + 2*y + w*z in I False """ try: @@ -470,11 +470,11 @@ def base_ring(self): And `p`-adic numbers:: - sage: R = Zp(7, prec=10); R # optional - sage.rings.padics + sage: R = Zp(7, prec=10); R # needs sage.rings.padics 7-adic Ring with capped relative precision 10 - sage: I = 7*R; I # optional - sage.rings.padics + sage: I = 7*R; I # needs sage.rings.padics Principal ideal (7 + O(7^11)) of 7-adic Ring with capped relative precision 10 - sage: I.base_ring() # optional - sage.rings.padics + sage: I.base_ring() # needs sage.rings.padics 7-adic Ring with capped relative precision 10 """ return self.ring().base_ring() @@ -486,14 +486,15 @@ def apply_morphism(self, phi): EXAMPLES:: - sage: psi = CC['x'].hom([-CC['x'].0]) # optional - sage.rings.real_mpfr - sage: J = ideal([CC['x'].0 + 1]); J # optional - sage.rings.real_mpfr + sage: # needs sage.rings.real_mpfr + sage: psi = CC['x'].hom([-CC['x'].0]) + sage: J = ideal([CC['x'].0 + 1]); J Principal ideal (x + 1.00000000000000) of Univariate Polynomial Ring in x over Complex Field with 53 bits of precision - sage: psi(J) # optional - sage.rings.real_mpfr + sage: psi(J) Principal ideal (x - 1.00000000000000) of Univariate Polynomial Ring in x over Complex Field with 53 bits of precision - sage: J.apply_morphism(psi) # optional - sage.rings.real_mpfr + sage: J.apply_morphism(psi) Principal ideal (x - 1.00000000000000) of Univariate Polynomial Ring in x over Complex Field with 53 bits of precision @@ -510,30 +511,31 @@ def apply_morphism(self, phi): TESTS:: sage: x = polygen(ZZ) - sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_fields - sage: A = K.ideal(a) # optional - sage.rings.number_fields - sage: taus = K.embeddings(K) # optional - sage.rings.number_fields - sage: A.apply_morphism(taus[0]) # identity # optional - sage.rings.number_fields + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_fields + sage: A = K.ideal(a) # needs sage.rings.number_fields + sage: taus = K.embeddings(K) # needs sage.rings.number_fields + sage: A.apply_morphism(taus[0]) # identity # needs sage.rings.number_fields Fractional ideal (a) - sage: A.apply_morphism(taus[1]) # complex conjugation # optional - sage.rings.number_fields + sage: A.apply_morphism(taus[1]) # complex conjugation # needs sage.rings.number_fields Fractional ideal (-a) - sage: A.apply_morphism(taus[0]) == A.apply_morphism(taus[1]) # optional - sage.rings.number_fields + sage: A.apply_morphism(taus[0]) == A.apply_morphism(taus[1]) # needs sage.rings.number_fields True :: - sage: K. = NumberField(x^2 + 5) # optional - sage.rings.number_fields - sage: B = K.ideal([2, a + 1]); B # optional - sage.rings.number_fields + sage: # needs sage.rings.number_fields + sage: K. = NumberField(x^2 + 5) + sage: B = K.ideal([2, a + 1]); B Fractional ideal (2, a + 1) - sage: taus = K.embeddings(K) # optional - sage.rings.number_fields - sage: B.apply_morphism(taus[0]) # identity # optional - sage.rings.number_fields + sage: taus = K.embeddings(K) + sage: B.apply_morphism(taus[0]) # identity Fractional ideal (2, a + 1) Since 2 is totally ramified, complex conjugation fixes it:: - sage: B.apply_morphism(taus[1]) # complex conjugation # optional - sage.rings.number_fields + sage: B.apply_morphism(taus[1]) # complex conjugation # needs sage.rings.number_fields Fractional ideal (2, a + 1) - sage: taus[1](B) # optional - sage.rings.number_fields + sage: taus[1](B) # needs sage.rings.number_fields Fractional ideal (2, a + 1) """ from sage.categories.morphism import is_Morphism @@ -589,12 +591,12 @@ def ring(self): sage: I = R.ideal(x^2 - 3) sage: I.ring() Univariate Polynomial Ring in x over Rational Field - sage: Rbar = R.quotient(I, names='a') # optional - sage.libs.pari - sage: S = PolynomialRing(Rbar, 'y'); y = Rbar.gen(); S # optional - sage.libs.pari + sage: Rbar = R.quotient(I, names='a') # needs sage.libs.pari + sage: S = PolynomialRing(Rbar, 'y'); y = Rbar.gen(); S # needs sage.libs.pari Univariate Polynomial Ring in y over Univariate Quotient Polynomial Ring in a over Rational Field with modulus x^2 - 3 - sage: J = S.ideal(y^2 + 1) # optional - sage.libs.pari - sage: J.ring() # optional - sage.libs.pari + sage: J = S.ideal(y^2 + 1) # needs sage.libs.pari + sage: J.ring() # needs sage.libs.pari Univariate Polynomial Ring in y over Univariate Quotient Polynomial Ring in a over Rational Field with modulus x^2 - 3 """ @@ -699,16 +701,16 @@ def is_maximal(self): sage: R = ZZ sage: I = R.ideal(7) - sage: I.is_maximal() # optional - sage.libs.pari + sage: I.is_maximal() True - sage: R.ideal(16).is_maximal() # optional - sage.libs.pari + sage: R.ideal(16).is_maximal() False sage: S = Integers(8) - sage: S.ideal(0).is_maximal() # optional - sage.libs.pari + sage: S.ideal(0).is_maximal() False - sage: S.ideal(2).is_maximal() # optional - sage.libs.pari + sage: S.ideal(2).is_maximal() True - sage: S.ideal(4).is_maximal() # optional - sage.libs.pari + sage: S.ideal(4).is_maximal() False """ from sage.rings.integer_ring import ZZ @@ -744,28 +746,29 @@ def is_primary(self, P=None): sage: R. = QQ[] sage: I = R.ideal([x^2, x*y]) - sage: I.is_primary() # optional - sage.libs.singular + sage: I.is_primary() # needs sage.libs.singular False - sage: J = I.primary_decomposition()[1]; J # optional - sage.libs.singular + sage: J = I.primary_decomposition()[1]; J # needs sage.libs.singular Ideal (y, x^2) of Multivariate Polynomial Ring in x, y over Rational Field - sage: J.is_primary() # optional - sage.libs.singular + sage: J.is_primary() # needs sage.libs.singular True - sage: J.is_prime() # optional - sage.libs.singular + sage: J.is_prime() # needs sage.libs.singular False Some examples from the Macaulay2 documentation:: - sage: R. = GF(101)[] # optional - sage.rings.finite_rings - sage: I = R.ideal([y^6]) # optional - sage.rings.finite_rings - sage: I.is_primary() # optional - sage.libs.singular sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(101)[] + sage: I = R.ideal([y^6]) + sage: I.is_primary() # needs sage.libs.singular True - sage: I.is_primary(R.ideal([y])) # optional - sage.libs.singular sage.rings.finite_rings + sage: I.is_primary(R.ideal([y])) # needs sage.libs.singular True - sage: I = R.ideal([x^4, y^7]) # optional - sage.libs.singular sage.rings.finite_rings - sage: I.is_primary() # optional - sage.libs.singular sage.rings.finite_rings + sage: I = R.ideal([x^4, y^7]) + sage: I.is_primary() # needs sage.libs.singular True - sage: I = R.ideal([x*y, y^2]) # optional - sage.libs.singular sage.rings.finite_rings - sage: I.is_primary() # optional - sage.libs.singular sage.rings.finite_rings + sage: I = R.ideal([x*y, y^2]) + sage: I.is_primary() # needs sage.libs.singular False .. NOTE:: @@ -804,24 +807,24 @@ def is_prime(self): sage: R. = QQ[] sage: I = R.ideal([x, y]) - sage: I.is_prime() # a maximal ideal # optional - sage.libs.singular + sage: I.is_prime() # a maximal ideal # needs sage.libs.singular True sage: I = R.ideal([x^2 - y]) - sage: I.is_prime() # a non-maximal prime ideal # optional - sage.libs.singular + sage: I.is_prime() # a non-maximal prime ideal # needs sage.libs.singular True sage: I = R.ideal([x^2, y]) - sage: I.is_prime() # a non-prime primary ideal # optional - sage.libs.singular + sage: I.is_prime() # a non-prime primary ideal # needs sage.libs.singular False sage: I = R.ideal([x^2, x*y]) - sage: I.is_prime() # a non-prime non-primary ideal # optional - sage.libs.singular + sage: I.is_prime() # a non-prime non-primary ideal # needs sage.libs.singular False sage: S = Integers(8) - sage: S.ideal(0).is_prime() # optional - sage.libs.singular + sage: S.ideal(0).is_prime() False - sage: S.ideal(2).is_prime() # optional - sage.libs.singular + sage: S.ideal(2).is_prime() True - sage: S.ideal(4).is_prime() # optional - sage.libs.singular + sage: S.ideal(4).is_prime() False Note that this method is not implemented for all rings where it @@ -892,7 +895,7 @@ def embedded_primes(self): sage: R. = QQ[] sage: I = R.ideal(x^2, x*y) - sage: I.embedded_primes() # optional - sage.libs.singular + sage: I.embedded_primes() # needs sage.libs.singular [Ideal (y, x) of Multivariate Polynomial Ring in x, y over Rational Field] """ # by definition, embedded primes are associated primes that @@ -960,20 +963,20 @@ def is_trivial(self): :: sage: I = QQ['x', 'y'].ideal(-5) - sage: I.is_trivial() # optional - sage.libs.singular + sage: I.is_trivial() # needs sage.libs.singular True :: - sage: I = CC['x'].ideal(0) # optional - sage.rings.real_mpfr - sage: I.is_trivial() # optional - sage.rings.real_mpfr + sage: I = CC['x'].ideal(0) # needs sage.rings.real_mpfr + sage: I.is_trivial() # needs sage.rings.real_mpfr True This test addresses issue :trac:`20514`:: sage: R = QQ['x', 'y'] sage: I = R.ideal(R.gens()) - sage: I.is_trivial() # optional - sage.libs.singular + sage: I.is_trivial() # needs sage.libs.singular False """ return self.is_zero() or self == self.ring().unit_ideal() @@ -1118,9 +1121,9 @@ def norm(self): EXAMPLES:: - sage: R. = GF(8, names='a')[] # optional - sage.rings.finite_rings - sage: I = R.ideal(t^4 + t + 1) # optional - sage.rings.finite_rings - sage: I.norm() # optional - sage.rings.finite_rings + sage: R. = GF(8, names='a')[] # needs sage.rings.finite_rings + sage: I = R.ideal(t^4 + t + 1) # needs sage.rings.finite_rings + sage: I.norm() # needs sage.rings.finite_rings Principal ideal (t^4 + t + 1) of Univariate Polynomial Ring in t over Finite Field in a of size 2^3 """ @@ -1142,9 +1145,9 @@ def absolute_norm(self): EXAMPLES:: - sage: R. = GF(9, names='a')[] # optional - sage.rings.finite_rings - sage: I = R.ideal(t^4 + t + 1) # optional - sage.rings.finite_rings - sage: I.absolute_norm() # optional - sage.rings.finite_rings + sage: R. = GF(9, names='a')[] # needs sage.rings.finite_rings + sage: I = R.ideal(t^4 + t + 1) # needs sage.rings.finite_rings + sage: I.absolute_norm() # needs sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError @@ -1178,11 +1181,11 @@ def _macaulay2_init_(self, macaulay2=None): Field ideals generated from the polynomial ring over two variables in the finite field of size 2:: - sage: P. = PolynomialRing(GF(2), 2) # optional - sage.rings.finite_rings - sage: I = sage.rings.ideal.FieldIdeal(P); I # optional - sage.rings.finite_rings + sage: P. = PolynomialRing(GF(2), 2) + sage: I = sage.rings.ideal.FieldIdeal(P); I Ideal (x^2 + x, y^2 + y) of Multivariate Polynomial Ring in x, y over Finite Field of size 2 - sage: macaulay2(I) # optional - macaulay2 # optional - sage.rings.finite_rings + sage: macaulay2(I) # optional - macaulay2 # needs sage.rings.finite_rings 2 2 ideal (x + x, y + y) @@ -1229,7 +1232,7 @@ def free_resolution(self, *args, **kwds): sage: R. = PolynomialRing(QQ) sage: I = R.ideal([x^4 + 3*x^2 + 2]) - sage: I.free_resolution() # optional - sage.modules + sage: I.free_resolution() # needs sage.modules S^1 <-- S^1 <-- 0 """ if not self.is_principal(): @@ -1248,7 +1251,7 @@ def graded_free_resolution(self, *args, **kwds): sage: R. = PolynomialRing(QQ) sage: I = R.ideal([x^3]) - sage: I.graded_free_resolution() # optional - sage.modules + sage: I.graded_free_resolution() # needs sage.modules S(0) <-- S(-3) <-- 0 """ from sage.homology.graded_resolution import GradedFiniteFreeResolution_free_module @@ -1575,18 +1578,18 @@ def is_prime(self): EXAMPLES:: - sage: ZZ.ideal(2).is_prime() # optional - sage.libs.pari + sage: ZZ.ideal(2).is_prime() True - sage: ZZ.ideal(-2).is_prime() # optional - sage.libs.pari + sage: ZZ.ideal(-2).is_prime() True - sage: ZZ.ideal(4).is_prime() # optional - sage.libs.pari + sage: ZZ.ideal(4).is_prime() False - sage: ZZ.ideal(0).is_prime() # optional - sage.libs.pari + sage: ZZ.ideal(0).is_prime() True sage: R. = QQ[] - sage: P = R.ideal(x^2 + 1); P # optional - sage.libs.pari + sage: P = R.ideal(x^2 + 1); P Principal ideal (x^2 + 1) of Univariate Polynomial Ring in x over Rational Field - sage: P.is_prime() # optional - sage.libs.pari + sage: P.is_prime() # needs sage.libs.pari True In fields, only the zero ideal is prime:: @@ -1616,18 +1619,19 @@ def is_maximal(self): EXAMPLES:: - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: p = R.ideal(t^2 + 2) # optional - sage.rings.finite_rings - sage: p.is_maximal() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(5)[] + sage: p = R.ideal(t^2 + 2) + sage: p.is_maximal() True - sage: p = R.ideal(t^2 + 1) # optional - sage.rings.finite_rings - sage: p.is_maximal() # optional - sage.rings.finite_rings + sage: p = R.ideal(t^2 + 1) + sage: p.is_maximal() False - sage: p = R.ideal(0) # optional - sage.rings.finite_rings - sage: p.is_maximal() # optional - sage.rings.finite_rings + sage: p = R.ideal(0) + sage: p.is_maximal() False - sage: p = R.ideal(1) # optional - sage.rings.finite_rings - sage: p.is_maximal() # optional - sage.rings.finite_rings + sage: p = R.ideal(1) + sage: p.is_maximal() False """ if not self.ring().is_field() and self.is_zero(): @@ -1647,30 +1651,30 @@ def residue_field(self): sage: P = ZZ.ideal(61); P Principal ideal (61) of Integer Ring - sage: F = P.residue_field(); F # optional - sage.libs.pari + sage: F = P.residue_field(); F # needs sage.libs.pari Residue field of Integers modulo 61 - sage: pi = F.reduction_map(); pi # optional - sage.libs.pari + sage: pi = F.reduction_map(); pi # needs sage.libs.pari Partially defined reduction map: From: Rational Field To: Residue field of Integers modulo 61 - sage: pi(123/234) # optional - sage.libs.pari + sage: pi(123/234) # needs sage.libs.pari 6 - sage: pi(1/61) # optional - sage.libs.pari + sage: pi(1/61) # needs sage.libs.pari Traceback (most recent call last): ... ZeroDivisionError: Cannot reduce rational 1/61 modulo 61: it has negative valuation - sage: lift = F.lift_map(); lift # optional - sage.libs.pari + sage: lift = F.lift_map(); lift # needs sage.libs.pari Lifting map: From: Residue field of Integers modulo 61 To: Integer Ring - sage: lift(F(12345/67890)) # optional - sage.libs.pari + sage: lift(F(12345/67890)) # needs sage.libs.pari 33 sage: (12345/67890) % 61 33 TESTS:: - sage: ZZ.ideal(96).residue_field() # optional - sage.libs.pari + sage: ZZ.ideal(96).residue_field() Traceback (most recent call last): ... ValueError: The ideal (Principal ideal (96) of Integer Ring) is not prime @@ -1679,9 +1683,9 @@ def residue_field(self): sage: R. = QQ[] sage: I = R.ideal(x^2 + 1) - sage: I.is_prime() # optional - sage.libs.pari + sage: I.is_prime() # needs sage.libs.pari True - sage: I.residue_field() # optional - sage.libs.pari + sage: I.residue_field() Traceback (most recent call last): ... TypeError: residue fields only supported for polynomial rings over finite fields. @@ -1707,8 +1711,8 @@ def __repr__(self): sage: from sage.rings.ideal import Ideal_fractional sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field - sage: Ideal_fractional(K, [a]) # indirect doctest # optional - sage.rings.number_field + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: Ideal_fractional(K, [a]) # indirect doctest # needs sage.rings.number_field Fractional ideal (a) of Number Field in a with defining polynomial x^2 + 1 """ return "Fractional ideal %s of %s"%(self._repr_short(), self.ring()) @@ -1744,19 +1748,19 @@ def Cyclic(R, n=None, homog=False, singular=None): rationals:: sage: P. = PolynomialRing(QQ, 3, order='lex') - sage: I = sage.rings.ideal.Cyclic(P); I # optional - sage.libs.singular + sage: I = sage.rings.ideal.Cyclic(P); I # needs sage.libs.singular Ideal (x + y + z, x*y + x*z + y*z, x*y*z - 1) of Multivariate Polynomial Ring in x, y, z over Rational Field - sage: I.groebner_basis() # optional - sage.libs.singular + sage: I.groebner_basis() # needs sage.libs.singular [x + y + z, y^2 + y*z + z^2, z^3 - 1] We compute a Groebner basis for cyclic 6, which is a standard benchmark and test ideal:: sage: R. = QQ['x,y,z,t,u,v'] - sage: I = sage.rings.ideal.Cyclic(R, 6) # optional - sage.libs.singular - sage: B = I.groebner_basis() # optional - sage.libs.singular - sage: len(B) # optional - sage.libs.singular + sage: I = sage.rings.ideal.Cyclic(R, 6) # needs sage.libs.singular + sage: B = I.groebner_basis() # needs sage.libs.singular + sage: len(B) # needs sage.libs.singular 45 """ from .rational_field import RationalField @@ -1802,14 +1806,14 @@ def Katsura(R, n=None, homog=False, singular=None): EXAMPLES:: sage: P. = PolynomialRing(QQ, 3) - sage: I = sage.rings.ideal.Katsura(P, 3); I # optional - sage.libs.singular + sage: I = sage.rings.ideal.Katsura(P, 3); I # needs sage.libs.singular Ideal (x + 2*y + 2*z - 1, x^2 + 2*y^2 + 2*z^2 - x, 2*x*y + 2*y*z - y) of Multivariate Polynomial Ring in x, y, z over Rational Field :: - sage: Q. = PolynomialRing(QQ, implementation="singular") # optional - sage.libs.singular - sage: J = sage.rings.ideal.Katsura(Q,1); J # optional - sage.libs.singular + sage: Q. = PolynomialRing(QQ, implementation="singular") # needs sage.libs.singular + sage: J = sage.rings.ideal.Katsura(Q,1); J # needs sage.libs.singular Ideal (x - 1) of Multivariate Polynomial Ring in x over Rational Field """ from .rational_field import RationalField @@ -1849,15 +1853,15 @@ def FieldIdeal(R): The field ideal generated from the polynomial ring over two variables in the finite field of size 2:: - sage: P. = PolynomialRing(GF(2), 2) # optional - sage.rings.finite_rings - sage: I = sage.rings.ideal.FieldIdeal(P); I # optional - sage.rings.finite_rings + sage: P. = PolynomialRing(GF(2), 2) + sage: I = sage.rings.ideal.FieldIdeal(P); I Ideal (x^2 + x, y^2 + y) of Multivariate Polynomial Ring in x, y over Finite Field of size 2 Another, similar example:: - sage: Q. = PolynomialRing(GF(2^4, name='alpha'), 4) # optional - sage.rings.finite_rings - sage: J = sage.rings.ideal.FieldIdeal(Q); J # optional - sage.rings.finite_rings + sage: Q. = PolynomialRing(GF(2^4, name='alpha'), 4) # needs sage.rings.finite_rings + sage: J = sage.rings.ideal.FieldIdeal(Q); J # needs sage.rings.finite_rings Ideal (x1^16 + x1, x2^16 + x2, x3^16 + x3, x4^16 + x4) of Multivariate Polynomial Ring in x1, x2, x3, x4 over Finite Field in alpha of size 2^4 diff --git a/src/sage/rings/ideal_monoid.py b/src/sage/rings/ideal_monoid.py index 01193661aae..ee3ac892b8f 100644 --- a/src/sage/rings/ideal_monoid.py +++ b/src/sage/rings/ideal_monoid.py @@ -3,8 +3,8 @@ WARNING: This is used by some rings that are not commutative! :: - sage: MS = MatrixSpace(QQ, 3, 3) # optional - sage.modules - sage: type(MS.ideal(MS.one()).parent()) # optional - sage.modules + sage: MS = MatrixSpace(QQ, 3, 3) # needs sage.modules + sage: type(MS.ideal(MS.one()).parent()) # needs sage.modules """ @@ -53,9 +53,9 @@ def __init__(self, R): TESTS:: - sage: R = QuadraticField(-23, 'a') # optional - sage.rings.number_field + sage: R = QuadraticField(-23, 'a') # needs sage.rings.number_field sage: from sage.rings.ideal_monoid import IdealMonoid - sage: M = IdealMonoid(R); M # indirect doctest # optional - sage.rings.number_field + sage: M = IdealMonoid(R); M # indirect doctest # needs sage.rings.number_field Monoid of ideals of Number Field in a with defining polynomial x^2 + 23 with a = 4.795831523312720?*I @@ -63,8 +63,8 @@ def __init__(self, R): sage: id.parent().category() Category of commutative monoids - sage: MS = MatrixSpace(QQ, 3, 3) # optional - sage.modules - sage: MS.ideal(MS.one()).parent().category() # optional - sage.modules + sage: MS = MatrixSpace(QQ, 3, 3) # needs sage.modules + sage: MS.ideal(MS.one()).parent().category() # needs sage.modules Category of monoids """ self.__R = R @@ -81,9 +81,9 @@ def _repr_(self): TESTS:: - sage: R = QuadraticField(-23, 'a') # optional - sage.rings.number_field + sage: R = QuadraticField(-23, 'a') # needs sage.rings.number_field sage: from sage.rings.ideal_monoid import IdealMonoid - sage: M = IdealMonoid(R); M._repr_() # optional - sage.rings.number_field + sage: M = IdealMonoid(R); M._repr_() # needs sage.rings.number_field 'Monoid of ideals of Number Field in a with defining polynomial x^2 + 23 with a = 4.795831523312720?*I' """ @@ -95,9 +95,9 @@ def ring(self): EXAMPLES:: - sage: R = QuadraticField(-23, 'a') # optional - sage.rings.number_field + sage: R = QuadraticField(-23, 'a') # needs sage.rings.number_field sage: from sage.rings.ideal_monoid import IdealMonoid - sage: M = IdealMonoid(R); M.ring() is R # optional - sage.rings.number_field + sage: M = IdealMonoid(R); M.ring() is R # needs sage.rings.number_field True """ return self.__R @@ -108,12 +108,13 @@ def _element_constructor_(self, x): EXAMPLES:: - sage: R. = QuadraticField(-23) # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: R. = QuadraticField(-23) sage: from sage.rings.ideal_monoid import IdealMonoid - sage: M = IdealMonoid(R) # optional - sage.rings.number_field - sage: M(a) # indirect doctest # optional - sage.rings.number_field + sage: M = IdealMonoid(R) + sage: M(a) # indirect doctest Fractional ideal (a) - sage: M([a-4, 13]) # optional - sage.rings.number_field + sage: M([a-4, 13]) Fractional ideal (13, 1/2*a + 9/2) """ try: @@ -137,15 +138,16 @@ def _coerce_map_from_(self, x): EXAMPLES:: - sage: R = QuadraticField(-23, 'a') # optional - sage.rings.number_field - sage: M = R.ideal_monoid() # optional - sage.rings.number_field - sage: M.has_coerce_map_from(R) # indirect doctest # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: R = QuadraticField(-23, 'a') + sage: M = R.ideal_monoid() + sage: M.has_coerce_map_from(R) # indirect doctest True - sage: M.has_coerce_map_from(QQ.ideal_monoid()) # optional - sage.rings.number_field + sage: M.has_coerce_map_from(QQ.ideal_monoid()) True - sage: M.has_coerce_map_from(Zmod(6)) # optional - sage.rings.number_field + sage: M.has_coerce_map_from(Zmod(6)) False - sage: M.has_coerce_map_from(loads(dumps(M))) # optional - sage.rings.number_field + sage: M.has_coerce_map_from(loads(dumps(M))) True """ if isinstance(x, IdealMonoid_c): @@ -159,13 +161,14 @@ def __eq__(self, other): EXAMPLES:: - sage: R = QuadraticField(-23, 'a') # optional - sage.rings.number_field - sage: M = R.ideal_monoid() # optional - sage.rings.number_field - sage: M == QQ # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: R = QuadraticField(-23, 'a') + sage: M = R.ideal_monoid() + sage: M == QQ False - sage: M == 17 # optional - sage.rings.number_field + sage: M == 17 False - sage: M == R.ideal_monoid() # optional - sage.rings.number_field + sage: M == R.ideal_monoid() True """ if not isinstance(other, IdealMonoid_c): @@ -179,13 +182,14 @@ def __ne__(self, other): EXAMPLES:: - sage: R = QuadraticField(-23, 'a') # optional - sage.rings.number_field - sage: M = R.ideal_monoid() # optional - sage.rings.number_field - sage: M != QQ # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: R = QuadraticField(-23, 'a') + sage: M = R.ideal_monoid() + sage: M != QQ True - sage: M != 17 # optional - sage.rings.number_field + sage: M != 17 True - sage: M != R.ideal_monoid() # optional - sage.rings.number_field + sage: M != R.ideal_monoid() False """ return not (self == other) @@ -196,13 +200,14 @@ def __hash__(self): EXAMPLES:: - sage: R = QuadraticField(-23, 'a') # optional - sage.rings.number_field - sage: M = R.ideal_monoid() # optional - sage.rings.number_field - sage: hash(M) == hash(QQ) # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: R = QuadraticField(-23, 'a') + sage: M = R.ideal_monoid() + sage: hash(M) == hash(QQ) False - sage: hash(M) == 17 # optional - sage.rings.number_field + sage: hash(M) == 17 False - sage: hash(M) == hash(R.ideal_monoid()) # optional - sage.rings.number_field + sage: hash(M) == hash(R.ideal_monoid()) True """ # uses a random number, to have a distinct hash diff --git a/src/sage/rings/infinity.py b/src/sage/rings/infinity.py index 2d812f5dd1c..19b52f7b242 100644 --- a/src/sage/rings/infinity.py +++ b/src/sage/rings/infinity.py @@ -203,8 +203,8 @@ We check that :trac:`17990` is fixed:: - sage: m = Matrix([Infinity]) # optional - sage.modules - sage: m.rows() # optional - sage.modules + sage: m = Matrix([Infinity]) # needs sage.modules + sage: m.rows() # needs sage.modules [(+Infinity)] """ #***************************************************************************** @@ -290,7 +290,7 @@ def _maxima_init_(self): """ TESTS:: - sage: maxima(-oo) # optional - sage.symbolic + sage: maxima(-oo) # needs sage.symbolic minf sage: [x._maxima_init_() for x in [unsigned_infinity, oo, -oo]] ['inf', 'inf', 'minf'] @@ -306,7 +306,7 @@ def _fricas_init_(self): sage: fricas(-oo) # optional - fricas - infinity - sage: [x._fricas_init_() for x in [unsigned_infinity, oo, -oo]] # optional - fricas + sage: [x._fricas_init_() for x in [unsigned_infinity, oo, -oo]] ['%infinity', '%plusInfinity', '%minusInfinity'] sage: [fricas(x) for x in [unsigned_infinity, oo, -oo]] # optional - fricas [infinity, + infinity, - infinity] @@ -324,9 +324,9 @@ def __pari__(self): EXAMPLES:: - sage: pari(-oo) # optional - sage.libs.pari + sage: pari(-oo) # needs sage.libs.pari -oo - sage: pari(oo) # optional - sage.libs.pari + sage: pari(oo) # needs sage.libs.pari +oo """ from sage.libs.pari.all import pari @@ -472,7 +472,7 @@ def _div_(self, other): Traceback (most recent call last): ... ValueError: unsigned oo times smaller number not defined - sage: SR(infinity) / unsigned_infinity # optional - sage.symbolic + sage: SR(infinity) / unsigned_infinity # needs sage.symbolic Traceback (most recent call last): ... RuntimeError: indeterminate expression: 0 * infinity encountered. @@ -490,7 +490,7 @@ def __float__(self): +infinity sage: float(infinity) # random +infinity - sage: CDF(infinity) + sage: CDF(infinity) # needs sage.rings.complex_double +infinity sage: infinity.__float__() # random +infinity @@ -499,7 +499,7 @@ def __float__(self): -infinity sage: float(-infinity) # random -inf - sage: CDF(-infinity) + sage: CDF(-infinity) # needs sage.rings.complex_double -infinity sage: (-infinity).__float__() # random -inf @@ -568,8 +568,8 @@ def __init__(self): Sage can understand SymPy's complex infinity (:trac:`17493`):: - sage: import sympy # optional - sympy - sage: SR(sympy.zoo) # optional - sympy + sage: import sympy # needs sympy + sage: SR(sympy.zoo) # needs sympy Infinity Some equality checks:: @@ -676,7 +676,7 @@ def _element_constructor_(self, x): sage: UnsignedInfinityRing(2) # indirect doctest A number less than infinity - sage: UnsignedInfinityRing(I) # optional - sage.rings.number_field + sage: UnsignedInfinityRing(I) # needs sage.rings.number_field A number less than infinity sage: UnsignedInfinityRing(unsigned_infinity) Infinity @@ -684,31 +684,31 @@ def _element_constructor_(self, x): Infinity sage: UnsignedInfinityRing(-oo) Infinity - sage: K. = QuadraticField(3) # optional - sage.rings.number_field - sage: UnsignedInfinityRing(a) # optional - sage.rings.number_field + sage: K. = QuadraticField(3) # needs sage.rings.number_field + sage: UnsignedInfinityRing(a) # needs sage.rings.number_field A number less than infinity - sage: UnsignedInfinityRing(a - 2) # optional - sage.rings.number_field + sage: UnsignedInfinityRing(a - 2) # needs sage.rings.number_field A number less than infinity sage: UnsignedInfinityRing(RDF(oo)), UnsignedInfinityRing(RDF(-oo)) (Infinity, Infinity) - sage: UnsignedInfinityRing(RR(oo)), UnsignedInfinityRing(RR(-oo)) # optional - sage.rings.real_mpfr + sage: UnsignedInfinityRing(RR(oo)), UnsignedInfinityRing(RR(-oo)) (Infinity, Infinity) - sage: UnsignedInfinityRing(CDF(oo)), UnsignedInfinityRing(CDF(-oo)) + sage: UnsignedInfinityRing(CDF(oo)), UnsignedInfinityRing(CDF(-oo)) # needs sage.rings.complex_double (Infinity, Infinity) - sage: UnsignedInfinityRing(CC(oo)), UnsignedInfinityRing(CC(-oo)) # optional - sage.rings.real_mpfr + sage: UnsignedInfinityRing(CC(oo)), UnsignedInfinityRing(CC(-oo)) # needs sage.rings.real_mpfr (Infinity, Infinity) sage: UnsignedInfinityRing(RIF(oo)), UnsignedInfinityRing(RIF(-oo)) (Infinity, Infinity) sage: UnsignedInfinityRing(float('+inf')), UnsignedInfinityRing(float('-inf')) (Infinity, Infinity) - sage: UnsignedInfinityRing(SR(oo)), UnsignedInfinityRing(SR(-oo)) # optional - sage.symbolic + sage: UnsignedInfinityRing(SR(oo)), UnsignedInfinityRing(SR(-oo)) # needs sage.symbolic (Infinity, Infinity) The following rings have a ``is_infinity`` method:: sage: RR(oo).is_infinity() True - sage: SR(oo).is_infinity() # optional - sage.symbolic + sage: SR(oo).is_infinity() # needs sage.symbolic True """ # Lazy elements can wrap infinity or not, unwrap first @@ -746,13 +746,13 @@ def _coerce_map_from_(self, R): sage: UnsignedInfinityRing.has_coerce_map_from(int) # indirect doctest True - sage: UnsignedInfinityRing.has_coerce_map_from(CC) # optional - sage.rings.real_mpfr + sage: UnsignedInfinityRing.has_coerce_map_from(CC) # needs sage.rings.real_mpfr True - sage: UnsignedInfinityRing.has_coerce_map_from(QuadraticField(-163, 'a')) # optional - sage.rings.number_field + sage: UnsignedInfinityRing.has_coerce_map_from(QuadraticField(-163, 'a')) # needs sage.rings.number_field True - sage: UnsignedInfinityRing.has_coerce_map_from(QQ^3) # optional - sage.modules + sage: UnsignedInfinityRing.has_coerce_map_from(QQ^3) # needs sage.modules False - sage: UnsignedInfinityRing.has_coerce_map_from(SymmetricGroup(13)) # optional - sage.groups + sage: UnsignedInfinityRing.has_coerce_map_from(SymmetricGroup(13)) # needs sage.groups False """ return isinstance(R, Ring) or R in (int, float, complex) @@ -942,12 +942,12 @@ def _sympy_(self): EXAMPLES:: - sage: import sympy # optional - sympy - sage: SR(unsigned_infinity)._sympy_() # optional - sympy + sage: import sympy # needs sympy + sage: SR(unsigned_infinity)._sympy_() # needs sympy zoo - sage: gamma(-3)._sympy_() is sympy.factorial(-2) # optional - sympy + sage: gamma(-3)._sympy_() is sympy.factorial(-2) # needs sympy True - sage: gamma(-3) is sympy.factorial(-2)._sage_() # optional - sympy + sage: gamma(-3) is sympy.factorial(-2)._sage_() # needs sympy True """ import sympy @@ -983,7 +983,7 @@ def is_Infinite(x): True sage: sage.rings.infinity.is_Infinite(3) False - sage: sage.rings.infinity.is_Infinite(RR(infinity)) # optional - sage.rings.real_mpfr + sage: sage.rings.infinity.is_Infinite(RR(infinity)) False sage: sage.rings.infinity.is_Infinite(ZZ) False @@ -1130,43 +1130,43 @@ def _element_constructor_(self, x): sage: [InfinityRing(a) for a in [-2..2]] [A negative finite number, A negative finite number, Zero, A positive finite number, A positive finite number] - sage: K. = QuadraticField(3) # optional - sage.rings.number_field - sage: InfinityRing(a) # optional - sage.rings.number_field + sage: K. = QuadraticField(3) # needs sage.rings.number_field + sage: InfinityRing(a) # needs sage.rings.number_field A positive finite number - sage: InfinityRing(a - 2) # optional - sage.rings.number_field + sage: InfinityRing(a - 2) # needs sage.rings.number_field A negative finite number sage: InfinityRing(RDF(oo)), InfinityRing(RDF(-oo)) (+Infinity, -Infinity) - sage: InfinityRing(RR(oo)), InfinityRing(RR(-oo)) # optional - sage.rings.real_mpfr + sage: InfinityRing(RR(oo)), InfinityRing(RR(-oo)) (+Infinity, -Infinity) sage: InfinityRing(RIF(oo)), InfinityRing(RIF(-oo)) (+Infinity, -Infinity) sage: InfinityRing(float('+inf')), InfinityRing(float('-inf')) (+Infinity, -Infinity) - sage: InfinityRing(SR(oo)), InfinityRing(SR(-oo)) # optional - sage.symbolic + sage: InfinityRing(SR(oo)), InfinityRing(SR(-oo)) # needs sage.symbolic (+Infinity, -Infinity) The following rings have ``is_positive_infinity`` / ``is_negative_infinity`` methods:: - sage: RR(oo).is_positive_infinity(), RR(-oo).is_negative_infinity() # optional - sage.rings.real_mpfr + sage: RR(oo).is_positive_infinity(), RR(-oo).is_negative_infinity() (True, True) - sage: SR(oo).is_positive_infinity(), SR(-oo).is_negative_infinity() # optional - sage.symbolic + sage: SR(oo).is_positive_infinity(), SR(-oo).is_negative_infinity() # needs sage.symbolic (True, True) Complex infinity raises an exception. This is fine (there is no coercion, so there is no promise of functoriality):: - sage: i_infinity = CC(0, oo) # optional - sage.rings.real_mpfr - sage: InfinityRing(CC(oo)), InfinityRing(CC(-oo)) # optional - sage.rings.real_mpfr + sage: i_infinity = CC(0, oo) # needs sage.rings.real_mpfr + sage: InfinityRing(CC(oo)), InfinityRing(CC(-oo)) # needs sage.rings.real_mpfr (+Infinity, -Infinity) - sage: InfinityRing(i_infinity) # optional - sage.rings.real_mpfr + sage: InfinityRing(i_infinity) # needs sage.rings.real_mpfr Traceback (most recent call last): ... ValueError: infinite but not with +/- phase - sage: InfinityRing(CDF(oo)), InfinityRing(CDF(-oo)) + sage: InfinityRing(CDF(oo)), InfinityRing(CDF(-oo)) # needs sage.rings.complex_double (+Infinity, -Infinity) - sage: InfinityRing(CDF(i_infinity)) + sage: InfinityRing(CDF(i_infinity)) # needs sage.rings.complex_double sage.rings.real_mpfr Traceback (most recent call last): ... ValueError: infinite but not with +/- phase @@ -1227,7 +1227,7 @@ def _coerce_map_from_(self, R): sage: InfinityRing.has_coerce_map_from(int) # indirect doctest True - sage: InfinityRing.has_coerce_map_from(AA) # optional - sage.rings.number_field + sage: InfinityRing.has_coerce_map_from(AA) # needs sage.rings.number_field True sage: InfinityRing.has_coerce_map_from(RDF) True @@ -1238,7 +1238,7 @@ def _coerce_map_from_(self, R): infinity ring:: sage: cm = get_coercion_model() - sage: cm.explain(AA(3), oo, operator.lt) # optional - sage.rings.number_field + sage: cm.explain(AA(3), oo, operator.lt) # needs sage.rings.number_field Coercion on left operand via Coercion map: From: Algebraic Real Field @@ -1251,9 +1251,9 @@ def _coerce_map_from_(self, R): symbolic comparisons with infinities all happen in the symbolic ring:: - sage: SR.has_coerce_map_from(InfinityRing) # optional - sage.symbolic + sage: SR.has_coerce_map_from(InfinityRing) # needs sage.symbolic True - sage: InfinityRing.has_coerce_map_from(SR) # optional - sage.symbolic + sage: InfinityRing.has_coerce_map_from(SR) # needs sage.symbolic False Complex numbers do not coerce into the infinity ring (what @@ -1261,11 +1261,11 @@ def _coerce_map_from_(self, R): be compared, so we do not have to enforce consistency when comparing with infinity either:: - sage: InfinityRing.has_coerce_map_from(CDF) + sage: InfinityRing.has_coerce_map_from(CDF) # needs sage.rings.complex_double False - sage: InfinityRing.has_coerce_map_from(CC) # optional - sage.rings.real_mpfr + sage: InfinityRing.has_coerce_map_from(CC) # needs sage.rings.real_mpfr False - sage: CC(0, oo) < CC(1) # does not coerce to infinity ring # optional - sage.rings.real_mpfr + sage: CC(0, oo) < CC(1) # does not coerce to infinity ring # needs sage.rings.real_mpfr True """ from sage.structure.coerce import parent_is_real_numerical @@ -1279,7 +1279,7 @@ def _pushout_(self, other): r""" EXAMPLES:: - sage: QQbar(-2*i)*infinity # optional - sage.rings.number_field sage.symbolic + sage: QQbar(-2*i)*infinity # needs sage.rings.number_field sage.symbolic (-I)*Infinity """ from sage.symbolic.ring import SR @@ -1480,9 +1480,9 @@ def _latex_(self): TESTS:: - sage: a = InfinityRing(pi); a # optional - sage.symbolic + sage: a = InfinityRing(pi); a # needs sage.symbolic A positive finite number - sage: a._latex_() # optional - sage.symbolic + sage: a._latex_() # needs sage.symbolic 'A positive finite number' sage: [latex(InfinityRing(a)) for a in [-2..2]] [A negative finite number, A negative finite number, Zero, A positive finite number, A positive finite number] @@ -1623,12 +1623,12 @@ def _sympy_(self): EXAMPLES:: - sage: import sympy # optional - sympy - sage: bool(-oo == -sympy.oo) # optional - sympy + sage: import sympy # needs sympy + sage: bool(-oo == -sympy.oo) # needs sympy True - sage: bool(SR(-oo) == -sympy.oo) # optional - sympy + sage: bool(SR(-oo) == -sympy.oo) # needs sympy True - sage: bool((-oo)._sympy_() == -sympy.oo) # optional - sympy + sage: bool((-oo)._sympy_() == -sympy.oo) # needs sympy True """ @@ -1641,9 +1641,9 @@ def _gap_init_(self): EXAMPLES:: - sage: gap(-Infinity) # optional - sage.libs.gap + sage: gap(-Infinity) # needs sage.libs.gap -infinity - sage: libgap(-Infinity) # optional - sage.libs.gap + sage: libgap(-Infinity) # needs sage.libs.gap -infinity """ return '-infinity' @@ -1724,10 +1724,10 @@ def _sympy_(self): EXAMPLES:: - sage: import sympy # optional - sympy - sage: bool(oo == sympy.oo) # indirect doctest # optional - sympy + sage: import sympy # needs sympy + sage: bool(oo == sympy.oo) # indirect doctest # needs sympy True - sage: bool(SR(oo) == sympy.oo) # optional - sage.symbolic sympy + sage: bool(SR(oo) == sympy.oo) # needs sympy sage.symbolic True """ import sympy @@ -1739,9 +1739,9 @@ def _gap_init_(self): EXAMPLES:: - sage: gap(+Infinity) # optional - sage.libs.gap + sage: gap(+Infinity) # needs sage.libs.gap infinity - sage: libgap(+Infinity) # optional - sage.libs.gap + sage: libgap(+Infinity) # needs sage.libs.gap infinity """ return 'infinity' @@ -1769,8 +1769,8 @@ def test_comparison(ring): EXAMPLES:: sage: from sage.rings.infinity import test_comparison - sage: rings = [ZZ, QQ, RR, RealField(200), RDF, RLF, RIF] # optional - sage.rings.real_mpfr - sage: for R in rings: # optional - sage.rings.real_mpfr + sage: rings = [ZZ, QQ, RR, RealField(200), RDF, RLF, RIF] # needs sage.rings.real_mpfr + sage: for R in rings: # needs sage.rings.real_mpfr ....: print('testing {}'.format(R)) ....: test_comparison(R) testing Integer Ring @@ -1780,19 +1780,20 @@ def test_comparison(ring): testing Real Double Field testing Real Lazy Field testing Real Interval Field with 53 bits of precision - sage: test_comparison(AA) # optional - sage.rings.number_field + sage: test_comparison(AA) # needs sage.rings.number_field Comparison with number fields does not work:: - sage: K. = NumberField(x^2 - 3) # optional - sage.rings.number_field - sage: (-oo < 1 + sqrt3) and (1 + sqrt3 < oo) # known bug # optional - sage.rings.number_field + sage: x = polygen(ZZ, 'x') + sage: K. = NumberField(x^2 - 3) # needs sage.rings.number_field + sage: (-oo < 1 + sqrt3) and (1 + sqrt3 < oo) # known bug # needs sage.rings.number_field False The symbolic ring handles its own infinities, but answers ``False`` (meaning: cannot decide) already for some very elementary comparisons:: - sage: test_comparison(SR) # known bug # optional - sage.symbolic + sage: test_comparison(SR) # known bug # needs sage.symbolic Traceback (most recent call last): ... AssertionError: testing -1000.0 in Symbolic Ring: id = ... diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index c2414413fda..3e9fe6ce885 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -24,7 +24,7 @@ Add an integer and a rational number:: Add an integer and a complex number:: - sage: b = ComplexField().0 + 1.5 + sage: b = ComplexField().0 + 1.5 # needs sage.rings.real_mpfr sage: loads((a + b).dumps()) == a + b True @@ -64,8 +64,8 @@ Return version of this integer in the multi-precision floating real field `\RR`:: sage: n = 9390823 - sage: RR = RealField(200) - sage: RR(n) + sage: RR = RealField(200) # needs sage.rings.real_mpfr + sage: RR(n) # needs sage.rings.real_mpfr 9.3908230000000000000000000000000000000000000000000000000000e6 AUTHORS: @@ -421,9 +421,9 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): Conversion from PARI:: - sage: Integer(pari('-10380104371593008048799446356441519384')) # optional - sage.libs.pari + sage: Integer(pari('-10380104371593008048799446356441519384')) # needs sage.libs.pari -10380104371593008048799446356441519384 - sage: Integer(pari('Pol([-3])')) # optional - sage.libs.pari + sage: Integer(pari('Pol([-3])')) # needs sage.libs.pari -3 Conversion from gmpy2:: @@ -459,11 +459,11 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): -901824309821093821093812093810928309183091832091 sage: ZZ(RR(2.0)^80) 1208925819614629174706176 - sage: ZZ(QQbar(sqrt(28-10*sqrt(3)) + sqrt(3))) # optional - sage.rings.number_field sage.symbolic + sage: ZZ(QQbar(sqrt(28-10*sqrt(3)) + sqrt(3))) # needs sage.rings.number_field sage.symbolic 5 - sage: ZZ(AA(32).nth_root(5)) # optional - sage.rings.number_field + sage: ZZ(AA(32).nth_root(5)) # needs sage.rings.number_field 2 - sage: ZZ(pari('Mod(-3,7)')) # optional - sage.libs.pari + sage: ZZ(pari('Mod(-3,7)')) # needs sage.libs.pari 4 sage: ZZ('sage') Traceback (most recent call last): @@ -475,10 +475,10 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): '3b' sage: ZZ( ZZ(5).digits(3) , 3) 5 - sage: import numpy # optional - numpy - sage: ZZ(numpy.int64(7^7)) # optional - numpy + sage: import numpy # needs numpy + sage: ZZ(numpy.int64(7^7)) # needs numpy 823543 - sage: ZZ(numpy.ubyte(-7)) # optional - numpy + sage: ZZ(numpy.ubyte(-7)) # needs numpy 249 sage: ZZ(True) 1 @@ -494,8 +494,8 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): :: - sage: k = GF(2) # optional - sage.rings.finite_rings - sage: ZZ((k(0),k(1)), 2) # optional - sage.rings.finite_rings + sage: k = GF(2) + sage: ZZ((k(0),k(1)), 2) 2 :: @@ -531,40 +531,40 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): Test conversion from PARI (:trac:`11685`):: - sage: ZZ(pari(-3)) # optional - sage.libs.pari + sage: ZZ(pari(-3)) # needs sage.libs.pari -3 - sage: ZZ(pari("-3.0")) # optional - sage.libs.pari + sage: ZZ(pari("-3.0")) # needs sage.libs.pari -3 - sage: ZZ(pari("-3.5")) # optional - sage.libs.pari + sage: ZZ(pari("-3.5")) # needs sage.libs.pari Traceback (most recent call last): ... TypeError: Attempt to coerce non-integral real number to an Integer - sage: ZZ(pari("1e100")) # optional - sage.libs.pari + sage: ZZ(pari("1e100")) # needs sage.libs.pari Traceback (most recent call last): ... PariError: precision too low in truncr (precision loss in truncation) - sage: ZZ(pari("10^50")) # optional - sage.libs.pari + sage: ZZ(pari("10^50")) # needs sage.libs.pari 100000000000000000000000000000000000000000000000000 - sage: ZZ(pari("Pol(3)")) # optional - sage.libs.pari + sage: ZZ(pari("Pol(3)")) # needs sage.libs.pari 3 - sage: ZZ(GF(3^20,'t')(1)) # optional - sage.rings.finite_rings + sage: ZZ(GF(3^20,'t')(1)) # needs sage.rings.finite_rings 1 - sage: ZZ(pari(GF(3^20,'t')(1))) # optional - sage.libs.pari sage.rings.finite_rings + sage: ZZ(pari(GF(3^20,'t')(1))) # needs sage.libs.pari sage.rings.finite_rings 1 sage: x = polygen(QQ) - sage: K. = NumberField(x^2 + 3) # optional - sage.rings.number_field - sage: ZZ(a^2) # optional - sage.rings.number_field + sage: K. = NumberField(x^2 + 3) # needs sage.rings.number_field + sage: ZZ(a^2) # needs sage.rings.number_field -3 - sage: ZZ(pari(a)^2) # optional - sage.libs.pari sage.rings.number_field + sage: ZZ(pari(a)^2) # needs sage.libs.pari sage.rings.number_field -3 - sage: ZZ(pari("Mod(x, x^3+x+1)")) # Note error message refers to lifted element # optional - sage.libs.pari + sage: ZZ(pari("Mod(x, x^3+x+1)")) # Note error message refers to lifted element # needs sage.libs.pari Traceback (most recent call last): ... TypeError: Unable to coerce PARI x to an Integer Test coercion of p-adic with negative valuation:: - sage: ZZ(pari(Qp(11)(11^-7))) # optional - sage.libs.pari sage.rings.padics + sage: ZZ(pari(Qp(11)(11^-7))) # needs sage.libs.pari sage.rings.padics Traceback (most recent call last): ... TypeError: cannot convert p-adic with negative valuation to an integer @@ -580,23 +580,23 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): Test comparisons with numpy types (see :trac:`13386` and :trac:`18076`):: - sage: import numpy # optional - numpy - sage: numpy.int8('12') == 12 # optional - numpy + sage: import numpy # needs numpy + sage: numpy.int8('12') == 12 # needs numpy True - sage: 12 == numpy.int8('12') # optional - numpy + sage: 12 == numpy.int8('12') # needs numpy True - sage: float('15') == 15 # optional - numpy + sage: float('15') == 15 True - sage: 15 == float('15') # optional - numpy + sage: 15 == float('15') True Test underscores as digit separators (PEP 515, https://www.python.org/dev/peps/pep-0515/):: - sage: Integer('1_3') # optional - numpy + sage: Integer('1_3') 13 - sage: Integer(b'1_3') # optional - numpy + sage: Integer(b'1_3') 13 """ # TODO: All the code below should somehow be in an external @@ -765,8 +765,8 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: sage: n = -10 - sage: R = GF(17) # optional - sage.rings.finite_rings - sage: n._im_gens_(R, [R(1)]) # optional - sage.rings.finite_rings + sage: R = GF(17) + sage: n._im_gens_(R, [R(1)]) 7 """ return codomain.coerce(self) @@ -1003,9 +1003,9 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: ex = SR(ZZ(7)); ex # optional - sage.symbolic + sage: ex = SR(ZZ(7)); ex # needs sage.symbolic 7 - sage: parent(ex) # optional - sage.symbolic + sage: parent(ex) # needs sage.symbolic Symbolic Ring """ return sring._force_pyobject(self, force=True) @@ -1016,9 +1016,9 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: n = 5; n._sympy_() # optional - sympy + sage: n = 5; n._sympy_() # needs sympy 5 - sage: n = -5; n._sympy_() # optional - sympy + sage: n = -5; n._sympy_() # needs sympy -5 """ import sympy @@ -2004,7 +2004,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): Traceback (most recent call last): ... ZeroDivisionError: rational division by zero - sage: 3 / QQbar.zero() # optional - sage.rings.number_field + sage: 3 / QQbar.zero() # needs sage.rings.number_field Traceback (most recent call last): ... ZeroDivisionError: division by zero in algebraic field @@ -2109,7 +2109,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): 1 sage: 2^-0 1 - sage: (-1)^(1/3) # optional - sage.symbolic + sage: (-1)^(1/3) # needs sage.symbolic (-1)^(1/3) For consistency with Python and MPFR, 0^0 is defined to be 1 in @@ -2136,30 +2136,31 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): We raise 2 to various interesting exponents:: - sage: 2^x # symbolic x # optional - sage.symbolic + sage: 2^x # symbolic x # needs sage.symbolic 2^x sage: 2^1.5 # real number 2.82842712474619 sage: 2^float(1.5) # python float abs tol 3e-16 2.8284271247461903 - sage: 2^I # complex number + sage: 2^I # complex number # needs sage.symbolic 2^I sage: r = 2 ^ int(-3); r; type(r) 1/8 - sage: f = 2^(sin(x)-cos(x)); f # optional - sage.symbolic + sage: f = 2^(sin(x)-cos(x)); f # needs sage.symbolic 2^(-cos(x) + sin(x)) - sage: f(x=3) + sage: f(x=3) # needs sage.symbolic 2^(-cos(3) + sin(3)) A symbolic sum:: - sage: x, y, z = var('x,y,z') # optional - sage.symbolic - sage: 2^(x + y + z) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: x, y, z = var('x,y,z') + sage: 2^(x + y + z) 2^(x + y + z) - sage: 2^(1/2) # optional - sage.symbolic + sage: 2^(1/2) sqrt(2) - sage: 2^(-1/2) # optional - sage.symbolic + sage: 2^(-1/2) 1/2*sqrt(2) TESTS:: @@ -2651,9 +2652,9 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): :: sage: x = 3^100000 - sage: RR(log(RR(x), 3)) + sage: RR(log(RR(x), 3)) # needs sage.symbolic 100000.000000000 - sage: RR(log(RR(x + 100000), 3)) + sage: RR(log(RR(x + 100000), 3)) # needs sage.symbolic 100000.000000000 :: @@ -2764,15 +2765,15 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: Integer(124).log(5) # optional - sage.symbolic + sage: Integer(124).log(5) # needs sage.symbolic log(124)/log(5) - sage: Integer(124).log(5, 100) # optional - sage.rings.real_mpfr + sage: Integer(124).log(5, 100) # needs sage.rings.real_mpfr 2.9950093311241087454822446806 sage: Integer(125).log(5) 3 - sage: Integer(125).log(5, prec=53) # optional - sage.rings.real_mpfr + sage: Integer(125).log(5, prec=53) # needs sage.rings.real_mpfr 3.00000000000000 - sage: log(Integer(125)) # optional - sage.symbolic + sage: log(Integer(125)) # needs sage.symbolic 3*log(5) For extremely large numbers, this works:: @@ -2785,28 +2786,28 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): works in a reasonable amount of time for this ``x``:: sage: x = 3^100000 - sage: log(x) # optional - sage.symbolic + sage: log(x) # needs sage.symbolic log(1334971414230...5522000001) But approximations are probably more useful in this case, and work to as high a precision as we desire:: - sage: x.log(3, 53) # default precision for RealField # optional - sage.rings.real_mpfr + sage: x.log(3, 53) # default precision for RealField # needs sage.rings.real_mpfr 100000.000000000 - sage: (x + 1).log(3, 53) # optional - sage.rings.real_mpfr + sage: (x + 1).log(3, 53) # needs sage.rings.real_mpfr 100000.000000000 - sage: (x + 1).log(3, 1000) # optional - sage.rings.real_mpfr + sage: (x + 1).log(3, 1000) # needs sage.rings.real_mpfr 100000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 We can use non-integer bases, with default e:: - sage: x.log(2.5, prec=53) # optional - sage.rings.real_mpfr + sage: x.log(2.5, prec=53) # needs sage.rings.real_mpfr 119897.784671579 We also get logarithms of negative integers, via the symbolic ring, using the branch from `-\pi` to `\pi`:: - sage: log(-1) # optional - sage.symbolic + sage: log(-1) # needs sage.symbolic I*pi The logarithm of zero is done likewise:: @@ -2826,7 +2827,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): TESTS:: - sage: (-2).log(3) # optional - sage.symbolic + sage: (-2).log(3) # needs sage.symbolic (I*pi + log(2))/log(3) """ cdef int self_sgn @@ -2883,11 +2884,11 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: Integer(8).exp() # optional - sage.symbolic + sage: Integer(8).exp() # needs sage.symbolic e^8 - sage: Integer(8).exp(prec=100) # optional - sage.symbolic + sage: Integer(8).exp(prec=100) # needs sage.symbolic 2980.9579870417282747435920995 - sage: exp(Integer(8)) # optional - sage.symbolic + sage: exp(Integer(8)) # needs sage.symbolic e^8 For even fairly large numbers, this may not be useful. @@ -2895,9 +2896,9 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): :: sage: y = Integer(145^145) - sage: y.exp() # optional - sage.symbolic + sage: y.exp() # needs sage.symbolic e^25024207011349079210459585279553675697932183658421565260323592409432707306554163224876110094014450895759296242775250476115682350821522931225499163750010280453185147546962559031653355159703678703793369785727108337766011928747055351280379806937944746847277089168867282654496776717056860661614337004721164703369140625 - sage: y.exp(prec=53) # default RealField precision # optional - sage.symbolic + sage: y.exp(prec=53) # default RealField precision # needs sage.symbolic +infinity """ from sage.functions.all import exp @@ -2977,12 +2978,12 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): Setting the optional ``limit`` argument works as expected:: sage: a = 10^100 + 1 - sage: a.prime_divisors() # optional - sage.libs.pari + sage: a.prime_divisors() # needs sage.libs.pari [73, 137, 401, 1201, 1601, 1676321, 5964848081, 129694419029057750551385771184564274499075700947656757821537291527196801] - sage: a.prime_divisors(limit=10^3) # optional - sage.libs.pari + sage: a.prime_divisors(limit=10^3) [73, 137, 401] - sage: a.prime_divisors(limit=10^7) # optional - sage.libs.pari + sage: a.prime_divisors(limit=10^7) [73, 137, 401, 1201, 1601, 1676321] """ res = [r[0] for r in self.factor(*args, **kwds)] @@ -3024,32 +3025,32 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): [1, 2, 3, 4, 6, 8, 9, 12, 17, 18, 24, 34, 36, 51, 68, 72, 102, 136, 153, 204, 306, 408, 612, 1224] sage: a = odd_part(factorial(31)) - sage: v = a.divisors() # optional - sage.libs.pari - sage: len(v) # optional - sage.libs.pari + sage: v = a.divisors() # needs sage.libs.pari + sage: len(v) # needs sage.libs.pari 172800 - sage: prod(e + 1 for p, e in factor(a)) # optional - sage.libs.pari + sage: prod(e + 1 for p, e in factor(a)) # needs sage.libs.pari 172800 - sage: all(t.divides(a) for t in v) # optional - sage.libs.pari + sage: all(t.divides(a) for t in v) # needs sage.libs.pari True :: sage: n = 2^551 - 1 - sage: L = n.divisors() # optional - sage.libs.pari - sage: len(L) # optional - sage.libs.pari + sage: L = n.divisors() # needs sage.libs.pari + sage: len(L) # needs sage.libs.pari 256 - sage: L[-1] == n # optional - sage.libs.pari + sage: L[-1] == n # needs sage.libs.pari True TESTS: Overflow:: - sage: prod(primes_first_n(64)).divisors() # optional - sage.libs.pari + sage: prod(primes_first_n(64)).divisors() # needs sage.libs.pari Traceback (most recent call last): ... OverflowError: value too large - sage: prod(primes_first_n(58)).divisors() # optional - sage.libs.pari + sage: prod(primes_first_n(58)).divisors() # needs sage.libs.pari Traceback (most recent call last): ... OverflowError: value too large # 32-bit @@ -3059,8 +3060,8 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): (the ``divisors`` call below allocates about 800 MB every time, so a memory leak will not go unnoticed):: - sage: n = prod(primes_first_n(25)) # optional - sage.libs.pari - sage: for i in range(20): # long time # optional - sage.libs.pari + sage: n = prod(primes_first_n(25)) # needs sage.libs.pari + sage: for i in range(20): # long time # needs sage.libs.pari ....: try: ....: alarm(RDF.random_element(1e-3, 0.5)) ....: _ = n.divisors() @@ -3342,9 +3343,9 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): This example caused trouble in :trac:`6083`:: - sage: a = next_prime(2**31) # optional - sage.libs.pari - sage: b = Integers(a)(100) # optional - sage.libs.pari - sage: a % b # optional - sage.libs.pari + sage: a = next_prime(2**31) # needs sage.libs.pari + sage: b = Integers(a)(100) # needs sage.libs.pari + sage: a % b # needs sage.libs.pari Traceback (most recent call last): ... ArithmeticError: reduction modulo 100 not defined @@ -3440,10 +3441,10 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): sage: divmod(1, sys.maxsize+1r) # should not raise OverflowError: Python int too large to convert to C long (0, 1) - sage: import mpmath # optional - mpmath - sage: mpmath.mp.prec = 1000 # optional - mpmath - sage: root = mpmath.findroot(lambda x: x^2 - 3, 2) # optional - mpmath - sage: len(str(root)) # optional - mpmath + sage: import mpmath # needs mpmath + sage: mpmath.mp.prec = 1000 # needs mpmath + sage: root = mpmath.findroot(lambda x: x^2 - 3, 2) # needs mpmath + sage: len(str(root)) # needs mpmath 301 """ cdef Integer q = PY_NEW(Integer) @@ -3696,44 +3697,46 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: n = next_prime(10^6)*next_prime(10^7); n.trial_division() # optional - sage.libs.pari + sage: # needs sage.libs.pari + sage: n = next_prime(10^6)*next_prime(10^7); n.trial_division() 1000003 - sage: (-n).trial_division() # optional - sage.libs.pari + sage: (-n).trial_division() 1000003 - sage: n.trial_division(bound=100) # optional - sage.libs.pari + sage: n.trial_division(bound=100) 10000049000057 - sage: n.trial_division(bound=-10) # optional - sage.libs.pari + sage: n.trial_division(bound=-10) Traceback (most recent call last): ... ValueError: bound must be positive - sage: n.trial_division(bound=0) # optional - sage.libs.pari + sage: n.trial_division(bound=0) Traceback (most recent call last): ... ValueError: bound must be positive - sage: ZZ(0).trial_division() # optional - sage.libs.pari + sage: ZZ(0).trial_division() Traceback (most recent call last): ... ValueError: self must be nonzero - sage: n = next_prime(10^5) * next_prime(10^40); n.trial_division() # optional - sage.libs.pari + sage: # needs sage.libs.pari + sage: n = next_prime(10^5) * next_prime(10^40); n.trial_division() 100003 - sage: n.trial_division(bound=10^4) # optional - sage.libs.pari + sage: n.trial_division(bound=10^4) 1000030000000000000000000000000000000012100363 - sage: (-n).trial_division(bound=10^4) # optional - sage.libs.pari + sage: (-n).trial_division(bound=10^4) 1000030000000000000000000000000000000012100363 - sage: (-n).trial_division() # optional - sage.libs.pari + sage: (-n).trial_division() 100003 - sage: n = 2 * next_prime(10^40); n.trial_division() # optional - sage.libs.pari + sage: n = 2 * next_prime(10^40); n.trial_division() 2 - sage: n = 3 * next_prime(10^40); n.trial_division() # optional - sage.libs.pari + sage: n = 3 * next_prime(10^40); n.trial_division() 3 - sage: n = 5 * next_prime(10^40); n.trial_division() # optional - sage.libs.pari + sage: n = 5 * next_prime(10^40); n.trial_division() 5 - sage: n = 2 * next_prime(10^4); n.trial_division() # optional - sage.libs.pari + sage: n = 2 * next_prime(10^4); n.trial_division() 2 - sage: n = 3 * next_prime(10^4); n.trial_division() # optional - sage.libs.pari + sage: n = 3 * next_prime(10^4); n.trial_division() 3 - sage: n = 5 * next_prime(10^4); n.trial_division() # optional - sage.libs.pari + sage: n = 5 * next_prime(10^4); n.trial_division() 5 You can specify a starting point:: @@ -3859,7 +3862,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: n = 2^100 - 1; n.factor() # optional - sage.libs.pari + sage: n = 2^100 - 1; n.factor() # needs sage.libs.pari 3 * 5^3 * 11 * 31 * 41 * 101 * 251 * 601 * 1801 * 4051 * 8101 * 268501 This factorization can be converted into a list of pairs `(p, @@ -3886,9 +3889,9 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): that appear in the factorization:: sage: n = 920384092842390423848290348203948092384082349082 - sage: n.factor(proof=False) # optional - sage.libs.pari + sage: n.factor(proof=False) # needs sage.libs.pari 2 * 11 * 1531 * 4402903 * 10023679 * 619162955472170540533894518173 - sage: n.factor(proof=True) # optional - sage.libs.pari + sage: n.factor(proof=True) # needs sage.libs.pari 2 * 11 * 1531 * 4402903 * 10023679 * 619162955472170540533894518173 We factor using trial division only:: @@ -3899,15 +3902,16 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): An example where FLINT is used:: sage: n = 82862385732327628428164127822 - sage: n.factor(algorithm='flint') # optional - sage.libs.flint + sage: n.factor(algorithm='flint') # needs sage.libs.flint 2 * 3 * 11 * 13 * 41 * 73 * 22650083 * 1424602265462161 We factor using a quadratic sieve algorithm:: - sage: p = next_prime(10^20) # optional - sage.libs.pari - sage: q = next_prime(10^21) # optional - sage.libs.pari - sage: n = p * q # optional - sage.libs.pari - sage: n.factor(algorithm='qsieve') # optional - sage.libs.pari + sage: # needs sage.libs.pari + sage: p = next_prime(10^20) + sage: q = next_prime(10^21) + sage: n = p * q + sage: n.factor(algorithm='qsieve') doctest:... RuntimeWarning: the factorization returned by qsieve may be incomplete (the factors may not be prime) or even wrong; see qsieve? for details @@ -3915,10 +3919,11 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): We factor using the elliptic curve method:: - sage: p = next_prime(10^15) # optional - sage.libs.pari - sage: q = next_prime(10^21) # optional - sage.libs.pari - sage: n = p * q # optional - sage.libs.pari - sage: n.factor(algorithm='ecm') # optional - sage.libs.pari + sage: # needs sage.libs.pari + sage: p = next_prime(10^15) + sage: q = next_prime(10^21) + sage: n = p * q + sage: n.factor(algorithm='ecm') 1000000000000037 * 1000000000000000000117 TESTS:: @@ -4614,13 +4619,14 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: gamma(5) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: gamma(5) 24 - sage: gamma(0) # optional - sage.symbolic + sage: gamma(0) Infinity - sage: gamma(-1) # optional - sage.symbolic + sage: gamma(-1) Infinity - sage: gamma(-2^150) # optional - sage.symbolic + sage: gamma(-2^150) Infinity """ if mpz_sgn(self.value) > 0: @@ -4810,7 +4816,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: 144.perfect_power() # optional - sage.libs.pari + sage: 144.perfect_power() # needs sage.libs.pari (12, 2) sage: 1.perfect_power() (1, 1) @@ -4818,15 +4824,15 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): (0, 1) sage: (-1).perfect_power() (-1, 1) - sage: (-8).perfect_power() # optional - sage.libs.pari + sage: (-8).perfect_power() # needs sage.libs.pari (-2, 3) sage: (-4).perfect_power() (-4, 1) - sage: (101^29).perfect_power() # optional - sage.libs.pari + sage: (101^29).perfect_power() # needs sage.libs.pari (101, 29) - sage: (-243).perfect_power() # optional - sage.libs.pari + sage: (-243).perfect_power() # needs sage.libs.pari (-3, 5) - sage: (-64).perfect_power() # optional - sage.libs.pari + sage: (-64).perfect_power() # needs sage.libs.pari (-4, 3) TESTS:: @@ -4872,9 +4878,9 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: ZZ(5).global_height() + sage: ZZ(5).global_height() # needs sage.rings.real_mpfr 1.60943791243410 - sage: ZZ(-2).global_height(prec=100) + sage: ZZ(-2).global_height(prec=100) # needs sage.rings.real_mpfr 0.69314718055994530941723212146 sage: exp(_) 2.0000000000000000000000000000 @@ -5135,55 +5141,57 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: 17.is_prime_power() # optional - sage.libs.pari + sage: # needs sage.libs.pari + sage: 17.is_prime_power() True - sage: 10.is_prime_power() # optional - sage.libs.pari + sage: 10.is_prime_power() False - sage: 64.is_prime_power() # optional - sage.libs.pari + sage: 64.is_prime_power() True - sage: (3^10000).is_prime_power() # optional - sage.libs.pari + sage: (3^10000).is_prime_power() True - sage: (10000).is_prime_power() # optional - sage.libs.pari + sage: (10000).is_prime_power() False - sage: (-3).is_prime_power() # optional - sage.libs.pari + sage: (-3).is_prime_power() False - sage: 0.is_prime_power() # optional - sage.libs.pari + sage: 0.is_prime_power() False - sage: 1.is_prime_power() # optional - sage.libs.pari + sage: 1.is_prime_power() False - sage: p = next_prime(10^20); p # optional - sage.libs.pari + sage: p = next_prime(10^20); p 100000000000000000039 - sage: p.is_prime_power() # optional - sage.libs.pari + sage: p.is_prime_power() True - sage: (p^97).is_prime_power() # optional - sage.libs.pari + sage: (p^97).is_prime_power() True - sage: (p + 1).is_prime_power() # optional - sage.libs.pari + sage: (p + 1).is_prime_power() False With the ``get_data`` keyword set to ``True``:: - sage: (3^100).is_prime_power(get_data=True) # optional - sage.libs.pari + sage: # needs sage.libs.pari + sage: (3^100).is_prime_power(get_data=True) (3, 100) - sage: 12.is_prime_power(get_data=True) # optional - sage.libs.pari + sage: 12.is_prime_power(get_data=True) (12, 0) - sage: (p^97).is_prime_power(get_data=True) # optional - sage.libs.pari + sage: (p^97).is_prime_power(get_data=True) (100000000000000000039, 97) - sage: q = p.next_prime(); q # optional - sage.libs.pari + sage: q = p.next_prime(); q 100000000000000000129 - sage: (p*q).is_prime_power(get_data=True) # optional - sage.libs.pari + sage: (p*q).is_prime_power(get_data=True) (10000000000000000016800000000000000005031, 0) The method works for large entries when ``proof=False``:: sage: proof.arithmetic(False) - sage: ((10^500 + 961)^4).is_prime_power() # optional - sage.libs.pari + sage: ((10^500 + 961)^4).is_prime_power() # needs sage.libs.pari True sage: proof.arithmetic(True) We check that :trac:`4777` is fixed:: sage: n = 150607571^14 - sage: n.is_prime_power() # optional - sage.libs.pari + sage: n.is_prime_power() # needs sage.libs.pari True TESTS:: @@ -5277,26 +5285,26 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: sage: z = 2^31 - 1 - sage: z.is_prime() # optional - sage.libs.pari + sage: z.is_prime() # needs sage.libs.pari True sage: z = 2^31 - sage: z.is_prime() # optional - sage.libs.pari + sage: z.is_prime() False sage: z = 7 - sage: z.is_prime() # optional - sage.libs.pari + sage: z.is_prime() True sage: z = -7 - sage: z.is_prime() # optional - sage.libs.pari + sage: z.is_prime() False - sage: z.is_irreducible() # optional - sage.libs.pari + sage: z.is_irreducible() True :: sage: z = 10^80 + 129 - sage: z.is_prime(proof=False) # optional - sage.libs.pari + sage: z.is_prime(proof=False) # needs sage.libs.pari True - sage: z.is_prime(proof=True) # optional - sage.libs.pari + sage: z.is_prime(proof=True) # needs sage.libs.pari True When starting Sage the arithmetic proof flag is True. We can change @@ -5305,12 +5313,12 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): sage: proof.arithmetic() True sage: n = 10^100 + 267 - sage: timeit("n.is_prime()") # not tested # optional - sage.libs.pari + sage: timeit("n.is_prime()") # not tested # needs sage.libs.pari 5 loops, best of 3: 163 ms per loop sage: proof.arithmetic(False) sage: proof.arithmetic() False - sage: timeit("n.is_prime()") # not tested # optional - sage.libs.pari + sage: timeit("n.is_prime()") # not tested # needs sage.libs.pari 1000 loops, best of 3: 573 us per loop ALGORITHM: @@ -5327,7 +5335,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): ....: if tab[i]: ....: for j in range(2*i, size, i): ....: tab[j] = 0 - sage: all(ZZ(i).is_prime() == b for i,b in enumerate(tab)) # optional - sage.libs.pari + sage: all(ZZ(i).is_prime() == b for i,b in enumerate(tab)) # needs sage.libs.pari True """ if mpz_sgn(self.value) <= 0: @@ -5390,16 +5398,16 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: sage: z = 2^31 - 1 - sage: z.is_irreducible() # optional - sage.libs.pari + sage: z.is_irreducible() # needs sage.libs.pari True sage: z = 2^31 - sage: z.is_irreducible() # optional - sage.libs.pari + sage: z.is_irreducible() False sage: z = 7 - sage: z.is_irreducible() # optional - sage.libs.pari + sage: z.is_irreducible() True sage: z = -7 - sage: z.is_irreducible() # optional - sage.libs.pari + sage: z.is_irreducible() True """ cdef Integer n = self if self >= 0 else -self @@ -5419,10 +5427,10 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: sage: z = 2^31 - 1 - sage: z.is_pseudoprime() # optional - sage.libs.pari + sage: z.is_pseudoprime() # needs sage.libs.pari True sage: z = 2^31 - sage: z.is_pseudoprime() # optional - sage.libs.pari + sage: z.is_pseudoprime() # needs sage.libs.pari False """ return self.__pari__().ispseudoprime() @@ -5443,17 +5451,17 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: sage: x = 10^200 + 357 - sage: x.is_pseudoprime() # optional - sage.libs.pari + sage: x.is_pseudoprime() # needs sage.libs.pari True - sage: (x^12).is_pseudoprime_power() # optional - sage.libs.pari + sage: (x^12).is_pseudoprime_power() # needs sage.libs.pari True - sage: (x^12).is_pseudoprime_power(get_data=True) # optional - sage.libs.pari + sage: (x^12).is_pseudoprime_power(get_data=True) # needs sage.libs.pari (1000...000357, 12) - sage: (997^100).is_pseudoprime_power() # optional - sage.libs.pari + sage: (997^100).is_pseudoprime_power() # needs sage.libs.pari True - sage: (998^100).is_pseudoprime_power() # optional - sage.libs.pari + sage: (998^100).is_pseudoprime_power() # needs sage.libs.pari False - sage: ((10^1000 + 453)^2).is_pseudoprime_power() # optional - sage.libs.pari + sage: ((10^1000 + 453)^2).is_pseudoprime_power() # needs sage.libs.pari True TESTS:: @@ -5462,7 +5470,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): False sage: (-1).is_pseudoprime_power() False - sage: 1.is_pseudoprime_power() # optional - sage.libs.pari + sage: 1.is_pseudoprime_power() # needs sage.libs.pari False """ return self.is_prime_power(proof=False, get_data=get_data) @@ -5530,20 +5538,20 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: K = NumberField(x^2 - 2, 'beta') # optional - sage.rings.number_field + sage: K = NumberField(x^2 - 2, 'beta') # needs sage.rings.number_field sage: n = 4 - sage: n.is_norm(K) # optional - sage.rings.number_field + sage: n.is_norm(K) # needs sage.rings.number_field True - sage: 5.is_norm(K) # optional - sage.rings.number_field + sage: 5.is_norm(K) # needs sage.rings.number_field False sage: 7.is_norm(QQ) True - sage: n.is_norm(K, element=True) # optional - sage.rings.number_field + sage: n.is_norm(K, element=True) # needs sage.rings.number_field (True, -4*beta + 6) - sage: n.is_norm(K, element=True)[1].norm() # optional - sage.rings.number_field + sage: n.is_norm(K, element=True)[1].norm() # needs sage.rings.number_field 4 sage: n = 5 - sage: n.is_norm(K, element=True) # optional - sage.rings.number_field + sage: n.is_norm(K, element=True) # needs sage.rings.number_field (False, None) sage: n = 7 sage: n.is_norm(QQ, element=True) @@ -5559,9 +5567,9 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: 3._bnfisnorm(QuadraticField(-1, 'i')) # optional - sage.rings.number_field + sage: 3._bnfisnorm(QuadraticField(-1, 'i')) # needs sage.rings.number_field (1, 3) - sage: 7._bnfisnorm(CyclotomicField(7)) # optional - sage.rings.number_field + sage: 7._bnfisnorm(CyclotomicField(7)) # needs sage.rings.number_field (zeta7^5 - zeta7^2, 1) """ from sage.rings.rational_field import QQ @@ -5662,11 +5670,11 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: (-163).class_number() # optional - sage.libs.pari + sage: (-163).class_number() # needs sage.libs.pari 1 - sage: (-104).class_number() # optional - sage.libs.pari + sage: (-104).class_number() # needs sage.libs.pari 6 - sage: [((4*n + 1), (4*n + 1).class_number()) for n in [21..29]] # optional - sage.libs.pari + sage: [((4*n + 1), (4*n + 1).class_number()) for n in [21..29]] # needs sage.libs.pari [(85, 2), (89, 1), (93, 1), @@ -5748,8 +5756,8 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): 2 sage: a.squarefree_part(bound=2**14) 2 - sage: a = 7^3 * next_prime(2^100)^2 * next_prime(2^200) # optional - sage.libs.pari - sage: a / a.squarefree_part(bound=1000) # optional - sage.libs.pari + sage: a = 7^3 * next_prime(2^100)^2 * next_prime(2^200) # needs sage.libs.pari + sage: a / a.squarefree_part(bound=1000) # needs sage.libs.pari 49 """ cdef Integer z @@ -5796,17 +5804,18 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: (-37).next_probable_prime() # optional - sage.libs.pari + sage: # needs sage.libs.pari + sage: (-37).next_probable_prime() 2 - sage: (100).next_probable_prime() # optional - sage.libs.pari + sage: (100).next_probable_prime() 101 - sage: (2^512).next_probable_prime() # optional - sage.libs.pari + sage: (2^512).next_probable_prime() 13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084171 - sage: 0.next_probable_prime() # optional - sage.libs.pari + sage: 0.next_probable_prime() 2 - sage: 126.next_probable_prime() # optional - sage.libs.pari + sage: 126.next_probable_prime() 127 - sage: 144168.next_probable_prime() # optional - sage.libs.pari + sage: 144168.next_probable_prime() 144169 """ return Integer( self.__pari__().nextprime(True) ) @@ -5825,23 +5834,23 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: 100.next_prime() # optional - sage.libs.pari + sage: 100.next_prime() # needs sage.libs.pari 101 - sage: (10^50).next_prime() # optional - sage.libs.pari + sage: (10^50).next_prime() # needs sage.libs.pari 100000000000000000000000000000000000000000000000151 Use ``proof=False``, which is way faster since it does not need a primality proof:: - sage: b = (2^1024).next_prime(proof=False) # optional - sage.libs.pari - sage: b - 2^1024 # optional - sage.libs.pari + sage: b = (2^1024).next_prime(proof=False) # needs sage.libs.pari + sage: b - 2^1024 # needs sage.libs.pari 643 :: - sage: Integer(0).next_prime() # optional - sage.libs.pari + sage: Integer(0).next_prime() # needs sage.libs.pari 2 - sage: Integer(1001).next_prime() # optional - sage.libs.pari + sage: Integer(1001).next_prime() # needs sage.libs.pari 1009 """ # Use PARI to compute the next *pseudo*-prime @@ -5870,11 +5879,11 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: 10.previous_prime() # optional - sage.libs.pari + sage: 10.previous_prime() # needs sage.libs.pari 7 - sage: 7.previous_prime() # optional - sage.libs.pari + sage: 7.previous_prime() # needs sage.libs.pari 5 - sage: 14376485.previous_prime() # optional - sage.libs.pari + sage: 14376485.previous_prime() # needs sage.libs.pari 14376463 sage: 2.previous_prime() @@ -5885,8 +5894,8 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): An example using ``proof=False``, which is way faster since it does not need a primality proof:: - sage: b = (2^1024).previous_prime(proof=False) # optional - sage.libs.pari - sage: 2^1024 - b # optional - sage.libs.pari + sage: b = (2^1024).previous_prime(proof=False) # needs sage.libs.pari + sage: 2^1024 - b # needs sage.libs.pari 105 """ if mpz_cmp_ui(self.value, 2) <= 0: @@ -5926,23 +5935,23 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): sage: (-1).next_prime_power() 2 - sage: 2.next_prime_power() # optional - sage.libs.pari + sage: 2.next_prime_power() 3 - sage: 103.next_prime_power() # optional - sage.libs.pari + sage: 103.next_prime_power() # needs sage.libs.pari 107 - sage: 107.next_prime_power() # optional - sage.libs.pari + sage: 107.next_prime_power() 109 - sage: 2044.next_prime_power() # optional - sage.libs.pari + sage: 2044.next_prime_power() # needs sage.libs.pari 2048 TESTS:: - sage: [(2**k - 1).next_prime_power() for k in range(1,10)] # optional - sage.libs.pari + sage: [(2**k - 1).next_prime_power() for k in range(1,10)] [2, 4, 8, 16, 32, 64, 128, 256, 512] - sage: [(2**k).next_prime_power() for k in range(10)] # optional - sage.libs.pari + sage: [(2**k).next_prime_power() for k in range(10)] # needs sage.libs.pari [2, 3, 5, 9, 17, 37, 67, 131, 257, 521] - sage: for _ in range(10): # optional - sage.libs.pari + sage: for _ in range(10): # needs sage.libs.pari ....: n = ZZ.random_element(2**256).next_prime_power() ....: m = n.next_prime_power().previous_prime_power() ....: assert m == n, "problem with n = {}".format(n) @@ -5990,13 +5999,14 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: 3.previous_prime_power() # optional - sage.libs.pari + sage: # needs sage.libs.pari + sage: 3.previous_prime_power() 2 - sage: 103.previous_prime_power() # optional - sage.libs.pari + sage: 103.previous_prime_power() 101 - sage: 107.previous_prime_power() # optional - sage.libs.pari + sage: 107.previous_prime_power() 103 - sage: 2044.previous_prime_power() # optional - sage.libs.pari + sage: 2044.previous_prime_power() 2039 sage: 2.previous_prime_power() @@ -6006,12 +6016,12 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): TESTS:: - sage: [(2**k + 1).previous_prime_power() for k in range(1,10)] # optional - sage.libs.pari + sage: [(2**k + 1).previous_prime_power() for k in range(1,10)] [2, 4, 8, 16, 32, 64, 128, 256, 512] - sage: [(2**k).previous_prime_power() for k in range(2, 10)] # optional - sage.libs.pari + sage: [(2**k).previous_prime_power() for k in range(2, 10)] # needs sage.libs.pari [3, 7, 13, 31, 61, 127, 251, 509] - sage: for _ in range(10): # optional - sage.libs.pari + sage: for _ in range(10): # needs sage.libs.pari ....: n = ZZ.random_element(3,2**256).previous_prime_power() ....: m = n.previous_prime_power().next_prime_power() ....: assert m == n, "problem with n = {}".format(n) @@ -6080,11 +6090,11 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: 100.is_squarefree() # optional - sage.libs.pari + sage: 100.is_squarefree() # needs sage.libs.pari False - sage: 102.is_squarefree() # optional - sage.libs.pari + sage: 102.is_squarefree() # needs sage.libs.pari True - sage: 0.is_squarefree() # optional - sage.libs.pari + sage: 0.is_squarefree() # needs sage.libs.pari False """ return self.__pari__().issquarefree() @@ -6129,11 +6139,11 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: (-4).is_fundamental_discriminant() + sage: (-4).is_fundamental_discriminant() # needs sage.libs.pari True sage: (-12).is_fundamental_discriminant() False - sage: 101.is_fundamental_discriminant() + sage: 101.is_fundamental_discriminant() # needs sage.libs.pari True TESTS:: @@ -6142,7 +6152,8 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): False sage: 1.is_fundamental_discriminant() False - sage: len([D for D in srange(-100,100) if D.is_fundamental_discriminant()]) + sage: len([D for D in srange(-100,100) # needs sage.libs.pari + ....: if D.is_fundamental_discriminant()]) 61 """ @@ -6163,16 +6174,16 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: sage: n = 9390823 - sage: m = n.__pari__(); m # optional - sage.libs.pari + sage: m = n.__pari__(); m # needs sage.libs.pari 9390823 - sage: type(m) # optional - sage.libs.pari + sage: type(m) # needs sage.libs.pari TESTS:: sage: n = 10^10000000 - sage: m = n.__pari__() # crash from trac 875 # optional - sage.libs.pari - sage: m % 1234567 # optional - sage.libs.pari + sage: m = n.__pari__() # crash from trac 875 # needs sage.libs.pari + sage: m % 1234567 # needs sage.libs.pari 1041334 """ @@ -6202,19 +6213,19 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: import numpy # optional - numpy - sage: numpy.array([1, 2, 3]) # optional - numpy + sage: import numpy # needs numpy + sage: numpy.array([1, 2, 3]) # needs numpy array([1, 2, 3]) - sage: numpy.array([1, 2, 3]).dtype # optional - numpy + sage: numpy.array([1, 2, 3]).dtype # needs numpy dtype('int32') # 32-bit dtype('int64') # 64-bit - sage: numpy.array(2**40).dtype # optional - numpy + sage: numpy.array(2**40).dtype # needs numpy dtype('int64') - sage: numpy.array(2**400).dtype # optional - numpy + sage: numpy.array(2**400).dtype # needs numpy dtype('O') - sage: numpy.array([1,2,3,0.1]).dtype # optional - numpy + sage: numpy.array([1,2,3,0.1]).dtype # needs numpy dtype('float64') """ if mpz_fits_slong_p(self.value): @@ -6241,11 +6252,12 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): '117' Large integers use hex: - sage: m = 3^(2^20) # optional - magma - sage: s = m._magma_init_(magma) # optional - magma - sage: 'StringToInteger' in s # optional - magma + sage: # optional - magma + sage: m = 3^(2^20) + sage: s = m._magma_init_(magma) + sage: 'StringToInteger' in s True - sage: magma(m).sage() == m # optional - magma + sage: magma(m).sage() == m True """ if self.ndigits(2) > 10000: @@ -6377,19 +6389,19 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): 12 sage: sqrt(Integer(144)) 12 - sage: Integer(102).sqrt() # optional - sage.symbolic + sage: Integer(102).sqrt() # needs sage.symbolic sqrt(102) :: sage: n = 2 - sage: n.sqrt(all=True) # optional - sage.symbolic + sage: n.sqrt(all=True) # needs sage.symbolic [sqrt(2), -sqrt(2)] - sage: n.sqrt(prec=10) + sage: n.sqrt(prec=10) # needs sage.rings.real_mpfr 1.4 - sage: n.sqrt(prec=100) + sage: n.sqrt(prec=100) # needs sage.rings.real_mpfr 1.4142135623730950488016887242 - sage: n.sqrt(prec=100, all=True) + sage: n.sqrt(prec=100, all=True) # needs sage.rings.real_mpfr [1.4142135623730950488016887242, -1.4142135623730950488016887242] sage: n.sqrt(extend=False) Traceback (most recent call last): @@ -6406,13 +6418,13 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): TESTS:: - sage: type(5.sqrt()) # optional - sage.symbolic + sage: type(5.sqrt()) # needs sage.symbolic - sage: type(5.sqrt(prec=53)) + sage: type(5.sqrt(prec=53)) # needs sage.rings.real_mpfr - sage: type((-5).sqrt(prec=53)) + sage: type((-5).sqrt(prec=53)) # needs sage.rings.real_mpfr - sage: type(0.sqrt(prec=53)) + sage: type(0.sqrt(prec=53)) # needs sage.rings.real_mpfr Check that :trac:`9466` and :trac:`26509` are fixed:: @@ -7030,7 +7042,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): sage: 10.binomial(2) 45 - sage: 10.binomial(2, algorithm='pari') # optional - sage.libs.pari + sage: 10.binomial(2, algorithm='pari') # needs sage.libs.pari 45 sage: 10.binomial(-2) 0 @@ -7072,7 +7084,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): check for reliable interrupting, see :trac:`18919`:: sage: from cysignals import AlarmInterrupt - sage: for i in [1..10]: # long time (5s) # optional - sage.libs.pari + sage: for i in [1..10]: # long time (5s) # needs sage.libs.pari ....: try: ....: alarm(i/11) ....: (2^100).binomial(2^22, algorithm='pari') diff --git a/src/sage/rings/integer_ring.pyx b/src/sage/rings/integer_ring.pyx index 68933ce7fa5..15375a7b1df 100644 --- a/src/sage/rings/integer_ring.pyx +++ b/src/sage/rings/integer_ring.pyx @@ -245,7 +245,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain): 17 sage: Z(Mod(19,23)) 19 - sage: Z(2 + 3*5 + O(5^3)) # optional - sage.rings.padics + sage: Z(2 + 3*5 + O(5^3)) # needs sage.rings.padics 17 Arbitrary numeric bases are supported; strings or list of integers @@ -394,19 +394,19 @@ cdef class IntegerRing_class(PrincipalIdealDomain): EXAMPLES:: - sage: ZZ[sqrt(2), sqrt(3)] # optional - sage.rings.number_field sage.symbolic + sage: ZZ[sqrt(2), sqrt(3)] # needs sage.rings.number_field sage.symbolic Relative Order in Number Field in sqrt2 with defining polynomial x^2 - 2 over its base field sage: ZZ['x'] Univariate Polynomial Ring in x over Integer Ring sage: ZZ['x,y'] Multivariate Polynomial Ring in x, y over Integer Ring - sage: R = ZZ[sqrt(5) + 1]; R # optional - sage.rings.number_field sage.symbolic + sage: R = ZZ[sqrt(5) + 1]; R # needs sage.rings.number_field sage.symbolic Order in Number Field in a with defining polynomial x^2 - 2*x - 4 with a = 3.236067977499790? - sage: R.is_maximal() # optional - sage.rings.number_field sage.symbolic + sage: R.is_maximal() # needs sage.rings.number_field sage.symbolic False - sage: R = ZZ[(1 + sqrt(5))/2]; R # optional - sage.rings.number_field sage.symbolic + sage: R = ZZ[(1 + sqrt(5))/2]; R # needs sage.rings.number_field sage.symbolic Order in Number Field in a with defining polynomial x^2 - x - 1 with a = 1.618033988749895? - sage: R.is_maximal() # optional - sage.rings.number_field sage.symbolic + sage: R.is_maximal() # needs sage.rings.number_field sage.symbolic True """ if x in self: @@ -531,7 +531,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain): sage: ZZ.coerce(int(5)) # indirect doctest 5 - sage: ZZ.coerce(GF(7)(2)) # optional - sage.rings.finite_rings + sage: ZZ.coerce(GF(7)(2)) Traceback (most recent call last): ... TypeError: no canonical coercion from Finite Field of size 7 to Integer Ring @@ -553,14 +553,15 @@ cdef class IntegerRing_class(PrincipalIdealDomain): Coercions are available from numpy integer types:: - sage: import numpy # optional - numpy - sage: ZZ.coerce(numpy.int8('1')) # optional - numpy + sage: # needs numpy + sage: import numpy + sage: ZZ.coerce(numpy.int8('1')) 1 - sage: ZZ.coerce(numpy.int32('32')) # optional - numpy + sage: ZZ.coerce(numpy.int32('32')) 32 - sage: ZZ.coerce(numpy.int64('-12')) # optional - numpy + sage: ZZ.coerce(numpy.int64('-12')) -12 - sage: ZZ.coerce(numpy.uint64('11')) # optional - numpy + sage: ZZ.coerce(numpy.uint64('11')) 11 TESTS:: @@ -719,7 +720,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain): We return a sample from a discrete Gaussian distribution:: - sage: ZZ.random_element(11.0, distribution="gaussian").parent() is ZZ # optional - sage.modules + sage: ZZ.random_element(11.0, distribution="gaussian").parent() is ZZ # needs sage.modules True TESTS: @@ -728,7 +729,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain): sage: ZZ.random_element(5, -5, distribution="1/n").parent() is ZZ True - sage: ZZ.random_element(5, -5, distribution="gaussian").parent() is ZZ # optional - sage.modules + sage: ZZ.random_element(5, -5, distribution="gaussian").parent() is ZZ # needs sage.modules True sage: ZZ.random_element(5, -5, distribution="mpz_rrandomb").parent() is ZZ True @@ -737,7 +738,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain): Traceback (most recent call last): ... TypeError: x must be > 0 - sage: ZZ.random_element(-10, -5, distribution="gaussian") # optional - sage.modules + sage: ZZ.random_element(-10, -5, distribution="gaussian") Traceback (most recent call last): ... TypeError: x must be > 0 @@ -924,9 +925,9 @@ cdef class IntegerRing_class(PrincipalIdealDomain): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: ZZ.extension(x^2 - 5, 'a') # optional - sage.rings.number_field + sage: ZZ.extension(x^2 - 5, 'a') # needs sage.rings.number_field Order in Number Field in a with defining polynomial x^2 - 5 - sage: ZZ.extension([x^2 + 1, x^2 + 2], 'a,b') # optional - sage.rings.number_field + sage: ZZ.extension([x^2 + 1, x^2 + 2], 'a,b') # needs sage.rings.number_field Relative Order in Number Field in a with defining polynomial x^2 + 1 over its base field """ @@ -980,40 +981,41 @@ cdef class IntegerRing_class(PrincipalIdealDomain): EXAMPLES:: - sage: F = ZZ.residue_field(61); F # optional - sage.libs.pari + sage: # needs sage.libs.pari + sage: F = ZZ.residue_field(61); F Residue field of Integers modulo 61 - sage: pi = F.reduction_map(); pi # optional - sage.libs.pari + sage: pi = F.reduction_map(); pi Partially defined reduction map: From: Rational Field To: Residue field of Integers modulo 61 - sage: pi(123/234) # optional - sage.libs.pari + sage: pi(123/234) 6 - sage: pi(1/61) # optional - sage.libs.pari + sage: pi(1/61) Traceback (most recent call last): ... ZeroDivisionError: Cannot reduce rational 1/61 modulo 61: it has negative valuation - sage: lift = F.lift_map(); lift # optional - sage.libs.pari + sage: lift = F.lift_map(); lift Lifting map: From: Residue field of Integers modulo 61 To: Integer Ring - sage: lift(F(12345/67890)) # optional - sage.libs.pari + sage: lift(F(12345/67890)) 33 - sage: (12345/67890) % 61 # optional - sage.libs.pari + sage: (12345/67890) % 61 33 Construction can be from a prime ideal instead of a prime:: - sage: ZZ.residue_field(ZZ.ideal(97)) # optional - sage.libs.pari + sage: ZZ.residue_field(ZZ.ideal(97)) # needs sage.libs.pari Residue field of Integers modulo 97 TESTS:: - sage: ZZ.residue_field(ZZ.ideal(96)) # optional - sage.libs.pari + sage: ZZ.residue_field(ZZ.ideal(96)) Traceback (most recent call last): ... TypeError: Principal ideal (96) of Integer Ring is not prime - sage: ZZ.residue_field(96) # optional - sage.libs.pari + sage: ZZ.residue_field(96) Traceback (most recent call last): ... TypeError: 96 is not prime @@ -1164,7 +1166,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain): sage: ZZ.completion(infinity, 53) Integer Ring - sage: ZZ.completion(5, 15, {'print_mode': 'bars'}) # optional - sage.rings.padics + sage: ZZ.completion(5, 15, {'print_mode': 'bars'}) # needs sage.rings.padics 5-adic Ring with capped relative precision 15 """ if p == sage.rings.infinity.Infinity: @@ -1279,41 +1281,41 @@ cdef class IntegerRing_class(PrincipalIdealDomain): sage: R. = PolynomialRing(ZZ, sparse=True) sage: p = (x + 1)^23 * (x - 1)^23 * (x - 100) * (x + 5445)^5 - sage: ZZ._roots_univariate_polynomial(p) # optional - sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p) # needs sage.libs.pari [(100, 1), (-5445, 5), (1, 23), (-1, 23)] sage: p *= (1 + x^3458645 - 76*x^3435423343 + x^45346567867756556) - sage: ZZ._roots_univariate_polynomial(p) # optional - sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p) # needs sage.libs.pari [(1, 23), (-1, 23), (100, 1), (-5445, 5)] sage: p *= x^156468451540687043504386074354036574634735074 - sage: ZZ._roots_univariate_polynomial(p) # optional - sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p) # needs sage.libs.pari [(0, 156468451540687043504386074354036574634735074), (1, 23), (-1, 23), (100, 1), (-5445, 5)] - sage: ZZ._roots_univariate_polynomial(p, multiplicities=False) # optional - sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p, multiplicities=False) # needs sage.libs.pari [0, 1, -1, 100, -5445] sage: R. = PolynomialRing(ZZ, sparse=False) sage: p = (x + 1)^23 * (x - 1)^23 * (x - 100) * (x + 5445)^5 - sage: ZZ._roots_univariate_polynomial(p) # optional - sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p) # needs sage.libs.pari [(100, 1), (-5445, 5), (1, 23), (-1, 23)] - sage: ZZ._roots_univariate_polynomial(p, multiplicities=False) # optional - sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p, multiplicities=False) # needs sage.libs.pari [100, -5445, 1, -1] - sage: ZZ._roots_univariate_polynomial(p, algorithm="sparse") # optional - sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p, algorithm="sparse") # needs sage.libs.pari [(100, 1), (-5445, 5), (1, 23), (-1, 23)] - sage: ZZ._roots_univariate_polynomial(p, algorithm="dense") # optional - sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p, algorithm="dense") # needs sage.libs.pari [(100, 1), (-5445, 5), (1, 23), (-1, 23)] - sage: ZZ._roots_univariate_polynomial(p, algorithm="foobar") # optional - sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p, algorithm="foobar") Traceback (most recent call last): ... ValueError: unknown algorithm 'foobar' sage: p = x^20 * p - sage: ZZ._roots_univariate_polynomial(p, algorithm="sparse") # optional - sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p, algorithm="sparse") # needs sage.libs.pari [(0, 20), (100, 1), (-5445, 5), (1, 23), (-1, 23)] - sage: ZZ._roots_univariate_polynomial(p, algorithm="dense") # optional - sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p, algorithm="dense") # needs sage.libs.pari [(100, 1), (-5445, 5), (0, 20), (1, 23), (-1, 23)] """ deg = p.degree() @@ -1466,7 +1468,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain): EXAMPLES:: - sage: gap(ZZ) # indirect doctest # optional - sage.libs.gap + sage: gap(ZZ) # indirect doctest # needs sage.libs.gap Integers """ return 'Integers' @@ -1522,7 +1524,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain): EXAMPLES:: - sage: ZZ._sympy_() # optional - sympy + sage: ZZ._sympy_() # needs sympy Integers """ from sympy import Integers @@ -1552,9 +1554,9 @@ cdef class IntegerRing_class(PrincipalIdealDomain): EXAMPLES:: - sage: v = ZZ.valuation(3); v # optional - sage.rings.padics + sage: v = ZZ.valuation(3); v # needs sage.rings.padics 3-adic valuation - sage: v(3) # optional - sage.rings.padics + sage: v(3) # needs sage.rings.padics 1 .. SEEALSO:: diff --git a/src/sage/rings/laurent_series_ring.py b/src/sage/rings/laurent_series_ring.py index b8d7ec38f40..a5fc28597eb 100644 --- a/src/sage/rings/laurent_series_ring.py +++ b/src/sage/rings/laurent_series_ring.py @@ -6,11 +6,11 @@ sage: R = LaurentSeriesRing(QQ, "x") sage: R.base_ring() Rational Field - sage: S = LaurentSeriesRing(GF(17)['x'], 'y') # optional - sage.rings.finite_rings - sage: S # optional - sage.rings.finite_rings + sage: S = LaurentSeriesRing(GF(17)['x'], 'y') + sage: S Laurent Series Ring in y over Univariate Polynomial Ring in x over Finite Field of size 17 - sage: S.base_ring() # optional - sage.rings.finite_rings + sage: S.base_ring() Univariate Polynomial Ring in x over Finite Field of size 17 .. SEEALSO:: @@ -89,7 +89,7 @@ class LaurentSeriesRing(UniqueRepresentation, CommutativeRing): sage: Frac(QQ[['x']]) Laurent Series Ring in x over Rational Field - sage: Frac(GF(5)['y']) # optional - sage.rings.finite_rings + sage: Frac(GF(5)['y']) Fraction Field of Univariate Polynomial Ring in y over Finite Field of size 5 When the base ring is a domain, the fraction field is the @@ -101,22 +101,23 @@ class LaurentSeriesRing(UniqueRepresentation, CommutativeRing): Laurent series rings are determined by their variable and the base ring, and are globally unique:: - sage: K = Qp(5, prec=5) # optional - sage.rings.padics - sage: L = Qp(5, prec=200) # optional - sage.rings.padics - sage: R. = LaurentSeriesRing(K) # optional - sage.rings.padics - sage: S. = LaurentSeriesRing(L) # optional - sage.rings.padics - sage: R is S # optional - sage.rings.padics + sage: # needs sage.rings.padics + sage: K = Qp(5, prec=5) + sage: L = Qp(5, prec=200) + sage: R. = LaurentSeriesRing(K) + sage: S. = LaurentSeriesRing(L) + sage: R is S False - sage: T. = LaurentSeriesRing(Qp(5, prec=200)) # optional - sage.rings.padics - sage: S is T # optional - sage.rings.padics + sage: T. = LaurentSeriesRing(Qp(5, prec=200)) + sage: S is T True - sage: W. = LaurentSeriesRing(Qp(5, prec=199)) # optional - sage.rings.padics - sage: W is T # optional - sage.rings.padics + sage: W. = LaurentSeriesRing(Qp(5, prec=199)) + sage: W is T False - sage: K = LaurentSeriesRing(CC, 'q'); K # optional - sage.rings.real_mpfr + sage: K = LaurentSeriesRing(CC, 'q'); K # needs sage.rings.real_mpfr Laurent Series Ring in q over Complex Field with 53 bits of precision - sage: loads(K.dumps()) == K # optional - sage.rings.real_mpfr + sage: loads(K.dumps()) == K # needs sage.rings.real_mpfr True sage: P = QQ[['x']] sage: F = Frac(P) @@ -126,10 +127,10 @@ class LaurentSeriesRing(UniqueRepresentation, CommutativeRing): a field equipped with a discrete valuation for which it is complete. The appropriate (sub)category is automatically set in this case:: - sage: k = GF(11) # optional - sage.rings.finite_rings - sage: R. = k[[]] # optional - sage.rings.finite_rings - sage: F = Frac(R) # optional - sage.rings.finite_rings - sage: F.category() # optional - sage.rings.finite_rings + sage: k = GF(11) + sage: R. = k[[]] + sage: F = Frac(R) + sage: F.category() Join of Category of complete discrete valuation fields and Category of commutative algebras over (finite enumerated fields and @@ -404,35 +405,37 @@ def _element_constructor_(self, x, n=0, prec=infinity): EXAMPLES:: - sage: R. = LaurentSeriesRing(Qp(5, 10)) # optional - sage.rings.padics - sage: S. = LaurentSeriesRing(RationalField()) # optional - sage.rings.padics - sage: R(t + t^2 + O(t^3)) # optional - sage.rings.padics + sage: # needs sage.rings.padics + sage: R. = LaurentSeriesRing(Qp(5, 10)) + sage: S. = LaurentSeriesRing(RationalField()) + sage: R(t + t^2 + O(t^3)) (1 + O(5^10))*u + (1 + O(5^10))*u^2 + O(u^3) - sage: R(t + t^2 + O(t^3), prec=2) # optional - sage.rings.padics + sage: R(t + t^2 + O(t^3), prec=2) (1 + O(5^10))*u + O(u^2) Coercing an element into its own parent produces that element again, unless a different ``n`` or ``prec`` is given:: - sage: u is R(u) # optional - sage.rings.padics + sage: u is R(u) # needs sage.rings.padics True - sage: R(u, n=3, prec=7) # optional - sage.rings.padics + sage: R(u, n=3, prec=7) # needs sage.rings.padics (1 + O(5^10))*u^4 + O(u^7) Rational functions are accepted:: - sage: I = sqrt(-1) # optional - sage.rings.number_field sage.symbolic - sage: K. = QQ[I] # optional - sage.rings.number_field sage.symbolic - sage: P. = PolynomialRing(K) # optional - sage.rings.number_field sage.symbolic - sage: L. = LaurentSeriesRing(QQ[I]) # optional - sage.rings.number_field sage.symbolic - sage: L((t*I)/(t^3+I*2*t)) # optional - sage.rings.number_field sage.symbolic + sage: # needs sage.rings.number_field sage.symbolic + sage: I = sqrt(-1) + sage: K. = QQ[I] + sage: P. = PolynomialRing(K) + sage: L. = LaurentSeriesRing(QQ[I]) + sage: L((t*I)/(t^3+I*2*t)) 1/2 + 1/4*I*u^2 - 1/8*u^4 - 1/16*I*u^6 + 1/32*u^8 + 1/64*I*u^10 - 1/128*u^12 - 1/256*I*u^14 + 1/512*u^16 + 1/1024*I*u^18 + O(u^20) :: - sage: L(t*I) / L(t^3+I*2*t) # optional - sage.rings.number_field + sage: L(t*I) / L(t^3+I*2*t) # needs sage.rings.number_field sage.symbolic 1/2 + 1/4*I*u^2 - 1/8*u^4 - 1/16*I*u^6 + 1/32*u^8 + 1/64*I*u^10 - 1/128*u^12 - 1/256*I*u^14 + 1/512*u^16 + 1/1024*I*u^18 + O(u^20) @@ -441,9 +444,9 @@ def _element_constructor_(self, x, n=0, prec=infinity): Check that :trac:`28993` is fixed:: - sage: from sage.modular.etaproducts import qexp_eta # optional - sage.modular + sage: from sage.modular.etaproducts import qexp_eta # needs sage.modular sage: S. = LaurentSeriesRing(RationalField()) - sage: qexp_eta(S, prec=30) # optional - sage.modular + sage: qexp_eta(S, prec=30) # needs sage.modular 1 - t - t^2 + t^5 + t^7 - t^12 - t^15 + t^22 + t^26 + O(t^30) When converting from `R((z))` to `R((z))((w))`, the variable @@ -459,23 +462,23 @@ def _element_constructor_(self, x, n=0, prec=infinity): Various conversions from PARI (see also :trac:`2508`):: sage: L. = LaurentSeriesRing(QQ, default_prec=10) - sage: L(pari('1/x')) # optional - sage.libs.pari + sage: L(pari('1/x')) # needs sage.libs.pari q^-1 - sage: L(pari('polchebyshev(5)')) # optional - sage.libs.pari + sage: L(pari('polchebyshev(5)')) # needs sage.libs.pari 5*q - 20*q^3 + 16*q^5 - sage: L(pari('polchebyshev(5) - 1/x^4')) # optional - sage.libs.pari + sage: L(pari('polchebyshev(5) - 1/x^4')) # needs sage.libs.pari -q^-4 + 5*q - 20*q^3 + 16*q^5 - sage: L(pari('1/polchebyshev(5)')) # optional - sage.libs.pari + sage: L(pari('1/polchebyshev(5)')) # needs sage.libs.pari 1/5*q^-1 + 4/5*q + 64/25*q^3 + 192/25*q^5 + 2816/125*q^7 + O(q^9) - sage: L(pari('polchebyshev(5) + O(x^40)')) # optional - sage.libs.pari + sage: L(pari('polchebyshev(5) + O(x^40)')) # needs sage.libs.pari 5*q - 20*q^3 + 16*q^5 + O(q^40) - sage: L(pari('polchebyshev(5) - 1/x^4 + O(x^40)')) # optional - sage.libs.pari + sage: L(pari('polchebyshev(5) - 1/x^4 + O(x^40)')) # needs sage.libs.pari -q^-4 + 5*q - 20*q^3 + 16*q^5 + O(q^40) - sage: L(pari('1/polchebyshev(5) + O(x^10)')) # optional - sage.libs.pari + sage: L(pari('1/polchebyshev(5) + O(x^10)')) # needs sage.libs.pari 1/5*q^-1 + 4/5*q + 64/25*q^3 + 192/25*q^5 + 2816/125*q^7 + 8192/125*q^9 + O(q^10) - sage: L(pari('1/polchebyshev(5) + O(x^10)'), -10) # Multiply by q^-10 # optional - sage.libs.pari + sage: L(pari('1/polchebyshev(5) + O(x^10)'), -10) # Multiply by q^-10 # needs sage.libs.pari 1/5*q^-11 + 4/5*q^-9 + 64/25*q^-7 + 192/25*q^-5 + 2816/125*q^-3 + 8192/125*q^-1 + O(1) - sage: L(pari('O(x^-10)')) # optional - sage.libs.pari + sage: L(pari('O(x^-10)')) # needs sage.libs.pari O(q^-10) Check that :trac:`30073` is fixed:: @@ -540,8 +543,8 @@ def random_element(self, algorithm='default'): EXAMPLES:: - sage: S. = LaurentSeriesRing(GF(3)) # optional - sage.rings.finite_rings - sage: S.random_element() # random # optional - sage.rings.finite_rings + sage: S. = LaurentSeriesRing(GF(3)) + sage: S.random_element() # random s^-8 + s^-7 + s^-6 + s^-5 + s^-1 + s + s^3 + s^4 + s^5 + 2*s^6 + s^7 + s^11 + O(s^12) """ @@ -577,9 +580,9 @@ def construction(self): sage: parent(1/2 * t) Laurent Series Ring in t over Rational Field - sage: QQbar.gen() * t # optional - sage.rings.number_field + sage: QQbar.gen() * t # needs sage.rings.number_field I*t - sage: parent(QQbar.gen() * t) # optional - sage.rings.number_field + sage: parent(QQbar.gen() * t) # needs sage.rings.number_field Laurent Series Ring in t over Algebraic Field """ from sage.categories.pushout import CompletionFunctor @@ -655,15 +658,16 @@ def _is_valid_homomorphism_(self, codomain, im_gens, base_map=None): """ EXAMPLES:: - sage: R. = LaurentSeriesRing(GF(17)) # optional - sage.rings.finite_rings - sage: S. = LaurentSeriesRing(GF(19)) # optional - sage.rings.finite_rings - sage: R.hom([y], S) # indirect doctest # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = LaurentSeriesRing(GF(17)) + sage: S. = LaurentSeriesRing(GF(19)) + sage: R.hom([y], S) # indirect doctest Traceback (most recent call last): ... ValueError: relations do not all (canonically) map to 0 under map determined by images of generators - sage: f = R.hom(x + x^3, R) # optional - sage.rings.finite_rings - sage: f(x^2) # optional - sage.rings.finite_rings + sage: f = R.hom(x + x^3, R) + sage: f(x^2) x^2 + 2*x^4 + x^6 The image of the generator needs to be a unit:: @@ -690,8 +694,8 @@ def characteristic(self): """ EXAMPLES:: - sage: R. = LaurentSeriesRing(GF(17)) # optional - sage.rings.finite_rings - sage: R.characteristic() # optional - sage.rings.finite_rings + sage: R. = LaurentSeriesRing(GF(17)) + sage: R.characteristic() 17 """ return self.base_ring().characteristic() @@ -705,8 +709,8 @@ def residue_field(self): EXAMPLES:: - sage: R. = LaurentSeriesRing(GF(17)) # optional - sage.rings.finite_rings - sage: R.residue_field() # optional - sage.rings.finite_rings + sage: R. = LaurentSeriesRing(GF(17)) + sage: R.residue_field() Finite Field of size 17 sage: R. = LaurentSeriesRing(ZZ) diff --git a/src/sage/rings/laurent_series_ring_element.pyx b/src/sage/rings/laurent_series_ring_element.pyx index 63cac5bce7a..9b8ad96eb09 100644 --- a/src/sage/rings/laurent_series_ring_element.pyx +++ b/src/sage/rings/laurent_series_ring_element.pyx @@ -3,16 +3,16 @@ Laurent Series EXAMPLES:: - sage: R. = LaurentSeriesRing(GF(7), 't'); R # optional - sage.rings.finite_rings + sage: R. = LaurentSeriesRing(GF(7), 't'); R Laurent Series Ring in t over Finite Field of size 7 - sage: f = 1/(1-t+O(t^10)); f # optional - sage.rings.finite_rings + sage: f = 1/(1-t+O(t^10)); f 1 + t + t^2 + t^3 + t^4 + t^5 + t^6 + t^7 + t^8 + t^9 + O(t^10) Laurent series are immutable:: - sage: f[2] # optional - sage.rings.finite_rings + sage: f[2] 1 - sage: f[2] = 5 # optional - sage.rings.finite_rings + sage: f[2] = 5 Traceback (most recent call last): ... IndexError: Laurent series are immutable @@ -21,18 +21,18 @@ We compute with a Laurent series over the complex mpfr numbers. :: - sage: K. = Frac(CC[['q']]); K # optional - sage.rings.real_mpfr + sage: K. = Frac(CC[['q']]); K # needs sage.rings.real_mpfr Laurent Series Ring in q over Complex Field with 53 bits of precision - sage: q # optional - sage.rings.real_mpfr + sage: q # needs sage.rings.real_mpfr 1.00000000000000*q Saving and loading. :: - sage: loads(q.dumps()) == q # optional - sage.rings.real_mpfr + sage: loads(q.dumps()) == q # needs sage.rings.real_mpfr True - sage: loads(K.dumps()) == K # optional - sage.rings.real_mpfr + sage: loads(K.dumps()) == K # needs sage.rings.real_mpfr True IMPLEMENTATION: Laurent series in Sage are represented internally @@ -113,13 +113,14 @@ cdef class LaurentSeries(AlgebraElement): :: - sage: S. = LaurentSeriesRing(GF(5)) # optional - sage.rings.finite_rings sage.rings.padics - sage: T. = PowerSeriesRing(pAdicRing(5)) # optional - sage.rings.finite_rings sage.rings.padics - sage: S(t) # optional - sage.rings.finite_rings sage.rings.padics + sage: # needs sage.rings.finite_rings sage.rings.padics + sage: S. = LaurentSeriesRing(GF(5)) + sage: T. = PowerSeriesRing(pAdicRing(5)) + sage: S(t) s - sage: parent(S(t)) # optional - sage.rings.finite_rings sage.rings.padics + sage: parent(S(t)) Laurent Series Ring in s over Finite Field of size 5 - sage: parent(S(t)[1]) # optional - sage.rings.finite_rings sage.rings.padics + sage: parent(S(t)[1]) Finite Field of size 5 """ AlgebraElement.__init__(self, parent) @@ -181,7 +182,7 @@ cdef class LaurentSeries(AlgebraElement): sage: R. = LaurentSeriesRing(ZZ) sage: p = R([1,2,3]); p 1 + 2*q + 3*q^2 - sage: p.change_ring(GF(2)) # optional - sage.rings.finite_rings + sage: p.change_ring(GF(2)) 1 + q^2 """ return self._parent.change_ring(R)(self) @@ -284,16 +285,16 @@ cdef class LaurentSeries(AlgebraElement): EXAMPLES:: sage: Zx. = ZZ[] - sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field - sage: R. = LaurentSeriesRing(K) # optional - sage.rings.number_field - sage: z = t^-1 + i*t # optional - sage.rings.number_field - sage: z._im_gens_(R, [t^2]) # optional - sage.rings.number_field + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: R. = LaurentSeriesRing(K) # needs sage.rings.number_field + sage: z = t^-1 + i*t # needs sage.rings.number_field + sage: z._im_gens_(R, [t^2]) # needs sage.rings.number_field t^-2 + i*t^2 The argument base_map is not yet supported, because it isn't over power series:: - sage: cc = K.hom([i]) # optional - sage.rings.number_field - sage: z._im_gens_(R, [t^2], base_map=cc) # optional - sage.rings.number_field + sage: cc = K.hom([i]) # needs sage.rings.number_field + sage: z._im_gens_(R, [t^2], base_map=cc) # needs sage.rings.number_field Traceback (most recent call last): ... NotImplementedError @@ -667,11 +668,12 @@ cdef class LaurentSeries(AlgebraElement): EXAMPLES:: - sage: A. = LaurentSeriesRing(GF(5)) # optional - sage.rings.finite_rings - sage: x = t^(-1) + t^2 + O(t^5) # optional - sage.rings.finite_rings - sage: x.lift_to_precision(10) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: A. = LaurentSeriesRing(GF(5)) + sage: x = t^(-1) + t^2 + O(t^5) + sage: x.lift_to_precision(10) t^-1 + t^2 + O(t^10) - sage: x.lift_to_precision() # optional - sage.rings.finite_rings + sage: x.lift_to_precision() t^-1 + t^2 """ if absprec is not None and absprec <= self.precision_absolute(): @@ -1597,8 +1599,8 @@ cdef class LaurentSeries(AlgebraElement): TESTS:: - sage: y = var('y') # optional - sage.symbolic - sage: f.derivative(y) # optional - sage.symbolic + sage: y = var('y') # needs sage.symbolic + sage: f.derivative(y) # needs sage.symbolic Traceback (most recent call last): ... ValueError: cannot differentiate with respect to y @@ -1700,11 +1702,12 @@ cdef class LaurentSeries(AlgebraElement): sage: (x^-2 + 1 + x).nth_root(2)**2 x^-2 + 1 + x + O(x^18) - sage: j = j_invariant_qexp() # optional - sage.modular - sage: q = j.parent().gen() # optional - sage.modular - sage: j(q^3).nth_root(3) # optional - sage.modular + sage: # needs sage.modular + sage: j = j_invariant_qexp() + sage: q = j.parent().gen() + sage: j(q^3).nth_root(3) q^-1 + 248*q^2 + 4124*q^5 + ... + O(q^29) - sage: (j(q^2) - 1728).nth_root(2) # optional - sage.modular + sage: (j(q^2) - 1728).nth_root(2) q^-1 - 492*q - 22590*q^3 - ... + O(q^19) """ if prec is None: @@ -1751,10 +1754,11 @@ cdef class LaurentSeries(AlgebraElement): Check whether a polynomial over a Laurent series ring is contained in the polynomial ring over the power series ring (see :trac:`19459`): - sage: L. = LaurentSeriesRing(GF(2)) # optional - sage.rings.finite_rings - sage: R. = PolynomialRing(L) # optional - sage.rings.finite_rings - sage: S. = PolynomialRing(L._power_series_ring) # optional - sage.rings.finite_rings - sage: t**(-1)*x*y in S # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: L. = LaurentSeriesRing(GF(2)) + sage: R. = PolynomialRing(L) + sage: S. = PolynomialRing(L._power_series_ring) + sage: t**(-1)*x*y in S False There used to be an issue with non-canonical representations of zero, @@ -1774,8 +1778,8 @@ cdef class LaurentSeries(AlgebraElement): Test for :trac:`32440`:: - sage: L. = LaurentSeriesRing(QQ, implementation='pari') # optional - sage.libs.pari - sage: (x + O(x^3)).power_series() # optional - sage.libs.pari + sage: L. = LaurentSeriesRing(QQ, implementation='pari') # needs sage.libs.pari + sage: (x + O(x^3)).power_series() # needs sage.libs.pari x + O(x^3) """ if self.__n < 0: @@ -1836,9 +1840,9 @@ cdef class LaurentSeries(AlgebraElement): Test for :trac:`23928`:: - sage: R. = LaurentSeriesRing(QQ, implementation='pari') # optional - sage.libs.pari - sage: f = x.add_bigoh(7) # optional - sage.libs.pari - sage: f(x) # optional - sage.libs.pari + sage: R. = LaurentSeriesRing(QQ, implementation='pari') # needs sage.libs.pari + sage: f = x.add_bigoh(7) # needs sage.libs.pari + sage: f(x) # needs sage.libs.pari x + O(x^7) """ if len(kwds) >= 1: @@ -1878,16 +1882,17 @@ cdef class LaurentSeries(AlgebraElement): sage: L. = LaurentSeriesRing(QQ) sage: f = x + 1/x + O(x^2); f x^-1 + x + O(x^2) - sage: f.__pari__() # optional - sage.libs.pari + sage: f.__pari__() # needs sage.libs.pari x^-1 + x + O(x^2) Check that :trac:`32437` is fixed:: - sage: F. = GF(257^2) # optional - sage.rings.finite_rings - sage: R. = LaurentSeriesRing(F) # optional - sage.rings.finite_rings - sage: g = t + O(t^99) # optional - sage.rings.finite_rings - sage: f = u*t + O(t^99) # optional - sage.rings.finite_rings - sage: g(f) # indirect doctest # optional - sage.libs.pari sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = GF(257^2) + sage: R. = LaurentSeriesRing(F) + sage: g = t + O(t^99) + sage: f = u*t + O(t^99) + sage: g(f) # indirect doctest # needs sage.libs.pari u*t + O(t^99) """ f = self.__u diff --git a/src/sage/rings/lazy_series.py b/src/sage/rings/lazy_series.py index cf9c4f9cb20..78fbbf67afc 100644 --- a/src/sage/rings/lazy_series.py +++ b/src/sage/rings/lazy_series.py @@ -83,9 +83,9 @@ A similar statement is true for lazy symmetric functions:: - sage: h = SymmetricFunctions(QQ).h() # optional - sage.combinat - sage: L = LazySymmetricFunctions(h) # optional - sage.combinat - sage: 1 / (1-L(h[1])) # optional - sage.combinat + sage: h = SymmetricFunctions(QQ).h() # needs sage.combinat + sage: L = LazySymmetricFunctions(h) # needs sage.combinat + sage: 1 / (1-L(h[1])) # needs sage.combinat h[] + h[1] + (h[1,1]) + (h[1,1,1]) + (h[1,1,1,1]) + (h[1,1,1,1,1]) + (h[1,1,1,1,1,1]) + O^7 We can change the base ring:: @@ -145,9 +145,9 @@ sage: check(L, z) sage: L. = LazyPowerSeriesRing(QQ) sage: check(L, z) - sage: p = SymmetricFunctions(QQ).p() # optional - sage.combinat - sage: L = LazySymmetricFunctions(p) # optional - sage.combinat - sage: check(L, L(p[1])) # optional - sage.combinat + sage: p = SymmetricFunctions(QQ).p() # needs sage.combinat + sage: L = LazySymmetricFunctions(p) # needs sage.combinat + sage: check(L, L(p[1])) # needs sage.combinat We check that the elements in the cache of the stream of homogeneous components are in the correct ring:: @@ -171,30 +171,30 @@ ....: yield n ....: n += 1 - sage: L. = LazyLaurentSeriesRing(GF(2)) # optional - sage.rings.finite_rings - sage: check(L, lambda n: n, valuation=-5) # optional - sage.rings.finite_rings - sage: check(L, gen(), valuation=-5) # optional - sage.rings.finite_rings + sage: L. = LazyLaurentSeriesRing(GF(2)) # needs sage.rings.finite_rings + sage: check(L, lambda n: n, valuation=-5) # needs sage.rings.finite_rings + sage: check(L, gen(), valuation=-5) # needs sage.rings.finite_rings - sage: L = LazyDirichletSeriesRing(QQbar, "s") # optional - sage.rings.number_field - sage: check(L, lambda n: n, valuation=2) # optional - sage.rings.number_field - sage: check(L, gen(), valuation=2) # optional - sage.rings.number_field + sage: L = LazyDirichletSeriesRing(QQbar, "s") # needs sage.rings.number_field + sage: check(L, lambda n: n, valuation=2) # needs sage.rings.number_field + sage: check(L, gen(), valuation=2) # needs sage.rings.number_field - sage: L. = LazyPowerSeriesRing(GF(2)) # optional - sage.rings.finite_rings - sage: check(L, lambda n: n, valuation=0) # optional - sage.rings.finite_rings - sage: check(L, gen(), valuation=0) # optional - sage.rings.finite_rings + sage: L. = LazyPowerSeriesRing(GF(2)) # needs sage.rings.finite_rings + sage: check(L, lambda n: n, valuation=0) # needs sage.rings.finite_rings + sage: check(L, gen(), valuation=0) # needs sage.rings.finite_rings - sage: L. = LazyPowerSeriesRing(GF(2)) # optional - sage.rings.finite_rings - sage: check(L, lambda n: (x + y)^n, valuation=None) # optional - sage.rings.finite_rings - sage: def gen(): # optional - sage.rings.finite_rings + sage: L. = LazyPowerSeriesRing(GF(2)) # needs sage.rings.finite_rings + sage: check(L, lambda n: (x + y)^n, valuation=None) # needs sage.rings.finite_rings + sage: def gen(): # needs sage.rings.finite_rings ....: n = 0 ....: while True: ....: yield (x+y)^n ....: n += 1 - sage: check(L, gen(), valuation=None) # optional - sage.rings.finite_rings + sage: check(L, gen(), valuation=None) # needs sage.rings.finite_rings - sage: s = SymmetricFunctions(GF(2)).s() # optional - sage.combinat sage.rings.finite_rings - sage: L = LazySymmetricFunctions(s) # optional - sage.combinat sage.rings.finite_rings - sage: check(L, lambda n: sum(k*s(la) for k, la in enumerate(Partitions(n))), # optional - sage.combinat sage.rings.finite_rings + sage: s = SymmetricFunctions(GF(2)).s() # needs sage.combinat sage.rings.finite_rings + sage: L = LazySymmetricFunctions(s) # needs sage.combinat sage.rings.finite_rings + sage: check(L, lambda n: sum(k*s(la) for k, la in enumerate(Partitions(n))), # needs sage.combinat sage.rings.finite_rings ....: valuation=0) """ @@ -296,9 +296,9 @@ def __init__(self, parent, coeff_stream): sage: L. = LazyLaurentSeriesRing(ZZ) sage: TestSuite(L.an_element()).run() - sage: L = LazyDirichletSeriesRing(QQbar, 'z') # optional - sage.rings.number_field - sage: g = L(constant=1) # optional - sage.rings.number_field - sage: TestSuite(g).run() # optional - sage.rings.number_field + sage: L = LazyDirichletSeriesRing(QQbar, 'z') # needs sage.rings.number_field + sage: g = L(constant=1) # needs sage.rings.number_field + sage: TestSuite(g).run() # needs sage.rings.number_field """ Element.__init__(self, parent) self._coeff_stream = coeff_stream @@ -436,9 +436,9 @@ def coefficients(self, n=None): sage: f.coefficients() lazy list [1, 1, -1/6, ...] - sage: L. = LazyPowerSeriesRing(GF(2)) # optional - sage.rings.finite_rings - sage: f = L(lambda n: n) # optional - sage.rings.finite_rings - sage: f.coefficients(5) # optional - sage.rings.finite_rings + sage: L. = LazyPowerSeriesRing(GF(2)) # needs sage.rings.finite_rings + sage: f = L(lambda n: n) # needs sage.rings.finite_rings + sage: f.coefficients(5) # needs sage.rings.finite_rings [1, 1, 1, 1, 1] """ coeff_stream = self._coeff_stream @@ -496,10 +496,10 @@ def map_coefficients(self, f): sage: L = LazyDirichletSeriesRing(ZZ, "z") sage: s = L(lambda n: n-1) - sage: s # optional - sage.symbolic + sage: s # needs sage.symbolic 1/(2^z) + 2/3^z + 3/4^z + 4/5^z + 5/6^z + 6/7^z + O(1/(8^z)) sage: ms = s.map_coefficients(lambda c: c + 1) - sage: ms # optional - sage.symbolic + sage: ms # needs sage.symbolic 2/2^z + 3/3^z + 4/4^z + 5/5^z + 6/6^z + 7/7^z + 8/8^z + O(1/(9^z)) Similarly for multivariate power series:: @@ -520,12 +520,13 @@ def map_coefficients(self, f): Similarly for lazy symmetric functions:: - sage: p = SymmetricFunctions(QQ).p() # optional - sage.combinat - sage: L = LazySymmetricFunctions(p) # optional - sage.combinat - sage: f = 1/(1-2*L(p[1])); f # optional - sage.combinat + sage: # needs sage.combinat + sage: p = SymmetricFunctions(QQ).p() + sage: L = LazySymmetricFunctions(p) + sage: f = 1/(1-2*L(p[1])); f p[] + 2*p[1] + (4*p[1,1]) + (8*p[1,1,1]) + (16*p[1,1,1,1]) + (32*p[1,1,1,1,1]) + (64*p[1,1,1,1,1,1]) + O^7 - sage: f.map_coefficients(lambda c: log(c, 2)) # optional - sage.combinat + sage: f.map_coefficients(lambda c: log(c, 2)) p[1] + (2*p[1,1]) + (3*p[1,1,1]) + (4*p[1,1,1,1]) + (5*p[1,1,1,1,1]) + (6*p[1,1,1,1,1,1]) + O^7 @@ -663,10 +664,10 @@ def shift(self, n): sage: D = LazyDirichletSeriesRing(QQ, 't') sage: f = D([0,1,2]) - sage: f # optional - sage.symbolic + sage: f # needs sage.symbolic 1/(2^t) + 2/3^t sage: sf = f.shift(3) - sage: sf # optional - sage.symbolic + sage: sf # needs sage.symbolic 1/(5^t) + 2/6^t Examples with power series (where the minimal valuation is `0`):: @@ -1010,60 +1011,65 @@ def __bool__(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(GF(2)) # optional - sage.rings.finite_rings - sage: bool(z - z) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: L. = LazyLaurentSeriesRing(GF(2)) + sage: bool(z - z) False - sage: f = 1/(1 - z) # optional - sage.rings.finite_rings - sage: bool(f) # optional - sage.rings.finite_rings + sage: f = 1/(1 - z) + sage: bool(f) True - sage: M = L(lambda n: n, valuation=0); M # optional - sage.rings.finite_rings + sage: M = L(lambda n: n, valuation=0); M z + z^3 + z^5 + O(z^7) - sage: M.is_zero() # optional - sage.rings.finite_rings + sage: M.is_zero() False - sage: M = L(lambda n: 2*n if n < 10 else 1, valuation=0); M # optional - sage.rings.finite_rings + sage: M = L(lambda n: 2*n if n < 10 else 1, valuation=0); M O(z^7) - sage: bool(M) # optional - sage.rings.finite_rings + sage: bool(M) Traceback (most recent call last): ... ValueError: undecidable as lazy Laurent series - sage: M[15] # optional - sage.rings.finite_rings + sage: M[15] 1 - sage: bool(M) # optional - sage.rings.finite_rings + sage: bool(M) True - sage: L. = LazyLaurentSeriesRing(GF(2), sparse=True) # optional - sage.rings.finite_rings - sage: M = L(lambda n: 2*n if n < 10 else 1, valuation=0); M # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: L. = LazyLaurentSeriesRing(GF(2), sparse=True) + sage: M = L(lambda n: 2*n if n < 10 else 1, valuation=0); M O(z^7) - sage: bool(M) # optional - sage.rings.finite_rings + sage: bool(M) Traceback (most recent call last): ... ValueError: undecidable as lazy Laurent series - sage: M[15] # optional - sage.rings.finite_rings + sage: M[15] 1 - sage: bool(M) # optional - sage.rings.finite_rings + sage: bool(M) True Uninitialized series:: - sage: g = L.undefined(valuation=0) # optional - sage.rings.finite_rings - sage: bool(g) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: g = L.undefined(valuation=0) + sage: bool(g) True - sage: g.define(0) # optional - sage.rings.finite_rings - sage: bool(g) # optional - sage.rings.finite_rings + sage: g.define(0) + sage: bool(g) False - sage: g = L.undefined(valuation=0) # optional - sage.rings.finite_rings - sage: bool(g) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: g = L.undefined(valuation=0) + sage: bool(g) True - sage: g.define(1 + z) # optional - sage.rings.finite_rings - sage: bool(g) # optional - sage.rings.finite_rings + sage: g.define(1 + z) + sage: bool(g) True - sage: g = L.undefined(valuation=0) # optional - sage.rings.finite_rings - sage: bool(g) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: g = L.undefined(valuation=0) + sage: bool(g) True - sage: g.define(1 + z*g) # optional - sage.rings.finite_rings - sage: bool(g) # optional - sage.rings.finite_rings + sage: g.define(1 + z*g) + sage: bool(g) True """ if isinstance(self._coeff_stream, Stream_zero): @@ -1202,14 +1208,15 @@ def define(self, s): We can compute the Frobenius character of unlabeled trees:: - sage: m = SymmetricFunctions(QQ).m() # optional - sage.combinat - sage: s = SymmetricFunctions(QQ).s() # optional - sage.combinat - sage: L = LazySymmetricFunctions(m) # optional - sage.combinat - sage: E = L(lambda n: s[n], valuation=0) # optional - sage.combinat - sage: X = L(s[1]) # optional - sage.combinat - sage: A = L.undefined() # optional - sage.combinat - sage: A.define(X*E(A, check=False)) # optional - sage.combinat - sage: A[:6] # optional - sage.combinat + sage: # needs sage.combinat + sage: m = SymmetricFunctions(QQ).m() + sage: s = SymmetricFunctions(QQ).s() + sage: L = LazySymmetricFunctions(m) + sage: E = L(lambda n: s[n], valuation=0) + sage: X = L(s[1]) + sage: A = L.undefined() + sage: A.define(X*E(A, check=False)) + sage: A[:6] [m[1], 2*m[1, 1] + m[2], 9*m[1, 1, 1] + 5*m[2, 1] + 2*m[3], @@ -1251,7 +1258,7 @@ def define(self, s): sage: g = D.undefined(valuation=2) sage: o = D(constant=1, valuation=2) sage: g.define(o * e(g)) - sage: g # optional - sage.symbolic + sage: g # needs sage.symbolic 1/(2^s) + 1/(3^s) + 2/4^s + 1/(5^s) + 3/6^s + 1/(7^s) + 9/2/8^s + O(1/(9^s)) For Laurent series there is no minimal valuation, so it has @@ -1276,7 +1283,7 @@ def define(self, s): sage: g = D([0, 1]) sage: f = D.undefined() sage: f.define(1 + ~f*g) - sage: f # optional - sage.symbolic + sage: f # needs sage.symbolic 1 + 1/(2^s) - 1/(4^s) + O(1/(8^s)) sage: oeis(f[:30]) # optional - internet @@ -1324,11 +1331,12 @@ def define(self, s): sage: f 1 + 2*t + 12*t^3 + 32*t^4 + 368*t^5 + 2192*t^6 + O(t^7) - sage: s = SymmetricFunctions(QQ).s() # optional - sage.combinat - sage: L = LazySymmetricFunctions(s) # optional - sage.combinat - sage: f = L.undefined() # optional - sage.combinat - sage: f.define(1+(s[1]*f).revert()) # optional - sage.combinat - sage: f # optional - sage.combinat + sage: # needs sage.combinat + sage: s = SymmetricFunctions(QQ).s() + sage: L = LazySymmetricFunctions(s) + sage: f = L.undefined() + sage: f.define(1+(s[1]*f).revert()) + sage: f s[] + s[1] + (-s[1,1]-s[2]) + (3*s[1,1,1]+6*s[2,1]+3*s[3]) + (-13*s[1,1,1,1]-39*s[2,1,1]-26*s[2,2]-39*s[3,1]-13*s[4]) @@ -1336,7 +1344,7 @@ def define(self, s): + (-419*s[1,1,1,1,1,1]-2095*s[2,1,1,1,1]-3771*s[2,2,1,1]-2095*s[2,2,2]-4190*s[3,1,1,1]-6704*s[3,2,1]-2095*s[3,3]-4190*s[4,1,1]-3771*s[4,2]-2095*s[5,1]-419*s[6]) + O^7 - sage: (f*s[1]).revert() + 1 - f # optional - sage.combinat + sage: (f*s[1]).revert() + 1 - f # needs sage.combinat O^7 """ @@ -1459,12 +1467,13 @@ def _ascii_art_(self): EXAMPLES:: - sage: e = SymmetricFunctions(QQ).e() # optional - sage.combinat sage.modules - sage: L. = LazyLaurentSeriesRing(e) # optional - sage.combinat sage.modules - sage: L.options.display_length = 3 # optional - sage.combinat sage.modules - sage: ascii_art(1 / (1 - e[1]*z)) # optional - sage.combinat sage.modules + sage: # needs sage.combinat sage.modules + sage: e = SymmetricFunctions(QQ).e() + sage: L. = LazyLaurentSeriesRing(e) + sage: L.options.display_length = 3 + sage: ascii_art(1 / (1 - e[1]*z)) e[] + e[1]*z + e[1, 1]*z^2 + O(e[]*z^3) - sage: L.options._reset() # optional - sage.combinat sage.modules + sage: L.options._reset() """ from sage.typeset.ascii_art import ascii_art, AsciiArt if isinstance(self._coeff_stream, Stream_zero): @@ -1479,12 +1488,13 @@ def _unicode_art_(self): EXAMPLES:: - sage: e = SymmetricFunctions(QQ).e() # optional - sage.combinat sage.modules - sage: L. = LazyLaurentSeriesRing(e) # optional - sage.combinat sage.modules - sage: L.options.display_length = 3 # optional - sage.combinat sage.modules - sage: unicode_art(1 / (1 - e[1]*z)) # optional - sage.combinat sage.modules + sage: # needs sage.combinat sage.modules + sage: e = SymmetricFunctions(QQ).e() + sage: L. = LazyLaurentSeriesRing(e) + sage: L.options.display_length = 3 + sage: unicode_art(1 / (1 - e[1]*z)) e[] + e[1]*z + e[1, 1]*z^2 + O(e[]*z^3) - sage: L.options._reset() # optional - sage.combinat sage.modules + sage: L.options._reset() """ from sage.typeset.unicode_art import unicode_art, UnicodeArt if isinstance(self._coeff_stream, Stream_zero): @@ -1539,7 +1549,7 @@ def change_ring(self, ring): sage: t.parent() Lazy Dirichlet Series Ring in z over Rational Field sage: it = t^-1 - sage: it # optional - sage.symbolic + sage: it # needs sage.symbolic 1/2 - 1/2/2^z - 1/2/3^z - 1/2/5^z + 1/2/6^z - 1/2/7^z + O(1/(8^z)) A Taylor series example:: @@ -1607,28 +1617,28 @@ def _add_(self, other): sage: L = LazyDirichletSeriesRing(ZZ, "z") sage: s = L(lambda n: n) - sage: s # optional - sage.symbolic + sage: s # needs sage.symbolic 1 + 2/2^z + 3/3^z + 4/4^z + 5/5^z + 6/6^z + 7/7^z + O(1/(8^z)) sage: t = L(constant=1) - sage: t # optional - sage.symbolic + sage: t # needs sage.symbolic 1 + 1/(2^z) + 1/(3^z) + O(1/(4^z)) sage: st = s + t - sage: st # optional - sage.symbolic + sage: st # needs sage.symbolic 2 + 3/2^z + 4/3^z + 5/4^z + 6/5^z + 7/6^z + 8/7^z + O(1/(8^z)) sage: r = L(constant=-1) sage: rt = r + t - sage: rt # optional - sage.symbolic + sage: rt # needs sage.symbolic 0 sage: r = L([1,2,3]) sage: rt = r + t - sage: rt # optional - sage.symbolic + sage: rt # needs sage.symbolic 2 + 3/2^z + 4/3^z + 1/(4^z) + 1/(5^z) + 1/(6^z) + O(1/(7^z)) sage: r = L([1,2,3], constant=-1) sage: rt = r + t - sage: rt # optional - sage.symbolic + sage: rt # needs sage.symbolic 2 + 3/2^z + 4/3^z """ P = self.parent() @@ -1823,16 +1833,16 @@ def _acted_upon_(self, scalar, self_on_left): sage: L = LazyDirichletSeriesRing(ZZ, "z") sage: g = L([0,1]) - sage: 2 * g # optional - sage.symbolic + sage: 2 * g # needs sage.symbolic 2/2^z - sage: -1 * g # optional - sage.symbolic + sage: -1 * g # needs sage.symbolic -1/(2^z) - sage: 0*g # optional - sage.symbolic + sage: 0*g # needs sage.symbolic 0 sage: M = L(lambda n: n) - sage: M # optional - sage.symbolic + sage: M # needs sage.symbolic 1 + 2/2^z + 3/3^z + 4/4^z + 5/5^z + 6/6^z + 7/7^z + O(1/(8^z)) - sage: 3 * M # optional - sage.symbolic + sage: 3 * M # needs sage.symbolic 3 + 6/2^z + 9/3^z + 12/4^z + 15/5^z + 18/6^z + 21/7^z + O(1/(8^z)) sage: 1 * M is M @@ -1955,7 +1965,7 @@ def exp(self): sage: L = LazyDirichletSeriesRing(QQ, "s") sage: Z = L(constant=1, valuation=2) - sage: exp(Z) # optional - sage.symbolic + sage: exp(Z) # needs sage.symbolic 1 + 1/(2^s) + 1/(3^s) + 3/2/4^s + 1/(5^s) + 2/6^s + 1/(7^s) + O(1/(8^s)) """ from .lazy_series_ring import LazyLaurentSeriesRing @@ -1971,7 +1981,7 @@ def log(self): sage: L = LazyDirichletSeriesRing(QQ, "s") sage: Z = L(constant=1) - sage: log(Z) # optional - sage.symbolic + sage: log(Z) # needs sage.symbolic 1/(2^s) + 1/(3^s) + 1/2/4^s + 1/(5^s) + 1/(7^s) + O(1/(8^s)) """ from .lazy_series_ring import LazyLaurentSeriesRing @@ -2028,8 +2038,8 @@ def cos(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # optional - sage.symbolic - sage: cos(z)[0:6] == cos(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # needs sage.symbolic + sage: cos(z)[0:6] == cos(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ from .lazy_series_ring import LazyLaurentSeriesRing @@ -2054,8 +2064,8 @@ def tan(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # optional - sage.symbolic - sage: tan(z)[0:6] == tan(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # needs sage.symbolic + sage: tan(z)[0:6] == tan(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ return self.sin() / self.cos() @@ -2076,8 +2086,8 @@ def cot(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # optional - sage.symbolic - sage: cot(z)[0:6] == cot(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # needs sage.symbolic + sage: cot(z)[0:6] == cot(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ return ~self.tan() @@ -2098,8 +2108,8 @@ def csc(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # optional - sage.symbolic - sage: (z*csc(z))[0:6] == (x*csc(x)).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # needs sage.symbolic + sage: (z*csc(z))[0:6] == (x*csc(x)).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ return ~self.sin() @@ -2120,8 +2130,8 @@ def sec(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # optional - sage.symbolic - sage: sec(z)[0:6] == sec(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # needs sage.symbolic + sage: sec(z)[0:6] == sec(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ return ~self.cos() @@ -2146,8 +2156,8 @@ def arcsin(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # optional - sage.symbolic - sage: asin(z)[0:6] == asin(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # needs sage.symbolic + sage: asin(z)[0:6] == asin(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ from .lazy_series_ring import LazyLaurentSeriesRing @@ -2183,8 +2193,8 @@ def arccos(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic - sage: acos(z)[0:6] == acos(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # needs sage.symbolic + sage: acos(z)[0:6] == acos(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ from sage.symbolic.constants import pi @@ -2207,8 +2217,8 @@ def arctan(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # optional - sage.symbolic - sage: atan(z)[0:6] == atan(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # needs sage.symbolic + sage: atan(z)[0:6] == atan(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ from .lazy_series_ring import LazyLaurentSeriesRing @@ -2246,8 +2256,8 @@ def arccot(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic - sage: acot(z)[0:6] == acot(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # needs sage.symbolic + sage: acot(z)[0:6] == acot(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ from sage.symbolic.constants import pi @@ -2273,8 +2283,8 @@ def sinh(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic - sage: sinh(z)[0:6] == sinh(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # needs sage.symbolic + sage: sinh(z)[0:6] == sinh(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ from .lazy_series_ring import LazyLaurentSeriesRing @@ -2300,8 +2310,8 @@ def cosh(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic - sage: cosh(z)[0:6] == cosh(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # needs sage.symbolic + sage: cosh(z)[0:6] == cosh(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ from .lazy_series_ring import LazyLaurentSeriesRing @@ -2327,8 +2337,8 @@ def tanh(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic - sage: tanh(z)[0:6] == tanh(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # needs sage.symbolic + sage: tanh(z)[0:6] == tanh(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ from sage.arith.misc import bernoulli @@ -2358,8 +2368,8 @@ def coth(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic - sage: coth(z)[0:6] == coth(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # needs sage.symbolic + sage: coth(z)[0:6] == coth(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ from sage.arith.misc import bernoulli @@ -2390,8 +2400,8 @@ def sech(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic - sage: sech(z)[0:6] == sech(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # needs sage.symbolic + sage: sech(z)[0:6] == sech(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ from sage.combinat.combinat import euler_number @@ -2421,8 +2431,8 @@ def csch(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic - sage: csch(z)[0:6] == csch(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # needs sage.symbolic + sage: csch(z)[0:6] == csch(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ from sage.arith.misc import bernoulli @@ -2460,8 +2470,8 @@ def arcsinh(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic - sage: asinh(z)[0:6] == asinh(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # needs sage.symbolic + sage: asinh(z)[0:6] == asinh(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ @@ -2498,8 +2508,8 @@ def arctanh(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic - sage: atanh(z)[0:6] == atanh(x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # needs sage.symbolic + sage: atanh(z)[0:6] == atanh(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ @@ -2533,8 +2543,8 @@ def hypergeometric(self, a, b): TESTS:: - sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # optional - sage.symbolic - sage: z.hypergeometric([1,1],[1])[0:6] == hypergeometric([1,1],[1], x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # needs sage.symbolic + sage: z.hypergeometric([1,1],[1])[0:6] == hypergeometric([1,1],[1], x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True """ @@ -2624,14 +2634,14 @@ def __pow__(self, n): sage: D = LazyDirichletSeriesRing(QQ, 's') sage: Z = D(constant=1) - sage: Z^2 # optional - sage.symbolic + sage: Z^2 # needs sage.symbolic 1 + 2/2^s + 2/3^s + 3/4^s + 2/5^s + 4/6^s + 2/7^s + O(1/(8^s)) sage: f = Z^(1/3) - sage: f # optional - sage.symbolic + sage: f # needs sage.symbolic 1 + 1/3/2^s + 1/3/3^s + 2/9/4^s + 1/3/5^s + 1/9/6^s + 1/3/7^s + O(1/(8^s)) - sage: f^2 # optional - sage.symbolic + sage: f^2 # needs sage.symbolic 1 + 2/3/2^s + 2/3/3^s + 5/9/4^s + 2/3/5^s + 4/9/6^s + 2/3/7^s + O(1/(8^s)) - sage: f^3 - Z # optional - sage.symbolic + sage: f^3 - Z # needs sage.symbolic O(1/(8^s)) sage: L. = LazyLaurentSeriesRing(QQ) @@ -2685,11 +2695,12 @@ def sqrt(self): This also works for Dirichlet series:: - sage: D = LazyDirichletSeriesRing(SR, "s") # optional - sage.symbolic - sage: Z = D(constant=1) # optional - sage.symbolic - sage: f = sqrt(Z); f # optional - sage.symbolic + sage: # needs sage.symbolic + sage: D = LazyDirichletSeriesRing(SR, "s") + sage: Z = D(constant=1) + sage: f = sqrt(Z); f 1 + 1/2/2^s + 1/2/3^s + 3/8/4^s + 1/2/5^s + 1/4/6^s + 1/2/7^s + O(1/(8^s)) - sage: f*f - Z # optional - sage.symbolic + sage: f*f - Z O(1/(8^s)) """ return self ** QQ((1, 2)) # == 1/2 @@ -2798,22 +2809,23 @@ def _mul_(self, other): Multiplication of series with eventually constant coefficients may yield another such series:: - sage: L. = LazyLaurentSeriesRing(SR) # optional - sage.symbolic - sage: var("a b c d e u v w") # optional - sage.symbolic + sage: # needs sage.symbolic + sage: L. = LazyLaurentSeriesRing(SR) + sage: var("a b c d e u v w") (a, b, c, d, e, u, v, w) - sage: s = a/z^2 + b*z + c*z^2 + d*z^3 + e*z^4 # optional - sage.symbolic - sage: t = L([u, v], constant=w, valuation=-1) # optional - sage.symbolic - sage: s1 = s.approximate_series(44) # optional - sage.symbolic - sage: t1 = t.approximate_series(44) # optional - sage.symbolic - sage: s1 * t1 - (s * t).approximate_series(42) # optional - sage.symbolic + sage: s = a/z^2 + b*z + c*z^2 + d*z^3 + e*z^4 + sage: t = L([u, v], constant=w, valuation=-1) + sage: s1 = s.approximate_series(44) + sage: t1 = t.approximate_series(44) + sage: s1 * t1 - (s * t).approximate_series(42) O(z^42) Check products with exact series:: - sage: L([1], constant=3)^2 # optional - sage.symbolic + sage: L([1], constant=3)^2 # needs sage.symbolic 1 + 6*z + 15*z^2 + 24*z^3 + 33*z^4 + 42*z^5 + 51*z^6 + O(z^7) - sage: (1+z) * L([1,0,1], constant=1) # optional - sage.symbolic + sage: (1+z) * L([1,0,1], constant=1) # needs sage.symbolic 1 + z + z^2 + 2*z^3 + 2*z^4 + 2*z^5 + O(z^6) """ P = self.parent() @@ -2934,8 +2946,8 @@ def __pow__(self, n): We also support the general case:: - sage: L. = LazyLaurentSeriesRing(SR) # optional - sage.symbolic - sage: (1 + z)^(1 + z) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(SR) # needs sage.symbolic + sage: (1 + z)^(1 + z) # needs sage.symbolic 1 + z + z^2 + 1/2*z^3 + 1/3*z^4 + 1/12*z^5 + 3/40*z^6 + O(z^7) """ @@ -2995,14 +3007,15 @@ def __invert__(self): We can also compute the multiplicative inverse of a symmetric function:: - sage: h = SymmetricFunctions(QQ).h() # optional - sage.modules - sage: p = SymmetricFunctions(QQ).p() # optional - sage.modules - sage: L = LazySymmetricFunctions(p) # optional - sage.modules - sage: E = L(lambda n: h[n]) # optional - sage.modules - sage: (~E)[:4] # optional - sage.modules + sage: # needs sage.modules + sage: h = SymmetricFunctions(QQ).h() + sage: p = SymmetricFunctions(QQ).p() + sage: L = LazySymmetricFunctions(p) + sage: E = L(lambda n: h[n]) + sage: (~E)[:4] [p[], -p[1], 1/2*p[1, 1] - 1/2*p[2], -1/6*p[1, 1, 1] + 1/2*p[2, 1] - 1/3*p[3]] - sage: (E * ~E)[:6] # optional - sage.modules + sage: (E * ~E)[:6] # needs sage.modules [p[], 0, 0, 0, 0, 0] TESTS:: @@ -3113,9 +3126,9 @@ def _div_(self, other): An example over the ring of symmetric functions:: - sage: e = SymmetricFunctions(QQ).e() # optional - sage.modules - sage: R. = LazyLaurentSeriesRing(e) # optional - sage.modules - sage: 1 / (1 - e[1]*z) # optional - sage.modules + sage: e = SymmetricFunctions(QQ).e() # needs sage.modules + sage: R. = LazyLaurentSeriesRing(e) # needs sage.modules + sage: 1 / (1 - e[1]*z) # needs sage.modules e[] + e[1]*z + e[1, 1]*z^2 + e[1, 1, 1]*z^3 + e[1, 1, 1, 1]*z^4 + e[1, 1, 1, 1, 1]*z^5 + e[1, 1, 1, 1, 1, 1]*z^6 + O(e[]*z^7) @@ -3368,11 +3381,11 @@ def log(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # optional - sage.symbolic - sage: log(1+z)[0:6] == log(1+x).series(x, 6).coefficients(sparse=False) # optional - sage.symbolic + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # needs sage.symbolic + sage: log(1+z)[0:6] == log(1+x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True - sage: log(z) # optional - sage.symbolic + sage: log(z) # needs sage.symbolic Traceback (most recent call last): ... ValueError: can only compose with a positive valuation series @@ -3501,16 +3514,16 @@ def _im_gens_(self, codomain, im_gens, base_map=None): EXAMPLES:: sage: Z. = ZZ[] - sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field - sage: R. = LazyLaurentSeriesRing(K) # optional - sage.rings.number_field - sage: f = R(lambda n: i^n, valuation=-2); f # optional - sage.rings.number_field + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: R. = LazyLaurentSeriesRing(K) # needs sage.rings.number_field + sage: f = R(lambda n: i^n, valuation=-2); f # needs sage.rings.number_field -t^-2 - i*t^-1 + 1 + i*t - t^2 - i*t^3 + t^4 + O(t^5) - sage: f._im_gens_(R, [t + t^2]) # optional - sage.rings.number_field + sage: f._im_gens_(R, [t + t^2]) # needs sage.rings.number_field -t^-2 + (-i + 2)*t^-1 + (i - 2) + 4*t + (2*i - 6)*t^2 + (-2*i + 4)*t^3 + (-2*i - 7)*t^4 + O(t^5) - sage: cc = K.hom([-i]) # optional - sage.rings.number_field - sage: f._im_gens_(R, [t + t^2], base_map=cc) # optional - sage.rings.number_field + sage: cc = K.hom([-i]) # needs sage.rings.number_field + sage: f._im_gens_(R, [t + t^2], base_map=cc) # needs sage.rings.number_field -t^-2 + (i + 2)*t^-1 + (-i - 2) + 4*t + (-2*i - 6)*t^2 + (2*i + 4)*t^3 + (2*i - 7)*t^4 + O(t^5) """ @@ -3747,7 +3760,7 @@ def __call__(self, g, *, check=True): sage: e = L(lambda n: 1/factorial(n), 0) sage: D = LazyDirichletSeriesRing(QQ, "s") sage: g = D(constant=1)-1 - sage: g # optional - sage.symbolic + sage: g # needs sage.symbolic 1/(2^s) + 1/(3^s) + 1/(4^s) + O(1/(5^s)) sage: e(g)[0:10] @@ -3757,7 +3770,7 @@ def __call__(self, g, *, check=True): [0, 1, 1, 1, 3/2, 1, 2, 1, 13/6, 3/2] sage: g = D([0,1,0,1,1,2]) - sage: g # optional - sage.symbolic + sage: g # needs sage.symbolic 1/(2^s) + 1/(4^s) + 1/(5^s) + 2/6^s sage: e(g)[0:10] [0, 1, 1, 0, 3/2, 1, 2, 0, 7/6, 0] @@ -3770,11 +3783,11 @@ def __call__(self, g, *, check=True): ValueError: can only compose with a positive valuation series sage: e5 = L(e, degree=5) - sage: e5 # optional - sage.symbolic + sage: e5 # needs sage.symbolic 1 + z + 1/2*z^2 + 1/6*z^3 + 1/24*z^4 - sage: e5(g) # optional - sage.symbolic + sage: e5(g) # needs sage.symbolic 1 + 1/(2^s) + 3/2/4^s + 1/(5^s) + 2/6^s + O(1/(8^s)) - sage: sum(e5[k] * g^k for k in range(5)) # optional - sage.symbolic + sage: sum(e5[k] * g^k for k in range(5)) # needs sage.symbolic 1 + 1/(2^s) + 3/2/4^s + 1/(5^s) + 2/6^s + O(1/(8^s)) The output parent is always the common parent between the base ring @@ -4546,7 +4559,7 @@ def __call__(self, *g, check=True): sage: D = LazyDirichletSeriesRing(QQ, "s") sage: g = D(constant=1)-1 - sage: g # optional - sage.symbolic + sage: g # needs sage.symbolic 1/(2^s) + 1/(3^s) + 1/(4^s) + O(1/(5^s)) sage: f = 1 / (1 - x - y*z); f 1 + x + (x^2+y*z) + (x^3+2*x*y*z) + (x^4+3*x^2*y*z+y^2*z^2) @@ -4554,18 +4567,18 @@ def __call__(self, *g, check=True): + (x^6+5*x^4*y*z+6*x^2*y^2*z^2+y^3*z^3) + O(x,y,z)^7 sage: fog = f(g, g, g) - sage: fog # optional - sage.symbolic + sage: fog # needs sage.symbolic 1 + 1/(2^s) + 1/(3^s) + 3/4^s + 1/(5^s) + 5/6^s + O(1/(7^s)) sage: fg = 1 / (1 - g - g*g) - sage: fg # optional - sage.symbolic + sage: fg # needs sage.symbolic 1 + 1/(2^s) + 1/(3^s) + 3/4^s + 1/(5^s) + 5/6^s + 1/(7^s) + O(1/(8^s)) - sage: fog - fg # optional - sage.symbolic + sage: fog - fg # needs sage.symbolic O(1/(8^s)) sage: f = 1 / (1 - 2*a) - sage: f(g) # optional - sage.symbolic + sage: f(g) # needs sage.symbolic 1 + 2/2^s + 2/3^s + 6/4^s + 2/5^s + 10/6^s + 2/7^s + O(1/(8^s)) - sage: 1 / (1 - 2*g) # optional - sage.symbolic + sage: 1 / (1 - 2*g) # needs sage.symbolic 1 + 2/2^s + 2/3^s + 6/4^s + 2/5^s + 10/6^s + 2/7^s + O(1/(8^s)) The output parent is always the common parent between the base ring @@ -5313,19 +5326,20 @@ def xgcd(self, f): sage: g == s * a + t * b True - sage: L. = LazyPowerSeriesRing(GF(2)) # optional - sage.rings.finite_rings - sage: a = L(lambda n: n % 2, valuation=3); a # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: L. = LazyPowerSeriesRing(GF(2)) + sage: a = L(lambda n: n % 2, valuation=3); a x^3 + x^5 + x^7 + x^9 + O(x^10) - sage: b = L(lambda n: binomial(n,2) % 2, valuation=3); b # optional - sage.rings.finite_rings + sage: b = L(lambda n: binomial(n,2) % 2, valuation=3); b x^3 + x^6 + x^7 + O(x^10) - sage: g, s, t = a.xgcd(b) # optional - sage.rings.finite_rings - sage: g # optional - sage.rings.finite_rings + sage: g, s, t = a.xgcd(b) + sage: g x^3 - sage: s # optional - sage.rings.finite_rings + sage: s 1 + x + x^3 + x^4 + x^5 + O(x^7) - sage: t # optional - sage.rings.finite_rings + sage: t x + x^2 + x^4 + x^5 + x^6 + O(x^8) - sage: g == s * a + t * b # optional - sage.rings.finite_rings + sage: g == s * a + t * b True sage: LazyPowerSeriesRing.options._reset() # reset the options @@ -5367,11 +5381,12 @@ def _format_series(self, formatter, format_strings=False): TESTS:: - sage: h = SymmetricFunctions(ZZ).h() # optional - sage.modules - sage: e = SymmetricFunctions(ZZ).e() # optional - sage.modules - sage: L = LazySymmetricFunctions(tensor([h, e])) # optional - sage.modules - sage: f = L(lambda n: sum(tensor([h[k], e[n-k]]) for k in range(n+1))) # optional - sage.modules - sage: f._format_series(repr) # optional - sage.modules + sage: # needs sage.modules + sage: h = SymmetricFunctions(ZZ).h() + sage: e = SymmetricFunctions(ZZ).e() + sage: L = LazySymmetricFunctions(tensor([h, e])) + sage: f = L(lambda n: sum(tensor([h[k], e[n-k]]) for k in range(n+1))) + sage: f._format_series(repr) '(h[]#e[]) + (h[]#e[1]+h[1]#e[]) + (h[]#e[2]+h[1]#e[1]+h[2]#e[]) @@ -5442,8 +5457,8 @@ class LazySymmetricFunction(LazyCompletionGradedAlgebraElement): EXAMPLES:: - sage: s = SymmetricFunctions(ZZ).s() # optional - sage.modules - sage: L = LazySymmetricFunctions(s) # optional - sage.modules + sage: s = SymmetricFunctions(ZZ).s() # needs sage.modules + sage: L = LazySymmetricFunctions(s) # needs sage.modules """ def is_unit(self): """ @@ -5451,22 +5466,22 @@ def is_unit(self): EXAMPLES:: - sage: m = SymmetricFunctions(ZZ).m() # optional - sage.modules - sage: L = LazySymmetricFunctions(m) # optional - sage.modules + sage: m = SymmetricFunctions(ZZ).m() # needs sage.modules + sage: L = LazySymmetricFunctions(m) # needs sage.modules - sage: L(2*m[1]).is_unit() # optional - sage.modules + sage: L(2*m[1]).is_unit() # needs sage.modules False - sage: L(-1 + 2*m[1]).is_unit() # optional - sage.modules + sage: L(-1 + 2*m[1]).is_unit() # needs sage.modules True - sage: L(2 + m[1]).is_unit() # optional - sage.modules + sage: L(2 + m[1]).is_unit() # needs sage.modules False - sage: m = SymmetricFunctions(QQ).m() # optional - sage.modules - sage: L = LazySymmetricFunctions(m) # optional - sage.modules + sage: m = SymmetricFunctions(QQ).m() # needs sage.modules + sage: L = LazySymmetricFunctions(m) # needs sage.modules - sage: L(2 + 3*m[1]).is_unit() # optional - sage.modules + sage: L(2 + 3*m[1]).is_unit() # needs sage.modules True """ if self.is_zero(): # now 0 != 1 @@ -5510,54 +5525,56 @@ def __call__(self, *args, check=True): EXAMPLES:: sage: P. = QQ[] - sage: s = SymmetricFunctions(P).s() # optional - sage.modules - sage: L = LazySymmetricFunctions(s) # optional - sage.modules - sage: f = s[2] # optional - sage.modules - sage: g = s[3] # optional - sage.modules - sage: L(f)(L(g)) - L(f(g)) # optional - sage.modules + sage: s = SymmetricFunctions(P).s() # needs sage.modules + sage: L = LazySymmetricFunctions(s) # needs sage.modules + sage: f = s[2] # needs sage.modules + sage: g = s[3] # needs sage.modules + sage: L(f)(L(g)) - L(f(g)) # needs sage.modules 0 - sage: f = s[2] + s[2,1] # optional - sage.modules - sage: g = s[1] + s[2,2] # optional - sage.modules - sage: L(f)(L(g)) - L(f(g)) # optional - sage.modules + sage: f = s[2] + s[2,1] # needs sage.modules + sage: g = s[1] + s[2,2] # needs sage.modules + sage: L(f)(L(g)) - L(f(g)) # needs sage.modules 0 - sage: L(f)(g) - L(f(g)) # optional - sage.modules + sage: L(f)(g) - L(f(g)) # needs sage.modules 0 - sage: f = s[2] + s[2,1] # optional - sage.modules - sage: g = s[1] + s[2,2] # optional - sage.modules - sage: L(f)(L(q*g)) - L(f(q*g)) # optional - sage.modules + sage: f = s[2] + s[2,1] # needs sage.modules + sage: g = s[1] + s[2,2] # needs sage.modules + sage: L(f)(L(q*g)) - L(f(q*g)) # needs sage.modules 0 The Frobenius character of the permutation action on set partitions is a plethysm:: - sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules - sage: S = LazySymmetricFunctions(s) # optional - sage.modules - sage: E1 = S(lambda n: s[n], valuation=1) # optional - sage.modules - sage: E = 1 + E1 # optional - sage.modules - sage: P = E(E1) # optional - sage.modules - sage: P[:5] # optional - sage.modules + sage: # needs sage.modules + sage: s = SymmetricFunctions(QQ).s() + sage: S = LazySymmetricFunctions(s) + sage: E1 = S(lambda n: s[n], valuation=1) + sage: E = 1 + E1 + sage: P = E(E1) + sage: P[:5] [s[], s[1], 2*s[2], s[2, 1] + 3*s[3], 2*s[2, 2] + 2*s[3, 1] + 5*s[4]] The plethysm with a tensor product is also implemented:: - sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules - sage: X = tensor([s[1],s[[]]]) # optional - sage.modules - sage: Y = tensor([s[[]],s[1]]) # optional - sage.modules - sage: S = LazySymmetricFunctions(s) # optional - sage.modules - sage: S2 = LazySymmetricFunctions(tensor([s, s])) # optional - sage.modules - sage: A = S(s[1,1,1]) # optional - sage.modules - sage: B = S2(X+Y) # optional - sage.modules - sage: A(B) # optional - sage.modules + sage: # needs sage.modules + sage: s = SymmetricFunctions(QQ).s() + sage: X = tensor([s[1],s[[]]]) + sage: Y = tensor([s[[]],s[1]]) + sage: S = LazySymmetricFunctions(s) + sage: S2 = LazySymmetricFunctions(tensor([s, s])) + sage: A = S(s[1,1,1]) + sage: B = S2(X+Y) + sage: A(B) (s[]#s[1,1,1]+s[1]#s[1,1]+s[1,1]#s[1]+s[1,1,1]#s[]) - sage: H = S(lambda n: s[n]) # optional - sage.modules - sage: H(S2(X*Y)) # optional - sage.modules + sage: H = S(lambda n: s[n]) # needs sage.modules + sage: H(S2(X*Y)) # needs sage.modules (s[]#s[]) + (s[1]#s[1]) + (s[1,1]#s[1,1]+s[2]#s[2]) + (s[1,1,1]#s[1,1,1]+s[2,1]#s[2,1]+s[3]#s[3]) + O^7 - sage: H(S2(X+Y)) # optional - sage.modules + sage: H(S2(X+Y)) # needs sage.modules (s[]#s[]) + (s[]#s[1]+s[1]#s[]) + (s[]#s[2]+s[1]#s[1]+s[2]#s[]) + (s[]#s[3]+s[1]#s[2]+s[2]#s[1]+s[3]#s[]) + (s[]#s[4]+s[1]#s[3]+s[2]#s[2]+s[3]#s[1]+s[4]#s[]) @@ -5567,24 +5584,25 @@ def __call__(self, *args, check=True): TESTS:: - sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules - sage: S = LazySymmetricFunctions(s) # optional - sage.modules - sage: f = 1 / (1 - S(s[2])) # optional - sage.modules - sage: g = f(s[2]); g # optional - sage.modules + sage: # needs sage.modules + sage: s = SymmetricFunctions(QQ).s() + sage: S = LazySymmetricFunctions(s) + sage: f = 1 / (1 - S(s[2])) + sage: g = f(s[2]); g s[] + (s[2,2]+s[4]) + O^7 - sage: S(sum(f[i](s[2]) for i in range(5))).truncate(10) == g.truncate(10) # optional - sage.modules + sage: S(sum(f[i](s[2]) for i in range(5))).truncate(10) == g.truncate(10) True - sage: f = 1 / (1 - S(s[2])) # optional - sage.modules - sage: g = S(s[1]) / (1 - S(s[1])) # optional - sage.modules - sage: f(g) # optional - sage.modules + sage: f = 1 / (1 - S(s[2])) + sage: g = S(s[1]) / (1 - S(s[1])) + sage: f(g) s[] + s[2] + (s[1,1,1]+2*s[2,1]+s[3]) + (2*s[1,1,1,1]+4*s[2,1,1]+5*s[2,2]+5*s[3,1]+3*s[4]) + (2*s[1,1,1,1,1]+10*s[2,1,1,1]+14*s[2,2,1]+18*s[3,1,1]+16*s[3,2]+14*s[4,1]+4*s[5]) + (3*s[1,1,1,1,1,1]+22*s[2,1,1,1,1]+38*s[2,2,1,1]+28*s[2,2,2]+48*s[3,1,1,1]+82*s[3,2,1]+25*s[3,3]+51*s[4,1,1]+56*s[4,2]+31*s[5,1]+9*s[6]) + O^7 - sage: f(0) # optional - sage.modules + sage: f(0) 1 - sage: f(s(1)) # optional - sage.modules + sage: f(s(1)) Traceback (most recent call last): ... ValueError: can only compose with a positive valuation series @@ -5592,22 +5610,23 @@ def __call__(self, *args, check=True): Check that composing the zero series with anything yields zero in the correct parent:: - sage: e = SymmetricFunctions(QQ).e() # optional - sage.modules - sage: h = SymmetricFunctions(QQ).h() # optional - sage.modules - sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules - sage: p = SymmetricFunctions(QQ).p() # optional - sage.modules - sage: L = LazySymmetricFunctions(tensor([e, h])) # optional - sage.modules - sage: r = (L(0)(s[1], p[1])); r # optional - sage.modules + sage: # needs sage.modules + sage: e = SymmetricFunctions(QQ).e() + sage: h = SymmetricFunctions(QQ).h() + sage: s = SymmetricFunctions(QQ).s() + sage: p = SymmetricFunctions(QQ).p() + sage: L = LazySymmetricFunctions(tensor([e, h])) + sage: r = (L(0)(s[1], p[1])); r 0 - sage: r.parent() # optional - sage.modules + sage: r.parent() Symmetric Functions over Rational Field in the Schur basis Check that composing `f` with zero series yields the constant term of `f`:: - sage: f = 3*L(tensor([s[1], s[1]])) # optional - sage.modules - sage: f(0, 0) # optional - sage.modules + sage: f = 3*L(tensor([s[1], s[1]])) # needs sage.modules + sage: f(0, 0) # needs sage.modules 0 - sage: (3+f)(0, 0) # optional - sage.modules + sage: (3+f)(0, 0) # needs sage.modules 3 """ fP = parent(self) @@ -5694,39 +5713,41 @@ def revert(self): EXAMPLES:: - sage: h = SymmetricFunctions(QQ).h() # optional - sage.modules - sage: L = LazySymmetricFunctions(h) # optional - sage.modules - sage: f = L(lambda n: h[n]) - 1 # optional - sage.modules - sage: f(f.revert()) # optional - sage.modules + sage: # needs sage.modules + sage: h = SymmetricFunctions(QQ).h() + sage: L = LazySymmetricFunctions(h) + sage: f = L(lambda n: h[n]) - 1 + sage: f(f.revert()) h[1] + O^8 TESTS:: - sage: f = L(lambda n: h[n]) - 1 - h[1] # optional - sage.modules - sage: g = f.revert() # optional - sage.modules - sage: g[1] # optional - sage.modules + sage: f = L(lambda n: h[n]) - 1 - h[1] # needs sage.modules + sage: g = f.revert() # needs sage.modules + sage: g[1] # needs sage.modules Traceback (most recent call last): ... ValueError: compositional inverse does not exist - sage: R. = QQ[] # optional - sage.modules - sage: p = SymmetricFunctions(R.fraction_field()).p() # optional - sage.modules - sage: L = LazySymmetricFunctions(p) # optional - sage.modules - sage: f = L(a + b*p[1]) # optional - sage.modules - sage: f.revert() # optional - sage.modules + sage: # needs sage.modules + sage: R. = QQ[] + sage: p = SymmetricFunctions(R.fraction_field()).p() + sage: L = LazySymmetricFunctions(p) + sage: f = L(a + b*p[1]) + sage: f.revert() (((-a)/b)*p[]) + 1/b*p[1] - sage: f = L(2*p[1]) # optional - sage.modules - sage: f.revert() # optional - sage.modules + sage: f = L(2*p[1]) # needs sage.modules + sage: f.revert() # needs sage.modules 1/2*p[1] - sage: f = L(2*p[1] + p[1,1]) # optional - sage.modules - sage: f.revert() # optional - sage.modules + sage: f = L(2*p[1] + p[1,1]) # needs sage.modules + sage: f.revert() # needs sage.modules 1/2*p[1] + (-1/8*p[1,1]) + (1/16*p[1,1,1]) + (-5/128*p[1,1,1,1]) + (7/256*p[1,1,1,1,1]) + (-21/1024*p[1,1,1,1,1,1]) + (33/2048*p[1,1,1,1,1,1,1]) + O^8 - sage: f.revert()(f) # optional - sage.modules + sage: f.revert()(f) # needs sage.modules p[1] + O^8 ALGORITHM: @@ -5819,33 +5840,36 @@ def derivative_with_respect_to_p1(self, n=1): The species `E` of sets satisfies the relationship `E' = E`:: - sage: h = SymmetricFunctions(QQ).h() # optional - sage.modules - sage: T = LazySymmetricFunctions(h) # optional - sage.modules - sage: E = T(lambda n: h[n]) # optional - sage.modules - sage: E - E.derivative_with_respect_to_p1() # optional - sage.modules + sage: # needs sage.modules + sage: h = SymmetricFunctions(QQ).h() + sage: T = LazySymmetricFunctions(h) + sage: E = T(lambda n: h[n]) + sage: E - E.derivative_with_respect_to_p1() O^6 The species `C` of cyclic orderings and the species `L` of linear orderings satisfy the relationship `C' = L`:: - sage: p = SymmetricFunctions(QQ).p() # optional - sage.modules - sage: C = T(lambda n: (sum(euler_phi(k)*p([k])**(n//k) # optional - sage.modules + sage: # needs sage.modules + sage: p = SymmetricFunctions(QQ).p() + sage: C = T(lambda n: (sum(euler_phi(k)*p([k])**(n//k) ....: for k in divisors(n))/n if n > 0 else 0)) - sage: L = T(lambda n: p([1]*n)) # optional - sage.modules - sage: L - C.derivative_with_respect_to_p1() # optional - sage.modules + sage: L = T(lambda n: p([1]*n)) + sage: L - C.derivative_with_respect_to_p1() O^6 TESTS:: - sage: T = LazySymmetricFunctions(p) # optional - sage.modules - sage: a = T(p([1,1,1])) # optional - sage.modules - sage: a.derivative_with_respect_to_p1() # optional - sage.modules + sage: # needs sage.modules + sage: T = LazySymmetricFunctions(p) + sage: a = T(p([1,1,1])) + sage: a.derivative_with_respect_to_p1() (3*p[1,1]) + O^9 - sage: a.derivative_with_respect_to_p1(1) # optional - sage.modules + sage: a.derivative_with_respect_to_p1(1) (3*p[1,1]) + O^9 - sage: a.derivative_with_respect_to_p1(2) # optional - sage.modules + sage: a.derivative_with_respect_to_p1(2) 6*p[1] + O^8 - sage: a.derivative_with_respect_to_p1(3) # optional - sage.modules + sage: a.derivative_with_respect_to_p1(3) 6*p[] + O^7 """ P = self.parent() @@ -5900,12 +5924,12 @@ def functorial_composition(self, *args): :class:`~sage.combinat.species.subset_species.SubsetSpecies`.:: sage: R. = QQ[] - sage: h = SymmetricFunctions(R).h() # optional - sage.modules - sage: m = SymmetricFunctions(R).m() # optional - sage.modules - sage: L = LazySymmetricFunctions(m) # optional - sage.modules - sage: P = L(lambda n: sum(q^k*h[n-k]*h[k] for k in range(n+1))) # optional - sage.modules - sage: P2 = L(lambda n: h[2]*h[n-2], valuation=2) # optional - sage.modules - sage: P.functorial_composition(P2)[:4] # optional - sage.modules + sage: h = SymmetricFunctions(R).h() # needs sage.modules + sage: m = SymmetricFunctions(R).m() # needs sage.modules + sage: L = LazySymmetricFunctions(m) # needs sage.modules + sage: P = L(lambda n: sum(q^k*h[n-k]*h[k] for k in range(n+1))) # needs sage.modules + sage: P2 = L(lambda n: h[2]*h[n-2], valuation=2) # needs sage.modules + sage: P.functorial_composition(P2)[:4] # needs sage.modules [m[], m[1], (q+1)*m[1, 1] + (q+1)*m[2], @@ -5913,12 +5937,12 @@ def functorial_composition(self, *args): For example, there are:: - sage: P.functorial_composition(P2)[4].coefficient([4])[3] # optional - sage.modules + sage: P.functorial_composition(P2)[4].coefficient([4])[3] # needs sage.modules 3 unlabelled graphs on 4 vertices and 3 edges, and:: - sage: P.functorial_composition(P2)[4].coefficient([2,2])[3] # optional - sage.modules + sage: P.functorial_composition(P2)[4].coefficient([2,2])[3] # needs sage.modules 8 labellings of their vertices with two 1's and two 2's. @@ -5926,43 +5950,46 @@ def functorial_composition(self, *args): The symmetric function `h_1 \sum_n h_n` is the neutral element with respect to functorial composition:: - sage: p = SymmetricFunctions(QQ).p() # optional - sage.modules - sage: h = SymmetricFunctions(QQ).h() # optional - sage.modules - sage: e = SymmetricFunctions(QQ).e() # optional - sage.modules - sage: L = LazySymmetricFunctions(h) # optional - sage.modules - sage: E = L(lambda n: h[n]) # optional - sage.modules - sage: Ep = p[1]*E.derivative_with_respect_to_p1(); Ep # optional - sage.modules + sage: # needs sage.modules + sage: p = SymmetricFunctions(QQ).p() + sage: h = SymmetricFunctions(QQ).h() + sage: e = SymmetricFunctions(QQ).e() + sage: L = LazySymmetricFunctions(h) + sage: E = L(lambda n: h[n]) + sage: Ep = p[1]*E.derivative_with_respect_to_p1(); Ep h[1] + (h[1,1]) + (h[2,1]) + (h[3,1]) + (h[4,1]) + (h[5,1]) + O^7 - sage: f = L(lambda n: h[n-n//2, n//2]) # optional - sage.modules - sage: f - Ep.functorial_composition(f) # optional - sage.modules + sage: f = L(lambda n: h[n-n//2, n//2]) + sage: f - Ep.functorial_composition(f) O^7 The functorial composition distributes over the sum:: - sage: F1 = L(lambda n: h[n]) # optional - sage.modules - sage: F2 = L(lambda n: e[n]) # optional - sage.modules - sage: f1 = F1.functorial_composition(f) # optional - sage.modules - sage: f2 = F2.functorial_composition(f) # optional - sage.modules - sage: (F1 + F2).functorial_composition(f) - f1 - f2 # long time # optional - sage.modules + sage: # needs sage.modules + sage: F1 = L(lambda n: h[n]) + sage: F2 = L(lambda n: e[n]) + sage: f1 = F1.functorial_composition(f) + sage: f2 = F2.functorial_composition(f) + sage: (F1 + F2).functorial_composition(f) - f1 - f2 # long time O^7 TESTS: Check a corner case:: - sage: h = SymmetricFunctions(QQ).h() # optional - sage.modules - sage: L = LazySymmetricFunctions(h) # optional - sage.modules - sage: L(h[2,1]).functorial_composition(3*h[0]) # optional - sage.modules + sage: h = SymmetricFunctions(QQ).h() # needs sage.modules + sage: L = LazySymmetricFunctions(h) # needs sage.modules + sage: L(h[2,1]).functorial_composition(3*h[0]) # needs sage.modules 3*h[] + O^7 Check an instance of a non-group action:: - sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules - sage: p = SymmetricFunctions(QQ).p() # optional - sage.modules - sage: L = LazySymmetricFunctions(p) # optional - sage.modules - sage: f = L(lambda n: s[n]) # optional - sage.modules - sage: g = 2*s[2, 1, 1] + s[2, 2] + 3*s[4] # optional - sage.modules - sage: r = f.functorial_composition(g); r[4] # optional - sage.modules + sage: # needs sage.modules + sage: s = SymmetricFunctions(QQ).s() + sage: p = SymmetricFunctions(QQ).p() + sage: L = LazySymmetricFunctions(p) + sage: f = L(lambda n: s[n]) + sage: g = 2*s[2, 1, 1] + s[2, 2] + 3*s[4] + sage: r = f.functorial_composition(g); r[4] Traceback (most recent call last): ... ValueError: the argument is not the Frobenius character of a permutation representation @@ -6111,14 +6138,15 @@ def arithmetic_product(self, *args, check=True): consistent for all the lists in the structure. :: sage: R. = QQ[] - sage: p = SymmetricFunctions(R).p() # optional - sage.modules - sage: m = SymmetricFunctions(R).m() # optional - sage.modules - sage: L = LazySymmetricFunctions(m) # optional - sage.modules - - sage: C = species.CycleSpecies().cycle_index_series() # optional - sage.modules - sage: c = L(lambda n: C[n]) # optional - sage.modules - sage: Lplus = L(lambda n: p([1]*n), valuation=1) # optional - sage.modules - sage: r = c.arithmetic_product(Lplus); r # optional - sage.modules + sage: p = SymmetricFunctions(R).p() # needs sage.modules + sage: m = SymmetricFunctions(R).m() # needs sage.modules + sage: L = LazySymmetricFunctions(m) # needs sage.modules + + sage: # needs sage.modules + sage: C = species.CycleSpecies().cycle_index_series() + sage: c = L(lambda n: C[n]) + sage: Lplus = L(lambda n: p([1]*n), valuation=1) + sage: r = c.arithmetic_product(Lplus); r m[1] + (3*m[1,1]+2*m[2]) + (8*m[1,1,1]+4*m[2,1]+2*m[3]) + (42*m[1,1,1,1]+21*m[2,1,1]+12*m[2,2]+7*m[3,1]+3*m[4]) @@ -6128,7 +6156,7 @@ def arithmetic_product(self, *args, check=True): In particular, the number of regular octopuses is:: - sage: [r[n].coefficient([1]*n) for n in range(8)] # optional - sage.modules + sage: [r[n].coefficient([1]*n) for n in range(8)] # needs sage.modules [0, 1, 3, 8, 42, 144, 1440, 5760] It is shown in [MM2008]_ that the exponential generating @@ -6136,7 +6164,7 @@ def arithmetic_product(self, *args, check=True): (x) = \sum_{n \geq 1} \sigma (n) (n - 1)! \frac{x^{n}}{n!}` (where `\sigma (n)` is the sum of the divisors of `n`). :: - sage: [sum(divisors(i))*factorial(i-1) for i in range(1,8)] # optional - sage.modules + sage: [sum(divisors(i))*factorial(i-1) for i in range(1,8)] # needs sage.modules [1, 3, 8, 42, 144, 1440, 5760] AUTHORS: @@ -6151,37 +6179,38 @@ def arithmetic_product(self, *args, check=True): Check that the product with zero works:: - sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules - sage: L = LazySymmetricFunctions(s) # optional - sage.modules - sage: L(0).arithmetic_product(s[2]) # optional - sage.modules + sage: # needs sage.modules + sage: s = SymmetricFunctions(QQ).s() + sage: L = LazySymmetricFunctions(s) + sage: L(0).arithmetic_product(s[2]) 0 - sage: L(s[2]).arithmetic_product(0) # optional - sage.modules + sage: L(s[2]).arithmetic_product(0) 0 Check that the arithmetic product of symmetric functions of finite support works:: - sage: L(s([2])).arithmetic_product(s([1,1,1])) # optional - sage.modules + sage: L(s([2])).arithmetic_product(s([1,1,1])) # needs sage.modules s[2, 2, 1, 1] + s[3, 1, 1, 1] + s[3, 2, 1] + s[3, 3] + 2*s[4, 1, 1] - sage: f = 1/(1-L(s[1])) # optional - sage.modules - sage: f.arithmetic_product(s[1]) - f # optional - sage.modules + sage: f = 1/(1-L(s[1])) # needs sage.modules + sage: f.arithmetic_product(s[1]) - f # needs sage.modules O^7 Check that the arithmetic product of symmetric functions with constant a term works as advertised:: - sage: p = SymmetricFunctions(QQ).p() # optional - sage.modules - sage: L = LazySymmetricFunctions(p) # optional - sage.modules - sage: L(5).arithmetic_product(3*p[2,1]) # optional - sage.modules + sage: p = SymmetricFunctions(QQ).p() # needs sage.modules + sage: L = LazySymmetricFunctions(p) # needs sage.modules + sage: L(5).arithmetic_product(3*p[2,1]) # needs sage.modules 15*p[] Check the arithmetic product of symmetric functions over a finite field works:: - sage: s = SymmetricFunctions(FiniteField(2)).s() # optional - sage.modules - sage: L = LazySymmetricFunctions(s) # optional - sage.modules - sage: L(s([2])).arithmetic_product(s([1,1,1])) # optional - sage.modules + sage: s = SymmetricFunctions(FiniteField(2)).s() # needs sage.modules + sage: L = LazySymmetricFunctions(s) # needs sage.modules + sage: L(s([2])).arithmetic_product(s([1,1,1])) # needs sage.modules s[2, 2, 1, 1] + s[3, 1, 1, 1] + s[3, 2, 1] + s[3, 3] """ @@ -6278,36 +6307,39 @@ def symmetric_function(self, degree=None): EXAMPLES:: - sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules - sage: S = LazySymmetricFunctions(s) # optional - sage.modules - sage: elt = S(s[2]) # optional - sage.modules - sage: elt.symmetric_function() # optional - sage.modules + sage: # needs sage.modules + sage: s = SymmetricFunctions(QQ).s() + sage: S = LazySymmetricFunctions(s) + sage: elt = S(s[2]) + sage: elt.symmetric_function() s[2] TESTS:: - sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules - sage: S = LazySymmetricFunctions(s) # optional - sage.modules - sage: elt = S(s[2]) # optional - sage.modules - sage: elt.symmetric_function() # optional - sage.modules + sage: # needs sage.modules + sage: s = SymmetricFunctions(QQ).s() + sage: S = LazySymmetricFunctions(s) + sage: elt = S(s[2]) + sage: elt.symmetric_function() s[2] - sage: f = 1 / (1 - elt) # optional - sage.modules - sage: f # optional - sage.modules + sage: f = 1 / (1 - elt) + sage: f s[] + s[2] + (s[2,2]+s[3,1]+s[4]) + (s[2,2,2]+2*s[3,2,1]+s[3,3]+s[4,1,1]+3*s[4,2]+2*s[5,1]+s[6]) + O^7 - sage: f.symmetric_function() # optional - sage.modules + sage: f.symmetric_function() Traceback (most recent call last): ... ValueError: not a symmetric function - sage: f4 = f.truncate(5); f4 # optional - sage.modules + sage: # needs sage.modules + sage: f4 = f.truncate(5); f4 s[] + s[2] + (s[2,2]+s[3,1]+s[4]) - sage: f4.symmetric_function() # optional - sage.modules + sage: f4.symmetric_function() s[] + s[2] + s[2, 2] + s[3, 1] + s[4] - sage: f4.symmetric_function() == f.symmetric_function(4) # optional - sage.modules + sage: f4.symmetric_function() == f.symmetric_function(4) True - sage: S.zero().symmetric_function() # optional - sage.modules + sage: S.zero().symmetric_function() 0 - sage: f4.symmetric_function(0) # optional - sage.modules + sage: f4.symmetric_function(0) s[] """ @@ -6337,15 +6369,15 @@ class LazyDirichletSeries(LazyModuleElement): sage: L = LazyDirichletSeriesRing(ZZ, "z") sage: f = L(constant=1)^2 - sage: f # optional - sage.symbolic + sage: f # needs sage.symbolic 1 + 2/2^z + 2/3^z + 3/4^z + 2/5^z + 4/6^z + 2/7^z + O(1/(8^z)) - sage: f.coefficient(100) == number_of_divisors(100) # optional - sage.libs.pari + sage: f.coefficient(100) == number_of_divisors(100) # needs sage.libs.pari True Lazy Dirichlet series is picklable:: sage: g = loads(dumps(f)) - sage: g # optional - sage.symbolic + sage: g # needs sage.symbolic 1 + 2/2^z + 2/3^z + 3/4^z + 2/5^z + 4/6^z + 2/7^z + O(1/(8^z)) sage: g == f True @@ -6385,9 +6417,9 @@ def valuation(self): EXAMPLES:: sage: L = LazyDirichletSeriesRing(ZZ, "z") - sage: mu = L(moebius); mu.valuation() # optional - sage.libs.pari + sage: mu = L(moebius); mu.valuation() # needs sage.libs.pari 0 - sage: (mu - mu).valuation() # optional - sage.libs.pari + sage: (mu - mu).valuation() # needs sage.libs.pari +Infinity sage: g = L(constant=1, valuation=2) sage: g.valuation() @@ -6412,36 +6444,36 @@ def _mul_(self, other): sage: D = LazyDirichletSeriesRing(QQ, "s") sage: zeta = D(constant=1) - sage: zeta # optional - sage.symbolic + sage: zeta # needs sage.symbolic 1 + 1/(2^s) + 1/(3^s) + O(1/(4^s)) - sage: zeta * zeta # optional - sage.symbolic + sage: zeta * zeta # needs sage.symbolic 1 + 2/2^s + 2/3^s + 3/4^s + 2/5^s + 4/6^s + 2/7^s + O(1/(8^s)) sage: [number_of_divisors(n) for n in range(1, 8)] [1, 2, 2, 3, 2, 4, 2] sage: mu = D(moebius) - sage: mu # optional - sage.symbolic + sage: mu # needs sage.symbolic 1 - 1/(2^s) - 1/(3^s) - 1/(5^s) + 1/(6^s) - 1/(7^s) + O(1/(8^s)) - sage: zeta * mu # optional - sage.symbolic + sage: zeta * mu # needs sage.symbolic 1 + O(1/(8^s)) sage: D.one() * mu is mu True sage: mu * D.one() is mu True - sage: zeta*(2-zeta) # optional - sage.symbolic + sage: zeta*(2-zeta) # needs sage.symbolic 1 - 1/(4^s) - 2/6^s + O(1/(8^s)) sage: d1 = D([0,0,1,2,3]) sage: d2 = D([0,1,2,3]) - sage: d1 * d2 # optional - sage.symbolic + sage: d1 * d2 # needs sage.symbolic 1/(6^s) + 2/8^s + 2/9^s + 3/10^s + 7/12^s + O(1/(13^s)) - sage: d1 * d2 # not tested - exact result # optional - sage.symbolic + sage: d1 * d2 # not tested # needs sage.symbolic 1/(6^s) + 2/8^s + 2/9^s + 3/10^s + 7/12^s + 6/15^s + 6/16^s + 9/20^s sage: L. = LazyLaurentSeriesRing(D) - sage: 1/(1-t*zeta) # optional - sage.symbolic + sage: 1/(1-t*zeta) # needs sage.symbolic (1 + O(1/(8^s))) + (1 + 1/(2^s) + 1/(3^s) + 1/(4^s) + 1/(5^s) + 1/(6^s) + 1/(7^s) + O(1/(8^s)))*t + (1 + 2/2^s + 2/3^s + 3/4^s + 2/5^s + 4/6^s + 2/7^s + O(1/(8^s)))*t^2 @@ -6555,7 +6587,7 @@ def __call__(self, p, *, check=True): Infinity sage: f = D([1,2,-3,-4], valuation=2) - sage: f # optional - sage.symbolic + sage: f # needs sage.symbolic 1/(2^s) + 2/3^s - 3/4^s - 4/5^s sage: f(2) 449/3600 @@ -6625,22 +6657,22 @@ def _format_series(self, formatter, format_strings=False): sage: L = LazyDirichletSeriesRing(QQ, "s") sage: f = L(constant=1) - sage: f._format_series(repr) # optional - sage.symbolic + sage: f._format_series(repr) # needs sage.symbolic '1 + 1/(2^s) + 1/(3^s) + O(1/(4^s))' - sage: f._format_series(unicode_art) # optional - sage.symbolic + sage: f._format_series(unicode_art) # needs sage.symbolic -s -s 1 + 2 + 3 + O(1/(4^s)) - sage: L([1,-1,1])._format_series(repr) # optional - sage.symbolic + sage: L([1,-1,1])._format_series(repr) # needs sage.symbolic '1 - 1/(2^s) + 1/(3^s)' - sage: L([1,-1,1])._format_series(ascii_art) # optional - sage.symbolic + sage: L([1,-1,1])._format_series(ascii_art) # needs sage.symbolic -s -s 1 + -2 + 3 sage: R. = QQ[] sage: L = LazyDirichletSeriesRing(R, "s") - sage: L([1,-1 + x,1/3])._format_series(ascii_art) # optional - sage.symbolic + sage: L([1,-1 + x,1/3])._format_series(ascii_art) # needs sage.symbolic ( -s) (3 ) ( -s ) (---) @@ -6649,9 +6681,9 @@ def _format_series(self, formatter, format_strings=False): sage: L. = LazyLaurentSeriesRing(QQ) sage: D = LazyDirichletSeriesRing(L, "s") sage: f = D([2, 0, 1/(1-z), 3]) - sage: f # optional - sage.symbolic + sage: f # needs sage.symbolic (2)/1^s + ((1+z+z^2+O(z^3))/3^s) + (3)/4^s - sage: f._format_series(ascii_art) # optional - sage.symbolic + sage: f._format_series(ascii_art) # needs sage.symbolic ((2)/1^s) + ((1 + z + z^2 + O(z^3))/3^s) + ((3)/4^s) """ P = self.parent() diff --git a/src/sage/rings/lazy_series_ring.py b/src/sage/rings/lazy_series_ring.py index e105188d7fe..07ea18fafa0 100644 --- a/src/sage/rings/lazy_series_ring.py +++ b/src/sage/rings/lazy_series_ring.py @@ -155,10 +155,10 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No If ``x`` can be converted into an element of the underlying Laurent polynomial ring, we do this:: - sage: L = LazyLaurentSeriesRing(GF(2), 'z') # optional - sage.rings.finite_rings - sage: L(2) # optional - sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings + sage: L(2) # needs sage.rings.finite_rings 0 - sage: L(3) # optional - sage.rings.finite_rings + sage: L(3) # needs sage.rings.finite_rings 1 In particular, ``x`` can be a Laurent polynomial:: @@ -287,21 +287,22 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No Converting various series from a univariate power series:: - sage: L = LazyLaurentSeriesRing(GF(2), 'z') # optional - sage.rings.finite_rings - sage: R = LazyPowerSeriesRing(ZZ, 'z') # optional - sage.rings.finite_rings - sage: L.has_coerce_map_from(R) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(2), 'z') + sage: R = LazyPowerSeriesRing(ZZ, 'z') + sage: L.has_coerce_map_from(R) True - sage: L(R(lambda n: n)) # optional - sage.rings.finite_rings + sage: L(R(lambda n: n)) z + z^3 + z^5 + z^7 + O(z^8) - sage: L(R([2,4,6])) == L.zero() # optional - sage.rings.finite_rings + sage: L(R([2,4,6])) == L.zero() True - sage: L(R([2,4,6], valuation=2, constant=4)) == L.zero() # optional - sage.rings.finite_rings + sage: L(R([2,4,6], valuation=2, constant=4)) == L.zero() True - sage: L(R([2,4,6], valuation=2, constant=5)) # optional - sage.rings.finite_rings + sage: L(R([2,4,6], valuation=2, constant=5)) z^5 + z^6 + z^7 + O(z^8) - sage: L(R([2,3,4], valuation=2, constant=4)) # optional - sage.rings.finite_rings + sage: L(R([2,3,4], valuation=2, constant=4)) z^3 - sage: L(R([2,3,4], valuation=2, constant=5)) # optional - sage.rings.finite_rings + sage: L(R([2,3,4], valuation=2, constant=5)) z^3 + z^5 + z^6 + z^7 + O(z^8) Can only convert from known to be constant multivariate power series:: @@ -712,9 +713,9 @@ def one(self): sage: L.one() 1 - sage: m = SymmetricFunctions(ZZ).m() # optional - sage.modules - sage: L = LazySymmetricFunctions(m) # optional - sage.modules - sage: L.one() # optional - sage.modules + sage: m = SymmetricFunctions(ZZ).m() # needs sage.modules + sage: L = LazySymmetricFunctions(m) # needs sage.modules + sage: L.one() # needs sage.modules m[] """ @@ -733,9 +734,9 @@ def zero(self): sage: L.zero() 0 - sage: s = SymmetricFunctions(ZZ).s() # optional - sage.modules - sage: L = LazySymmetricFunctions(s) # optional - sage.modules - sage: L.zero() # optional - sage.modules + sage: s = SymmetricFunctions(ZZ).s() # needs sage.modules + sage: L = LazySymmetricFunctions(s) # needs sage.modules + sage: L.zero() # needs sage.modules 0 sage: L = LazyDirichletSeriesRing(ZZ, 'z') @@ -759,14 +760,14 @@ def characteristic(self): sage: L.characteristic() 0 - sage: R. = LazyLaurentSeriesRing(GF(11)); R # optional - sage.rings.finite_rings + sage: R. = LazyLaurentSeriesRing(GF(11)); R # needs sage.rings.finite_rings Lazy Laurent Series Ring in w over Finite Field of size 11 - sage: R.characteristic() # optional - sage.rings.finite_rings + sage: R.characteristic() # needs sage.rings.finite_rings 11 - sage: R. = LazyPowerSeriesRing(GF(7)); R # optional - sage.rings.finite_rings + sage: R. = LazyPowerSeriesRing(GF(7)); R # needs sage.rings.finite_rings Multivariate Lazy Taylor Series Ring in x, y over Finite Field of size 7 - sage: R.characteristic() # optional - sage.rings.finite_rings + sage: R.characteristic() # needs sage.rings.finite_rings 7 sage: L = LazyDirichletSeriesRing(ZZ, "s") @@ -781,13 +782,13 @@ def _coerce_map_from_(self, S): EXAMPLES:: - sage: L = LazyLaurentSeriesRing(GF(2), 'z') # optional - sage.rings.finite_rings - sage: L.has_coerce_map_from(ZZ) # optional - sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings + sage: L.has_coerce_map_from(ZZ) # needs sage.rings.finite_rings True - sage: L.has_coerce_map_from(GF(2)) # optional - sage.rings.finite_rings + sage: L.has_coerce_map_from(GF(2)) # needs sage.rings.finite_rings True sage: R = LazyPowerSeriesRing(ZZ, 'z') - sage: L.has_coerce_map_from(R) # optional - sage.rings.finite_rings + sage: L.has_coerce_map_from(R) # needs sage.rings.finite_rings True sage: L = LazyLaurentSeriesRing(QQ, 'z') @@ -801,17 +802,18 @@ def _coerce_map_from_(self, S): sage: L.has_coerce_map_from(R) False - sage: L = LazyPowerSeriesRing(GF(2), 'z') # optional - sage.rings.finite_rings - sage: L.has_coerce_map_from(ZZ) # optional - sage.rings.finite_rings + sage: L = LazyPowerSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings + sage: L.has_coerce_map_from(ZZ) # needs sage.rings.finite_rings True - sage: L.has_coerce_map_from(GF(2)) # optional - sage.rings.finite_rings + sage: L.has_coerce_map_from(GF(2)) # needs sage.rings.finite_rings True - sage: s = SymmetricFunctions(GF(2)).s() # optional - sage.modules sage.rings.finite_rings - sage: L = LazySymmetricFunctions(s) # optional - sage.modules sage.rings.finite_rings - sage: L.has_coerce_map_from(ZZ) # optional - sage.modules sage.rings.finite_rings + sage: # needs sage.modules sage.rings.finite_rings + sage: s = SymmetricFunctions(GF(2)).s() + sage: L = LazySymmetricFunctions(s) + sage: L.has_coerce_map_from(ZZ) True - sage: L.has_coerce_map_from(GF(2)) # optional - sage.modules sage.rings.finite_rings + sage: L.has_coerce_map_from(GF(2)) True """ if self.base_ring().has_coerce_map_from(S): @@ -845,13 +847,13 @@ def _coerce_map_from_base_ring(self): sage: L = LazyDirichletSeriesRing(QQ, 'z') sage: phi = L._coerce_map_from_base_ring() sage: m = phi(2) - sage: m # optional - sage.symbolic + sage: m # needs sage.symbolic 2 sage: m = phi(2, valuation=2) - sage: m # optional - sage.symbolic + sage: m # needs sage.symbolic 2/2^z sage: m = phi(2, valuation=2, constant=4) - sage: m # optional - sage.symbolic + sage: m # needs sage.symbolic 2/2^z + 4/3^z + 4/4^z + 4/5^z + O(1/(6^z)) """ # Return a DefaultConvertMap_unique; this can pass additional @@ -1050,12 +1052,13 @@ class LazyLaurentSeriesRing(LazySeriesRing): Lazy Laurent series ring over a finite field:: - sage: L. = LazyLaurentSeriesRing(GF(3)); L # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: L. = LazyLaurentSeriesRing(GF(3)); L Lazy Laurent Series Ring in z over Finite Field of size 3 - sage: e = 1 / (1 + z) # optional - sage.rings.finite_rings - sage: e.coefficient(100) # optional - sage.rings.finite_rings + sage: e = 1 / (1 + z) + sage: e.coefficient(100) 1 - sage: e.coefficient(100).parent() # optional - sage.rings.finite_rings + sage: e.coefficient(100).parent() Finite Field of size 3 Series can be defined by specifying a coefficient function @@ -1197,21 +1200,21 @@ def __init__(self, base_ring, names, sparse=True, category=None): and Category of infinite sets sage: L = LazyLaurentSeriesRing(ZZ['x, y'], 't') - sage: TestSuite(L).run() # optional - sage.libs.singular + sage: TestSuite(L).run() # needs sage.libs.singular sage: L.category() Category of infinite commutative no zero divisors algebras over (unique factorization domains and commutative algebras over (euclidean domains and infinite enumerated sets and metric spaces) and infinite sets) - sage: L = LazyLaurentSeriesRing(GF(5), 't') # optional - sage.rings.finite_rings - sage: TestSuite(L).run() # optional - sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(5), 't') # needs sage.rings.finite_rings + sage: TestSuite(L).run() # needs sage.rings.finite_rings - sage: L = LazyLaurentSeriesRing(GF(5)['x'], 't') # optional - sage.rings.finite_rings - sage: TestSuite(L).run() # optional - sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(5)['x'], 't') # needs sage.rings.finite_rings + sage: TestSuite(L).run() # needs sage.rings.finite_rings - sage: L = LazyLaurentSeriesRing(GF(5)['x, y'], 't') # optional - sage.rings.finite_rings - sage: TestSuite(L).run() # optional - sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(5)['x, y'], 't') # needs sage.rings.finite_rings + sage: TestSuite(L).run() # needs sage.rings.finite_rings sage: L = LazyLaurentSeriesRing(Zmod(6), 't') sage: TestSuite(L).run(skip=['_test_revert']) @@ -1220,8 +1223,8 @@ def __init__(self, base_ring, names, sparse=True, category=None): (finite commutative rings and subquotients of monoids and quotients of semigroups and finite enumerated sets) - sage: E. = ExteriorAlgebra(QQ) # optional - sage.modules - sage: L = LazyLaurentSeriesRing(E, 't') # not tested # optional - sage.modules + sage: E. = ExteriorAlgebra(QQ) # needs sage.modules + sage: L = LazyLaurentSeriesRing(E, 't') # not tested # needs sage.modules sage: LazyLaurentSeriesRing.options._reset() # reset the options """ @@ -1254,7 +1257,7 @@ def _repr_(self): EXAMPLES:: - sage: LazyLaurentSeriesRing(GF(2), 'z') # optional - sage.rings.finite_rings + sage: LazyLaurentSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings Lazy Laurent Series Ring in z over Finite Field of size 2 """ return "Lazy Laurent Series Ring in {} over {}".format(self.variable_name(), self.base_ring()) @@ -1265,8 +1268,8 @@ def _latex_(self): EXAMPLES:: - sage: L = LazyLaurentSeriesRing(GF(2), 'z') # optional - sage.rings.finite_rings - sage: latex(L) # optional - sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings + sage: latex(L) # needs sage.rings.finite_rings \Bold{F}_{2} (\!(z)\!) """ from sage.misc.latex import latex @@ -1351,16 +1354,16 @@ def some_elements(self): -2*z^-3 - 2*z^-2 + 4*z^-1 + 11 - z - 34*z^2 - 31*z^3 + O(z^4), 4*z^-2 + z^-1 + z + 4*z^2 + 9*z^3 + 16*z^4 + O(z^5)] - sage: L = LazyLaurentSeriesRing(GF(2), 'z') # optional - sage.rings.finite_rings - sage: L.some_elements()[:7] # optional - sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings + sage: L.some_elements()[:7] # needs sage.rings.finite_rings [0, 1, z, z^-4 + z^-3 + z^2 + z^3, z^-2, 1 + z + z^3 + z^4 + z^6 + O(z^7), z^-1 + z + z^3 + O(z^5)] - sage: L = LazyLaurentSeriesRing(GF(3), 'z') # optional - sage.rings.finite_rings - sage: L.some_elements()[:7] # optional - sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(3), 'z') # needs sage.rings.finite_rings + sage: L.some_elements()[:7] # needs sage.rings.finite_rings [0, 1, z, z^-3 + z^-1 + 2 + z + z^2 + z^3, z^-2, @@ -1603,7 +1606,7 @@ def euler(self): sage: P = 1 / phi; P 1 + q + 2*q^2 + 3*q^3 + 5*q^4 + 7*q^5 + 11*q^6 + O(q^7) - sage: P[:20] == [Partitions(n).cardinality() for n in range(20)] # optional - sage.libs.flint + sage: P[:20] == [Partitions(n).cardinality() for n in range(20)] # needs sage.libs.flint True TESTS:: @@ -1668,11 +1671,11 @@ def __init__(self, base_ring, names, sparse=True, category=None): sage: L = LazyPowerSeriesRing(QQ, 's, t') sage: TestSuite(L).run(skip="_test_fraction_field") - sage: L = LazyPowerSeriesRing(GF(5), 't') # optional - sage.rings.finite_rings - sage: TestSuite(L).run() # optional - sage.rings.finite_rings + sage: L = LazyPowerSeriesRing(GF(5), 't') # needs sage.rings.finite_rings + sage: TestSuite(L).run() # needs sage.rings.finite_rings - sage: L = LazyPowerSeriesRing(GF(5), 's, t') # optional - sage.rings.finite_rings - sage: TestSuite(L).run(skip=['_test_fraction_field']) # optional - sage.rings.finite_rings + sage: L = LazyPowerSeriesRing(GF(5), 's, t') # needs sage.rings.finite_rings + sage: TestSuite(L).run(skip=['_test_fraction_field']) # needs sage.rings.finite_rings sage: L = LazyPowerSeriesRing(Zmod(6), 't') sage: TestSuite(L).run(skip=['_test_revert']) @@ -1754,7 +1757,7 @@ def _repr_(self): EXAMPLES:: - sage: LazyPowerSeriesRing(GF(2), 'z') # optional - sage.rings.finite_rings + sage: LazyPowerSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings Lazy Taylor Series Ring in z over Finite Field of size 2 """ BR = self.base_ring() @@ -1769,8 +1772,8 @@ def _latex_(self): EXAMPLES:: - sage: L = LazyPowerSeriesRing(GF(2), 'z') # optional - sage.rings.finite_rings - sage: latex(L) # optional - sage.rings.finite_rings + sage: L = LazyPowerSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings + sage: latex(L) # needs sage.rings.finite_rings \Bold{F}_{2} [\![z]\!] """ from sage.misc.latex import latex @@ -1868,10 +1871,10 @@ def _element_constructor_(self, x=None, valuation=None, constant=None, degree=No EXAMPLES:: - sage: L = LazyPowerSeriesRing(GF(2), 'z') # optional - sage.rings.finite_rings - sage: L(2) # optional - sage.rings.finite_rings + sage: L = LazyPowerSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings + sage: L(2) # needs sage.rings.finite_rings 0 - sage: L(3) # optional - sage.rings.finite_rings + sage: L(3) # needs sage.rings.finite_rings 1 sage: L = LazyPowerSeriesRing(ZZ, 'z') @@ -1937,11 +1940,11 @@ def _element_constructor_(self, x=None, valuation=None, constant=None, degree=No (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) # optional - sage.libs.singular + sage: L(f) # needs sage.libs.singular 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) # optional - sage.libs.singular + sage: L(f) == (1 + aa + bb) / (1 + aa*bb + cc^3) # needs sage.libs.singular True TESTS:: @@ -2190,15 +2193,15 @@ def some_elements(self): 1 + z - 2*z^2 - 7*z^3 - z^4 + 20*z^5 + 23*z^6 + O(z^7), z + 4*z^2 + 9*z^3 + 16*z^4 + 25*z^5 + 36*z^6 + O(z^7)] - sage: L = LazyPowerSeriesRing(GF(3)["q"], 'z') # optional - sage.rings.finite_rings - sage: L.some_elements()[:6] # optional - sage.rings.finite_rings + sage: L = LazyPowerSeriesRing(GF(3)["q"], 'z') # needs sage.rings.finite_rings + sage: L.some_elements()[:6] # needs sage.rings.finite_rings [0, 1, z + q*z^2 + q*z^3 + q*z^4 + O(z^5), z + z^2 + z^3, 1 + z + z^2 + 2*z^3 + 2*z^4 + 2*z^5 + O(z^6), z + z^2 + z^4 + z^5 + O(z^7)] - sage: L = LazyPowerSeriesRing(GF(3), 'q, t') # optional - sage.rings.finite_rings - sage: L.some_elements()[:6] # optional - sage.rings.finite_rings + sage: L = LazyPowerSeriesRing(GF(3), 'q, t') # needs sage.rings.finite_rings + sage: L.some_elements()[:6] # needs sage.rings.finite_rings [0, 1, q, q + q^2 + q^3, 1 + q + q^2 + (-q^3) + (-q^4) + (-q^5) + (-q^6) + O(q,t)^7, @@ -2237,26 +2240,27 @@ class LazyCompletionGradedAlgebra(LazySeriesRing): EXAMPLES:: - sage: NCSF = NonCommutativeSymmetricFunctions(QQ) # optional - sage.modules - sage: S = NCSF.Complete() # optional - sage.modules - sage: L = S.formal_series_ring(); L # optional - sage.modules + sage: NCSF = NonCommutativeSymmetricFunctions(QQ) # needs sage.modules + sage: S = NCSF.Complete() # needs sage.modules + sage: L = S.formal_series_ring(); L # needs sage.modules Lazy completion of Non-Commutative Symmetric Functions over the Rational Field in the Complete basis - sage: f = 1 / (1 - L(S[1])); f # optional - sage.modules + sage: # needs sage.modules + sage: f = 1 / (1 - L(S[1])); f S[] + S[1] + (S[1,1]) + (S[1,1,1]) + (S[1,1,1,1]) + (S[1,1,1,1,1]) + (S[1,1,1,1,1,1]) + O^7 - sage: g = 1 / (1 - L(S[2])); g # optional - sage.modules + sage: g = 1 / (1 - L(S[2])); g S[] + S[2] + (S[2,2]) + (S[2,2,2]) + O^7 - sage: f * g # optional - sage.modules + sage: f * g S[] + S[1] + (S[1,1]+S[2]) + (S[1,1,1]+S[1,2]) + (S[1,1,1,1]+S[1,1,2]+S[2,2]) + (S[1,1,1,1,1]+S[1,1,1,2]+S[1,2,2]) + (S[1,1,1,1,1,1]+S[1,1,1,1,2]+S[1,1,2,2]+S[2,2,2]) + O^7 - sage: g * f # optional - sage.modules + sage: g * f S[] + S[1] + (S[1,1]+S[2]) + (S[1,1,1]+S[2,1]) + (S[1,1,1,1]+S[2,1,1]+S[2,2]) + (S[1,1,1,1,1]+S[2,1,1,1]+S[2,2,1]) + (S[1,1,1,1,1,1]+S[2,1,1,1,1]+S[2,2,1,1]+S[2,2,2]) + O^7 - sage: f * g - g * f # optional - sage.modules + sage: f * g - g * f (S[1,2]-S[2,1]) + (S[1,1,2]-S[2,1,1]) + (S[1,1,1,2]+S[1,2,2]-S[2,1,1,1]-S[2,2,1]) + (S[1,1,1,1,2]+S[1,1,2,2]-S[2,1,1,1,1]-S[2,2,1,1]) + O^7 @@ -2271,23 +2275,23 @@ def __init__(self, basis, sparse=True, category=None): sage: LazySymmetricFunctions.options.halting_precision(6) - sage: s = SymmetricFunctions(QQ).s() # optional - sage.modules - sage: L = LazySymmetricFunctions(s) # optional - sage.modules - sage: TestSuite(L).run() # optional - sage.modules + sage: s = SymmetricFunctions(QQ).s() # needs sage.modules + sage: L = LazySymmetricFunctions(s) # needs sage.modules + sage: TestSuite(L).run() # needs sage.modules - sage: p = SymmetricFunctions(GF(5)).p() # optional - sage.modules sage.rings.finite_rings - sage: L = LazySymmetricFunctions(p) # optional - sage.modules sage.rings.finite_rings - sage: TestSuite(L).run() # optional - sage.modules sage.rings.finite_rings + sage: p = SymmetricFunctions(GF(5)).p() # needs sage.modules sage.rings.finite_rings + sage: L = LazySymmetricFunctions(p) # needs sage.modules sage.rings.finite_rings + sage: TestSuite(L).run() # needs sage.modules sage.rings.finite_rings Reversion will only work when the base ring is a field:: - sage: s = SymmetricFunctions(ZZ).s() # optional - sage.modules - sage: L = LazySymmetricFunctions(s) # optional - sage.modules - sage: TestSuite(L).run(skip=['_test_revert']) # optional - sage.modules + sage: s = SymmetricFunctions(ZZ).s() # needs sage.modules + sage: L = LazySymmetricFunctions(s) # needs sage.modules + sage: TestSuite(L).run(skip=['_test_revert']) # needs sage.modules - sage: s = SymmetricFunctions(QQ["q"]).s() # optional - sage.modules - sage: L = LazySymmetricFunctions(s) # optional - sage.modules - sage: TestSuite(L).run(skip=['_test_revert']) # optional - sage.modules + sage: s = SymmetricFunctions(QQ["q"]).s() # needs sage.modules + sage: L = LazySymmetricFunctions(s) # needs sage.modules + sage: TestSuite(L).run(skip=['_test_revert']) # needs sage.modules Options are remembered across doctests:: @@ -2296,15 +2300,15 @@ def __init__(self, basis, sparse=True, category=None): Check that :trac:`34470` is fixed. The ideal generated by `p[1]` and `p[2]` is not principal:: - sage: p = SymmetricFunctions(QQ).p() # optional - sage.modules - sage: L = LazySymmetricFunctions(s) # optional - sage.modules - sage: L in PrincipalIdealDomains # optional - sage.modules + sage: p = SymmetricFunctions(QQ).p() # needs sage.modules + sage: L = LazySymmetricFunctions(s) # needs sage.modules + sage: L in PrincipalIdealDomains # needs sage.modules False Check that a basis which is not graded is not enough:: - sage: ht = SymmetricFunctions(ZZ).ht() # optional - sage.modules - sage: L = LazySymmetricFunctions(ht) # optional - sage.modules + sage: ht = SymmetricFunctions(ZZ).ht() # needs sage.modules + sage: L = LazySymmetricFunctions(ht) # needs sage.modules Traceback (most recent call last): ... ValueError: basis should be in GradedAlgebrasWithBasis @@ -2343,8 +2347,8 @@ def _repr_(self): EXAMPLES:: - sage: s = SymmetricFunctions(GF(2)).s() # optional - sage.modules sage.rings.finite_rings - sage: LazySymmetricFunctions(s) # optional - sage.modules sage.rings.finite_rings + sage: s = SymmetricFunctions(GF(2)).s() # needs sage.modules sage.rings.finite_rings + sage: LazySymmetricFunctions(s) # needs sage.modules sage.rings.finite_rings Lazy completion of Symmetric Functions over Finite Field of size 2 in the Schur basis """ return "Lazy completion of {}".format(self._laurent_poly_ring) @@ -2355,9 +2359,9 @@ def _latex_(self): EXAMPLES:: - sage: s = SymmetricFunctions(GF(2)).s() # optional - sage.modules sage.rings.finite_rings - sage: L = LazySymmetricFunctions(s) # optional - sage.modules sage.rings.finite_rings - sage: latex(L) # optional - sage.modules sage.rings.finite_rings + sage: s = SymmetricFunctions(GF(2)).s() # needs sage.modules sage.rings.finite_rings + sage: L = LazySymmetricFunctions(s) # needs sage.modules sage.rings.finite_rings + sage: latex(L) # needs sage.modules sage.rings.finite_rings \text{\texttt{Symmetric{ }Functions{ }over{ }Finite{ }Field{ }of{ }size{ }2{ }in{ }the{ }Schur{ }basis}} """ from sage.misc.latex import latex @@ -2369,10 +2373,11 @@ def _monomial(self, c, n): EXAMPLES:: - sage: m = SymmetricFunctions(ZZ).m() # optional - sage.modules - sage: s = SymmetricFunctions(ZZ).s() # optional - sage.modules - sage: L = LazySymmetricFunctions(m) # optional - sage.modules - sage: L._monomial(s[2,1], 3) # optional - sage.modules + sage: # needs sage.modules + sage: m = SymmetricFunctions(ZZ).m() + sage: s = SymmetricFunctions(ZZ).s() + sage: L = LazySymmetricFunctions(m) + sage: L._monomial(s[2,1], 3) 2*m[1, 1, 1] + m[2, 1] """ L = self._laurent_poly_ring @@ -2394,62 +2399,65 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No EXAMPLES:: - sage: m = SymmetricFunctions(GF(2)).m() # optional - sage.modules sage.rings.finite_rings - sage: L = LazySymmetricFunctions(m) # optional - sage.modules sage.rings.finite_rings - sage: L(2) # optional - sage.modules sage.rings.finite_rings + sage: # needs sage.modules sage.rings.finite_rings + sage: m = SymmetricFunctions(GF(2)).m() + sage: L = LazySymmetricFunctions(m) + sage: L(2) 0 - sage: L(3) # optional - sage.modules sage.rings.finite_rings + sage: L(3) m[] - sage: m = SymmetricFunctions(ZZ).m() # optional - sage.modules - sage: L = LazySymmetricFunctions(m) # optional - sage.modules - sage: f = L(lambda i: m([i]), valuation=5, degree=10); f # optional - sage.modules + sage: m = SymmetricFunctions(ZZ).m() # needs sage.modules + sage: L = LazySymmetricFunctions(m) # needs sage.modules + sage: f = L(lambda i: m([i]), valuation=5, degree=10); f # needs sage.modules m[5] + m[6] + m[7] + m[8] + m[9] - sage: f.coefficient(6) # optional - sage.modules + sage: f.coefficient(6) # needs sage.modules m[6] - sage: f[20] # optional - sage.modules + sage: f[20] # needs sage.modules 0 Alternatively, ``x`` can be a list of elements of the base ring. Then these elements are read as coefficients of the terms of degrees starting from the ``valuation``:: - sage: f = L([m[1],m[2],m[3]], valuation=1); f # optional - sage.modules + sage: f = L([m[1],m[2],m[3]], valuation=1); f # needs sage.modules m[1] + m[2] + m[3] Finally, ``x`` can be a symmetric function:: - sage: m = SymmetricFunctions(ZZ).m() # optional - sage.modules - sage: s = SymmetricFunctions(ZZ).s() # optional - sage.modules - sage: L = LazySymmetricFunctions(m) # optional - sage.modules - sage: L(s.an_element()) # optional - sage.modules + sage: # needs sage.modules + sage: m = SymmetricFunctions(ZZ).m() + sage: s = SymmetricFunctions(ZZ).s() + sage: L = LazySymmetricFunctions(m) + sage: L(s.an_element()) 2*m[] + 2*m[1] + (3*m[1,1]+3*m[2]) TESTS:: - sage: e = SymmetricFunctions(ZZ).e() # optional - sage.modules - sage: h = SymmetricFunctions(ZZ).h() # optional - sage.modules - sage: L = LazySymmetricFunctions(tensor([h, e])) # optional - sage.modules - sage: L(lambda n: 0) # optional - sage.modules + sage: # needs sage.modules + sage: e = SymmetricFunctions(ZZ).e() + sage: h = SymmetricFunctions(ZZ).h() + sage: L = LazySymmetricFunctions(tensor([h, e])) + sage: L(lambda n: 0) O^7 - sage: L(lambda n: tensor([h[n], e([])]) + tensor([h([]), e[n]]), degree=3) # optional - sage.modules + sage: L(lambda n: tensor([h[n], e([])]) + tensor([h([]), e[n]]), degree=3) # needs sage.modules (2*h[]#e[]) + (h[]#e[1]+h[1]#e[]) + (h[]#e[2]+h[2]#e[]) - sage: L(lambda n: n)[3]; # optional - sage.modules + sage: L(lambda n: n)[3]; # needs sage.modules Traceback (most recent call last): ... ValueError: coefficient 3*h[] # e[] should be an element of homogeneous degree 3 but has degree 0 - sage: L([1, 2, 3]); # optional - sage.modules + sage: L([1, 2, 3]); # needs sage.modules Traceback (most recent call last): ... ValueError: coefficient 2*h[] # e[] should be an element of homogeneous degree 1 but has degree 0 - sage: L(lambda n: n, degree=3); # optional - sage.modules + sage: L(lambda n: n, degree=3); # needs sage.modules Traceback (most recent call last): ... ValueError: coefficient h[] # e[] should be an element @@ -2568,9 +2576,9 @@ def _an_element_(self): EXAMPLES:: - sage: m = SymmetricFunctions(ZZ).m() # optional - sage.modules - sage: L = LazySymmetricFunctions(m) # optional - sage.modules - sage: L.an_element() # optional - sage.modules + sage: m = SymmetricFunctions(ZZ).m() # needs sage.modules + sage: L = LazySymmetricFunctions(m) # needs sage.modules + sage: L.an_element() # needs sage.modules 2*m[] + 2*m[1] + 3*m[2] """ return self(self._laurent_poly_ring.an_element()) @@ -2581,9 +2589,9 @@ def some_elements(self): EXAMPLES:: - sage: m = SymmetricFunctions(GF(5)).m() # optional - sage.modules sage.rings.finite_rings - sage: L = LazySymmetricFunctions(m) # optional - sage.modules sage.rings.finite_rings - sage: L.some_elements()[:5] # optional - sage.modules sage.rings.finite_rings + sage: m = SymmetricFunctions(GF(5)).m() # needs sage.modules sage.rings.finite_rings + sage: L = LazySymmetricFunctions(m) # needs sage.modules sage.rings.finite_rings + sage: L.some_elements()[:5] # needs sage.modules sage.rings.finite_rings [0, m[], 2*m[] + 2*m[1] + 3*m[2], 2*m[1] + 3*m[2], 3*m[] + 2*m[1] + (m[1,1]+m[2]) + (2*m[1,1,1]+m[3]) @@ -2592,10 +2600,11 @@ def some_elements(self): + (2*m[2,2,1,1]+m[2,2,2]+2*m[3,2,1]+2*m[3,3]+m[4,1,1]+3*m[4,2]+4*m[5,1]+4*m[6]) + O^7] - sage: NCSF = NonCommutativeSymmetricFunctions(QQ) # optional - sage.modules - sage: S = NCSF.Complete() # optional - sage.modules - sage: L = S.formal_series_ring() # optional - sage.modules - sage: L.some_elements()[:4] # optional - sage.modules + sage: # needs sage.modules + sage: NCSF = NonCommutativeSymmetricFunctions(QQ) + sage: S = NCSF.Complete() + sage: L = S.formal_series_ring() + sage: L.some_elements()[:4] [0, S[], 2*S[] + 2*S[1] + (3*S[1,1]), 2*S[1] + (3*S[1,1])] """ @@ -2634,12 +2643,12 @@ class LazySymmetricFunctions(LazyCompletionGradedAlgebra): EXAMPLES:: - sage: s = SymmetricFunctions(ZZ).s() # optional - sage.modules - sage: LazySymmetricFunctions(s) # optional - sage.modules + sage: s = SymmetricFunctions(ZZ).s() # needs sage.modules + sage: LazySymmetricFunctions(s) # needs sage.modules Lazy completion of Symmetric Functions over Integer Ring in the Schur basis - sage: m = SymmetricFunctions(ZZ).m() # optional - sage.modules - sage: LazySymmetricFunctions(tensor([s, m])) # optional - sage.modules + sage: m = SymmetricFunctions(ZZ).m() # needs sage.modules + sage: LazySymmetricFunctions(tensor([s, m])) # needs sage.modules Lazy completion of Symmetric Functions over Integer Ring in the Schur basis # Symmetric Functions over Integer Ring in the monomial basis @@ -2728,7 +2737,7 @@ def _laurent_poly_ring(self): TESTS:: sage: L = LazyDirichletSeriesRing(ZZ, 't') - sage: L._laurent_poly_ring is SR # optional - sage.symbolic + sage: L._laurent_poly_ring is SR # needs sage.symbolic True """ from sage.symbolic.ring import SR @@ -2743,10 +2752,10 @@ def __init__(self, base_ring, names, sparse=True, category=None): sage: LazyDirichletSeriesRing.options.halting_precision(12) sage: L = LazyDirichletSeriesRing(ZZ, 't') - sage: TestSuite(L).run() # optional - sage.symbolic + sage: TestSuite(L).run() # needs sage.symbolic sage: L = LazyDirichletSeriesRing(QQ, 't') - sage: TestSuite(L).run() # optional - sage.symbolic + sage: TestSuite(L).run() # needs sage.symbolic sage: LazyDirichletSeriesRing.options._reset() # reset the options @@ -2774,7 +2783,7 @@ def _repr_(self): EXAMPLES:: - sage: LazyDirichletSeriesRing(QQbar, 'z') # optional - sage.rings.number_field + sage: LazyDirichletSeriesRing(QQbar, 'z') # needs sage.rings.number_field Lazy Dirichlet Series Ring in z over Algebraic Field """ return "Lazy Dirichlet Series Ring in {} over {}".format(self.variable_name(), self.base_ring()) @@ -2787,9 +2796,9 @@ def one(self): EXAMPLES:: sage: L = LazyDirichletSeriesRing(ZZ, 'z') - sage: L.one() # optional - sage.symbolic + sage: L.one() # needs sage.symbolic 1 - sage: ~L.one() # optional - sage.symbolic + sage: ~L.one() # needs sage.symbolic 1 + O(1/(8^z)) """ R = self.base_ring() @@ -2828,31 +2837,31 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No sage: L = LazyDirichletSeriesRing(ZZ, 'z') sage: R = L(3) - sage: R # optional - sage.symbolic + sage: R # needs sage.symbolic 3 sage: S = L(lambda i: i, constant=1, degree=6) - sage: S # optional - sage.symbolic + sage: S # needs sage.symbolic 1 + 2/2^z + 3/3^z + 4/4^z + 5/5^z + 1/(6^z) + 1/(7^z) + 1/(8^z) + O(1/(9^z)) sage: X = L(constant=5, degree=3) - sage: X # optional - sage.symbolic + sage: X # needs sage.symbolic 5/3^z + 5/4^z + 5/5^z + O(1/(6^z)) sage: X.valuation() log(3) sage: e = L(moebius) - sage: e # optional - sage.symbolic + sage: e # needs sage.symbolic 1 - 1/(2^z) - 1/(3^z) - 1/(5^z) + 1/(6^z) - 1/(7^z) + O(1/(8^z)) sage: T = L([0], constant=1) - sage: T # optional - sage.symbolic + sage: T # needs sage.symbolic 1/(2^z) + 1/(3^z) + 1/(4^z) + O(1/(5^z)) sage: U = L(constant=1) - sage: U # optional - sage.symbolic + sage: U # needs sage.symbolic 1 + 1/(2^z) + 1/(3^z) + O(1/(4^z)) sage: V = L(lambda i: i, valuation=3) - sage: V # optional - sage.symbolic + sage: V # needs sage.symbolic 3/3^z + 4/4^z + 5/5^z + 6/6^z + 7/7^z + 8/8^z + 9/9^z + O(1/(10^z)) Alternatively, ``x`` can be a list of elements of the base ring. @@ -2862,16 +2871,16 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No simply omitted if it is zero:: sage: f = L([1,2,3,4], 4) - sage: f # optional - sage.symbolic + sage: f # needs sage.symbolic 1/(4^z) + 2/5^z + 3/6^z + 4/7^z sage: g = L([1,3,5,7,9], 6, constant=-1) - sage: g # optional - sage.symbolic + sage: g # needs sage.symbolic 1/(6^z) + 3/7^z + 5/8^z + 7/9^z + 9/10^z - 1/(11^z) - 1/(12^z) - 1/(13^z) + O(1/(14^z)) TESTS:: - sage: L = LazyDirichletSeriesRing(GF(2), 'z') # optional - sage.rings.finite_rings + sage: L = LazyDirichletSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: positive characteristic not allowed for Dirichlet series @@ -2879,27 +2888,27 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No sage: L. = LazyLaurentSeriesRing(QQ) sage: D = LazyDirichletSeriesRing(QQ, 't') sage: d = D(L.one()) - sage: d # optional - sage.symbolic + sage: d # needs sage.symbolic 1 + 1/(2^t) + 1/(3^t) + 1/(4^t) + 1/(5^t) + 1/(6^t) + 1/(7^t) + O(1/(8^t)) sage: R. = LaurentPolynomialRing(QQ) sage: D = LazyDirichletSeriesRing(QQ, 't') sage: dd = D(coefficients=z + z^2) - sage: dd # optional - sage.symbolic + sage: dd # needs sage.symbolic 2 + 6/2^t + 12/3^t + 20/4^t + 30/5^t + 42/6^t + 56/7^t + O(1/(8^t)) sage: s = D(lambda n: n) sage: d2 = D(s, valuation=2) - sage: d2 # optional - sage.symbolic + sage: d2 # needs sage.symbolic 1/(2^t) + 2/3^t + 3/4^t + 4/5^t + 5/6^t + 6/7^t + 7/8^t + O(1/(9^t)) sage: Ds = LazyDirichletSeriesRing(ZZ, 's') sage: m = Ds(moebius, valuation=2) - sage: m # optional - sage.symbolic + sage: m # needs sage.symbolic -1/(2^s) - 1/(3^s) - 1/(5^s) + 1/(6^s) - 1/(7^s) + O(1/(9^s)) sage: D = LazyDirichletSeriesRing(QQ, 't') sage: dm = D(m) - sage: dm # optional - sage.symbolic + sage: dm # needs sage.symbolic -1/(2^t) - 1/(3^t) - 1/(5^t) + 1/(6^t) - 1/(7^t) + O(1/(9^t)) """ if isinstance(x, (list, tuple)): @@ -2945,7 +2954,7 @@ def _an_element_(self): sage: L = LazyDirichletSeriesRing(ZZ, 'z') sage: m = L.an_element() - sage: m # optional - sage.symbolic + sage: m # needs sage.symbolic 1/(4^z) + 1/(5^z) + 1/(6^z) + O(1/(7^z)) """ c = self.base_ring().an_element() @@ -2959,7 +2968,7 @@ def some_elements(self): sage: L = LazyDirichletSeriesRing(ZZ, 'z') sage: l = L.some_elements() - sage: l # optional - sage.symbolic + sage: l # needs sage.symbolic [0, 1, 1/(4^z) + 1/(5^z) + 1/(6^z) + O(1/(7^z)), 1/(2^z) - 1/(3^z) + 2/4^z - 2/5^z + 3/6^z - 3/7^z + 4/8^z - 4/9^z, @@ -2968,7 +2977,7 @@ def some_elements(self): sage: L = LazyDirichletSeriesRing(QQ, 'z') sage: l = L.some_elements() - sage: l # optional - sage.symbolic + sage: l # needs sage.symbolic [0, 1, 1/2/4^z + 1/2/5^z + 1/2/6^z + O(1/(7^z)), 1/2 - 1/2/2^z + 2/3^z - 2/4^z + 1/(6^z) - 1/(7^z) + 42/8^z + 2/3/9^z, @@ -2990,7 +2999,7 @@ def _monomial(self, c, n): EXAMPLES:: sage: L = LazyDirichletSeriesRing(ZZ, 'z') - sage: m = L._monomial(5, 3); m # optional - sage.symbolic + sage: m = L._monomial(5, 3); m # needs sage.symbolic 5/3^z """ try: @@ -3010,11 +3019,12 @@ def _skip_leading_zeros(iterator): sage: [x for x, _ in zip(_skip_leading_zeros(it), range(10))] [10, 11, 12, 13, 14, 15, 16, 17, 18, 19] - sage: it = map(GF(3), NN) # optional - sage.rings.finite_rings - sage: [x for x, _ in zip(it, range(10))] # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: it = map(GF(3), NN) + sage: [x for x, _ in zip(it, range(10))] [0, 1, 2, 0, 1, 2, 0, 1, 2, 0] - sage: it = map(GF(3), NN) # optional - sage.rings.finite_rings - sage: [x for x, _ in zip(_skip_leading_zeros(it), range(10))] # optional - sage.rings.finite_rings + sage: it = map(GF(3), NN) + sage: [x for x, _ in zip(_skip_leading_zeros(it), range(10))] [1, 2, 0, 1, 2, 0, 1, 2, 0, 1] """ while True: diff --git a/src/sage/rings/localization.py b/src/sage/rings/localization.py index bda24010204..b43fc573102 100644 --- a/src/sage/rings/localization.py +++ b/src/sage/rings/localization.py @@ -10,18 +10,18 @@ EXAMPLES:: sage: LZ = Localization(ZZ, (5,11)) - sage: m = matrix(LZ, [[5, 7], [0,11]]) # optional - sage.modules - sage: m.parent() # optional - sage.modules + sage: m = matrix(LZ, [[5, 7], [0,11]]) # needs sage.modules + sage: m.parent() # needs sage.modules Full MatrixSpace of 2 by 2 dense matrices over Integer Ring localized at (5, 11) - sage: ~m # parent of inverse is different: see documentation of m.__invert__ # optional - sage.modules + sage: ~m # parent of inverse is different: see documentation of m.__invert__ # needs sage.modules [ 1/5 -7/55] [ 0 1/11] - sage: _.parent() # optional - sage.modules + sage: _.parent() # needs sage.modules Full MatrixSpace of 2 by 2 dense matrices over Rational Field - sage: mi = matrix(LZ, ~m) # optional - sage.modules - sage: mi.parent() # optional - sage.modules + sage: mi = matrix(LZ, ~m) # needs sage.modules + sage: mi.parent() # needs sage.modules Full MatrixSpace of 2 by 2 dense matrices over Integer Ring localized at (5, 11) - sage: mi == ~m # optional - sage.modules + sage: mi == ~m # needs sage.modules True The next example defines the most general ring containing the coefficients of the irreducible @@ -34,48 +34,51 @@ sage: I = S.cartesian_product(S) sage: add_units = u + [q, q + 1] + [ui - uj for ui, uj in I if ui != uj] sage: add_units += [q*ui - uj for ui, uj in I if ui != uj] - sage: L = R.localization(tuple(add_units)); L # optional - sage.libs.pari + sage: L = R.localization(tuple(add_units)); L # needs sage.libs.pari Multivariate Polynomial Ring in u0, u1, u2, q over Integer Ring localized at (q, q + 1, u2, u1, u1 - u2, u0, u0 - u2, u0 - u1, u2*q - u1, u2*q - u0, u1*q - u2, u1*q - u0, u0*q - u2, u0*q - u1) Define the representation matrices (of one of the three dimensional irreducible representations):: - sage: m1 = matrix(L, [[u1, 0, 0], [0, u0, 0], [0, 0, u0]]) # optional - sage.modules - sage: m2 = matrix(L, [[(u0*q - u0)/(u0 - u1), (u0*q - u1)/(u0 - u1), 0], # optional - sage.modules + sage: # needs sage.libs.pari sage.modules + sage: m1 = matrix(L, [[u1, 0, 0], [0, u0, 0], [0, 0, u0]]) + sage: m2 = matrix(L, [[(u0*q - u0)/(u0 - u1), (u0*q - u1)/(u0 - u1), 0], ....: [(-u1*q + u0)/(u0 - u1), (-u1*q + u1)/(u0 - u1), 0], ....: [0, 0, -1]]) - sage: m3 = matrix(L, [[-1, 0, 0], # optional - sage.modules + sage: m3 = matrix(L, [[-1, 0, 0], ....: [0, u0*(1 - q)/(u1*q - u0), q*(u1 - u0)/(u1*q - u0)], ....: [0, (u1*q^2 - u0)/(u1*q - u0), (u1*q^ 2 - u1*q)/(u1*q - u0)]]) - sage: m1.base_ring() == L # optional - sage.modules + sage: m1.base_ring() == L True Check relations of the Ariki-Koike algebra:: - sage: m1*m2*m1*m2 == m2*m1*m2*m1 # optional - sage.modules + sage: # needs sage.libs.pari sage.modules + sage: m1*m2*m1*m2 == m2*m1*m2*m1 True - sage: m2*m3*m2 == m3*m2*m3 # optional - sage.modules + sage: m2*m3*m2 == m3*m2*m3 True - sage: m1*m3 == m3*m1 # optional - sage.modules + sage: m1*m3 == m3*m1 True - sage: m1**3 - (u0+u1+u2)*m1**2 + (u0*u1+u0*u2+u1*u2)*m1 - u0*u1*u2 == 0 # optional - sage.modules + sage: m1**3 - (u0+u1+u2)*m1**2 + (u0*u1+u0*u2+u1*u2)*m1 - u0*u1*u2 == 0 True - sage: m2**2 - (q-1)*m2 - q == 0 # optional - sage.modules + sage: m2**2 - (q-1)*m2 - q == 0 True - sage: m3**2 - (q-1)*m3 - q == 0 # optional - sage.modules + sage: m3**2 - (q-1)*m3 - q == 0 True - sage: ~m1 in m1.parent() # optional - sage.modules + sage: ~m1 in m1.parent() True - sage: ~m2 in m2.parent() # optional - sage.modules + sage: ~m2 in m2.parent() True - sage: ~m3 in m3.parent() # optional - sage.modules + sage: ~m3 in m3.parent() True Obtain specializations in positive characteristic:: - sage: Fp = GF(17) # optional - sage.rings.finite_rings - sage: f = L.hom((3,5,7,11), codomain=Fp); f # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: Fp = GF(17) + sage: f = L.hom((3,5,7,11), codomain=Fp); f # needs sage.libs.pari Ring morphism: From: Multivariate Polynomial Ring in u0, u1, u2, q over Integer Ring localized at (q, q + 1, u2, u1, u1 - u2, u0, u0 - u2, u0 - u1, u2*q - u1, u2*q - u0, @@ -85,24 +88,25 @@ u1 |--> 5 u2 |--> 7 q |--> 11 - sage: mFp1 = matrix({k: f(v) for k, v in m1.dict().items()}); mFp1 # optional - sage.modules sage.rings.finite_rings + sage: mFp1 = matrix({k: f(v) for k, v in m1.dict().items()}); mFp1 # needs sage.libs.pari sage.modules [5 0 0] [0 3 0] [0 0 3] - sage: mFp1.base_ring() # optional - sage.modules sage.rings.finite_rings + sage: mFp1.base_ring() # needs sage.libs.pari sage.modules Finite Field of size 17 - sage: mFp2 = matrix({k: f(v) for k, v in m2.dict().items()}); mFp2 # optional - sage.modules sage.rings.finite_rings + sage: mFp2 = matrix({k: f(v) for k, v in m2.dict().items()}); mFp2 # needs sage.libs.pari sage.modules [ 2 3 0] [ 9 8 0] [ 0 0 16] - sage: mFp3 = matrix({k: f(v) for k, v in m3.dict().items()}); mFp3 # optional - sage.modules sage.rings.finite_rings + sage: mFp3 = matrix({k: f(v) for k, v in m3.dict().items()}); mFp3 # needs sage.libs.pari sage.modules [16 0 0] [ 0 4 5] [ 0 7 6] Obtain specializations in characteristic 0:: - sage: fQ = L.hom((3,5,7,11), codomain=QQ); fQ # optional - sage.rings.finite_rings + sage: # needs sage.libs.pari + sage: fQ = L.hom((3,5,7,11), codomain=QQ); fQ Ring morphism: From: Multivariate Polynomial Ring in u0, u1, u2, q over Integer Ring localized at (q, q + 1, u2, u1, u1 - u2, u0, u0 - u2, u0 - u1, @@ -112,25 +116,25 @@ u1 |--> 5 u2 |--> 7 q |--> 11 - sage: mQ1 = matrix({k: fQ(v) for k, v in m1.dict().items()}); mQ1 # optional - sage.modules sage.rings.finite_rings + sage: mQ1 = matrix({k: fQ(v) for k, v in m1.dict().items()}); mQ1 # needs sage.modules sage.rings.finite_rings [5 0 0] [0 3 0] [0 0 3] - sage: mQ1.base_ring() # optional - sage.modules sage.rings.finite_rings + sage: mQ1.base_ring() # needs sage.modules sage.rings.finite_rings Rational Field - sage: mQ2 = matrix({k: fQ(v) for k, v in m2.dict().items()}); mQ2 # optional - sage.modules sage.rings.finite_rings + sage: mQ2 = matrix({k: fQ(v) for k, v in m2.dict().items()}); mQ2 # needs sage.modules sage.rings.finite_rings [-15 -14 0] [ 26 25 0] [ 0 0 -1] - sage: mQ3 = matrix({k: fQ(v) for k, v in m3.dict().items()}); mQ3 # optional - sage.modules sage.rings.finite_rings + sage: mQ3 = matrix({k: fQ(v) for k, v in m3.dict().items()}); mQ3 # needs sage.modules sage.rings.finite_rings [ -1 0 0] [ 0 -15/26 11/26] [ 0 301/26 275/26] sage: S. = QQ[] sage: T = S.quo(x + y + z) - sage: F = T.fraction_field() # optional - sage.libs.singular - sage: fF = L.hom((x, y, z, t), codomain=F); fF # optional - sage.libs.singular + sage: F = T.fraction_field() # needs sage.libs.pari sage.libs.singular + sage: fF = L.hom((x, y, z, t), codomain=F); fF # needs sage.libs.pari sage.libs.singular Ring morphism: From: Multivariate Polynomial Ring in u0, u1, u2, q over Integer Ring localized at (q, q + 1, u2, u1, u1 - u2, u0, u0 - u2, u0 - u1, @@ -141,16 +145,16 @@ u1 |--> ybar u2 |--> zbar q |--> tbar - sage: mF1 = matrix({k: fF(v) for k, v in m1.dict().items()}); mF1 # optional - sage.libs.singular sage.modules + sage: mF1 = matrix({k: fF(v) for k, v in m1.dict().items()}); mF1 # needs sage.libs.pari sage.libs.singular sage.modules [ ybar 0 0] [ 0 -ybar - zbar 0] [ 0 0 -ybar - zbar] - sage: mF1.base_ring() == F # optional - sage.libs.singular sage.modules + sage: mF1.base_ring() == F # needs sage.libs.pari sage.libs.singular sage.modules True TESTS:: - sage: TestSuite(L).run() # optional - sage.libs.singular sage.modules + sage: TestSuite(L).run() # needs sage.libs.pari sage.libs.singular sage.modules AUTHORS: @@ -199,21 +203,23 @@ def normalize_extra_units(base_ring, add_units, warning=True): sage: normalize_extra_units(ZZ, [3, -15, 45, 9, 2, 50]) [2, 3, 5] sage: P. = ZZ[] - sage: normalize_extra_units(P, [3*x, z*y**2, 2*z, 18*(x*y*z)**2, x*z, 6*x*z, 5]) # optional - sage.libs.pari + sage: normalize_extra_units(P, # needs sage.libs.pari + ....: [3*x, z*y**2, 2*z, 18*(x*y*z)**2, x*z, 6*x*z, 5]) [2, 3, 5, z, y, x] sage: P. = QQ[] - sage: normalize_extra_units(P, [3*x, z*y**2, 2*z, 18*(x*y*z)**2, x*z, 6*x*z, 5]) # optional - sage.libs.pari + sage: normalize_extra_units(P, # needs sage.libs.pari + ....: [3*x, z*y**2, 2*z, 18*(x*y*z)**2, x*z, 6*x*z, 5]) [z, y, x] sage: R. = ZZ[] - sage: Q. = R.quo(x**2 - 5) # optional - sage.libs.singular - sage: p = b**2 - 5 # optional - sage.libs.singular - sage: p == (b-a)*(b+a) # optional - sage.libs.singular + sage: Q. = R.quo(x**2 - 5) # needs sage.libs.singular + sage: p = b**2 - 5 # needs sage.libs.singular + sage: p == (b-a)*(b+a) # needs sage.libs.singular True - sage: normalize_extra_units(Q, [p]) # optional - sage.libs.pari + sage: normalize_extra_units(Q, [p]) # needs sage.libs.pari sage.libs.singular doctest:...: UserWarning: Localization may not be represented uniquely [b^2 - 5] - sage: normalize_extra_units(Q, [p], warning=False) # optional - sage.libs.pari + sage: normalize_extra_units(Q, [p], warning=False) # needs sage.libs.pari sage.libs.singular [b^2 - 5] """ # convert to base ring @@ -250,13 +256,15 @@ class LocalizationElement(IntegralDomainElement): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: from sage.rings.localization import LocalizationElement - sage: P. = GF(5)[] # optional - sage.rings.finite_rings - sage: L = P.localization((x, y*z-x)) # optional - sage.rings.finite_rings - sage: LocalizationElement(L, 4/(y*z-x)**2) # optional - sage.rings.finite_rings + sage: P. = GF(5)[] + sage: L = P.localization((x, y*z - x)) + sage: LocalizationElement(L, 4/(y*z-x)**2) (-1)/(y^2*z^2 - 2*x*y*z + x^2) - sage: _.parent() # optional - sage.rings.finite_rings - Multivariate Polynomial Ring in x, y, z over Finite Field of size 5 localized at (x, y*z - x) + sage: _.parent() + Multivariate Polynomial Ring in x, y, z over Finite Field of size 5 + localized at (x, y*z - x) """ def __init__(self, parent, x): @@ -267,9 +275,9 @@ def __init__(self, parent, x): sage: from sage.rings.localization import LocalizationElement sage: P. = RR[] - sage: L = Localization(P, x**2 + x + 1) # optional - sage.libs.pari - sage: l = LocalizationElement(L, (x**2+1)/(x**2+x+1)) # optional - sage.libs.pari - sage: l._value == (x**2+1)/(x**2+x+1) # optional - sage.libs.pari + sage: L = Localization(P, x**2 + x + 1) # needs sage.libs.pari + sage: l = LocalizationElement(L, (x**2+1)/(x**2+x+1)) # needs sage.libs.pari + sage: l._value == (x**2+1)/(x**2+x+1) # needs sage.libs.pari True """ IntegralDomainElement.__init__(self, parent) @@ -281,11 +289,12 @@ def _repr_(self): EXAMPLES:: + sage: # needs sage.rings.real_mpfr sage: from sage.rings.localization import LocalizationElement - sage: P. = CC[] # optional - sage.rings.real_mpfr - sage: L = Localization(P, x**2 + x + 1) # optional - sage.rings.real_mpfr - sage: l = LocalizationElement(L, (x**2+1)/(x**2+x+1)) # optional - sage.rings.real_mpfr - sage: l._repr_() == str(l) # optional - sage.rings.real_mpfr + sage: P. = CC[] + sage: L = Localization(P, x**2 + x + 1) + sage: l = LocalizationElement(L, (x**2+1)/(x**2+x+1)) + sage: l._repr_() == str(l) True sage: R. = ZZ[] @@ -391,8 +400,8 @@ def factor(self, proof=None): sage: P. = QQ['x, y'] sage: L = P.localization(X - Y) sage: x, y = L.gens() - sage: p = (x^2 - y^2)/(x-y)^2 # optional - sage.libs.singular - sage: p.factor() # optional - sage.libs.singular + sage: p = (x^2 - y^2)/(x-y)^2 # needs sage.libs.singular + sage: p.factor() # needs sage.libs.singular (1/(x - y)) * (x + y) """ num = self._value.numerator() @@ -411,9 +420,9 @@ def _im_gens_(self, codomain, im_gens, base_map=None): EXAMPLES:: sage: R. = ZZ[] - sage: L = Localization(R, x**2 + 1) # optional - sage.libs.pari - sage: f = L.hom([5], codomain=Localization(ZZ, 26)) # indirect doctest # optional - sage.libs.pari - sage: f(x/(x**2+1)) # optional - sage.libs.pari + sage: L = Localization(R, x**2 + 1) # needs sage.libs.pari + sage: f = L.hom([5], codomain=Localization(ZZ, 26)) # indirect doctest # needs sage.libs.pari + sage: f(x/(x**2+1)) # needs sage.libs.pari 5/26 """ return self._value._im_gens_(codomain, im_gens, base_map=base_map) @@ -449,12 +458,12 @@ def is_unit(self): EXAMPLES:: sage: P. = QQ[] - sage: L = P.localization((x, y*z)) # optional - sage.libs.pari - sage: L(y*z).is_unit() # optional - sage.libs.pari + sage: L = P.localization((x, y*z)) # needs sage.libs.pari + sage: L(y*z).is_unit() # needs sage.libs.pari True - sage: L(z).is_unit() # optional - sage.libs.pari + sage: L(z).is_unit() # needs sage.libs.pari True - sage: L(x*y*z).is_unit() # optional - sage.libs.pari + sage: L(x*y*z).is_unit() # needs sage.libs.pari True """ return self.parent()._cut_off_extra_units_from_base_ring_element(self._value.numerator()).is_unit() @@ -467,9 +476,9 @@ def inverse_of_unit(self): sage: P. = ZZ[] sage: L = Localization(P, x*y*z) - sage: L(x*y*z).inverse_of_unit() # optional - sage.libs.singular + sage: L(x*y*z).inverse_of_unit() # needs sage.libs.singular 1/(x*y*z) - sage: L(z).inverse_of_unit() # optional - sage.libs.singular + sage: L(z).inverse_of_unit() # needs sage.libs.singular 1/z """ parent = self.parent() @@ -481,11 +490,12 @@ def _richcmp_(self, other, op): """ EXAMPLES:: - sage: P. = GF(7)[] # optional - sage.rings.finite_rings - sage: L = Localization(P, (x, y, z)) # optional - sage.rings.finite_rings - sage: L(1/x) < L(3/(x*y*z)**3) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: P. = GF(7)[] + sage: L = Localization(P, (x, y, z)) + sage: L(1/x) < L(3/(x*y*z)**3) False - sage: ~L(y*z/x) == L(x/(y*z)) # optional - sage.rings.finite_rings + sage: ~L(y*z/x) == L(x/(y*z)) True """ sval = self._value @@ -518,8 +528,8 @@ def _rational_(self): TESTS:: sage: L = ZZ.localization(5) - sage: cp3 = cyclotomic_polynomial(3).change_ring(L) # optional - sage.libs.pari - sage: cp3.splitting_field('t') # indirect doctest # optional - sage.libs.pari sage.rings.number_field + sage: cp3 = cyclotomic_polynomial(3).change_ring(L) + sage: cp3.splitting_field('t') # indirect doctest # needs sage.libs.pari sage.rings.number_field Number Field in t with defining polynomial x^2 + x + 1 """ from sage.rings.rational_field import QQ @@ -601,42 +611,42 @@ class Localization(IntegralDomain, UniqueRepresentation): ... ValueError: factor 7 of denominator is not a unit - sage: Localization(Zp(7), (3, 5)) # optional - sage.rings.padics + sage: Localization(Zp(7), (3, 5)) # needs sage.rings.padics Traceback (most recent call last): ... ValueError: all given elements are invertible in 7-adic Ring with capped relative precision 20 sage: R. = ZZ[] - sage: L = R.localization(x**2 + 1) # optional - sage.libs.pari + sage: L = R.localization(x**2 + 1) # needs sage.libs.pari sage: s = (x+5)/(x**2+1) - sage: s in L # optional - sage.libs.pari + sage: s in L # needs sage.libs.pari True sage: t = (x+5)/(x**2+2) - sage: t in L # optional - sage.libs.pari + sage: t in L False - sage: L(t) # optional - sage.libs.pari + sage: L(t) # needs sage.libs.pari Traceback (most recent call last): ... TypeError: fraction must have unit denominator - sage: L(s) in R # optional - sage.libs.pari + sage: L(s) in R # needs sage.libs.pari False - sage: y = L(x) # optional - sage.libs.pari - sage: g = L(s) # optional - sage.libs.pari - sage: g.parent() # optional - sage.libs.pari + sage: y = L(x) # needs sage.libs.pari + sage: g = L(s) # needs sage.libs.pari + sage: g.parent() # needs sage.libs.pari Univariate Polynomial Ring in x over Integer Ring localized at (x^2 + 1,) - sage: f = (y+5)/(y**2+1); f # optional - sage.libs.pari + sage: f = (y+5)/(y**2+1); f # needs sage.libs.pari (x + 5)/(x^2 + 1) - sage: f == g # optional - sage.libs.pari + sage: f == g # needs sage.libs.pari True - sage: (y+5)/(y**2+2) # optional - sage.libs.pari + sage: (y+5)/(y**2+2) # needs sage.libs.pari Traceback (most recent call last): ... ValueError: factor x^2 + 2 of denominator is not a unit - sage: Lau. = LaurentPolynomialRing(ZZ) - sage: LauL = Lau.localization(u + 1) - sage: LauL(~u).parent() + sage: Lau. = LaurentPolynomialRing(ZZ) # needs sage.modules + sage: LauL = Lau.localization(u + 1) # needs sage.modules + sage: LauL(~u).parent() # needs sage.modules Multivariate Polynomial Ring in u, v over Integer Ring localized at (v, u, u + 1) More examples will be shown typing ``sage.rings.localization?`` @@ -662,8 +672,8 @@ def __init__(self, base_ring, extra_units, names=None, normalize=True, category= sage: TestSuite(L).run() sage: R. = ZZ[] - sage: L = R.localization(x**2 + 1) # optional - sage.libs.pari - sage: TestSuite(L).run() # optional - sage.libs.pari + sage: L = R.localization(x**2 + 1) # needs sage.libs.pari + sage: TestSuite(L).run() """ if type(extra_units) is tuple: extra_units = list(extra_units) @@ -703,8 +713,8 @@ def _repr_(self): EXAMPLES:: - sage: R. = GF(3)[] # optional - sage.rings.finite_rings - sage: Localization(R, a**2 - 1) # optional - sage.rings.finite_rings + sage: R. = GF(3)[] + sage: Localization(R, a**2 - 1) # needs sage.rings.finite_rings Univariate Polynomial Ring in a over Finite Field of size 3 localized at (a + 1, a + 2) """ @@ -735,13 +745,13 @@ def _is_valid_homomorphism_(self, codomain, im_gens, base_map=None): EXAMPLES:: sage: R. = ZZ[] - sage: L = Localization(R, x**2 + 1) # optional - sage.libs.pari - sage: L.hom([5]) # indirect doctest # optional - sage.libs.pari + sage: L = Localization(R, x**2 + 1) # needs sage.libs.pari + sage: L.hom([5]) # indirect doctest # needs sage.libs.pari Traceback (most recent call last): ... ValueError: images of some localized elements fail to be units - sage: L.hom([5], codomain=Localization(ZZ, 26)) # indirect doctest # optional - sage.libs.pari + sage: L.hom([5], codomain=Localization(ZZ, 26)) # indirect doctest # needs sage.libs.pari Ring morphism: From: Univariate Polynomial Ring in x over Integer Ring localized at (x^2 + 1,) @@ -751,22 +761,22 @@ def _is_valid_homomorphism_(self, codomain, im_gens, base_map=None): TESTS:: sage: phi = R.hom([5]) - sage: L._is_valid_homomorphism_(ZZ, [3], base_map=phi) # optional - sage.libs.pari + sage: L._is_valid_homomorphism_(ZZ, [3], base_map=phi) # needs sage.libs.pari Traceback (most recent call last): ... ValueError: given base_map is not compatible with im_gens - sage: L._is_valid_homomorphism_(ZZ, [5], base_map=phi) # optional - sage.libs.pari + sage: L._is_valid_homomorphism_(ZZ, [5], base_map=phi) # needs sage.libs.pari Traceback (most recent call last): ... ValueError: images of some localized elements fail to be units sage: phi = R.hom([5], codomain=QQ) - sage: L._is_valid_homomorphism_(ZZ, [5], base_map=phi) # optional - sage.libs.pari + sage: L._is_valid_homomorphism_(ZZ, [5], base_map=phi) # needs sage.libs.pari Traceback (most recent call last): ... ValueError: codomain of base_map must be Integer Ring - sage: L._is_valid_homomorphism_(QQ, [5], base_map=phi) # optional - sage.libs.pari + sage: L._is_valid_homomorphism_(QQ, [5], base_map=phi) # needs sage.libs.pari True """ B = self.base_ring() @@ -798,7 +808,7 @@ def ngens(self): EXAMPLES:: sage: R. = ZZ[] - sage: Localization(R, (x**2 + 1, y - 1)).ngens() # optional - sage.libs.pari + sage: Localization(R, (x**2 + 1, y - 1)).ngens() # needs sage.libs.pari 2 sage: Localization(ZZ, 2).ngens() @@ -814,7 +824,7 @@ def gen(self, i): EXAMPLES:: sage: R. = ZZ[] - sage: R.localization((x**2 + 1, y - 1)).gen(0) # optional - sage.libs.pari + sage: R.localization((x**2 + 1, y - 1)).gen(0) # needs sage.libs.pari x sage: ZZ.localization(2).gen(0) @@ -830,7 +840,7 @@ def gens(self): EXAMPLES:: sage: R. = ZZ[] - sage: Localization(R, (x**2 + 1, y - 1)).gens() # optional - sage.libs.pari + sage: Localization(R, (x**2 + 1, y - 1)).gens() # needs sage.libs.pari (x, y) sage: Localization(ZZ, 2).gens() @@ -854,10 +864,10 @@ def _cut_off_extra_units_from_base_ring_element(self, x): EXAMPLES:: sage: P. = QQ[] - sage: L = Localization(P, (x, y*z)) # optional - sage.libs.pari - sage: L._cut_off_extra_units_from_base_ring_element(x*y*z) # optional - sage.libs.pari + sage: L = Localization(P, (x, y*z)) # needs sage.libs.pari + sage: L._cut_off_extra_units_from_base_ring_element(x*y*z) # needs sage.libs.pari 1 - sage: L._cut_off_extra_units_from_base_ring_element(x*z) # optional - sage.libs.pari + sage: L._cut_off_extra_units_from_base_ring_element(x*z) # needs sage.libs.pari 1 TESTS: @@ -898,15 +908,15 @@ def _fraction_to_element(self, x): sage: P. = QQ[] sage: d = x**2 + y**2 + z**2 - sage: L = Localization(P, d) # optional - sage.libs.pari - sage: L._fraction_to_element((x+y+z)/d) # optional - sage.libs.pari + sage: L = Localization(P, d) # needs sage.libs.pari + sage: L._fraction_to_element((x+y+z)/d) # needs sage.libs.pari (x + y + z)/(x^2 + y^2 + z^2) - sage: _ in L # optional - sage.libs.pari + sage: _ in L # needs sage.libs.pari True TESTS:: - sage: TestSuite(L).run() # optional - sage.libs.pari + sage: TestSuite(L).run() # needs sage.libs.pari """ potential_non_unit_denom = self._cut_off_extra_units_from_base_ring_element(x.denominator()) if potential_non_unit_denom.is_unit(): @@ -924,21 +934,21 @@ def _coerce_map_from_(self, S): sage: P. = QQ[] sage: L = Localization(P, y*z) - sage: M = Localization(P, (x, y, z)) - sage: M._coerce_map_from_(L) + sage: M = Localization(P, (x, y, z)) # needs sage.libs.pari + sage: M._coerce_map_from_(L) # needs sage.libs.pari True - sage: L._coerce_map_from_(M) + sage: L._coerce_map_from_(M) # needs sage.libs.pari False sage: Q. = ZZ[] sage: N = Localization(Q, v*w) sage: L._coerce_map_from_(N) True - sage: N._coerce_map_from_(M) + sage: N._coerce_map_from_(M) # needs sage.libs.pari False - sage: O = Localization(L, x**2 + 1) - sage: O._coerce_map_from_(M) + sage: O = Localization(L, x**2 + 1) # needs sage.libs.pari + sage: O._coerce_map_from_(M) # needs sage.libs.pari False - sage: O._coerce_map_from_(L) + sage: O._coerce_map_from_(L) # needs sage.libs.pari True """ if S is self.base_ring(): @@ -954,11 +964,12 @@ def fraction_field(self): EXAMPLES:: - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: L = Localization(R, (a**2 - 3, a)) # optional - sage.rings.finite_rings - sage: L.fraction_field() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(5)[] + sage: L = Localization(R, (a**2 - 3, a)) + sage: L.fraction_field() Fraction Field of Univariate Polynomial Ring in a over Finite Field of size 5 - sage: L.is_subring(_) # optional - sage.rings.finite_rings + sage: L.is_subring(_) True """ return self._fraction_field @@ -969,9 +980,9 @@ def characteristic(self): EXAMPLES:: - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: L = R.localization((a**2 - 3, a)) # optional - sage.rings.finite_rings - sage: L.characteristic() # optional - sage.rings.finite_rings + sage: R. = GF(5)[] + sage: L = R.localization((a**2 - 3, a)) # needs sage.rings.finite_rings + sage: L.characteristic() # needs sage.rings.finite_rings 5 """ return self.base_ring().characteristic() diff --git a/src/sage/rings/monomials.py b/src/sage/rings/monomials.py index 0beb25a1044..9a96157c153 100644 --- a/src/sage/rings/monomials.py +++ b/src/sage/rings/monomials.py @@ -9,7 +9,7 @@ def _monomials(gens, R, n, i): EXAMPLES:: - sage: monomials([x], [3]) # indirect doctest + sage: monomials([x], [3]) # indirect doctest # needs sage.symbolic [1, x, x^2] """ # each power of the ith generator times all products @@ -51,7 +51,7 @@ def monomials(v, n): EXAMPLES:: - sage: monomials([x], [3]) + sage: monomials([x], [3]) # needs sage.symbolic [1, x, x^2] sage: R. = QQ[] sage: monomials([x,y], [5,5]) diff --git a/src/sage/rings/morphism.pyx b/src/sage/rings/morphism.pyx index 9e5b1b0f551..565d1b69316 100644 --- a/src/sage/rings/morphism.pyx +++ b/src/sage/rings/morphism.pyx @@ -33,24 +33,25 @@ EXAMPLES: Reduction to finite field:: - sage: H = Hom(ZZ, GF(9, 'a')) # optional - sage.rings.finite_rings - sage: phi = H([1]) # optional - sage.rings.finite_rings - sage: phi(5) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: H = Hom(ZZ, GF(9, 'a')) + sage: phi = H([1]) + sage: phi(5) 2 - sage: psi = H([4]) # optional - sage.rings.finite_rings - sage: psi(5) # optional - sage.rings.finite_rings + sage: psi = H([4]) + sage: psi(5) 2 Map from single variable polynomial ring:: sage: R. = ZZ[] - sage: phi = R.hom([2], GF(5)) # optional - sage.rings.finite_rings - sage: phi # optional - sage.rings.finite_rings + sage: phi = R.hom([2], GF(5)) + sage: phi Ring morphism: From: Univariate Polynomial Ring in x over Integer Ring To: Finite Field of size 5 Defn: x |--> 2 - sage: phi(x + 12) # optional - sage.rings.finite_rings + sage: phi(x + 12) 4 Identity map on the real numbers:: @@ -70,8 +71,8 @@ Homomorphism from one precision of field to another. From smaller to bigger doesn't make sense:: - sage: R200 = RealField(200) - sage: f = RR.hom( R200 ) + sage: R200 = RealField(200) # needs sage.rings.real_mpfr + sage: f = RR.hom( R200 ) # needs sage.rings.real_mpfr Traceback (most recent call last): ... TypeError: natural coercion morphism from Real Field with 53 bits of precision @@ -79,7 +80,7 @@ From smaller to bigger doesn't make sense:: From bigger to small does:: - sage: f = RR.hom( RealField(15) ) + sage: f = RR.hom( RealField(15) ) # needs sage.rings.real_mpfr sage: f(2.5) 2.500 sage: f(RR.pi()) @@ -109,16 +110,16 @@ A map from a multivariate polynomial ring to itself:: An endomorphism of a quotient of a multi-variate polynomial ring:: sage: R. = PolynomialRing(QQ) - sage: S. = quo(R, ideal(1 + y^2)) # optional - sage.libs.singular - sage: phi = S.hom([a^2, -b]) # optional - sage.libs.singular - sage: phi # optional - sage.libs.singular + sage: S. = quo(R, ideal(1 + y^2)) # needs sage.libs.singular + sage: phi = S.hom([a^2, -b]) # needs sage.libs.singular + sage: phi # needs sage.libs.singular Ring endomorphism of Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (y^2 + 1) Defn: a |--> a^2 b |--> -b - sage: phi(b) # optional - sage.libs.singular + sage: phi(b) # needs sage.libs.singular -b - sage: phi(a^2 + b^2) # optional - sage.libs.singular + sage: phi(a^2 + b^2) # needs sage.libs.singular a^4 - 1 The reduction map from the integers to the integers modulo 8, viewed as @@ -147,28 +148,30 @@ a quotient ring:: Inclusion of ``GF(2)`` into ``GF(4,'a')``:: - sage: k = GF(2) # optional - sage.rings.finite_rings - sage: i = k.hom(GF(4, 'a')) # optional - sage.rings.finite_rings - sage: i # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: k = GF(2) + sage: i = k.hom(GF(4, 'a')) + sage: i Ring morphism: From: Finite Field of size 2 To: Finite Field in a of size 2^2 Defn: 1 |--> 1 - sage: i(0) # optional - sage.rings.finite_rings + sage: i(0) 0 - sage: a = i(1); a.parent() # optional - sage.rings.finite_rings + sage: a = i(1); a.parent() Finite Field in a of size 2^2 We next compose the inclusion with reduction from the integers to ``GF(2)``:: - sage: pi = ZZ.hom(k) # optional - sage.rings.finite_rings - sage: pi # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: pi = ZZ.hom(k) + sage: pi Natural morphism: From: Integer Ring To: Finite Field of size 2 - sage: f = i * pi # optional - sage.rings.finite_rings - sage: f # optional - sage.rings.finite_rings + sage: f = i * pi + sage: f Composite map: From: Integer Ring To: Finite Field in a of size 2^2 @@ -180,40 +183,41 @@ We next compose the inclusion with reduction from the integers to From: Finite Field of size 2 To: Finite Field in a of size 2^2 Defn: 1 |--> 1 - sage: a = f(5); a # optional - sage.rings.finite_rings + sage: a = f(5); a 1 - sage: a.parent() # optional - sage.rings.finite_rings + sage: a.parent() Finite Field in a of size 2^2 Inclusion from `\QQ` to the 3-adic field:: - sage: phi = QQ.hom(Qp(3, print_mode='series')) # optional - sage.rings.padics - sage: phi # optional - sage.rings.padics + sage: # needs sage.rings.padics + sage: phi = QQ.hom(Qp(3, print_mode='series')) + sage: phi Ring morphism: From: Rational Field To: 3-adic Field with capped relative precision 20 - sage: phi.codomain() # optional - sage.rings.padics + sage: phi.codomain() 3-adic Field with capped relative precision 20 - sage: phi(394) # optional - sage.rings.padics + sage: phi(394) 1 + 2*3 + 3^2 + 2*3^3 + 3^4 + 3^5 + O(3^20) An automorphism of a quotient of a univariate polynomial ring:: sage: R. = PolynomialRing(QQ) - sage: S. = R.quo(x^2 - 2) # optional - sage.libs.pari - sage: sqrt2^2 # optional - sage.libs.pari + sage: S. = R.quo(x^2 - 2) # needs sage.libs.pari + sage: sqrt2^2 # needs sage.libs.pari 2 - sage: (3+sqrt2)^10 # optional - sage.libs.pari + sage: (3+sqrt2)^10 # needs sage.libs.pari 993054*sqrt2 + 1404491 - sage: c = S.hom([-sqrt2]) # optional - sage.libs.pari - sage: c(1+sqrt2) # optional - sage.libs.pari + sage: c = S.hom([-sqrt2]) # needs sage.libs.pari + sage: c(1+sqrt2) # needs sage.libs.pari -sqrt2 + 1 Note that Sage verifies that the morphism is valid:: - sage: (1 - sqrt2)^2 # optional - sage.libs.pari + sage: (1 - sqrt2)^2 # needs sage.libs.pari -2*sqrt2 + 3 - sage: c = S.hom([1 - sqrt2]) # this is not valid # optional - sage.libs.pari + sage: c = S.hom([1 - sqrt2]) # this is not valid # needs sage.libs.pari Traceback (most recent call last): ... ValueError: relations do not all (canonically) map to 0 @@ -233,19 +237,20 @@ Endomorphism of power series ring:: Frobenius on a power series ring over a finite field:: - sage: R. = PowerSeriesRing(GF(5)) # optional - sage.rings.finite_rings - sage: f = R.hom([t^5]); f # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = PowerSeriesRing(GF(5)) + sage: f = R.hom([t^5]); f Ring endomorphism of Power Series Ring in t over Finite Field of size 5 Defn: t |--> t^5 - sage: a = 2 + t + 3*t^2 + 4*t^3 + O(t^4) # optional - sage.rings.finite_rings - sage: b = 1 + t + 2*t^2 + t^3 + O(t^5) # optional - sage.rings.finite_rings - sage: f(a) # optional - sage.rings.finite_rings + sage: a = 2 + t + 3*t^2 + 4*t^3 + O(t^4) + sage: b = 1 + t + 2*t^2 + t^3 + O(t^5) + sage: f(a) 2 + t^5 + 3*t^10 + 4*t^15 + O(t^20) - sage: f(b) # optional - sage.rings.finite_rings + sage: f(b) 1 + t^5 + 2*t^10 + t^15 + O(t^25) - sage: f(a*b) # optional - sage.rings.finite_rings + sage: f(a*b) 2 + 3*t^5 + 3*t^10 + t^15 + O(t^20) - sage: f(a)*f(b) # optional - sage.rings.finite_rings + sage: f(a)*f(b) 2 + 3*t^5 + 3*t^10 + t^15 + O(t^20) Homomorphism of Laurent series ring:: @@ -279,35 +284,36 @@ positive:: Complex conjugation on cyclotomic fields:: - sage: K. = CyclotomicField(7) # optional - sage.rings.number_field - sage: c = K.hom([1/zeta7]); c # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = CyclotomicField(7) + sage: c = K.hom([1/zeta7]); c Ring endomorphism of Cyclotomic Field of order 7 and degree 6 Defn: zeta7 |--> -zeta7^5 - zeta7^4 - zeta7^3 - zeta7^2 - zeta7 - 1 - sage: a = (1+zeta7)^5; a # optional - sage.rings.number_field + sage: a = (1+zeta7)^5; a zeta7^5 + 5*zeta7^4 + 10*zeta7^3 + 10*zeta7^2 + 5*zeta7 + 1 - sage: c(a) # optional - sage.rings.number_field + sage: c(a) 5*zeta7^5 + 5*zeta7^4 - 4*zeta7^2 - 5*zeta7 - 4 - sage: c(zeta7 + 1/zeta7) # this element is obviously fixed by inversion # optional - sage.rings.number_field + sage: c(zeta7 + 1/zeta7) # this element is obviously fixed by inversion -zeta7^5 - zeta7^4 - zeta7^3 - zeta7^2 - 1 - sage: zeta7 + 1/zeta7 # optional - sage.rings.number_field + sage: zeta7 + 1/zeta7 -zeta7^5 - zeta7^4 - zeta7^3 - zeta7^2 - 1 Embedding a number field into the reals:: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field - sage: alpha = RR(2)^(1/3); alpha # optional - sage.rings.number_field + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: alpha = RR(2)^(1/3); alpha # needs sage.rings.number_field 1.25992104989487 - sage: i = K.hom([alpha],check=False); i # optional - sage.rings.number_field + sage: i = K.hom([alpha],check=False); i # needs sage.rings.number_field Ring morphism: From: Number Field in beta with defining polynomial x^3 - 2 To: Real Field with 53 bits of precision Defn: beta |--> 1.25992104989487 - sage: i(beta) # optional - sage.rings.number_field + sage: i(beta) # needs sage.rings.number_field 1.25992104989487 - sage: i(beta^3) # optional - sage.rings.number_field + sage: i(beta^3) # needs sage.rings.number_field 2.00000000000000 - sage: i(beta^2 + 1) # optional - sage.rings.number_field + sage: i(beta^2 + 1) # needs sage.rings.number_field 2.58740105196820 An example from Jim Carlson:: @@ -338,51 +344,53 @@ TESTS:: :: - sage: K. = CyclotomicField(7) # optional - sage.rings.number_field - sage: c = K.hom([1/zeta7]) # optional - sage.rings.number_field - sage: c == loads(dumps(c)) # optional - sage.rings.number_field + sage: K. = CyclotomicField(7) # needs sage.rings.number_field + sage: c = K.hom([1/zeta7]) # needs sage.rings.number_field + sage: c == loads(dumps(c)) True :: - sage: R. = PowerSeriesRing(GF(5)) # optional - sage.rings.finite_rings - sage: f = R.hom([t^5]) # optional - sage.rings.finite_rings - sage: f == loads(dumps(f)) # optional - sage.rings.finite_rings + sage: R. = PowerSeriesRing(GF(5)) + sage: f = R.hom([t^5]) + sage: f == loads(dumps(f)) True We define the identity map in many possible ways. These should all compare equal:: - sage: k = GF(2) # optional - sage.rings.finite_rings - sage: R. = k[] # optional - sage.rings.finite_rings - sage: F4. = R.quo(x^2+x+1) # optional - sage.rings.finite_rings - sage: H = End(F4) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: k = GF(2) + sage: R. = k[] + sage: F4. = R.quo(x^2+x+1) + sage: H = End(F4) + sage: # needs sage.rings.finite_rings sage: from sage.rings.morphism import * - sage: phi1 = H.identity(); phi1 # optional - sage.rings.finite_rings + sage: phi1 = H.identity(); phi1 Identity endomorphism of Univariate Quotient Polynomial Ring in a over Finite Field of size 2 with modulus x^2 + x + 1 - sage: phi2 = H([a]); phi2 # optional - sage.rings.finite_rings + sage: phi2 = H([a]); phi2 Ring endomorphism of Univariate Quotient Polynomial Ring in a over Finite Field of size 2 with modulus x^2 + x + 1 Defn: a |--> a - sage: phi3 = RingHomomorphism_from_base(H, R.hom([x])); phi3 # optional - sage.rings.finite_rings + sage: phi3 = RingHomomorphism_from_base(H, R.hom([x])); phi3 # needs sage.libs.ntl Ring endomorphism of Univariate Quotient Polynomial Ring in a over Finite Field of size 2 with modulus x^2 + x + 1 Defn: Induced from base ring by Ring endomorphism of Univariate Polynomial Ring in x over Finite Field of size 2 (using GF2X) Defn: x |--> x - sage: phi4 = RingHomomorphism_cover(H); phi4 # optional - sage.rings.finite_rings + sage: phi4 = RingHomomorphism_cover(H); phi4 Ring endomorphism of Univariate Quotient Polynomial Ring in a over Finite Field of size 2 with modulus x^2 + x + 1 Defn: Natural quotient map - sage: phi5 = F4.frobenius_endomorphism() ^ 2; phi5 # optional - sage.rings.finite_rings + sage: phi5 = F4.frobenius_endomorphism() ^ 2; phi5 Frobenius endomorphism x |--> x^(2^2) of Univariate Quotient Polynomial Ring in a over Finite Field of size 2 with modulus x^2 + x + 1 - sage: maps = [phi1, phi2, phi3, phi4, phi5] # optional - sage.rings.finite_rings - sage: for f in maps: # optional - sage.rings.finite_rings + sage: maps = [phi1, phi2, phi3, phi4, phi5] # needs sage.libs.ntl + sage: for f in maps: # needs sage.libs.ntl ....: for g in maps: ....: if f != g: ....: print("{} != {}".format(f, g)) @@ -468,14 +476,14 @@ cdef class RingMap_lift(RingMap): EXAMPLES:: sage: R. = QQ[] - sage: S. = R.quo( (x^2 + y^2, y) ) # optional - sage.libs.singular - sage: S.lift() # optional - sage.libs.singular + sage: S. = R.quo( (x^2 + y^2, y) ) # needs sage.libs.singular + sage: S.lift() # needs sage.libs.singular Set-theoretic ring morphism: From: Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2, y) To: Multivariate Polynomial Ring in x, y over Rational Field Defn: Choice of lifting map - sage: S.lift() == 0 # optional - sage.libs.singular + sage: S.lift() == 0 # needs sage.libs.singular False Since :trac:`11068`, it is possible to create @@ -485,10 +493,11 @@ cdef class RingMap_lift(RingMap): of :class:`sage.rings.ring.Ring`, as in the following example:: - sage: MS = MatrixSpace(GF(5), 2, 2) # optional - sage.modules sage.rings.finite_rings - sage: I = MS * [MS.0*MS.1, MS.2+MS.3] * MS # optional - sage.modules sage.rings.finite_rings - sage: Q = MS.quo(I) # optional - sage.modules sage.rings.finite_rings - sage: Q.0*Q.1 # indirect doctest # optional - sage.modules sage.rings.finite_rings + sage: # needs sage.modules sage.rings.finite_rings + sage: MS = MatrixSpace(GF(5), 2, 2) + sage: I = MS * [MS.0*MS.1, MS.2+MS.3] * MS + sage: Q = MS.quo(I) + sage: Q.0*Q.1 # indirect doctest [0 1] [0 0] """ @@ -508,9 +517,9 @@ cdef class RingMap_lift(RingMap): An invalid example:: - sage: GF9. = GaussianIntegers().quotient(3) # optional - sage.rings.number_field - sage: from sage.rings.morphism import RingMap_lift # optional - sage.rings.number_field - sage: RingMap_lift(GF9, ZZ) # optional - sage.rings.number_field + sage: GF9. = GaussianIntegers().quotient(3) # needs sage.rings.number_field + sage: from sage.rings.morphism import RingMap_lift + sage: RingMap_lift(GF9, ZZ) # needs sage.rings.number_field Traceback (most recent call last): ... TypeError: no canonical coercion from Number Field in I @@ -653,14 +662,14 @@ cdef class RingHomomorphism(RingMap): EXAMPLES:: - sage: f = ZZ.hom(Zp(3)); f # optional - sage.rings.padics + sage: f = ZZ.hom(Zp(3)); f # needs sage.rings.padics Ring morphism: From: Integer Ring To: 3-adic Ring with capped relative precision 20 TESTS:: - sage: isinstance(f, sage.rings.morphism.RingHomomorphism) # optional - sage.rings.padics + sage: isinstance(f, sage.rings.morphism.RingHomomorphism) # needs sage.rings.padics True """ @@ -675,7 +684,7 @@ cdef class RingHomomorphism(RingMap): TESTS:: - sage: ZZ.hom(Zp(3))._repr_type() # optional - sage.rings.padics + sage: ZZ.hom(Zp(3))._repr_type() # needs sage.rings.padics 'Ring' """ @@ -788,17 +797,17 @@ cdef class RingHomomorphism(RingMap): result has the type of a homomorphism between its domain and codomain:: - sage: C = CyclotomicField(24) # optional - sage.rings.number_field - sage: f = End(C)[1] # optional - sage.rings.number_field - sage: type(f*f) == type(f) # optional - sage.rings.number_field + sage: C = CyclotomicField(24) # needs sage.rings.number_field + sage: f = End(C)[1] # needs sage.rings.number_field + sage: type(f*f) == type(f) # needs sage.rings.number_field True An example where the domain of ``right`` is a relative number field:: sage: PQ. = QQ[] - sage: K. = NumberField([X^2 - 2, X^2 - 3]) # optional - sage.rings.number_field - sage: e, u, v, w = End(K) # optional - sage.rings.number_field - sage: u*v # optional - sage.rings.number_field + sage: K. = NumberField([X^2 - 2, X^2 - 3]) # needs sage.rings.number_field + sage: e, u, v, w = End(K) # needs sage.rings.number_field + sage: u*v # needs sage.rings.number_field Relative number field endomorphism of Number Field in a with defining polynomial X^2 - 2 over its base field Defn: a |--> -a @@ -824,20 +833,20 @@ cdef class RingHomomorphism(RingMap): We check that composition works when there is a base map:: sage: R. = ZZ[] - sage: K. = GF(7^2) # optional - sage.rings.finite_rings - sage: L. = K.extension(x^3 - 3) # optional - sage.rings.finite_rings - sage: phi = L.hom([u^7], base_map=K.frobenius_endomorphism()) # optional - sage.rings.finite_rings - sage: phi # optional - sage.rings.finite_rings + sage: K. = GF(7^2) # needs sage.rings.finite_rings + sage: L. = K.extension(x^3 - 3) # needs sage.rings.finite_rings + sage: phi = L.hom([u^7], base_map=K.frobenius_endomorphism()) # needs sage.rings.finite_rings + sage: phi # needs sage.rings.finite_rings Ring endomorphism of Univariate Quotient Polynomial Ring in u over Finite Field in a of size 7^2 with modulus u^3 + 4 Defn: u |--> 2*u with map of base ring - sage: psi = phi^3; psi # optional - sage.rings.finite_rings + sage: psi = phi^3; psi # needs sage.rings.finite_rings Ring endomorphism of Univariate Quotient Polynomial Ring in u over Finite Field in a of size 7^2 with modulus u^3 + 4 Defn: u |--> u with map of base ring - sage: psi(a) == phi(phi(phi(a))) # optional - sage.rings.finite_rings + sage: psi(a) == phi(phi(phi(a))) # needs sage.rings.finite_rings True It also works when the image of the base map is not contained within the base ring of the codomain:: @@ -906,8 +915,8 @@ cdef class RingHomomorphism(RingMap): EXAMPLES:: - sage: R. = QQ[]; S. = R.quo([x^2, y^2]); f = S.cover() # optional - sage.libs.singular - sage: f.pushforward(R.ideal([x, 3*x + x*y + y^2])) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo([x^2, y^2]); f = S.cover() # needs sage.libs.singular + sage: f.pushforward(R.ideal([x, 3*x + x*y + y^2])) # needs sage.libs.singular Ideal (xx, xx*yy + 3*xx) of Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2, y^2) """ @@ -940,18 +949,18 @@ cdef class RingHomomorphism(RingMap): sage: S. = QQ[] sage: f = R.hom([u^2, u*v, v^2], S) sage: I = S.ideal([u^6, u^5*v, u^4*v^2, u^3*v^3]) - sage: J = f.inverse_image(I); J # optional - sage.libs.singular + sage: J = f.inverse_image(I); J # needs sage.libs.singular Ideal (y^2 - x*z, x*y*z, x^2*z, x^2*y, x^3) of Multivariate Polynomial Ring in x, y, z over Rational Field - sage: f(J) == I # optional - sage.libs.singular + sage: f(J) == I # needs sage.libs.singular True Under the above homomorphism, there exists an inverse image for every element that only involves monomials of even degree:: - sage: [f.inverse_image(p) for p in [u^2, u^4, u*v + u^3*v^3]] # optional - sage.libs.singular + sage: [f.inverse_image(p) for p in [u^2, u^4, u*v + u^3*v^3]] # needs sage.libs.singular [x, x^2, x*y*z + y] - sage: f.inverse_image(u*v^2) # optional - sage.libs.singular + sage: f.inverse_image(u*v^2) # needs sage.libs.singular Traceback (most recent call last): ... ValueError: element u*v^2 does not have preimage @@ -959,27 +968,29 @@ cdef class RingHomomorphism(RingMap): The image of the inverse image ideal can be strictly smaller than the original ideal:: - sage: S. = QQ['u,v'].quotient('v^2 - 2') # optional - sage.libs.singular - sage: f = QuadraticField(2).hom([v], S) # optional - sage.libs.singular sage.rings.number_field - sage: I = S.ideal(u + v) # optional - sage.libs.singular sage.rings.number_field - sage: J = f.inverse_image(I) # optional - sage.libs.singular sage.rings.number_field - sage: J.is_zero() # optional - sage.libs.singular sage.rings.number_field + sage: # needs sage.libs.singular + sage: S. = QQ['u,v'].quotient('v^2 - 2') + sage: f = QuadraticField(2).hom([v], S) # needs sage.rings.number_field + sage: I = S.ideal(u + v) # needs sage.rings.number_field + sage: J = f.inverse_image(I) # needs sage.rings.number_field + sage: J.is_zero() # needs sage.rings.number_field True - sage: f(J) < I # optional - sage.libs.singular sage.rings.number_field + sage: f(J) < I # needs sage.rings.number_field True Fractional ideals are not yet fully supported:: - sage: K. = NumberField(QQ['x']('x^2+2')) # optional - sage.rings.number_field - sage: f = K.hom([-a], K) # optional - sage.rings.number_field - sage: I = K.ideal([a + 1]) # optional - sage.rings.number_field - sage: f.inverse_image(I) # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = NumberField(QQ['x']('x^2+2')) + sage: f = K.hom([-a], K) + sage: I = K.ideal([a + 1]) + sage: f.inverse_image(I) Traceback (most recent call last): ... NotImplementedError: inverse image not implemented... - sage: f.inverse_image(K.ideal(0)).is_zero() # optional - sage.rings.number_field + sage: f.inverse_image(K.ideal(0)).is_zero() True - sage: f.inverse()(I) # optional - sage.rings.number_field + sage: f.inverse()(I) Fractional ideal (-a + 1) ALGORITHM: @@ -993,7 +1004,7 @@ cdef class RingHomomorphism(RingMap): TESTS:: - sage: ZZ.hom(Zp(2)).inverse_image(ZZ.ideal(2)) # optional - sage.rings.padics + sage: ZZ.hom(Zp(2)).inverse_image(ZZ.ideal(2)) # needs sage.rings.padics Traceback (most recent call last): ... ValueError: not an ideal or element in codomain 2-adic Ring @@ -1001,7 +1012,7 @@ cdef class RingHomomorphism(RingMap): :: - sage: ZZ.hom(Zp(2)).inverse_image(Zp(2).ideal(2)) # optional - sage.rings.padics + sage: ZZ.hom(Zp(2)).inverse_image(Zp(2).ideal(2)) # needs sage.rings.padics Traceback (most recent call last): ... NotImplementedError: base rings must be equal @@ -1021,13 +1032,14 @@ cdef class RingHomomorphism(RingMap): EXAMPLES:: - sage: R. = QQbar[] # optional - sage.rings.number_field - sage: f = R.hom([x, QQbar(i) * x + y^2], R) # optional - sage.rings.number_field - sage: I = R.ideal(y^3) # optional - sage.rings.number_field - sage: J = f._inverse_image_ideal(I); J # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: R. = QQbar[] + sage: f = R.hom([x, QQbar(i) * x + y^2], R) + sage: I = R.ideal(y^3) + sage: J = f._inverse_image_ideal(I); J Ideal (x^2 + 2*I*x*y - y^2) of Multivariate Polynomial Ring in x, y over Algebraic Field - sage: f(J) <= I # optional - sage.rings.number_field + sage: f(J) <= I True TESTS: @@ -1035,17 +1047,17 @@ cdef class RingHomomorphism(RingMap): Check that :trac:`31367` is fixed:: sage: A. = QQ[] - sage: B. = QQ['x,y'].quotient('y') # optional - sage.libs.singular - sage: f = A.hom([x], B) # optional - sage.libs.singular - sage: f.kernel() # optional - sage.libs.singular + sage: B. = QQ['x,y'].quotient('y') # needs sage.libs.singular + sage: f = A.hom([x], B) # needs sage.libs.singular + sage: f.kernel() # needs sage.libs.singular Principal ideal (0) of Univariate Polynomial Ring in t over Rational Field :: sage: A. = QQ[] - sage: B. = QQ['x,y,z'].quotient('z') # optional - sage.libs.singular - sage: f = A.hom([x, y], B) # optional - sage.libs.singular - sage: f.kernel() # optional - sage.libs.singular + sage: B. = QQ['x,y,z'].quotient('z') # needs sage.libs.singular + sage: f = A.hom([x, y], B) # needs sage.libs.singular + sage: f.kernel() # needs sage.libs.singular Ideal (0) of Multivariate Polynomial Ring in t, u over Rational Field """ from .polynomial.polynomial_quotient_ring import is_PolynomialQuotientRing @@ -1087,36 +1099,37 @@ cdef class RingHomomorphism(RingMap): A degenerate case:: - sage: R. = QQ['x,y'].quotient(1) # optional - sage.libs.singular - sage: f = R.hom([y, x], R) # optional - sage.libs.singular - sage: f.inverse_image(x), f.inverse_image(y) # indirect doctest # optional - sage.libs.singular + sage: R. = QQ['x,y'].quotient(1) # needs sage.libs.singular + sage: f = R.hom([y, x], R) # needs sage.libs.singular + sage: f.inverse_image(x), f.inverse_image(y) # indirect doctest # needs sage.libs.singular (0, 0) Check cases involving quotient rings in which a generator is constant (:trac:`31178`):: sage: R. = QQ[] - sage: B. = R.quotient(R.ideal(x)) # optional - sage.libs.singular - sage: g = R.hom([d^2, d^3], B) # optional - sage.libs.singular - sage: g.inverse_image(d) # optional - sage.libs.singular + sage: B. = R.quotient(R.ideal(x)) # needs sage.libs.singular + sage: g = R.hom([d^2, d^3], B) # needs sage.libs.singular + sage: g.inverse_image(d) # needs sage.libs.singular Traceback (most recent call last): ... ValueError: element d does not have preimage - sage: g.inverse_image(d^2) # optional - sage.libs.singular + sage: g.inverse_image(d^2) # needs sage.libs.singular x - sage: g.inverse_image(d^3) # optional - sage.libs.singular + sage: g.inverse_image(d^3) # needs sage.libs.singular y - sage: A. = R.quotient(R.ideal(y^2 - x^3)) # optional - sage.libs.singular - sage: h = A.hom([d^2, d^3], B) # optional - sage.libs.singular - sage: h.inverse_image(d^2) # optional - sage.libs.singular + sage: A. = R.quotient(R.ideal(y^2 - x^3)) # needs sage.libs.singular + sage: h = A.hom([d^2, d^3], B) # needs sage.libs.singular + sage: h.inverse_image(d^2) # needs sage.libs.singular a Check that quotient rings are handled correctly (:trac:`33217`):: - sage: A. = QQ['X,Y,Z'].quotient('X^2+Y^2+Z^2-1') # optional - sage.libs.singular - sage: B. = QQ['T,U,V,W'].quotient(['T^2+U^2-1', 'V^2+W^2-1']) # optional - sage.libs.singular - sage: psi = A.hom([v*u, w*u, t], B) # optional - sage.libs.singular - sage: psi.inverse_image(t^2) == z^2 # optional - sage.libs.singular + sage: # needs sage.libs.singular + sage: A. = QQ['X,Y,Z'].quotient('X^2+Y^2+Z^2-1') + sage: B. = QQ['T,U,V,W'].quotient(['T^2+U^2-1', 'V^2+W^2-1']) + sage: psi = A.hom([v*u, w*u, t], B) + sage: psi.inverse_image(t^2) == z^2 True """ graph, from_B, to_A = self._graph_ideal() @@ -1136,7 +1149,7 @@ cdef class RingHomomorphism(RingMap): sage: A. = QQ[] sage: B. = QQ[] sage: f = A.hom([t^4, t^3 - t^2], B) - sage: f.kernel() # optional - sage.libs.singular + sage: f.kernel() # needs sage.libs.singular Ideal (y^4 - x^3 + 4*x^2*y - 2*x*y^2 + x^2) of Multivariate Polynomial Ring in x, y over Rational Field @@ -1145,18 +1158,18 @@ cdef class RingHomomorphism(RingMap): sage: A. = QQ[] sage: B. = QQ[] sage: f = A.hom([u^3, u^2*v, u*v^2, v^3], B) - sage: f.kernel() == A.ideal(matrix.hankel([a, b, c], [d]).minors(2)) # optional - sage.libs.singular + sage: f.kernel() == A.ideal(matrix.hankel([a, b, c], [d]).minors(2)) # needs sage.libs.singular True - sage: Q = A.quotient(f.kernel()) # optional - sage.libs.singular - sage: Q.hom(f.im_gens(), B).is_injective() # optional - sage.libs.singular + sage: Q = A.quotient(f.kernel()) # needs sage.libs.singular + sage: Q.hom(f.im_gens(), B).is_injective() # needs sage.libs.singular True The Steiner-Roman surface:: sage: R. = QQ[] - sage: S = R.quotient(x^2 + y^2 + z^2 - 1) # optional - sage.libs.singular - sage: f = R.hom([x*y, x*z, y*z], S) # optional - sage.libs.singular - sage: f.kernel() # optional - sage.libs.singular + sage: S = R.quotient(x^2 + y^2 + z^2 - 1) + sage: f = R.hom([x*y, x*z, y*z], S) # needs sage.libs.singular + sage: f.kernel() # needs sage.libs.singular Ideal (x^2*y^2 + x^2*z^2 + y^2*z^2 - x*y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field @@ -1164,30 +1177,31 @@ cdef class RingHomomorphism(RingMap): The results are cached:: - sage: f.kernel() is f.kernel() # optional - sage.libs.singular + sage: f.kernel() is f.kernel() # needs sage.libs.singular True A degenerate case:: sage: R. = QQ[] - sage: f = R.hom([0, 0], R.quotient(1)) # optional - sage.libs.singular - sage: f.kernel().is_one() # optional - sage.libs.singular + sage: f = R.hom([0, 0], R.quotient(1)) # needs sage.libs.singular + sage: f.kernel().is_one() # needs sage.libs.singular True :: - sage: K. = QuadraticField(2) # optional - sage.rings.number_field - sage: K.hom([-sqrt2], K).kernel().is_zero() # optional - sage.rings.number_field + sage: K. = QuadraticField(2) # needs sage.rings.number_field + sage: K.hom([-sqrt2], K).kernel().is_zero() # needs sage.rings.number_field True :: - sage: A. = QuadraticField(2) # optional - sage.rings.number_field - sage: B. = A.extension(A['b']('b^2-3')) # optional - sage.rings.number_field - sage: C. = B.absolute_field() # optional - sage.rings.number_field - sage: A.hom([B(a)], C).kernel().is_zero() # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: A. = QuadraticField(2) + sage: B. = A.extension(A['b']('b^2-3')) + sage: C. = B.absolute_field() + sage: A.hom([B(a)], C).kernel().is_zero() True - sage: A.hom([a], B).kernel() # optional - sage.rings.number_field + sage: A.hom([a], B).kernel() Traceback (most recent call last): ... NotImplementedError: base rings must be equal @@ -1262,32 +1276,34 @@ cdef class RingHomomorphism(RingMap): Ideals in quotient rings over ``QQbar`` do not support reduction yet, so the graph is constructed in the ambient ring instead:: - sage: A. = QQbar['z,w'].quotient('z*w - 1') # optional - sage.rings.number_field - sage: B. = QQbar['x,y'].quotient('2*x^2 + y^2 - 1') # optional - sage.rings.number_field - sage: f = A.hom([QQbar(2).sqrt()*x + QQbar(I)*y, # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: A. = QQbar['z,w'].quotient('z*w - 1') + sage: B. = QQbar['x,y'].quotient('2*x^2 + y^2 - 1') + sage: f = A.hom([QQbar(2).sqrt()*x + QQbar(I)*y, ....: QQbar(2).sqrt()*x - QQbar(I)*y], B) - sage: f._graph_ideal()[0] # optional - sage.rings.number_field + sage: f._graph_ideal()[0] Ideal (z*w - 1, 2*x^2 + y^2 - 1, 1.414213562373095?*x + I*y - z, 1.414213562373095?*x + (-I)*y - w) of Multivariate Polynomial Ring in x, y, z, w over Algebraic Field - sage: f.inverse()(f(z)), f.inverse()(f(w)) # optional - sage.rings.number_field + sage: f.inverse()(f(z)), f.inverse()(f(w)) (z, w) Non-trivial base maps are not supported:: - sage: K. = QuadraticField(2) # optional - sage.rings.number_field - sage: R. = K[] # optional - sage.rings.number_field - sage: f = R.hom([x, a*x + y], R, base_map=K.hom([-a], K)) # optional - sage.rings.number_field - sage: f._graph_ideal() # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(2) + sage: R. = K[] + sage: f = R.hom([x, a*x + y], R, base_map=K.hom([-a], K)) + sage: f._graph_ideal() Traceback (most recent call last): ... NotImplementedError: base map must be trivial Non-commutative rings are not supported (:trac:`32824`):: - sage: A = GradedCommutativeAlgebra(QQ, 'x,y,z') # optional - sage.combinat sage.modules - sage: A.hom(A.gens(), A).kernel() # optional - sage.combinat sage.modules + sage: A = GradedCommutativeAlgebra(QQ, 'x,y,z') # needs sage.combinat sage.modules + sage: A.hom(A.gens(), A).kernel() # needs sage.combinat sage.modules Traceback (most recent call last): ... NotImplementedError: rings are not commutative @@ -1344,7 +1360,7 @@ cdef class RingHomomorphism(RingMap): sage: R. = QQ[] sage: f = R.hom([2*t - 1], R) - sage: f.inverse() # optional - sage.libs.singular + sage: f.inverse() # needs sage.libs.singular Ring endomorphism of Univariate Polynomial Ring in t over Rational Field Defn: t |--> 1/2*t + 1/2 @@ -1353,15 +1369,15 @@ cdef class RingHomomorphism(RingMap): sage: R. = QQ[] sage: f = R.hom([y*z, x*z, x*y], R) - sage: f.inverse() # optional - sage.libs.singular + sage: f.inverse() # needs sage.libs.singular Traceback (most recent call last): ... ZeroDivisionError: ring homomorphism not surjective - sage: f.is_injective() # optional - sage.libs.singular + sage: f.is_injective() # needs sage.libs.singular True - sage: Q. = R.quotient(x*y*z - 1) # optional - sage.libs.singular - sage: g = Q.hom([y*z, x*z, x*y], Q) # optional - sage.libs.singular - sage: g.inverse() # optional - sage.libs.singular + sage: Q. = R.quotient(x*y*z - 1) # needs sage.libs.singular + sage: g = Q.hom([y*z, x*z, x*y], Q) # needs sage.libs.singular + sage: g.inverse() # needs sage.libs.singular Ring endomorphism of Quotient of Multivariate Polynomial Ring in x, y, z over Rational Field by the ideal (x*y*z - 1) Defn: x |--> y*z @@ -1372,24 +1388,24 @@ cdef class RingHomomorphism(RingMap): sage: S. = ZZ[] sage: f = S.hom([x + 2*y, x + 3*y], S) - sage: f.inverse() # optional - sage.libs.singular + sage: f.inverse() # needs sage.libs.singular Ring endomorphism of Multivariate Polynomial Ring in x, y over Integer Ring Defn: x |--> 3*x - 2*y y |--> -x + y - sage: (f.inverse() * f).is_identity() # optional - sage.libs.singular + sage: (f.inverse() * f).is_identity() # needs sage.libs.singular True The following homomorphism is invertible over the rationals, but not over the integers:: sage: g = S.hom([x + y, x - y - 2], S) - sage: g.inverse() # optional - sage.libs.singular + sage: g.inverse() # needs sage.libs.singular Traceback (most recent call last): ... ZeroDivisionError: ring homomorphism not surjective sage: R. = QQ[x,y] sage: h = R.hom([x + y, x - y - 2], R) - sage: (h.inverse() * h).is_identity() # optional - sage.libs.singular + sage: (h.inverse() * h).is_identity() # needs sage.libs.singular True This example by M. Nagata is a wild automorphism:: @@ -1397,13 +1413,13 @@ cdef class RingHomomorphism(RingMap): sage: R. = QQ[] sage: sigma = R.hom([x - 2*y*(z*x+y^2) - z*(z*x+y^2)^2, ....: y + z*(z*x+y^2), z], R) - sage: tau = sigma.inverse(); tau # optional - sage.libs.singular + sage: tau = sigma.inverse(); tau # needs sage.libs.singular Ring endomorphism of Multivariate Polynomial Ring in x, y, z over Rational Field Defn: x |--> -y^4*z - 2*x*y^2*z^2 - x^2*z^3 + 2*y^3 + 2*x*y*z + x y |--> -y^2*z - x*z^2 + y z |--> z - sage: (tau * sigma).is_identity() # optional - sage.libs.singular + sage: (tau * sigma).is_identity() # needs sage.libs.singular True We compute the triangular automorphism that converts moments to @@ -1427,37 +1443,38 @@ cdef class RingHomomorphism(RingMap): x1^5 + 10*x1^3*x2 + 15*x1*x2^2 + 10*x1^2*x3 + 10*x2*x3 + 5*x1*x4 + x5] sage: all(p.is_homogeneous() for p in phi.im_gens()) True - sage: phi.inverse().im_gens()[:5] # optional - sage.libs.singular + sage: phi.inverse().im_gens()[:5] # needs sage.libs.singular [x1, -x1^2 + x2, 2*x1^3 - 3*x1*x2 + x3, -6*x1^4 + 12*x1^2*x2 - 3*x2^2 - 4*x1*x3 + x4, 24*x1^5 - 60*x1^3*x2 + 30*x1*x2^2 + 20*x1^2*x3 - 10*x2*x3 - 5*x1*x4 + x5] - sage: (phi.inverse() * phi).is_identity() # optional - sage.libs.singular + sage: (phi.inverse() * phi).is_identity() # needs sage.libs.singular True Automorphisms of number fields as well as Galois fields are supported:: - sage: K. = CyclotomicField(7) # optional - sage.rings.number_field - sage: c = K.hom([1/zeta7]) # optional - sage.rings.number_field - sage: (c.inverse() * c).is_identity() # optional - sage.rings.number_field + sage: K. = CyclotomicField(7) # needs sage.rings.number_field + sage: c = K.hom([1/zeta7]) # needs sage.rings.number_field + sage: (c.inverse() * c).is_identity() # needs sage.rings.number_field True - sage: F. = GF(7^3) # optional - sage.rings.finite_rings - sage: f = F.hom(t^7, F) # optional - sage.rings.finite_rings - sage: (f.inverse() * f).is_identity() # optional - sage.rings.finite_rings + sage: F. = GF(7^3) # needs sage.rings.finite_rings + sage: f = F.hom(t^7, F) # needs sage.rings.finite_rings + sage: (f.inverse() * f).is_identity() # needs sage.rings.finite_rings True An isomorphism between the algebraic torus and the circle over a number field:: - sage: K. = QuadraticField(-1) # optional - sage.rings.number_field - sage: A. = K['z,w'].quotient('z*w - 1') # optional - sage.rings.number_field - sage: B. = K['x,y'].quotient('x^2 + y^2 - 1') # optional - sage.rings.number_field - sage: f = A.hom([x + i*y, x - i*y], B) # optional - sage.rings.number_field - sage: g = f.inverse() # optional - sage.rings.number_field - sage: g.morphism_from_cover().im_gens() # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(-1) + sage: A. = K['z,w'].quotient('z*w - 1') + sage: B. = K['x,y'].quotient('x^2 + y^2 - 1') + sage: f = A.hom([x + i*y, x - i*y], B) + sage: g = f.inverse() + sage: g.morphism_from_cover().im_gens() [1/2*z + 1/2*w, (-1/2*i)*z + (1/2*i)*w] - sage: all(g(f(z)) == z for z in A.gens()) # optional - sage.rings.number_field + sage: all(g(f(z)) == z for z in A.gens()) True TESTS: @@ -1465,43 +1482,45 @@ cdef class RingHomomorphism(RingMap): Morphisms involving quotient rings:: sage: R. = QQ[] - sage: S. = QQ['s,u,t'].quotient('u-t^2') # optional - sage.libs.singular - sage: f = R.hom([s, -t], S) # optional - sage.libs.singular - sage: (f.inverse() * f).is_identity() # optional - sage.libs.singular + sage: S. = QQ['s,u,t'].quotient('u-t^2') # needs sage.libs.singular + sage: f = R.hom([s, -t], S) # needs sage.libs.singular + sage: (f.inverse() * f).is_identity() # needs sage.libs.singular True - sage: Q. = R.quotient(x - y^2) # optional - sage.libs.singular - sage: g = Q.hom([v, -w], Q) # optional - sage.libs.singular - sage: g.inverse()(g(v)) == v and g.inverse()(g(w)) == w # optional - sage.libs.singular + sage: Q. = R.quotient(x - y^2) # needs sage.libs.singular + sage: g = Q.hom([v, -w], Q) # needs sage.libs.singular + sage: g.inverse()(g(v)) == v and g.inverse()(g(w)) == w # needs sage.libs.singular True sage: S. = QQ[] - sage: h = Q.hom([z^2, -z], S) # optional - sage.libs.singular - sage: h.inverse()(h(v)) == v and h.inverse()(h(w)) == w # optional - sage.libs.singular + sage: h = Q.hom([z^2, -z], S) # needs sage.libs.singular + sage: h.inverse()(h(v)) == v and h.inverse()(h(w)) == w # needs sage.libs.singular True Morphisms between number fields and quotient rings:: - sage: K. = QuadraticField(2) # optional - sage.rings.number_field - sage: f = K.hom([-sqrt2], K.polynomial_quotient_ring()) # optional - sage.rings.number_field - sage: (f.inverse() * f).is_identity() # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(2) + sage: f = K.hom([-sqrt2], K.polynomial_quotient_ring()) + sage: (f.inverse() * f).is_identity() True - sage: g = K.polynomial_quotient_ring().hom([-sqrt2], K) # optional - sage.rings.number_field - sage: (g.inverse() * g).is_identity() # optional - sage.rings.number_field + sage: g = K.polynomial_quotient_ring().hom([-sqrt2], K) + sage: (g.inverse() * g).is_identity() True Morphisms involving Galois fields:: - sage: A. = GF(7^3) # optional - sage.rings.finite_rings - sage: R = A.polynomial_ring().quotient(A.polynomial()) # optional - sage.rings.finite_rings - sage: g = A.hom(R.gens(), R) # optional - sage.rings.finite_rings - sage: (g.inverse() * g).is_identity() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: A. = GF(7^3) + sage: R = A.polynomial_ring().quotient(A.polynomial()) + sage: g = A.hom(R.gens(), R) + sage: (g.inverse() * g).is_identity() True - sage: B., f = A.extension(3, map=True) # optional - sage.rings.finite_rings - sage: f.inverse() # optional - sage.rings.finite_rings + sage: B., f = A.extension(3, map=True) + sage: f.inverse() Traceback (most recent call last): ... ZeroDivisionError: ring homomorphism not surjective - sage: B., f = A.extension(1, map=True) # optional - sage.rings.finite_rings - sage: f.inverse() # optional - sage.rings.finite_rings + sage: B., f = A.extension(1, map=True) + sage: f.inverse() Ring morphism: From: Finite Field in T of size 7^3 To: Finite Field in t of size 7^3 @@ -1511,51 +1530,51 @@ cdef class RingHomomorphism(RingMap): sage: R. = QQ[] sage: S. = QQ[] - sage: S.hom([x, y, 0], R).inverse() # optional - sage.libs.singular + sage: S.hom([x, y, 0], R).inverse() # needs sage.libs.singular Traceback (most recent call last): ... ZeroDivisionError: ring homomorphism not injective sage: T. = QQ[] - sage: R.hom([2*z, 3*z], T).inverse() + sage: R.hom([2*z, 3*z], T).inverse() # needs sage.libs.singular Traceback (most recent call last): ... ZeroDivisionError: ring homomorphism not injective - sage: Q. = R.quotient([x^5, y^4]) # optional - sage.libs.singular - sage: R.hom([u, v], Q).inverse() # optional - sage.libs.singular + sage: Q. = R.quotient([x^5, y^4]) # needs sage.libs.singular + sage: R.hom([u, v], Q).inverse() # needs sage.libs.singular Traceback (most recent call last): ... ZeroDivisionError: ring homomorphism not injective - sage: Q.cover().inverse() # optional - sage.libs.singular + sage: Q.cover().inverse() # needs sage.libs.singular Traceback (most recent call last): ... ZeroDivisionError: ring homomorphism not injective Univariate quotient rings:: - sage: R. = QQ['t'].quotient('t^5') + sage: R. = QQ['t'].quotient('t^5') # needs sage.libs.pari sage: f = R.hom([2*t], R) - sage: (f.inverse() * f).is_identity() + sage: (f.inverse() * f).is_identity() # needs sage.libs.singular True A homomorphism over ``QQbar``:: - sage: R. = QQbar[] # optional - sage.rings.number_field - sage: f = R.hom([x + QQbar(I)*y^2, -y], R) # optional - sage.rings.number_field - sage: (f.inverse() * f).is_identity() # optional - sage.rings.number_field + sage: R. = QQbar[] # needs sage.rings.number_field + sage: f = R.hom([x + QQbar(I)*y^2, -y], R) # needs sage.rings.number_field + sage: (f.inverse() * f).is_identity() # needs sage.rings.number_field True Check that results are cached:: - sage: R. = GF(823)[] # optional - sage.rings.finite_rings - sage: f = R.hom([x, y+x^2], R) # optional - sage.rings.finite_rings - sage: f.inverse() is f.inverse() # optional - sage.rings.finite_rings + sage: R. = GF(823)[] + sage: f = R.hom([x, y+x^2], R) + sage: f.inverse() is f.inverse() # needs sage.rings.finite_rings True Some subclasses of ring homomorphisms are not supported:: sage: from sage.rings.morphism import FrobeniusEndomorphism_generic - sage: K. = PowerSeriesRing(GF(5)) # optional - sage.rings.finite_rings - sage: FrobeniusEndomorphism_generic(K).inverse() # optional - sage.rings.finite_rings + sage: K. = PowerSeriesRing(GF(5)) + sage: FrobeniusEndomorphism_generic(K).inverse() Traceback (most recent call last): ... NotImplementedError @@ -1563,7 +1582,7 @@ cdef class RingHomomorphism(RingMap): :: sage: R. = LaurentPolynomialRing(QQ) - sage: R.hom([y, x], R).inverse() + sage: R.hom([y, x], R).inverse() # needs sage.libs.singular Traceback (most recent call last): ... NotImplementedError @@ -1582,11 +1601,11 @@ cdef class RingHomomorphism(RingMap): sage: R. = QQ[] sage: f = R.hom([x + 123*y^2, y], R) - sage: f._graph_ideal()[0].groebner_basis.is_in_cache() # optional - sage.libs.singular + sage: f._graph_ideal()[0].groebner_basis.is_in_cache() False - sage: f.is_injective() # optional - sage.libs.singular + sage: f.is_injective() # needs sage.libs.singular True - sage: f._graph_ideal()[0].groebner_basis.is_in_cache() # optional - sage.libs.singular + sage: f._graph_ideal()[0].groebner_basis.is_in_cache() # needs sage.libs.singular True """ if not self.is_injective(): @@ -1606,9 +1625,9 @@ cdef class RingHomomorphism(RingMap): EXAMPLES:: - sage: R. = GF(17)[] # optional - sage.rings.finite_rings - sage: f = R.hom([3*x, y + x^2 + x^3], R) # optional - sage.rings.finite_rings - sage: (f * ~f).is_identity() # optional - sage.rings.finite_rings + sage: R. = GF(17)[] + sage: f = R.hom([3*x, y + x^2 + x^3], R) + sage: (f * ~f).is_identity() # needs sage.rings.finite_rings True """ return self.inverse() @@ -1620,10 +1639,10 @@ cdef class RingHomomorphism(RingMap): EXAMPLES:: sage: R. = QQ[] - sage: R.hom([y*z, x*z, x*y], R).is_surjective() # optional - sage.libs.singular + sage: R.hom([y*z, x*z, x*y], R).is_surjective() # needs sage.libs.singular False - sage: Q. = R.quotient(x*y*z - 1) # optional - sage.libs.singular - sage: R.hom([y*z, x*z, x*y], Q).is_surjective() # optional - sage.libs.singular + sage: Q. = R.quotient(x*y*z - 1) # needs sage.libs.singular + sage: R.hom([y*z, x*z, x*y], Q).is_surjective() # needs sage.libs.singular True ALGORITHM: @@ -1644,10 +1663,10 @@ cdef class RingHomomorphism(RingMap): EXAMPLES:: sage: R. = QQ[] - sage: R.hom([y*z, x*z, x*y], R).is_invertible() # optional - sage.libs.singular + sage: R.hom([y*z, x*z, x*y], R).is_invertible() # needs sage.libs.singular False - sage: Q. = R.quotient(x*y*z - 1) # optional - sage.libs.singular - sage: Q.hom([y*z, x*z, x*y], Q).is_invertible() # optional - sage.libs.singular + sage: Q. = R.quotient(x*y*z - 1) # needs sage.libs.singular + sage: Q.hom([y*z, x*z, x*y], Q).is_invertible() # needs sage.libs.singular True ALGORITHM: @@ -1789,12 +1808,12 @@ cdef class RingHomomorphism_im_gens(RingHomomorphism): Here's another example where the domain isn't free:: - sage: S. = R.quotient(x - y) # optional - sage.libs.singular - sage: phi = S.hom([xx + 1, xx + 1]) # optional - sage.libs.singular + sage: S. = R.quotient(x - y) # needs sage.libs.singular + sage: phi = S.hom([xx + 1, xx + 1]) # needs sage.libs.singular Note that one has to specify valid images:: - sage: phi = S.hom([xx + 1, xx - 1]) # optional - sage.libs.singular + sage: phi = S.hom([xx + 1, xx - 1]) # needs sage.libs.singular Traceback (most recent call last): ... ValueError: relations do not all (canonically) map to 0 @@ -1803,11 +1822,11 @@ cdef class RingHomomorphism_im_gens(RingHomomorphism): You can give a map of the base ring:: sage: Zx. = ZZ[] - sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field - sage: cc = K.hom([-i]) # optional - sage.rings.number_field - sage: R. = K[] # optional - sage.rings.number_field - sage: z = 1 + i*t + (3+4*i)*t^2 # optional - sage.rings.number_field - sage: z._im_gens_(R, [t^2], base_map=cc) # optional - sage.rings.number_field + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: cc = K.hom([-i]) # needs sage.rings.number_field + sage: R. = K[] # needs sage.rings.number_field + sage: z = 1 + i*t + (3+4*i)*t^2 # needs sage.rings.number_field + sage: z._im_gens_(R, [t^2], base_map=cc) # needs sage.rings.number_field (-4*i + 3)*t^4 - i*t^2 + 1 The base map's codomain is extended to the whole codomain:: @@ -1827,8 +1846,8 @@ cdef class RingHomomorphism_im_gens(RingHomomorphism): speed up creation of a homomorphism:: sage: R. = QQ[] - sage: S. = R.quotient(x - y) # optional - sage.libs.singular - sage: phi = S.hom([xx + 1, xx - 1], check=False) # optional - sage.libs.singular + sage: S. = R.quotient(x - y) # needs sage.libs.singular + sage: phi = S.hom([xx + 1, xx - 1], check=False) # needs sage.libs.singular Traceback (most recent call last): ... ValueError: relations do not all (canonically) map to 0 @@ -1891,20 +1910,20 @@ cdef class RingHomomorphism_im_gens(RingHomomorphism): EXAMPLES:: sage: R. = ZZ[] - sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field - sage: cc = K.hom([-i]) # optional - sage.rings.number_field - sage: S. = K[] # optional - sage.rings.number_field - sage: phi = S.hom([y^2], base_map=cc) # optional - sage.rings.number_field - sage: phi # optional - sage.rings.number_field + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: cc = K.hom([-i]) # needs sage.rings.number_field + sage: S. = K[] # needs sage.rings.number_field + sage: phi = S.hom([y^2], base_map=cc) # needs sage.rings.number_field + sage: phi # needs sage.rings.number_field Ring endomorphism of Univariate Polynomial Ring in y over Number Field in i with defining polynomial x^2 + 1 Defn: y |--> y^2 with map of base ring - sage: phi(y) # optional - sage.rings.number_field + sage: phi(y) # needs sage.rings.number_field y^2 - sage: phi(i*y) # optional - sage.rings.number_field + sage: phi(i*y) # needs sage.rings.number_field -i*y^2 - sage: phi.base_map() # optional - sage.rings.number_field + sage: phi.base_map() # needs sage.rings.number_field Composite map: From: Number Field in i with defining polynomial x^2 + 1 To: Univariate Polynomial Ring in y over Number Field in i @@ -1967,51 +1986,52 @@ cdef class RingHomomorphism_im_gens(RingHomomorphism): A single variate quotient over `\QQ`:: sage: R. = QQ[] - sage: Q. = R.quotient(x^2 + x + 1) # optional - sage.libs.pari - sage: f1 = R.hom([a]) # optional - sage.libs.pari - sage: f2 = R.hom([a + a^2 + a + 1]) # optional - sage.libs.pari - sage: f1 == f2 # optional - sage.libs.pari + sage: Q. = R.quotient(x^2 + x + 1) # needs sage.libs.pari + sage: f1 = R.hom([a]) # needs sage.libs.pari + sage: f2 = R.hom([a + a^2 + a + 1]) # needs sage.libs.pari + sage: f1 == f2 # needs sage.libs.pari True - sage: f1 == R.hom([a^2]) # optional - sage.libs.pari + sage: f1 == R.hom([a^2]) # needs sage.libs.pari False - sage: f1(x^3 + x) # optional - sage.libs.pari + sage: f1(x^3 + x) # needs sage.libs.pari a + 1 - sage: f2(x^3 + x) # optional - sage.libs.pari + sage: f2(x^3 + x) # needs sage.libs.pari a + 1 TESTS:: - sage: loads(dumps(f2)) == f2 # optional - sage.libs.pari + sage: loads(dumps(f2)) == f2 # needs sage.libs.pari True :: - sage: R. = QQ[]; f = R.hom([x, x + y]); g = R.hom([y, x]) # optional - sage.libs.pari - sage: f == g # indirect doctest # optional - sage.libs.pari + sage: R. = QQ[]; f = R.hom([x, x + y]); g = R.hom([y, x]) + sage: f == g # indirect doctest False EXAMPLES: A multivariate quotient over a finite field:: - sage: R. = GF(7)[] # optional - sage.rings.finite_rings - sage: Q. = R.quotient([x^2 + x + 1, y^2 + y + 1]) # optional - sage.rings.finite_rings - sage: f1 = R.hom([a, b]) # optional - sage.rings.finite_rings - sage: f2 = R.hom([a + a^2 + a + 1, b + b^2 + b + 1]) # optional - sage.rings.finite_rings - sage: f1 == f2 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(7)[] + sage: Q. = R.quotient([x^2 + x + 1, y^2 + y + 1]) + sage: f1 = R.hom([a, b]) + sage: f2 = R.hom([a + a^2 + a + 1, b + b^2 + b + 1]) + sage: f1 == f2 True - sage: f1 == R.hom([b, a]) # optional - sage.rings.finite_rings + sage: f1 == R.hom([b, a]) False - sage: x^3 + x + y^2 # optional - sage.rings.finite_rings + sage: x^3 + x + y^2 x^3 + y^2 + x - sage: f1(x^3 + x + y^2) # optional - sage.rings.finite_rings + sage: f1(x^3 + x + y^2) a - b - sage: f2(x^3 + x + y^2) # optional - sage.rings.finite_rings + sage: f2(x^3 + x + y^2) a - b TESTS:: - sage: loads(dumps(f2)) == f2 # optional - sage.rings.finite_rings + sage: loads(dumps(f2)) == f2 # needs sage.rings.finite_rings True This was fixed in :trac:`24277`:: @@ -2120,12 +2140,13 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): Similarly, we can construct the induced homomorphism on a matrix ring over our polynomial rings:: - sage: MR = MatrixSpace(R, 2, 2) # optional - sage.modules - sage: MS = MatrixSpace(S, 2, 2) # optional - sage.modules - sage: M = MR([x^2 + 1/7*x*y - y^2, -1/2*y^2 + 2*y + 1/6, # optional - sage.modules + sage: # needs sage.modules + sage: MR = MatrixSpace(R, 2, 2) + sage: MS = MatrixSpace(S, 2, 2) + sage: M = MR([x^2 + 1/7*x*y - y^2, -1/2*y^2 + 2*y + 1/6, ....: 4*x^2 - 14*x, 1/2*y^2 + 13/4*x - 2/11*y]) - sage: Mf = MR.hom(f, MS) # optional - sage.modules - sage: Mf # optional - sage.modules + sage: Mf = MR.hom(f, MS) + sage: Mf Ring morphism: From: Full MatrixSpace of 2 by 2 dense matrices over Multivariate Polynomial Ring in x, y over Rational Field @@ -2137,19 +2158,20 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): To: Univariate Polynomial Ring in z over Rational Field Defn: x |--> 2*z y |--> 3*z - sage: Mf(M) # optional - sage.modules + sage: Mf(M) [ -29/7*z^2 -9/2*z^2 + 6*z + 1/6] [ 16*z^2 - 28*z 9/2*z^2 + 131/22*z] The construction of induced homomorphisms is recursive, and so we have:: - sage: MPR = MatrixSpace(PR, 2) # optional - sage.modules - sage: MPS = MatrixSpace(PS, 2) # optional - sage.modules - sage: M = MPR([(-x + y)*t^2 + 58*t - 3*x^2 + x*y, # optional - sage.modules + sage: # needs sage.modules + sage: MPR = MatrixSpace(PR, 2) + sage: MPS = MatrixSpace(PS, 2) + sage: M = MPR([(-x + y)*t^2 + 58*t - 3*x^2 + x*y, ....: (- 1/7*x*y - 1/40*x)*t^2 + (5*x^2 + y^2)*t + 2*y, ....: (- 1/3*y + 1)*t^2 + 1/3*x*y + y^2 + 5/2*y + 1/4, ....: (x + 6*y + 1)*t^2]) - sage: MPf = MPR.hom(f, MPS); MPf # optional - sage.modules + sage: MPf = MPR.hom(f, MPS); MPf Ring morphism: From: Full MatrixSpace of 2 by 2 dense matrices over Univariate Polynomial Ring in t over Multivariate Polynomial Ring in x, y over Rational Field @@ -2167,7 +2189,7 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): To: Univariate Polynomial Ring in z over Rational Field Defn: x |--> 2*z y |--> 3*z - sage: MPf(M) # optional - sage.modules + sage: MPf(M) [ z*t^2 + 58*t - 6*z^2 (-6/7*z^2 - 1/20*z)*t^2 + 29*z^2*t + 6*z] [ (-z + 1)*t^2 + 11*z^2 + 15/2*z + 1/4 (20*z + 1)*t^2] """ @@ -2180,9 +2202,9 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): sage: from sage.rings.morphism import RingHomomorphism_from_base sage: R. = ZZ[] sage: f = R.hom([2*x], R) - sage: P = MatrixSpace(R, 2).Hom(MatrixSpace(R, 2)) # optional - sage.modules - sage: g = RingHomomorphism_from_base(P, f) # optional - sage.modules - sage: g # optional - sage.modules + sage: P = MatrixSpace(R, 2).Hom(MatrixSpace(R, 2)) # needs sage.modules + sage: g = RingHomomorphism_from_base(P, f) # needs sage.modules + sage: g # needs sage.modules Ring endomorphism of Full MatrixSpace of 2 by 2 dense matrices over Univariate Polynomial Ring in x over Integer Ring Defn: Induced from base ring by @@ -2193,8 +2215,8 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): codomain are constructed in a compatible way. So, the following results in an error:: - sage: P = MatrixSpace(R, 2).Hom(R['t']) # optional - sage.modules - sage: g = RingHomomorphism_from_base(P, f) # optional - sage.modules + sage: P = MatrixSpace(R, 2).Hom(R['t']) # needs sage.modules + sage: g = RingHomomorphism_from_base(P, f) # needs sage.modules Traceback (most recent call last): ... ValueError: domain (Full MatrixSpace of 2 by 2 dense matrices over Univariate Polynomial Ring in x over Integer Ring) @@ -2219,10 +2241,10 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): sage: R. = QQ[] sage: S. = QQ[] sage: f = R.hom([2*z, 3*z], S) - sage: MR = MatrixSpace(R, 2) # optional - sage.modules - sage: MS = MatrixSpace(S, 2) # optional - sage.modules - sage: g = MR.hom(f, MS) # optional - sage.modules - sage: g.underlying_map() == f # optional - sage.modules + sage: MR = MatrixSpace(R, 2) # needs sage.modules + sage: MS = MatrixSpace(S, 2) # needs sage.modules + sage: g = MR.hom(f, MS) # needs sage.modules + sage: g.underlying_map() == f # needs sage.modules True """ return self._underlying @@ -2296,19 +2318,19 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): `\QQ`:: sage: R. = QQ[] - sage: Q. = R.quotient(x^2 + x + 1) # optional - sage.libs.pari sage.modules - sage: f1 = R.hom([a]) # optional - sage.libs.pari sage.libs.singular sage.modules - sage: f2 = R.hom([a + a^2 + a + 1]) # optional - sage.libs.pari sage.libs.singular sage.modules - sage: PR. = R[] # optional - sage.libs.pari sage.libs.singular sage.modules - sage: PQ = Q['s','t'] # optional - sage.libs.pari sage.libs.singular sage.modules - sage: f1P = PR.hom(f1,PQ) # optional - sage.libs.pari sage.libs.singular sage.modules - sage: f2P = PR.hom(f2,PQ) # optional - sage.libs.pari sage.libs.singular sage.modules - sage: f1P == f2P # optional - sage.libs.pari sage.libs.singular sage.modules + sage: Q. = R.quotient(x^2 + x + 1) # needs sage.libs.pari sage.modules + sage: f1 = R.hom([a]) # needs sage.libs.pari sage.libs.singular sage.modules + sage: f2 = R.hom([a + a^2 + a + 1]) # needs sage.libs.pari sage.libs.singular sage.modules + sage: PR. = R[] + sage: PQ = Q['s','t'] # needs sage.libs.pari sage.libs.singular sage.modules + sage: f1P = PR.hom(f1,PQ) # needs sage.libs.pari sage.libs.singular sage.modules + sage: f2P = PR.hom(f2,PQ) # needs sage.libs.pari sage.libs.singular sage.modules + sage: f1P == f2P # needs sage.libs.pari sage.libs.singular sage.modules True TESTS:: - sage: f1P == loads(dumps(f1P)) # optional - sage.libs.pari sage.libs.singular sage.modules + sage: f1P == loads(dumps(f1P)) # needs sage.libs.pari sage.libs.singular sage.modules True sage: R. = QQ[]; f = R.hom([x, x + y]); g = R.hom([y, x]) @@ -2321,20 +2343,21 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): A matrix ring over a multivariate quotient over a finite field:: - sage: R. = GF(7)[] # optional - sage.rings.finite_rings - sage: Q. = R.quotient([x^2 + x + 1, y^2 + y + 1]) # optional - sage.rings.finite_rings - sage: f1 = R.hom([a, b]) # optional - sage.rings.finite_rings - sage: f2 = R.hom([a + a^2 + a + 1, b + b^2 + b + 1]) # optional - sage.rings.finite_rings - sage: MR = MatrixSpace(R, 2) # optional - sage.rings.finite_rings sage.modules - sage: MQ = MatrixSpace(Q, 2) # optional - sage.rings.finite_rings sage.modules - sage: f1M = MR.hom(f1, MQ) # optional - sage.rings.finite_rings sage.modules - sage: f2M = MR.hom(f2, MQ) # optional - sage.rings.finite_rings sage.modules - sage: f1M == f2M # optional - sage.rings.finite_rings sage.modules + sage: # needs sage.rings.finite_rings + sage: R. = GF(7)[] + sage: Q. = R.quotient([x^2 + x + 1, y^2 + y + 1]) + sage: f1 = R.hom([a, b]) + sage: f2 = R.hom([a + a^2 + a + 1, b + b^2 + b + 1]) + sage: MR = MatrixSpace(R, 2) # needs sage.modules + sage: MQ = MatrixSpace(Q, 2) # needs sage.modules + sage: f1M = MR.hom(f1, MQ) # needs sage.modules + sage: f2M = MR.hom(f2, MQ) # needs sage.modules + sage: f1M == f2M # needs sage.modules True TESTS:: - sage: f1M == loads(dumps(f1M)) # optional - sage.rings.finite_rings sage.modules + sage: f1M == loads(dumps(f1M)) # needs sage.modules sage.rings.finite_rings True """ if not isinstance(other, RingHomomorphism_from_base): @@ -2355,9 +2378,9 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): sage: R1. = ZZ[] sage: f = R1.hom([x + y, x - y]) - sage: R2 = MatrixSpace(FractionField(R1)['t'], 2) # optional - sage.modules - sage: g = R2.hom(f, R2) # optional - sage.modules - sage: g #indirect doctest # optional - sage.modules + sage: R2 = MatrixSpace(FractionField(R1)['t'], 2) # needs sage.modules + sage: g = R2.hom(f, R2) # needs sage.modules + sage: g #indirect doctest # needs sage.modules Ring endomorphism of Full MatrixSpace of 2 by 2 dense matrices over Univariate Polynomial Ring in t over Fraction Field of Multivariate Polynomial Ring in x, y over Integer Ring Defn: Induced from base ring by @@ -2405,11 +2428,11 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): sage: R. = QQ[] sage: S. = QQ[] - sage: f = R.hom([a + b, a - b], S) # optional - sage.libs.singular + sage: f = R.hom([a + b, a - b], S) sage: PR. = R[] sage: PS = S['t'] - sage: Pf = PR.hom(f, PS) # optional - sage.libs.singular - sage: Pf.inverse() # optional - sage.libs.singular + sage: Pf = PR.hom(f, PS) + sage: Pf.inverse() # needs sage.libs.singular Ring morphism: From: Univariate Polynomial Ring in t over Multivariate Polynomial Ring in a, b over Rational Field @@ -2421,7 +2444,7 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): To: Multivariate Polynomial Ring in x, y over Rational Field Defn: a |--> 1/2*x + 1/2*y b |--> 1/2*x - 1/2*y - sage: Pf.inverse()(Pf(x*t^2 + y*t)) # optional - sage.libs.singular + sage: Pf.inverse()(Pf(x*t^2 + y*t)) # needs sage.libs.singular x*t^2 + y*t """ return self.parent().reversed()(self._underlying.inverse()) @@ -2435,8 +2458,8 @@ cdef class RingHomomorphism_from_fraction_field(RingHomomorphism): sage: S. = QQ[] sage: f = S.hom([x^2]) - sage: g = f.extend_to_fraction_field() # optional - sage.libs.singular - sage: type(g) # optional - sage.libs.singular + sage: g = f.extend_to_fraction_field() # needs sage.libs.singular + sage: type(g) # needs sage.libs.singular """ def __init__(self, parent, morphism): @@ -2446,10 +2469,10 @@ cdef class RingHomomorphism_from_fraction_field(RingHomomorphism): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) # optional - sage.rings.number_field - sage: f = A.coerce_map_from(ZZ) # optional - sage.rings.number_field - sage: g = f.extend_to_fraction_field() # indirect doctest # optional - sage.rings.number_field - sage: g # optional - sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 2) # needs sage.rings.number_field + sage: f = A.coerce_map_from(ZZ) # needs sage.rings.number_field + sage: g = f.extend_to_fraction_field() # indirect doctest # needs sage.rings.number_field + sage: g # needs sage.rings.number_field Ring morphism: From: Rational Field To: Number Field in a with defining polynomial x^2 - 2 @@ -2464,11 +2487,11 @@ cdef class RingHomomorphism_from_fraction_field(RingHomomorphism): EXAMPLES:: sage: S. = QQ[] - sage: f = S.hom([x^2]).extend_to_fraction_field() # optional - sage.libs.singular - sage: f # optional - sage.libs.singular + sage: f = S.hom([x^2]).extend_to_fraction_field() # needs sage.libs.singular + sage: f # needs sage.libs.singular Ring endomorphism of Fraction Field of Univariate Polynomial Ring in x over Rational Field Defn: x |--> x^2 - sage: f._repr_defn() # optional - sage.libs.singular + sage: f._repr_defn() # needs sage.libs.singular 'x |--> x^2' """ return self._morphism._repr_defn() @@ -2484,10 +2507,10 @@ cdef class RingHomomorphism_from_fraction_field(RingHomomorphism): EXAMPLES:: sage: S. = QQ[] - sage: f = S.hom([x + 1]).extend_to_fraction_field() # optional - sage.libs.singular - sage: f(1/x) # optional - sage.libs.singular + sage: f = S.hom([x + 1]).extend_to_fraction_field() # needs sage.libs.singular + sage: f(1/x) # needs sage.libs.singular 1/(x + 1) - sage: f(1/(x-1)) # optional - sage.libs.singular + sage: f(1/(x-1)) # needs sage.libs.singular 1/x """ return self._morphism(x.numerator()) / self._morphism(x.denominator()) @@ -2499,12 +2522,12 @@ cdef class RingHomomorphism_from_fraction_field(RingHomomorphism): TESTS:: sage: S. = QQ[] - sage: f = S.hom([x + 1]).extend_to_fraction_field() # optional - sage.libs.singular + sage: f = S.hom([x + 1]).extend_to_fraction_field() # needs sage.libs.singular - sage: g = copy(f) # indirect doctest # optional - sage.libs.singular - sage: f == g # optional - sage.libs.singular + sage: g = copy(f) # indirect doctest # needs sage.libs.singular + sage: f == g # needs sage.libs.singular True - sage: f is g # optional - sage.libs.singular + sage: f is g # needs sage.libs.singular False """ self._morphism = _slots['_morphism'] @@ -2517,8 +2540,8 @@ cdef class RingHomomorphism_from_fraction_field(RingHomomorphism): TESTS:: sage: S. = QQ[] - sage: f = S.hom([x + 1]).extend_to_fraction_field() # optional - sage.libs.singular - sage: loads(dumps(f)) == f # optional - sage.libs.singular + sage: f = S.hom([x + 1]).extend_to_fraction_field() # needs sage.libs.singular + sage: loads(dumps(f)) == f # needs sage.libs.singular True """ slots = RingHomomorphism._extra_slots(self) @@ -2534,8 +2557,8 @@ cdef class RingHomomorphism_from_fraction_field(RingHomomorphism): sage: S. = QQ[] sage: f = S.hom([2*x - 1]) - sage: g = f.extend_to_fraction_field() # optional - sage.libs.singular - sage: g.inverse() # optional - sage.libs.singular + sage: g = f.extend_to_fraction_field() # needs sage.libs.singular + sage: g.inverse() # needs sage.libs.singular Ring endomorphism of Fraction Field of Univariate Polynomial Ring in x over Rational Field Defn: x |--> 1/2*x + 1/2 @@ -2550,14 +2573,14 @@ cdef class RingHomomorphism_cover(RingHomomorphism): EXAMPLES:: sage: R. = PolynomialRing(QQ, 2) - sage: S. = R.quo(x^2 + y^2) # optional - sage.libs.singular - sage: phi = S.cover(); phi # optional - sage.libs.singular + sage: S. = R.quo(x^2 + y^2) # needs sage.libs.singular + sage: phi = S.cover(); phi # needs sage.libs.singular Ring morphism: From: Multivariate Polynomial Ring in x, y over Rational Field To: Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2) Defn: Natural quotient map - sage: phi(x + y) # optional - sage.libs.singular + sage: phi(x + y) # needs sage.libs.singular a + b """ def __init__(self, parent): @@ -2643,11 +2666,11 @@ cdef class RingHomomorphism_cover(RingHomomorphism): EXAMPLES:: sage: R. = PolynomialRing(QQ, 2) - sage: S. = R.quo(x^2 + y^2) # optional - sage.libs.singular - sage: phi = S.cover() # optional - sage.libs.singular - sage: phi == loads(dumps(phi)) # optional - sage.libs.singular + sage: S. = R.quo(x^2 + y^2) # needs sage.libs.singular + sage: phi = S.cover() # needs sage.libs.singular + sage: phi == loads(dumps(phi)) # needs sage.libs.singular True - sage: phi == R.quo(x^2 + y^3).cover() # optional - sage.libs.singular + sage: phi == R.quo(x^2 + y^3).cover() # needs sage.libs.singular False """ if not isinstance(other, RingHomomorphism_cover): @@ -2663,13 +2686,13 @@ cdef class RingHomomorphism_cover(RingHomomorphism): TESTS:: sage: R. = PolynomialRing(QQ, 2) - sage: S. = R.quo(x^2 + y^2) # optional - sage.libs.singular - sage: phi = S.cover() # optional - sage.libs.singular - sage: type(phi) # optional - sage.libs.singular + sage: S. = R.quo(x^2 + y^2) # needs sage.libs.singular + sage: phi = S.cover() # needs sage.libs.singular + sage: type(phi) # needs sage.libs.singular - sage: hash(phi) == hash(phi) # optional - sage.libs.singular + sage: hash(phi) == hash(phi) # needs sage.libs.singular True - sage: {phi: 1}[phi] # optional - sage.libs.singular + sage: {phi: 1}[phi] # needs sage.libs.singular 1 """ return hash((self.domain(), self.codomain())) @@ -2684,12 +2707,13 @@ cdef class RingHomomorphism_cover(RingHomomorphism): EXAMPLES:: - sage: R. = QQ['x,y'].quotient('x^2 * y^2') # optional - sage.libs.singular - sage: R.cover().inverse_image(R.ideal(x^3, y^3 + 1)) # optional - sage.libs.singular + sage: # needs sage.libs.singular + sage: R. = QQ['x,y'].quotient('x^2 * y^2') + sage: R.cover().inverse_image(R.ideal(x^3, y^3 + 1)) Ideal (x^2*y^2, x^3, y^3 + 1) of Multivariate Polynomial Ring in x, y over Rational Field - sage: S. = QQbar['u,v'].quotient('u^4 - 1') # optional - sage.libs.singular - sage: S.cover().inverse_image(S.ideal(u^2 - 1)) # optional - sage.libs.singular + sage: S. = QQbar['u,v'].quotient('u^4 - 1') + sage: S.cover().inverse_image(S.ideal(u^2 - 1)) Ideal (u^4 - 1, u^2 - 1) of Multivariate Polynomial Ring in u, v over Algebraic Field """ @@ -2704,8 +2728,8 @@ cdef class RingHomomorphism_cover(RingHomomorphism): EXAMPLES:: - sage: Q. = QQ['x,y'].quotient('x + y') # optional - sage.libs.singular - sage: Q.cover().inverse_image(u) # optional - sage.libs.singular + sage: Q. = QQ['x,y'].quotient('x + y') # needs sage.libs.singular + sage: Q.cover().inverse_image(u) # needs sage.libs.singular -y """ return b.lift() @@ -2734,23 +2758,23 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): EXAMPLES:: sage: R. = PolynomialRing(QQ, 3) - sage: S. = R.quo(x^3 + y^3 + z^3) # optional - sage.libs.singular - sage: phi = S.hom([b, c, a]); phi # optional - sage.libs.singular + sage: S. = R.quo(x^3 + y^3 + z^3) # needs sage.libs.singular + sage: phi = S.hom([b, c, a]); phi # needs sage.libs.singular Ring endomorphism of Quotient of Multivariate Polynomial Ring in x, y, z over Rational Field by the ideal (x^3 + y^3 + z^3) Defn: a |--> b b |--> c c |--> a - sage: phi(a + b + c) # optional - sage.libs.singular + sage: phi(a + b + c) # needs sage.libs.singular a + b + c - sage: loads(dumps(phi)) == phi # optional - sage.libs.singular + sage: loads(dumps(phi)) == phi # needs sage.libs.singular True Validity of the homomorphism is determined, when possible, and a ``TypeError`` is raised if there is no homomorphism sending the generators to the given images:: - sage: S.hom([b^2, c^2, a^2]) # optional - sage.libs.singular + sage: S.hom([b^2, c^2, a^2]) # needs sage.libs.singular Traceback (most recent call last): ... ValueError: relations do not all (canonically) map to 0 @@ -2762,7 +2786,7 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): EXAMPLES:: - sage: R. = QQ[]; S. = R.quo([x^2,y^2]); S.hom([yy,xx]) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo([x^2,y^2]); S.hom([yy,xx]) # needs sage.libs.singular Ring endomorphism of Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2, y^2) Defn: xx |--> yy @@ -2790,21 +2814,21 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): EXAMPLES:: sage: R. = PolynomialRing(QQ, 3) - sage: S. = R.quo(x^3 + y^3 + z^3) # optional - sage.libs.singular - sage: phi = S.hom([b, c, a]); phi # optional - sage.libs.singular + sage: S. = R.quo(x^3 + y^3 + z^3) # needs sage.libs.singular + sage: phi = S.hom([b, c, a]); phi # needs sage.libs.singular Ring endomorphism of Quotient of Multivariate Polynomial Ring in x, y, z over Rational Field by the ideal (x^3 + y^3 + z^3) Defn: a |--> b b |--> c c |--> a - sage: phi(a + b + c) # optional - sage.libs.singular + sage: phi(a + b + c) # needs sage.libs.singular a + b + c - sage: psi = copy(phi) # indirect doctest # optional - sage.libs.singular - sage: psi == phi # optional - sage.libs.singular + sage: psi = copy(phi) # indirect doctest # needs sage.libs.singular + sage: psi == phi # needs sage.libs.singular True - sage: psi is phi # optional - sage.libs.singular + sage: psi is phi # needs sage.libs.singular False - sage: psi(a) == phi(a) # optional - sage.libs.singular + sage: psi(a) == phi(a) # needs sage.libs.singular True """ @@ -2818,21 +2842,21 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): EXAMPLES:: sage: R. = PolynomialRing(QQ, 3) - sage: S. = R.quo(x^3 + y^3 + z^3) # optional - sage.libs.singular - sage: phi = S.hom([b, c, a]); phi # optional - sage.libs.singular + sage: S. = R.quo(x^3 + y^3 + z^3) # needs sage.libs.singular + sage: phi = S.hom([b, c, a]); phi # needs sage.libs.singular Ring endomorphism of Quotient of Multivariate Polynomial Ring in x, y, z over Rational Field by the ideal (x^3 + y^3 + z^3) Defn: a |--> b b |--> c c |--> a - sage: phi(a + b + c) # optional - sage.libs.singular + sage: phi(a + b + c) # needs sage.libs.singular a + b + c - sage: psi = copy(phi) # indirect doctest # optional - sage.libs.singular - sage: psi == phi # optional - sage.libs.singular + sage: psi = copy(phi) # indirect doctest # needs sage.libs.singular + sage: psi == phi # needs sage.libs.singular True - sage: psi is phi # optional - sage.libs.singular + sage: psi is phi # needs sage.libs.singular False - sage: psi(a) == phi(a) # optional - sage.libs.singular + sage: psi(a) == phi(a) # needs sage.libs.singular True """ slots = RingHomomorphism._extra_slots(self) @@ -2846,8 +2870,8 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): EXAMPLES:: - sage: R. = QQ[]; S. = R.quo([x^2, y^2]); f = S.hom([yy,xx]) # optional - sage.libs.singular - sage: f._phi() # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo([x^2, y^2]); f = S.hom([yy,xx]) # needs sage.libs.singular + sage: f._phi() # needs sage.libs.singular Ring morphism: From: Multivariate Polynomial Ring in x, y over Rational Field To: Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2, y^2) @@ -2863,8 +2887,8 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): EXAMPLES:: - sage: R. = QQ[]; S. = R.quo([x^2, y^2]) # optional - sage.libs.singular - sage: S.hom([yy,xx]).morphism_from_cover() # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo([x^2, y^2]) # needs sage.libs.singular + sage: S.hom([yy,xx]).morphism_from_cover() # needs sage.libs.singular Ring morphism: From: Multivariate Polynomial Ring in x, y over Rational Field To: Quotient of Multivariate Polynomial Ring in x, y @@ -2880,14 +2904,15 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): EXAMPLES:: - sage: R. = PolynomialRing(GF(19), 3) # optional - sage.rings.finite_rings - sage: S. = R.quo(x^3 + y^3 + z^3) # optional - sage.rings.finite_rings - sage: phi = S.hom([b, c, a]) # optional - sage.rings.finite_rings - sage: psi = S.hom([c, b, a]) # optional - sage.rings.finite_rings - sage: f = S.hom([b, c, a + a^3 + b^3 + c^3]) # optional - sage.rings.finite_rings - sage: phi == psi # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = PolynomialRing(GF(19), 3) + sage: S. = R.quo(x^3 + y^3 + z^3) + sage: phi = S.hom([b, c, a]) + sage: psi = S.hom([c, b, a]) + sage: f = S.hom([b, c, a + a^3 + b^3 + c^3]) + sage: phi == psi False - sage: phi == f # optional - sage.rings.finite_rings + sage: phi == f True """ if not isinstance(other, RingHomomorphism_from_quotient): @@ -2904,14 +2929,15 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): EXAMPLES:: - sage: R. = PolynomialRing(GF(19), 3) # optional - sage.rings.finite_rings - sage: S. = R.quo(x^3 + y^3 + z^3) # optional - sage.rings.finite_rings - sage: phi = S.hom([b, c, a]) # optional - sage.rings.finite_rings - sage: type(phi) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = PolynomialRing(GF(19), 3) + sage: S. = R.quo(x^3 + y^3 + z^3) + sage: phi = S.hom([b, c, a]) + sage: type(phi) - sage: hash(phi) == hash(phi) # optional - sage.rings.finite_rings + sage: hash(phi) == hash(phi) True - sage: {phi: 1}[phi] # optional - sage.rings.finite_rings + sage: {phi: 1}[phi] 1 """ return hash(self.phi) @@ -2922,9 +2948,9 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): EXAMPLES:: - sage: R. = QQ[]; S. = R.quo([x^2,y^2]) # optional - sage.libs.singular - sage: f = S.hom([yy, xx]) # optional - sage.libs.singular - sage: print(f._repr_defn()) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo([x^2,y^2]) # needs sage.libs.singular + sage: f = S.hom([yy, xx]) # needs sage.libs.singular + sage: print(f._repr_defn()) # needs sage.libs.singular xx |--> yy yy |--> xx """ @@ -2939,8 +2965,8 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): EXAMPLES:: - sage: R. = QQ[]; S. = R.quo([x^2, y^2]); f = S.hom([yy, xx]) # optional - sage.libs.singular - sage: f(3*x + (1/2)*y) # indirect doctest # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo([x^2, y^2]); f = S.hom([yy, xx]) # needs sage.libs.singular + sage: f(3*x + (1/2)*y) # indirect doctest # needs sage.libs.singular 1/2*xx + 3*yy """ return self.phi(self.lift(x)) @@ -2967,11 +2993,11 @@ cdef class FrobeniusEndomorphism_generic(RingHomomorphism): TESTS:: sage: from sage.rings.morphism import FrobeniusEndomorphism_generic - sage: K. = PowerSeriesRing(GF(5)) # optional - sage.rings.finite_rings - sage: FrobeniusEndomorphism_generic(K) # optional - sage.rings.finite_rings + sage: K. = PowerSeriesRing(GF(5)) + sage: FrobeniusEndomorphism_generic(K) Frobenius endomorphism x |--> x^5 of Power Series Ring in u over Finite Field of size 5 - sage: FrobeniusEndomorphism_generic(K, 2) # optional - sage.rings.finite_rings + sage: FrobeniusEndomorphism_generic(K, 2) Frobenius endomorphism x |--> x^(5^2) of Power Series Ring in u over Finite Field of size 5 """ @@ -3000,10 +3026,11 @@ cdef class FrobeniusEndomorphism_generic(RingHomomorphism): EXAMPLES:: - sage: K = Frac(GF(5)['T']) # optional - sage.rings.finite_rings - sage: phi = K.frobenius_endomorphism() # optional - sage.rings.finite_rings - sage: psi = copy(phi) # optional - sage.rings.finite_rings - sage: phi == psi # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = Frac(GF(5)['T']) + sage: phi = K.frobenius_endomorphism() + sage: psi = copy(phi) + sage: phi == psi True """ self._p = _slots['_domain'].characteristic() @@ -3020,16 +3047,16 @@ cdef class FrobeniusEndomorphism_generic(RingHomomorphism): EXAMPLES:: - sage: K = Frac(GF(25)['T']) # optional - sage.rings.finite_rings - sage: phi = K.frobenius_endomorphism(2) # optional - sage.rings.finite_rings - sage: phi # optional - sage.rings.finite_rings + sage: K = Frac(GF(25)['T']) # needs sage.rings.finite_rings + sage: phi = K.frobenius_endomorphism(2) # needs sage.rings.finite_rings + sage: phi # needs sage.rings.finite_rings Frobenius endomorphism x |--> x^(5^2) of Fraction Field of Univariate Polynomial Ring in T over Finite Field in z2 of size 5^2 - sage: psi = loads(dumps(phi)); psi # optional - sage.rings.finite_rings + sage: psi = loads(dumps(phi)); psi # needs sage.rings.finite_rings Frobenius endomorphism x |--> x^(5^2) of Fraction Field of Univariate Polynomial Ring in T over Finite Field in z2 of size 5^2 - sage: phi == psi # optional - sage.rings.finite_rings + sage: phi == psi # needs sage.rings.finite_rings True """ slots = RingHomomorphism._extra_slots(self) @@ -3042,12 +3069,12 @@ cdef class FrobeniusEndomorphism_generic(RingHomomorphism): EXAMPLES:: - sage: K. = PowerSeriesRing(GF(5)) # optional - sage.rings.finite_rings - sage: Frob = K.frobenius_endomorphism(); Frob # optional - sage.rings.finite_rings + sage: K. = PowerSeriesRing(GF(5)) + sage: Frob = K.frobenius_endomorphism(); Frob Frobenius endomorphism x |--> x^5 of Power Series Ring in u over Finite Field of size 5 - sage: Frob._repr_() # optional - sage.rings.finite_rings + sage: Frob._repr_() 'Frobenius endomorphism x |--> x^5 of Power Series Ring in u over Finite Field of size 5' """ @@ -3066,11 +3093,12 @@ cdef class FrobeniusEndomorphism_generic(RingHomomorphism): EXAMPLES:: - sage: K. = PowerSeriesRing(GF(5)) # optional - sage.rings.finite_rings - sage: Frob = K.frobenius_endomorphism() # optional - sage.rings.finite_rings - sage: Frob._repr_short() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = PowerSeriesRing(GF(5)) + sage: Frob = K.frobenius_endomorphism() + sage: Frob._repr_short() 'Frob' - sage: (Frob^2)._repr_short() # optional - sage.rings.finite_rings + sage: (Frob^2)._repr_short() 'Frob^2' """ if self._power == 0: @@ -3087,9 +3115,9 @@ cdef class FrobeniusEndomorphism_generic(RingHomomorphism): EXAMPLES:: - sage: K. = PowerSeriesRing(GF(5)) # optional - sage.rings.finite_rings - sage: Frob = K.frobenius_endomorphism(2) # optional - sage.rings.finite_rings - sage: Frob._latex_() # optional - sage.rings.finite_rings + sage: K. = PowerSeriesRing(GF(5)) + sage: Frob = K.frobenius_endomorphism(2) + sage: Frob._latex_() '\\verb"Frob"^{2}' """ if self._power == 0: @@ -3104,11 +3132,12 @@ cdef class FrobeniusEndomorphism_generic(RingHomomorphism): """ TESTS:: - sage: K. = PowerSeriesRing(GF(5)) # optional - sage.rings.finite_rings - sage: Frob = K.frobenius_endomorphism() # optional - sage.rings.finite_rings - sage: Frob(u) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = PowerSeriesRing(GF(5)) + sage: Frob = K.frobenius_endomorphism() + sage: Frob(u) u^5 - sage: (Frob^2)(1 + u) # optional - sage.rings.finite_rings + sage: (Frob^2)(1 + u) 1 + u^25 """ return x ** self._q @@ -3121,11 +3150,12 @@ cdef class FrobeniusEndomorphism_generic(RingHomomorphism): EXAMPLES:: - sage: K. = PowerSeriesRing(GF(5)) # optional - sage.rings.finite_rings - sage: Frob = K.frobenius_endomorphism() # optional - sage.rings.finite_rings - sage: Frob.power() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = PowerSeriesRing(GF(5)) + sage: Frob = K.frobenius_endomorphism() + sage: Frob.power() 1 - sage: (Frob^9).power() # optional - sage.rings.finite_rings + sage: (Frob^9).power() 9 """ return self._power @@ -3136,11 +3166,11 @@ cdef class FrobeniusEndomorphism_generic(RingHomomorphism): EXAMPLES:: - sage: K. = PowerSeriesRing(GF(5)) # optional - sage.rings.finite_rings - sage: Frob = K.frobenius_endomorphism(); Frob # optional - sage.rings.finite_rings + sage: K. = PowerSeriesRing(GF(5)) + sage: Frob = K.frobenius_endomorphism(); Frob Frobenius endomorphism x |--> x^5 of Power Series Ring in u over Finite Field of size 5 - sage: Frob^2 # optional - sage.rings.finite_rings + sage: Frob^2 Frobenius endomorphism x |--> x^(5^2) of Power Series Ring in u over Finite Field of size 5 """ @@ -3152,14 +3182,15 @@ cdef class FrobeniusEndomorphism_generic(RingHomomorphism): EXAMPLES:: - sage: K. = PowerSeriesRing(GF(5)) # optional - sage.rings.finite_rings - sage: f = K.frobenius_endomorphism(); f # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = PowerSeriesRing(GF(5)) + sage: f = K.frobenius_endomorphism(); f Frobenius endomorphism x |--> x^5 of Power Series Ring in u over Finite Field of size 5 - sage: g = K.frobenius_endomorphism(2); g # optional - sage.rings.finite_rings + sage: g = K.frobenius_endomorphism(2); g Frobenius endomorphism x |--> x^(5^2) of Power Series Ring in u over Finite Field of size 5 - sage: f * g # optional - sage.rings.finite_rings + sage: f * g Frobenius endomorphism x |--> x^(5^3) of Power Series Ring in u over Finite Field of size 5 """ @@ -3201,15 +3232,15 @@ def _tensor_product_ring(B, A): sage: from sage.rings.morphism import _tensor_product_ring sage: R. = QQ[] - sage: S. = R.quotient(x^2 + y^2) # optional - sage.libs.singular - sage: Q = _tensor_product_ring(S, R); Q # optional - sage.libs.singular + sage: S. = R.quotient(x^2 + y^2) # needs sage.libs.singular + sage: Q = _tensor_product_ring(S, R); Q # needs sage.libs.singular Quotient of Multivariate Polynomial Ring in u, v, x, y over Rational Field by the ideal (u^2 + v^2) - sage: Q.term_order() # optional - sage.libs.singular + sage: Q.term_order() # needs sage.libs.singular Block term order with blocks: (Degree reverse lexicographic term order of length 2, Degree reverse lexicographic term order of length 2) - sage: _tensor_product_ring(R, R) # optional - sage.libs.singular + sage: _tensor_product_ring(R, R) Multivariate Polynomial Ring in y0, y1, x0, x1 over Rational Field TESTS: diff --git a/src/sage/rings/multi_power_series_ring.py b/src/sage/rings/multi_power_series_ring.py index e8b58284316..3e65e05f6af 100644 --- a/src/sage/rings/multi_power_series_ring.py +++ b/src/sage/rings/multi_power_series_ring.py @@ -75,21 +75,22 @@ - Use angle-bracket notation:: - sage: S. = PowerSeriesRing(GF(65537)); S # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: S. = PowerSeriesRing(GF(65537)); S Multivariate Power Series Ring in x, y over Finite Field of size 65537 - sage: s = -30077*x + 9485*x*y - 6260*y^3 + 12870*x^2*y^2 - 20289*y^4 + S.O(5); s # optional - sage.rings.finite_rings + sage: s = -30077*x + 9485*x*y - 6260*y^3 + 12870*x^2*y^2 - 20289*y^4 + S.O(5); s -30077*x + 9485*x*y - 6260*y^3 + 12870*x^2*y^2 - 20289*y^4 + O(x, y)^5 - sage: s in S # optional - sage.rings.finite_rings + sage: s in S True - sage: TestSuite(S).run() # optional - sage.rings.finite_rings - sage: loads(dumps(S)) is S # optional - sage.rings.finite_rings + sage: TestSuite(S).run() + sage: loads(dumps(S)) is S True - Use double square bracket notation:: sage: ZZ[['s,t,u']] Multivariate Power Series Ring in s, t, u over Integer Ring - sage: GF(127931)[['x,y']] # optional - sage.rings.finite_rings + sage: GF(127931)[['x,y']] # needs sage.rings.finite_rings Multivariate Power Series Ring in x, y over Finite Field of size 127931 Variable ordering determines how series are displayed. @@ -117,16 +118,16 @@ sage: R. = PowerSeriesRing(QQ); R Multivariate Power Series Ring in t, u, v over Rational Field - sage: R.base_extend(RR) # optional - sage.rings.real_mpfr + sage: R.base_extend(RR) # needs sage.rings.real_mpfr Multivariate Power Series Ring in t, u, v over Real Field with 53 bits of precision sage: R.change_ring(IntegerModRing(10)) Multivariate Power Series Ring in t, u, v over Ring of integers modulo 10 - sage: S = PowerSeriesRing(GF(65537),2,'x,y'); S # optional - sage.rings.finite_rings + sage: S = PowerSeriesRing(GF(65537),2,'x,y'); S # needs sage.rings.finite_rings Multivariate Power Series Ring in x, y over Finite Field of size 65537 - sage: S.change_ring(GF(5)) # optional - sage.rings.finite_rings + sage: S.change_ring(GF(5)) # needs sage.rings.finite_rings Multivariate Power Series Ring in x, y over Finite Field of size 5 Coercion from polynomial ring:: @@ -159,19 +160,19 @@ Coercion from symbolic ring:: - sage: x,y = var('x,y') # optional - sage.symbolic - sage: S = PowerSeriesRing(GF(11),2,'x,y'); S # optional - sage.rings.finite_rings + sage: x,y = var('x,y') # needs sage.symbolic + sage: S = PowerSeriesRing(GF(11),2,'x,y'); S Multivariate Power Series Ring in x, y over Finite Field of size 11 - sage: type(x) # optional - sage.symbolic + sage: type(x) # needs sage.symbolic - sage: type(S(x)) # optional - sage.rings.finite_rings sage.symbolic + sage: type(S(x)) # needs sage.rings.finite_rings sage.symbolic - sage: f = S(2/7 -100*x^2 + 1/3*x*y + y^2).O(3); f # optional - sage.rings.finite_rings sage.symbolic + sage: f = S(2/7 -100*x^2 + 1/3*x*y + y^2).O(3); f # needs sage.rings.finite_rings sage.symbolic 5 - x^2 + 4*x*y + y^2 + O(x, y)^3 - sage: f.parent() # optional - sage.rings.finite_rings sage.symbolic + sage: f.parent() # needs sage.rings.finite_rings sage.symbolic Multivariate Power Series Ring in x, y over Finite Field of size 11 - sage: f.parent() == S # optional - sage.rings.finite_rings sage.symbolic + sage: f.parent() == S # needs sage.rings.finite_rings sage.symbolic True The implementation of the multivariate power series ring uses a combination @@ -390,11 +391,12 @@ def _repr_(self): EXAMPLES:: - sage: R. = PowerSeriesRing(GF(17)) # optional - sage.rings.finite_rings - sage: R #indirect doctest # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = PowerSeriesRing(GF(17)) + sage: R #indirect doctest Multivariate Power Series Ring in x, y over Finite Field of size 17 - sage: R.rename('my multivariate power series ring') # optional - sage.rings.finite_rings - sage: R # optional - sage.rings.finite_rings + sage: R.rename('my multivariate power series ring') + sage: R my multivariate power series ring """ if self.ngens() == 0: @@ -479,10 +481,10 @@ def characteristic(self): EXAMPLES:: - sage: H = PowerSeriesRing(GF(65537),4,'f'); H # optional - sage.rings.finite_rings + sage: H = PowerSeriesRing(GF(65537),4,'f'); H # needs sage.rings.finite_rings Multivariate Power Series Ring in f0, f1, f2, f3 over Finite Field of size 65537 - sage: H.characteristic() # optional - sage.rings.finite_rings + sage: H.characteristic() # needs sage.rings.finite_rings 65537 """ return self.base_ring().characteristic() @@ -543,7 +545,7 @@ def change_ring(self, R): sage: R. = PowerSeriesRing(QQ); R Multivariate Power Series Ring in t, u, v over Rational Field - sage: R.base_extend(RR) # optional - sage.rings.real_mpfr + sage: R.base_extend(RR) # needs sage.rings.real_mpfr Multivariate Power Series Ring in t, u, v over Real Field with 53 bits of precision sage: R.change_ring(IntegerModRing(10)) @@ -555,10 +557,10 @@ def change_ring(self, R): TypeError: no base extension defined - sage: S = PowerSeriesRing(GF(65537),2,'x,y'); S # optional - sage.rings.finite_rings + sage: S = PowerSeriesRing(GF(65537),2,'x,y'); S # needs sage.rings.finite_rings Multivariate Power Series Ring in x, y over Finite Field of size 65537 - sage: S.change_ring(GF(5)) # optional - sage.rings.finite_rings + sage: S.change_ring(GF(5)) # needs sage.rings.finite_rings Multivariate Power Series Ring in x, y over Finite Field of size 5 """ return PowerSeriesRing(R, names=self.variable_names(), default_prec=self.default_prec()) @@ -576,16 +578,16 @@ def remove_var(self, *var): Power Series Ring in u over Integer Ring - sage: M = PowerSeriesRing(GF(5),5,'t'); M # optional - sage.rings.finite_rings + sage: M = PowerSeriesRing(GF(5),5,'t'); M Multivariate Power Series Ring in t0, t1, t2, t3, t4 over Finite Field of size 5 - sage: M.remove_var(M.gens()[3]) # optional - sage.rings.finite_rings + sage: M.remove_var(M.gens()[3]) Multivariate Power Series Ring in t0, t1, t2, t4 over Finite Field of size 5 Removing all variables results in the base ring:: - sage: M.remove_var(*M.gens()) # optional - sage.rings.finite_rings + sage: M.remove_var(*M.gens()) Finite Field of size 5 """ @@ -634,10 +636,10 @@ def _coerce_impl(self, f): sage: R(f2) -2*v^2 + 5*u*v^2 + O(t, u, v)^6 - sage: R2 = R.change_ring(GF(2)) # optional - sage.rings.finite_rings - sage: R2(f1) # optional - sage.rings.finite_rings + sage: R2 = R.change_ring(GF(2)) + sage: R2(f1) v + t*v - sage: R2(f2) # optional - sage.rings.finite_rings + sage: R2(f2) u*v^2 + O(t, u, v)^6 TESTS:: @@ -709,13 +711,13 @@ def _is_valid_homomorphism_(self, codomain, im_gens, base_map=None): from the base ring to the codomain:: sage: T. = ZZ[] - sage: K. = NumberField(t^2 + 1) # optional - sage.rings.number_field - sage: Q8. = CyclotomicField(8) # optional - sage.rings.number_field - sage: X. = PowerSeriesRing(Q8) # optional - sage.rings.number_field - sage: M. = PowerSeriesRing(K) # optional - sage.rings.number_field - sage: M._is_valid_homomorphism_(X, [x,x,x+x^2]) # no coercion # optional - sage.rings.number_field + sage: K. = NumberField(t^2 + 1) # needs sage.rings.number_field + sage: Q8. = CyclotomicField(8) # needs sage.rings.number_field + sage: X. = PowerSeriesRing(Q8) # needs sage.rings.number_field + sage: M. = PowerSeriesRing(K) # needs sage.rings.number_field + sage: M._is_valid_homomorphism_(X, [x,x,x+x^2]) # no coercion # needs sage.rings.number_field False - sage: M._is_valid_homomorphism_(X, [x,x,x+x^2], base_map=K.hom([z^2])) # optional - sage.rings.number_field + sage: M._is_valid_homomorphism_(X, [x,x,x+x^2], base_map=K.hom([z^2])) # needs sage.rings.number_field True """ try: @@ -757,22 +759,23 @@ def _coerce_map_from_(self, P): EXAMPLES:: - sage: A = GF(17)[['x','y']] # optional - sage.rings.finite_rings - sage: A.has_coerce_map_from(ZZ) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: A = GF(17)[['x','y']] + sage: A.has_coerce_map_from(ZZ) True - sage: A.has_coerce_map_from(ZZ['x']) # optional - sage.rings.finite_rings + sage: A.has_coerce_map_from(ZZ['x']) True - sage: A.has_coerce_map_from(ZZ['y','x']) # optional - sage.rings.finite_rings + sage: A.has_coerce_map_from(ZZ['y','x']) True - sage: A.has_coerce_map_from(ZZ[['x']]) # optional - sage.rings.finite_rings + sage: A.has_coerce_map_from(ZZ[['x']]) True - sage: A.has_coerce_map_from(ZZ[['y','x']]) # optional - sage.rings.finite_rings + sage: A.has_coerce_map_from(ZZ[['y','x']]) True - sage: A.has_coerce_map_from(ZZ['x','z']) # optional - sage.rings.finite_rings + sage: A.has_coerce_map_from(ZZ['x','z']) False - sage: A.has_coerce_map_from(GF(3)['x','y']) # optional - sage.rings.finite_rings + sage: A.has_coerce_map_from(GF(3)['x','y']) False - sage: A.has_coerce_map_from(Frac(ZZ['y','x'])) # optional - sage.rings.finite_rings + sage: A.has_coerce_map_from(Frac(ZZ['y','x'])) False TESTS:: @@ -780,9 +783,9 @@ def _coerce_map_from_(self, P): sage: M = PowerSeriesRing(ZZ, 3, 'x,y,z') sage: M._coerce_map_from_(M) True - sage: M._coerce_map_from_(M.remove_var(x)) # optional - sage.symbolic + sage: M._coerce_map_from_(M.remove_var(x)) # needs sage.symbolic True - sage: M._coerce_map_from_(PowerSeriesRing(ZZ,x)) # optional - sage.symbolic + sage: M._coerce_map_from_(PowerSeriesRing(ZZ,x)) # needs sage.symbolic True sage: M._coerce_map_from_(PolynomialRing(ZZ,'x,z')) True diff --git a/src/sage/rings/multi_power_series_ring_element.py b/src/sage/rings/multi_power_series_ring_element.py index eeca8245b90..3ce76fdabf9 100644 --- a/src/sage/rings/multi_power_series_ring_element.py +++ b/src/sage/rings/multi_power_series_ring_element.py @@ -253,19 +253,20 @@ class MPowerSeries(PowerSeries): 1 + s + t - s*t + O(s, t)^5 - sage: T = PowerSeriesRing(GF(3),5,'t'); T # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: T = PowerSeriesRing(GF(3),5,'t'); T Multivariate Power Series Ring in t0, t1, t2, t3, t4 over Finite Field of size 3 - sage: t = T.gens() # optional - sage.rings.finite_rings - sage: w = t[0] - 2*t[1]*t[3] + 5*t[4]^3 - t[0]^3*t[2]^2; w # optional - sage.rings.finite_rings + sage: t = T.gens() + sage: w = t[0] - 2*t[1]*t[3] + 5*t[4]^3 - t[0]^3*t[2]^2; w t0 + t1*t3 - t4^3 - t0^3*t2^2 - sage: w = w.add_bigoh(5); w # optional - sage.rings.finite_rings + sage: w = w.add_bigoh(5); w t0 + t1*t3 - t4^3 + O(t0, t1, t2, t3, t4)^5 - sage: w in T # optional - sage.rings.finite_rings + sage: w in T True - sage: w = t[0] - 2*t[0]*t[2] + 5*t[4]^3 - t[0]^3*t[2]^2 + T.O(6) # optional - sage.rings.finite_rings - sage: w # optional - sage.rings.finite_rings + sage: w = t[0] - 2*t[0]*t[2] + 5*t[4]^3 - t[0]^3*t[2]^2 + T.O(6) # needs sage.rings.finite_rings + sage: w # needs sage.rings.finite_rings t0 + t0*t2 - t4^3 - t0^3*t2^2 + O(t0, t1, t2, t3, t4)^6 @@ -274,20 +275,21 @@ class MPowerSeries(PowerSeries): sage: S.random_element(4) # random -2*t + t^2 - 12*s^3 + O(s, t)^4 - sage: T.random_element(10) # random # optional - sage.rings.finite_rings + sage: T.random_element(10) # random # needs sage.rings.finite_rings -t1^2*t3^2*t4^2 + t1^5*t3^3*t4 + O(t0, t1, t2, t3, t4)^10 Convert elements from polynomial rings:: - sage: R = PolynomialRing(ZZ, 5, T.variable_names()) # optional - sage.libs.pari - sage: t = R.gens() # optional - sage.libs.pari - sage: r = -t[2]*t[3] + t[3]^2 + t[4]^2 # optional - sage.libs.pari - sage: T(r) # optional - sage.libs.pari + sage: # needs sage.rings.finite_rings + sage: R = PolynomialRing(ZZ, 5, T.variable_names()) + sage: t = R.gens() + sage: r = -t[2]*t[3] + t[3]^2 + t[4]^2 + sage: T(r) -t2*t3 + t3^2 + t4^2 - sage: r.parent() # optional - sage.libs.pari + sage: r.parent() Multivariate Polynomial Ring in t0, t1, t2, t3, t4 over Integer Ring - sage: r in T # optional - sage.libs.pari + sage: r in T True """ @@ -314,9 +316,9 @@ def __init__(self, parent, x=0, prec=infinity, is_gen=False, check=False): Multivariate Power Series Ring in s, t over Rational Field sage: x = polygen(ZZ, 'x') - sage: K = NumberField(x - 3,'a') # optional - sage.rings.number_field - sage: g = K.random_element()*f # optional - sage.rings.number_field - sage: g.parent() # optional - sage.rings.number_field + sage: K = NumberField(x - 3,'a') # needs sage.rings.number_field + sage: g = K.random_element()*f # needs sage.rings.number_field + sage: g.parent() # needs sage.rings.number_field Multivariate Power Series Ring in s, t over Number Field in a with defining polynomial x - 3 @@ -451,20 +453,20 @@ def __call__(self, *x, **kwds): Checking that :trac:`15059` is fixed:: - sage: M. = PowerSeriesRing(GF(5)) # optional - sage.rings.finite_rings - sage: s = M.hom([u, u+v]) # optional - sage.rings.finite_rings - sage: s(M.one()) # optional - sage.rings.finite_rings + sage: M. = PowerSeriesRing(GF(5)) + sage: s = M.hom([u, u+v]) + sage: s(M.one()) 1 Since :trac:`26105` you can specify a map on the base ring:: sage: Zx. = ZZ[] - sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field - sage: cc = K.hom([-i]) # optional - sage.rings.number_field - sage: R. = PowerSeriesRing(K) # optional - sage.rings.number_field - sage: f = s^2 + i*s*t + (3+4*i)*s^3 + R.O(4); f # optional - sage.rings.number_field + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field + sage: cc = K.hom([-i]) # needs sage.rings.number_field + sage: R. = PowerSeriesRing(K) # needs sage.rings.number_field + sage: f = s^2 + i*s*t + (3+4*i)*s^3 + R.O(4); f # needs sage.rings.number_field s^2 + i*s*t + (4*i + 3)*s^3 + O(s, t)^4 - sage: f(t, s, base_map=cc) # optional - sage.rings.number_field + sage: f(t, s, base_map=cc) # needs sage.rings.number_field (-i)*s*t + t^2 + (-4*i + 3)*t^3 + O(s, t)^4 """ if len(x) != self.parent().ngens(): @@ -516,25 +518,25 @@ def _subs_formal(self, *x, **kwds): -2/33*z^3 - 1/5*z^5 sage: f(z,1) #indirect doctest -1/5 - 2/33*z + z^2 - z^5 - sage: RF = RealField(10) # optional - sage.rings.real_mpfr - sage: f(z, RF(1)) # indirect doctest # optional - sage.rings.real_mpfr + sage: RF = RealField(10) # needs sage.rings.real_mpfr + sage: f(z, RF(1)) # indirect doctest # needs sage.rings.real_mpfr -0.20 - 0.061*z + 1.0*z^2 - 0.00*z^3 - 0.00*z^4 - 1.0*z^5 - sage: m = matrix(QQ,[[1,0,1],[0,2,1],[-1,0,0]]); m # optional - sage.modules + sage: m = matrix(QQ,[[1,0,1],[0,2,1],[-1,0,0]]); m # needs sage.modules [ 1 0 1] [ 0 2 1] [-1 0 0] - sage: f(m,m) # indirect doctest # optional - sage.modules + sage: f(m,m) # indirect doctest # needs sage.modules [ 2/33 0 1/5] [ 131/55 -1136/165 -24/11] [ -1/5 0 -23/165] - sage: f(m,m) == -2/33*m^3 - 1/5*m^5 # indirect doctest # optional - sage.modules + sage: f(m,m) == -2/33*m^3 - 1/5*m^5 # indirect doctest # needs sage.modules True sage: f = f.add_bigoh(10) sage: f(z,z) -2/33*z^3 - 1/5*z^5 + O(z^10) - sage: f(m,m) # optional - sage.modules + sage: f(m,m) # needs sage.modules Traceback (most recent call last): ... AttributeError: 'sage.matrix.matrix_rational_dense.Matrix_rational_dense' object has no attribute 'add_bigoh' @@ -566,14 +568,15 @@ def _value(self): EXAMPLES:: - sage: R. = PowerSeriesRing(GF(5)); R # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = PowerSeriesRing(GF(5)); R Multivariate Power Series Ring in a, b, c over Finite Field of size 5 - sage: f = 1 + a + b - a*b + R.O(3); f # optional - sage.rings.finite_rings + sage: f = 1 + a + b - a*b + R.O(3); f 1 + a + b - a*b + O(a, b, c)^3 - sage: f._value() # optional - sage.rings.finite_rings + sage: f._value() 1 + a + b - a*b - sage: f._value().parent() # optional - sage.rings.finite_rings + sage: f._value().parent() Multivariate Polynomial Ring in a, b, c over Finite Field of size 5 """ return self._go_to_fg(self._bg_value) @@ -602,15 +605,16 @@ def _latex_(self): EXAMPLES:: - sage: M = PowerSeriesRing(GF(5),3,'t'); M # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: M = PowerSeriesRing(GF(5),3,'t'); M Multivariate Power Series Ring in t0, t1, t2 over Finite Field of size 5 - sage: t = M.gens() # optional - sage.rings.finite_rings - sage: f = (-t[0]^4*t[1]^3*t[2]^4 - 2*t[0]*t[1]^4*t[2]^7 # optional - sage.rings.finite_rings + sage: t = M.gens() + sage: f = (-t[0]^4*t[1]^3*t[2]^4 - 2*t[0]*t[1]^4*t[2]^7 ....: + 2*t[1]*t[2]^12 + 2*t[0]^7*t[1]^5*t[2]^2 + M.O(15)) - sage: f # optional - sage.rings.finite_rings + sage: f -t0^4*t1^3*t2^4 - 2*t0*t1^4*t2^7 + 2*t1*t2^12 + 2*t0^7*t1^5*t2^2 + O(t0, t1, t2)^15 - sage: f._latex_() # optional - sage.rings.finite_rings + sage: f._latex_() '-t_{0}^{4} t_{1}^{3} t_{2}^{4} + 3 t_{0} t_{1}^{4} t_{2}^{7} + 2 t_{1} t_{2}^{12} + 2 t_{0}^{7} t_{1}^{5} t_{2}^{2} + O(t_{0}, t_{1}, t_{2})^{15}' @@ -708,30 +712,32 @@ def _richcmp_(self, other, op): EXAMPLES:: - sage: R. = PowerSeriesRing(GF(5)); R # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = PowerSeriesRing(GF(5)); R Multivariate Power Series Ring in a, b, c over Finite Field of size 5 - sage: f = a + b + c + a^2*c # optional - sage.rings.finite_rings - sage: f == f^2 # optional - sage.rings.finite_rings + sage: f = a + b + c + a^2*c + sage: f == f^2 False - sage: f = f.truncate() # optional - sage.rings.finite_rings - sage: f == f.O(4) # optional - sage.rings.finite_rings + sage: f = f.truncate() + sage: f == f.O(4) True Ordering is determined by underlying polynomial ring:: - sage: a > b # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: a > b True - sage: a > a^2 # optional - sage.rings.finite_rings + sage: a > a^2 True - sage: b > a^2 # optional - sage.rings.finite_rings + sage: b > a^2 True - sage: (f^2).O(3) # optional - sage.rings.finite_rings + sage: (f^2).O(3) a^2 + 2*a*b + 2*a*c + b^2 + 2*b*c + c^2 + O(a, b, c)^3 - sage: f < f^2 # optional - sage.rings.finite_rings + sage: f < f^2 False - sage: f > f^2 # optional - sage.rings.finite_rings + sage: f > f^2 True - sage: f < 2*f # optional - sage.rings.finite_rings + sage: f < 2*f True """ return richcmp(self._bg_value, other._bg_value, op) @@ -893,24 +899,24 @@ def quo_rem(self, other, precision=None): sage: R. = PowerSeriesRing(ZZ) sage: f = 1 + a + b - a*b + R.O(3) sage: g = 1 + 2*a - 3*a*b + R.O(3) - sage: q, r = f.quo_rem(g); q, r # optional - sage.libs.singular + sage: q, r = f.quo_rem(g); q, r # needs sage.libs.singular (1 - a + b + 2*a^2 + O(a, b, c)^3, 0 + O(a, b, c)^3) - sage: f == q*g + r # optional - sage.libs.singular + sage: f == q*g + r # needs sage.libs.singular True - sage: q, r = (a*f).quo_rem(g); q, r # optional - sage.libs.singular + sage: q, r = (a*f).quo_rem(g); q, r # needs sage.libs.singular (a - a^2 + a*b + 2*a^3 + O(a, b, c)^4, 0 + O(a, b, c)^4) - sage: a*f == q*g + r # optional - sage.libs.singular + sage: a*f == q*g + r # needs sage.libs.singular True - sage: q, r = (a*f).quo_rem(a*g); q, r # optional - sage.libs.singular + sage: q, r = (a*f).quo_rem(a*g); q, r # needs sage.libs.singular (1 - a + b + 2*a^2 + O(a, b, c)^3, 0 + O(a, b, c)^4) - sage: a*f == q*(a*g) + r # optional - sage.libs.singular + sage: a*f == q*(a*g) + r # needs sage.libs.singular True - sage: q, r = (a*f).quo_rem(b*g); q, r # optional - sage.libs.singular + sage: q, r = (a*f).quo_rem(b*g); q, r # needs sage.libs.singular (a - 3*a^2 + O(a, b, c)^3, a + a^2 + O(a, b, c)^4) - sage: a*f == q*(b*g) + r # optional - sage.libs.singular + sage: a*f == q*(b*g) + r # needs sage.libs.singular True Trying to divide two polynomials, we run into the issue that @@ -919,61 +925,61 @@ def quo_rem(self, other, precision=None): algorithm would never terminate). Here, default precision comes to our help:: - sage: (1 + a^3).quo_rem(a + a^2) # optional - sage.libs.singular + sage: (1 + a^3).quo_rem(a + a^2) # needs sage.libs.singular (a^2 - a^3 + a^4 - a^5 + a^6 - a^7 + a^8 - a^9 + a^10 + O(a, b, c)^11, 1 + O(a, b, c)^12) - sage: (1 + a^3 + a*b).quo_rem(b + c) # optional - sage.libs.singular + sage: (1 + a^3 + a*b).quo_rem(b + c) # needs sage.libs.singular (a + O(a, b, c)^11, 1 - a*c + a^3 + O(a, b, c)^12) - sage: (1 + a^3 + a*b).quo_rem(b + c, precision=17) # optional - sage.libs.singular + sage: (1 + a^3 + a*b).quo_rem(b + c, precision=17) # needs sage.libs.singular (a + O(a, b, c)^16, 1 - a*c + a^3 + O(a, b, c)^17) - sage: (a^2 + b^2 + c^2).quo_rem(a + b + c) # optional - sage.libs.singular + sage: (a^2 + b^2 + c^2).quo_rem(a + b + c) # needs sage.libs.singular (a - b - c + O(a, b, c)^11, 2*b^2 + 2*b*c + 2*c^2 + O(a, b, c)^12) - sage: (a^2 + b^2 + c^2).quo_rem(1/(1+a+b+c)) # optional - sage.libs.singular + sage: (a^2 + b^2 + c^2).quo_rem(1/(1+a+b+c)) # needs sage.libs.singular (a^2 + b^2 + c^2 + a^3 + a^2*b + a^2*c + a*b^2 + a*c^2 + b^3 + b^2*c + b*c^2 + c^3 + O(a, b, c)^14, 0) - sage: (a^2 + b^2 + c^2).quo_rem(a/(1+a+b+c)) # optional - sage.libs.singular + sage: (a^2 + b^2 + c^2).quo_rem(a/(1+a+b+c)) # needs sage.libs.singular (a + a^2 + a*b + a*c + O(a, b, c)^13, b^2 + c^2) - sage: (1 + a + a^15).quo_rem(a^2) # optional - sage.libs.singular + sage: (1 + a + a^15).quo_rem(a^2) # needs sage.libs.singular (0 + O(a, b, c)^10, 1 + a + O(a, b, c)^12) - sage: (1 + a + a^15).quo_rem(a^2, precision=15) # optional - sage.libs.singular + sage: (1 + a + a^15).quo_rem(a^2, precision=15) # needs sage.libs.singular (0 + O(a, b, c)^13, 1 + a + O(a, b, c)^15) - sage: (1 + a + a^15).quo_rem(a^2, precision=16) # optional - sage.libs.singular + sage: (1 + a + a^15).quo_rem(a^2, precision=16) # needs sage.libs.singular (a^13 + O(a, b, c)^14, 1 + a + O(a, b, c)^16) Illustrating the dependency on the ordering of variables:: - sage: (1 + a + b).quo_rem(b + c) # optional - sage.libs.singular + sage: (1 + a + b).quo_rem(b + c) # needs sage.libs.singular (1 + O(a, b, c)^11, 1 + a - c + O(a, b, c)^12) - sage: (1 + b + c).quo_rem(c + a) # optional - sage.libs.singular + sage: (1 + b + c).quo_rem(c + a) # needs sage.libs.singular (0 + O(a, b, c)^11, 1 + b + c + O(a, b, c)^12) - sage: (1 + c + a).quo_rem(a + b) # optional - sage.libs.singular + sage: (1 + c + a).quo_rem(a + b) # needs sage.libs.singular (1 + O(a, b, c)^11, 1 - b + c + O(a, b, c)^12) TESTS:: - sage: (f).quo_rem(R.zero()) # optional - sage.libs.singular + sage: (f).quo_rem(R.zero()) Traceback (most recent call last): ... ZeroDivisionError - sage: (f).quo_rem(R.zero().add_bigoh(2)) # optional - sage.libs.singular + sage: (f).quo_rem(R.zero().add_bigoh(2)) Traceback (most recent call last): ... ZeroDivisionError Coercion is applied on ``other``:: - sage: (a + b).quo_rem(1) # optional - sage.libs.singular + sage: (a + b).quo_rem(1) (a + b + O(a, b, c)^12, 0 + O(a, b, c)^12) sage: R. = PowerSeriesRing(QQ) - sage: R(3).quo_rem(2) # optional - sage.libs.singular + sage: R(3).quo_rem(2) (3/2 + O(a, b, c)^12, 0 + O(a, b, c)^12) """ parent = self.parent() @@ -1037,30 +1043,30 @@ def _div_(self, denom_r): When possible, division by non-units also works:: - sage: a/(a*f) # optional - sage.libs.singular + sage: a/(a*f) # needs sage.libs.singular 1 - a - b + a^2 + 3*a*b + b^2 + O(a, b, c)^3 - sage: a/(R.zero()) # optional - sage.libs.singular + sage: a/(R.zero()) Traceback (most recent call last): ZeroDivisionError - sage: (a*f)/f # optional - sage.libs.singular + sage: (a*f)/f a + O(a, b, c)^4 - sage: f/(a*f) # optional - sage.libs.singular + sage: f/(a*f) # needs sage.libs.singular Traceback (most recent call last): ... ValueError: not divisible An example where one loses precision:: - sage: ((1+a)*f - f) / a*f # optional - sage.libs.singular + sage: ((1+a)*f - f) / a*f # needs sage.libs.singular 1 + 2*a + 2*b + O(a, b, c)^2 TESTS:: - sage: ((a+b)*f) / f == (a+b) # optional - sage.libs.singular + sage: ((a+b)*f) / f == (a+b) True - sage: ((a+b)*f) / (a+b) == f # optional - sage.libs.singular + sage: ((a+b)*f) / (a+b) == f # needs sage.libs.singular True """ if denom_r.is_unit(): # faster if denom_r is a unit @@ -1083,7 +1089,7 @@ def __mod__(self, other): False sage: g in R.base_extend(Zmod(2)) True - sage: g.polynomial() == f.polynomial() % 2 # optional - sage.libs.singular + sage: g.polynomial() == f.polynomial() % 2 # needs sage.libs.singular True """ if isinstance(other, (int, Integer)): @@ -1158,14 +1164,15 @@ def variables(self): EXAMPLES:: - sage: T = PowerSeriesRing(GF(3),5,'t'); T # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: T = PowerSeriesRing(GF(3),5,'t'); T Multivariate Power Series Ring in t0, t1, t2, t3, t4 over Finite Field of size 3 - sage: t = T.gens() # optional - sage.rings.finite_rings - sage: w = t[0] - 2*t[0]*t[2] + 5*t[4]^3 - t[0]^3*t[2]^2 + T.O(6) # optional - sage.rings.finite_rings - sage: w # optional - sage.rings.finite_rings + sage: t = T.gens() + sage: w = t[0] - 2*t[0]*t[2] + 5*t[4]^3 - t[0]^3*t[2]^2 + T.O(6) + sage: w t0 + t0*t2 - t4^3 - t0^3*t2^2 + O(t0, t1, t2, t3, t4)^6 - sage: w.variables() # optional - sage.rings.finite_rings + sage: w.variables() (t0, t2, t4) """ return tuple(self.parent(v) for v in self._value().variables()) @@ -1395,16 +1402,17 @@ def valuation(self): EXAMPLES:: - sage: R. = PowerSeriesRing(GF(4949717)); R # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = PowerSeriesRing(GF(4949717)); R Multivariate Power Series Ring in a, b over Finite Field of size 4949717 - sage: f = a^2 + a*b + a^3 + R.O(9) # optional - sage.rings.finite_rings - sage: f.valuation() # optional - sage.rings.finite_rings + sage: f = a^2 + a*b + a^3 + R.O(9) + sage: f.valuation() 2 - sage: g = 1 + a + a^3 # optional - sage.rings.finite_rings - sage: g.valuation() # optional - sage.rings.finite_rings + sage: g = 1 + a + a^3 + sage: g.valuation() 0 - sage: R.zero().valuation() # optional - sage.rings.finite_rings + sage: R.zero().valuation() +Infinity """ try: @@ -1897,13 +1905,13 @@ def exp(self, prec=infinity): sage: T. = PowerSeriesRing(ZZ, 2) sage: f = a + b + a*b + T.O(3) - sage: exp(f) # optional - sage.symbolic + sage: exp(f) # needs sage.symbolic 1 + a + b + 1/2*a^2 + 2*a*b + 1/2*b^2 + O(a, b)^3 - sage: f.exp() # optional - sage.symbolic + sage: f.exp() # needs sage.symbolic 1 + a + b + 1/2*a^2 + 2*a*b + 1/2*b^2 + O(a, b)^3 - sage: f.exp(prec=2) # optional - sage.symbolic + sage: f.exp(prec=2) # needs sage.symbolic 1 + a + b + O(a, b)^2 - sage: log(exp(f)) - f # optional - sage.symbolic + sage: log(exp(f)) - f # needs sage.symbolic 0 + O(a, b)^3 If the power series has a constant coefficient `c` and @@ -1912,7 +1920,7 @@ def exp(self, prec=infinity): are not yet implemented and therefore such cases raise an error:: sage: g = 2 + f - sage: exp(g) # optional - sage.symbolic + sage: exp(g) # needs sage.symbolic Traceback (most recent call last): ... TypeError: unsupported operand parent(s) for *: 'Symbolic Ring' and @@ -1922,7 +1930,7 @@ def exp(self, prec=infinity): Another workaround for this limitation is to change base ring to one which is closed under exponentiation, such as `\RR` or `\CC`:: - sage: exp(g.change_ring(RDF)) # optional - sage.symbolic + sage: exp(g.change_ring(RDF)) # needs sage.symbolic 7.38905609... + 7.38905609...*a + 7.38905609...*b + 3.69452804...*a^2 + 14.7781121...*a*b + 3.69452804...*b^2 + O(a, b)^3 @@ -1930,17 +1938,17 @@ def exp(self, prec=infinity): sage: T.default_prec() 12 - sage: exp(a) # optional - sage.symbolic + sage: exp(a) # needs sage.symbolic 1 + a + 1/2*a^2 + 1/6*a^3 + 1/24*a^4 + 1/120*a^5 + 1/720*a^6 + 1/5040*a^7 + 1/40320*a^8 + 1/362880*a^9 + 1/3628800*a^10 + 1/39916800*a^11 + O(a, b)^12 sage: a.exp(prec=5) 1 + a + 1/2*a^2 + 1/6*a^3 + 1/24*a^4 + O(a, b)^5 - sage: exp(a + T.O(5)) # optional - sage.symbolic + sage: exp(a + T.O(5)) # needs sage.symbolic 1 + a + 1/2*a^2 + 1/6*a^3 + 1/24*a^4 + O(a, b)^5 TESTS:: - sage: exp(a^2 + T.O(5)) # optional - sage.symbolic + sage: exp(a^2 + T.O(5)) # needs sage.symbolic 1 + a^2 + 1/2*a^4 + O(a, b)^5 """ R = self.parent() @@ -1989,11 +1997,11 @@ def log(self, prec=infinity): sage: T. = PowerSeriesRing(ZZ, 2) sage: f = 1 + a + b + a*b + T.O(5) - sage: f.log() # optional - sage.symbolic + sage: f.log() # needs sage.symbolic a + b - 1/2*a^2 - 1/2*b^2 + 1/3*a^3 + 1/3*b^3 - 1/4*a^4 - 1/4*b^4 + O(a, b)^5 - sage: log(f) # optional - sage.symbolic + sage: log(f) # needs sage.symbolic a + b - 1/2*a^2 - 1/2*b^2 + 1/3*a^3 + 1/3*b^3 - 1/4*a^4 - 1/4*b^4 + O(a, b)^5 - sage: exp(log(f)) - f # optional - sage.symbolic + sage: exp(log(f)) - f # needs sage.symbolic 0 + O(a, b)^5 If the power series has a constant coefficient `c` and @@ -2001,8 +2009,8 @@ def log(self, prec=infinity): power series over the :class:`~sage.symbolic.ring.SymbolicRing`. These are not yet implemented and therefore such cases raise an error:: - sage: g = 2 + f # optional - sage.symbolic - sage: log(g) # optional - sage.symbolic + sage: g = 2 + f + sage: log(g) # needs sage.symbolic Traceback (most recent call last): ... TypeError: unsupported operand parent(s) for -: 'Symbolic Ring' and 'Power @@ -2011,7 +2019,7 @@ def log(self, prec=infinity): Another workaround for this limitation is to change base ring to one which is closed under exponentiation, such as `\RR` or `\CC`:: - sage: log(g.change_ring(RDF)) # optional - sage.symbolic + sage: log(g.change_ring(RDF)) # needs sage.symbolic 1.09861228... + 0.333333333...*a + 0.333333333...*b - 0.0555555555...*a^2 + 0.222222222...*a*b - 0.0555555555...*b^2 + 0.0123456790...*a^3 - 0.0740740740...*a^2*b - 0.0740740740...*a*b^2 + 0.0123456790...*b^3 @@ -2020,17 +2028,17 @@ def log(self, prec=infinity): TESTS:: - sage: (1+a).log(prec=10).exp() # optional - sage.symbolic + sage: (1+a).log(prec=10).exp() # needs sage.symbolic 1 + a + O(a, b)^10 - sage: a.exp(prec=10).log() # optional - sage.symbolic + sage: a.exp(prec=10).log() # needs sage.symbolic a + O(a, b)^10 - sage: log(1+a) # optional - sage.symbolic + sage: log(1+a) # needs sage.symbolic a - 1/2*a^2 + 1/3*a^3 - 1/4*a^4 + 1/5*a^5 - 1/6*a^6 + 1/7*a^7 - 1/8*a^8 + 1/9*a^9 - 1/10*a^10 + 1/11*a^11 + O(a, b)^12 - sage: -log(1-a+T.O(5)) # optional - sage.symbolic + sage: -log(1-a+T.O(5)) # needs sage.symbolic a + 1/2*a^2 + 1/3*a^3 + 1/4*a^4 + O(a, b)^5 - sage: a.log(prec=10) # optional - sage.symbolic + sage: a.log(prec=10) Traceback (most recent call last): ... ValueError: Can only take formal power series for non-zero constant term. diff --git a/src/sage/rings/numbers_abc.py b/src/sage/rings/numbers_abc.py index 6bbcddccf40..a28021dd7db 100644 --- a/src/sage/rings/numbers_abc.py +++ b/src/sage/rings/numbers_abc.py @@ -41,26 +41,26 @@ def register_sage_classes(): True sage: isinstance(CDF(1.3, 4), numbers.Complex) True - sage: isinstance(AA(sqrt(2)), numbers.Real) + sage: isinstance(AA(sqrt(2)), numbers.Real) # needs sage.rings.number_field sage.symbolic True - sage: isinstance(QQbar(I), numbers.Complex) + sage: isinstance(QQbar(I), numbers.Complex) # needs sage.rings.number_field True This doesn't work with symbolic expressions at all:: - sage: isinstance(pi, numbers.Real) + sage: isinstance(pi, numbers.Real) # needs sage.symbolic False - sage: isinstance(I, numbers.Complex) + sage: isinstance(I, numbers.Complex) # needs sage.rings.number_field False - sage: isinstance(sqrt(2), numbers.Real) + sage: isinstance(sqrt(2), numbers.Real) # needs sage.rings.number_field sage.symbolic False Because we do this, NumPy's ``isscalar()`` recognizes Sage types:: - sage: from numpy import isscalar # optional - numpy - sage: isscalar(3.141) # optional - numpy + sage: from numpy import isscalar # needs numpy + sage: isscalar(3.141) # needs numpy True - sage: isscalar(4/17) # optional - numpy + sage: isscalar(4/17) # needs numpy True """ from sage.misc.superseded import deprecation diff --git a/src/sage/rings/power_series_poly.pyx b/src/sage/rings/power_series_poly.pyx index 63d26c53757..e3c4305c823 100644 --- a/src/sage/rings/power_series_poly.pyx +++ b/src/sage/rings/power_series_poly.pyx @@ -16,9 +16,9 @@ cdef class PowerSeries_poly(PowerSeries): """ EXAMPLES:: - sage: R. = PowerSeriesRing(CC); R # optional - sage.rings.real_mpfr + sage: R. = PowerSeriesRing(CC); R # needs sage.rings.real_mpfr Power Series Ring in q over Complex Field with 53 bits of precision - sage: loads(q.dumps()) == q # optional - sage.rings.real_mpfr + sage: loads(q.dumps()) == q # needs sage.rings.real_mpfr True sage: R. = QQ[[]] @@ -33,9 +33,9 @@ cdef class PowerSeries_poly(PowerSeries): Check that :trac:`22216` is fixed:: sage: R. = PowerSeriesRing(QQ) - sage: R(pari('1 + O(T)')) # optional - sage.libs.pari + sage: R(pari('1 + O(T)')) # needs sage.libs.pari 1 + O(T) - sage: R(pari('1/T + O(T)')) # optional - sage.libs.pari + sage: R(pari('1/T + O(T)')) # needs sage.libs.pari Traceback (most recent call last): ... ValueError: series has negative valuation @@ -104,9 +104,9 @@ cdef class PowerSeries_poly(PowerSeries): EXAMPLES:: - sage: R. = GF(7)[[]] # optional - sage.rings.finite_rings - sage: f = 3 - t^3 + O(t^5) # optional - sage.rings.finite_rings - sage: f.polynomial() # optional - sage.rings.finite_rings + sage: R. = GF(7)[[]] + sage: f = 3 - t^3 + O(t^5) + sage: f.polynomial() 6*t^3 + 3 """ return self.__f @@ -158,12 +158,13 @@ cdef class PowerSeries_poly(PowerSeries): EXAMPLES:: - sage: R. = GF(11)[[]] # optional - sage.rings.finite_rings - sage: bool(1 + t + O(t^18)) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(11)[[]] + sage: bool(1 + t + O(t^18)) True - sage: bool(R(0)) # optional - sage.rings.finite_rings + sage: bool(R(0)) False - sage: bool(O(t^18)) # optional - sage.rings.finite_rings + sage: bool(O(t^18)) False """ return not not self.__f @@ -224,17 +225,17 @@ cdef class PowerSeries_poly(PowerSeries): A series defined over another ring can be substituted:: - sage: S. = GF(7)[[]] # optional - sage.rings.finite_rings - sage: f(2*u + u^3 + O(u^5)) # optional - sage.rings.finite_rings + sage: S. = GF(7)[[]] + sage: f(2*u + u^3 + O(u^5)) 4*u^2 + u^3 + 4*u^4 + 5*u^5 + O(u^6) As can a p-adic integer as long as the coefficient ring is compatible:: - sage: f(100 + O(5^7)) # optional - sage.rings.padics + sage: f(100 + O(5^7)) # needs sage.rings.padics 5^4 + 3*5^5 + 4*5^6 + 2*5^7 + 2*5^8 + O(5^9) - sage: f.change_ring(Zp(5))(100 + O(5^7)) # optional - sage.rings.padics + sage: f.change_ring(Zp(5))(100 + O(5^7)) # needs sage.rings.padics 5^4 + 3*5^5 + 4*5^6 + 2*5^7 + 2*5^8 + O(5^9) - sage: f.change_ring(Zp(5))(100 + O(2^7)) # optional - sage.rings.padics + sage: f.change_ring(Zp(5))(100 + O(2^7)) # needs sage.rings.padics Traceback (most recent call last): ... ValueError: Cannot substitute this value @@ -247,7 +248,7 @@ cdef class PowerSeries_poly(PowerSeries): Traceback (most recent call last): ... ValueError: Can only substitute elements of positive valuation - sage: f(2 + O(5^3)) # optional - sage.rings.padics + sage: f(2 + O(5^3)) # needs sage.rings.padics Traceback (most recent call last): ... ValueError: Can only substitute elements of positive valuation @@ -267,18 +268,19 @@ cdef class PowerSeries_poly(PowerSeries): Arguments beyond the first can refer to the base ring:: - sage: P. = GF(5)[] # optional - sage.rings.finite_rings - sage: Q. = P[[]] # optional - sage.rings.finite_rings - sage: h = (1 - x*y)^-1 + O(y^7); h # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: P. = GF(5)[] + sage: Q. = P[[]] + sage: h = (1 - x*y)^-1 + O(y^7); h 1 + x*y + x^2*y^2 + x^3*y^3 + x^4*y^4 + x^5*y^5 + x^6*y^6 + O(y^7) - sage: h(y^2, 3) # optional - sage.rings.finite_rings + sage: h(y^2, 3) 1 + 3*y^2 + 4*y^4 + 2*y^6 + y^8 + 3*y^10 + 4*y^12 + O(y^14) These secondary values can also be specified using keywords:: - sage: h(y=y^2, x=3) # optional - sage.rings.finite_rings + sage: h(y=y^2, x=3) # needs sage.rings.finite_rings 1 + 3*y^2 + 4*y^4 + 2*y^6 + y^8 + 3*y^10 + 4*y^12 + O(y^14) - sage: h(y^2, x=3) # optional - sage.rings.finite_rings + sage: h(y^2, x=3) # needs sage.rings.finite_rings 1 + 3*y^2 + 4*y^4 + 2*y^6 + y^8 + 3*y^10 + 4*y^12 + O(y^14) """ P = self.parent() @@ -374,27 +376,29 @@ cdef class PowerSeries_poly(PowerSeries): EXAMPLES:: - sage: R. = GF(7)[[]] # optional - sage.rings.finite_rings - sage: f = 3 + 6*t^3 + O(t^5) # optional - sage.rings.finite_rings - sage: f._unsafe_mutate(0, 5) # optional - sage.rings.finite_rings - sage: f # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(7)[[]] + sage: f = 3 + 6*t^3 + O(t^5) + sage: f._unsafe_mutate(0, 5) + sage: f 5 + 6*t^3 + O(t^5) - sage: f._unsafe_mutate(2, 1) ; f # optional - sage.rings.finite_rings + sage: f._unsafe_mutate(2, 1) ; f 5 + t^2 + 6*t^3 + O(t^5) - Mutating can even bump up the precision:: - sage: f._unsafe_mutate(6, 1) ; f # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: f._unsafe_mutate(6, 1) ; f 5 + t^2 + 6*t^3 + t^6 + O(t^7) - sage: f._unsafe_mutate(0, 0) ; f # optional - sage.rings.finite_rings + sage: f._unsafe_mutate(0, 0) ; f t^2 + 6*t^3 + t^6 + O(t^7) - sage: f._unsafe_mutate(1, 0) ; f # optional - sage.rings.finite_rings + sage: f._unsafe_mutate(1, 0) ; f t^2 + 6*t^3 + t^6 + O(t^7) - sage: f._unsafe_mutate(11,0) ; f # optional - sage.rings.finite_rings + sage: f._unsafe_mutate(11,0) ; f t^2 + 6*t^3 + t^6 + O(t^12) - sage: g = t + O(t^7) # optional - sage.rings.finite_rings - sage: g._unsafe_mutate(1,0) ; g # optional - sage.rings.finite_rings + sage: g = t + O(t^7) # needs sage.rings.finite_rings + sage: g._unsafe_mutate(1,0) ; g # needs sage.rings.finite_rings O(t^7) """ self.__f._unsafe_mutate(i, value) @@ -553,9 +557,9 @@ cdef class PowerSeries_poly(PowerSeries): EXAMPLES:: - sage: R. = GF(7)[[]] # optional - sage.rings.finite_rings - sage: f = t + 3*t^4 + O(t^11) # optional - sage.rings.finite_rings - sage: f * GF(7)(3) # optional - sage.rings.finite_rings + sage: R. = GF(7)[[]] + sage: f = t + 3*t^4 + O(t^11) + sage: f * GF(7)(3) 3*t + 2*t^4 + O(t^11) """ return PowerSeries_poly(self._parent, self.__f * c, self._prec, check=False) @@ -566,9 +570,9 @@ cdef class PowerSeries_poly(PowerSeries): EXAMPLES:: - sage: R. = GF(11)[[]] # optional - sage.rings.finite_rings - sage: f = 1 + 3*t^4 + O(t^120) # optional - sage.rings.finite_rings - sage: 2 * f # optional - sage.rings.finite_rings + sage: R. = GF(11)[[]] + sage: f = 1 + 3*t^4 + O(t^120) + sage: 2 * f 2 + 6*t^4 + O(t^120) """ return PowerSeries_poly(self._parent, c * self.__f, self._prec, check=False) @@ -596,11 +600,12 @@ cdef class PowerSeries_poly(PowerSeries): EXAMPLES:: - sage: R. = GF(2)[[]] # optional - sage.rings.finite_rings - sage: f = t + t^4 + O(t^7) # optional - sage.rings.finite_rings - sage: f >> 1 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(2)[[]] + sage: f = t + t^4 + O(t^7) + sage: f >> 1 1 + t^3 + O(t^6) - sage: f >> 10 # optional - sage.rings.finite_rings + sage: f >> 10 O(t^0) """ if n: @@ -732,10 +737,10 @@ cdef class PowerSeries_poly(PowerSeries): EXAMPLES:: - sage: R. = GF(2)[[]] # optional - sage.rings.finite_rings - sage: f = 1/(1+I+O(I^8)); f # optional - sage.rings.finite_rings + sage: R. = GF(2)[[]] + sage: f = 1/(1+I+O(I^8)); f 1 + I + I^2 + I^3 + I^4 + I^5 + I^6 + I^7 + O(I^8) - sage: f.truncate(5) # optional - sage.rings.finite_rings + sage: f.truncate(5) I^4 + I^3 + I^2 + I + 1 """ if prec is infinity: @@ -763,10 +768,10 @@ cdef class PowerSeries_poly(PowerSeries): EXAMPLES:: - sage: R. = GF(2)[[]] # optional - sage.rings.finite_rings - sage: f = 1/(1+I+O(I^8)); f # optional - sage.rings.finite_rings + sage: R. = GF(2)[[]] + sage: f = 1/(1+I+O(I^8)); f 1 + I + I^2 + I^3 + I^4 + I^5 + I^6 + I^7 + O(I^8) - sage: f.truncate_powerseries(5) # optional - sage.rings.finite_rings + sage: f.truncate_powerseries(5) 1 + I + I^2 + I^3 + I^4 + O(I^5) """ return PowerSeries_poly(self._parent, self.__f.truncate(prec), @@ -844,8 +849,8 @@ cdef class PowerSeries_poly(PowerSeries): TESTS:: sage: R. = PowerSeriesRing(QQ, sparse=True) - sage: x = var('x') # optional - sage.symbolic - sage: t.derivative(x) # optional - sage.symbolic + sage: x = var('x') # needs sage.symbolic + sage: t.derivative(x) Traceback (most recent call last): ... ValueError: cannot differentiate with respect to x @@ -1034,10 +1039,10 @@ cdef class PowerSeries_poly(PowerSeries): ... ValueError: Series must have valuation one for reversion. - sage: Series = PowerSeriesRing(SR, 'x') # optional - sage.symbolic - sage: ser = Series([0, pi]); ser # optional - sage.symbolic + sage: Series = PowerSeriesRing(SR, 'x') # needs sage.symbolic + sage: ser = Series([0, pi]); ser # needs sage.symbolic pi*x - sage: ser.reverse() # optional - sage.symbolic + sage: ser.reverse() # needs sage.symbolic 1/pi*x + O(x^20) """ if self.valuation() != 1: @@ -1193,17 +1198,17 @@ cdef class PowerSeries_poly(PowerSeries): sage: R. = PowerSeriesRing(QQ) sage: s = R([1,2,3,4,5], prec=10); s 1 + 2*x + 3*x^2 + 4*x^3 + 5*x^4 + O(x^10) - sage: SR(s) # optional - sage.symbolic + sage: SR(s) # needs sage.symbolic 1 + 2*x + 3*x^2 + 4*x^3 + 5*x^4 + Order(x^10) - sage: SR(s).is_terminating_series() # optional - sage.symbolic + sage: SR(s).is_terminating_series() # needs sage.symbolic False - sage: SR(s).variables() # optional - sage.symbolic + sage: SR(s).variables() # needs sage.symbolic (x,) sage: s = R([1,2,3,4,5]); s 1 + 2*x + 3*x^2 + 4*x^3 + 5*x^4 - sage: SR(s) # optional - sage.symbolic + sage: SR(s) # needs sage.symbolic 1 + 2*x + 3*x^2 + 4*x^3 + 5*x^4 - sage: _.is_terminating_series() # optional - sage.symbolic + sage: _.is_terminating_series() # needs sage.symbolic True TESTS: @@ -1211,7 +1216,7 @@ cdef class PowerSeries_poly(PowerSeries): Check that :trac:`18094` is fixed:: sage: R. = PolynomialRing(ZZ) - sage: SR(R(0).add_bigoh(20)) # optional - sage.symbolic + sage: SR(R(0).add_bigoh(20)) # needs sage.symbolic Order(x^20) """ from sage.symbolic.ring import SR diff --git a/src/sage/rings/power_series_ring.py b/src/sage/rings/power_series_ring.py index e023867b67e..e687681827d 100644 --- a/src/sage/rings/power_series_ring.py +++ b/src/sage/rings/power_series_ring.py @@ -59,13 +59,14 @@ :: - sage: K. = PowerSeriesRing(SR, default_prec=5) # optional - sage.symbolic - sage: a, b, c = var('a,b,c') # optional - sage.symbolic - sage: f = a + b*t + c*t^2 + O(t^3) # optional - sage.symbolic - sage: f*f # optional - sage.symbolic + sage: # needs sage.symbolic + sage: K. = PowerSeriesRing(SR, default_prec=5) + sage: a, b, c = var('a,b,c') + sage: f = a + b*t + c*t^2 + O(t^3) + sage: f*f a^2 + 2*a*b*t + (b^2 + 2*a*c)*t^2 + O(t^3) - sage: f = sqrt(2) + sqrt(3)*t + O(t^3) # optional - sage.symbolic - sage: f^2 # optional - sage.symbolic + sage: f = sqrt(2) + sqrt(3)*t + O(t^3) + sage: f^2 2 + 2*sqrt(3)*sqrt(2)*t + 3*t^2 + O(t^3) Elements are first coerced to constants in ``base_ring``, then coerced @@ -258,13 +259,13 @@ def PowerSeriesRing(base_ring, name=None, arg2=None, names=None, Power series ring over finite field:: - sage: S = PowerSeriesRing(GF(65537),'x,y'); S # optional - sage.rings.finite_rings + sage: S = PowerSeriesRing(GF(65537),'x,y'); S # needs sage.rings.finite_rings Multivariate Power Series Ring in x, y over Finite Field of size 65537 Power series ring with many variables:: - sage: R = PowerSeriesRing(ZZ, ['x%s'%p for p in primes(100)]); R # optional - sage.libs.pari + sage: R = PowerSeriesRing(ZZ, ['x%s'%p for p in primes(100)]); R # needs sage.libs.pari Multivariate Power Series Ring in x2, x3, x5, x7, x11, x13, x17, x19, x23, x29, x31, x37, x41, x43, x47, x53, x59, x61, x67, x71, x73, x79, x83, x89, x97 over Integer Ring @@ -274,12 +275,12 @@ def PowerSeriesRing(base_ring, name=None, arg2=None, names=None, :: - sage: R.inject_variables() # optional - sage.libs.pari + sage: R.inject_variables() # needs sage.libs.pari Defining x2, x3, x5, x7, x11, x13, x17, x19, x23, x29, x31, x37, x41, x43, x47, x53, x59, x61, x67, x71, x73, x79, x83, x89, x97 - sage: f = x47 + 3*x11*x29 - x19 + R.O(3) # optional - sage.libs.pari - sage: f in R # optional - sage.libs.pari + sage: f = x47 + 3*x11*x29 - x19 + R.O(3) # needs sage.libs.pari + sage: f in R # needs sage.libs.pari True @@ -519,11 +520,12 @@ def __init__(self, base_ring, name=None, default_prec=None, sparse=False, commutative ring, but also a complete discrete valuation ring (CDVR). The appropriate (sub)category is automatically set in this case:: - sage: k = GF(11) # optional - sage.rings.finite_rings - sage: R. = k[[]] # optional - sage.rings.finite_rings - sage: R.category() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: k = GF(11) + sage: R. = k[[]] + sage: R.category() Category of complete discrete valuation rings - sage: TestSuite(R).run() # optional - sage.rings.finite_rings + sage: TestSuite(R).run() It is checked that the default precision is non-negative (see :trac:`19409`):: @@ -615,13 +617,14 @@ def _repr_(self): EXAMPLES:: - sage: R = GF(17)[['y']] # optional - sage.rings.finite_rings - sage: R # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R = GF(17)[['y']] + sage: R Power Series Ring in y over Finite Field of size 17 - sage: R.__repr__() # optional - sage.rings.finite_rings + sage: R.__repr__() 'Power Series Ring in y over Finite Field of size 17' - sage: R.rename('my power series ring') # optional - sage.rings.finite_rings - sage: R # optional - sage.rings.finite_rings + sage: R.rename('my power series ring') + sage: R my power series ring """ s = "Power Series Ring in %s over %s"%(self.variable_name(), self.base_ring()) @@ -661,11 +664,12 @@ def _latex_(self): EXAMPLES:: - sage: R = GF(17)[['y']] # optional - sage.rings.finite_rings - sage: latex(R) # indirect doctest # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R = GF(17)[['y']] + sage: latex(R) # indirect doctest \Bold{F}_{17}[[y]] - sage: R = GF(17)[['y12']] # optional - sage.rings.finite_rings - sage: latex(R) # optional - sage.rings.finite_rings + sage: R = GF(17)[['y12']] + sage: latex(R) \Bold{F}_{17}[[y_{12}]] """ return "%s[[%s]]"%(latex.latex(self.base_ring()), self.latex_variable_names()[0]) @@ -679,14 +683,15 @@ def _coerce_map_from_(self, S): EXAMPLES:: - sage: A = GF(17)[['x']] # optional - sage.rings.finite_rings - sage: A.has_coerce_map_from(ZZ) # indirect doctest # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: A = GF(17)[['x']] + sage: A.has_coerce_map_from(ZZ) # indirect doctest True - sage: A.has_coerce_map_from(ZZ['x']) # optional - sage.rings.finite_rings + sage: A.has_coerce_map_from(ZZ['x']) True - sage: A.has_coerce_map_from(ZZ['y']) # optional - sage.rings.finite_rings + sage: A.has_coerce_map_from(ZZ['y']) False - sage: A.has_coerce_map_from(ZZ[['x']]) # optional - sage.rings.finite_rings + sage: A.has_coerce_map_from(ZZ[['x']]) True """ @@ -759,15 +764,16 @@ def _element_constructor_(self, f, prec=infinity, check=True): Conversion from symbolic series:: - sage: x,y = var('x,y') # optional - sage.symbolic - sage: s = (1/(1-x)).series(x,3); s # optional - sage.symbolic + sage: # needs sage.symbolic + sage: x,y = var('x,y') + sage: s = (1/(1-x)).series(x,3); s 1 + 1*x + 1*x^2 + Order(x^3) - sage: R. = PowerSeriesRing(QQ) # optional - sage.symbolic - sage: R(s) # optional - sage.symbolic + sage: R. = PowerSeriesRing(QQ) + sage: R(s) 1 + x + x^2 + O(x^3) - sage: ex = (gamma(1-y)).series(y,3) # optional - sage.symbolic - sage: R. = PowerSeriesRing(SR) # optional - sage.symbolic - sage: R(ex) # optional - sage.symbolic + sage: ex = (gamma(1-y)).series(y,3) + sage: R. = PowerSeriesRing(SR) + sage: R(ex) 1 + euler_gamma*y + (1/2*euler_gamma^2 + 1/12*pi^2)*y^2 + O(y^3) Laurent series with non-negative valuation are accepted (see @@ -891,16 +897,16 @@ def _coerce_impl(self, x): We illustrate canonical coercion between power series rings with compatible base rings:: - sage: R. = PowerSeriesRing(GF(7)['w']) # optional - sage.rings.finite_rings + sage: R. = PowerSeriesRing(GF(7)['w']) sage: S = PowerSeriesRing(ZZ, 't') sage: f = S([1,2,3,4]); f 1 + 2*t + 3*t^2 + 4*t^3 - sage: g = R.coerce(f); g # optional - sage.rings.finite_rings + sage: g = R.coerce(f); g 1 + 2*t + 3*t^2 + 4*t^3 - sage: parent(g) # optional - sage.rings.finite_rings + sage: parent(g) Power Series Ring in t over Univariate Polynomial Ring in w over Finite Field of size 7 - sage: S.coerce(g) # optional - sage.rings.finite_rings + sage: S.coerce(g) Traceback (most recent call last): ... TypeError: no canonical coercion @@ -981,11 +987,11 @@ def base_extend(self, R): EXAMPLES:: - sage: R. = GF(7)[[]]; R # optional - sage.rings.finite_rings + sage: R. = GF(7)[[]]; R Power Series Ring in T over Finite Field of size 7 - sage: R.change_ring(ZZ) # optional - sage.rings.finite_rings + sage: R.change_ring(ZZ) Power Series Ring in T over Integer Ring - sage: R.base_extend(ZZ) # optional - sage.rings.finite_rings + sage: R.base_extend(ZZ) Traceback (most recent call last): ... TypeError: no base extension defined @@ -1003,13 +1009,13 @@ def change_ring(self, R): sage: R. = QQ[[]]; R Power Series Ring in T over Rational Field - sage: R.change_ring(GF(7)) # optional - sage.rings.finite_rings + sage: R.change_ring(GF(7)) Power Series Ring in T over Finite Field of size 7 - sage: R.base_extend(GF(7)) # optional - sage.rings.finite_rings + sage: R.base_extend(GF(7)) Traceback (most recent call last): ... TypeError: no base extension defined - sage: R.base_extend(QuadraticField(3,'a')) # optional - sage.rings.number_field + sage: R.base_extend(QuadraticField(3,'a')) # needs sage.rings.number_field Power Series Ring in T over Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? """ @@ -1234,11 +1240,11 @@ def residue_field(self): EXAMPLES:: - sage: R. = PowerSeriesRing(GF(17)) # optional - sage.rings.finite_rings - sage: R.residue_field() # optional - sage.rings.finite_rings + sage: R. = PowerSeriesRing(GF(17)) + sage: R.residue_field() Finite Field of size 17 - sage: R. = PowerSeriesRing(Zp(5)) # optional - sage.rings.padics - sage: R.residue_field() # optional - sage.rings.padics + sage: R. = PowerSeriesRing(Zp(5)) # needs sage.rings.padics + sage: R.residue_field() # needs sage.rings.padics Finite Field of size 5 """ if self.base_ring().is_field(): @@ -1331,10 +1337,10 @@ def fraction_field(self): EXAMPLES:: - sage: R. = PowerSeriesRing(GF(7)) # optional - sage.rings.finite_rings - sage: R.fraction_field() # optional - sage.rings.finite_rings + sage: R. = PowerSeriesRing(GF(7)) + sage: R.fraction_field() Laurent Series Ring in t over Finite Field of size 7 - sage: Frac(R) # optional - sage.rings.finite_rings + sage: Frac(R) Laurent Series Ring in t over Finite Field of size 7 """ return self.laurent_series_ring() diff --git a/src/sage/rings/power_series_ring_element.pyx b/src/sage/rings/power_series_ring_element.pyx index c9a73a18665..3579ac38953 100644 --- a/src/sage/rings/power_series_ring_element.pyx +++ b/src/sage/rings/power_series_ring_element.pyx @@ -130,9 +130,9 @@ def is_PowerSeries(x): True sage: is_PowerSeries(0) False - sage: var('x') # optional - sage.symbolic + sage: var('x') # needs sage.symbolic x - sage: is_PowerSeries(1 + x^2) # optional - sage.symbolic + sage: is_PowerSeries(1 + x^2) # needs sage.symbolic False """ return isinstance(x, PowerSeries) @@ -152,9 +152,9 @@ cdef class PowerSeries(AlgebraElement): EXAMPLES:: - sage: PowerSeriesRing(CC, 'q') # optional - sage.rings.real_mpfr + sage: PowerSeriesRing(CC, 'q') # needs sage.rings.real_mpfr Power Series Ring in q over Complex Field with 53 bits of precision - sage: T = PowerSeriesRing(GF(3), 5, 't'); T # optional - sage.rings.finite_rings + sage: T = PowerSeriesRing(GF(3), 5, 't'); T Multivariate Power Series Ring in t0, t1, t2, t3, t4 over Finite Field of size 3 """ @@ -276,13 +276,13 @@ cdef class PowerSeries(AlgebraElement): sage: R. = QQ[[]]; R Power Series Ring in T over Rational Field sage: f = 1 - 1/2*T + 1/3*T^2 + O(T^3) - sage: f.base_extend(GF(5)) # optional - sage.rings.finite_rings + sage: f.base_extend(GF(5)) Traceback (most recent call last): ... TypeError: no base extension defined - sage: f.change_ring(GF(5)) # optional - sage.rings.finite_rings + sage: f.change_ring(GF(5)) 1 + 2*T + 2*T^2 + O(T^3) - sage: f.change_ring(GF(3)) # optional - sage.rings.finite_rings + sage: f.change_ring(GF(3)) Traceback (most recent call last): ... ZeroDivisionError: inverse of Mod(0, 3) does not exist @@ -292,18 +292,18 @@ cdef class PowerSeries(AlgebraElement): :: - sage: K. = NumberField(cyclotomic_polynomial(3), 'a') # optional - sage.rings.number_field - sage: R. = K[['t']] # optional - sage.rings.number_field - sage: (4*t).change_ring(ZZ) # optional - sage.rings.number_field + sage: K. = NumberField(cyclotomic_polynomial(3), 'a') # needs sage.rings.number_field + sage: R. = K[['t']] # needs sage.rings.number_field + sage: (4*t).change_ring(ZZ) # needs sage.rings.number_field 4*t This does not succeed because ``ZZ(K(a+1))`` is not defined. :: - sage: K. = NumberField(cyclotomic_polynomial(3), 'a') # optional - sage.rings.number_field - sage: R. = K[['t']] # optional - sage.rings.number_field - sage: ((a+1)*t).change_ring(ZZ) # optional - sage.rings.number_field + sage: K. = NumberField(cyclotomic_polynomial(3), 'a') # needs sage.rings.number_field + sage: R. = K[['t']] # needs sage.rings.number_field + sage: ((a+1)*t).change_ring(ZZ) # needs sage.rings.number_field Traceback (most recent call last): ... TypeError: Unable to coerce a + 1 to an integer @@ -483,11 +483,12 @@ cdef class PowerSeries(AlgebraElement): EXAMPLES:: - sage: A. = PowerSeriesRing(GF(5)) # optional - sage.rings.finite_rings - sage: x = t + t^2 + O(t^5) # optional - sage.rings.finite_rings - sage: x.lift_to_precision(10) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: A. = PowerSeriesRing(GF(5)) + sage: x = t + t^2 + O(t^5) + sage: x.lift_to_precision(10) t + t^2 + O(t^10) - sage: x.lift_to_precision() # optional - sage.rings.finite_rings + sage: x.lift_to_precision() t + t^2 """ @@ -521,8 +522,8 @@ cdef class PowerSeries(AlgebraElement): EXAMPLES:: - sage: R. = GF(49,'alpha')[[]] # optional - sage.rings.finite_rings - sage: (t^2 + O(t^3)).base_ring() # optional - sage.rings.finite_rings + sage: R. = GF(49,'alpha')[[]] # needs sage.rings.finite_rings + sage: (t^2 + O(t^3)).base_ring() # needs sage.rings.finite_rings Finite Field in alpha of size 7^2 """ return self._parent.base_ring() @@ -799,10 +800,10 @@ cdef class PowerSeries(AlgebraElement): EXAMPLES:: - sage: R. = GF(2)[[]] # optional - sage.rings.finite_rings - sage: f = 1/(1+I+O(I^8)); f # optional - sage.rings.finite_rings + sage: R. = GF(2)[[]] + sage: f = 1/(1+I+O(I^8)); f 1 + I + I^2 + I^3 + I^4 + I^5 + I^6 + I^7 + O(I^8) - sage: f.truncate(5) # optional - sage.rings.finite_rings + sage: f.truncate(5) I^4 + I^3 + I^2 + I + 1 """ if prec is infinity: @@ -845,22 +846,23 @@ cdef class PowerSeries(AlgebraElement): EXAMPLES:: + sage: # needs sage.rings.complex_double sage: R. = CDF[[]] - sage: f = CDF(pi)^2 + m^3 + CDF(e)*m^4 + O(m^10); f # abs tol 5e-16 + sage: f = CDF(pi)^2 + m^3 + CDF(e)*m^4 + O(m^10); f # abs tol 5e-16 # needs sage.symbolic 9.869604401089358 + 0.0*m + 0.0*m^2 + 1.0*m^3 + 2.718281828459045*m^4 + O(m^10) - sage: f[-5] + sage: f[-5] # needs sage.symbolic 0.0 - sage: f[0] + sage: f[0] # needs sage.symbolic 9.869604401089358 - sage: f[4] # abs tol 5e-16 + sage: f[4] # abs tol 5e-16 # needs sage.symbolic 2.718281828459045 - sage: f[9] + sage: f[9] # needs sage.symbolic 0.0 - sage: f[10] + sage: f[10] # needs sage.symbolic Traceback (most recent call last): ... IndexError: coefficient not known - sage: f[1000] + sage: f[1000] # needs sage.symbolic Traceback (most recent call last): ... IndexError: coefficient not known @@ -1104,9 +1106,9 @@ cdef class PowerSeries(AlgebraElement): """ EXAMPLES:: - sage: R. = Qp(7)[[]] # optional - sage.rings.padics - sage: f = (48*67 + 46*67^2)*T + (1 + 42*67 + 5*67^3)*T^2 + O(T^3) # optional - sage.rings.padics - sage: f % 67 # optional - sage.rings.padics + sage: R. = Qp(7)[[]] # needs sage.rings.padics + sage: f = (48*67 + 46*67^2)*T + (1 + 42*67 + 5*67^3)*T^2 + O(T^3) # needs sage.rings.padics + sage: f % 67 # needs sage.rings.padics T^2 + O(T^3) """ from sage.rings.power_series_ring import PowerSeriesRing @@ -1194,12 +1196,13 @@ cdef class PowerSeries(AlgebraElement): EXAMPLES:: - sage: R. = PowerSeriesRing(QQ, implementation='pari') # optional - sage.libs.pari - sage: f = exp(x) + O(x^7); f # optional - sage.libs.pari + sage: # needs sage.libs.pari + sage: R. = PowerSeriesRing(QQ, implementation='pari') + sage: f = exp(x) + O(x^7); f # needs sage.symbolic 1 + x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + 1/120*x^5 + 1/720*x^6 + O(x^7) - sage: f << 2 # optional - sage.libs.pari + sage: f << 2 # needs sage.symbolic x^2 + x^3 + 1/2*x^4 + 1/6*x^5 + 1/24*x^6 + 1/120*x^7 + 1/720*x^8 + O(x^9) - sage: (f << 99) >> 99 # optional - sage.libs.pari + sage: (f << 99) >> 99 # needs sage.symbolic 1 + x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + 1/120*x^5 + 1/720*x^6 + O(x^7) """ return self.shift(n) @@ -1212,15 +1215,16 @@ cdef class PowerSeries(AlgebraElement): EXAMPLES:: - sage: R. = PowerSeriesRing(QQ, implementation='pari') # optional - sage.libs.pari - sage: f = exp(x) + O(x^7) # optional - sage.libs.pari - sage: f >> 3 # optional - sage.libs.pari + sage: # needs sage.libs.pari + sage: R. = PowerSeriesRing(QQ, implementation='pari') + sage: f = exp(x) + O(x^7) # needs sage.symbolic + sage: f >> 3 # needs sage.symbolic 1/6 + 1/24*x + 1/120*x^2 + 1/720*x^3 + O(x^4) - sage: f >> 7 # optional - sage.libs.pari + sage: f >> 7 # needs sage.symbolic O(x^0) - sage: f >> 99 # optional - sage.libs.pari + sage: f >> 99 # needs sage.symbolic O(x^0) - sage: (f >> 99) << 99 # optional - sage.libs.pari + sage: (f >> 99) << 99 # needs sage.symbolic O(x^99) """ return self.shift(-n) @@ -1266,9 +1270,9 @@ cdef class PowerSeries(AlgebraElement): EXAMPLES:: - sage: R. = SR[[]] # optional - sage.symbolic - sage: f = (1+I)*x^2 + 3*x - I # optional - sage.symbolic - sage: f.map_coefficients(lambda z: z.conjugate()) # optional - sage.symbolic + sage: R. = SR[[]] # needs sage.symbolic + sage: f = (1+I)*x^2 + 3*x - I # needs sage.symbolic + sage: f.map_coefficients(lambda z: z.conjugate()) # needs sage.symbolic I + 3*x + (-I + 1)*x^2 sage: R. = ZZ[[]] sage: f = x^2 + 2 @@ -1278,28 +1282,28 @@ cdef class PowerSeries(AlgebraElement): Examples with different base ring:: sage: R. = ZZ[[]] - sage: k = GF(2) # optional - sage.rings.finite_rings - sage: residue = lambda x: k(x) # optional - sage.rings.finite_rings - sage: f = 4*x^2+x+3 # optional - sage.rings.finite_rings - sage: g = f.map_coefficients(residue); g # optional - sage.rings.finite_rings + sage: k = GF(2) + sage: residue = lambda x: k(x) + sage: f = 4*x^2+x+3 + sage: g = f.map_coefficients(residue); g 1 + x - sage: g.parent() # optional - sage.rings.finite_rings + sage: g.parent() Power Series Ring in x over Integer Ring - sage: g = f.map_coefficients(residue, new_base_ring=k); g # optional - sage.rings.finite_rings + sage: g = f.map_coefficients(residue, new_base_ring=k); g 1 + x - sage: g.parent() # optional - sage.rings.finite_rings + sage: g.parent() Power Series Ring in x over Finite Field of size 2 - sage: residue = k.coerce_map_from(ZZ) # optional - sage.rings.finite_rings - sage: g = f.map_coefficients(residue); g # optional - sage.rings.finite_rings + sage: residue = k.coerce_map_from(ZZ) + sage: g = f.map_coefficients(residue); g 1 + x - sage: g.parent() # optional - sage.rings.finite_rings + sage: g.parent() Power Series Ring in x over Finite Field of size 2 Tests other implementations:: - sage: R. = PowerSeriesRing(GF(11), implementation='pari') # optional - sage.rings.finite_rings - sage: f = q - q^3 + O(q^10) # optional - sage.rings.finite_rings - sage: f.map_coefficients(lambda c: c - 2) # optional - sage.rings.finite_rings + sage: R. = PowerSeriesRing(GF(11), implementation='pari') # needs sage.rings.finite_rings + sage: f = q - q^3 + O(q^10) # needs sage.rings.finite_rings + sage: f.map_coefficients(lambda c: c - 2) # needs sage.rings.finite_rings 10*q + 8*q^3 + O(q^10) """ pol = self.polynomial() @@ -1336,13 +1340,13 @@ cdef class PowerSeries(AlgebraElement): EXAMPLES:: sage: t = PowerSeriesRing(QQ, 't').gen() - sage: s = sum(factorial(k) * t**k for k in range(12)).O(12) - sage: s.jacobi_continued_fraction() + sage: s = sum(factorial(k) * t**k for k in range(12)).O(12) # needs sage.rings.complex_double + sage: s.jacobi_continued_fraction() # needs sage.rings.complex_double ((-1, -1), (-3, -4), (-5, -9), (-7, -16), (-9, -25)) Another example:: - sage: (log(1+t)/t).jacobi_continued_fraction() # optional - sage.symbolic + sage: (log(1+t)/t).jacobi_continued_fraction() ((1/2, -1/12), (1/2, -1/15), (1/2, -9/140), @@ -1401,13 +1405,13 @@ cdef class PowerSeries(AlgebraElement): EXAMPLES:: sage: t = PowerSeriesRing(QQ, 't').gen() - sage: s = sum(catalan_number(k) * t**k for k in range(12)).O(12) # optional - sage.combinat - sage: s.stieltjes_continued_fraction() # optional - sage.combinat + sage: s = sum(catalan_number(k) * t**k for k in range(12)).O(12) + sage: s.stieltjes_continued_fraction() (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) Another example:: - sage: (exp(t)).stieltjes_continued_fraction() # optional - sage.symbolic + sage: (exp(t)).stieltjes_continued_fraction() (1, -1/2, 1/6, @@ -1557,7 +1561,7 @@ cdef class PowerSeries(AlgebraElement): :: - sage: K. = PowerSeriesRing(CDF, 5) + sage: K. = PowerSeriesRing(CDF, 5) # needs sage.rings.complex_double sage: v = sqrt(-1 + t + t^3, all=True); v [1.0*I - 0.5*I*t - 0.125*I*t^2 - 0.5625*I*t^3 - 0.2890625*I*t^4 + O(t^5), -1.0*I + 0.5*I*t + 0.125*I*t^2 + 0.5625*I*t^3 + 0.2890625*I*t^4 + O(t^5)] @@ -1764,11 +1768,12 @@ cdef class PowerSeries(AlgebraElement): Positive characteristic:: - sage: R. = GF(3)[[]] # optional - sage.rings.finite_rings - sage: p = 1 + 2 * u^2 # optional - sage.rings.finite_rings - sage: p.nth_root(4) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(3)[[]] + sage: p = 1 + 2 * u^2 + sage: p.nth_root(4) 1 + 2*u^2 + u^6 + 2*u^8 + u^12 + 2*u^14 + O(u^20) - sage: p.nth_root(4)**4 # optional - sage.rings.finite_rings + sage: p.nth_root(4)**4 1 + 2*u^2 + O(u^20) TESTS: @@ -1839,14 +1844,14 @@ cdef class PowerSeries(AlgebraElement): sage: t = PowerSeriesRing(QQ, 't').gen() sage: f = (t + t**2).O(4) - sage: cos(f) # optional - sage.symbolic + sage: cos(f) 1 - 1/2*t^2 - t^3 + O(t^4) For several variables:: sage: T. = PowerSeriesRing(ZZ,2) sage: f = a + b + a*b + T.O(3) - sage: cos(f) # optional - sage.symbolic + sage: cos(f) 1 - 1/2*a^2 - a*b - 1/2*b^2 + O(a, b)^3 sage: f.cos() 1 - 1/2*a^2 - a*b - 1/2*b^2 + O(a, b)^3 @@ -1857,7 +1862,7 @@ cdef class PowerSeries(AlgebraElement): one raises an error:: sage: g = 2+f - sage: cos(g) # optional - sage.symbolic + sage: cos(g) Traceback (most recent call last): ... ValueError: can only apply cos to formal power series with zero constant term @@ -1866,16 +1871,16 @@ cdef class PowerSeries(AlgebraElement): sage: T.default_prec() 12 - sage: cos(a) # optional - sage.symbolic + sage: cos(a) 1 - 1/2*a^2 + 1/24*a^4 - 1/720*a^6 + 1/40320*a^8 - 1/3628800*a^10 + O(a, b)^12 sage: a.cos(prec=5) 1 - 1/2*a^2 + 1/24*a^4 + O(a, b)^5 - sage: cos(a + T.O(5)) # optional - sage.symbolic + sage: cos(a + T.O(5)) 1 - 1/2*a^2 + 1/24*a^4 + O(a, b)^5 TESTS:: - sage: cos(a^2 + T.O(5)) # optional - sage.symbolic + sage: cos(a^2 + T.O(5)) 1 - 1/2*a^4 + O(a, b)^5 """ R = self.parent() @@ -1924,14 +1929,14 @@ cdef class PowerSeries(AlgebraElement): sage: t = PowerSeriesRing(QQ, 't').gen() sage: f = (t + t**2).O(4) - sage: sin(f) # optional - sage.symbolic + sage: sin(f) t + t^2 - 1/6*t^3 + O(t^4) For several variables:: sage: T. = PowerSeriesRing(ZZ,2) sage: f = a + b + a*b + T.O(3) - sage: sin(f) # optional - sage.symbolic + sage: sin(f) a + b + a*b + O(a, b)^3 sage: f.sin() a + b + a*b + O(a, b)^3 @@ -1942,7 +1947,7 @@ cdef class PowerSeries(AlgebraElement): one raises an error:: sage: g = 2+f - sage: sin(g) # optional - sage.symbolic + sage: sin(g) Traceback (most recent call last): ... ValueError: can only apply sin to formal power series with zero constant term @@ -1951,16 +1956,16 @@ cdef class PowerSeries(AlgebraElement): sage: T.default_prec() 12 - sage: sin(a) # optional - sage.symbolic + sage: sin(a) a - 1/6*a^3 + 1/120*a^5 - 1/5040*a^7 + 1/362880*a^9 - 1/39916800*a^11 + O(a, b)^12 sage: a.sin(prec=5) a - 1/6*a^3 + O(a, b)^5 - sage: sin(a + T.O(5)) # optional - sage.symbolic + sage: sin(a + T.O(5)) a - 1/6*a^3 + O(a, b)^5 TESTS:: - sage: sin(a^2 + T.O(5)) # optional - sage.symbolic + sage: sin(a^2 + T.O(5)) a^2 + O(a, b)^5 """ R = self.parent() @@ -2010,14 +2015,14 @@ cdef class PowerSeries(AlgebraElement): sage: t = PowerSeriesRing(QQ, 't').gen() sage: f = (t + t**2).O(4) - sage: tan(f) # optional - sage.symbolic + sage: tan(f) t + t^2 + 1/3*t^3 + O(t^4) For several variables:: sage: T. = PowerSeriesRing(ZZ,2) sage: f = a + b + a*b + T.O(3) - sage: tan(f) # optional - sage.symbolic + sage: tan(f) a + b + a*b + O(a, b)^3 sage: f.tan() a + b + a*b + O(a, b)^3 @@ -2028,7 +2033,7 @@ cdef class PowerSeries(AlgebraElement): one raises an error:: sage: g = 2 + f - sage: tan(g) # optional - sage.symbolic + sage: tan(g) Traceback (most recent call last): ... ValueError: can only apply tan to formal power series with zero constant term @@ -2037,16 +2042,16 @@ cdef class PowerSeries(AlgebraElement): sage: T.default_prec() 12 - sage: tan(a) # optional - sage.symbolic + sage: tan(a) a + 1/3*a^3 + 2/15*a^5 + 17/315*a^7 + 62/2835*a^9 + 1382/155925*a^11 + O(a, b)^12 sage: a.tan(prec=5) a + 1/3*a^3 + O(a, b)^5 - sage: tan(a + T.O(5)) # optional - sage.symbolic + sage: tan(a + T.O(5)) a + 1/3*a^3 + O(a, b)^5 TESTS:: - sage: tan(a^2 + T.O(5)) # optional - sage.symbolic + sage: tan(a^2 + T.O(5)) a^2 + O(a, b)^5 """ if not self[0].is_zero(): @@ -2074,14 +2079,14 @@ cdef class PowerSeries(AlgebraElement): sage: t = PowerSeriesRing(QQ, 't').gen() sage: f = (t + t**2).O(4) - sage: sinh(f) # optional - sage.symbolic + sage: sinh(f) t + t^2 + 1/6*t^3 + O(t^4) For several variables:: sage: T. = PowerSeriesRing(ZZ,2) sage: f = a + b + a*b + T.O(3) - sage: sinh(f) # optional - sage.symbolic + sage: sinh(f) a + b + a*b + O(a, b)^3 sage: f.sinh() a + b + a*b + O(a, b)^3 @@ -2092,7 +2097,7 @@ cdef class PowerSeries(AlgebraElement): one raises an error:: sage: g = 2 + f - sage: sinh(g) # optional - sage.symbolic + sage: sinh(g) Traceback (most recent call last): ... ValueError: can only apply sinh to formal power series with zero @@ -2102,17 +2107,17 @@ cdef class PowerSeries(AlgebraElement): sage: T.default_prec() 12 - sage: sinh(a) # optional - sage.symbolic + sage: sinh(a) a + 1/6*a^3 + 1/120*a^5 + 1/5040*a^7 + 1/362880*a^9 + 1/39916800*a^11 + O(a, b)^12 sage: a.sinh(prec=5) a + 1/6*a^3 + O(a, b)^5 - sage: sinh(a + T.O(5)) # optional - sage.symbolic + sage: sinh(a + T.O(5)) a + 1/6*a^3 + O(a, b)^5 TESTS:: - sage: sinh(a^2 + T.O(5)) # optional - sage.symbolic + sage: sinh(a^2 + T.O(5)) a^2 + O(a, b)^5 """ @@ -2163,14 +2168,14 @@ cdef class PowerSeries(AlgebraElement): sage: t = PowerSeriesRing(QQ, 't').gen() sage: f = (t + t**2).O(4) - sage: cosh(f) # optional - sage.symbolic + sage: cosh(f) 1 + 1/2*t^2 + t^3 + O(t^4) For several variables:: sage: T. = PowerSeriesRing(ZZ,2) sage: f = a + b + a*b + T.O(3) - sage: cosh(f) # optional - sage.symbolic + sage: cosh(f) 1 + 1/2*a^2 + a*b + 1/2*b^2 + O(a, b)^3 sage: f.cosh() 1 + 1/2*a^2 + a*b + 1/2*b^2 + O(a, b)^3 @@ -2181,7 +2186,7 @@ cdef class PowerSeries(AlgebraElement): one raises an error:: sage: g = 2 + f - sage: cosh(g) # optional - sage.symbolic + sage: cosh(g) Traceback (most recent call last): ... ValueError: can only apply cosh to formal power series with zero @@ -2191,17 +2196,17 @@ cdef class PowerSeries(AlgebraElement): sage: T.default_prec() 12 - sage: cosh(a) # optional - sage.symbolic + sage: cosh(a) 1 + 1/2*a^2 + 1/24*a^4 + 1/720*a^6 + 1/40320*a^8 + 1/3628800*a^10 + O(a, b)^12 sage: a.cosh(prec=5) 1 + 1/2*a^2 + 1/24*a^4 + O(a, b)^5 - sage: cosh(a + T.O(5)) # optional - sage.symbolic + sage: cosh(a + T.O(5)) 1 + 1/2*a^2 + 1/24*a^4 + O(a, b)^5 TESTS:: - sage: cosh(a^2 + T.O(5)) # optional - sage.symbolic + sage: cosh(a^2 + T.O(5)) 1 + 1/2*a^4 + O(a, b)^5 """ @@ -2251,14 +2256,14 @@ cdef class PowerSeries(AlgebraElement): sage: t = PowerSeriesRing(QQ, 't').gen() sage: f = (t + t**2).O(4) - sage: tanh(f) # optional - sage.symbolic + sage: tanh(f) t + t^2 - 1/3*t^3 + O(t^4) For several variables:: sage: T. = PowerSeriesRing(ZZ,2) sage: f = a + b + a*b + T.O(3) - sage: tanh(f) # optional - sage.symbolic + sage: tanh(f) a + b + a*b + O(a, b)^3 sage: f.tanh() a + b + a*b + O(a, b)^3 @@ -2269,7 +2274,7 @@ cdef class PowerSeries(AlgebraElement): one raises an error:: sage: g = 2 + f - sage: tanh(g) # optional - sage.symbolic + sage: tanh(g) Traceback (most recent call last): ... ValueError: can only apply tanh to formal power series with zero @@ -2279,17 +2284,17 @@ cdef class PowerSeries(AlgebraElement): sage: T.default_prec() 12 - sage: tanh(a) # optional - sage.symbolic + sage: tanh(a) a - 1/3*a^3 + 2/15*a^5 - 17/315*a^7 + 62/2835*a^9 - 1382/155925*a^11 + O(a, b)^12 sage: a.tanh(prec=5) a - 1/3*a^3 + O(a, b)^5 - sage: tanh(a + T.O(5)) # optional - sage.symbolic + sage: tanh(a + T.O(5)) a - 1/3*a^3 + O(a, b)^5 TESTS:: - sage: tanh(a^2 + T.O(5)) # optional - sage.symbolic + sage: tanh(a^2 + T.O(5)) a^2 + O(a, b)^5 """ @@ -2511,15 +2516,15 @@ cdef class PowerSeries(AlgebraElement): :: sage: R. = PowerSeriesRing(ZZ) - sage: (1 + x + O(x^2)).exp() + sage: (1 + x + O(x^2)).exp() # needs sage.symbolic Traceback (most recent call last): ... ArithmeticError: exponential of constant term does not belong to coefficient ring (consider working in a larger ring) :: - sage: R. = PowerSeriesRing(GF(5)) # optional - sage.rings.finite_rings - sage: (1 + x + O(x^2)).exp() # optional - sage.rings.finite_rings + sage: R. = PowerSeriesRing(GF(5)) + sage: (1 + x + O(x^2)).exp() Traceback (most recent call last): ... ArithmeticError: constant term of power series does not support exponentiation @@ -2787,21 +2792,21 @@ cdef class PowerSeries(AlgebraElement): sage: k. = QQ[[]] sage: f = 1 + 17*w + 15*w^3 + O(w^5) - sage: pari(f) # indirect doctest # optional - sage.libs.pari + sage: pari(f) # indirect doctest # needs sage.libs.pari 1 + 17*w + 15*w^3 + O(w^5) - sage: pari(1 - 19*w + w^5) # indirect doctest # optional - sage.libs.pari + sage: pari(1 - 19*w + w^5) # indirect doctest # needs sage.libs.pari w^5 - 19*w + 1 sage: R. = Zmod(6)[[]] - sage: pari(1 + x + 8*x^3 + O(x^8)) # indirect doctest # optional - sage.libs.pari + sage: pari(1 + x + 8*x^3 + O(x^8)) # indirect doctest # needs sage.libs.pari Mod(1, 6) + Mod(1, 6)*x + Mod(2, 6)*x^3 + O(x^8) TESTS:: - sage: pari(1 + O(x^1)) # optional - sage.libs.pari + sage: pari(1 + O(x^1)) # needs sage.libs.pari Mod(1, 6) + O(x) - sage: pari(O(x^1)) # optional - sage.libs.pari + sage: pari(O(x^1)) # needs sage.libs.pari O(x) - sage: pari(O(x^0)) # optional - sage.libs.pari + sage: pari(O(x^0)) # needs sage.libs.pari O(x^0) """ n = self.prec() diff --git a/src/sage/rings/puiseux_series_ring.py b/src/sage/rings/puiseux_series_ring.py index fdad0caef39..2f761c51925 100644 --- a/src/sage/rings/puiseux_series_ring.py +++ b/src/sage/rings/puiseux_series_ring.py @@ -111,7 +111,7 @@ def _repr_(self): EXAMPLES:: - sage: PuiseuxSeriesRing(AA, 'y') + sage: PuiseuxSeriesRing(AA, 'y') # needs sage.rings.number_field Puiseux Series Ring in y over Algebraic Real Field """ s = "Puiseux Series Ring in {} over {}".format(self.variable_name(), @@ -302,8 +302,8 @@ def _element_constructor_(self, x, e=1, prec=infinity): sage: P(z) + y**(1/2) 3 + y^(1/2) + 2*y + y^2 + 2*y^3 + O(y^5) - sage: from sage.modular.etaproducts import qexp_eta # optional - sage.modular - sage: y^(1/24)*qexp_eta(P, prec=30) # optional - sage.modular + sage: from sage.modular.etaproducts import qexp_eta # needs sage.modular + sage: y^(1/24)*qexp_eta(P, prec=30) # needs sage.modular y^(1/24) - y^(25/24) - y^(49/24) + y^(121/24) + y^(169/24) - y^(289/24) - y^(361/24) + y^(529/24) + y^(625/24) + O(y^(721/24)) """ P = parent(x) @@ -395,8 +395,8 @@ def gen(self, n=0): EXAMPLES:: - sage: A = PuiseuxSeriesRing(AA, 'z') - sage: A.gen() + sage: A = PuiseuxSeriesRing(AA, 'z') # needs sage.rings.number_field + sage: A.gen() # needs sage.rings.number_field z """ if n != 0: @@ -409,8 +409,8 @@ def ngens(self): EXAMPLES:: - sage: A = PuiseuxSeriesRing(AA, 'z') - sage: A.ngens() + sage: A = PuiseuxSeriesRing(AA, 'z') # needs sage.rings.number_field + sage: A.ngens() # needs sage.rings.number_field 1 """ return 1 @@ -421,8 +421,8 @@ def laurent_series_ring(self): EXAMPLES:: - sage: A = PuiseuxSeriesRing(AA, 'z') - sage: A.laurent_series_ring() + sage: A = PuiseuxSeriesRing(AA, 'z') # needs sage.rings.number_field + sage: A.laurent_series_ring() # needs sage.rings.number_field Laurent Series Ring in z over Algebraic Real Field """ return self._laurent_series_ring @@ -433,8 +433,8 @@ def default_prec(self): EXAMPLES:: - sage: A = PuiseuxSeriesRing(AA, 'z') - sage: A.default_prec() + sage: A = PuiseuxSeriesRing(AA, 'z') # needs sage.rings.number_field + sage: A.default_prec() # needs sage.rings.number_field 20 """ return self.laurent_series_ring().default_prec() diff --git a/src/sage/rings/puiseux_series_ring_element.pyx b/src/sage/rings/puiseux_series_ring_element.pyx index 9543ce5a24a..9465e20ba1b 100644 --- a/src/sage/rings/puiseux_series_ring_element.pyx +++ b/src/sage/rings/puiseux_series_ring_element.pyx @@ -46,7 +46,7 @@ Other arithmetic can be performed with Puiseux Series:: Mind the base ring. However, the base ring can be changed:: - sage: I*q + sage: I*q # needs sage.rings.number_field Traceback (most recent call last): ... TypeError: unsupported operand parent(s) for *: 'Number Field in I with defining polynomial x^2 + 1 with I = 1*I' and 'Puiseux Series Ring in x over Rational Field' @@ -220,11 +220,11 @@ cdef class PuiseuxSeries(AlgebraElement): sage: R. = PuiseuxSeriesRing(ZZ) sage: p = x^(1/3) + x**3 - sage: t = p._im_gens_(QQbar, [2]) - sage: t in QQbar + sage: t = p._im_gens_(QQbar, [2]) # needs sage.rings.number_field + sage: t in QQbar # needs sage.rings.number_field True - sage: f = R.hom([QQbar(2)], check=False) - sage: t == f(p) + sage: f = R.hom([QQbar(2)], check=False) # needs sage.rings.number_field + sage: t == f(p) # needs sage.rings.number_field True """ return self(codomain(im_gens[0])) @@ -241,8 +241,8 @@ cdef class PuiseuxSeries(AlgebraElement): sage: R.zero() 0 - sage: S. = PuiseuxSeriesRing(Zp(5)) - sage: t**(1/2) + 5 * t^(1/3) + sage: S. = PuiseuxSeriesRing(Zp(5)) # needs sage.rings.padics + sage: t**(1/2) + 5 * t^(1/3) # needs sage.rings.padics (5 + O(5^21))*t^(1/3) + (1 + O(5^20))*t^(1/2) """ laurent = self.laurent_part() @@ -300,7 +300,7 @@ cdef class PuiseuxSeries(AlgebraElement): sage: p = x^(1/2) + x**3-x**(-1/4) sage: p(16) 8199/2 - sage: p(pi.n()) + sage: p(pi.n()) # needs sage.symbolic 32.0276049867404 """ # use x.nth_root since x**(1/self._e) returns oo when x = 0 @@ -438,9 +438,9 @@ cdef class PuiseuxSeries(AlgebraElement): EXAMPLES:: - sage: P. = PuiseuxSeriesRing(Zp(3)) - sage: t = y^(2/5) + O(y) - sage: 5*t # indirect doctest + sage: P. = PuiseuxSeriesRing(Zp(3)) # needs sage.rings.padics + sage: t = y^(2/5) + O(y) # needs sage.rings.padics + sage: 5*t # indirect doctest # needs sage.rings.padics (2 + 3 + O(3^20))*y^(2/5) + O(y) """ return type(self)(self._parent, self._l._lmul_(c), self._e) @@ -871,6 +871,7 @@ cdef class PuiseuxSeries(AlgebraElement): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: P. = PolynomialRing(GF(5)) sage: R. = PuiseuxSeriesRing(P) sage: p = 3*y*x**(-2/3) + 2*y**2*x**(1/5); p @@ -944,6 +945,7 @@ cdef class PuiseuxSeries(AlgebraElement): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: R. = PuiseuxSeriesRing(GF(3)) sage: p = (x**(-1/3) + 2*x**3)**2; p x^(-2/3) + x^(8/3) + x^6 @@ -1018,6 +1020,7 @@ cdef class PuiseuxSeries(AlgebraElement): EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = PuiseuxSeriesRing(QQbar) sage: p = x**(3/2) - QQbar(I)*x**(1/2) sage: p.power_series() diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py index 4ffa5704e83..7c3e6262448 100644 --- a/src/sage/rings/qqbar.py +++ b/src/sage/rings/qqbar.py @@ -68,7 +68,7 @@ True sage: (sqrt(5 + 2*sqrt(QQbar(6))) - sqrt(QQbar(3)))^2 == 2 True - sage: AA((sqrt(5 + 2*sqrt(6)) - sqrt(3))^2) == 2 + sage: AA((sqrt(5 + 2*sqrt(6)) - sqrt(3))^2) == 2 # needs sage.symbolic True For a monic cubic polynomial `x^3 + bx^2 + cx + d` with roots `s1`, @@ -109,23 +109,23 @@ We can convert from symbolic expressions:: - sage: QQbar(sqrt(-5)) + sage: QQbar(sqrt(-5)) # needs sage.symbolic 2.236067977499790?*I - sage: AA(sqrt(2) + sqrt(3)) + sage: AA(sqrt(2) + sqrt(3)) # needs sage.symbolic 3.146264369941973? sage: QQbar(I) I - sage: QQbar(I * golden_ratio) + sage: QQbar(I * golden_ratio) # needs sage.symbolic 1.618033988749895?*I - sage: AA(golden_ratio)^2 - AA(golden_ratio) + sage: AA(golden_ratio)^2 - AA(golden_ratio) # needs sage.symbolic 1 - sage: QQbar((-8)^(1/3)) + sage: QQbar((-8)^(1/3)) # needs sage.symbolic 1.000000000000000? + 1.732050807568878?*I - sage: AA((-8)^(1/3)) + sage: AA((-8)^(1/3)) # needs sage.symbolic -2 - sage: QQbar((-4)^(1/4)) + sage: QQbar((-4)^(1/4)) # needs sage.symbolic 1 + 1*I - sage: AA((-4)^(1/4)) + sage: AA((-4)^(1/4)) # needs sage.symbolic Traceback (most recent call last): ... ValueError: Cannot coerce algebraic number with non-zero imaginary part to algebraic real @@ -133,9 +133,9 @@ The coercion, however, goes in the other direction, since not all symbolic expressions are algebraic numbers:: - sage: QQbar(sqrt(2)) + sqrt(3) + sage: QQbar(sqrt(2)) + sqrt(3) # needs sage.symbolic sqrt(3) + 1.414213562373095? - sage: QQbar(sqrt(2) + QQbar(sqrt(3))) + sage: QQbar(sqrt(2) + QQbar(sqrt(3))) # needs sage.symbolic 3.146264369941973? Note the different behavior in taking roots: for ``AA`` we prefer real @@ -202,10 +202,11 @@ The Sage rings ``AA`` and ``QQbar`` can decide equalities between radical expressions (over the reals and complex numbers respectively):: - sage: a = AA((2/(3*sqrt(3)) + 10/27)^(1/3) - 2/(9*(2/(3*sqrt(3)) + 10/27)^(1/3)) + 1/3) - sage: a + sage: a = AA((2/(3*sqrt(3)) + 10/27)^(1/3) # needs sage.symbolic + ....: - 2/(9*(2/(3*sqrt(3)) + 10/27)^(1/3)) + 1/3) + sage: a # needs sage.symbolic 1.000000000000000? - sage: a == 1 + sage: a == 1 # needs sage.symbolic True Algebraic numbers which are known to be rational print as rationals; @@ -261,9 +262,9 @@ We can compute the multiplicative order of an algebraic number:: - sage: QQbar(-1/2 + I*sqrt(3)/2).multiplicative_order() + sage: QQbar(-1/2 + I*sqrt(3)/2).multiplicative_order() # needs sage.symbolic 3 - sage: QQbar(-sqrt(3)/2 + I/2).multiplicative_order() + sage: QQbar(-sqrt(3)/2 + I/2).multiplicative_order() # needs sage.symbolic 12 sage: (QQbar.zeta(23)**5).multiplicative_order() 23 @@ -332,6 +333,7 @@ on ``n`` will also trigger exact computation on ``rt2``, as you can see by the fact that the third output is different than the first:: + sage: # needs sage.symbolic sage: rt2 = AA(sqrt(2)) sage: n = rt2^2 sage: sage_input(n, verify=True) @@ -383,24 +385,24 @@ sage: loads(dumps(QQbar.zeta(5))) == QQbar.zeta(5) True - sage: t = QQbar(sqrt(2)); type(t._descr) + sage: t = QQbar(sqrt(2)); type(t._descr) # needs sage.symbolic - sage: loads(dumps(t)) == QQbar(sqrt(2)) + sage: loads(dumps(t)) == QQbar(sqrt(2)) # needs sage.symbolic True - sage: t.exactify(); type(t._descr) + sage: t.exactify(); type(t._descr) # needs sage.symbolic - sage: loads(dumps(t)) == QQbar(sqrt(2)) + sage: loads(dumps(t)) == QQbar(sqrt(2)) # needs sage.symbolic True - sage: t = ~QQbar(sqrt(2)); type(t._descr) + sage: t = ~QQbar(sqrt(2)); type(t._descr) # needs sage.symbolic - sage: loads(dumps(t)) == 1/QQbar(sqrt(2)) + sage: loads(dumps(t)) == 1/QQbar(sqrt(2)) # needs sage.symbolic True - sage: t = QQbar(sqrt(2)) + QQbar(sqrt(3)); type(t._descr) + sage: t = QQbar(sqrt(2)) + QQbar(sqrt(3)); type(t._descr) # needs sage.symbolic - sage: loads(dumps(t)) == QQbar(sqrt(2)) + QQbar(sqrt(3)) + sage: loads(dumps(t)) == QQbar(sqrt(2)) + QQbar(sqrt(3)) # needs sage.symbolic True We can convert elements of ``QQbar`` and ``AA`` into the following @@ -418,7 +420,9 @@ Here are examples of all of these conversions:: - sage: all_vals = [AA(42), AA(22/7), AA(golden_ratio), QQbar(-13), QQbar(89/55), QQbar(-sqrt(7)), QQbar.zeta(5)] + sage: # needs sage.symbolic + sage: all_vals = [AA(42), AA(22/7), AA(golden_ratio), + ....: QQbar(-13), QQbar(89/55), QQbar(-sqrt(7)), QQbar.zeta(5)] sage: def convert_test_all(ty): ....: def convert_test(v): ....: try: @@ -666,13 +670,14 @@ def common_polynomial(self, poly): sage: phi * tau == -1 True - sage: x = polygen(SR) # optional - sage.symbolic - sage: p = (x - sqrt(-5)) * (x - sqrt(3)); p # optional - sage.symbolic + sage: # needs sage.symbolic + sage: x = polygen(SR) + sage: p = (x - sqrt(-5)) * (x - sqrt(3)); p x^2 + (-sqrt(3) - sqrt(-5))*x + sqrt(3)*sqrt(-5) - sage: p = QQbar.common_polynomial(p) # optional - sage.symbolic - sage: a = QQbar.polynomial_root(p, CIF(RIF(-0.1, 0.1), RIF(2, 3))); a # optional - sage.symbolic + sage: p = QQbar.common_polynomial(p) + sage: a = QQbar.polynomial_root(p, CIF(RIF(-0.1, 0.1), RIF(2, 3))); a 0.?e-18 + 2.236067977499790?*I - sage: b = QQbar.polynomial_root(p, RIF(1, 2)); b # optional - sage.symbolic + sage: b = QQbar.polynomial_root(p, RIF(1, 2)); b 1.732050807568878? These "common polynomials" can be shared between real and @@ -785,6 +790,7 @@ def _factor_multivariate_polynomial(self, f, proof=True): A test requiring us to further extend a number field that was used to specify the polynomial:: + sage: # needs sage.symbolic sage: p = x^2 + QQbar(sqrt(2))*y^2 sage: F = QQbar._factor_multivariate_polynomial(p) sage: F @@ -792,6 +798,7 @@ def _factor_multivariate_polynomial(self, f, proof=True): sage: F.value() == p True + sage: # needs sage.symbolic sage: p = u^2 + AA(sqrt(2))*v^2 sage: F = AA._factor_multivariate_polynomial(p) sage: F @@ -802,6 +809,7 @@ def _factor_multivariate_polynomial(self, f, proof=True): A test requiring a number field different from the number field used to specify the polynomial:: + sage: # needs sage.symbolic sage: p = QQbar(sqrt(2))*(x^2+y^2) sage: F = QQbar._factor_multivariate_polynomial(p) sage: F @@ -809,6 +817,7 @@ def _factor_multivariate_polynomial(self, f, proof=True): sage: F.value() == p True + sage: # needs sage.symbolic sage: p = AA(sqrt(2))*(u^2+v^2) sage: F = AA._factor_multivariate_polynomial(p) sage: F @@ -819,6 +828,7 @@ def _factor_multivariate_polynomial(self, f, proof=True): A test where a factor introduces a number field that was already used to specify the polynomial:: + sage: # needs sage.symbolic sage: p = QQbar(sqrt(2))*(x^2-2*y^2)^2 sage: F = QQbar._factor_multivariate_polynomial(p) sage: F @@ -827,6 +837,7 @@ def _factor_multivariate_polynomial(self, f, proof=True): sage: F.value() == p True + sage: # needs sage.symbolic sage: p = AA(sqrt(2))*(u^2-2*v^2)^2 sage: F = AA._factor_multivariate_polynomial(p) sage: F @@ -837,6 +848,7 @@ def _factor_multivariate_polynomial(self, f, proof=True): A test where two factors produce the same factor in the norm:: + sage: # needs sage.symbolic sage: p = (x^2+QQbar(sqrt(2))*y^2)*(x^4-2*y^4) sage: F = QQbar._factor_multivariate_polynomial(p) sage: F @@ -845,6 +857,7 @@ def _factor_multivariate_polynomial(self, f, proof=True): sage: F.value() == p True + sage: # needs sage.symbolic sage: p = (u^2+AA(sqrt(2))*v^2)*(u^4-2*v^4) sage: F = AA._factor_multivariate_polynomial(p) sage: F @@ -868,9 +881,9 @@ def _factor_multivariate_polynomial(self, f, proof=True): number field generator:: sage: S. = QQbar[] - sage: p = a^2 + QQbar(sqrt(2))*b^2 - sage: F = QQbar._factor_multivariate_polynomial(p) - sage: F + sage: p = a^2 + QQbar(sqrt(2))*b^2 # needs sage.symbolic + sage: F = QQbar._factor_multivariate_polynomial(p) # needs sage.symbolic + sage: F # needs sage.symbolic (a + (-1.189207115002722?*I)*b) * (a + 1.189207115002722?*I*b) A test that led to :trac:`26898`:: @@ -1088,7 +1101,7 @@ def _element_constructor_(self, x): EXAMPLES:: - sage: QQbar(sqrt(2)) in AA # indirect doctest + sage: QQbar(sqrt(2)) in AA # indirect doctest # needs sage.symbolic True sage: QQbar(I) in AA False @@ -1097,7 +1110,7 @@ def _element_constructor_(self, x): The following should both return ``True`` (this is a bug). :: - sage: sqrt(2) in AA # known bug + sage: sqrt(2) in AA # known bug # needs sage.symbolic False sage: K. = CyclotomicField(5); z + 1/z in AA # known bug False @@ -1178,7 +1191,7 @@ def _coerce_map_from_(self, from_par): True sage: a + AA(3) 5.645751311064590? - sage: AA.has_coerce_map_from(SR) # optional - sage.symbolic + sage: AA.has_coerce_map_from(SR) # needs sage.symbolic False sage: x = polygen(ZZ, 'x') @@ -1623,11 +1636,11 @@ def _element_constructor_(self, x): EXAMPLES:: - sage: sqrt(2) in QQbar # indirect doctest + sage: sqrt(2) in QQbar # indirect doctest # needs sage.symbolic True sage: 22/7 in QQbar True - sage: pi in QQbar + sage: pi in QQbar # needs sage.symbolic False """ if isinstance(x, AlgebraicNumber): @@ -1685,7 +1698,7 @@ def _coerce_map_from_(self, from_par): True sage: QQbar.has_coerce_map_from(CC) False - sage: QQbar.has_coerce_map_from(SR) # optional - sage.symbolic + sage: QQbar.has_coerce_map_from(SR) # needs sage.symbolic False sage: i + QQbar(2) @@ -2567,30 +2580,34 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal sage: splitting = number_field_elements_from_algebraics(rts)[0]; splitting Number Field in a with defining polynomial y^6 - 40*y^4 - 22*y^3 + 873*y^2 + 1386*y + 594 sage: p.roots(ring=splitting) - [(361/29286*a^5 - 19/3254*a^4 - 14359/29286*a^3 + 401/29286*a^2 + 18183/1627*a + 15930/1627, 1), (49/117144*a^5 - 179/39048*a^4 - 3247/117144*a^3 + 22553/117144*a^2 + 1744/4881*a - 17195/6508, 1), (-1493/117144*a^5 + 407/39048*a^4 + 60683/117144*a^3 - 24157/117144*a^2 - 56293/4881*a - 53033/6508, 1)] - sage: rt2 = AA(sqrt(2)); rt2 + [(361/29286*a^5 - 19/3254*a^4 - 14359/29286*a^3 + 401/29286*a^2 + 18183/1627*a + 15930/1627, 1), + (49/117144*a^5 - 179/39048*a^4 - 3247/117144*a^3 + 22553/117144*a^2 + 1744/4881*a - 17195/6508, 1), + (-1493/117144*a^5 + 407/39048*a^4 + 60683/117144*a^3 - 24157/117144*a^2 - 56293/4881*a - 53033/6508, 1)] + sage: rt2 = AA(sqrt(2)); rt2 # needs sage.symbolic 1.414213562373095? - sage: rt3 = AA(sqrt(3)); rt3 + sage: rt3 = AA(sqrt(3)); rt3 # needs sage.symbolic 1.732050807568878? - sage: rt3a = QQbar(sqrt(3)); rt3a + sage: rt3a = QQbar(sqrt(3)); rt3a # needs sage.symbolic 1.732050807568878? sage: qqI = QQbar.zeta(4); qqI I sage: z3 = QQbar.zeta(3); z3 -0.500000000000000? + 0.866025403784439?*I - sage: rt2b = rt3 + rt2 - rt3; rt2b + sage: rt2b = rt3 + rt2 - rt3; rt2b # needs sage.symbolic 1.414213562373095? - sage: rt2c = z3 + rt2 - z3; rt2c + sage: rt2c = z3 + rt2 - z3; rt2c # needs sage.symbolic 1.414213562373095? + 0.?e-19*I - sage: number_field_elements_from_algebraics(rt2) - (Number Field in a with defining polynomial y^2 - 2, a, Ring morphism: + sage: number_field_elements_from_algebraics(rt2) # needs sage.symbolic + (Number Field in a with defining polynomial y^2 - 2, a, + Ring morphism: From: Number Field in a with defining polynomial y^2 - 2 To: Algebraic Real Field Defn: a |--> 1.414213562373095?) - sage: number_field_elements_from_algebraics((rt2,rt3)) - (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, [-a^3 + 3*a, a^2 - 2], Ring morphism: + sage: number_field_elements_from_algebraics((rt2,rt3)) # needs sage.symbolic + (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, [-a^3 + 3*a, a^2 - 2], + Ring morphism: From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1 To: Algebraic Real Field Defn: a |--> -1.931851652578137?) @@ -2599,14 +2616,16 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal to ``AA`` (because all elements are real), but if we specify ``same_field=True``, we'll get a homomorphism back to ``QQbar``:: - sage: number_field_elements_from_algebraics(rt3a) - (Number Field in a with defining polynomial y^2 - 3, a, Ring morphism: + sage: number_field_elements_from_algebraics(rt3a) # needs sage.symbolic + (Number Field in a with defining polynomial y^2 - 3, a, + Ring morphism: From: Number Field in a with defining polynomial y^2 - 3 To: Algebraic Real Field Defn: a |--> 1.732050807568878?) - sage: number_field_elements_from_algebraics(rt3a, same_field=True) - (Number Field in a with defining polynomial y^2 - 3, a, Ring morphism: + sage: number_field_elements_from_algebraics(rt3a, same_field=True) # needs sage.symbolic + (Number Field in a with defining polynomial y^2 - 3, a, + Ring morphism: From: Number Field in a with defining polynomial y^2 - 3 To: Algebraic Field Defn: a |--> 1.732050807568878?) @@ -2614,15 +2633,16 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal We've created ``rt2b`` in such a way that \sage does not initially know that it's in a degree-2 extension of `\QQ`:: - sage: number_field_elements_from_algebraics(rt2b) - (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, -a^3 + 3*a, Ring morphism: + sage: number_field_elements_from_algebraics(rt2b) # needs sage.symbolic + (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, -a^3 + 3*a, + Ring morphism: From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1 To: Algebraic Real Field Defn: a |--> -1.931851652578137?) We can specify ``minimal=True`` if we want the smallest number field:: - sage: number_field_elements_from_algebraics(rt2b, minimal=True) + sage: number_field_elements_from_algebraics(rt2b, minimal=True) # needs sage.symbolic (Number Field in a with defining polynomial y^2 - 2, a, Ring morphism: From: Number Field in a with defining polynomial y^2 - 2 To: Algebraic Real Field @@ -2639,8 +2659,10 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal Or we can just pass in symbolic expressions, as long as they can be coerced into ``QQbar``:: - sage: number_field_elements_from_algebraics((sqrt(7), sqrt(9), sqrt(11))) - (Number Field in a with defining polynomial y^4 - 9*y^2 + 1, [-a^3 + 8*a, 3, -a^3 + 10*a], Ring morphism: + sage: number_field_elements_from_algebraics((sqrt(7), sqrt(9), sqrt(11))) # needs sage.symbolic + (Number Field in a with defining polynomial y^4 - 9*y^2 + 1, + [-a^3 + 8*a, 3, -a^3 + 10*a], + Ring morphism: From: Number Field in a with defining polynomial y^4 - 9*y^2 + 1 To: Algebraic Real Field Defn: a |--> 0.3354367396454047?) @@ -2648,12 +2670,16 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal Here we see an example of doing some computations with number field elements, and then mapping them back into ``QQbar``:: - sage: (fld,nums,hom) = number_field_elements_from_algebraics((rt2, rt3, qqI, z3)) + sage: # needs sage.symbolic + sage: algebraics = (rt2, rt3, qqI, z3) + sage: fld,nums,hom = number_field_elements_from_algebraics(algebraics) sage: fld,nums,hom # random - (Number Field in a with defining polynomial y^8 - y^4 + 1, [-a^5 + a^3 + a, a^6 - 2*a^2, a^6, -a^4], Ring morphism: - From: Number Field in a with defining polynomial y^8 - y^4 + 1 - To: Algebraic Field - Defn: a |--> -0.2588190451025208? - 0.9659258262890683?*I) + (Number Field in a with defining polynomial y^8 - y^4 + 1, + [-a^5 + a^3 + a, a^6 - 2*a^2, a^6, -a^4], + Ring morphism: + From: Number Field in a with defining polynomial y^8 - y^4 + 1 + To: Algebraic Field + Defn: a |--> -0.2588190451025208? - 0.9659258262890683?*I) sage: (nfrt2, nfrt3, nfI, nfz3) = nums sage: hom(nfrt2) 1.414213562373095? + 0.?e-18*I @@ -2689,9 +2715,13 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal :: - sage: nf,nums,hom = number_field_elements_from_algebraics([2^(1/3),3^(1/5)],embedded=True) + sage: # needs sage.symbolic + sage: elems = [2^(1/3), 3^(1/5)] + sage: nf, nums, hom = number_field_elements_from_algebraics(elems, + ....: embedded=True) sage: nf - Number Field in a with defining polynomial y^15 - 9*y^10 + 21*y^5 - 3 with a = 0.6866813218928813? + Number Field in a with defining polynomial y^15 - 9*y^10 + 21*y^5 - 3 + with a = 0.6866813218928813? sage: nums [a^10 - 5*a^5 + 2, -a^8 + 4*a^3] sage: hom @@ -2702,25 +2732,32 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal Complex embeddings are possible as well:: + sage: # needs sage.symbolic sage: elems = [sqrt(5), 2^(1/3)+sqrt(3)*I, 3/4] - sage: nf, nums, hom = number_field_elements_from_algebraics(elems, embedded=True) - sage: nf # random (polynomial and root not unique) + sage: nf, nums, hom = number_field_elements_from_algebraics(elems, + ....: embedded=True) + sage: nf # random (polynomial and root not unique) Number Field in a with defining polynomial y^24 - 6*y^23 ...- 9*y^2 + 1 with a = 0.2598679? + 0.0572892?*I - sage: nf.is_isomorphic(NumberField(x^24 - 9*x^22 + 135*x^20 - 720*x^18 + 1821*x^16 - 3015*x^14 + 3974*x^12 - 3015*x^10 + 1821*x^8 - 720*x^6 + 135*x^4 - 9*x^2 + 1, 'a')) + sage: nf.is_isomorphic(NumberField( + ....: x^24 - 9*x^22 + 135*x^20 - 720*x^18 + 1821*x^16 + ....: - 3015*x^14 + 3974*x^12 - 3015*x^10 + 1821*x^8 + ....: - 720*x^6 + 135*x^4 - 9*x^2 + 1, 'a')) True sage: list(map(QQbar, nums)) == elems == list(map(hom, nums)) True TESTS:: - sage: number_field_elements_from_algebraics(rt3) - (Number Field in a with defining polynomial y^2 - 3, a, Ring morphism: + sage: number_field_elements_from_algebraics(rt3) # needs sage.symbolic + (Number Field in a with defining polynomial y^2 - 3, a, + Ring morphism: From: Number Field in a with defining polynomial y^2 - 3 To: Algebraic Real Field Defn: a |--> 1.732050807568878?) - sage: number_field_elements_from_algebraics((rt2,qqI)) - (Number Field in a with defining polynomial y^4 + 1, [-a^3 + a, a^2], Ring morphism: + sage: number_field_elements_from_algebraics((rt2,qqI)) # needs sage.symbolic + (Number Field in a with defining polynomial y^4 + 1, [-a^3 + a, a^2], + Ring morphism: From: Number Field in a with defining polynomial y^4 + 1 To: Algebraic Field Defn: a |--> 0.7071067811865475? + 0.7071067811865475?*I) @@ -2728,16 +2765,18 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal Note that for the first example, where \sage does not realize that the number is real, we get a homomorphism to ``QQbar``:: - sage: number_field_elements_from_algebraics(rt2c) # random - (Number Field in a with defining polynomial y^4 + 2*y^2 + 4, 1/2*a^3, Ring morphism: + sage: number_field_elements_from_algebraics(rt2c) # random # needs sage.symbolic + (Number Field in a with defining polynomial y^4 + 2*y^2 + 4, 1/2*a^3, + Ring morphism: From: Number Field in a with defining polynomial y^4 + 2*y^2 + 4 To: Algebraic Field Defn: a |--> -0.7071067811865475? - 1.224744871391589?*I) But with ``minimal=True``, we get a homomorphism to ``AA``:: - sage: number_field_elements_from_algebraics(rt2c, minimal=True) - (Number Field in a with defining polynomial y^2 - 2, a, Ring morphism: + sage: number_field_elements_from_algebraics(rt2c, minimal=True) # needs sage.symbolic + (Number Field in a with defining polynomial y^2 - 2, a, + Ring morphism: From: Number Field in a with defining polynomial y^2 - 2 To: Algebraic Real Field Defn: a |--> 1.414213562373095?) @@ -2745,8 +2784,10 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal If we specify both ``minimal=True`` and ``same_field=True``, we get a second degree extension (minimal) that maps back to ``QQbar``:: - sage: number_field_elements_from_algebraics(rt2c, minimal=True, same_field=True) - (Number Field in a with defining polynomial y^2 - 2, a, Ring morphism: + sage: number_field_elements_from_algebraics(rt2c, minimal=True, # needs sage.symbolic + ....: same_field=True) + (Number Field in a with defining polynomial y^2 - 2, a, + Ring morphism: From: Number Field in a with defining polynomial y^2 - 2 To: Algebraic Field Defn: a |--> 1.414213562373095?) @@ -2770,12 +2811,13 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal sage: E = UCF.gen(5) sage: L. = NumberField(x^2-189*x+16, embedding=200) sage: x = polygen(ZZ) - sage: my_nums = [-52*E - 136*E^2 - 136*E^3 - 52*E^4, \ - L.gen()._algebraic_(AA), \ - sqrt(2), AA.polynomial_root(x^3-3, RIF(0,3)), 11/9, 1] - sage: res = number_field_elements_from_algebraics(my_nums, embedded=True) - sage: res[0] - Number Field in a with defining polynomial y^24 - 107010*y^22 - 24*y^21 + ... + 250678447193040618624307096815048024318853254384 with a = 93.32530798172420? + sage: my_nums = [-52*E - 136*E^2 - 136*E^3 - 52*E^4, # needs sage.symbolic + ....: L.gen()._algebraic_(AA), + ....: sqrt(2), AA.polynomial_root(x^3 - 3, RIF(0,3)), 11/9, 1] + sage: res = number_field_elements_from_algebraics(my_nums, embedded=True) # needs sage.symbolic + sage: res[0] # needs sage.symbolic + Number Field in a with defining polynomial y^24 - 107010*y^22 - 24*y^21 + ... + + 250678447193040618624307096815048024318853254384 with a = 93.32530798172420? """ gen = qq_generator @@ -3030,6 +3072,7 @@ def __reduce__(self): EXAMPLES:: + sage: # needs sage.symbolic sage: t = QQbar(sqrt(2)) + QQbar(sqrt(3)) sage: t.exactify() sage: type(t._descr._generator) @@ -3456,17 +3499,17 @@ def is_simple(self): sage: from sage.rings.qqbar import ANRational sage: ANRational(1/2).is_simple() True - sage: rt2 = AA(sqrt(2)) - sage: rt3 = AA(sqrt(3)) - sage: rt2b = rt3 + rt2 - rt3 - sage: rt2.exactify() - sage: rt2._descr.is_simple() + sage: rt2 = AA(sqrt(2)) # needs sage.symbolic + sage: rt3 = AA(sqrt(3)) # needs sage.symbolic + sage: rt2b = rt3 + rt2 - rt3 # needs sage.symbolic + sage: rt2.exactify() # needs sage.symbolic + sage: rt2._descr.is_simple() # needs sage.symbolic True - sage: rt2b.exactify() - sage: rt2b._descr.is_simple() + sage: rt2b.exactify() # needs sage.symbolic + sage: rt2b._descr.is_simple() # needs sage.symbolic False - sage: rt2b.simplify() - sage: rt2b._descr.is_simple() + sage: rt2b.simplify() # needs sage.symbolic + sage: rt2b._descr.is_simple() # needs sage.symbolic True """ return False @@ -3480,9 +3523,9 @@ def neg(self, n): EXAMPLES:: - sage: a = QQbar(sqrt(2)) - sage: b = a._descr - sage: b.neg(a) + sage: a = QQbar(sqrt(2)) # needs sage.symbolic + sage: b = a._descr # needs sage.symbolic + sage: b.neg(a) # needs sage.symbolic """ return ANUnaryExpr(n, '-') @@ -3493,9 +3536,9 @@ def invert(self, n): EXAMPLES:: - sage: a = QQbar(sqrt(2)) - sage: b = a._descr - sage: b.invert(a) + sage: a = QQbar(sqrt(2)) # needs sage.symbolic + sage: b = a._descr # needs sage.symbolic + sage: b.invert(a) # needs sage.symbolic """ return ANUnaryExpr(n, '~') @@ -3506,9 +3549,9 @@ def abs(self, n): EXAMPLES:: - sage: a = QQbar(sqrt(2)) - sage: b = a._descr - sage: b.abs(a) + sage: a = QQbar(sqrt(2)) # needs sage.symbolic + sage: b = a._descr # needs sage.symbolic + sage: b.abs(a) # needs sage.symbolic """ return ANUnaryExpr(n, 'abs') @@ -3519,9 +3562,9 @@ def real(self, n): EXAMPLES:: - sage: a = QQbar(sqrt(-7)) - sage: b = a._descr - sage: b.real(a) + sage: a = QQbar(sqrt(-7)) # needs sage.symbolic + sage: b = a._descr # needs sage.symbolic + sage: b.real(a) # needs sage.symbolic """ if self.is_complex(): @@ -3535,9 +3578,9 @@ def imag(self, n): EXAMPLES:: - sage: a = QQbar(sqrt(-7)) - sage: b = a._descr - sage: b.imag(a) + sage: a = QQbar(sqrt(-7)) # needs sage.symbolic + sage: b = a._descr # needs sage.symbolic + sage: b.imag(a) # needs sage.symbolic """ if self.is_complex(): @@ -3551,9 +3594,9 @@ def conjugate(self, n): EXAMPLES:: - sage: a = QQbar(sqrt(-7)) - sage: b = a._descr - sage: b.conjugate(a) + sage: a = QQbar(sqrt(-7)) # needs sage.symbolic + sage: b = a._descr # needs sage.symbolic + sage: b.conjugate(a) # needs sage.symbolic """ if self.is_complex(): @@ -3568,9 +3611,9 @@ def norm(self, n): EXAMPLES:: - sage: a = QQbar(sqrt(-7)) - sage: b = a._descr - sage: b.norm(a) + sage: a = QQbar(sqrt(-7)) # needs sage.symbolic + sage: b = a._descr # needs sage.symbolic + sage: b.norm(a) # needs sage.symbolic """ if self.is_complex(): @@ -3635,7 +3678,7 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement): 1.618033988749895? sage: phi^2 == phi+1 True - sage: AA(sqrt(65537)) + sage: AA(sqrt(65537)) # needs sage.symbolic 256.0019531175495? """ @@ -3695,9 +3738,9 @@ def _repr_(self): sage: AA(19).sqrt() 4.358898943540674? sage: AA.options.display_format = 'radical' - sage: AA(19).sqrt() + sage: AA(19).sqrt() # needs sage.symbolic sqrt(19) - sage: QQbar.zeta(6) + sage: QQbar.zeta(6) # needs sage.symbolic 1/2*I*sqrt(3) + 1/2 sage: QQbar.zeta(17) 0.9324722294043558? + 0.3612416661871530?*I @@ -3813,7 +3856,7 @@ def _mul_(self, other): """ TESTS:: - sage: AA(sqrt(2)) * AA(sqrt(8)) # indirect doctest + sage: AA(sqrt(2)) * AA(sqrt(8)) # indirect doctest # needs sage.symbolic 4.000000000000000? """ sk = type(self._descr) @@ -3824,7 +3867,7 @@ def _div_(self, other): """ TESTS:: - sage: AA(sqrt(2)) / AA(sqrt(8)) # indirect doctest + sage: AA(sqrt(2)) / AA(sqrt(8)) # indirect doctest # needs sage.symbolic 0.500000000000000? sage: z = QQbar(I).real() @@ -3843,7 +3886,7 @@ def __invert__(self): """ TESTS:: - sage: ~AA(sqrt(~2)) + sage: ~AA(sqrt(~2)) # needs sage.symbolic 1.414213562373095? sage: z = QQbar(I).real() @@ -3873,7 +3916,7 @@ def _sub_(self, other): """ TESTS:: - sage: AA(golden_ratio) * 2 - AA(5).sqrt() # indirect doctest + sage: AA(golden_ratio) * 2 - AA(5).sqrt() # indirect doctest # needs sage.symbolic 1.000000000000000? """ sk = type(self._descr) @@ -3893,7 +3936,7 @@ def __abs__(self): """ TESTS:: - sage: abs(AA(sqrt(2) - sqrt(3))) + sage: abs(AA(sqrt(2) - sqrt(3))) # needs sage.symbolic 0.3178372451957823? sage: abs(QQbar(3+4*I)) 5 @@ -3929,8 +3972,8 @@ def __hash__(self): True sage: h1 = hash(QQbar.zeta(6)) - sage: h2 = hash(QQbar(1/2 + I*sqrt(3)/2)) - sage: h1 == h2 + sage: h2 = hash(QQbar(1/2 + I*sqrt(3)/2)) # needs sage.symbolic + sage: h1 == h2 # needs sage.symbolic True Unfortunately, the hash code for algebraic numbers which are close @@ -4003,11 +4046,11 @@ def __bool__(self): sage: a = QQbar(2).sqrt() - 16616132878186749607/11749380235262596085 sage: b = QQbar(2).sqrt() - 6882627592338442563/4866752642924153522 sage: c = QQbar(3).sqrt() - 142437039878091970439/82236063316189858921 - sage: d = (59/2)**(1000/7) - sage: e = (a + b + c) * (a + b - c) * (a - b) * (a - b - c) / d - sage: bool(e) + sage: d = (59/2)**(1000/7) # needs sage.symbolic + sage: e = (a + b + c) * (a + b - c) * (a - b) * (a - b - c) / d # needs sage.symbolic + sage: bool(e) # needs sage.symbolic True - sage: bool(e.abs() < 2**-500) + sage: bool(e.abs() < 2**-500) # needs sage.symbolic True An identity between roots of unity:: @@ -4315,8 +4358,9 @@ def as_number_field_element(self, minimal=False, embedded=False, prec=53): EXAMPLES:: - sage: QQbar(sqrt(8)).as_number_field_element() - (Number Field in a with defining polynomial y^2 - 2, 2*a, Ring morphism: + sage: QQbar(sqrt(8)).as_number_field_element() # needs sage.symbolic + (Number Field in a with defining polynomial y^2 - 2, 2*a, + Ring morphism: From: Number Field in a with defining polynomial y^2 - 2 To: Algebraic Real Field Defn: a |--> 1.414213562373095?) @@ -4368,6 +4412,7 @@ def as_number_field_element(self, minimal=False, embedded=False, prec=53): A complex algebraic number as an element of an embedded number field:: + sage: # needs sage.symbolic sage: num = QQbar(sqrt(2) + 3^(1/3)*I) sage: nf, elt, hom = num.as_number_field_element(embedded=True) sage: hom(elt).parent() is QQbar @@ -4380,16 +4425,19 @@ def as_number_field_element(self, minimal=False, embedded=False, prec=53): We see an example where we do not get the minimal number field unless we specify ``minimal=True``:: + sage: # needs sage.symbolic sage: rt2 = AA(sqrt(2)) sage: rt3 = AA(sqrt(3)) sage: rt3b = rt2 + rt3 - rt2 sage: rt3b.as_number_field_element() - (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, a^2 - 2, Ring morphism: + (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, a^2 - 2, + Ring morphism: From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1 To: Algebraic Real Field Defn: a |--> -1.931851652578137?) sage: rt3b.as_number_field_element(minimal=True) - (Number Field in a with defining polynomial y^2 - 3, a, Ring morphism: + (Number Field in a with defining polynomial y^2 - 3, a, + Ring morphism: From: Number Field in a with defining polynomial y^2 - 3 To: Algebraic Real Field Defn: a |--> 1.732050807568878?) @@ -4444,6 +4492,7 @@ def simplify(self): EXAMPLES:: + sage: # needs sage.symbolic sage: rt2 = AA(sqrt(2)) sage: rt3 = AA(sqrt(3)) sage: rt2b = rt3 + rt2 - rt3 @@ -4697,28 +4746,28 @@ def radical_expression(self): EXAMPLES:: - sage: AA(1/sqrt(5)).radical_expression() # optional - sage.symbolic + sage: AA(1/sqrt(5)).radical_expression() # needs sage.symbolic sqrt(1/5) - sage: AA(sqrt(5 + sqrt(5))).radical_expression() # optional - sage.symbolic + sage: AA(sqrt(5 + sqrt(5))).radical_expression() # needs sage.symbolic sqrt(sqrt(5) + 5) - sage: QQbar.zeta(5).radical_expression() # optional - sage.symbolic + sage: QQbar.zeta(5).radical_expression() # needs sage.symbolic 1/4*sqrt(5) + 1/2*sqrt(-1/2*sqrt(5) - 5/2) - 1/4 sage: x = polygen(QQ, 'x') sage: a = (x^7 - x - 1).roots(AA, False)[0] - sage: a.radical_expression() # optional - sage.symbolic + sage: a.radical_expression() # needs sage.symbolic 1.112775684278706? - sage: a.radical_expression().parent() == SR # optional - sage.symbolic + sage: a.radical_expression().parent() == SR # needs sage.symbolic False sage: a = sorted((x^7-x-1).roots(QQbar, False), key=imag)[0] - sage: a.radical_expression() # optional - sage.symbolic + sage: a.radical_expression() # needs sage.symbolic -0.3636235193291805? - 0.9525611952610331?*I - sage: QQbar.zeta(5).imag().radical_expression() # optional - sage.symbolic + sage: QQbar.zeta(5).imag().radical_expression() # needs sage.symbolic 1/2*sqrt(1/2*sqrt(5) + 5/2) - sage: AA(5/3).radical_expression() # optional - sage.symbolic + sage: AA(5/3).radical_expression() # needs sage.symbolic 5/3 - sage: AA(5/3).radical_expression().parent() == SR # optional - sage.symbolic + sage: AA(5/3).radical_expression().parent() == SR # needs sage.symbolic True - sage: QQbar(0).radical_expression() # optional - sage.symbolic + sage: QQbar(0).radical_expression() # needs sage.symbolic 0 TESTS: @@ -4729,15 +4778,16 @@ def radical_expression(self): :: - sage: a = AA(sqrt(2) + 10^25) # optional - sage.symbolic - sage: p = a.minpoly() # optional - sage.symbolic - sage: v = a._value # optional - sage.symbolic - sage: f = ComplexIntervalField(v.prec()) # optional - sage.symbolic - sage: var('x') # optional - sage.symbolic + sage: # needs sage.symbolic + sage: a = AA(sqrt(2) + 10^25) + sage: p = a.minpoly() + sage: v = a._value + sage: f = ComplexIntervalField(v.prec()) + sage: var('x') x - sage: [f(b.rhs()).overlaps(f(v)) for b in SR(p).solve(x)] # optional - sage.symbolic + sage: [f(b.rhs()).overlaps(f(v)) for b in SR(p).solve(x)] [True, True] - sage: a.radical_expression() # optional - sage.symbolic + sage: a.radical_expression() sqrt(2) + 10000000000000000000000000 """ from sage.symbolic.ring import SR # Lazy to avoid cyclic dependency @@ -4765,17 +4815,18 @@ def _maxima_init_(self, I=None): r""" EXAMPLES:: + sage: # needs sage.symbolic sage: maxima(AA(7)) 7 - sage: maxima(QQbar(sqrt(5/2))) # optional - sage.symbolic + sage: maxima(QQbar(sqrt(5/2))) sqrt(10)/2 - sage: maxima(AA(-sqrt(5))) # optional - sage.symbolic + sage: maxima(AA(-sqrt(5))) -sqrt(5) - sage: maxima(QQbar(sqrt(-2))) # optional - sage.symbolic + sage: maxima(QQbar(sqrt(-2))) sqrt(2)*%i - sage: maxima(AA(2+sqrt(5))) # optional - sage.symbolic + sage: maxima(AA(2+sqrt(5))) sqrt(5)+2 - sage: maxima(QQ[x](x^7 - x - 1).roots(AA, False)[0]) # optional - sage.symbolic + sage: maxima(QQ[x](x^7 - x - 1).roots(AA, False)[0]) Traceback (most recent call last): ... NotImplementedError: cannot find radical expression @@ -4889,24 +4940,24 @@ def _richcmp_(self, other, op): TESTS:: - sage: QQbar.zeta(6) == QQbar(1/2 + I*sqrt(3)/2) # optional - sage.symbolic + sage: QQbar.zeta(6) == QQbar(1/2 + I*sqrt(3)/2) # needs sage.symbolic True sage: QQbar(I) == QQbar(I * (2^100+1)/(2^100)) False sage: QQbar(2) == 2 True - sage: QQbar(2) == GF(7)(2) # optional - sage.rings.finite_rings + sage: QQbar(2) == GF(7)(2) # needs sage.rings.finite_rings False - sage: GF(7)(2) in QQbar # optional - sage.rings.finite_rings + sage: GF(7)(2) in QQbar # needs sage.rings.finite_rings False - sage: QQbar.zeta(6) != QQbar(1/2 + I*sqrt(3)/2) # optional - sage.symbolic + sage: QQbar.zeta(6) != QQbar(1/2 + I*sqrt(3)/2) # needs sage.symbolic False sage: QQbar(I) != QQbar(I * (2^100+1)/(2^100)) True sage: QQbar(2) != 2 False - sage: QQbar(2) != GF(7)(2) # optional - sage.rings.finite_rings + sage: QQbar(2) != GF(7)(2) # needs sage.rings.finite_rings True sage: QQbar.zeta(3).real() == -1/2 @@ -4926,22 +4977,22 @@ def _richcmp_(self, other, op): Check that :trac:`29220` is fixed:: - sage: a = AA(2**(1/2) - 2**(1/3)) + sage: a = AA(2**(1/2) - 2**(1/3)) # needs sage.symbolic sage: b = 808620184/5240825825 - sage: a < b + sage: a < b # needs sage.symbolic True - sage: a < b + sage: a < b # needs sage.symbolic True - sage: a = AA(2^(1/3)) + sage: a = AA(2^(1/3)) # needs sage.symbolic sage: r = 3085094589/2448641198 - sage: a < r + sage: a < r # needs sage.symbolic False - sage: a > r + sage: a > r # needs sage.symbolic True - sage: a < r + sage: a < r # needs sage.symbolic False - sage: a > r + sage: a > r # needs sage.symbolic True """ if self is other: @@ -5000,7 +5051,7 @@ def _mpfr_(self, field): EXAMPLES:: - sage: QQbar(sqrt(2))._mpfr_(RR) + sage: QQbar(sqrt(2))._mpfr_(RR) # needs sage.symbolic 1.41421356237309 sage: QQbar(-22/7)._mpfr_(RR) -3.14285714285714 @@ -5019,7 +5070,7 @@ def __float__(self): EXAMPLES:: - sage: QQbar(sqrt(2)).__float__() + sage: QQbar(sqrt(2)).__float__() # needs sage.symbolic 1.414213562373095 sage: float(QQbar(-22/7)) -3.1428571428571432 @@ -5036,7 +5087,7 @@ def __complex__(self): EXAMPLES:: - sage: QQbar(sqrt(2)).__complex__() + sage: QQbar(sqrt(2)).__complex__() # needs sage.symbolic (1.414213562373095+0j) sage: complex(QQbar.zeta(3)) (-0.5+0.8660254037844386j) @@ -5049,7 +5100,7 @@ def _complex_double_(self, cdf): EXAMPLES:: - sage: QQbar(sqrt(-5))._complex_double_(CDF) + sage: QQbar(sqrt(-5))._complex_double_(CDF) # needs sage.symbolic 2.23606797749979*I sage: CDF(QQbar.zeta(12)) 0.8660254037844386 + 0.5*I @@ -5062,7 +5113,7 @@ def _interval_fast(self, prec): EXAMPLES:: - sage: QQbar(sqrt(-5))._interval_fast(100) + sage: QQbar(sqrt(-5))._interval_fast(100) # needs sage.symbolic 2.236067977499789696409173...?*I """ return self.interval_fast(ComplexIntervalField(prec)) @@ -5081,15 +5132,15 @@ def _integer_(self, ZZ=None): Traceback (most recent call last): ... ValueError: Cannot coerce algebraic number with non-zero imaginary part to algebraic real - sage: QQbar(sqrt(17))._integer_() + sage: QQbar(sqrt(17))._integer_() # needs sage.symbolic Traceback (most recent call last): ... ValueError: Cannot coerce non-integral Algebraic Real 4.123105625617660? to Integer - sage: QQbar(sqrt(16))._integer_() + sage: QQbar(sqrt(16))._integer_() # needs sage.symbolic 4 - sage: v = QQbar(1 + I*sqrt(3))^5 + QQbar(16*sqrt(3)*I); v + sage: v = QQbar(1 + I*sqrt(3))^5 + QQbar(16*sqrt(3)*I); v # needs sage.symbolic 16.00000000000000? + 0.?e-17*I - sage: v._integer_() + sage: v._integer_() # needs sage.symbolic 16 """ return AA(self)._integer_(ZZ) @@ -5108,15 +5159,15 @@ def _rational_(self): Traceback (most recent call last): ... ValueError: Cannot coerce algebraic number with non-zero imaginary part to algebraic real - sage: QQbar(sqrt(2))._rational_() + sage: QQbar(sqrt(2))._rational_() # needs sage.symbolic Traceback (most recent call last): ... ValueError: Cannot coerce irrational Algebraic Real 1.414213562373095? to Rational - sage: v1 = QQbar(1/3 + I*sqrt(5))^7 - sage: v2 = QQbar((100336/729*golden_ratio - 50168/729)*I) - sage: v = v1 + v2; v + sage: v1 = QQbar(1/3 + I*sqrt(5))^7 # needs sage.symbolic + sage: v2 = QQbar((100336/729*golden_ratio - 50168/729)*I) # needs sage.symbolic + sage: v = v1 + v2; v # needs sage.symbolic -259.6909007773206? + 0.?e-15*I - sage: v._rational_() + sage: v._rational_() # needs sage.symbolic -567944/2187 """ return AA(self)._rational_() @@ -5191,10 +5242,10 @@ def interval_exact(self, field): 0.7071067811865475? + 0.7071067811865475?*I sage: a.interval_exact(CIF) 0.7071067811865475? + 0.7071067811865475?*I - sage: b = QQbar((1+I)*sqrt(2)/2) # optional - sage.symbolic - sage: (a - b).interval(CIF) # optional - sage.symbolic + sage: b = QQbar((1+I)*sqrt(2)/2) # needs sage.symbolic + sage: (a - b).interval(CIF) # needs sage.symbolic 0.?e-19 + 0.?e-18*I - sage: (a - b).interval_exact(CIF) # optional - sage.symbolic + sage: (a - b).interval_exact(CIF) # needs sage.symbolic 0 """ if not isinstance(field, sage.rings.abc.ComplexIntervalField): @@ -5274,7 +5325,7 @@ def multiplicative_order(self): EXAMPLES:: - sage: QQbar(-sqrt(3)/2 - I/2).multiplicative_order() # optional - sage.symbolic + sage: QQbar(-sqrt(3)/2 - I/2).multiplicative_order() # needs sage.symbolic 12 sage: QQbar(1).multiplicative_order() 1 @@ -5300,11 +5351,11 @@ def rational_argument(self): EXAMPLES:: - sage: QQbar((1+I)*(sqrt(2)+sqrt(5))).rational_argument() # optional - sage.symbolic + sage: QQbar((1+I)*(sqrt(2)+sqrt(5))).rational_argument() # needs sage.symbolic 1/8 - sage: QQbar(-1 + I*sqrt(3)).rational_argument() # optional - sage.symbolic + sage: QQbar(-1 + I*sqrt(3)).rational_argument() # needs sage.symbolic 1/3 - sage: QQbar(-1 - I*sqrt(3)).rational_argument() # optional - sage.symbolic + sage: QQbar(-1 - I*sqrt(3)).rational_argument() # needs sage.symbolic -1/3 sage: QQbar(3+4*I).rational_argument() is None True @@ -5334,9 +5385,9 @@ def _pow_(self, other): EXAMPLES:: - sage: QQbar(1) ^ QQbar(sqrt(2)) # optional - sage.symbolic + sage: QQbar(1) ^ QQbar(sqrt(2)) # needs sage.symbolic 1 - sage: 1 ^ QQbar(sqrt(2)) # optional - sage.symbolic + sage: 1 ^ QQbar(sqrt(2)) # needs sage.symbolic 1 sage: QQbar(2) ^ QQbar(2) Traceback (most recent call last): @@ -5371,8 +5422,9 @@ def __init__(self, x): sometimes a very small (e.g., 1e-17) complex part appears in a complex interval used to create an AlgebraicReal.:: - sage: a = QQbar((-1)^(1/4)); b = AA(a^3-a); t = b.as_number_field_element() - sage: b*1 + sage: a = QQbar((-1)^(1/4)); b = AA(a^3-a) # needs sage.symbolic + sage: t = b.as_number_field_element() # needs sage.symbolic + sage: b*1 # needs sage.symbolic -1.414213562373095? """ AlgebraicNumber_base.__init__(self, AA, x) @@ -5386,6 +5438,7 @@ def _ensure_real(self): EXAMPLES:: + sage: # needs sage.symbolic sage: a = QQbar((-1)^(1/4)); b = AA(a^3-a); b._value -1.4142135623730950488? sage: b._value = a._value; b._value @@ -5406,8 +5459,8 @@ def _more_precision(self): EXAMPLES:: - sage: a = QQbar(sqrt(2)) # optional - sage.symbolic - sage: a._more_precision() # optional - sage.symbolic + sage: a = QQbar(sqrt(2)) # needs sage.symbolic + sage: a._more_precision() # needs sage.symbolic TESTS: @@ -5432,8 +5485,8 @@ def __reduce__(self): EXAMPLES:: - sage: t = AA(sqrt(2)) # optional - sage.symbolic - sage: loads(dumps(t)) == t # optional - sage.symbolic + sage: t = AA(sqrt(2)) # needs sage.symbolic + sage: loads(dumps(t)) == t # needs sage.symbolic True """ return (AlgebraicReal, (self._descr, )) @@ -5453,32 +5506,33 @@ def _richcmp_(self, other, op): TESTS:: - sage: AA(golden_ratio) < AA(sqrt(5)) # optional - sage.symbolic + sage: AA(golden_ratio) < AA(sqrt(5)) # needs sage.symbolic True - sage: AA(golden_ratio) == AA((sqrt(5)+1)/2) # optional - sage.symbolic + sage: AA(golden_ratio) == AA((sqrt(5)+1)/2) # needs sage.symbolic True sage: AA(7) >= AA(50/7) False Check for trivial equality with identical elements:: - sage: x1 = AA(2^(1/50)) # optional - sage.symbolic - sage: x2 = AA(2^(1/50)) # optional - sage.symbolic - sage: y = x1 - x2 # optional - sage.symbolic - sage: y == y # optional - sage.symbolic + sage: # needs sage.symbolic + sage: x1 = AA(2^(1/50)) + sage: x2 = AA(2^(1/50)) + sage: y = x1 - x2 + sage: y == y True - sage: y >= y # optional - sage.symbolic + sage: y >= y True - sage: y < y # optional - sage.symbolic + sage: y < y False - sage: z = x1 - x2 # optional - sage.symbolic - sage: z == 0 # optional - sage.symbolic + sage: z = x1 - x2 # needs sage.symbolic + sage: z == 0 # needs sage.symbolic True - sage: a = x1 - x2 # optional - sage.symbolic - sage: b = x1 - x2 # optional - sage.symbolic - sage: a == b # optional - sage.symbolic + sage: a = x1 - x2 # needs sage.symbolic + sage: b = x1 - x2 # needs sage.symbolic + sage: a == b # needs sage.symbolic True """ if self is other: @@ -5552,11 +5606,11 @@ def _integer_(self, Z=None): 42 sage: AA(42)._integer_().parent() Integer Ring - sage: AA(golden_ratio)._integer_() + sage: AA(golden_ratio)._integer_() # needs sage.symbolic Traceback (most recent call last): ... ValueError: Cannot coerce non-integral Algebraic Real 1.618033988749895? to Integer - sage: (AA(golden_ratio)^10 + AA(1-golden_ratio)^10)._integer_() + sage: (AA(golden_ratio)^10 + AA(1-golden_ratio)^10)._integer_() # needs sage.symbolic 123 sage: AA(-22/7)._integer_() Traceback (most recent call last): @@ -5614,9 +5668,9 @@ def floor(self): EXAMPLES:: - sage: AA(sqrt(2)).floor() # optional - sage.symbolic + sage: AA(sqrt(2)).floor() # needs sage.symbolic 1 - sage: AA(-sqrt(2)).floor() # optional - sage.symbolic + sage: AA(-sqrt(2)).floor() # needs sage.symbolic -2 sage: AA(42).floor() 42 @@ -5625,8 +5679,8 @@ def floor(self): Check that :trac:`15501` is fixed:: - sage: a = QQbar((-1)^(1/4)).real() # optional - sage.symbolic - sage: (floor(a-a) + a).parent() # optional - sage.symbolic + sage: a = QQbar((-1)^(1/4)).real() # needs sage.symbolic + sage: (floor(a-a) + a).parent() # needs sage.symbolic Algebraic Real Field """ return self._floor_ceil(lambda x: x.floor()) @@ -5637,9 +5691,9 @@ def ceil(self): EXAMPLES:: - sage: AA(sqrt(2)).ceil() # optional - sage.symbolic + sage: AA(sqrt(2)).ceil() # needs sage.symbolic 2 - sage: AA(-sqrt(2)).ceil() # optional - sage.symbolic + sage: AA(-sqrt(2)).ceil() # needs sage.symbolic -1 sage: AA(42).ceil() 42 @@ -5652,7 +5706,7 @@ def round(self): EXAMPLES:: - sage: AA(sqrt(2)).round() # optional - sage.symbolic + sage: AA(sqrt(2)).round() # needs sage.symbolic 1 sage: AA(1/2).round() 1 @@ -5667,9 +5721,9 @@ def trunc(self): EXAMPLES:: - sage: AA(sqrt(2)).trunc() # optional - sage.symbolic + sage: AA(sqrt(2)).trunc() # needs sage.symbolic 1 - sage: AA(-sqrt(2)).trunc() # optional - sage.symbolic + sage: AA(-sqrt(2)).trunc() # needs sage.symbolic -1 sage: AA(1).trunc() 1 @@ -5688,13 +5742,13 @@ def _rational_(self): Rational Field sage: AA(-22/7)._rational_() -22/7 - sage: AA(sqrt(7))._rational_() # optional - sage.symbolic + sage: AA(sqrt(7))._rational_() # needs sage.symbolic Traceback (most recent call last): ... ValueError: Cannot coerce irrational Algebraic Real 2.645751311064591? to Rational - sage: v = AA(1/2 + sqrt(2))^3 - AA(11/4*sqrt(2)); v # optional - sage.symbolic + sage: v = AA(1/2 + sqrt(2))^3 - AA(11/4*sqrt(2)); v # needs sage.symbolic 3.125000000000000? - sage: v._rational_() + sage: v._rational_() # needs sage.symbolic 25/8 """ self.exactify() @@ -5711,10 +5765,10 @@ def real(self): EXAMPLES:: - sage: a = AA(sqrt(2) + sqrt(3)) # optional - sage.symbolic - sage: a.real() # optional - sage.symbolic + sage: a = AA(sqrt(2) + sqrt(3)) # needs sage.symbolic + sage: a.real() # needs sage.symbolic 3.146264369941973? - sage: a.real() is a # optional - sage.symbolic + sage: a.real() is a # needs sage.symbolic True """ return self @@ -5727,10 +5781,10 @@ def imag(self): EXAMPLES:: - sage: a = AA(sqrt(2) + sqrt(3)) # optional - sage.symbolic - sage: a.imag() # optional - sage.symbolic + sage: a = AA(sqrt(2) + sqrt(3)) # needs sage.symbolic + sage: a.imag() # needs sage.symbolic 0 - sage: parent(a.imag()) # optional - sage.symbolic + sage: parent(a.imag()) # needs sage.symbolic Algebraic Real Field """ return AA_0 @@ -5741,10 +5795,10 @@ def conjugate(self): EXAMPLES:: - sage: a = AA(sqrt(2) + sqrt(3)) # optional - sage.symbolic - sage: a.conjugate() # optional - sage.symbolic + sage: a = AA(sqrt(2) + sqrt(3)) # needs sage.symbolic + sage: a.conjugate() # needs sage.symbolic 3.146264369941973? - sage: a.conjugate() is a # optional - sage.symbolic + sage: a.conjugate() is a # needs sage.symbolic True """ return self @@ -5817,9 +5871,9 @@ def sign(self): sage: (a*b - b*a).sign() 0 - sage: a = AA(sqrt(1/2)) # optional - sage.symbolic - sage: b = AA(-sqrt(1/2)) # optional - sage.symbolic - sage: (a + b).sign() # optional - sage.symbolic + sage: a = AA(sqrt(1/2)) # needs sage.symbolic + sage: b = AA(-sqrt(1/2)) # needs sage.symbolic + sage: (a + b).sign() # needs sage.symbolic 0 TESTS: @@ -5828,17 +5882,18 @@ def sign(self): following example will take a long time (more than 5 seconds) when calling ``y.exactify()``:: - sage: x1 = AA(2^(1/50)) # optional - sage.symbolic - sage: x2 = AA(2^(1/50)) # optional - sage.symbolic - sage: y = x1 - x2 # optional - sage.symbolic - sage: y.sign() # optional - sage.symbolic + sage: # needs sage.symbolic + sage: x1 = AA(2^(1/50)) + sage: x2 = AA(2^(1/50)) + sage: y = x1 - x2 + sage: y.sign() 0 Simplify to rationals for binary operations when computing the sign:: - sage: a = AA(2^(1/60)) # optional - sage.symbolic - sage: b = a - (a + 1) # optional - sage.symbolic - sage: (b + 1).sign() # optional - sage.symbolic + sage: a = AA(2^(1/60)) # needs sage.symbolic + sage: b = a - (a + 1) # needs sage.symbolic + sage: (b + 1).sign() # needs sage.symbolic 0 """ if not self._value.contains_zero(): @@ -5934,8 +5989,8 @@ def _interval_fast(self, prec): EXAMPLES:: - sage: t = AA(sqrt(7)) # optional - sage.symbolic - sage: t._interval_fast(100) # optional - sage.symbolic + sage: t = AA(sqrt(7)) # needs sage.symbolic + sage: t._interval_fast(100) # needs sage.symbolic 2.64575131106459059050161575364? """ return self.interval_fast(RealIntervalField(prec)) @@ -6071,9 +6126,9 @@ def __float__(self): EXAMPLES:: - sage: AA(golden_ratio).__float__() + sage: AA(golden_ratio).__float__() # needs sage.symbolic 1.618033988749895 - sage: float(AA(sqrt(11))) + sage: float(AA(sqrt(11))) # needs sage.symbolic 3.3166247903554 """ return float(RR(self)) @@ -6090,9 +6145,9 @@ def _complex_mpfr_field_(self, field): EXAMPLES:: - sage: AA(golden_ratio)._complex_mpfr_field_(ComplexIntervalField(100)) + sage: AA(golden_ratio)._complex_mpfr_field_(ComplexIntervalField(100)) # needs sage.symbolic 1.618033988749894848204586834365? - sage: AA(golden_ratio)._complex_mpfr_field_(ComplexField(100)) + sage: AA(golden_ratio)._complex_mpfr_field_(ComplexField(100)) # needs sage.symbolic 1.6180339887498948482045868344 """ if isinstance(field, sage.rings.abc.ComplexIntervalField): @@ -6660,9 +6715,9 @@ def is_AlgebraicReal(x): EXAMPLES:: sage: from sage.rings.qqbar import is_AlgebraicReal - sage: is_AlgebraicReal(AA(sqrt(2))) + sage: is_AlgebraicReal(AA(sqrt(2))) # needs sage.symbolic True - sage: is_AlgebraicReal(QQbar(sqrt(2))) + sage: is_AlgebraicReal(QQbar(sqrt(2))) # needs sage.symbolic False sage: is_AlgebraicReal("spam") False @@ -6677,9 +6732,9 @@ def is_AlgebraicNumber(x): EXAMPLES:: sage: from sage.rings.qqbar import is_AlgebraicNumber - sage: is_AlgebraicNumber(AA(sqrt(2))) + sage: is_AlgebraicNumber(AA(sqrt(2))) # needs sage.symbolic False - sage: is_AlgebraicNumber(QQbar(sqrt(2))) + sage: is_AlgebraicNumber(QQbar(sqrt(2))) # needs sage.symbolic True sage: is_AlgebraicNumber("spam") False @@ -7085,13 +7140,14 @@ def conjugate(self, n): EXAMPLES:: - sage: a = (x^2 + 23).roots(ring=QQbar, multiplicities=False)[0] # optional - sage.symbolic - sage: b = a._descr # optional - sage.symbolic - sage: type(b) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: a = (x^2 + 23).roots(ring=QQbar, multiplicities=False)[0] + sage: b = a._descr + sage: type(b) - sage: c = b.conjugate(a); c # optional - sage.symbolic + sage: c = b.conjugate(a); c - sage: c.exactify() # optional - sage.symbolic + sage: c.exactify() -2*a + 1 where a^2 - a + 6 = 0 and a in 0.50000000000000000? - 2.397915761656360?*I """ if not self._complex: @@ -7486,10 +7542,10 @@ def exactify(self): Verify that :trac:`12727` is fixed:: - sage: m = sqrt(sin(pi/5)); a = QQbar(m); b = AA(m) # optional - sage.symbolic - sage: a.minpoly() # optional - sage.symbolic + sage: m = sqrt(sin(pi/5)); a = QQbar(m); b = AA(m) # needs sage.symbolic + sage: a.minpoly() # needs sage.symbolic x^8 - 5/4*x^4 + 5/16 - sage: b.minpoly() # optional - sage.symbolic + sage: b.minpoly() # needs sage.symbolic x^8 - 5/4*x^4 + 5/16 """ gen = self._poly.generator() @@ -7751,16 +7807,17 @@ def is_complex(self): EXAMPLES:: - sage: rt2 = QQbar(sqrt(2)) # optional - sage.symbolic - sage: rtm3 = QQbar(sqrt(-3)) # optional - sage.symbolic - sage: x = rtm3 + rt2 - rtm3 # optional - sage.symbolic - sage: x.exactify() # optional - sage.symbolic - sage: y = x._descr # optional - sage.symbolic - sage: type(y) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: rt2 = QQbar(sqrt(2)) + sage: rtm3 = QQbar(sqrt(-3)) + sage: x = rtm3 + rt2 - rtm3 + sage: x.exactify() + sage: y = x._descr + sage: type(y) - sage: y.is_complex() # optional - sage.symbolic + sage: y.is_complex() True - sage: x.imag() == 0 # optional - sage.symbolic + sage: x.imag() == 0 True """ return not self._exactly_real @@ -7776,19 +7833,20 @@ def is_simple(self): EXAMPLES:: - sage: rt2 = AA(sqrt(2)) # optional - sage.symbolic - sage: rt3 = AA(sqrt(3)) # optional - sage.symbolic - sage: rt2b = rt3 + rt2 - rt3 # optional - sage.symbolic - sage: rt2.exactify() # optional - sage.symbolic - sage: rt2._descr # optional - sage.symbolic + sage: # needs sage.symbolic + sage: rt2 = AA(sqrt(2)) + sage: rt3 = AA(sqrt(3)) + sage: rt2b = rt3 + rt2 - rt3 + sage: rt2.exactify() + sage: rt2._descr a where a^2 - 2 = 0 and a in 1.414213562373095? - sage: rt2._descr.is_simple() # optional - sage.symbolic + sage: rt2._descr.is_simple() True - sage: rt2b.exactify() # optional - sage.symbolic - sage: rt2b._descr # optional - sage.symbolic + sage: rt2b.exactify() # needs sage.symbolic + sage: rt2b._descr # needs sage.symbolic a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in -0.5176380902050415? - sage: rt2b._descr.is_simple() # optional - sage.symbolic + sage: rt2b._descr.is_simple() # needs sage.symbolic False """ try: @@ -7871,13 +7929,14 @@ def simplify(self, n): EXAMPLES:: - sage: rt2 = AA(sqrt(2)) # optional - sage.symbolic - sage: rt3 = AA(sqrt(3)) # optional - sage.symbolic - sage: rt2b = rt3 + rt2 - rt3 # optional - sage.symbolic - sage: rt2b.exactify() # optional - sage.symbolic - sage: rt2b._descr # optional - sage.symbolic + sage: # needs sage.symbolic + sage: rt2 = AA(sqrt(2)) + sage: rt3 = AA(sqrt(3)) + sage: rt2b = rt3 + rt2 - rt3 + sage: rt2b.exactify() + sage: rt2b._descr a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in -0.5176380902050415? - sage: rt2b._descr.simplify(rt2b) # optional - sage.symbolic + sage: rt2b._descr.simplify(rt2b) a where a^2 - 2 = 0 and a in 1.414213562373095? """ @@ -7909,21 +7968,22 @@ def neg(self, n): EXAMPLES:: - sage: a = QQbar(sqrt(-2)) + QQbar(sqrt(-3)) # optional - sage.symbolic - sage: a.exactify() # optional - sage.symbolic - sage: b = a._descr # optional - sage.symbolic - sage: type(b) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: a = QQbar(sqrt(-2)) + QQbar(sqrt(-3)) + sage: a.exactify() + sage: b = a._descr + sage: type(b) - sage: c = b.neg(None); c # random (not uniquely represented) # optional - sage.symbolic + sage: c = b.neg(None); c # random (not uniquely represented) -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I - sage: (c.generator() == b.generator() # optional - sage.symbolic + sage: (c.generator() == b.generator() ....: and c.field_element_value() + b.field_element_value() == 0) True The parameter is ignored:: - sage: (b.neg("random").generator() == c.generator() # optional - sage.symbolic + sage: (b.neg("random").generator() == c.generator() # needs sage.symbolic ....: and b.neg("random").field_element_value() == c.field_element_value()) True """ @@ -7935,21 +7995,22 @@ def invert(self, n): EXAMPLES:: - sage: a = QQbar(sqrt(-2)) + QQbar(sqrt(-3)) # optional - sage.symbolic - sage: a.exactify() # optional - sage.symbolic - sage: b = a._descr # optional - sage.symbolic - sage: type(b) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: a = QQbar(sqrt(-2)) + QQbar(sqrt(-3)) + sage: a.exactify() + sage: b = a._descr + sage: type(b) - sage: c = b.invert(None); c # random (not uniquely represented) # optional - sage.symbolic + sage: c = b.invert(None); c # random (not uniquely represented) -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I - sage: (c.generator() == b.generator() # optional - sage.symbolic + sage: (c.generator() == b.generator() ....: and c.field_element_value() * b.field_element_value() == 1) True The parameter is ignored:: - sage: (b.invert("random").generator() == c.generator() # optional - sage.symbolic + sage: (b.invert("random").generator() == c.generator() # needs sage.symbolic ....: and b.invert("random").field_element_value() == c.field_element_value()) True """ @@ -7961,12 +8022,13 @@ def conjugate(self, n): EXAMPLES:: - sage: a = QQbar(sqrt(-2)) + QQbar(sqrt(-3)) # optional - sage.symbolic - sage: a.exactify() # optional - sage.symbolic - sage: b = a._descr # optional - sage.symbolic - sage: type(b) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: a = QQbar(sqrt(-2)) + QQbar(sqrt(-3)) + sage: a.exactify() + sage: b = a._descr + sage: type(b) - sage: c = b.conjugate(None); c # random (not uniquely represented) # optional - sage.symbolic + sage: c = b.conjugate(None); c # random (not uniquely represented) 1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I @@ -7974,14 +8036,14 @@ def conjugate(self, n): same abstract field element but conjugating the complex embedding of the field:: - sage: c.generator() == b.generator().conjugate() # optional - sage.symbolic + sage: c.generator() == b.generator().conjugate() # needs sage.symbolic True - sage: c.field_element_value() == b.field_element_value() # optional - sage.symbolic + sage: c.field_element_value() == b.field_element_value() # needs sage.symbolic True The parameter is ignored:: - sage: (b.conjugate("random").generator() == c.generator() # optional - sage.symbolic + sage: (b.conjugate("random").generator() == c.generator() # needs sage.symbolic ....: and b.conjugate("random").field_element_value() == c.field_element_value()) True @@ -8000,12 +8062,13 @@ def norm(self, n): EXAMPLES:: - sage: a = QQbar(sqrt(-2)) + QQbar(sqrt(-3)) # optional - sage.symbolic - sage: a.exactify() # optional - sage.symbolic - sage: b = a._descr # optional - sage.symbolic - sage: type(b) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: a = QQbar(sqrt(-2)) + QQbar(sqrt(-3)) + sage: a.exactify() + sage: b = a._descr + sage: type(b) - sage: b.norm(a) # optional - sage.symbolic + sage: b.norm(a) """ if self._exactly_real: @@ -8021,12 +8084,13 @@ def abs(self, n): EXAMPLES:: - sage: a = QQbar(sqrt(-2)) + QQbar(sqrt(-3)) # optional - sage.symbolic - sage: a.exactify() # optional - sage.symbolic - sage: b = a._descr # optional - sage.symbolic - sage: type(b) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: a = QQbar(sqrt(-2)) + QQbar(sqrt(-3)) + sage: a.exactify() + sage: b = a._descr + sage: type(b) - sage: b.abs(a) # optional - sage.symbolic + sage: b.abs(a) Root 3.146264369941972342? of x^2 - 9.89897948556636? """ return AlgebraicReal(self.norm(n)).sqrt()._descr @@ -8038,12 +8102,12 @@ def rational_argument(self, n): EXAMPLES:: - sage: a = QQbar(sqrt(-2)) + QQbar(sqrt(3)) # optional - sage.symbolic - sage: a.exactify() # optional - sage.symbolic - sage: b = a._descr # optional - sage.symbolic - sage: type(b) # optional - sage.symbolic + sage: a = QQbar(sqrt(-2)) + QQbar(sqrt(3)) # needs sage.symbolic + sage: a.exactify() # needs sage.symbolic + sage: b = a._descr # needs sage.symbolic + sage: type(b) # needs sage.symbolic - sage: b.rational_argument(a) is None # optional - sage.symbolic + sage: b.rational_argument(a) is None # needs sage.symbolic True sage: x = polygen(QQ) sage: a = (x^4 + 1).roots(QQbar, multiplicities=False)[0] @@ -8094,7 +8158,7 @@ def __init__(self, arg, op): EXAMPLES:: - sage: t = ~QQbar(sqrt(2)); type(t._descr) # indirect doctest # optional - sage.symbolic + sage: t = ~QQbar(sqrt(2)); type(t._descr) # indirect doctest # needs sage.symbolic """ self._arg = arg @@ -8107,9 +8171,9 @@ def __reduce__(self): EXAMPLES:: - sage: t = ~QQbar(sqrt(2)); type(t._descr) # optional - sage.symbolic + sage: t = ~QQbar(sqrt(2)); type(t._descr) # needs sage.symbolic - sage: loads(dumps(t)) == 1/QQbar(sqrt(2)) # optional - sage.symbolic + sage: loads(dumps(t)) == 1/QQbar(sqrt(2)) # needs sage.symbolic True """ return (ANUnaryExpr, (self._arg, self._op)) @@ -8208,13 +8272,14 @@ def is_complex(self): EXAMPLES:: - sage: t = AA(sqrt(2)) # optional - sage.symbolic - sage: s = (-t)._descr # optional - sage.symbolic - sage: s # optional - sage.symbolic + sage: # needs sage.symbolic + sage: t = AA(sqrt(2)) + sage: s = (-t)._descr + sage: s - sage: s.is_complex() # optional - sage.symbolic + sage: s.is_complex() False - sage: QQbar(-sqrt(2))._descr.is_complex() # optional - sage.symbolic + sage: QQbar(-sqrt(2))._descr.is_complex() True """ return self._complex @@ -8225,11 +8290,12 @@ def _interval_fast(self, prec): EXAMPLES:: - sage: t = AA(sqrt(2)) # optional - sage.symbolic - sage: s = (-t)._descr # optional - sage.symbolic - sage: s # optional - sage.symbolic + sage: # needs sage.symbolic + sage: t = AA(sqrt(2)) + sage: s = (-t)._descr + sage: s - sage: s._interval_fast(150) # optional - sage.symbolic + sage: s._interval_fast(150) -1.414213562373095048801688724209698078569671876? """ op = self._op @@ -8282,10 +8348,10 @@ def exactify(self): EXAMPLES:: - sage: v = (-QQbar(sqrt(2)))._descr # optional - sage.symbolic - sage: type(v) # optional - sage.symbolic + sage: v = (-QQbar(sqrt(2)))._descr # needs sage.symbolic + sage: type(v) # needs sage.symbolic - sage: v.exactify() # optional - sage.symbolic + sage: v.exactify() # needs sage.symbolic -a where a^2 - 2 = 0 and a in 1.414213562373095? """ op = self._op @@ -8349,7 +8415,7 @@ def __init__(self, left, right, op): EXAMPLES:: - sage: t = QQbar(sqrt(2)) + QQbar(sqrt(3)); type(t._descr) # indirect doctest # optional - sage.symbolic + sage: t = QQbar(sqrt(2)) + QQbar(sqrt(3)); type(t._descr) # indirect doctest # needs sage.symbolic """ self._left = left @@ -8363,9 +8429,9 @@ def __reduce__(self): EXAMPLES:: - sage: t = QQbar(sqrt(2)) + QQbar(sqrt(3)); type(t._descr) # optional - sage.symbolic + sage: t = QQbar(sqrt(2)) + QQbar(sqrt(3)); type(t._descr) # needs sage.symbolic - sage: loads(dumps(t)) == QQbar(sqrt(2)) + QQbar(sqrt(3)) # optional - sage.symbolic + sage: loads(dumps(t)) == QQbar(sqrt(2)) + QQbar(sqrt(3)) # needs sage.symbolic True """ return (ANBinaryExpr, (self._left, self._right, self._op)) @@ -8413,10 +8479,10 @@ def handle_sage_input(self, sib, coerce, is_qqbar): True sage: sage_input(n) 1 + AA(3) - sage: rt3 = QQbar(sqrt(3)) # optional - sage.symbolic - sage: one = rt3/rt3 # optional - sage.symbolic + sage: rt3 = QQbar(sqrt(3)) # needs sage.symbolic + sage: one = rt3/rt3 # needs sage.symbolic sage: n = sqrt(AA(2)) + one - sage: one == 1 # optional - sage.symbolic + sage: one == 1 # needs sage.symbolic True sage: sage_input(n) R. = AA[] @@ -8487,8 +8553,8 @@ def is_complex(self): EXAMPLES:: - sage: x = (QQbar(sqrt(-2)) / QQbar(sqrt(-5)))._descr # optional - sage.symbolic - sage: x.is_complex() # optional - sage.symbolic + sage: x = (QQbar(sqrt(-2)) / QQbar(sqrt(-5)))._descr # needs sage.symbolic + sage: x.is_complex() # needs sage.symbolic True """ return self._complex @@ -8499,10 +8565,10 @@ def _interval_fast(self, prec): EXAMPLES:: - sage: x = (QQbar(sqrt(-2)) / QQbar(sqrt(-5)))._descr # optional - sage.symbolic - sage: y= x._interval_fast(64); y # optional - sage.symbolic + sage: x = (QQbar(sqrt(-2)) / QQbar(sqrt(-5)))._descr # needs sage.symbolic + sage: y= x._interval_fast(64); y # needs sage.symbolic 0.632455532033675867? - sage: y.parent() # optional - sage.symbolic + sage: y.parent() # needs sage.symbolic Complex Interval Field with 64 bits of precision """ op = self._op @@ -8519,8 +8585,8 @@ def exactify(self): """ TESTS:: - sage: rt2c = QQbar.zeta(3) + AA(sqrt(2)) - QQbar.zeta(3) # optional - sage.symbolic - sage: rt2c.exactify() # optional - sage.symbolic + sage: rt2c = QQbar.zeta(3) + AA(sqrt(2)) - QQbar.zeta(3) # needs sage.symbolic + sage: rt2c.exactify() # needs sage.symbolic We check to make sure that this method still works even. We do this by increasing the recursion level at each step and @@ -8605,25 +8671,27 @@ def an_binop_expr(a, b, op): EXAMPLES:: - sage: a = QQbar(sqrt(2)) + QQbar(sqrt(3)) # optional - sage.symbolic - sage: b = QQbar(sqrt(3)) + QQbar(sqrt(5)) # optional - sage.symbolic - sage: type(a._descr); type(b._descr) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: a = QQbar(sqrt(2)) + QQbar(sqrt(3)) + sage: b = QQbar(sqrt(3)) + QQbar(sqrt(5)) + sage: type(a._descr); type(b._descr) sage: from sage.rings.qqbar import an_binop_expr - sage: x = an_binop_expr(a, b, operator.add); x # optional - sage.symbolic + sage: x = an_binop_expr(a, b, operator.add); x - sage: x.exactify() # optional - sage.symbolic + sage: x.exactify() 6/7*a^7 - 2/7*a^6 - 71/7*a^5 + 26/7*a^4 + 125/7*a^3 - 72/7*a^2 - 43/7*a + 47/7 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in -0.3199179336182997? - sage: a = QQbar(sqrt(2)) + QQbar(sqrt(3)) # optional - sage.symbolic - sage: b = QQbar(sqrt(3)) + QQbar(sqrt(5)) # optional - sage.symbolic - sage: type(a._descr) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: a = QQbar(sqrt(2)) + QQbar(sqrt(3)) + sage: b = QQbar(sqrt(3)) + QQbar(sqrt(5)) + sage: type(a._descr) - sage: x = an_binop_expr(a, b, operator.mul); x # optional - sage.symbolic + sage: x = an_binop_expr(a, b, operator.mul); x - sage: x.exactify() # optional - sage.symbolic + sage: x.exactify() 2*a^7 - a^6 - 24*a^5 + 12*a^4 + 46*a^3 - 22*a^2 - 22*a + 9 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in -0.3199179336182997? """ @@ -8757,7 +8825,7 @@ def get_AA_golden_ratio(): EXAMPLES:: - sage: AA(golden_ratio) # indirect doctest # optional - sage.symbolic + sage: AA(golden_ratio) # indirect doctest # needs sage.symbolic 1.618033988749895? """ global AA_golden_ratio diff --git a/src/sage/rings/quotient_ring.py b/src/sage/rings/quotient_ring.py index f90dcc6c9aa..b00b253b40f 100644 --- a/src/sage/rings/quotient_ring.py +++ b/src/sage/rings/quotient_ring.py @@ -38,8 +38,8 @@ ....: def reduce(self,x): ....: R = self.ring() ....: return add([c*R(m) for m,c in x if len(m) = FreeAlgebra(QQ, 3) # optional - sage.combinat sage.modules - sage: I3 = PowerIdeal(F,3); I3 # optional - sage.combinat sage.modules + sage: F. = FreeAlgebra(QQ, 3) # needs sage.combinat sage.modules + sage: I3 = PowerIdeal(F,3); I3 # needs sage.combinat sage.modules Twosided Ideal (x^3, x^2*y, x^2*z, x*y*x, x*y^2, x*y*z, x*z*x, x*z*y, x*z^2, y*x^2, y*x*y, y*x*z, y^2*x, y^3, y^2*z, y*z*x, y*z*y, y*z^2, z*x^2, z*x*y, z*x*z, z*y*x, z*y^2, z*y*z, z^2*x, z^2*y, z^3) of @@ -49,33 +49,35 @@ finite dimensional quotients defined by multiplication matrices. We are bypassing it, so that we obtain the default quotient:: - sage: Q3. = F.quotient(I3) # optional - sage.combinat sage.modules - sage: Q3 # optional - sage.combinat sage.modules + sage: # needs sage.combinat sage.modules + sage: Q3. = F.quotient(I3) + sage: Q3 Quotient of Free Algebra on 3 generators (x, y, z) over Rational Field by the ideal (x^3, x^2*y, x^2*z, x*y*x, x*y^2, x*y*z, x*z*x, x*z*y, x*z^2, y*x^2, y*x*y, y*x*z, y^2*x, y^3, y^2*z, y*z*x, y*z*y, y*z^2, z*x^2, z*x*y, z*x*z, z*y*x, z*y^2, z*y*z, z^2*x, z^2*y, z^3) - sage: (a+b+2)^4 # optional - sage.combinat sage.modules + sage: (a+b+2)^4 16 + 32*a + 32*b + 24*a^2 + 24*a*b + 24*b*a + 24*b^2 - sage: Q3.is_commutative() # optional - sage.combinat sage.modules + sage: Q3.is_commutative() False Even though `Q_3` is not commutative, there is commutativity for products of degree three:: - sage: a*(b*c)-(b*c)*a==F.zero() # optional - sage.combinat sage.modules + sage: a*(b*c)-(b*c)*a==F.zero() # needs sage.combinat sage.modules True If we quotient out all terms of degree two then of course the resulting quotient ring is commutative:: - sage: I2 = PowerIdeal(F,2); I2 # optional - sage.combinat sage.modules + sage: # needs sage.combinat sage.modules + sage: I2 = PowerIdeal(F,2); I2 Twosided Ideal (x^2, x*y, x*z, y*x, y^2, y*z, z*x, z*y, z^2) of Free Algebra on 3 generators (x, y, z) over Rational Field - sage: Q2. = F.quotient(I2) # optional - sage.combinat sage.modules - sage: Q2.is_commutative() # optional - sage.combinat sage.modules + sage: Q2. = F.quotient(I2) + sage: Q2.is_commutative() True - sage: (a+b+2)^4 # optional - sage.combinat sage.modules + sage: (a+b+2)^4 16 + 32*a + 32*b Since :trac:`7797`, there is an implementation of free algebras @@ -83,20 +85,21 @@ letterplace wrapper allows to provide the above toy example more easily:: + sage: # needs sage.combinat sage.libs.singular sage.modules sage: from itertools import product - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.libs.singular sage.modules - sage: Q3 = F.quo(F*[F.prod(m) for m in product(F.gens(), repeat=3)]*F) # optional - sage.combinat sage.libs.singular sage.modules - sage: Q3 # optional - sage.combinat sage.libs.singular sage.modules + sage: F. = FreeAlgebra(QQ, implementation='letterplace') + sage: Q3 = F.quo(F*[F.prod(m) for m in product(F.gens(), repeat=3)]*F) + sage: Q3 Quotient of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field by the ideal (x*x*x, x*x*y, x*x*z, x*y*x, x*y*y, x*y*z, x*z*x, x*z*y, x*z*z, y*x*x, y*x*y, y*x*z, y*y*x, y*y*y, y*y*z, y*z*x, y*z*y, y*z*z, z*x*x, z*x*y, z*x*z, z*y*x, z*y*y, z*y*z, z*z*x, z*z*y, z*z*z) - sage: Q3.0*Q3.1 - Q3.1*Q3.0 # optional - sage.combinat sage.libs.singular sage.modules + sage: Q3.0*Q3.1 - Q3.1*Q3.0 xbar*ybar - ybar*xbar - sage: Q3.0*(Q3.1*Q3.2) - (Q3.1*Q3.2)*Q3.0 # optional - sage.combinat sage.libs.singular sage.modules + sage: Q3.0*(Q3.1*Q3.2) - (Q3.1*Q3.2)*Q3.0 0 - sage: Q2 = F.quo(F*[F.prod(m) for m in product(F.gens(), repeat=2)]*F) # optional - sage.combinat sage.libs.singular sage.modules - sage: Q2.is_commutative() # optional - sage.combinat sage.libs.singular sage.modules + sage: Q2 = F.quo(F*[F.prod(m) for m in product(F.gens(), repeat=2)]*F) + sage: Q2.is_commutative() True """ @@ -180,14 +183,14 @@ def QuotientRing(R, I, names=None, **kwds): ring can be specified as shown below):: sage: P. = QQ[] - sage: R. = QuotientRing(P, P.ideal(x^2 + 1)) # optional - sage.libs.pari - sage: R # optional - sage.libs.pari + sage: R. = QuotientRing(P, P.ideal(x^2 + 1)) # needs sage.libs.pari + sage: R # needs sage.libs.pari Univariate Quotient Polynomial Ring in xx over Rational Field with modulus x^2 + 1 - sage: R.gens(); R.gen() # optional - sage.libs.pari + sage: R.gens(); R.gen() # needs sage.libs.pari (xx,) xx - sage: for n in range(4): xx^n # optional - sage.libs.pari + sage: for n in range(4): xx^n # needs sage.libs.pari 1 xx -1 @@ -196,13 +199,13 @@ def QuotientRing(R, I, names=None, **kwds): :: sage: P. = QQ[] - sage: S = QuotientRing(P, P.ideal(x^2 - 2)) # optional - sage.libs.pari - sage: S # optional - sage.libs.pari + sage: S = QuotientRing(P, P.ideal(x^2 - 2)) # needs sage.libs.pari + sage: S # needs sage.libs.pari Univariate Quotient Polynomial Ring in xbar over Rational Field with modulus x^2 - 2 - sage: xbar = S.gen(); S.gen() # optional - sage.libs.pari + sage: xbar = S.gen(); S.gen() # needs sage.libs.pari xbar - sage: for n in range(3): xbar^n # optional - sage.libs.pari + sage: for n in range(3): xbar^n # needs sage.libs.pari 1 xbar 2 @@ -210,7 +213,7 @@ def QuotientRing(R, I, names=None, **kwds): Sage coerces objects into ideals when possible:: sage: P. = QQ[] - sage: R = QuotientRing(P, x^2 + 1); R # optional - sage.libs.pari + sage: R = QuotientRing(P, x^2 + 1); R # needs sage.libs.pari Univariate Quotient Polynomial Ring in xbar over Rational Field with modulus x^2 + 1 @@ -220,16 +223,16 @@ def QuotientRing(R, I, names=None, **kwds): `\QQ[x,y]`:: sage: R. = PolynomialRing(QQ, 2) - sage: S. = QuotientRing(R, R.ideal(1 + y^2)) # optional - sage.libs.pari - sage: T. = QuotientRing(S, S.ideal(a)) # optional - sage.libs.pari - sage: T # optional - sage.libs.pari + sage: S. = QuotientRing(R, R.ideal(1 + y^2)) # needs sage.libs.pari + sage: T. = QuotientRing(S, S.ideal(a)) # needs sage.libs.pari + sage: T # needs sage.libs.pari Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x, y^2 + 1) - sage: R.gens(); S.gens(); T.gens() # optional - sage.libs.pari + sage: R.gens(); S.gens(); T.gens() # needs sage.libs.pari (x, y) (a, b) (0, d) - sage: for n in range(4): d^n # optional - sage.libs.pari + sage: for n in range(4): d^n # needs sage.libs.pari 1 d -1 @@ -248,23 +251,24 @@ def QuotientRing(R, I, names=None, **kwds): Here is an example of the quotient of a free algebra by a twosided homogeneous ideal (see :trac:`7797`):: - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.libs.singular sage.modules - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.libs.singular sage.modules - sage: Q. = F.quo(I); Q # optional - sage.combinat sage.libs.singular sage.modules + sage: # needs sage.combinat sage.libs.singular sage.modules + sage: F. = FreeAlgebra(QQ, implementation='letterplace') + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F + sage: Q. = F.quo(I); Q Quotient of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field by the ideal (x*y + y*z, x*x + x*y - y*x - y*y) - sage: a*b # optional - sage.combinat sage.libs.singular sage.modules + sage: a*b -b*c - sage: a^3 # optional - sage.combinat sage.libs.singular sage.modules + sage: a^3 -b*c*a - b*c*b - b*c*c - sage: J = Q * [a^3 - b^3] * Q # optional - sage.combinat sage.libs.singular sage.modules - sage: R. = Q.quo(J); R # optional - sage.combinat sage.libs.singular sage.modules + sage: J = Q * [a^3 - b^3] * Q + sage: R. = Q.quo(J); R Quotient of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field by the ideal (-y*y*z - y*z*x - 2*y*z*z, x*y + y*z, x*x + x*y - y*x - y*y) - sage: i^3 # optional - sage.combinat sage.libs.singular sage.modules + sage: i^3 -j*k*i - j*k*j - j*k*k - sage: j^3 # optional - sage.combinat sage.libs.singular sage.modules + sage: j^3 -j*k*i - j*k*j - j*k*k Check that :trac:`5978` is fixed by if we quotient by the zero ideal `(0)` @@ -350,12 +354,13 @@ def is_QuotientRing(x): :: - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.libs.singular sage.modules - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.libs.singular sage.modules - sage: Q = F.quo(I) # optional - sage.combinat sage.libs.singular sage.modules - sage: is_QuotientRing(Q) # optional - sage.combinat sage.libs.singular sage.modules + sage: # needs sage.combinat sage.libs.singular sage.modules + sage: F. = FreeAlgebra(QQ, implementation='letterplace') + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F + sage: Q = F.quo(I) + sage: is_QuotientRing(Q) True - sage: is_QuotientRing(F) # optional - sage.combinat sage.libs.singular sage.modules + sage: is_QuotientRing(F) False """ return isinstance(x, QuotientRing_nc) @@ -378,27 +383,29 @@ class QuotientRing_nc(ring.Ring, sage.structure.parent_gens.ParentWithGens): Here is a quotient of a free algebra by a twosided homogeneous ideal:: - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.libs.singular sage.modules - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2]*F # optional - sage.combinat sage.libs.singular sage.modules - sage: Q. = F.quo(I); Q # optional - sage.combinat sage.libs.singular sage.modules + sage: # needs sage.combinat sage.libs.singular sage.modules + sage: F. = FreeAlgebra(QQ, implementation='letterplace') + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2]*F + sage: Q. = F.quo(I); Q Quotient of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field by the ideal (x*y + y*z, x*x + x*y - y*x - y*y) - sage: a*b # optional - sage.combinat sage.libs.singular sage.modules + sage: a*b -b*c - sage: a^3 # optional - sage.combinat sage.libs.singular sage.modules + sage: a^3 -b*c*a - b*c*b - b*c*c A quotient of a quotient is just the quotient of the original top ring by the sum of two ideals:: - sage: J = Q * [a^3 - b^3] * Q # optional - sage.combinat sage.libs.singular sage.modules - sage: R. = Q.quo(J); R # optional - sage.combinat sage.libs.singular sage.modules + sage: # needs sage.combinat sage.libs.singular sage.modules + sage: J = Q * [a^3 - b^3] * Q + sage: R. = Q.quo(J); R Quotient of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field by the ideal (-y*y*z - y*z*x - 2*y*z*z, x*y + y*z, x*x + x*y - y*x - y*y) - sage: i^3 # optional - sage.combinat sage.libs.singular sage.modules + sage: i^3 -j*k*i - j*k*j - j*k*k - sage: j^3 # optional - sage.combinat sage.libs.singular sage.modules + sage: j^3 -j*k*i - j*k*j - j*k*k For rings that *do* inherit from :class:`~sage.rings.ring.CommutativeRing`, @@ -416,10 +423,10 @@ class QuotientRing_nc(ring.Ring, sage.structure.parent_gens.ParentWithGens): :: sage: R. = PolynomialRing(QQ) - sage: S. = R.quo(x^2 + y^2) # optional - sage.libs.singular - sage: a^2 + b^2 == 0 # optional - sage.libs.singular + sage: S. = R.quo(x^2 + y^2) # needs sage.libs.singular + sage: a^2 + b^2 == 0 # needs sage.libs.singular True - sage: S(0) == a^2 + b^2 # optional - sage.libs.singular + sage: S(0) == a^2 + b^2 # needs sage.libs.singular True Again, a quotient of a quotient is just the quotient of the original top @@ -428,12 +435,12 @@ class QuotientRing_nc(ring.Ring, sage.structure.parent_gens.ParentWithGens): :: sage: R. = PolynomialRing(QQ, 2) - sage: S. = R.quo(1 + y^2) # optional - sage.libs.singular - sage: T. = S.quo(a) # optional - sage.libs.singular - sage: T # optional - sage.libs.singular + sage: S. = R.quo(1 + y^2) # needs sage.libs.singular + sage: T. = S.quo(a) # needs sage.libs.singular + sage: T # needs sage.libs.singular Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x, y^2 + 1) - sage: T.gens() # optional - sage.libs.singular + sage: T.gens() # needs sage.libs.singular (0, d) """ Element = quotient_ring_element.QuotientRingElement @@ -452,15 +459,16 @@ def __init__(self, R, I, names, category=None): EXAMPLES:: - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.libs.singular sage.modules - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.libs.singular sage.modules - sage: Q. = F.quo(I); Q # optional - sage.combinat sage.libs.singular sage.modules + sage: # needs sage.combinat sage.libs.singular sage.modules + sage: F. = FreeAlgebra(QQ, implementation='letterplace') + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F + sage: Q. = F.quo(I); Q Quotient of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field by the ideal (x*y + y*z, x*x + x*y - y*x - y*y) - sage: a*b # optional - sage.combinat sage.libs.singular sage.modules + sage: a*b -b*c - sage: a^3 # optional - sage.combinat sage.libs.singular sage.modules + sage: a^3 -b*c*a - b*c*b - b*c*c """ @@ -507,10 +515,10 @@ def construction(self): sage: I = R.ideal([4 + 3*x + x^2, 1 + x^2]) sage: R.quotient_ring(I).construction() (QuotientFunctor, Univariate Polynomial Ring in x over Integer Ring) - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.libs.singular sage.modules - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.libs.singular sage.modules - sage: Q = F.quo(I) # optional - sage.combinat sage.libs.singular sage.modules - sage: Q.construction() # optional - sage.combinat sage.libs.singular sage.modules + sage: F. = FreeAlgebra(QQ, implementation='letterplace') # needs sage.combinat sage.libs.singular sage.modules + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # needs sage.combinat sage.libs.singular sage.modules + sage: Q = F.quo(I) # needs sage.combinat sage.libs.singular sage.modules + sage: Q.construction() # needs sage.combinat sage.libs.singular sage.modules (QuotientFunctor, Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field) @@ -519,8 +527,8 @@ def construction(self): sage: F, R = Integers(5).construction() sage: F(R) Ring of integers modulo 5 - sage: F, R = GF(5).construction() # optional - sage.rings.finite_rings - sage: F(R) # optional - sage.rings.finite_rings + sage: F, R = GF(5).construction() + sage: F(R) Finite Field of size 5 """ from sage.categories.pushout import QuotientFunctor @@ -592,19 +600,20 @@ def is_commutative(self): The non-commutative case is more interesting:: - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.libs.singular sage.modules - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.libs.singular sage.modules - sage: Q = F.quo(I) # optional - sage.combinat sage.libs.singular sage.modules - sage: Q.is_commutative() # optional - sage.combinat sage.libs.singular sage.modules + sage: # needs sage.combinat sage.libs.singular sage.modules + sage: F. = FreeAlgebra(QQ, implementation='letterplace') + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F + sage: Q = F.quo(I) + sage: Q.is_commutative() False - sage: Q.1*Q.2 == Q.2*Q.1 # optional - sage.combinat sage.libs.singular sage.modules + sage: Q.1*Q.2 == Q.2*Q.1 False In the next example, the generators apparently commute:: - sage: J = F * [x*y - y*x, x*z - z*x, y*z - z*y, x^3 - y^3] * F # optional - sage.combinat sage.libs.singular sage.modules - sage: R = F.quo(J) # optional - sage.combinat sage.libs.singular sage.modules - sage: R.is_commutative() # optional - sage.combinat sage.libs.singular sage.modules + sage: J = F * [x*y - y*x, x*z - z*x, y*z - z*y, x^3 - y^3] * F # needs sage.combinat sage.libs.singular sage.modules + sage: R = F.quo(J) # needs sage.combinat sage.libs.singular sage.modules + sage: R.is_commutative() # needs sage.combinat sage.libs.singular sage.modules True """ @@ -646,19 +655,19 @@ def cover(self): sage: R. = PolynomialRing(QQ) sage: Q = R.quo((x^2, y^2)) - sage: pi = Q.cover() # optional - sage.libs.singular - sage: pi(x^3 + y) # optional - sage.libs.singular + sage: pi = Q.cover() # needs sage.libs.singular + sage: pi(x^3 + y) # needs sage.libs.singular ybar - sage: l = pi.lift(x + y^3) # optional - sage.libs.singular - sage: l # optional - sage.libs.singular + sage: l = pi.lift(x + y^3) # needs sage.libs.singular + sage: l # needs sage.libs.singular x - sage: l = pi.lift(); l # optional - sage.libs.singular + sage: l = pi.lift(); l # needs sage.libs.singular Set-theoretic ring morphism: From: Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2, y^2) To: Multivariate Polynomial Ring in x, y over Rational Field Defn: Choice of lifting map - sage: l(x + y^3) # optional - sage.libs.singular + sage: l(x + y^3) # needs sage.libs.singular x """ try: @@ -680,40 +689,41 @@ def lifting_map(self): sage: R. = PolynomialRing(QQ, 2) sage: S = R.quotient(x^2 + y^2) - sage: pi = S.cover(); pi # optional - sage.libs.singular + sage: pi = S.cover(); pi # needs sage.libs.singular Ring morphism: From: Multivariate Polynomial Ring in x, y over Rational Field To: Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2) Defn: Natural quotient map - sage: L = S.lifting_map(); L # optional - sage.libs.singular + sage: L = S.lifting_map(); L # needs sage.libs.singular Set-theoretic ring morphism: From: Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2) To: Multivariate Polynomial Ring in x, y over Rational Field Defn: Choice of lifting map - sage: L(S.0) # optional - sage.libs.singular + sage: L(S.0) # needs sage.libs.singular x - sage: L(S.1) # optional - sage.libs.singular + sage: L(S.1) # needs sage.libs.singular y Note that some reduction may be applied so that the lift of a reduction need not equal the original element:: - sage: z = pi(x^3 + 2*y^2); z # optional - sage.libs.singular + sage: z = pi(x^3 + 2*y^2); z # needs sage.libs.singular -xbar*ybar^2 + 2*ybar^2 - sage: L(z) # optional - sage.libs.singular + sage: L(z) # needs sage.libs.singular -x*y^2 + 2*y^2 - sage: L(z) == x^3 + 2*y^2 # optional - sage.libs.singular + sage: L(z) == x^3 + 2*y^2 # needs sage.libs.singular False Test that there also is a lift for rings that are no instances of :class:`~sage.rings.ring.Ring` (see :trac:`11068`):: - sage: MS = MatrixSpace(GF(5), 2, 2) # optional - sage.modules sage.rings.finite_rings - sage: I = MS * [MS.0*MS.1, MS.2 + MS.3] * MS # optional - sage.modules sage.rings.finite_rings - sage: Q = MS.quo(I) # optional - sage.modules sage.rings.finite_rings - sage: Q.lift() # optional - sage.modules sage.rings.finite_rings + sage: # needs sage.modules sage.rings.finite_rings + sage: MS = MatrixSpace(GF(5), 2, 2) + sage: I = MS * [MS.0*MS.1, MS.2 + MS.3] * MS + sage: Q = MS.quo(I) + sage: Q.lift() Set-theoretic ring morphism: From: Quotient of Full MatrixSpace of 2 by 2 dense matrices over Finite Field of size 5 by the ideal @@ -755,13 +765,13 @@ def lift(self, x=None): sage: R. = PolynomialRing(QQ, 2) sage: S = R.quotient(x^2 + y^2) - sage: S.lift() # optional - sage.libs.singular + sage: S.lift() # needs sage.libs.singular Set-theoretic ring morphism: From: Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2) To: Multivariate Polynomial Ring in x, y over Rational Field Defn: Choice of lifting map - sage: S.lift(S.0) == x # optional - sage.libs.singular + sage: S.lift(S.0) == x # needs sage.libs.singular True """ @@ -785,7 +795,7 @@ def retract(self,x): sage: R. = PolynomialRing(QQ, 2) sage: S = R.quotient(x^2 + y^2) - sage: S.retract((x+y)^2) # optional - sage.libs.singular + sage: S.retract((x+y)^2) # needs sage.libs.singular 2*xbar*ybar """ @@ -826,11 +836,11 @@ def defining_ideal(self): ideals:: sage: R. = PolynomialRing(QQ, 2) - sage: S. = QuotientRing(R, R.ideal(1 + y^2)) # optional - sage.libs.singular - sage: T. = QuotientRing(S, S.ideal(a)) # optional - sage.libs.singular - sage: S.defining_ideal() # optional - sage.libs.singular + sage: S. = QuotientRing(R, R.ideal(1 + y^2)) # needs sage.libs.singular + sage: T. = QuotientRing(S, S.ideal(a)) # needs sage.libs.singular + sage: S.defining_ideal() # needs sage.libs.singular Ideal (y^2 + 1) of Multivariate Polynomial Ring in x, y over Rational Field - sage: T.defining_ideal() # optional - sage.libs.singular + sage: T.defining_ideal() # needs sage.libs.singular Ideal (x, y^2 + 1) of Multivariate Polynomial Ring in x, y over Rational Field """ return self.__I @@ -844,14 +854,14 @@ def is_field(self, proof=True): TESTS:: sage: Q = QuotientRing(ZZ, 7*ZZ) - sage: Q.is_field() # optional - sage.libs.pari + sage: Q.is_field() True Requires the ``is_maximal`` method of the defining ideal to be implemented:: sage: R. = ZZ[] - sage: R.quotient_ring(R.ideal([2, 4 + x])).is_field() # optional - sage.libs.pari + sage: R.quotient_ring(R.ideal([2, 4 + x])).is_field() Traceback (most recent call last): ... NotImplementedError @@ -878,19 +888,19 @@ def is_integral_domain(self, proof=True): EXAMPLES:: sage: R. = QQ[] - sage: R.quo(x^2 - y).is_integral_domain() # optional - sage.singular + sage: R.quo(x^2 - y).is_integral_domain() # needs sage.singular True - sage: R.quo(x^2 - y^2).is_integral_domain() # optional - sage.singular + sage: R.quo(x^2 - y^2).is_integral_domain() # needs sage.singular False - sage: R.quo(x^2 - y^2).is_integral_domain(proof=False) # optional - sage.singular + sage: R.quo(x^2 - y^2).is_integral_domain(proof=False) # needs sage.singular False - sage: R. = ZZ[] # optional - sage.singular - sage: Q = R.quotient_ring([a, b]) # optional - sage.singular - sage: Q.is_integral_domain() # optional - sage.singular + sage: R. = ZZ[] + sage: Q = R.quotient_ring([a, b]) + sage: Q.is_integral_domain() Traceback (most recent call last): ... NotImplementedError - sage: Q.is_integral_domain(proof=False) # optional - sage.singular + sage: Q.is_integral_domain(proof=False) False """ if proof: @@ -912,8 +922,8 @@ def is_noetherian(self): True sage: P. = QQ[] - sage: R = QuotientRing(P, x^2 + 1) # optional - sage.libs.pari - sage: R.is_noetherian() # optional - sage.libs.pari + sage: R = QuotientRing(P, x^2 + 1) # needs sage.libs.pari + sage: R.is_noetherian() True If the cover ring of ``self`` is not Noetherian, we currently @@ -924,8 +934,8 @@ def is_noetherian(self): sage: R.is_noetherian() False sage: I = R.ideal([x[1]^2, x[2]]) - sage: S = R.quotient(I) # optional - sage.libs.pari - sage: S.is_noetherian() # optional - sage.libs.pari + sage: S = R.quotient(I) + sage: S.is_noetherian() Traceback (most recent call last): ... NotImplementedError @@ -951,8 +961,8 @@ def cover_ring(self): :: sage: P. = QQ[] - sage: Q = QuotientRing(P, x^2 + 1) # optional - sage.libs.pari - sage: Q.cover_ring() # optional - sage.libs.pari + sage: Q = QuotientRing(P, x^2 + 1) # needs sage.libs.pari + sage: Q.cover_ring() # needs sage.libs.pari Univariate Polynomial Ring in x over Rational Field """ return self.__R @@ -968,10 +978,10 @@ def ideal(self, *gens, **kwds): sage: R. = PolynomialRing(QQ) sage: S = R.quotient_ring(x^2 + y^2) - sage: S.ideal() # optional - sage.libs.pari + sage: S.ideal() # needs sage.libs.pari Ideal (0) of Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2) - sage: S.ideal(x + y + 1) # optional - sage.libs.pari + sage: S.ideal(x + y + 1) # needs sage.libs.pari Ideal (xbar + ybar + 1) of Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2) @@ -1010,9 +1020,9 @@ def _element_constructor_(self, x, coerce=True): sage: R. = PolynomialRing(QQ) sage: S = R.quotient_ring(x^2 + y^2) - sage: S(x) # indirect doctest # optional - sage.libs.singular + sage: S(x) # indirect doctest # needs sage.libs.singular xbar - sage: S(x^2 + y^2) # optional - sage.libs.singular + sage: S(x^2 + y^2) # needs sage.libs.singular 0 The rings that coerce into the quotient ring canonically, are: @@ -1025,14 +1035,14 @@ def _element_constructor_(self, x, coerce=True): :: sage: R. = PolynomialRing(QQ, 2) - sage: S. = R.quotient(x^2 + y^2) # optional - sage.libs.singular - sage: S.coerce(0) # optional - sage.libs.singular + sage: S. = R.quotient(x^2 + y^2) # needs sage.libs.singular + sage: S.coerce(0) # needs sage.libs.singular 0 - sage: S.coerce(2/3) # optional - sage.libs.singular + sage: S.coerce(2/3) # needs sage.libs.singular 2/3 - sage: S.coerce(a^2 - b) # optional - sage.libs.singular + sage: S.coerce(a^2 - b) # needs sage.libs.singular -b^2 - b - sage: S.coerce(GF(7)(3)) # optional - sage.rings.finite_rings sage.libs.singular + sage: S.coerce(GF(7)(3)) Traceback (most recent call last): ... TypeError: no canonical coercion from Finite Field of size 7 @@ -1040,7 +1050,7 @@ def _element_constructor_(self, x, coerce=True): TESTS:: - sage: S(x, coerce=False) # optional - sage.libs.singular + sage: S(x, coerce=False) # needs sage.libs.singular a """ if isinstance(x, quotient_ring_element.QuotientRingElement): @@ -1068,10 +1078,10 @@ def _coerce_map_from_(self, R): True sage: S.has_coerce_map_from(QQ) True - sage: T = S.quotient_ring(x^3 - y) # optional - sage.libs.singular - sage: S.has_coerce_map_from(T) # optional - sage.libs.singular + sage: T = S.quotient_ring(x^3 - y) # needs sage.libs.singular + sage: S.has_coerce_map_from(T) # needs sage.libs.singular False - sage: T.has_coerce_map_from(R) # optional - sage.libs.singular + sage: T.has_coerce_map_from(R) # needs sage.libs.singular True TESTS: @@ -1081,15 +1091,15 @@ def _coerce_map_from_(self, R): sage: R. = PolynomialRing(QQ) sage: I = R.ideal(x^2 + y^2) sage: J = R.ideal(x^2 + y^2, x^3 - y) - sage: I < J # optional - sage.libs.singular + sage: I < J # needs sage.libs.singular True - sage: S = R.quotient(I) # optional - sage.libs.singular - sage: T = R.quotient(J) # optional - sage.libs.singular - sage: T.has_coerce_map_from(S) # optional - sage.libs.singular + sage: S = R.quotient(I) + sage: T = R.quotient(J) + sage: T.has_coerce_map_from(S) # needs sage.libs.singular True - sage: S.quotient_ring(x^4 - x*y + 1).has_coerce_map_from(S) # optional - sage.libs.singular + sage: S.quotient_ring(x^4 - x*y + 1).has_coerce_map_from(S) # needs sage.libs.singular True - sage: S.has_coerce_map_from(T) # optional - sage.libs.singular + sage: S.has_coerce_map_from(T) # needs sage.libs.singular False We also allow coercions with the cover rings:: @@ -1097,15 +1107,15 @@ def _coerce_map_from_(self, R): sage: Rp. = PolynomialRing(ZZ) sage: Ip = Rp.ideal(x^2 + y^2) sage: Jp = Rp.ideal(x^2 + y^2, x^3 - y) - sage: Sp = Rp.quotient(Ip) # optional - sage.libs.singular - sage: Tp = Rp.quotient(Jp) # optional - sage.libs.singular - sage: R.has_coerce_map_from(Rp) # optional - sage.libs.singular + sage: Sp = Rp.quotient(Ip) + sage: Tp = Rp.quotient(Jp) + sage: R.has_coerce_map_from(Rp) True - sage: Sp.has_coerce_map_from(Sp) # optional - sage.libs.singular + sage: Sp.has_coerce_map_from(Sp) True - sage: T.has_coerce_map_from(Sp) # optional - sage.libs.singular + sage: T.has_coerce_map_from(Sp) # needs sage.libs.singular True - sage: Sp.has_coerce_map_from(T) # optional - sage.libs.singular + sage: Sp.has_coerce_map_from(T) # needs sage.libs.singular False """ C = self.cover_ring() @@ -1137,9 +1147,9 @@ def __richcmp__(self, other, op): equal, but since the generators are different, the corresponding quotient rings are not equal:: - sage: R.ideal(x^2 + y^2) == R.ideal(-x^2 - y^2) # optional - sage.libs.singular + sage: R.ideal(x^2 + y^2) == R.ideal(-x^2 - y^2) # needs sage.libs.singular True - sage: R.quotient_ring(x^2 + y^2) == R.quotient_ring(-x^2 - y^2) # optional - sage.libs.singular + sage: R.quotient_ring(x^2 + y^2) == R.quotient_ring(-x^2 - y^2) False """ if not isinstance(other, QuotientRing_nc): @@ -1169,16 +1179,16 @@ def ngens(self): :: sage: R. = PolynomialRing(QQ,2) - sage: S. = QuotientRing(R, R.ideal(1 + y^2)) # optional - sage.libs.singular - sage: T. = QuotientRing(S, S.ideal(a)) # optional - sage.libs.singular - sage: T # optional - sage.libs.singular + sage: S. = QuotientRing(R, R.ideal(1 + y^2)) # needs sage.libs.singular + sage: T. = QuotientRing(S, S.ideal(a)) # needs sage.libs.singular + sage: T # needs sage.libs.singular Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x, y^2 + 1) - sage: R.gens(); S.gens(); T.gens() # optional - sage.libs.singular + sage: R.gens(); S.gens(); T.gens() # needs sage.libs.singular (x, y) (a, b) (0, d) - sage: R.ngens(); S.ngens(); T.ngens() # optional - sage.libs.singular + sage: R.ngens(); S.ngens(); T.ngens() # needs sage.libs.singular 2 2 2 @@ -1198,18 +1208,18 @@ def gen(self, i=0): :: sage: R. = PolynomialRing(QQ,2) - sage: S. = QuotientRing(R, R.ideal(1 + y^2)) # optional - sage.libs.singular - sage: T. = QuotientRing(S, S.ideal(a)) # optional - sage.libs.singular - sage: T # optional - sage.libs.singular + sage: S. = QuotientRing(R, R.ideal(1 + y^2)) # needs sage.libs.singular + sage: T. = QuotientRing(S, S.ideal(a)) # needs sage.libs.singular + sage: T # needs sage.libs.singular Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x, y^2 + 1) - sage: R.gen(0); R.gen(1) # optional - sage.libs.singular + sage: R.gen(0); R.gen(1) x y - sage: S.gen(0); S.gen(1) # optional - sage.libs.singular + sage: S.gen(0); S.gen(1) # needs sage.libs.singular a b - sage: T.gen(0); T.gen(1) # optional - sage.libs.singular + sage: T.gen(0); T.gen(1) # needs sage.libs.singular 0 d """ @@ -1236,7 +1246,7 @@ def _singular_(self, singular=None): sage: R. = PolynomialRing(QQ) sage: S = R.quotient_ring(x^2 + y^2) - sage: S._singular_() # optional - sage.libs.singular + sage: S._singular_() # needs sage.libs.singular polynomial ring, over a field, global ordering // coefficients: QQ // number of vars : 2 @@ -1270,10 +1280,10 @@ def _singular_init_(self, singular=None): sage: R. = PolynomialRing(QQ) sage: S = R.quotient_ring(x^2 + y^2) - sage: T = S._singular_init_() # optional - sage.libs.singular - sage: parent(S) # optional - sage.libs.singular + sage: T = S._singular_init_() # needs sage.libs.singular + sage: parent(S) - sage: parent(T) # optional - sage.libs.singular + sage: parent(T) # needs sage.libs.singular Singular """ if singular is None: @@ -1293,9 +1303,9 @@ def _magma_init_(self, magma): EXAMPLES:: - sage: P. = PolynomialRing(GF(2)) # optional - sage.rings.finite_rings - sage: Q = P.quotient(sage.rings.ideal.FieldIdeal(P)) # optional - sage.rings.finite_rings - sage: magma(Q) # optional - magma # indirect doctest # optional - sage.rings.finite_rings + sage: P. = PolynomialRing(GF(2)) + sage: Q = P.quotient(sage.rings.ideal.FieldIdeal(P)) + sage: magma(Q) # optional - magma # needs sage.rings.finite_rings Affine Algebra of rank 2 over GF(2) Graded Reverse Lexicographical Order Variables: x, y @@ -1388,12 +1398,13 @@ def _macaulay2_init_(self, macaulay2=None): 2 2 2 (x*y - z , y - w ) - sage: R. = PolynomialRing(GF(101), 2) # optional - sage.rings.finite_rings - sage: I = R.ideal([x^2 + x, y^2 + y]) # optional - sage.rings.finite_rings - sage: Q = R.quotient_ring(I); Q # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = PolynomialRing(GF(101), 2) + sage: I = R.ideal([x^2 + x, y^2 + y]) + sage: Q = R.quotient_ring(I); Q Quotient of Multivariate Polynomial Ring in x, y over Finite Field of size 101 by the ideal (x^2 + x, y^2 + y) - sage: Q._macaulay2_init_() # optional - macaulay2 # optional - sage.rings.finite_rings + sage: Q._macaulay2_init_() # optional - macaulay2 ZZ ---[x...y] 101 @@ -1467,12 +1478,12 @@ def _contains_(self, other): :: sage: R. = QQ[] - sage: S. = R.quotient(T^3 - 1) # optional - sage.libs.pari - sage: 1 in S.ideal(t^2 - 1) # optional - sage.libs.pari + sage: S. = R.quotient(T^3 - 1) # needs sage.libs.pari + sage: 1 in S.ideal(t^2 - 1) # needs sage.libs.pari False - sage: 7 in S.ideal(t^2 + 1) # optional - sage.libs.pari + sage: 7 in S.ideal(t^2 + 1) # needs sage.libs.pari True - sage: 5-5*t in S.ideal(t^2 - 1) # optional - sage.libs.pari + sage: 5-5*t in S.ideal(t^2 - 1) # needs sage.libs.pari True """ R = self.ring() diff --git a/src/sage/rings/quotient_ring_element.py b/src/sage/rings/quotient_ring_element.py index 8ef6d665a29..dc1fec51fad 100644 --- a/src/sage/rings/quotient_ring_element.py +++ b/src/sage/rings/quotient_ring_element.py @@ -61,23 +61,24 @@ class QuotientRingElement(RingElement): sage: S = R.quo(x^2 + y^2); S Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2) - sage: S.gens() # optional - sage.libs.singular + sage: S.gens() # needs sage.libs.singular (xbar, ybar) We name each of the generators. :: - sage: S. = R.quotient(x^2 + y^2) # optional - sage.libs.singular - sage: a # optional - sage.libs.singular + sage: # needs sage.libs.singular + sage: S. = R.quotient(x^2 + y^2) + sage: a a - sage: b # optional - sage.libs.singular + sage: b b - sage: a^2 + b^2 == 0 # optional - sage.libs.singular + sage: a^2 + b^2 == 0 True - sage: b.lift() # optional - sage.libs.singular + sage: b.lift() y - sage: (a^3 + b^2).lift() # optional - sage.libs.singular + sage: (a^3 + b^2).lift() -x*y^2 + y^2 """ def __init__(self, parent, rep, reduce=True): @@ -109,10 +110,10 @@ def _reduce_(self): TESTS:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: a._reduce_() # optional - sage.libs.singular - sage: a._QuotientRingElement__rep # optional - sage.libs.singular + sage: a._reduce_() # needs sage.libs.singular + sage: a._QuotientRingElement__rep # needs sage.libs.singular x """ I = self.parent().defining_ideal() @@ -125,11 +126,11 @@ def lift(self): EXAMPLES:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: a.lift() # optional - sage.libs.singular + sage: a.lift() # needs sage.libs.singular x - sage: (3/5*(a + a^2 + b^2)).lift() # optional - sage.libs.singular + sage: (3/5*(a + a^2 + b^2)).lift() # needs sage.libs.singular 3/5*x """ return self.__rep @@ -142,16 +143,16 @@ def __bool__(self): EXAMPLES:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: bool(a) # indirect doctest # optional - sage.libs.singular + sage: bool(a) # indirect doctest # needs sage.libs.singular True - sage: bool(S(0)) # optional - sage.libs.singular + sage: bool(S(0)) # needs sage.libs.singular False TESTS:: - sage: bool(a - a) # optional - sage.libs.singular + sage: bool(a - a) # needs sage.libs.singular False """ return self.__rep not in self.parent().defining_ideal() @@ -162,18 +163,18 @@ def is_unit(self): EXAMPLES:: - sage: R. = QQ[]; S. = R.quo(1 - x*y); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(1 - x*y); type(a) # needs sage.libs.singular - sage: a*b # optional - sage.libs.singular + sage: a*b # needs sage.libs.singular 1 - sage: S(2).is_unit() # optional - sage.libs.singular + sage: S(2).is_unit() # needs sage.libs.singular True Check that :trac:`29469` is fixed:: - sage: a.is_unit() # optional - sage.libs.singular + sage: a.is_unit() # needs sage.libs.singular True - sage: (a+b).is_unit() # optional - sage.libs.singular + sage: (a+b).is_unit() # needs sage.libs.singular False """ if self.__rep.is_unit(): @@ -194,18 +195,19 @@ def _repr_(self): TESTS:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: a-2*a*b # indirect doctest # optional - sage.libs.singular + sage: a-2*a*b # indirect doctest # needs sage.libs.singular -2*a*b + a In :trac:`11068`, the case of quotient rings without assigned names has been covered as well:: - sage: S = SteenrodAlgebra(2) # optional - sage.libs.singular - sage: I = S * [S.0 + S.1] * S # optional - sage.libs.singular - sage: Q = S.quo(I) # optional - sage.libs.singular - sage: Q.0 # optional - sage.libs.singular + sage: # needs sage.libs.singular + sage: S = SteenrodAlgebra(2) + sage: I = S * [S.0 + S.1] * S + sage: Q = S.quo(I) + sage: Q.0 Sq(1) """ @@ -235,8 +237,8 @@ def _latex_(self): sage: a = R.gen(0) sage: I = R.ideal(a**2 + a + 1) sage: S = R.quotient(I, names=R.variable_names()) - sage: a = S.gen(0) # optional - sage.libs.singular - sage: latex(a) # optional - sage.libs.singular + sage: a = S.gen(0) # needs sage.libs.singular + sage: latex(a) a """ from sage.structure.parent_gens import localvars @@ -261,8 +263,8 @@ def __pari__(self): sage: R. = QQ[] sage: I = R.ideal(x^3, y^3) - sage: S. = R.quo(I) # optional - sage.libs.singular - sage: pari(xb) # optional - sage.libs.pari sage.libs.singular + sage: S. = R.quo(I) # needs sage.libs.singular + sage: pari(xb) # needs sage.libs.pari sage.libs.singular Traceback (most recent call last): ... ValueError: Pari does not support quotients by non-principal ideals @@ -270,10 +272,10 @@ def __pari__(self): Note that the quotient does work in the case that the ideal is principal:: sage: I = R.ideal(x^3 + y^3) - sage: S. = R.quo(I) # optional - sage.libs.singular - sage: pari(xb)^4 # optional - sage.libs.pari sage.libs.singular + sage: S. = R.quo(I) # needs sage.libs.singular + sage: pari(xb)^4 # needs sage.libs.pari sage.libs.singular Mod(-y^3*x, x^3 + y^3) - sage: pari(yb)^4 # optional - sage.libs.pari sage.libs.singular + sage: pari(yb)^4 # needs sage.libs.pari sage.libs.singular Mod(y^4, x^3 + y^3) """ gens = self.parent().defining_ideal().gens() @@ -289,14 +291,14 @@ def _add_(self, right): EXAMPLES:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: a + b # optional - sage.libs.singular + sage: a + b # needs sage.libs.singular a + b TESTS:: - sage: a._add_(b) # optional - sage.libs.singular + sage: a._add_(b) # needs sage.libs.singular a + b """ return self.__class__(self.parent(), self.__rep + right.__rep) @@ -309,14 +311,14 @@ def _sub_(self, right): EXAMPLES:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: a - b # optional - sage.libs.singular + sage: a - b # needs sage.libs.singular a - b TESTS:: - sage: a._sub_(b) # optional - sage.libs.singular + sage: a._sub_(b) # needs sage.libs.singular a - b """ return self.__class__(self.parent(), self.__rep - right.__rep) @@ -329,16 +331,16 @@ def _mul_(self, right): EXAMPLES:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: a * b # optional - sage.libs.singular + sage: a * b # needs sage.libs.singular a*b TESTS:: - sage: a._mul_(b) # optional - sage.libs.singular + sage: a._mul_(b) # needs sage.libs.singular a*b - sage: a._mul_(a) # optional - sage.libs.singular + sage: a._mul_(a) # needs sage.libs.singular -b^2 """ return self.__class__(self.parent(), self.__rep * right.__rep) @@ -353,30 +355,30 @@ def _div_(self, right): sage: R. = QQ[] sage: I = R.ideal([x^2 + 1, y^3 - 2]) - sage: S. = R.quotient(I) # optional - sage.libs.singular - sage: 1/(1+i) # optional - sage.libs.singular + sage: S. = R.quotient(I) # needs sage.libs.singular + sage: 1/(1+i) # needs sage.libs.singular -1/2*i + 1/2 Confirm via symbolic computation:: - sage: 1/(1+sqrt(-1)) # optional - sage.symbolic + sage: 1/(1+sqrt(-1)) # needs sage.symbolic -1/2*I + 1/2 Another more complicated quotient:: - sage: b = 1/(i+cuberoot); b # optional - sage.libs.singular + sage: b = 1/(i+cuberoot); b # needs sage.libs.singular 1/5*i*cuberoot^2 - 2/5*i*cuberoot + 2/5*cuberoot^2 - 1/5*i + 1/5*cuberoot - 2/5 - sage: b*(i+cuberoot) # optional - sage.libs.singular + sage: b*(i+cuberoot) # needs sage.libs.singular 1 Another really easy example:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: a / S(2) # optional - sage.libs.singular + sage: a / S(2) # needs sage.libs.singular 1/2*a - sage: (a*b)._div_(b) # optional - sage.libs.singular + sage: (a*b)._div_(b) # needs sage.libs.singular a An example in which we try to divide in a ring that is not a @@ -384,18 +386,18 @@ def _div_(self, right): sage: R. = QQ[] sage: I = R.ideal([x^2 - 1, y^3 - 2]) - sage: S. = R.quotient(I) # optional - sage.libs.singular - sage: 1/cuberoot # optional - sage.libs.singular + sage: S. = R.quotient(I) # needs sage.libs.singular + sage: 1/cuberoot # needs sage.libs.singular 1/2*cuberoot^2 - sage: 1/a # optional - sage.libs.singular + sage: 1/a # needs sage.libs.singular a Check that :trac:`13670` is fixed (i.e. that the error message actually describes what happens when the result of division is not defined):: sage: R. = QQ[] - sage: S = R.quotient_ring( R.ideal(x2**2 + x1 - 2, x1**2 - 1) ) # optional - sage.libs.singular - sage: 1 / S(x1 + x2) # optional - sage.libs.singular + sage: S = R.quotient_ring( R.ideal(x2**2 + x1 - 2, x1**2 - 1) ) + sage: 1 / S(x1 + x2) # needs sage.libs.singular Traceback (most recent call last): ... ArithmeticError: Division failed. The numerator is not a multiple of the denominator. @@ -407,7 +409,7 @@ def _div_(self, right): sage: R. = QQ[] sage: S. = R[] - sage: Z. = S.quotient([y^2 - 2, z^2 - 3]) # optional - sage.libs.singular + sage: Z. = S.quotient([y^2 - 2, z^2 - 3]) # needs sage.libs.singular Traceback (most recent call last): ... TypeError: Can only reduce polynomials over fields. @@ -475,15 +477,15 @@ def _im_gens_(self, codomain, im_gens, base_map=None): quotient ring work correctly (see :trac:`16135`):: sage: R. = QQ[] - sage: K = R.quotient(x^2 - y^3).fraction_field() # optional - sage.libs.singular + sage: K = R.quotient(x^2 - y^3).fraction_field() # needs sage.libs.singular sage: L. = FunctionField(QQ) - sage: f = K.hom((t^3, t^2)) # optional - sage.libs.singular - sage: list(map(f, K.gens())) # optional - sage.libs.singular + sage: f = K.hom((t^3, t^2)) # needs sage.libs.singular + sage: list(map(f, K.gens())) # needs sage.libs.singular [t^3, t^2] - sage: xbar, ybar = K.gens() # optional - sage.libs.singular - sage: f(1/ybar) # optional - sage.libs.singular + sage: xbar, ybar = K.gens() # needs sage.libs.singular + sage: f(1/ybar) # needs sage.libs.singular 1/t^2 - sage: f(xbar/ybar) # optional - sage.libs.singular + sage: f(xbar/ybar) # needs sage.libs.singular t """ return self.lift()._im_gens_(codomain, im_gens, base_map=base_map) @@ -496,13 +498,14 @@ def __int__(self): EXAMPLES:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: # needs sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) - sage: int(S(-3)) # indirect doctest # optional - sage.libs.singular + sage: int(S(-3)) # indirect doctest -3 - sage: type(int(S(-3))) # optional - sage.libs.singular + sage: type(int(S(-3))) <... 'int'> - sage: int(a) # optional - sage.libs.singular + sage: int(a) Traceback (most recent call last): ... TypeError: unable to convert non-constant polynomial x to @@ -513,14 +516,14 @@ def _integer_(self, Z): """ EXAMPLES:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: ZZ(S(-3)) # optional - sage.libs.singular + sage: ZZ(S(-3)) # needs sage.libs.singular -3 TESTS:: - sage: type(ZZ(S(-3))) # optional - sage.libs.singular + sage: type(ZZ(S(-3))) # needs sage.libs.singular """ return Z(self.lift()) @@ -529,14 +532,14 @@ def _rational_(self): """ EXAMPLES:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: QQ(S(-2/3)) # optional - sage.libs.singular + sage: QQ(S(-2/3)) # needs sage.libs.singular -2/3 TESTS:: - sage: type(S(-2/3)._rational_()) # optional - sage.libs.singular + sage: type(S(-2/3)._rational_()) # needs sage.libs.singular """ from sage.rings.rational_field import QQ @@ -546,11 +549,11 @@ def __neg__(self): """ EXAMPLES:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: -a # indirect doctest # optional - sage.libs.singular + sage: -a # indirect doctest # needs sage.libs.singular -a - sage: -(a+b) # optional - sage.libs.singular + sage: -(a+b) # needs sage.libs.singular -a - b """ return self.__class__(self.parent(), -self.__rep) @@ -559,11 +562,11 @@ def __pos__(self): """ TESTS:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: (a+b).__pos__() # optional - sage.libs.singular + sage: (a+b).__pos__() # needs sage.libs.singular a + b - sage: c = a+b; c.__pos__() is c # optional - sage.libs.singular + sage: c = a+b; c.__pos__() is c # needs sage.libs.singular True """ return self @@ -572,19 +575,19 @@ def __invert__(self): """ EXAMPLES:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: ~S(2/3) # optional - sage.libs.singular + sage: ~S(2/3) # needs sage.libs.singular 3/2 TESTS:: - sage: S(2/3).__invert__() # optional - sage.libs.singular + sage: S(2/3).__invert__() # needs sage.libs.singular 3/2 Note that a is not invertible as an element of R:: - sage: a.__invert__() # optional - sage.libs.singular + sage: a.__invert__() # needs sage.libs.singular Traceback (most recent call last): ... ArithmeticError: element is non-invertible @@ -599,11 +602,11 @@ def __float__(self): """ EXAMPLES:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: float(S(2/3)) # optional - sage.libs.singular + sage: float(S(2/3)) # needs sage.libs.singular 0.6666666666666666 - sage: float(a) # optional - sage.libs.singular + sage: float(a) # needs sage.libs.singular Traceback (most recent call last): ... TypeError: unable to convert non-constant polynomial x to @@ -614,10 +617,11 @@ def __hash__(self): r""" TESTS:: - sage: R. = QQ[] # optional - sage.libs.singular - sage: S. = R.quo(x^2 + y^2) # optional - sage.libs.singular - sage: c = a*a + b # optional - sage.libs.singular - sage: hash(a) != hash(b) # optional - sage.libs.singular + sage: # needs sage.libs.singular + sage: R. = QQ[] + sage: S. = R.quo(x^2 + y^2) + sage: c = a*a + b + sage: hash(a) != hash(b) True """ return hash(self.__rep) @@ -626,38 +630,41 @@ def _richcmp_(self, other, op): """ EXAMPLES:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: # needs sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) - sage: a > b # indirect doctest # optional - sage.libs.singular + sage: a > b # indirect doctest True - sage: b > a # optional - sage.libs.singular + sage: b > a False - sage: a == loads(dumps(a)) # optional - sage.libs.singular + sage: a == loads(dumps(a)) True TESTS:: - sage: a == (a+1-1) # optional - sage.libs.singular + sage: a == (a+1-1) # needs sage.libs.singular True - sage: a > b # optional - sage.libs.singular + sage: a > b # needs sage.libs.singular True See :trac:`7797`:: - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # optional - sage.combinat sage.libs.singular sage.modules - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.libs.singular sage.modules - sage: Q = F.quo(I) # optional - sage.combinat sage.libs.singular sage.modules - sage: Q.0^4 # indirect doctest # optional - sage.combinat sage.libs.singular sage.modules + sage: # needs sage.combinat sage.libs.singular sage.modules + sage: F. = FreeAlgebra(QQ, implementation='letterplace') + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F + sage: Q = F.quo(I) + sage: Q.0^4 # indirect doctest ybar*zbar*zbar*xbar + ybar*zbar*zbar*ybar + ybar*zbar*zbar*zbar The issue from :trac:`8005` was most likely fixed as part of :trac:`9138`:: - sage: F = GF(5) # optional - sage.rings.finite_rings - sage: R. = F[] # optional - sage.rings.finite_rings - sage: I = Ideal(R, [x, y]) # optional - sage.rings.finite_rings - sage: S. = QuotientRing(R, I) # optional - sage.rings.finite_rings - sage: x1^4 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5) + sage: R. = F[] + sage: I = Ideal(R, [x, y]) + sage: S. = QuotientRing(R, I) + sage: x1^4 0 """ # A containment test is not implemented for univariate polynomial @@ -680,18 +687,19 @@ def lt(self): EXAMPLES:: - sage: R. = PolynomialRing(GF(7), 3, order='lex') # optional - sage.rings.finite_rings - sage: I = sage.rings.ideal.FieldIdeal(R) # optional - sage.rings.finite_rings - sage: Q = R.quo(I) # optional - sage.rings.finite_rings - sage: f = Q(z*y + 2*x) # optional - sage.rings.finite_rings - sage: f.lt() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = PolynomialRing(GF(7), 3, order='lex') + sage: I = sage.rings.ideal.FieldIdeal(R) + sage: Q = R.quo(I) + sage: f = Q(z*y + 2*x) + sage: f.lt() 2*xbar TESTS:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: (a + 3*a*b + b).lt() # optional - sage.libs.singular + sage: (a + 3*a*b + b).lt() # needs sage.libs.singular 3*a*b """ return self.__class__(self.parent(), self.__rep.lt()) @@ -702,18 +710,19 @@ def lm(self): EXAMPLES:: - sage: R. = PolynomialRing(GF(7), 3, order='lex') # optional - sage.rings.finite_rings - sage: I = sage.rings.ideal.FieldIdeal(R) # optional - sage.rings.finite_rings - sage: Q = R.quo(I) # optional - sage.rings.finite_rings - sage: f = Q(z*y + 2*x) # optional - sage.rings.finite_rings - sage: f.lm() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = PolynomialRing(GF(7), 3, order='lex') + sage: I = sage.rings.ideal.FieldIdeal(R) + sage: Q = R.quo(I) + sage: f = Q(z*y + 2*x) + sage: f.lm() xbar TESTS:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: (a+3*a*b+b).lm() # optional - sage.libs.singular + sage: (a+3*a*b+b).lm() # needs sage.libs.singular a*b """ @@ -725,18 +734,19 @@ def lc(self): EXAMPLES:: - sage: R. = PolynomialRing(GF(7), 3, order='lex') # optional - sage.rings.finite_rings - sage: I = sage.rings.ideal.FieldIdeal(R) # optional - sage.rings.finite_rings - sage: Q = R.quo(I) # optional - sage.rings.finite_rings - sage: f = Q(z*y + 2*x) # optional - sage.rings.finite_rings - sage: f.lc() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = PolynomialRing(GF(7), 3, order='lex') + sage: I = sage.rings.ideal.FieldIdeal(R) + sage: Q = R.quo(I) + sage: f = Q(z*y + 2*x) + sage: f.lc() 2 TESTS:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: (a + 3*a*b + b).lc() # optional - sage.libs.singular + sage: (a + 3*a*b + b).lc() # needs sage.libs.singular 3 """ return self.__rep.lc() @@ -752,17 +762,18 @@ def variables(self): EXAMPLES:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: # needs sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) - sage: a.variables() # optional - sage.libs.singular + sage: a.variables() (a,) - sage: b.variables() # optional - sage.libs.singular + sage: b.variables() (b,) - sage: s = a^2 + b^2 + 1; s # optional - sage.libs.singular + sage: s = a^2 + b^2 + 1; s 1 - sage: s.variables() # optional - sage.libs.singular + sage: s.variables() () - sage: (a + b).variables() # optional - sage.libs.singular + sage: (a + b).variables() (a, b) """ return tuple(self.__class__(self.parent(), v) for v in self.__rep.variables()) @@ -777,13 +788,14 @@ def monomials(self): EXAMPLES:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: # needs sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) - sage: a.monomials() # optional - sage.libs.singular + sage: a.monomials() [a] - sage: (a + a*b).monomials() # optional - sage.libs.singular + sage: (a + a*b).monomials() [a*b, a] - sage: R.zero().monomials() # optional - sage.libs.singular + sage: R.zero().monomials() [] """ return [self.__class__(self.parent(), m) for m in self.__rep.monomials()] @@ -799,10 +811,11 @@ def _singular_(self, singular=singular_default): EXAMPLES:: - sage: P. = PolynomialRing(GF(2), 2) # optional - sage.rings.finite_rings - sage: I = sage.rings.ideal.FieldIdeal(P) # optional - sage.rings.finite_rings - sage: Q = P.quo(I) # optional - sage.rings.finite_rings - sage: Q._singular_() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: P. = PolynomialRing(GF(2), 2) + sage: I = sage.rings.ideal.FieldIdeal(P) + sage: Q = P.quo(I) + sage: Q._singular_() polynomial ring, over a field, global ordering // coefficients: ZZ/2 // number of vars : 2 @@ -812,20 +825,20 @@ def _singular_(self, singular=singular_default): // quotient ring from ideal _[1]=x2+x _[2]=y2+y - sage: xbar = Q(x); xbar # optional - sage.rings.finite_rings + sage: xbar = Q(x); xbar xbar - sage: xbar._singular_() # optional - sage.rings.finite_rings + sage: xbar._singular_() x - sage: Q(xbar._singular_()) # a round-trip # optional - sage.rings.finite_rings + sage: Q(xbar._singular_()) # a round-trip xbar TESTS:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # optional - sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular - sage: (a - 2/3*b)._singular_() # optional - sage.libs.singular + sage: (a - 2/3*b)._singular_() # needs sage.libs.singular x-2/3*y - sage: S((a - 2/3*b)._singular_()) # optional - sage.libs.singular + sage: S((a - 2/3*b)._singular_()) # needs sage.libs.singular a - 2/3*b """ if singular is None: @@ -838,12 +851,13 @@ def _magma_init_(self, magma): EXAMPLES:: - sage: P. = PolynomialRing(GF(2)) # optional - sage.rings.finite_rings - sage: Q = P.quotient(sage.rings.ideal.FieldIdeal(P)) # optional - sage.rings.finite_rings - sage: xbar, ybar = Q.gens() # optional - sage.rings.finite_rings - sage: magma(xbar) # optional - magma # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: P. = PolynomialRing(GF(2)) + sage: Q = P.quotient(sage.rings.ideal.FieldIdeal(P)) + sage: xbar, ybar = Q.gens() + sage: magma(xbar) # optional - magma x - sage: xbar._magma_init_(magma) # optional - magma # optional - sage.rings.finite_rings + sage: xbar._magma_init_(magma) # optional - magma '_sage_[...]!_sage_ref...' """ g = magma(self.__rep) @@ -856,19 +870,20 @@ def _macaulay2_(self, macaulay2=None): EXAMPLES:: - sage: R. = PolynomialRing(GF(7), 2) # optional - sage.rings.finite_rings - sage: Q = R.quotient([x^2 - y]) # optional - sage.rings.finite_rings - sage: x, y = Q.gens() # optional - sage.rings.finite_rings - sage: f = (x^3 + 2*y^2*x)^7; f # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = PolynomialRing(GF(7), 2) + sage: Q = R.quotient([x^2 - y]) + sage: x, y = Q.gens() + sage: f = (x^3 + 2*y^2*x)^7; f 2*xbar*ybar^17 + xbar*ybar^10 - sage: mf = macaulay2(f); mf # optional - macaulay2 # optional - sage.rings.finite_rings + sage: mf = macaulay2(f); mf # optional - macaulay2 17 10 2x*y + x*y - sage: mf.sage() # optional - macaulay2 # optional - sage.rings.finite_rings + sage: mf.sage() # optional - macaulay2 2*x*y^17 + x*y^10 - sage: mf.sage() == f # optional - macaulay2 # optional - sage.rings.finite_rings + sage: mf.sage() == f # optional - macaulay2 True - sage: Q(mf) # optional - macaulay2 # optional - sage.rings.finite_rings + sage: Q(mf) # optional - macaulay2 2*xbar*ybar^17 + xbar*ybar^10 In Macaulay2, the variable names for a quotient ring are inherited from @@ -880,15 +895,16 @@ def _macaulay2_(self, macaulay2=None): :: - sage: R. = PolynomialRing(GF(7), 2) # optional - sage.rings.finite_rings - sage: Q = R.quotient([x^2 - y], names=R.gens()) # optional - sage.rings.finite_rings - sage: x, y = Q.gens() # optional - sage.rings.finite_rings - sage: f = (x^3 + 2*y^2*x)^7; f # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = PolynomialRing(GF(7), 2) + sage: Q = R.quotient([x^2 - y], names=R.gens()) + sage: x, y = Q.gens() + sage: f = (x^3 + 2*y^2*x)^7; f 2*x*y^17 + x*y^10 - sage: macaulay2(f) # optional - macaulay2 # optional - sage.rings.finite_rings + sage: macaulay2(f) # optional - macaulay2 17 10 2x*y + x*y - sage: _.sage() # optional - macaulay2 # optional - sage.rings.finite_rings + sage: _.sage() # optional - macaulay2 2*x*y^17 + x*y^10 TESTS: @@ -896,15 +912,16 @@ def _macaulay2_(self, macaulay2=None): Check that changing the currently defined global variables (`x`, `y`, ...) in Macaulay2 does not affect the result of this conversion:: - sage: R. = PolynomialRing(GF(7), 2) # optional - sage.rings.finite_rings - sage: Q = R.quotient([x^2 - y], names=R.gens()) # optional - sage.rings.finite_rings - sage: x, y = Q.gens() # optional - sage.rings.finite_rings - sage: f = (x^3 + 2*y^2*x)^7 # optional - sage.rings.finite_rings - sage: macaulay2(f) # optional - macaulay2 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = PolynomialRing(GF(7), 2) + sage: Q = R.quotient([x^2 - y], names=R.gens()) + sage: x, y = Q.gens() + sage: f = (x^3 + 2*y^2*x)^7 + sage: macaulay2(f) # optional - macaulay2 17 10 2x*y + x*y - sage: macaulay2.use(R.quotient([x, y])) # optional - macaulay2 # optional - sage.rings.finite_rings - sage: macaulay2(f) # optional - macaulay2 # optional - sage.rings.finite_rings + sage: macaulay2.use(R.quotient([x, y])) # optional - macaulay2 + sage: macaulay2(f) # optional - macaulay2 17 10 2x*y + x*y """ @@ -933,18 +950,19 @@ def reduce(self, G): EXAMPLES:: - sage: P. = PolynomialRing(GF(2), 5, order='lex') # optional - sage.rings.finite_rings - sage: I1 = ideal([a*b + c*d + 1, a*c*e + d*e, # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: P. = PolynomialRing(GF(2), 5, order='lex') + sage: I1 = ideal([a*b + c*d + 1, a*c*e + d*e, ....: a*b*e + c*e, b*c + c*d*e + 1]) - sage: Q = P.quotient(sage.rings.ideal.FieldIdeal(P)) # optional - sage.rings.finite_rings - sage: I2 = ideal([Q(f) for f in I1.gens()]) # optional - sage.rings.finite_rings - sage: f = Q((a*b + c*d + 1)^2 + e) # optional - sage.rings.finite_rings - sage: f.reduce(I2.gens()) # optional - sage.rings.finite_rings + sage: Q = P.quotient(sage.rings.ideal.FieldIdeal(P)) + sage: I2 = ideal([Q(f) for f in I1.gens()]) + sage: f = Q((a*b + c*d + 1)^2 + e) + sage: f.reduce(I2.gens()) ebar Notice that the result above is not minimal:: - sage: I2.reduce(f) # optional - sage.rings.finite_rings + sage: I2.reduce(f) # needs sage.rings.finite_rings 0 """ try: diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx index f08b37d6d45..90b07c7914b 100644 --- a/src/sage/rings/rational.pyx +++ b/src/sage/rings/rational.pyx @@ -293,30 +293,30 @@ cpdef rational_power_parts(a, Rational b, factor_limit=10**5): sage: rational_power_parts(3/4, -1/2) (2, 3) - sage: t = (3/4)^(-1/2); t # optional - sage.symbolic + sage: t = (3/4)^(-1/2); t # needs sage.symbolic 2/3*sqrt(3) - sage: t^2 # optional - sage.symbolic + sage: t^2 # needs sage.symbolic 4/3 Check if :trac:`15605` is fixed:: sage: rational_power_parts(-1, -1/3) (1, -1) - sage: (-1)^(-1/3) # optional - sage.symbolic + sage: (-1)^(-1/3) # needs sage.symbolic -(-1)^(2/3) - sage: 1 / ((-1)^(1/3)) # optional - sage.symbolic + sage: 1 / ((-1)^(1/3)) # needs sage.symbolic -(-1)^(2/3) sage: rational_power_parts(-1, 2/3) (1, -1) - sage: (-1)^(2/3) # optional - sage.symbolic + sage: (-1)^(2/3) # needs sage.symbolic (-1)^(2/3) sage: all(rational_power_parts(-1, i/77) == (1,-1) for i in range(1,9)) True - sage: (-1)^(1/3)*(-1)^(1/5) # optional - sage.symbolic + sage: (-1)^(1/3)*(-1)^(1/5) # needs sage.symbolic (-1)^(8/15) - sage: bool((-1)^(2/3) == -1/2 + sqrt(3)/2*I) # optional - sage.symbolic + sage: bool((-1)^(2/3) == -1/2 + sqrt(3)/2*I) # needs sage.symbolic True - sage: all((-1)^(p/q) == cos(p*pi/q) + I * sin(p*pi/q) # optional - sage.symbolic + sage: all((-1)^(p/q) == cos(p*pi/q) + I * sin(p*pi/q) # needs sage.symbolic ....: for p in srange(1, 6) for q in srange(1, 6)) True @@ -416,9 +416,9 @@ cdef class Rational(sage.structure.element.FieldElement): 1/2 sage: Rational(("2", "10"), 16) 1/8 - sage: Rational(QQbar(125/8).nth_root(3)) # optional - sage.rings.number_field + sage: Rational(QQbar(125/8).nth_root(3)) # needs sage.rings.number_field 5/2 - sage: Rational(AA(209735/343 - 17910/49*golden_ratio).nth_root(3) # optional - sage.rings.number_field + sage: Rational(AA(209735/343 - 17910/49*golden_ratio).nth_root(3) # needs sage.rings.number_field sage.symbolic ....: + 3*AA(golden_ratio)) 53/7 sage: QQ(float(1.5)) @@ -435,24 +435,25 @@ cdef class Rational(sage.structure.element.FieldElement): Conversion from PARI:: - sage: Rational(pari('-939082/3992923')) # optional - sage.libs.pari + sage: Rational(pari('-939082/3992923')) # needs sage.libs.pari -939082/3992923 - sage: Rational(pari('Pol([-1/2])')) #9595 # optional - sage.libs.pari + sage: Rational(pari('Pol([-1/2])')) #9595 # needs sage.libs.pari -1/2 Conversions from numpy:: - sage: import numpy as np # optional - numpy - sage: QQ(np.int8('-15')) # optional - numpy + sage: # needs numpy + sage: import numpy as np + sage: QQ(np.int8('-15')) -15 - sage: QQ(np.int16('-32')) # optional - numpy + sage: QQ(np.int16('-32')) -32 - sage: QQ(np.int32('-19')) # optional - numpy + sage: QQ(np.int32('-19')) -19 - sage: QQ(np.uint32('1412')) # optional - numpy + sage: QQ(np.uint32('1412')) 1412 - sage: QQ(np.float16('12')) # optional - numpy + sage: QQ(np.float16('12')) # needs numpy 12 Conversions from gmpy2:: @@ -507,7 +508,7 @@ cdef class Rational(sage.structure.element.FieldElement): 7 sage: a.__init__('70', base=8); a 56 - sage: a.__init__(pari('2/3')); a # optional - sage.libs.pari + sage: a.__init__(pari('2/3')); a # needs sage.libs.pari 2/3 sage: a.__init__('-h/3ki', 32); a -17/3730 @@ -718,7 +719,7 @@ cdef class Rational(sage.structure.element.FieldElement): sage: 1 + 1/(2 + 1/(3 + 1/(4 + 1/5))) 225/157 - sage: (fibonacci(20)/fibonacci(19)).continued_fraction_list() + sage: (fibonacci(20)/fibonacci(19)).continued_fraction_list() # needs sage.libs.pari [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2] sage: (-1/3).continued_fraction_list() @@ -805,9 +806,9 @@ cdef class Rational(sage.structure.element.FieldElement): sage: a = (355/113).continued_fraction(); a [3; 7, 16] - sage: a.n(digits=10) # optional - sage.rings.real_mpfr + sage: a.n(digits=10) # needs sage.rings.real_mpfr 3.141592920 - sage: pi.n(digits=10) # optional - sage.rings.real_mpfr sage.symbolic + sage: pi.n(digits=10) # needs sage.rings.real_mpfr sage.symbolic 3.141592654 It's almost pi! @@ -958,9 +959,9 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: - sage: ex = SR(QQ(7)/3); ex # optional - sage.symbolic + sage: ex = SR(QQ(7)/3); ex # needs sage.symbolic 7/3 - sage: parent(ex) # optional - sage.symbolic + sage: parent(ex) # needs sage.symbolic Symbolic Ring """ return sring._force_pyobject(self, force=True) @@ -971,12 +972,12 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: - sage: n = 1/2; n._sympy_() # optional - sympy + sage: n = 1/2; n._sympy_() # needs sympy 1/2 - sage: n = -1/5; n._sympy_() # optional - sympy + sage: n = -1/5; n._sympy_() # needs sympy -1/5 - sage: from sympy import Symbol # optional - sympy - sage: QQ(1) + Symbol('x')*QQ(2) # optional - sympy + sage: from sympy import Symbol # needs sympy + sage: QQ(1) + Symbol('x')*QQ(2) # needs sympy 2*x + 1 """ import sympy @@ -1044,16 +1045,16 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: - sage: import numpy # optional - numpy - sage: numpy.array([1, 2, 3/1]) # optional - numpy + sage: import numpy # needs numpy + sage: numpy.array([1, 2, 3/1]) # needs numpy array([1, 2, 3]) - sage: numpy.array(QQ(2**40)).dtype # optional - numpy + sage: numpy.array(QQ(2**40)).dtype # needs numpy dtype('int64') - sage: numpy.array(QQ(2**400)).dtype # optional - numpy + sage: numpy.array(QQ(2**400)).dtype # needs numpy dtype('O') - sage: numpy.array([1, 1/2, 3/4]) # optional - numpy + sage: numpy.array([1, 1/2, 3/4]) # needs numpy array([1. , 0.5 , 0.75]) """ if mpz_cmp_ui(mpq_denref(self.value), 1) == 0: @@ -1196,11 +1197,11 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: sage: a = QQ(25/6) - sage: a.local_height(2) # optional - sage.rings.real_mpfr + sage: a.local_height(2) # needs sage.rings.real_mpfr 0.693147180559945 - sage: a.local_height(3) # optional - sage.rings.real_mpfr + sage: a.local_height(3) # needs sage.rings.real_mpfr 1.09861228866811 - sage: a.local_height(5) # optional - sage.rings.real_mpfr + sage: a.local_height(5) # needs sage.rings.real_mpfr 0.000000000000000 """ from sage.rings.real_mpfr import RealField @@ -1234,11 +1235,11 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: sage: a = QQ(6/25) - sage: a.local_height_arch() # optional - sage.rings.real_mpfr + sage: a.local_height_arch() # needs sage.rings.real_mpfr 0.000000000000000 - sage: (1/a).local_height_arch() # optional - sage.rings.real_mpfr + sage: (1/a).local_height_arch() # needs sage.rings.real_mpfr 1.42711635564015 - sage: (1/a).local_height_arch(100) # optional - sage.rings.real_mpfr + sage: (1/a).local_height_arch(100) # needs sage.rings.real_mpfr 1.4271163556401457483890413081 """ from sage.rings.real_mpfr import RealField @@ -1277,11 +1278,11 @@ cdef class Rational(sage.structure.element.FieldElement): sage: a = QQ(5/6) sage: a.support() [2, 3, 5] - sage: a.global_height_non_arch() # optional - sage.rings.real_mpfr + sage: a.global_height_non_arch() # needs sage.rings.real_mpfr 1.79175946922805 - sage: [a.local_height(p) for p in a.support()] # optional - sage.rings.real_mpfr + sage: [a.local_height(p) for p in a.support()] # needs sage.rings.real_mpfr [0.693147180559945, 1.09861228866811, 0.000000000000000] - sage: sum([a.local_height(p) for p in a.support()]) # optional - sage.rings.real_mpfr + sage: sum([a.local_height(p) for p in a.support()]) # needs sage.rings.real_mpfr 1.79175946922805 """ from sage.rings.real_mpfr import RealField @@ -1318,11 +1319,11 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: sage: a = QQ(6/25) - sage: a.global_height_arch() # optional - sage.rings.real_mpfr + sage: a.global_height_arch() # needs sage.rings.real_mpfr 0.000000000000000 - sage: (1/a).global_height_arch() # optional - sage.rings.real_mpfr + sage: (1/a).global_height_arch() # needs sage.rings.real_mpfr 1.42711635564015 - sage: (1/a).global_height_arch(100) # optional - sage.rings.real_mpfr + sage: (1/a).global_height_arch(100) # needs sage.rings.real_mpfr 1.4271163556401457483890413081 """ return self.local_height_arch(prec) @@ -1350,15 +1351,15 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: sage: a = QQ(6/25) - sage: a.global_height_arch() + a.global_height_non_arch() # optional - sage.rings.real_mpfr + sage: a.global_height_arch() + a.global_height_non_arch() # needs sage.rings.real_mpfr 3.21887582486820 - sage: a.global_height() # optional - sage.rings.real_mpfr + sage: a.global_height() # needs sage.rings.real_mpfr 3.21887582486820 - sage: (1/a).global_height() # optional - sage.rings.real_mpfr + sage: (1/a).global_height() # needs sage.rings.real_mpfr 3.21887582486820 - sage: QQ(0).global_height() # optional - sage.rings.real_mpfr + sage: QQ(0).global_height() # needs sage.rings.real_mpfr 0.000000000000000 - sage: QQ(1).global_height() # optional - sage.rings.real_mpfr + sage: QQ(1).global_height() # needs sage.rings.real_mpfr 0.000000000000000 """ from sage.rings.real_mpfr import RealField @@ -1418,43 +1419,43 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: sage: x = polygen(QQ, 'x') - sage: K = NumberField(x^2 - 2, 'beta') # optional - sage.rings.number_field - sage: (1/7).is_norm(K) # optional - sage.rings.number_field + sage: K = NumberField(x^2 - 2, 'beta') # needs sage.rings.number_field + sage: (1/7).is_norm(K) # needs sage.rings.number_field True - sage: (1/10).is_norm(K) # optional - sage.rings.number_field + sage: (1/10).is_norm(K) # needs sage.rings.number_field False - sage: 0.is_norm(K) # optional - sage.rings.number_field + sage: 0.is_norm(K) # needs sage.rings.number_field True - sage: (1/7).is_norm(K, element=True) # optional - sage.rings.number_field + sage: (1/7).is_norm(K, element=True) # needs sage.rings.number_field (True, 1/7*beta + 3/7) - sage: (1/10).is_norm(K, element=True) # optional - sage.rings.number_field + sage: (1/10).is_norm(K, element=True) # needs sage.rings.number_field (False, None) - sage: (1/691).is_norm(QQ, element=True) # optional - sage.rings.number_field + sage: (1/691).is_norm(QQ, element=True) (True, 1/691) The number field doesn't have to be defined by an integral polynomial:: - sage: B, e = (1/5).is_norm(QuadraticField(5/4, 'a'), element=True) # optional - sage.rings.number_field - sage: B # optional - sage.rings.number_field + sage: B, e = (1/5).is_norm(QuadraticField(5/4, 'a'), element=True) # needs sage.rings.number_field + sage: B # needs sage.rings.number_field True - sage: e.norm() # optional - sage.rings.number_field + sage: e.norm() # needs sage.rings.number_field 1/5 A non-Galois number field:: - sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field - sage: B, e = (3/5).is_norm(K, element=True); B # optional - sage.rings.number_field + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: B, e = (3/5).is_norm(K, element=True); B # needs sage.rings.number_field True - sage: e.norm() # optional - sage.rings.number_field + sage: e.norm() # needs sage.rings.number_field 3/5 - sage: 7.is_norm(K) # optional - sage.rings.number_field + sage: 7.is_norm(K) # needs sage.rings.number_field Traceback (most recent call last): ... NotImplementedError: is_norm is not implemented unconditionally for norms from non-Galois number fields - sage: 7.is_norm(K, proof=False) # optional - sage.rings.number_field + sage: 7.is_norm(K, proof=False) # needs sage.rings.number_field False AUTHORS: @@ -1537,10 +1538,10 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: - sage: QQ(2)._bnfisnorm(QuadraticField(-1, 'i')) # optional - sage.rings.number_field + sage: QQ(2)._bnfisnorm(QuadraticField(-1, 'i')) # needs sage.rings.number_field (i + 1, 1) sage: x = polygen(QQ, 'x') - sage: 7._bnfisnorm(NumberField(x^3 - 2, 'b')) # optional - sage.rings.number_field + sage: 7._bnfisnorm(NumberField(x^3 - 2, 'b')) # needs sage.rings.number_field (1, 7) AUTHORS: @@ -1899,34 +1900,34 @@ cdef class Rational(sage.structure.element.FieldElement): sage: x.sqrt(all=True) [10, -10] sage: x = 81/5 - sage: x.sqrt() # optional - sage.symbolic + sage: x.sqrt() # needs sage.symbolic 9*sqrt(1/5) sage: x = -81/3 - sage: x.sqrt() # optional - sage.symbolic + sage: x.sqrt() # needs sage.symbolic 3*sqrt(-3) :: sage: n = 2/3 - sage: n.sqrt() # optional - sage.symbolic + sage: n.sqrt() # needs sage.symbolic sqrt(2/3) - sage: n.sqrt(prec=10) # optional - sage.rings.real_mpfr + sage: n.sqrt(prec=10) # needs sage.rings.real_mpfr 0.82 - sage: n.sqrt(prec=100) # optional - sage.rings.real_mpfr + sage: n.sqrt(prec=100) # needs sage.rings.real_mpfr 0.81649658092772603273242802490 - sage: n.sqrt(prec=100)^2 # optional - sage.rings.real_mpfr + sage: n.sqrt(prec=100)^2 # needs sage.rings.real_mpfr 0.66666666666666666666666666667 - sage: n.sqrt(prec=53, all=True) # optional - sage.rings.real_mpfr + sage: n.sqrt(prec=53, all=True) # needs sage.rings.real_mpfr [0.816496580927726, -0.816496580927726] sage: n.sqrt(extend=False, all=True) Traceback (most recent call last): ... ValueError: square root of 2/3 not a rational number - sage: sqrt(-2/3, all=True) # optional - sage.symbolic + sage: sqrt(-2/3, all=True) # needs sage.symbolic [sqrt(-2/3), -sqrt(-2/3)] - sage: sqrt(-2/3, prec=53) # optional - sage.rings.real_mpfr + sage: sqrt(-2/3, prec=53) # needs sage.rings.real_mpfr 0.816496580927726*I - sage: sqrt(-2/3, prec=53, all=True) # optional - sage.rings.real_mpfr + sage: sqrt(-2/3, prec=53, all=True) # needs sage.rings.real_mpfr [0.816496580927726*I, -0.816496580927726*I] AUTHORS: @@ -1988,22 +1989,22 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: - sage: (1/7).period() # optional - sage.libs.pari + sage: (1/7).period() # needs sage.libs.pari 6 - sage: RR(1/7) # optional - sage.rings.real_mpfr + sage: RR(1/7) # needs sage.rings.real_mpfr 0.142857142857143 - sage: (1/8).period() # optional - sage.libs.pari + sage: (1/8).period() # needs sage.libs.pari 1 - sage: RR(1/8) # optional - sage.rings.real_mpfr + sage: RR(1/8) # needs sage.rings.real_mpfr 0.125000000000000 - sage: RR(1/6) # optional - sage.rings.real_mpfr + sage: RR(1/6) # needs sage.rings.real_mpfr 0.166666666666667 - sage: (1/6).period() # optional - sage.libs.pari + sage: (1/6).period() # needs sage.libs.pari 1 sage: x = 333/106 - sage: x.period() # optional - sage.libs.pari + sage: x.period() # needs sage.libs.pari 13 - sage: RealField(200)(x) # optional - sage.rings.real_mpfr + sage: RealField(200)(x) # needs sage.rings.real_mpfr 3.1415094339622641509433962264150943396226415094339622641509 """ cdef unsigned int alpha, beta @@ -2193,27 +2194,27 @@ cdef class Rational(sage.structure.element.FieldElement): Test that conversion agrees with `RR`:: sage: Q = [a/b for a in [-99..99] for b in [1..99]] - sage: all(RDF(q) == RR(q) for q in Q) # optional - sage.rings.real_mpfr + sage: all(RDF(q) == RR(q) for q in Q) True Test that the conversion has correct rounding on simple rationals:: - sage: for p in [-100..100]: # optional - sage.rings.real_mpfr + sage: for p in [-100..100]: # needs sage.rings.real_mpfr ....: for q in [1..100]: ....: r = RDF(p/q) ....: assert (RR(r).exact_rational() - p/q) <= r.ulp()/2 Test larger rationals:: - sage: Q = continued_fraction(pi).convergents()[:100] + sage: Q = continued_fraction(pi).convergents()[:100] # needs sage.symbolic sage: all(RDF(q) == RR(q) for q in Q) True At some point, the continued fraction and direct conversion to ``RDF`` should agree:: - sage: RDFpi = RDF(pi) - sage: all(RDF(q) == RDFpi for q in Q[20:]) + sage: RDFpi = RDF(pi) # needs sage.symbolic + sage: all(RDF(q) == RDFpi for q in Q[20:]) # needs sage.symbolic True """ return mpq_get_d_nearest(self.value) @@ -2513,9 +2514,9 @@ cdef class Rational(sage.structure.element.FieldElement): sage: (2/3)^5 32/243 - sage: (-1/1)^(1/3) # optional - sage.symbolic + sage: (-1/1)^(1/3) # needs sage.symbolic (-1)^(1/3) - sage: (2/3)^(3/4) # optional - sage.symbolic + sage: (2/3)^(3/4) # needs sage.symbolic (2/3)^(3/4) sage: (-1/3)^0 1 @@ -2530,18 +2531,18 @@ cdef class Rational(sage.structure.element.FieldElement): 2/3 sage: parent(a) Rational Field - sage: (-27/125)^(1/3) # optional - sage.symbolic + sage: (-27/125)^(1/3) # needs sage.symbolic 3/5*(-1)^(1/3) - sage: (-27/125)^(1/2) # optional - sage.symbolic + sage: (-27/125)^(1/2) # needs sage.symbolic 3/5*sqrt(-3/5) The result is normalized to have the rational power in the numerator:: - sage: 2^(-1/2) # optional - sage.symbolic + sage: 2^(-1/2) # needs sage.symbolic 1/2*sqrt(2) - sage: 8^(-1/5) # optional - sage.symbolic + sage: 8^(-1/5) # needs sage.symbolic 1/8*8^(4/5) - sage: 3^(-3/2) # optional - sage.symbolic + sage: 3^(-3/2) # needs sage.symbolic 1/9*sqrt(3) TESTS:: @@ -2553,7 +2554,7 @@ cdef class Rational(sage.structure.element.FieldElement): This works even if the base is a Python integer:: - sage: int(2)^(1/2) # optional - sage.symbolic + sage: int(2)^(1/2) # needs sage.symbolic sqrt(2) sage: a = int(2)^(3/1); a 8 @@ -2572,7 +2573,7 @@ cdef class Rational(sage.structure.element.FieldElement): ... OverflowError: exponent must be at most 2147483647 # 32-bit OverflowError: exponent must be at most 9223372036854775807 # 64-bit - sage: QQ(-1)^(2^100) # optional - sage.symbolic + sage: QQ(-1)^(2^100) # needs sage.symbolic 1 """ n = other @@ -3119,42 +3120,42 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: - sage: (124/345).log(5) # optional - sage.symbolic + sage: (124/345).log(5) # needs sage.symbolic log(124/345)/log(5) - sage: (124/345).log(5, 100) # optional - sage.rings.real_mpfr + sage: (124/345).log(5, 100) # needs sage.rings.real_mpfr -0.63578895682825611710391773754 - sage: log(QQ(125)) # optional - sage.symbolic + sage: log(QQ(125)) # needs sage.symbolic 3*log(5) sage: log(QQ(125), 5) 3 - sage: log(QQ(125), 3) # optional - sage.symbolic + sage: log(QQ(125), 3) # needs sage.symbolic 3*log(5)/log(3) sage: QQ(8).log(1/2) -3 - sage: (1/8).log(1/2) # optional - sage.libs.pari + sage: (1/8).log(1/2) 3 - sage: (1/2).log(1/8) # optional - sage.libs.pari + sage: (1/2).log(1/8) 1/3 - sage: (1/2).log(8) # optional - sage.libs.pari + sage: (1/2).log(8) -1/3 - sage: (16/81).log(8/27) # optional - sage.libs.pari + sage: (16/81).log(8/27) # needs sage.libs.pari 4/3 - sage: (8/27).log(16/81) # optional - sage.libs.pari + sage: (8/27).log(16/81) # needs sage.libs.pari 3/4 - sage: log(27/8, 16/81) # optional - sage.libs.pari + sage: log(27/8, 16/81) # needs sage.libs.pari -3/4 - sage: log(16/81, 27/8) # optional - sage.libs.pari + sage: log(16/81, 27/8) # needs sage.libs.pari -4/3 - sage: (125/8).log(5/2) # optional - sage.libs.pari + sage: (125/8).log(5/2) # needs sage.libs.pari 3 - sage: (125/8).log(5/2, prec=53) # optional - sage.rings.real_mpfr + sage: (125/8).log(5/2, prec=53) # needs sage.rings.real_mpfr 3.00000000000000 TESTS:: - sage: (25/2).log(5/2) # optional - sage.symbolic + sage: (25/2).log(5/2) # needs sage.symbolic log(25/2)/log(5/2) - sage: (-1/2).log(3) # optional - sage.symbolic + sage: (-1/2).log(3) # needs sage.symbolic (I*pi + log(1/2))/log(3) """ cdef int self_sgn @@ -3223,22 +3224,23 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: - sage: gamma(1/2) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: gamma(1/2) sqrt(pi) - sage: gamma(7/2) # optional - sage.symbolic + sage: gamma(7/2) 15/8*sqrt(pi) - sage: gamma(-3/2) # optional - sage.symbolic + sage: gamma(-3/2) 4/3*sqrt(pi) - sage: gamma(6/1) # optional - sage.symbolic + sage: gamma(6/1) 120 - sage: gamma(1/3) # optional - sage.symbolic + sage: gamma(1/3) gamma(1/3) This function accepts an optional precision argument:: - sage: (1/3).gamma(prec=100) # optional - sage.rings.real_mpfr + sage: (1/3).gamma(prec=100) # needs sage.rings.real_mpfr 2.6789385347077476336556929410 - sage: (1/2).gamma(prec=100) # optional - sage.rings.real_mpfr + sage: (1/2).gamma(prec=100) # needs sage.rings.real_mpfr 1.7724538509055160272981674833 TESTS: @@ -3774,11 +3776,11 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: sage: n = 9390823/17 - sage: m = n.__pari__(); m # optional - sage.libs.pari + sage: m = n.__pari__(); m # needs sage.libs.pari 9390823/17 - sage: type(m) # optional - sage.libs.pari + sage: type(m) # needs sage.libs.pari - sage: m.type() # optional - sage.libs.pari + sage: m.type() # needs sage.libs.pari 't_FRAC' """ global new_gen_from_rational diff --git a/src/sage/rings/rational_field.py b/src/sage/rings/rational_field.py index ee665002556..8efdc093636 100644 --- a/src/sage/rings/rational_field.py +++ b/src/sage/rings/rational_field.py @@ -16,17 +16,17 @@ :: - sage: RealField(9).pi() # optional - sage.rings.real_mpfr + sage: RealField(9).pi() # needs sage.rings.real_mpfr 3.1 - sage: QQ(RealField(9).pi()) # optional - sage.rings.real_mpfr + sage: QQ(RealField(9).pi()) # needs sage.rings.real_mpfr 22/7 - sage: QQ(RealField().pi()) # optional - sage.rings.real_mpfr + sage: QQ(RealField().pi()) # needs sage.rings.real_mpfr 245850922/78256779 sage: QQ(35) 35 sage: QQ('12/347') 12/347 - sage: QQ(exp(pi*I)) + sage: QQ(exp(pi*I)) # needs sage.symbolic -1 sage: x = polygen(ZZ) sage: QQ((3*x)/(4*x)) @@ -86,7 +86,7 @@ class RationalField(Singleton, number_field_base.NumberField): -930482/9320842317 sage: QQ([9320842317]) 9320842317 - sage: QQ(pari(39029384023840928309482842098430284398243982394)) # optional - sage.libs.pari + sage: QQ(pari(39029384023840928309482842098430284398243982394)) # needs sage.libs.pari 39029384023840928309482842098430284398243982394 sage: QQ('sage') Traceback (most recent call last): @@ -98,11 +98,11 @@ class RationalField(Singleton, number_field_base.NumberField): :: - sage: QQ(RR(3929329/32)) # optional - sage.rings.real_mpfr + sage: QQ(RR(3929329/32)) 3929329/32 - sage: QQ(-RR(3929329/32)) # optional - sage.rings.real_mpfr + sage: QQ(-RR(3929329/32)) -3929329/32 - sage: QQ(RR(1/7)) - 1/7 # optional - sage.rings.real_mpfr + sage: QQ(RR(1/7)) - 1/7 # needs sage.rings.real_mpfr 0 If you specify the optional second argument ``base``, then the string @@ -110,26 +110,27 @@ class RationalField(Singleton, number_field_base.NumberField): :: - sage: QQ(23.2, 2) # optional - sage.rings.real_mpfr + sage: # needs sage.rings.real_mpfr + sage: QQ(23.2, 2) 6530219459687219/281474976710656 - sage: 6530219459687219.0/281474976710656 # optional - sage.rings.real_mpfr + sage: 6530219459687219.0/281474976710656 23.20000000000000 - sage: a = 23.2; a # optional - sage.rings.real_mpfr + sage: a = 23.2; a 23.2000000000000 - sage: QQ(a, 10) # optional - sage.rings.real_mpfr + sage: QQ(a, 10) 116/5 Here's a nice example involving elliptic curves:: - sage: # optional - sage.rings.real_mpfr sage.schemes - sage: E = EllipticCurve('11a') # optional - sage.schemes - sage: L = E.lseries().at1(300)[0]; L # optional - sage.schemes + sage: # needs sage.rings.real_mpfr sage.schemes + sage: E = EllipticCurve('11a') + sage: L = E.lseries().at1(300)[0]; L 0.2538418608559106843377589233... - sage: O = E.period_lattice().omega(); O # optional - sage.schemes + sage: O = E.period_lattice().omega(); O 1.26920930427955 - sage: t = L/O; t # optional - sage.schemes + sage: t = L/O; t 0.200000000000000 - sage: QQ(RealField(45)(t)) # optional - sage.rings.real_mpfr sage.schemes + sage: QQ(RealField(45)(t)) 1/5 """ def __new__(cls): @@ -325,9 +326,9 @@ def completion(self, p, prec, extras={}): EXAMPLES:: - sage: QQ.completion(infinity, 53) # optional - sage.rings.real_mpfr + sage: QQ.completion(infinity, 53) # needs sage.rings.real_mpfr Real Field with 53 bits of precision - sage: QQ.completion(5, 15, {'print_mode': 'bars'}) # optional - sage.rings.padics + sage: QQ.completion(5, 15, {'print_mode': 'bars'}) # needs sage.rings.padics 5-adic Field with capped relative precision 15 """ from sage.rings.infinity import Infinity @@ -442,7 +443,7 @@ def __truediv__(self, I): EXAMPLES:: - sage: QQ / ZZ # optional - sage.groups + sage: QQ / ZZ # needs sage.groups Q/Z """ from sage.rings.ideal import Ideal_generic @@ -527,9 +528,9 @@ def primes_of_bounded_norm_iter(self, B): EXAMPLES:: sage: it = QQ.primes_of_bounded_norm_iter(10) - sage: list(it) # optional - sage.libs.pari + sage: list(it) # needs sage.libs.pari [2, 3, 5, 7] - sage: list(QQ.primes_of_bounded_norm_iter(1)) # optional - sage.libs.pari + sage: list(QQ.primes_of_bounded_norm_iter(1)) [] """ try: @@ -607,14 +608,14 @@ def embeddings(self, K): sage: QQ.embeddings(QQ) [Identity endomorphism of Rational Field] - sage: QQ.embeddings(CyclotomicField(5)) # optional - sage.rings.number_field + sage: QQ.embeddings(CyclotomicField(5)) # needs sage.rings.number_field [Coercion map: From: Rational Field To: Cyclotomic Field of order 5 and degree 4] `K` must have characteristic 0:: - sage: QQ.embeddings(GF(3)) # optional - sage.rings.finite_rings + sage: QQ.embeddings(GF(3)) Traceback (most recent call last): ... ValueError: no embeddings of the rational field into K. @@ -658,7 +659,7 @@ def places(self, all_complex=False, prec=None): EXAMPLES:: - sage: QQ.places() # optional - sage.rings.real_mpfr + sage: QQ.places() # needs sage.rings.real_mpfr [Ring morphism: From: Rational Field To: Real Field with 53 bits of precision @@ -668,7 +669,7 @@ def places(self, all_complex=False, prec=None): From: Rational Field To: Real Double Field Defn: 1 |--> 1.0] - sage: QQ.places(prec=200, all_complex=True) # optional - sage.rings.real_mpfr + sage: QQ.places(prec=200, all_complex=True) # needs sage.rings.real_mpfr [Ring morphism: From: Rational Field To: Complex Field with 200 bits of precision @@ -705,12 +706,12 @@ def complex_embedding(self, prec=53): EXAMPLES:: - sage: QQ.complex_embedding() # optional - sage.rings.real_mpfr + sage: QQ.complex_embedding() # needs sage.rings.real_mpfr Ring morphism: From: Rational Field To: Complex Field with 53 bits of precision Defn: 1 |--> 1.00000000000000 - sage: QQ.complex_embedding(20) # optional - sage.rings.real_mpfr + sage: QQ.complex_embedding(20) # needs sage.rings.real_mpfr Ring morphism: From: Rational Field To: Complex Field with 20 bits of precision @@ -736,9 +737,9 @@ def residue_field(self, p, check=True): EXAMPLES:: - sage: QQ.residue_field(5) + sage: QQ.residue_field(5) # needs sage.rings.finite_rings Residue field of Integers modulo 5 - sage: QQ.residue_field(next_prime(10^9)) + sage: QQ.residue_field(next_prime(10^9)) # needs sage.rings.finite_rings Residue field of Integers modulo 1000000007 """ from sage.rings.finite_rings.residue_field import ResidueField @@ -769,37 +770,37 @@ def hilbert_symbol_negative_at_S(self, S, b, check=True): EXAMPLES:: - sage: QQ.hilbert_symbol_negative_at_S([-1,5,3,2,7,11,13,23], -10/7) # optional - sage.rings.padics + sage: QQ.hilbert_symbol_negative_at_S([-1,5,3,2,7,11,13,23], -10/7) # needs sage.rings.padics -9867 - sage: QQ.hilbert_symbol_negative_at_S([3, 5, QQ.places()[0], 11], -15) # optional - sage.rings.padics + sage: QQ.hilbert_symbol_negative_at_S([3, 5, QQ.places()[0], 11], -15) # needs sage.rings.padics -33 - sage: QQ.hilbert_symbol_negative_at_S([3, 5], 2) # optional - sage.rings.padics + sage: QQ.hilbert_symbol_negative_at_S([3, 5], 2) # needs sage.rings.padics 15 TESTS:: - sage: QQ.hilbert_symbol_negative_at_S(5/2, -2) # optional - sage.libs.pari sage.modules + sage: QQ.hilbert_symbol_negative_at_S(5/2, -2) # needs sage.libs.pari sage.modules Traceback (most recent call last): ... TypeError: first argument must be a list or integer :: - sage: QQ.hilbert_symbol_negative_at_S([1, 3], 0) # optional - sage.libs.pari sage.modules + sage: QQ.hilbert_symbol_negative_at_S([1, 3], 0) # needs sage.libs.pari sage.modules Traceback (most recent call last): ... ValueError: second argument must be nonzero :: - sage: QQ.hilbert_symbol_negative_at_S([-1, 3, 5], 2) # optional - sage.libs.pari sage.modules + sage: QQ.hilbert_symbol_negative_at_S([-1, 3, 5], 2) # needs sage.libs.pari sage.modules Traceback (most recent call last): ... ValueError: list should be of even cardinality :: - sage: QQ.hilbert_symbol_negative_at_S([1, 3], 2) # optional - sage.libs.pari sage.modules + sage: QQ.hilbert_symbol_negative_at_S([1, 3], 2) # needs sage.libs.pari sage.modules Traceback (most recent call last): ... ValueError: all entries in list must be prime or -1 for @@ -807,7 +808,7 @@ def hilbert_symbol_negative_at_S(self, S, b, check=True): :: - sage: QQ.hilbert_symbol_negative_at_S([5, 7], 2) # optional - sage.libs.pari sage.modules + sage: QQ.hilbert_symbol_negative_at_S([5, 7], 2) # needs sage.libs.pari sage.modules Traceback (most recent call last): ... ValueError: second argument must be a nonsquare with @@ -815,14 +816,14 @@ def hilbert_symbol_negative_at_S(self, S, b, check=True): :: - sage: QQ.hilbert_symbol_negative_at_S([1, 3], sqrt(2)) # optional - sage.libs.pari sage.modules + sage: QQ.hilbert_symbol_negative_at_S([1, 3], sqrt(2)) # needs sage.libs.pari sage.modules sage.symbolic Traceback (most recent call last): ... TypeError: second argument must be a rational number :: - sage: QQ.hilbert_symbol_negative_at_S([-1, 3], 2) # optional - sage.libs.pari sage.modules + sage: QQ.hilbert_symbol_negative_at_S([-1, 3], 2) # needs sage.libs.pari sage.modules Traceback (most recent call last): ... ValueError: if the infinite place is in the list, the second @@ -1063,16 +1064,16 @@ def extension(self, poly, names, **kwds): We make a single absolute extension:: sage: x = polygen(QQ, 'x') - sage: K. = QQ.extension(x^3 + 5); K # optional - sage.rings.number_field + sage: K. = QQ.extension(x^3 + 5); K # needs sage.rings.number_field Number Field in a with defining polynomial x^3 + 5 We make an extension generated by roots of two polynomials:: - sage: K. = QQ.extension([x^3 + 5, x^2 + 3]); K # optional - sage.rings.number_field + sage: K. = QQ.extension([x^3 + 5, x^2 + 3]); K # needs sage.rings.number_field Number Field in a with defining polynomial x^3 + 5 over its base field - sage: b^2 # optional - sage.rings.number_field + sage: b^2 # needs sage.rings.number_field -3 - sage: a^3 # optional - sage.rings.number_field + sage: a^3 # needs sage.rings.number_field -5 """ from sage.rings.number_field.number_field import NumberField @@ -1084,7 +1085,7 @@ def algebraic_closure(self): EXAMPLES:: - sage: QQ.algebraic_closure() # optional - sage.rings.number_field + sage: QQ.algebraic_closure() # needs sage.rings.number_field Algebraic Field """ from sage.rings.qqbar import QQbar @@ -1417,43 +1418,44 @@ def selmer_space(self, S, p, proof=None): When `S` is empty, `\QQ(S,p)` is only nontrivial for `p=2`:: - sage: QS2, QS2gens, fromQS2, toQS2 = QQ.selmer_space([], 2) # optional - sage.rings.number_field - sage: QS2 # optional - sage.rings.number_field + sage: QS2, QS2gens, fromQS2, toQS2 = QQ.selmer_space([], 2) # needs sage.rings.number_field + sage: QS2 # needs sage.rings.number_field Vector space of dimension 1 over Finite Field of size 2 - sage: QS2gens # optional - sage.rings.number_field + sage: QS2gens # needs sage.rings.number_field [-1] - sage: all(QQ.selmer_space([], p)[0].dimension() == 0 # optional - sage.libs.pari + sage: all(QQ.selmer_space([], p)[0].dimension() == 0 # needs sage.libs.pari ....: for p in primes(3, 10)) True In general there is one generator for each `p\in S`, and an additional generator of `-1` when `p=2`:: - sage: QS2, QS2gens, fromQS2, toQS2 = QQ.selmer_space([5,7], 2) # optional - sage.modules - sage: QS2 # optional - sage.modules + sage: # needs sage.modules sage.rings.number_field + sage: QS2, QS2gens, fromQS2, toQS2 = QQ.selmer_space([5,7], 2) + sage: QS2 Vector space of dimension 3 over Finite Field of size 2 - sage: QS2gens # optional - sage.modules + sage: QS2gens [5, 7, -1] - sage: toQS2(-7) # optional - sage.modules + sage: toQS2(-7) (0, 1, 1) - sage: fromQS2((0,1,1)) # optional - sage.modules + sage: fromQS2((0,1,1)) -7 The map ``fromQS2`` is only well-defined modulo `p`'th powers (in this case, modulo squares):: - sage: toQS2(-5/7) # optional - sage.modules + sage: toQS2(-5/7) # needs sage.modules sage.rings.number_field (1, 1, 1) - sage: fromQS2((1,1,1)) # optional - sage.modules + sage: fromQS2((1,1,1)) # needs sage.modules sage.rings.number_field -35 - sage: ((-5/7)/(-35)).is_square() # optional - sage.modules + sage: ((-5/7)/(-35)).is_square() True The map ``toQS2`` is not defined on all of `\QQ^*`, only on those numbers which are squares away from `5` and `7`:: - sage: toQS2(210) # optional - sage.modules + sage: toQS2(210) # needs sage.modules sage.rings.number_field Traceback (most recent call last): ... ValueError: argument 210 should have valuations divisible by 2 @@ -1523,7 +1525,7 @@ def _gap_init_(self): EXAMPLES:: - sage: gap(QQ) # indirect doctest # optional - sage.libs.gap + sage: gap(QQ) # indirect doctest # needs sage.libs.gap Rationals """ return 'Rationals' @@ -1591,7 +1593,7 @@ def _sympy_(self): EXAMPLES:: - sage: QQ._sympy_() # optional - sympy + sage: QQ._sympy_() # needs sympy Rationals """ from sympy import Rationals @@ -1637,20 +1639,20 @@ def _factor_univariate_polynomial(self, f): TESTS:: sage: R. = QQ[] - sage: QQ._factor_univariate_polynomial(x) # optional - sage.libs.pari + sage: QQ._factor_univariate_polynomial(x) # needs sage.libs.pari x - sage: QQ._factor_univariate_polynomial(2*x) # optional - sage.libs.pari + sage: QQ._factor_univariate_polynomial(2*x) # needs sage.libs.pari (2) * x - sage: QQ._factor_univariate_polynomial((x^2 - 1/4)^4) # optional - sage.libs.pari + sage: QQ._factor_univariate_polynomial((x^2 - 1/4)^4) # needs sage.libs.pari (x - 1/2)^4 * (x + 1/2)^4 - sage: QQ._factor_univariate_polynomial((2*x + 1) * (3*x^2 - 5)^2) # optional - sage.libs.pari + sage: QQ._factor_univariate_polynomial((2*x + 1) * (3*x^2 - 5)^2) # needs sage.libs.pari (18) * (x + 1/2) * (x^2 - 5/3)^2 - sage: f = prod((k^2*x^k + k)^(k-1) for k in primes(10)) # optional - sage.libs.pari - sage: QQ._factor_univariate_polynomial(f) # optional - sage.libs.pari + sage: f = prod((k^2*x^k + k)^(k-1) for k in primes(10)) # needs sage.libs.pari + sage: QQ._factor_univariate_polynomial(f) # needs sage.libs.pari (1751787911376562500) * (x^2 + 1/2) * (x^3 + 1/3)^2 * (x^5 + 1/5)^4 * (x^7 + 1/7)^6 - sage: QQ._factor_univariate_polynomial(10*x^5 - 1) # optional - sage.libs.pari + sage: QQ._factor_univariate_polynomial(10*x^5 - 1) # needs sage.libs.pari (10) * (x^5 - 1/10) - sage: QQ._factor_univariate_polynomial(10*x^5 - 10) # optional - sage.libs.pari + sage: QQ._factor_univariate_polynomial(10*x^5 - 10) # needs sage.libs.pari (10) * (x - 1) * (x^4 + x^3 + x^2 + x + 1) """ @@ -1668,9 +1670,9 @@ def valuation(self, p): EXAMPLES:: - sage: v = QQ.valuation(3); v # optional - sage.rings.padics + sage: v = QQ.valuation(3); v # needs sage.rings.padics 3-adic valuation - sage: v(1/3) # optional - sage.rings.padics + sage: v(1/3) # needs sage.rings.padics -1 .. SEEALSO:: diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx index 9eec35e882e..3a93dc4645b 100644 --- a/src/sage/rings/real_arb.pyx +++ b/src/sage/rings/real_arb.pyx @@ -28,9 +28,9 @@ Sage :class:`RealBall` objects wrap Arb objects of type ``arb_t``. A real ball represents a ball over the real numbers, that is, an interval `[m-r,m+r]` where the midpoint `m` and the radius `r` are (extended) real numbers:: - sage: RBF(pi) + sage: RBF(pi) # needs sage.symbolic [3.141592653589793 +/- ...e-16] - sage: RBF(pi).mid(), RBF(pi).rad() + sage: RBF(pi).mid(), RBF(pi).rad() # needs sage.symbolic (3.14159265358979, ...e-16) The midpoint is represented as an arbitrary-precision floating-point number @@ -147,7 +147,7 @@ Comparisons with Sage symbolic infinities work with some limitations:: True sage: RBF(infinity) < infinity False - sage: RBF(NaN) < infinity + sage: RBF(NaN) < infinity # needs sage.symbolic Traceback (most recent call last): ... ValueError: infinite but not with +/- phase @@ -159,14 +159,14 @@ Comparisons with Sage symbolic infinities work with some limitations:: Comparisons between elements of real ball fields, however, support special values and should be preferred:: - sage: RBF(NaN) < RBF(infinity) + sage: RBF(NaN) < RBF(infinity) # needs sage.symbolic False sage: RBF(0).add_error(infinity) <= RBF(infinity) True TESTS:: - sage: (RBF(pi) * identity_matrix(QQ, 3)).parent() + sage: (RBF(pi) * identity_matrix(QQ, 3)).parent() # needs sage.symbolic Full MatrixSpace of 3 by 3 dense matrices over Real ball field with 53 bits of precision @@ -175,11 +175,11 @@ TESTS:: :: - sage: SR.coerce(RBF(0.42)) # optional - sage.symbolic + sage: SR.coerce(RBF(0.42)) # needs sage.symbolic [0.4200000000000000 +/- ...e-17] - sage: RBF(0.42) + SR(1) # optional - sage.symbolic + sage: RBF(0.42) + SR(1) # needs sage.symbolic [1.420000000000000 +/- ...e-16] - sage: _.parent() # optional - sage.symbolic + sage: _.parent() # needs sage.symbolic Symbolic Ring Classes and Methods @@ -338,7 +338,7 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField): :: - sage: (1/2*RBF(1)) + AA(sqrt(2)) - 1 + polygen(QQ, 'x') # optional - sage.symbolic + sage: (1/2*RBF(1)) + AA(sqrt(2)) - 1 + polygen(QQ, 'x') # needs sage.symbolic x + [0.914213562373095 +/- ...e-16] TESTS:: @@ -362,9 +362,9 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField): sage: RBF.zero() 0 - sage: NF. = QuadraticField(2, embedding=AA(2).sqrt()) - sage: a = (sqrt2 - 1)^1000 - sage: RBF(a) + sage: NF. = QuadraticField(2, embedding=AA(2).sqrt()) # needs sage.rings.number_field + sage: a = (sqrt2 - 1)^1000 # needs sage.rings.number_field + sage: RBF(a) # needs sage.rings.number_field [1.676156872756536e-383 +/- ...e-399] sage: RealBallField().is_finite() @@ -456,7 +456,7 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField): False sage: RealBallField().has_coerce_map_from(RIF) False - sage: RealBallField().has_coerce_map_from(SR) # optional - sage.symbolic + sage: RealBallField().has_coerce_map_from(SR) # needs sage.symbolic False sage: RealBallField().has_coerce_map_from(RR) False @@ -509,34 +509,34 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField): [+/- 1.01] sage: RBF(1) 1.000000000000000 - sage: RBF(x) + sage: RBF(x) # needs sage.symbolic Traceback (most recent call last): ... TypeError: unable to convert x to a RealBall Various symbolic constants are supported:: - sage: RBF(e) + sage: RBF(e) # needs sage.symbolic [2.718281828459045 +/- ...e-16] - sage: RBF(pi) + sage: RBF(pi) # needs sage.symbolic [3.141592653589793 +/- ...e-16] Symbolic expressions are parsed :: - sage: RBF(4*zeta(3)) + sage: RBF(4*zeta(3)) # needs sage.symbolic [4.8082276126383...] - sage: RBF(exp(1), 0.01) + sage: RBF(exp(1), 0.01) # needs sage.symbolic [2.7 +/- ...] TESTS: The following conversions used to yield incorrect results:: - sage: RBF(airy_ai(1)) + sage: RBF(airy_ai(1)) # needs sage.symbolic [0.135292416312881...] - sage: v = RBF(zetaderiv(1, 3/2)); v + sage: v = RBF(zetaderiv(1, 3/2)); v # needs sage.symbolic [-3.932239737431101 +/- 5.58e-16] - sage: v.overlaps(RealBallField(100)(3/2).zetaderiv(1)) + sage: v.overlaps(RealBallField(100)(3/2).zetaderiv(1)) # needs sage.symbolic True """ @@ -816,7 +816,7 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField): TESTS:: - sage: RBF.sinpi(RLF(sqrt(2))) + sage: RBF.sinpi(RLF(sqrt(2))) # needs sage.symbolic [-0.963902532849877 +/- ...e-16] """ cdef RealBall res, x_as_ball @@ -860,7 +860,7 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField): TESTS:: - sage: RBF.cospi(RLF(sqrt(2))) + sage: RBF.cospi(RLF(sqrt(2))) # needs sage.symbolic [-0.26625534204142 +/- ...e-15] """ cdef RealBall res, x_as_ball @@ -908,7 +908,7 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField): TESTS:: - sage: RBF.gamma(RLF(pi)) # abs tol 1e-13 + sage: RBF.gamma(RLF(pi)) # abs tol 1e-13 # needs sage.symbolic [2.28803779534003 +/- 4.12e-15] """ cdef RealBall res @@ -1258,7 +1258,7 @@ cdef class RealBall(RingElement): sage: RBF(3, 0.125) [3e+0 +/- 0.126] - sage: RBF(pi, 0.125r) + sage: RBF(pi, 0.125r) # needs sage.symbolic [3e+0 +/- 0.267] sage: RBF(3, 1/8) [3e+0 +/- 0.126] @@ -1267,8 +1267,8 @@ cdef class RealBall(RingElement): :: - sage: NF. = QuadraticField(2) - sage: RBF(1/5 + sqrt2/2) + sage: NF. = QuadraticField(2) # needs sage.rings.number_field + sage: RBF(1/5 + sqrt2/2) # needs sage.rings.number_field [0.907106781186547 +/- ...e-16] Note that integers and floating-point numbers are ''not'' rounded to @@ -1535,9 +1535,11 @@ cdef class RealBall(RingElement): TESTS:: - sage: [loads(dumps(b)).identical(b) for b in - ....: [RealBallField(60).pi(), RBF(infinity), RBF(NaN)]] - [True, True, True] + sage: [loads(dumps(b)).identical(b) + ....: for b in [RealBallField(60).pi(), RBF(infinity)]] + [True, True] + sage: b = RBF(NaN); loads(dumps(b)).identical(b) # needs sage.symbolic + True """ cdef bytes py_val sig_on() @@ -1582,7 +1584,7 @@ cdef class RealBall(RingElement): Traceback (most recent call last): ... ValueError: [+/- 2.01] does not contain a unique integer - sage: ZZ(RBF(pi)) + sage: ZZ(RBF(pi)) # needs sage.symbolic Traceback (most recent call last): ... ValueError: [3.141592653589793 +/- ...e-16] does not contain a unique integer @@ -1629,6 +1631,7 @@ cdef class RealBall(RingElement): EXAMPLES:: + sage: # needs sage.symbolic sage: mypi = RBF(pi) sage: RR(mypi) 3.14159265358979 @@ -2069,13 +2072,13 @@ cdef class RealBall(RingElement): their parent's nominal precision (see :mod:`~sage.rings.real_arb` for more information):: - sage: b = RBF(pi.n(100)) - sage: b.mid() + sage: b = RBF(pi.n(100)) # needs sage.symbolic + sage: b.mid() # needs sage.symbolic 3.141592653589793238462643383 The ``round()`` method rounds such a ball to its parent's precision:: - sage: b.round().mid() + sage: b.round().mid() # needs sage.symbolic 3.14159265358979 .. SEEALSO:: :meth:`trim` @@ -2097,11 +2100,11 @@ cdef class RealBall(RingElement): EXAMPLES:: - sage: RBF(pi).accuracy() + sage: RBF(pi).accuracy() # needs sage.symbolic 52 sage: RBF(1).accuracy() == RBF.maximal_accuracy() True - sage: RBF(NaN).accuracy() == -RBF.maximal_accuracy() + sage: RBF(NaN).accuracy() == -RBF.maximal_accuracy() # needs sage.symbolic True .. SEEALSO:: :meth:`~RealBallField.maximal_accuracy` @@ -2204,7 +2207,7 @@ cdef class RealBall(RingElement): EXAMPLES:: sage: RBF = RealBallField() - sage: RBF(pi).is_nonzero() + sage: RBF(pi).is_nonzero() # needs sage.symbolic True sage: RBF(RIF(-0.5, 0.5)).is_nonzero() False @@ -2563,9 +2566,9 @@ cdef class RealBall(RingElement): EXAMPLES:: - sage: RBF(pi).overlaps(RBF(pi) + 2**(-100)) + sage: RBF(pi).overlaps(RBF(pi) + 2**(-100)) # needs sage.symbolic True - sage: RBF(pi).overlaps(RBF(3)) + sage: RBF(pi).overlaps(RBF(3)) # needs sage.symbolic False """ return arb_overlaps(self.value, other.value) @@ -2599,7 +2602,7 @@ cdef class RealBall(RingElement): sage: RBF(1/3).contains_exact(1/3) True - sage: RBF(sqrt(2)).contains_exact(sqrt(2)) + sage: RBF(sqrt(2)).contains_exact(sqrt(2)) # needs sage.symbolic Traceback (most recent call last): ... TypeError: unsupported type: @@ -2645,12 +2648,12 @@ cdef class RealBall(RingElement): EXAMPLES:: - sage: sqrt(2) in RBF(sqrt(2)) + sage: sqrt(2) in RBF(sqrt(2)) # needs sage.symbolic True A false negative:: - sage: sqrt(2) in RBF(RealBallField(100)(sqrt(2))) + sage: sqrt(2) in RBF(RealBallField(100)(sqrt(2))) # needs sage.symbolic False .. SEEALSO:: :meth:`contains_exact` @@ -2730,7 +2733,7 @@ cdef class RealBall(RingElement): True sage: RBF(-infinity).is_infinity() True - sage: RBF(NaN).is_infinity() + sage: RBF(NaN).is_infinity() # needs sage.symbolic True sage: (~RBF(0)).is_infinity() True @@ -2745,7 +2748,7 @@ cdef class RealBall(RingElement): EXAMPLES:: - sage: RBF(NaN).is_NaN() + sage: RBF(NaN).is_NaN() # needs sage.symbolic True sage: RBF(-5).gamma().is_NaN() True @@ -2860,7 +2863,7 @@ cdef class RealBall(RingElement): EXAMPLES:: - sage: RBF(pi)/RBF(e) + sage: RBF(pi)/RBF(e) # needs sage.symbolic [1.155727349790922 +/- ...e-16] sage: RBF(2)/RBF(0) nan @@ -2875,6 +2878,7 @@ cdef class RealBall(RingElement): """ EXAMPLES:: + sage: # needs sage.symbolic sage: RBF(e)^17 [24154952.7535753 +/- ...e-8] sage: RBF(e)^(-1) @@ -2890,14 +2894,14 @@ cdef class RealBall(RingElement): nan sage: RBF(0)^(-1) nan - sage: RBF(-e)**RBF(pi) + sage: RBF(-e)**RBF(pi) # needs sage.symbolic nan TESTS:: - sage: RBF(e)**(2r) + sage: RBF(e)**(2r) # needs sage.symbolic [7.38905609893065 +/- ...e-15] - sage: RBF(e)**(-1r) + sage: RBF(e)**(-1r) # needs sage.symbolic [0.367879441171442 +/- ...e-16] """ cdef fmpz_t tmpz @@ -3216,7 +3220,7 @@ cdef class RealBall(RingElement): EXAMPLES:: - sage: RBF(pi).sin() + sage: RBF(pi).sin() # needs sage.symbolic [+/- ...e-16] .. SEEALSO:: :meth:`~sage.rings.real_arb.RealBallField.sinpi` @@ -3233,7 +3237,7 @@ cdef class RealBall(RingElement): EXAMPLES:: - sage: RBF(pi).cos() + sage: RBF(pi).cos() # needs sage.symbolic [-1.00000000000000 +/- ...e-16] .. SEEALSO:: :meth:`~sage.rings.real_arb.RealBallField.cospi` @@ -3252,7 +3256,7 @@ cdef class RealBall(RingElement): sage: RBF(1).tan() [1.557407724654902 +/- ...e-16] - sage: RBF(pi/2).tan() + sage: RBF(pi/2).tan() # needs sage.symbolic nan """ cdef RealBall res = self._new() @@ -3269,7 +3273,7 @@ cdef class RealBall(RingElement): sage: RBF(1).cot() [0.642092615934331 +/- ...e-16] - sage: RBF(pi).cot() + sage: RBF(pi).cot() # needs sage.symbolic nan """ cdef RealBall res = self._new() @@ -3547,7 +3551,7 @@ cdef class RealBall(RingElement): TESTS:: - sage: RBF(Ei(1)) # abs tol 5e-16 + sage: RBF(Ei(1)) # abs tol 5e-16 # needs sage.symbolic [1.89511781635594 +/- 4.94e-15] """ cdef RealBall res = self._new() @@ -3567,7 +3571,7 @@ cdef class RealBall(RingElement): TESTS:: - sage: RBF(Si(1)) # abs tol 1e-15 + sage: RBF(Si(1)) # abs tol 1e-15 # needs sage.symbolic [0.946083070367183 +/- 9.22e-16] """ cdef RealBall res = self._new() @@ -3589,7 +3593,7 @@ cdef class RealBall(RingElement): TESTS:: - sage: RBF(Ci(1)) # abs tol 5e-16 + sage: RBF(Ci(1)) # abs tol 5e-16 # needs sage.symbolic [0.337403922900968 +/- 3.25e-16] """ cdef RealBall res = self._new() @@ -3611,7 +3615,7 @@ cdef class RealBall(RingElement): TESTS:: - sage: RBF(Shi(1)) + sage: RBF(Shi(1)) # needs sage.symbolic [1.05725087537573 +/- 2.77e-15] """ cdef RealBall res = self._new() @@ -3633,7 +3637,7 @@ cdef class RealBall(RingElement): TESTS:: - sage: RBF(Chi(1)) # abs tol 1e-17 + sage: RBF(Chi(1)) # abs tol 1e-17 # needs sage.symbolic [0.837866940980208 +/- 4.72e-16] """ cdef RealBall res = self._new() @@ -3655,9 +3659,9 @@ cdef class RealBall(RingElement): TESTS:: - sage: RBF(li(0)) + sage: RBF(li(0)) # needs sage.symbolic 0 - sage: RBF(Li(0)) + sage: RBF(Li(0)) # needs sage.symbolic [-1.04516378011749 +/- 4.23e-15] """ cdef RealBall res = self._new() @@ -3701,7 +3705,7 @@ cdef class RealBall(RingElement): EXAMPLES:: - sage: RBF(sin(3)).beta(RBF(2/3).sqrt()) # abs tol 1e-13 + sage: RBF(sin(3)).beta(RBF(2/3).sqrt()) # abs tol 1e-13 # needs sage.symbolic [7.407661629415 +/- 1.07e-13] sage: RealBallField(100)(7/2).beta(1) # abs tol 1e-30 [0.28571428571428571428571428571 +/- 5.23e-30] @@ -3936,11 +3940,11 @@ cdef class RealBall(RingElement): EXAMPLES:: - sage: polylog(0, -1) + sage: polylog(0, -1) # needs sage.symbolic -1/2 sage: RBF(-1).polylog(0) [-0.50000000000000 +/- ...e-16] - sage: polylog(1, 1/2) + sage: polylog(1, 1/2) # needs sage.symbolic -log(1/2) sage: RBF(1/2).polylog(1) [0.69314718055995 +/- ...e-15] @@ -3979,6 +3983,7 @@ cdef class RealBall(RingElement): EXAMPLES:: + sage: # needs sage.symbolic sage: RBF(pi).chebyshev_T(0) 1.000000000000000 sage: RBF(pi).chebyshev_T(1) @@ -4011,6 +4016,7 @@ cdef class RealBall(RingElement): EXAMPLES:: + sage: # needs sage.symbolic sage: RBF(pi).chebyshev_U(0) 1.000000000000000 sage: RBF(pi).chebyshev_U(1) @@ -4044,7 +4050,7 @@ cdef class RealBall(RingElement): sage: RBF(1).agm(1) 1.000000000000000 - sage: RBF(sqrt(2)).agm(1)^(-1) + sage: RBF(sqrt(2)).agm(1)^(-1) # needs sage.symbolic [0.8346268416740...] """ cdef RealBall other_as_ball diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index ffa28ed5866..7fa6e4c6847 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -128,15 +128,16 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): numbers and higher-precision ones, though of course there may be loss of precision:: - sage: a = RealField(200)(2).sqrt(); a # needs sage.rings.real_mpfr + sage: # needs sage.rings.real_mpfr + sage: a = RealField(200)(2).sqrt(); a 1.4142135623730950488016887242096980785696718753769480731767 - sage: b = RDF(a); b # needs sage.rings.real_mpfr + sage: b = RDF(a); b 1.4142135623730951 - sage: a.parent()(b) # needs sage.rings.real_mpfr + sage: a.parent()(b) 1.4142135623730951454746218587388284504413604736328125000000 - sage: a.parent()(b) == b # needs sage.rings.real_mpfr + sage: a.parent()(b) == b True - sage: b == RR(a) # needs sage.rings.real_mpfr + sage: b == RR(a) True TESTS:: @@ -797,13 +798,14 @@ cdef class RealDoubleElement(FieldElement): Adding or subtracting an ulp always gives a different number:: - sage: a + a.ulp() == a # needs sage.symbolic + sage: # needs sage.symbolic + sage: a + a.ulp() == a False - sage: a - a.ulp() == a # needs sage.symbolic + sage: a - a.ulp() == a False - sage: b + b.ulp() == b # needs sage.symbolic + sage: b + b.ulp() == b False - sage: b - b.ulp() == b # needs sage.symbolic + sage: b - b.ulp() == b False Since the default rounding mode is round-to-nearest, adding or @@ -1265,24 +1267,25 @@ cdef class RealDoubleElement(FieldElement): EXAMPLES:: - sage: a = RDF(exp(1.0)); a # needs sage.symbolic + sage: # needs sage.symbolic + sage: a = RDF(exp(1.0)); a 2.718281828459045 - sage: sign,mantissa,exponent = RDF(exp(1.0)).sign_mantissa_exponent() # needs sage.symbolic - sage: sign,mantissa,exponent # needs sage.symbolic + sage: sign,mantissa,exponent = RDF(exp(1.0)).sign_mantissa_exponent() + sage: sign,mantissa,exponent (1, 6121026514868073, -51) - sage: sign*mantissa*(2**exponent) == a # needs sage.symbolic + sage: sign*mantissa*(2**exponent) == a True The mantissa is always a nonnegative number:: - sage: RDF(-1).sign_mantissa_exponent() + sage: RDF(-1).sign_mantissa_exponent() # needs sage.rings.real_mpfr (-1, 4503599627370496, -52) TESTS:: - sage: RDF('+0').sign_mantissa_exponent() + sage: RDF('+0').sign_mantissa_exponent() # needs sage.rings.real_mpfr (1, 0, 0) - sage: RDF('-0').sign_mantissa_exponent() + sage: RDF('-0').sign_mantissa_exponent() # needs sage.rings.real_mpfr (-1, 0, 0) """ from sage.rings.real_mpfr import RR @@ -1672,7 +1675,7 @@ cdef class RealDoubleElement(FieldElement): EXAMPLES:: - sage: CDF(RDF(1/3)) # indirect doctest + sage: CDF(RDF(1/3)) # indirect doctest # needs sage.rings.complex_double 0.3333333333333333 """ return CDF(self._value) @@ -1846,7 +1849,7 @@ cdef class RealDoubleElement(FieldElement): :: sage: r = RDF(-2.0) - sage: r.sqrt() + sage: r.sqrt() # needs sage.rings.complex_double 1.4142135623730951*I :: @@ -1855,7 +1858,7 @@ cdef class RealDoubleElement(FieldElement): [1.4142135623730951, -1.4142135623730951] sage: RDF(0).sqrt(all=True) [0.0] - sage: RDF(-2).sqrt(all=True) + sage: RDF(-2).sqrt(all=True) # needs sage.rings.complex_double [1.4142135623730951*I, -1.4142135623730951*I] """ if self._value >= 0: diff --git a/src/sage/rings/real_double_element_gsl.pyx b/src/sage/rings/real_double_element_gsl.pyx index d03c0271d1a..8b6b3671605 100644 --- a/src/sage/rings/real_double_element_gsl.pyx +++ b/src/sage/rings/real_double_element_gsl.pyx @@ -249,7 +249,7 @@ cdef class RealDoubleElement_gsl(RealDoubleElement): 0.6931471805599453 sage: RDF(2).log(2) 1.0 - sage: RDF(2).log(pi) + sage: RDF(2).log(pi) # needs sage.symbolic 0.6055115613982801 sage: RDF(2).log(10) 0.30102999566398114 @@ -334,7 +334,7 @@ cdef class RealDoubleElement_gsl(RealDoubleElement): sage: r = RDF('16.0'); r.log10() 1.2041199826559248 - sage: r.log() / RDF(log(10)) + sage: r.log() / RDF(log(10)) # needs sage.symbolic 1.2041199826559246 sage: r = RDF('39.9'); r.log10() 1.6009728956867482 @@ -355,7 +355,7 @@ cdef class RealDoubleElement_gsl(RealDoubleElement): sage: r = RDF(16); r.logpi() 2.4220462455931204 - sage: r.log() / RDF(log(pi)) + sage: r.log() / RDF(log(pi)) # needs sage.symbolic 2.4220462455931204 sage: r = RDF('39.9'); r.logpi() 3.2203023346075152 @@ -508,11 +508,11 @@ cdef class RealDoubleElement_gsl(RealDoubleElement): EXAMPLES:: - sage: RDF(pi).restrict_angle() + sage: RDF(pi).restrict_angle() # needs sage.symbolic 3.141592653589793 - sage: RDF(pi + 1e-10).restrict_angle() + sage: RDF(pi + 1e-10).restrict_angle() # needs sage.symbolic -3.1415926534897936 - sage: RDF(1+10^10*pi).restrict_angle() + sage: RDF(1+10^10*pi).restrict_angle() # needs sage.symbolic 0.9999977606... """ return self._new_c(gsl_sf_angle_restrict_symm(self._value)) diff --git a/src/sage/rings/real_lazy.pyx b/src/sage/rings/real_lazy.pyx index 9fd6d547625..6dbfce3d494 100644 --- a/src/sage/rings/real_lazy.pyx +++ b/src/sage/rings/real_lazy.pyx @@ -15,9 +15,9 @@ TESTS: Bug :trac:`21991`:: - sage: a = QuadraticField(5).gen() - sage: u = -573147844013817084101/2*a + 1281597540372340914251/2 - sage: RealIntervalField(128)(RLF(u)).is_exact() + sage: a = QuadraticField(5).gen() # needs sage.rings.number_field + sage: u = -573147844013817084101/2*a + 1281597540372340914251/2 # needs sage.rings.number_field + sage: RealIntervalField(128)(RLF(u)).is_exact() # needs sage.rings.number_field False """ @@ -747,6 +747,7 @@ cdef class LazyFieldElement(FieldElement): When the absolute value is involved, the result might be real:: + sage: # needs sage.symbolic sage: z = exp(CLF(1 + I/2)); z 2.38551673095914? + 1.303213729686996?*I sage: r = z.abs(); r @@ -854,7 +855,7 @@ cdef class LazyFieldElement(FieldElement): TESTS:: - sage: "log" in RLF(sqrt(8)).__dir__() + sage: "log" in RLF(sqrt(8)).__dir__() # needs sage.symbolic True """ @@ -869,9 +870,9 @@ cdef class LazyFieldElement(FieldElement): sage: a = RLF(3) sage: a.sqrt() 1.732050807568878? - sage: sin(a) + sage: sin(a) # needs sage.symbolic 0.1411200080598673? - sage: RealField(160)(tanh(RLF(3))) + sage: RealField(160)(tanh(RLF(3))) # needs sage.symbolic 0.99505475368673045133188018525548847509781385470 """ if name in named_unops: @@ -885,6 +886,7 @@ cdef class LazyFieldElement(FieldElement): EXAMPLES:: + sage: # needs sage.symbolic sage: a = RLF(sqrt(2)) + RLF(sqrt(3)) sage: cf = a.continued_fraction() sage: cf @@ -902,8 +904,8 @@ def make_element(parent, *args): EXAMPLES:: - sage: a = RLF(pi) + RLF(sqrt(1/2)) # indirect doctest - sage: bool(loads(dumps(a)) == a) + sage: a = RLF(pi) + RLF(sqrt(1/2)) # indirect doctest # needs sage.symbolic + sage: bool(loads(dumps(a)) == a) # needs sage.symbolic True """ return parent(*args) @@ -1042,8 +1044,8 @@ cdef class LazyWrapper(LazyFieldElement): EXAMPLES:: - sage: a = RLF(sqrt(2)) - sage: a.continued_fraction() + sage: a = RLF(sqrt(2)) # needs sage.symbolic + sage: a.continued_fraction() # needs sage.symbolic [1; 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ...] """ from sage.rings.continued_fraction import ContinuedFraction_real, ContinuedFraction_infinite @@ -1231,8 +1233,8 @@ cdef class LazyUnop(LazyFieldElement): sage: a = LazyUnop(RLF, 3, sqrt) sage: a.depth() 1 - sage: b = LazyUnop(RLF, a, sin) - sage: b.depth() + sage: b = LazyUnop(RLF, a, sin) # needs sage.symbolic + sage: b.depth() # needs sage.symbolic 2 """ return 1 + self._arg.depth() @@ -1245,7 +1247,7 @@ cdef class LazyUnop(LazyFieldElement): sage: from sage.rings.real_lazy import LazyUnop sage: a = LazyUnop(RLF, 3, sqrt) - sage: a.eval(ZZ) + sage: a.eval(ZZ) # needs sage.symbolic sqrt(3) """ arg = self._arg.eval(R) @@ -1261,7 +1263,7 @@ cdef class LazyUnop(LazyFieldElement): EXAMPLES:: - sage: hash(RLF(sin(1))) == hash(RLF(sin(1))) + sage: hash(RLF(sin(1))) == hash(RLF(sin(1))) # needs sage.symbolic True """ return hash(self._op(hash(self._arg))) diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx index 1193a14baff..6577ec8e733 100644 --- a/src/sage/rings/real_mpfi.pyx +++ b/src/sage/rings/real_mpfi.pyx @@ -47,7 +47,7 @@ preceding digit is possibly wrong by `\pm 1`. :: - sage: RIF(sqrt(2)) + sage: RIF(sqrt(2)) # needs sage.symbolic 1.414213562373095? However, if the interval is precise (its lower bound is equal to @@ -81,11 +81,11 @@ it is taken to be 1. '125.?2' sage: RIF(123, 127).str(error_digits=1) '125.?2' - sage: v = RIF(-e, pi); v + sage: v = RIF(-e, pi); v # needs sage.symbolic 0.?e1 - sage: v.str(error_digits=1) + sage: v.str(error_digits=1) # needs sage.symbolic '1.?4' - sage: v.str(error_digits=5) + sage: v.str(error_digits=5) # needs sage.symbolic '0.2117?29300' Error digits also sometimes let us indicate that the interval is @@ -230,10 +230,10 @@ specified if given a non-interval and an interval:: TESTS:: - sage: import numpy # optional - numpy - sage: RIF(2) == numpy.int8('2') # optional - numpy + sage: import numpy # needs numpy + sage: RIF(2) == numpy.int8('2') # needs numpy True - sage: numpy.int8('2') == RIF(2) # optional - numpy + sage: numpy.int8('2') == RIF(2) # needs numpy True sage: RIF(0,1) < float('2') Traceback (most recent call last): @@ -389,7 +389,7 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField): 3 sage: RIF(RIF(3)) 3 - sage: RIF(pi) + sage: RIF(pi) # needs sage.symbolic 3.141592653589794? sage: RIF(RealField(53)('1.5')) 1.5000000000000000? @@ -452,9 +452,9 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField): sage: def check(x): ....: return (x, x.lower() == x.upper()) - sage: check(RIF(pi)) + sage: check(RIF(pi)) # needs sage.symbolic (3.141592653589794?, False) - sage: check(RIF(RR(pi))) + sage: check(RIF(RR(pi))) # needs sage.symbolic (3.1415926535897932?, True) sage: check(RIF(1.5)) (1.5000000000000000?, True) @@ -486,11 +486,11 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField): 3 sage: R(R(3)) 3 - sage: R(pi) + sage: R(pi) # needs sage.symbolic 3.14159265358979323846264338328? sage: R(-2/19) -0.1052631578947368421052631578948? - sage: R(e,pi).str(style='brackets') + sage: R(e,pi).str(style='brackets') # needs sage.symbolic '[2.7182818284590452353602874713512 .. 3.1415926535897932384626433832825]' TESTS:: @@ -1050,7 +1050,7 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField): sage: magma(RealIntervalField(80)) # optional - magma # indirect doctest Real field of precision 24 - sage: floor(RR(log(2**80, 10))) + sage: floor(RR(log(2**80, 10))) # needs sage.symbolic 24 """ return "RealField(%s : Bits := true)" % self.prec() @@ -1356,7 +1356,7 @@ cdef class RealIntervalFieldElement(RingElement): error:: sage: a = RealInterval('2.3') - sage: maxima(a) + sage: maxima(a) # needs sage.symbolic Traceback (most recent call last): ... TypeError @@ -1370,10 +1370,11 @@ cdef class RealIntervalFieldElement(RingElement): EXAMPLES:: - sage: sage_input(RIF(e, pi), verify=True) + sage: sage_input(RIF(e, pi), verify=True) # needs sage.symbolic # Verified RIF(RR(2.7182818284590451), RR(3.1415926535897936)) - sage: sage_input(RealIntervalField(64)(sqrt(2)), preparse=False, verify=True) + sage: sage_input(RealIntervalField(64)(sqrt(2)), # needs sage.symbolic + ....: preparse=False, verify=True) # Verified RR64 = RealField(64) RealIntervalField(64)(RR64('1.41421356237309504876'), RR64('1.41421356237309504887')) @@ -1386,8 +1387,9 @@ cdef class RealIntervalFieldElement(RingElement): RealIntervalField(2)(RR2(12.), RR2(16.)) sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() - sage: RIF(-sqrt(3), -sqrt(2))._sage_input_(sib, False) - {call: {atomic:RIF}({unop:- {call: {atomic:RR}({atomic:1.7320508075688774})}}, {unop:- {call: {atomic:RR}({atomic:1.4142135623730949})}})} + sage: RIF(-sqrt(3), -sqrt(2))._sage_input_(sib, False) # needs sage.symbolic + {call: {atomic:RIF}({unop:- {call: {atomic:RR}({atomic:1.7320508075688774})}}, + {unop:- {call: {atomic:RR}({atomic:1.4142135623730949})}})} """ # Interval printing could often be much prettier, # but I'm feeling lazy :) @@ -1406,7 +1408,7 @@ cdef class RealIntervalFieldElement(RingElement): EXAMPLES:: - sage: hash(RIF(e)) == hash(RIF(e)) # indirect doctest + sage: hash(RIF(e)) == hash(RIF(e)) # indirect doctest # needs sage.symbolic True """ return hash(self.str(16)) @@ -1491,11 +1493,11 @@ cdef class RealIntervalFieldElement(RingElement): ``'brackets'`` style. In question style (the default), we print the "known correct" part of the number, followed by a question mark:: - sage: RIF(pi).str() + sage: RIF(pi).str() # needs sage.symbolic '3.141592653589794?' - sage: RIF(pi, 22/7).str() + sage: RIF(pi, 22/7).str() # needs sage.symbolic '3.142?' - sage: RIF(pi, 22/7).str(style='question') + sage: RIF(pi, 22/7).str(style='question') # needs sage.symbolic '3.142?' However, if the interval is precisely equal to some integer that's @@ -1545,9 +1547,9 @@ cdef class RealIntervalFieldElement(RingElement): We always use brackets style for ``NaN`` and infinities:: - sage: RIF(pi, infinity) + sage: RIF(pi, infinity) # needs sage.symbolic [3.1415926535897931 .. +infinity] - sage: RIF(NaN) + sage: RIF(NaN) # needs sage.symbolic [.. NaN ..] Let's take a closer, formal look at the question style. In its full @@ -1620,11 +1622,11 @@ cdef class RealIntervalFieldElement(RingElement): '3.14223?64' sage: pi_appr.str(base=36) '3.6?' - sage: RIF(NaN) + sage: RIF(NaN) # needs sage.symbolic [.. NaN ..] - sage: RIF(pi, infinity) + sage: RIF(pi, infinity) # needs sage.symbolic [3.1415926535897931 .. +infinity] - sage: RIF(-infinity, pi) + sage: RIF(-infinity, pi) # needs sage.symbolic [-infinity .. 3.1415926535897936] sage: RealIntervalField(210)(3).sqrt() 1.732050807568877293527446341505872366942805253810380628055806980? @@ -1632,7 +1634,7 @@ cdef class RealIntervalFieldElement(RingElement): 1.732050807568878? sage: RIF(3).sqrt() 1.732050807568878? - sage: RIF(0, 3^-150) + sage: RIF(0, 3^-150) # needs sage.symbolic 1.?e-71 TESTS: @@ -2311,7 +2313,7 @@ cdef class RealIntervalFieldElement(RingElement): sage: RIF(1,2).endpoints() (1.00000000000000, 2.00000000000000) - sage: RIF(pi).endpoints() + sage: RIF(pi).endpoints() # needs sage.symbolic (3.14159265358979, 3.14159265358980) sage: a = CIF(RIF(1,2), RIF(3,4)) sage: a.real().endpoints() @@ -2342,7 +2344,7 @@ cdef class RealIntervalFieldElement(RingElement): sage: RIF(1,2).edges() (1, 2) - sage: RIF(pi).edges() + sage: RIF(pi).edges() # needs sage.symbolic (3.1415926535897932?, 3.1415926535897936?) """ left = self._new() @@ -2363,7 +2365,7 @@ cdef class RealIntervalFieldElement(RingElement): EXAMPLES:: - sage: RIF(1, pi).absolute_diameter() + sage: RIF(1, pi).absolute_diameter() # needs sage.symbolic 2.14159265358979 """ cdef RealNumber x @@ -2378,7 +2380,7 @@ cdef class RealIntervalFieldElement(RingElement): EXAMPLES:: - sage: RIF(1, pi).relative_diameter() + sage: RIF(1, pi).relative_diameter() # needs sage.symbolic 1.03418797197910 """ cdef RealNumber x @@ -2399,17 +2401,17 @@ cdef class RealIntervalFieldElement(RingElement): 1.00000000000000 sage: RIF(1, 2).relative_diameter() 0.666666666666667 - sage: RIF(pi).diameter() + sage: RIF(pi).diameter() # needs sage.symbolic 1.41357985842823e-16 - sage: RIF(pi).absolute_diameter() + sage: RIF(pi).absolute_diameter() # needs sage.symbolic 4.44089209850063e-16 - sage: RIF(pi).relative_diameter() + sage: RIF(pi).relative_diameter() # needs sage.symbolic 1.41357985842823e-16 - sage: (RIF(pi) - RIF(3, 22/7)).diameter() + sage: (RIF(pi) - RIF(3, 22/7)).diameter() # needs sage.symbolic 0.142857142857144 - sage: (RIF(pi) - RIF(3, 22/7)).absolute_diameter() + sage: (RIF(pi) - RIF(3, 22/7)).absolute_diameter() # needs sage.symbolic 0.142857142857144 - sage: (RIF(pi) - RIF(3, 22/7)).relative_diameter() + sage: (RIF(pi) - RIF(3, 22/7)).relative_diameter() # needs sage.symbolic 2.03604377705518 """ cdef RealNumber x @@ -2431,31 +2433,31 @@ cdef class RealIntervalFieldElement(RingElement): EXAMPLES:: - sage: RIF(pi).fp_rank_diameter() + sage: RIF(pi).fp_rank_diameter() # needs sage.symbolic 1 sage: RIF(12345).fp_rank_diameter() 0 - sage: RIF(-sqrt(2)).fp_rank_diameter() + sage: RIF(-sqrt(2)).fp_rank_diameter() # needs sage.symbolic 1 sage: RIF(5/8).fp_rank_diameter() 0 sage: RIF(5/7).fp_rank_diameter() 1 - sage: a = RIF(pi)^12345; a + sage: a = RIF(pi)^12345; a # needs sage.symbolic 2.06622879260?e6137 - sage: a.fp_rank_diameter() + sage: a.fp_rank_diameter() # needs sage.symbolic 30524 - sage: (RIF(sqrt(2)) - RIF(sqrt(2))).fp_rank_diameter() + sage: (RIF(sqrt(2)) - RIF(sqrt(2))).fp_rank_diameter() # needs sage.symbolic 9671406088542672151117826 # 32-bit 41538374868278620559869609387229186 # 64-bit Just because we have the best possible interval, doesn't mean the interval is actually small:: - sage: a = RIF(pi)^12345678901234567890; a + sage: a = RIF(pi)^12345678901234567890; a # needs sage.symbolic [2.0985787164673874e323228496 .. +infinity] # 32-bit [5.8756537891115869e1388255822130839282 .. +infinity] # 64-bit - sage: a.fp_rank_diameter() + sage: a.fp_rank_diameter() # needs sage.symbolic 1 """ return self.lower().fp_rank_delta(self.upper()) @@ -2469,7 +2471,7 @@ cdef class RealIntervalFieldElement(RingElement): sage: RIF(3).is_exact() True - sage: RIF(2*pi).is_exact() + sage: RIF(2*pi).is_exact() # needs sage.symbolic False """ return mpfr_equal_p(&self.value.left, &self.value.right) @@ -2543,6 +2545,7 @@ cdef class RealIntervalFieldElement(RingElement): sage: b.lower(), b.upper() (1.50000000000000, 2.00000000000000) + sage: # needs sage.symbolic sage: I = RIF(e, pi) sage: a, b = I.bisection() sage: a.intersection(b) == RIF(I.center()) @@ -3372,9 +3375,9 @@ cdef class RealIntervalFieldElement(RingElement): EXAMPLES:: - sage: RIF(pi).unique_floor() + sage: RIF(pi).unique_floor() # needs sage.symbolic 3 - sage: RIF(100*pi).unique_floor() + sage: RIF(100*pi).unique_floor() # needs sage.symbolic 314 sage: RIF(100, 200).unique_floor() Traceback (most recent call last): @@ -3403,9 +3406,9 @@ cdef class RealIntervalFieldElement(RingElement): EXAMPLES:: - sage: RIF(pi).unique_ceil() + sage: RIF(pi).unique_ceil() # needs sage.symbolic 4 - sage: RIF(100*pi).unique_ceil() + sage: RIF(100*pi).unique_ceil() # needs sage.symbolic 315 sage: RIF(100, 200).unique_ceil() Traceback (most recent call last): @@ -3434,9 +3437,9 @@ cdef class RealIntervalFieldElement(RingElement): EXAMPLES:: - sage: RIF(pi).unique_round() + sage: RIF(pi).unique_round() # needs sage.symbolic 3 - sage: RIF(1000*pi).unique_round() + sage: RIF(1000*pi).unique_round() # needs sage.symbolic 3142 sage: RIF(100, 200).unique_round() Traceback (most recent call last): @@ -3448,7 +3451,7 @@ cdef class RealIntervalFieldElement(RingElement): ValueError: interval does not have a unique round (nearest integer) sage: RIF(0.7, 1.2).unique_round() 1 - sage: RIF(-pi).unique_round() + sage: RIF(-pi).unique_round() # needs sage.symbolic -3 sage: (RIF(4.5).unique_round(), RIF(-4.5).unique_round()) (5, -5) @@ -3521,13 +3524,13 @@ cdef class RealIntervalFieldElement(RingElement): EXAMPLES:: - sage: RIF(pi).unique_integer() + sage: RIF(pi).unique_integer() # needs sage.symbolic Traceback (most recent call last): ... ValueError: interval contains no integer - sage: RIF(pi, pi+1).unique_integer() + sage: RIF(pi, pi+1).unique_integer() # needs sage.symbolic 4 - sage: RIF(pi, pi+2).unique_integer() + sage: RIF(pi, pi+2).unique_integer() # needs sage.symbolic Traceback (most recent call last): ... ValueError: interval contains more than one integer @@ -3577,9 +3580,9 @@ cdef class RealIntervalFieldElement(RingElement): EXAMPLES:: - sage: RealIntervalField(10)(pi).simplest_rational() + sage: RealIntervalField(10)(pi).simplest_rational() # needs sage.symbolic 22/7 - sage: RealIntervalField(20)(pi).simplest_rational() + sage: RealIntervalField(20)(pi).simplest_rational() # needs sage.symbolic 355/113 sage: RIF(0.123, 0.567).simplest_rational() 1/2 @@ -3828,7 +3831,7 @@ cdef class RealIntervalFieldElement(RingElement): True sage: RIF(0) == RIF(0) True - sage: RIF(pi) == RIF(pi) + sage: RIF(pi) == RIF(pi) # needs sage.symbolic False sage: RIF(0, 1) == RIF(1, 2) False @@ -3852,7 +3855,7 @@ cdef class RealIntervalFieldElement(RingElement): False sage: RIF(0) != RIF(0) False - sage: RIF(pi) != RIF(pi) + sage: RIF(pi) != RIF(pi) # needs sage.symbolic False sage: RIF(0, 1) != RIF(1, 2) False @@ -3983,7 +3986,7 @@ cdef class RealIntervalFieldElement(RingElement): True sage: 1.0 in RIF(0, 2) True - sage: pi in RIF(3.1415, 3.1416) + sage: pi in RIF(3.1415, 3.1416) # needs sage.symbolic True sage: 22/7 in RIF(3.1415, 3.1416) False @@ -4115,7 +4118,7 @@ cdef class RealIntervalFieldElement(RingElement): sage: a = RIF(-1, 1).min(0).endpoints() sage: a[0] == -1.0 and a[1].abs() == 0.0 # in MPFI, the sign of 0.0 is not specified True - sage: RIF(-1, 1).min(pi).endpoints() + sage: RIF(-1, 1).min(pi).endpoints() # needs sage.symbolic (-1.00000000000000, 1.00000000000000) sage: RIF(-1, 1).min(RIF(-100, 100)).endpoints() (-100.000000000000, 1.00000000000000) @@ -4400,10 +4403,10 @@ cdef class RealIntervalFieldElement(RingElement): EXAMPLES:: sage: R = RealIntervalField(17) - sage: x = R((-e,pi)) - sage: x2 = x^2; x2.lower(), x2.upper() + sage: x = R((-e, pi)) # needs sage.symbolic + sage: x2 = x^2; x2.lower(), x2.upper() # needs sage.symbolic (0.0000, 9.870) - sage: x3 = x^3; x3.lower(), x3.upper() + sage: x3 = x^3; x3.lower(), x3.upper() # needs sage.symbolic (-26.83, 31.01) """ if exponent == 2: @@ -4616,7 +4619,8 @@ cdef class RealIntervalFieldElement(RingElement): EXAMPLES:: - sage: t=RIF(pi)/2 + sage: # needs sage.symbolic + sage: t = RIF(pi)/2 sage: t.cos() 0.?e-15 sage: t.cos().str(style='brackets') @@ -5070,7 +5074,7 @@ cdef class RealIntervalFieldElement(RingElement): (2.00000000000000, 6.00000000000000) sage: RIF(-1/2).gamma() -3.54490770181104? - sage: gamma(-1/2).n(100) in RIF(-1/2).gamma() + sage: gamma(-1/2).n(100) in RIF(-1/2).gamma() # needs sage.symbolic True sage: RIF1000 = RealIntervalField(1000) sage: 0 in (RIF1000(RealField(2000)(-19/3).gamma()) - RIF1000(-19/3).gamma()) diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index 15fa8bdffe9..ac3a41ce5ef 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -3329,22 +3329,23 @@ cdef class RealNumber(sage.structure.element.RingElement): Pari does maintain the same 250-bit number on both 32-bit and 64-bit platforms:: - sage: RealField(250).pi().__pari__() # needs sage.libs.pari + sage: # needs sage.libs.pari + sage: RealField(250).pi().__pari__() 3.14159265358979 - sage: RR(0.0).__pari__() # needs sage.libs.pari + sage: RR(0.0).__pari__() 0.E-19 - sage: RR(-1.234567).__pari__() # needs sage.libs.pari + sage: RR(-1.234567).__pari__() -1.23456700000000 - sage: RR(2.0).sqrt().__pari__() # needs sage.libs.pari + sage: RR(2.0).sqrt().__pari__() 1.41421356237310 - sage: RR(2.0).sqrt().__pari__().sage() # needs sage.libs.pari + sage: RR(2.0).sqrt().__pari__().sage() 1.41421356237309515 - sage: RR(2.0).sqrt().__pari__().sage().prec() # needs sage.libs.pari + sage: RR(2.0).sqrt().__pari__().sage().prec() 64 - sage: RealField(70)(pi).__pari__().sage().prec() # needs sage.libs.pari sage.symbolic + sage: RealField(70)(pi).__pari__().sage().prec() # needs sage.symbolic 96 # 32-bit 128 # 64-bit - sage: for i in range(100, 200): # needs sage.libs.pari + sage: for i in range(100, 200): ....: assert(RR(i).sqrt() == RR(i).sqrt().__pari__().sage()) TESTS: @@ -3359,11 +3360,12 @@ cdef class RealNumber(sage.structure.element.RingElement): Check that the largest and smallest exponents representable by PARI convert correctly:: - sage: a = pari(0.5) << (sys.maxsize+1)/4 # needs sage.libs.pari - sage: RR(a) >> (sys.maxsize+1)/4 # needs sage.libs.pari + sage: # needs sage.libs.pari + sage: a = pari(0.5) << (sys.maxsize+1)/4 + sage: RR(a) >> (sys.maxsize+1)/4 0.500000000000000 - sage: a = pari(0.5) >> (sys.maxsize-3)/4 # needs sage.libs.pari - sage: RR(a) << (sys.maxsize-3)/4 # needs sage.libs.pari + sage: a = pari(0.5) >> (sys.maxsize-3)/4 + sage: RR(a) << (sys.maxsize-3)/4 0.500000000000000 """ # This uses interfaces of MPFR and PARI which are documented diff --git a/src/sage/rings/ring.pyx b/src/sage/rings/ring.pyx index 48f7e967326..8f2c55db2de 100644 --- a/src/sage/rings/ring.pyx +++ b/src/sage/rings/ring.pyx @@ -132,9 +132,9 @@ cdef class Ring(ParentWithGens): running ._test_some_elements() . . . pass running ._test_zero() . . . pass running ._test_zero_divisors() . . . pass - sage: TestSuite(QQ['x','y']).run(skip='_test_elements') - sage: TestSuite(ZZ['x','y']).run(skip='_test_elements') - sage: TestSuite(ZZ['x','y']['t']).run() + sage: TestSuite(QQ['x','y']).run(skip='_test_elements') # needs sage.libs.singular + sage: TestSuite(ZZ['x','y']).run(skip='_test_elements') # needs sage.libs.singular + sage: TestSuite(ZZ['x','y']['t']).run() # needs sage.libs.singular Test against another bug fixed in :trac:`9944`:: @@ -142,36 +142,38 @@ cdef class Ring(ParentWithGens): Join of Category of euclidean domains and Category of commutative algebras over (number fields and quotient fields and metric spaces) and Category of infinite sets sage: QQ['x','y'].category() - Join of Category of unique factorization domains and Category of commutative algebras over - (number fields and quotient fields and metric spaces) and Category of infinite sets - sage: PolynomialRing(MatrixSpace(QQ,2),'x').category() + Join of Category of unique factorization domains + and Category of commutative algebras + over (number fields and quotient fields and metric spaces) + and Category of infinite sets + sage: PolynomialRing(MatrixSpace(QQ, 2),'x').category() # needs sage.modules Category of infinite algebras over (finite dimensional algebras with basis over (number fields and quotient fields and metric spaces) and infinite sets) - sage: PolynomialRing(SteenrodAlgebra(2),'x').category() + sage: PolynomialRing(SteenrodAlgebra(2),'x').category() # needs sage.combinat sage.modules Category of infinite algebras over (super hopf algebras with basis over Finite Field of size 2 and supercocommutative super coalgebras over Finite Field of size 2) TESTS:: - sage: Zp(7)._repr_option('element_is_atomic') + sage: Zp(7)._repr_option('element_is_atomic') # needs sage.rings.padics False sage: QQ._repr_option('element_is_atomic') True - sage: CDF._repr_option('element_is_atomic') # optional - sage.rings.complex_double + sage: CDF._repr_option('element_is_atomic') # needs sage.rings.complex_double False Check that categories correctly implement `is_finite` and `cardinality`:: sage: QQ.is_finite() False - sage: GF(2^10, 'a').is_finite() # optional - sage.rings.finite_rings + sage: GF(2^10, 'a').is_finite() # needs sage.rings.finite_rings True sage: R. = GF(7)[] sage: R.is_finite() False - sage: S. = R.quo(x^2 + 1) # optional - sage.rings.finite_rings - sage: S.is_finite() # optional - sage.rings.finite_rings + sage: S. = R.quo(x^2 + 1) # needs sage.rings.finite_rings + sage: S.is_finite() # needs sage.rings.finite_rings True sage: Integers(7).cardinality() @@ -255,11 +257,11 @@ cdef class Ring(ParentWithGens): """ EXAMPLES:: - sage: QQ.base_extend(GF(7)) # optional - sage.rings.finite_rings + sage: QQ.base_extend(GF(7)) Traceback (most recent call last): ... TypeError: no base extension defined - sage: ZZ.base_extend(GF(7)) # optional - sage.rings.finite_rings + sage: ZZ.base_extend(GF(7)) Finite Field of size 7 """ if R.has_coerce_map_from(self): @@ -280,7 +282,7 @@ cdef class Ring(ParentWithGens): EXAMPLES:: - sage: FreeAlgebra(QQ, 3, 'x').category() # todo: use a ring which is not an algebra! # optional - sage.combinat sage.modules + sage: FreeAlgebra(QQ, 3, 'x').category() # todo: use a ring which is not an algebra! # needs sage.combinat sage.modules Category of algebras with basis over Rational Field Since a quotient of the integers is its own base ring, and during @@ -310,16 +312,17 @@ cdef class Ring(ParentWithGens): EXAMPLES:: - sage: F. = FreeAlgebra(ZZ, 3) # optional - sage.combinat sage.modules - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.modules - sage: Q = F.quotient(I) # optional - sage.combinat sage.modules - sage: Q.ideal_monoid() # optional - sage.combinat sage.modules + sage: # needs sage.combinat sage.modules + sage: F. = FreeAlgebra(ZZ, 3) + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F + sage: Q = F.quotient(I) + sage: Q.ideal_monoid() Monoid of ideals of Quotient of Free Algebra on 3 generators (x, y, z) over Integer Ring by the ideal (x*y + y*z, x^2 + x*y - y*x - y^2) - sage: F. = FreeAlgebra(ZZ, implementation='letterplace') # optional - sage.combinat sage.modules - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # optional - sage.combinat sage.modules - sage: Q = F.quo(I) # optional - sage.combinat sage.modules - sage: Q.ideal_monoid() # optional - sage.combinat sage.modules + sage: F. = FreeAlgebra(ZZ, implementation='letterplace') + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F + sage: Q = F.quo(I) + sage: Q.ideal_monoid() Monoid of ideals of Quotient of Free Associative Unital Algebra on 3 generators (x, y, z) over Integer Ring by the ideal (x*y + y*z, x*x + x*y - y*x - y*y) @@ -366,10 +369,10 @@ cdef class Ring(ParentWithGens): Here is an example over a non-commutative ring:: - sage: A = SteenrodAlgebra(2) # optional - sage.combinat sage.modules - sage: A.ideal(A.1, A.2^2) # optional - sage.combinat sage.modules + sage: A = SteenrodAlgebra(2) # needs sage.combinat sage.modules + sage: A.ideal(A.1, A.2^2) # needs sage.combinat sage.modules Twosided Ideal (Sq(2), Sq(2,2)) of mod 2 Steenrod algebra, milnor basis - sage: A.ideal(A.1, A.2^2, side='left') # optional - sage.combinat sage.modules + sage: A.ideal(A.1, A.2^2, side='left') # needs sage.combinat sage.modules Left Ideal (Sq(2), Sq(2,2)) of mod 2 Steenrod algebra, milnor basis TESTS: @@ -448,22 +451,23 @@ cdef class Ring(ParentWithGens): EXAMPLES:: - sage: R. = GF(7)[] # optional - sage.rings.finite_rings - sage: (x + y) * R # optional - sage.rings.finite_rings + sage: R. = GF(7)[] + sage: (x + y) * R Ideal (x + y) of Multivariate Polynomial Ring in x, y, z over Finite Field of size 7 - sage: (x + y, z + y^3) * R # optional - sage.rings.finite_rings + sage: (x + y, z + y^3) * R Ideal (x + y, y^3 + z) of Multivariate Polynomial Ring in x, y, z over Finite Field of size 7 The following was implemented in :trac:`7797`:: - sage: A = SteenrodAlgebra(2) # optional - sage.combinat sage.modules - sage: A * [A.1 + A.2, A.1^2] # optional - sage.combinat sage.modules + sage: # needs sage.combinat sage.modules + sage: A = SteenrodAlgebra(2) + sage: A * [A.1 + A.2, A.1^2] Left Ideal (Sq(2) + Sq(4), Sq(1,1)) of mod 2 Steenrod algebra, milnor basis - sage: [A.1 + A.2, A.1^2] * A # optional - sage.combinat sage.modules + sage: [A.1 + A.2, A.1^2] * A Right Ideal (Sq(2) + Sq(4), Sq(1,1)) of mod 2 Steenrod algebra, milnor basis - sage: A * [A.1 + A.2, A.1^2] * A # optional - sage.combinat sage.modules + sage: A * [A.1 + A.2, A.1^2] * A Twosided Ideal (Sq(2) + Sq(4), Sq(1,1)) of mod 2 Steenrod algebra, milnor basis """ @@ -521,24 +525,24 @@ cdef class Ring(ParentWithGens): sage: RR._ideal_class_() - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: R._ideal_class_(1) # optional - sage.rings.finite_rings + sage: R. = GF(5)[] + sage: R._ideal_class_(1) - sage: S = R.quo(x^3 - y^2) # optional - sage.rings.finite_rings - sage: S._ideal_class_(1) # optional - sage.rings.finite_rings + sage: S = R.quo(x^3 - y^2) + sage: S._ideal_class_(1) - sage: S._ideal_class_(2) # optional - sage.rings.finite_rings + sage: S._ideal_class_(2) - sage: T. = S[] # optional - sage.rings.finite_rings - sage: T._ideal_class_(5) # optional - sage.rings.finite_rings + sage: T. = S[] # needs sage.rings.finite_rings + sage: T._ideal_class_(5) # needs sage.rings.finite_rings - sage: T._ideal_class_(1) # optional - sage.rings.finite_rings + sage: T._ideal_class_(1) # needs sage.rings.finite_rings Since :trac:`7797`, non-commutative rings have ideals as well:: - sage: A = SteenrodAlgebra(2) - sage: A._ideal_class_() + sage: A = SteenrodAlgebra(2) # needs sage.combinat sage.modules + sage: A._ideal_class_() # needs sage.combinat sage.modules """ @@ -576,7 +580,7 @@ cdef class Ring(ParentWithGens): EXAMPLES:: - sage: Zp(7).unit_ideal() # optional - sage.rings.padics + sage: Zp(7).unit_ideal() # needs sage.rings.padics Principal ideal (1 + O(7^20)) of 7-adic Ring with capped relative precision 20 """ if self._unit_ideal is None: @@ -607,10 +611,11 @@ cdef class Ring(ParentWithGens): Make sure that :trac:`13644` is fixed:: - sage: K = Qp(3) # optional - sage.rings.padics - sage: R. = K[] # optional - sage.rings.padics - sage: L. = K.extension(a^2-3) # optional - sage.rings.padics - sage: L.ideal(a) # optional - sage.rings.padics + sage: # needs sage.rings.padics + sage: K = Qp(3) + sage: R. = K[] + sage: L. = K.extension(a^2-3) + sage: L.ideal(a) Principal ideal (1 + O(a^40)) of 3-adic Eisenstein Extension Field in a defined by a^2 - 3 """ @@ -678,8 +683,8 @@ cdef class Ring(ParentWithGens): True sage: QQ['x,y,z'].is_commutative() True - sage: Q. = QuaternionAlgebra(QQ, -1, -1) # optional - sage.combinat sage.modules - sage: Q.is_commutative() # optional - sage.combinat sage.modules + sage: Q. = QuaternionAlgebra(QQ, -1, -1) # needs sage.combinat sage.modules + sage: Q.is_commutative() # needs sage.combinat sage.modules False """ if self.is_zero(): @@ -706,7 +711,7 @@ cdef class Ring(ParentWithGens): sage: QQ.is_field() True - sage: GF(9, 'a').is_field() # optional - sage.rings.finite_rings + sage: GF(9, 'a').is_field() # needs sage.rings.finite_rings True sage: ZZ.is_field() False @@ -718,12 +723,12 @@ cdef class Ring(ParentWithGens): This illustrates the use of the ``proof`` parameter:: sage: R. = QQ[] - sage: S. = R.quo((b^3)) # optional - sage.libs.singular - sage: S.is_field(proof=True) # optional - sage.libs.singular + sage: S. = R.quo((b^3)) # needs sage.libs.singular + sage: S.is_field(proof=True) # needs sage.libs.singular Traceback (most recent call last): ... NotImplementedError - sage: S.is_field(proof=False) # optional - sage.libs.singular + sage: S.is_field(proof=False) # needs sage.libs.singular False """ if self.is_zero(): @@ -750,9 +755,9 @@ cdef class Ring(ParentWithGens): True sage: ZZ.is_exact() True - sage: Qp(7).is_exact() # optional - sage.rings.padics + sage: Qp(7).is_exact() # needs sage.rings.padics False - sage: Zp(7, type='capped-abs').is_exact() # optional - sage.rings.padics + sage: Zp(7, type='capped-abs').is_exact() # needs sage.rings.padics False """ return True @@ -768,34 +773,34 @@ cdef class Ring(ParentWithGens): sage: ZZ.is_subring(QQ) True - sage: ZZ.is_subring(GF(19)) # optional - sage.rings.finite_rings + sage: ZZ.is_subring(GF(19)) False TESTS:: sage: QQ.is_subring(QQ['x']) True - sage: QQ.is_subring(GF(7)) # optional - sage.rings.finite_rings + sage: QQ.is_subring(GF(7)) False - sage: QQ.is_subring(CyclotomicField(7)) # optional - sage.rings.number_field + sage: QQ.is_subring(CyclotomicField(7)) # needs sage.rings.number_field True sage: QQ.is_subring(ZZ) False Every ring is a subring of itself, :trac:`17287`:: - sage: QQbar.is_subring(QQbar) # optional - sage.rings.number_field + sage: QQbar.is_subring(QQbar) # needs sage.rings.number_field True - sage: RR.is_subring(RR) # optional - sage.rings.real_mpfr + sage: RR.is_subring(RR) True - sage: CC.is_subring(CC) # optional - sage.rings.real_mpfr + sage: CC.is_subring(CC) # needs sage.rings.real_mpfr True sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - x + 1/10) # optional - sage.rings.number_field - sage: K.is_subring(K) # optional - sage.rings.number_field + sage: K. = NumberField(x^3 - x + 1/10) # needs sage.rings.number_field + sage: K.is_subring(K) # needs sage.rings.number_field True - sage: R. = RR[] # optional - sage.rings.real_mpfr - sage: R.is_subring(R) # optional - sage.rings.real_mpfr + sage: R. = RR[] + sage: R.is_subring(R) True """ if self is other: @@ -814,15 +819,15 @@ cdef class Ring(ParentWithGens): sage: QQ.is_prime_field() True - sage: GF(3).is_prime_field() # optional - sage.rings.finite_rings + sage: GF(3).is_prime_field() True - sage: GF(9, 'a').is_prime_field() # optional - sage.rings.finite_rings + sage: GF(9, 'a').is_prime_field() # needs sage.rings.finite_rings False sage: ZZ.is_prime_field() False sage: QQ['x'].is_prime_field() False - sage: Qp(19).is_prime_field() # optional - sage.rings.padics + sage: Qp(19).is_prime_field() # needs sage.rings.padics False """ return False @@ -853,24 +858,24 @@ cdef class Ring(ParentWithGens): True sage: Integers(8).is_integral_domain() False - sage: Zp(7).is_integral_domain() # optional - sage.rings.padics + sage: Zp(7).is_integral_domain() # needs sage.rings.padics True - sage: Qp(7).is_integral_domain() # optional - sage.rings.padics + sage: Qp(7).is_integral_domain() # needs sage.rings.padics True sage: R. = QQ[] - sage: S. = R.quo((b^3)) # optional - sage.libs.singular - sage: S.is_integral_domain() # optional - sage.libs.singular + sage: S. = R.quo((b^3)) # needs sage.libs.singular + sage: S.is_integral_domain() # needs sage.libs.singular False This illustrates the use of the ``proof`` parameter:: sage: R. = ZZ[] - sage: S. = R.quo((b^3)) # optional - sage.libs.singular - sage: S.is_integral_domain(proof=True) # optional - sage.libs.singular + sage: S. = R.quo((b^3)) # needs sage.libs.singular + sage: S.is_integral_domain(proof=True) # needs sage.libs.singular Traceback (most recent call last): ... NotImplementedError - sage: S.is_integral_domain(proof=False) # optional - sage.libs.singular + sage: S.is_integral_domain(proof=False) # needs sage.libs.singular False TESTS: @@ -878,21 +883,22 @@ cdef class Ring(ParentWithGens): Make sure :trac:`10481` is fixed:: sage: x = polygen(ZZ, 'x') - sage: R. = ZZ['x'].quo(x^2) # optional - sage.libs.pari - sage: R.fraction_field() # optional - sage.libs.pari + sage: R. = ZZ['x'].quo(x^2) # needs sage.libs.pari + sage: R.fraction_field() # needs sage.libs.pari Traceback (most recent call last): ... TypeError: self must be an integral domain. - sage: R.is_integral_domain() # optional - sage.libs.pari + sage: R.is_integral_domain() # needs sage.libs.pari False Forward the proof flag to ``is_field``, see :trac:`22910`:: - sage: R1. = GF(5)[] # optional - sage.rings.finite_rings - sage: F1 = R1.quotient_ring(x^2 + x + 1) # optional - sage.rings.finite_rings - sage: R2. = F1[] # optional - sage.rings.finite_rings - sage: F2 = R2.quotient_ring(x^2 + x + 1) # optional - sage.rings.finite_rings - sage: F2.is_integral_domain(False) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R1. = GF(5)[] + sage: F1 = R1.quotient_ring(x^2 + x + 1) + sage: R2. = F1[] + sage: F2 = R2.quotient_ring(x^2 + x + 1) + sage: F2.is_integral_domain(False) False """ if self.is_field(proof): @@ -925,7 +931,7 @@ cdef class Ring(ParentWithGens): EXAMPLES:: - sage: GF(19).order() # optional - sage.rings.finite_rings + sage: GF(19).order() 19 sage: QQ.order() +Infinity @@ -957,29 +963,29 @@ cdef class Ring(ParentWithGens): -1 sage: QQ.zeta(1) 1 - sage: CyclotomicField(6).zeta(6) # optional - sage.rings.number_field + sage: CyclotomicField(6).zeta(6) # needs sage.rings.number_field zeta6 - sage: CyclotomicField(3).zeta(3) # optional - sage.rings.number_field + sage: CyclotomicField(3).zeta(3) # needs sage.rings.number_field zeta3 - sage: CyclotomicField(3).zeta(3).multiplicative_order() # optional - sage.rings.number_field + sage: CyclotomicField(3).zeta(3).multiplicative_order() # needs sage.rings.number_field 3 - sage: a = GF(7).zeta(); a # optional - sage.rings.finite_rings + sage: a = GF(7).zeta(); a # needs sage.rings.finite_rings 3 - sage: a.multiplicative_order() # optional - sage.rings.finite_rings + sage: a.multiplicative_order() # needs sage.rings.finite_rings 6 - sage: a = GF(49,'z').zeta(); a # optional - sage.rings.finite_rings + sage: a = GF(49,'z').zeta(); a # needs sage.rings.finite_rings z - sage: a.multiplicative_order() # optional - sage.rings.finite_rings + sage: a.multiplicative_order() # needs sage.rings.finite_rings 48 - sage: a = GF(49,'z').zeta(2); a # optional - sage.rings.finite_rings + sage: a = GF(49,'z').zeta(2); a # needs sage.rings.finite_rings 6 - sage: a.multiplicative_order() # optional - sage.rings.finite_rings + sage: a.multiplicative_order() # needs sage.rings.finite_rings 2 sage: QQ.zeta(3) Traceback (most recent call last): ... ValueError: no n-th root of unity in rational field - sage: Zp(7, prec=8).zeta() # optional - sage.rings.padics + sage: Zp(7, prec=8).zeta() # needs sage.rings.padics 3 + 4*7 + 6*7^2 + 3*7^3 + 2*7^5 + 6*7^6 + 2*7^7 + O(7^8) TESTS:: @@ -989,7 +995,7 @@ cdef class Ring(ParentWithGens): 1 sage: Ring.zeta(QQ, 2) -1 - sage: Ring.zeta(QQ, 3) # optional - sage.libs.pari + sage: Ring.zeta(QQ, 3) # needs sage.libs.pari Traceback (most recent call last): ... ValueError: no 3rd root of unity in Rational Field @@ -1026,13 +1032,13 @@ cdef class Ring(ParentWithGens): EXAMPLES:: - sage: CyclotomicField(19).zeta_order() # optional - sage.rings.number_field + sage: CyclotomicField(19).zeta_order() # needs sage.rings.number_field 38 - sage: GF(19).zeta_order() # optional - sage.rings.finite_rings + sage: GF(19).zeta_order() 18 - sage: GF(5^3,'a').zeta_order() # optional - sage.rings.finite_rings + sage: GF(5^3,'a').zeta_order() # needs sage.rings.finite_rings 124 - sage: Zp(7, prec=8).zeta_order() # optional - sage.rings.padics + sage: Zp(7, prec=8).zeta_order() # needs sage.rings.padics 6 """ return self.zeta().multiplicative_order() @@ -1123,9 +1129,9 @@ cdef class Ring(ParentWithGens): sage: RDF.epsilon() 2.220446049250313e-16 - sage: ComplexField(53).epsilon() # optional - sage.rings.real_mpfr + sage: ComplexField(53).epsilon() # needs sage.rings.real_mpfr 2.22044604925031e-16 - sage: RealField(10).epsilon() # optional - sage.rings.real_mpfr + sage: RealField(10).epsilon() # needs sage.rings.real_mpfr 0.0020 For exact rings, zero is returned:: @@ -1135,14 +1141,14 @@ cdef class Ring(ParentWithGens): This also works over derived rings:: - sage: RR['x'].epsilon() # optional - sage.rings.real_mpfr + sage: RR['x'].epsilon() # needs sage.rings.real_mpfr 2.22044604925031e-16 sage: QQ['x'].epsilon() 0 For the symbolic ring, there is no reasonable answer:: - sage: SR.epsilon() # optional - sage.symbolic + sage: SR.epsilon() # needs sage.symbolic Traceback (most recent call last): ... NotImplementedError @@ -1200,11 +1206,11 @@ cdef class CommutativeRing(Ring): EXAMPLES:: - sage: R. = GF(3)[] # optional - sage.rings.finite_rings - sage: R.localization((x*y, x**2 + y**2)) # optional - sage.rings.finite_rings + sage: R. = GF(3)[] + sage: R.localization((x*y, x**2 + y**2)) # needs sage.rings.finite_rings Multivariate Polynomial Ring in x, y over Finite Field of size 3 localized at (y, x, x^2 + y^2) - sage: ~y in _ # optional - sage.rings.finite_rings + sage: ~y in _ # needs sage.rings.finite_rings True """ if not self.is_integral_domain(): @@ -1278,11 +1284,11 @@ cdef class CommutativeRing(Ring): sage: QQ.is_commutative() True - sage: ZpCA(7).is_commutative() # optional - sage.rings.padics + sage: ZpCA(7).is_commutative() # needs sage.rings.padics True - sage: A = QuaternionAlgebra(QQ, -1, -3, names=('i','j','k')); A # optional - sage.combinat sage.modules + sage: A = QuaternionAlgebra(QQ, -1, -3, names=('i','j','k')); A # needs sage.combinat sage.modules Quaternion Algebra (-1, -3) with base ring Rational Field - sage: A.is_commutative() # optional - sage.combinat sage.modules + sage: A.is_commutative() # needs sage.combinat sage.modules False """ return True @@ -1318,18 +1324,19 @@ cdef class CommutativeRing(Ring): All orders in number fields have Krull dimension 1, including non-maximal orders:: - sage: K. = QuadraticField(-1) # optional - sage.rings.number_field - sage: R = K.maximal_order(); R # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(-1) + sage: R = K.maximal_order(); R Gaussian Integers in Number Field in i with defining polynomial x^2 + 1 with i = 1*I - sage: R.krull_dimension() # optional - sage.rings.number_field + sage: R.krull_dimension() 1 - sage: R = K.order(2*i); R # optional - sage.rings.number_field + sage: R = K.order(2*i); R Order in Number Field in i with defining polynomial x^2 + 1 with i = 1*I - sage: R.is_maximal() # optional - sage.rings.number_field + sage: R.is_maximal() False - sage: R.krull_dimension() # optional - sage.rings.number_field + sage: R.krull_dimension() 1 """ raise NotImplementedError @@ -1374,16 +1381,17 @@ cdef class CommutativeRing(Ring): sage: R = QQ['x'] sage: y = polygen(R) - sage: R.extension(y^2 - 5, 'a') # optional - sage.libs.pari + sage: R.extension(y^2 - 5, 'a') # needs sage.libs.pari Univariate Quotient Polynomial Ring in a over Univariate Polynomial Ring in x over Rational Field with modulus a^2 - 5 :: - sage: P. = PolynomialRing(GF(5)) # optional - sage.rings.finite_rings - sage: F. = GF(5).extension(x^2 - 2) # optional - sage.rings.finite_rings - sage: P. = F[] # optional - sage.rings.finite_rings - sage: R. = F.extension(t^2 - a); R # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: P. = PolynomialRing(GF(5)) + sage: F. = GF(5).extension(x^2 - 2) + sage: P. = F[] + sage: R. = F.extension(t^2 - a); R Univariate Quotient Polynomial Ring in b over Finite Field in a of size 5^2 with modulus b^2 + 4*a """ @@ -1421,19 +1429,19 @@ cdef class CommutativeRing(Ring): EXAMPLES:: - sage: K. = PowerSeriesRing(GF(5)) # optional - sage.rings.finite_rings - sage: Frob = K.frobenius_endomorphism(); Frob # optional - sage.rings.finite_rings + sage: K. = PowerSeriesRing(GF(5)) + sage: Frob = K.frobenius_endomorphism(); Frob Frobenius endomorphism x |--> x^5 of Power Series Ring in u over Finite Field of size 5 - sage: Frob(u) # optional - sage.rings.finite_rings + sage: Frob(u) u^5 We can specify a power:: - sage: f = K.frobenius_endomorphism(2); f # optional - sage.rings.finite_rings + sage: f = K.frobenius_endomorphism(2); f Frobenius endomorphism x |--> x^(5^2) of Power Series Ring in u over Finite Field of size 5 - sage: f(1+u) # optional - sage.rings.finite_rings + sage: f(1+u) 1 + u^25 """ from .morphism import FrobeniusEndomorphism_generic @@ -1468,21 +1476,21 @@ cdef class CommutativeRing(Ring): EXAMPLES:: sage: R. = QQ[] - sage: M = R.derivation_module(); M # optional - sage.modules + sage: M = R.derivation_module(); M # needs sage.modules Module of derivations over Multivariate Polynomial Ring in x, y, z over Rational Field - sage: M.gens() # optional - sage.modules + sage: M.gens() # needs sage.modules (d/dx, d/dy, d/dz) We can specify a different codomain:: sage: K = R.fraction_field() - sage: M = R.derivation_module(K); M # optional - sage.modules + sage: M = R.derivation_module(K); M # needs sage.modules Module of derivations from Multivariate Polynomial Ring in x, y, z over Rational Field to Fraction Field of Multivariate Polynomial Ring in x, y, z over Rational Field - sage: M.gen() / x # optional - sage.modules + sage: M.gen() / x # needs sage.modules 1/x*d/dx Here is an example with a non-canonical defining morphism:: @@ -1495,32 +1503,32 @@ cdef class CommutativeRing(Ring): Defn: x |--> 0 y |--> 1 z |--> 2 - sage: M = R.derivation_module(ev) # optional - sage.modules - sage: M # optional - sage.modules + sage: M = R.derivation_module(ev) # needs sage.modules + sage: M # needs sage.modules Module of derivations from Multivariate Polynomial Ring in x, y, z over Rational Field to Rational Field Elements in `M` acts as derivations at `(0,1,2)`:: - sage: Dx = M.gen(0); Dx # optional - sage.modules + sage: Dx = M.gen(0); Dx # needs sage.modules d/dx - sage: Dy = M.gen(1); Dy # optional - sage.modules + sage: Dy = M.gen(1); Dy # needs sage.modules d/dy - sage: Dz = M.gen(2); Dz # optional - sage.modules + sage: Dz = M.gen(2); Dz # needs sage.modules d/dz sage: f = x^2 + y^2 + z^2 - sage: Dx(f) # = 2*x evaluated at (0,1,2) # optional - sage.modules + sage: Dx(f) # = 2*x evaluated at (0,1,2) # needs sage.modules 0 - sage: Dy(f) # = 2*y evaluated at (0,1,2) # optional - sage.modules + sage: Dy(f) # = 2*y evaluated at (0,1,2) # needs sage.modules 2 - sage: Dz(f) # = 2*z evaluated at (0,1,2) # optional - sage.modules + sage: Dz(f) # = 2*z evaluated at (0,1,2) # needs sage.modules 4 An example with a twisting homomorphism:: sage: theta = R.hom([x^2, y^2, z^2]) - sage: M = R.derivation_module(twist=theta); M # optional - sage.modules + sage: M = R.derivation_module(twist=theta); M # needs sage.modules Module of twisted derivations over Multivariate Polynomial Ring in x, y, z over Rational Field (twisting morphism: x |--> x^2, y |--> y^2, z |--> z^2) @@ -1559,23 +1567,23 @@ cdef class CommutativeRing(Ring): EXAMPLES:: sage: R. = QQ[] - sage: R.derivation() # optional - sage.modules + sage: R.derivation() # needs sage.modules d/dx In that case, ``arg`` could be a generator:: - sage: R.derivation(y) # optional - sage.modules + sage: R.derivation(y) # needs sage.modules d/dy or a list of coefficients:: - sage: R.derivation([1,2,3]) # optional - sage.modules + sage: R.derivation([1,2,3]) # needs sage.modules d/dx + 2*d/dy + 3*d/dz It is not possible to define derivations with respect to a polynomial which is not a variable:: - sage: R.derivation(x^2) # optional - sage.modules + sage: R.derivation(x^2) # needs sage.modules Traceback (most recent call last): ... ValueError: unable to create the derivation @@ -1584,18 +1592,18 @@ cdef class CommutativeRing(Ring): sage: R. = QQ[] sage: theta = R.hom([x^2, y^2, z^2]) - sage: f = R.derivation(twist=theta); f # optional - sage.modules + sage: f = R.derivation(twist=theta); f # needs sage.modules 0 - sage: f.parent() # optional - sage.modules + sage: f.parent() # needs sage.modules Module of twisted derivations over Multivariate Polynomial Ring in x, y, z over Rational Field (twisting morphism: x |--> x^2, y |--> y^2, z |--> z^2) Specifying a scalar, the returned twisted derivation is the corresponding multiple of `\theta - id`:: - sage: R.derivation(1, twist=theta) # optional - sage.modules + sage: R.derivation(1, twist=theta) # needs sage.modules [x |--> x^2, y |--> y^2, z |--> z^2] - id - sage: R.derivation(x, twist=theta) # optional - sage.modules + sage: R.derivation(x, twist=theta) # needs sage.modules x*([x |--> x^2, y |--> y^2, z |--> z^2] - id) """ @@ -1713,9 +1721,9 @@ cdef class IntegralDomain(CommutativeRing): True sage: QQ.is_integrally_closed() True - sage: QQbar.is_integrally_closed() # optional - sage.rings.number_field + sage: QQbar.is_integrally_closed() # needs sage.rings.number_field True - sage: GF(5).is_integrally_closed() # optional - sage.rings.finite_rings + sage: GF(5).is_integrally_closed() True sage: Z5 = Integers(5); Z5 Ring of integers modulo 5 @@ -1732,7 +1740,7 @@ cdef class IntegralDomain(CommutativeRing): EXAMPLES:: - sage: GF(7).is_field() # optional - sage.rings.finite_rings + sage: GF(7).is_field() True The following examples have their own ``is_field`` implementations:: @@ -1803,9 +1811,9 @@ cdef class DedekindDomain(IntegralDomain): sage: ZZ.krull_dimension() 1 sage: x = polygen(ZZ, 'x') - sage: K = NumberField(x^2 + 1, 's') # optional - sage.rings.number_field - sage: OK = K.ring_of_integers() # optional - sage.rings.number_field - sage: OK.krull_dimension() # optional - sage.rings.number_field + sage: K = NumberField(x^2 + 1, 's') # needs sage.rings.number_field + sage: OK = K.ring_of_integers() # needs sage.rings.number_field + sage: OK.krull_dimension() # needs sage.rings.number_field 1 The following are not Dedekind domains but have @@ -1822,13 +1830,14 @@ cdef class DedekindDomain(IntegralDomain): sage: U.krull_dimension() 4 - sage: K. = QuadraticField(-1) # optional - sage.rings.number_field - sage: R = K.order(2*i); R # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(-1) + sage: R = K.order(2*i); R Order in Number Field in i with defining polynomial x^2 + 1 with i = 1*I - sage: R.is_maximal() # optional - sage.rings.number_field + sage: R.is_maximal() False - sage: R.krull_dimension() # optional - sage.rings.number_field + sage: R.krull_dimension() 1 """ return 1 @@ -1848,16 +1857,16 @@ cdef class DedekindDomain(IntegralDomain): sage: ZZ.is_integrally_closed() True sage: x = polygen(ZZ, 'x') - sage: K = NumberField(x^2 + 1, 's') # optional - sage.rings.number_field - sage: OK = K.ring_of_integers() # optional - sage.rings.number_field - sage: OK.is_integrally_closed() # optional - sage.rings.number_field + sage: K = NumberField(x^2 + 1, 's') # needs sage.rings.number_field + sage: OK = K.ring_of_integers() # needs sage.rings.number_field + sage: OK.is_integrally_closed() # needs sage.rings.number_field True These, however, are not Dedekind domains:: sage: QQ.is_integrally_closed() True - sage: S = ZZ[sqrt(5)]; S.is_integrally_closed() # optional - sage.rings.number_field sage.symbolic + sage: S = ZZ[sqrt(5)]; S.is_integrally_closed() # needs sage.rings.number_field sage.symbolic False sage: T. = PolynomialRing(QQ, 2); T Multivariate Polynomial Ring in x, y over Rational Field @@ -1873,12 +1882,12 @@ cdef class DedekindDomain(IntegralDomain): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: K = NumberField(x^2 + 1, 's') # optional - sage.rings.number_field - sage: OK = K.ring_of_integers() # optional - sage.rings.number_field - sage: OK.integral_closure() # optional - sage.rings.number_field + sage: K = NumberField(x^2 + 1, 's') # needs sage.rings.number_field + sage: OK = K.ring_of_integers() # needs sage.rings.number_field + sage: OK.integral_closure() # needs sage.rings.number_field Gaussian Integers in Number Field in s with defining polynomial x^2 + 1 - sage: OK.integral_closure() == OK # optional - sage.rings.number_field + sage: OK.integral_closure() == OK # needs sage.rings.number_field True sage: QQ.integral_closure() == QQ @@ -1898,9 +1907,9 @@ cdef class DedekindDomain(IntegralDomain): sage: ZZ.is_noetherian() True sage: x = polygen(ZZ, 'x') - sage: K = NumberField(x^2 + 1, 's') # optional - sage.rings.number_field - sage: OK = K.ring_of_integers() # optional - sage.rings.number_field - sage: OK.is_noetherian() # optional - sage.rings.number_field + sage: K = NumberField(x^2 + 1, 's') # needs sage.rings.number_field + sage: OK = K.ring_of_integers() # needs sage.rings.number_field + sage: OK.is_noetherian() # needs sage.rings.number_field True sage: QQ.is_noetherian() True @@ -1924,7 +1933,7 @@ cdef class PrincipalIdealDomain(IntegralDomain): EXAMPLES:: - sage: Zp(5).is_noetherian() # optional - sage.rings.padics + sage: Zp(5).is_noetherian() # needs sage.rings.padics True """ return True @@ -1935,7 +1944,7 @@ cdef class PrincipalIdealDomain(IntegralDomain): EXAMPLES:: - sage: QQ.class_group() # optional - sage.groups + sage: QQ.class_group() # needs sage.groups Trivial Abelian group """ from sage.groups.abelian_gps.abelian_group import AbelianGroup @@ -1981,22 +1990,22 @@ cdef class PrincipalIdealDomain(IntegralDomain): coercible:: sage: R. = PolynomialRing(QQ) - sage: S. = NumberField(x^2 - 2, 'a') # optional - sage.rings.number_field - sage: f = (x - a)*(x + a); g = (x - a)*(x^2 - 2) # optional - sage.rings.number_field - sage: print(f); print(g) # optional - sage.rings.number_field + sage: S. = NumberField(x^2 - 2, 'a') # needs sage.rings.number_field + sage: f = (x - a)*(x + a); g = (x - a)*(x^2 - 2) # needs sage.rings.number_field + sage: print(f); print(g) # needs sage.rings.number_field x^2 - 2 x^3 - a*x^2 - 2*x + 2*a - sage: f in R # optional - sage.rings.number_field + sage: f in R # needs sage.rings.number_field True - sage: g in R # optional - sage.rings.number_field + sage: g in R # needs sage.rings.number_field False - sage: R.gcd(f, g) # optional - sage.rings.number_field + sage: R.gcd(f, g) # needs sage.rings.number_field Traceback (most recent call last): ... TypeError: Unable to coerce 2*a to a rational - sage: R.base_extend(S).gcd(f,g) # optional - sage.rings.number_field + sage: R.base_extend(S).gcd(f,g) # needs sage.rings.number_field x^2 - 2 - sage: R.base_extend(S).gcd(f, (x - a)*(x^2 - 3)) # optional - sage.rings.number_field + sage: R.base_extend(S).gcd(f, (x - a)*(x^2 - 3)) # needs sage.rings.number_field x - a """ if coerce: @@ -2089,7 +2098,7 @@ cpdef bint _is_Field(x) except -2: True sage: _is_Field(ZZ) False - sage: _is_Field(pAdicField(2)) # optional - sage.rings.padics + sage: _is_Field(pAdicField(2)) # needs sage.rings.padics True sage: _is_Field(5) False @@ -2131,14 +2140,14 @@ cdef class Field(PrincipalIdealDomain): sage: QQ.fraction_field() Rational Field - sage: RR.fraction_field() # optional - sage.rings.real_mpfr + sage: RR.fraction_field() # needs sage.rings.real_mpfr Real Field with 53 bits of precision - sage: CC.fraction_field() # optional - sage.rings.real_mpfr + sage: CC.fraction_field() # needs sage.rings.real_mpfr Complex Field with 53 bits of precision sage: x = polygen(ZZ, 'x') - sage: F = NumberField(x^2 + 1, 'i') # optional - sage.rings.number_field - sage: F.fraction_field() # optional - sage.rings.number_field + sage: F = NumberField(x^2 + 1, 'i') # needs sage.rings.number_field + sage: F.fraction_field() # needs sage.rings.number_field Number Field in i with defining polynomial x^2 + 1 """ return self @@ -2151,10 +2160,10 @@ cdef class Field(PrincipalIdealDomain): sage: QQ._pseudo_fraction_field() Rational Field - sage: K = GF(5) # optional - sage.rings.finite_rings - sage: K._pseudo_fraction_field() # optional - sage.rings.finite_rings + sage: K = GF(5) + sage: K._pseudo_fraction_field() Finite Field of size 5 - sage: K._pseudo_fraction_field() is K # optional - sage.rings.finite_rings + sage: K._pseudo_fraction_field() is K True """ return self @@ -2266,8 +2275,8 @@ cdef class Field(PrincipalIdealDomain): EXAMPLES:: - sage: k = GF(9, 'a') # optional - sage.rings.finite_rings - sage: k.prime_subfield() # optional - sage.rings.finite_rings + sage: k = GF(9, 'a') # needs sage.rings.finite_rings + sage: k.prime_subfield() # needs sage.rings.finite_rings Finite Field of size 3 """ if self.characteristic() == 0: @@ -2307,7 +2316,7 @@ cdef class Algebra(Ring): EXAMPLES:: - sage: A = Algebra(ZZ); A # optional - sage.modules + sage: A = Algebra(ZZ); A # needs sage.modules """ # This is a low-level class. For performance, we trust that the category @@ -2327,12 +2336,13 @@ cdef class Algebra(Ring): EXAMPLES:: - sage: A = Algebra(ZZ); A # optional - sage.modules + sage: # needs sage.modules + sage: A = Algebra(ZZ); A - sage: A.characteristic() # optional - sage.modules + sage: A.characteristic() 0 - sage: A = Algebra(GF(7^3, 'a')) # optional - sage.rings.finite_rings sage.modules - sage: A.characteristic() # optional - sage.rings.finite_rings sage.modules + sage: A = Algebra(GF(7^3, 'a')) # needs sage.rings.finite_rings + sage: A.characteristic() # needs sage.rings.finite_rings 7 """ return self.base_ring().characteristic() @@ -2347,16 +2357,16 @@ cdef class Algebra(Ring): EXAMPLES:: - sage: B = QuaternionAlgebra(2) # optional - sage.combinat sage.modules - sage: B.has_standard_involution() # optional - sage.combinat sage.modules + sage: B = QuaternionAlgebra(2) # needs sage.combinat sage.modules + sage: B.has_standard_involution() # needs sage.combinat sage.modules True sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x**2 - 2) # optional - sage.rings.number_field - sage: A = QuaternionAlgebra(K, -2, 5) # optional - sage.rings.number_field sage.combinat sage.modules - sage: A.has_standard_involution() # optional - sage.rings.number_field sage.combinat sage.modules + sage: K. = NumberField(x**2 - 2) # needs sage.rings.number_field + sage: A = QuaternionAlgebra(K, -2, 5) # needs sage.combinat sage.modules sage.rings.number_field + sage: A.has_standard_involution() # needs sage.combinat sage.modules sage.rings.number_field True - sage: L. = FreeAlgebra(QQ, 2) # optional - sage.combinat sage.modules - sage: L.has_standard_involution() # optional - sage.combinat sage.modules + sage: L. = FreeAlgebra(QQ, 2) # needs sage.combinat sage.modules + sage: L.has_standard_involution() # needs sage.combinat sage.modules Traceback (most recent call last): ... NotImplementedError: has_standard_involution is not implemented for this algebra @@ -2410,7 +2420,7 @@ cdef class CommutativeAlgebra(CommutativeRing): sage: sage.rings.ring.CommutativeAlgebra(QQ) - sage: sage.rings.ring.CommutativeAlgebra(QuaternionAlgebra(QQ, -1, -1)) # optional - sage.combinat sage.modules + sage: sage.rings.ring.CommutativeAlgebra(QuaternionAlgebra(QQ, -1, -1)) # needs sage.combinat sage.modules Traceback (most recent call last): ... TypeError: base ring must be a commutative ring @@ -2457,8 +2467,8 @@ def is_Ring(x): sage: from sage.rings.ring import is_Ring sage: is_Ring(ZZ) True - sage: MS = MatrixSpace(QQ, 2) # optional - sage.modules - sage: is_Ring(MS) # optional - sage.modules + sage: MS = MatrixSpace(QQ, 2) # needs sage.modules + sage: is_Ring(MS) # needs sage.modules True """ return x in _Rings diff --git a/src/sage/rings/ring_extension.pyx b/src/sage/rings/ring_extension.pyx index 4b88454f611..3f4acbef798 100644 --- a/src/sage/rings/ring_extension.pyx +++ b/src/sage/rings/ring_extension.pyx @@ -11,39 +11,40 @@ that is `L`. For example, the following line constructs the extension of finite fields `\mathbf{F}_{5^4}/\mathbf{F}_{5^2}`:: - sage: GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings + sage: GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base By default, Sage reuses the canonical generator of the top ring (here `z_4 \in \mathbf{F}_{5^4}`), together with its name. However, the user can customize them by passing in appropriate arguments:: - sage: F = GF(5^2) # optional - sage.rings.finite_rings - sage: k = GF(5^4) # optional - sage.rings.finite_rings - sage: z4 = k.gen() # optional - sage.rings.finite_rings - sage: K. = k.over(F, gen=1-z4); K # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5^2) + sage: k = GF(5^4) + sage: z4 = k.gen() + sage: K. = k.over(F, gen=1-z4); K Field in a with defining polynomial x^2 + z2*x + 4 over its base The base of the extension is available via the method :meth:`base` (or equivalently :meth:`base_ring`):: - sage: K.base() # optional - sage.rings.finite_rings + sage: K.base() # needs sage.rings.finite_rings Finite Field in z2 of size 5^2 It is also possible to build an extension on top of another extension, obtaining this way a tower of extensions:: - sage: L. = GF(5^8).over(K); L # optional - sage.rings.finite_rings + sage: L. = GF(5^8).over(K); L # needs sage.rings.finite_rings Field in b with defining polynomial x^2 + (4*z2 + 3*a)*x + 1 - a over its base - sage: L.base() # optional - sage.rings.finite_rings + sage: L.base() # needs sage.rings.finite_rings Field in a with defining polynomial x^2 + z2*x + 4 over its base - sage: L.base().base() # optional - sage.rings.finite_rings + sage: L.base().base() # needs sage.rings.finite_rings Finite Field in z2 of size 5^2 The method :meth:`bases` gives access to the complete list of rings in a tower:: - sage: L.bases() # optional - sage.rings.finite_rings + sage: L.bases() # needs sage.rings.finite_rings [Field in b with defining polynomial x^2 + (4*z2 + 3*a)*x + 1 - a over its base, Field in a with defining polynomial x^2 + z2*x + 4 over its base, Finite Field in z2 of size 5^2] @@ -52,44 +53,44 @@ Once we have constructed an extension (or a tower of extensions), we have interesting methods attached to it. As a basic example, one can compute a basis of the top ring over any base in the tower:: - sage: L.basis_over(K) # optional - sage.rings.finite_rings + sage: L.basis_over(K) # needs sage.rings.finite_rings [1, b] - sage: L.basis_over(F) # optional - sage.rings.finite_rings + sage: L.basis_over(F) # needs sage.rings.finite_rings [1, a, b, a*b] When the base is omitted, the default is the natural base of the extension:: - sage: L.basis_over() # optional - sage.rings.finite_rings + sage: L.basis_over() # needs sage.rings.finite_rings [1, b] The method :meth:`sage.rings.ring_extension_element.RingExtensionWithBasis.vector` computes the coordinates of an element according to the above basis:: - sage: u = a + 2*b + 3*a*b # optional - sage.rings.finite_rings - sage: u.vector() # over K # optional - sage.rings.finite_rings + sage: u = a + 2*b + 3*a*b # needs sage.rings.finite_rings + sage: u.vector() # over K # needs sage.rings.finite_rings (a, 2 + 3*a) - sage: u.vector(F) # optional - sage.rings.finite_rings + sage: u.vector(F) # needs sage.rings.finite_rings (0, 1, 2, 3) One can also compute traces and norms with respect to any base of the tower:: - sage: u.trace() # over K # optional - sage.rings.finite_rings + sage: u.trace() # over K # needs sage.rings.finite_rings (2*z2 + 1) + (2*z2 + 1)*a - sage: u.trace(F) # optional - sage.rings.finite_rings + sage: u.trace(F) # needs sage.rings.finite_rings z2 + 1 - sage: u.trace().trace() # over K, then over F # optional - sage.rings.finite_rings + sage: u.trace().trace() # over K, then over F # needs sage.rings.finite_rings z2 + 1 - sage: u.norm() # over K # optional - sage.rings.finite_rings + sage: u.norm() # over K # needs sage.rings.finite_rings (z2 + 1) + (4*z2 + 2)*a - sage: u.norm(F) # optional - sage.rings.finite_rings + sage: u.norm(F) # needs sage.rings.finite_rings 2*z2 + 2 And minimal polynomials:: - sage: u.minpoly() # optional - sage.rings.finite_rings + sage: u.minpoly() # needs sage.rings.finite_rings x^2 + ((3*z2 + 4) + (3*z2 + 4)*a)*x + (z2 + 1) + (4*z2 + 2)*a - sage: u.minpoly(F) # optional - sage.rings.finite_rings + sage: u.minpoly(F) # needs sage.rings.finite_rings x^4 + (4*z2 + 4)*x^3 + x^2 + (z2 + 1)*x + 2*z2 + 2 @@ -165,9 +166,9 @@ def tower_bases(ring, degree): Univariate Polynomial Ring in x over Rational Field], [1]) - sage: K. = Qq(5^2) # optional - sage.rings.padics - sage: L. = K.extension(x^3 - 5) # optional - sage.rings.padics - sage: tower_bases(L, True) # optional - sage.rings.padics + sage: K. = Qq(5^2) # needs sage.rings.padics + sage: L. = K.extension(x^3 - 5) # needs sage.rings.padics + sage: tower_bases(L, True) # needs sage.rings.padics ([5-adic Eisenstein Extension Field in w defined by x^3 - 5 over its base field, 5-adic Unramified Extension Field in a defined by x^2 + 4*x + 2, 5-adic Field with capped relative precision 20], @@ -213,12 +214,12 @@ def common_base(K, L, degree): sage: from sage.rings.ring_extension import common_base - sage: common_base(GF(5^3), GF(5^7), False) # optional - sage.rings.finite_rings + sage: common_base(GF(5^3), GF(5^7), False) # needs sage.rings.finite_rings Finite Field of size 5 - sage: common_base(GF(5^3), GF(5^7), True) # optional - sage.rings.finite_rings + sage: common_base(GF(5^3), GF(5^7), True) # needs sage.rings.finite_rings (Finite Field of size 5, 3, 7) - sage: common_base(GF(5^3), GF(7^5), False) # optional - sage.rings.finite_rings + sage: common_base(GF(5^3), GF(7^5), False) # needs sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError: unable to find a common base @@ -336,12 +337,12 @@ class RingExtensionFactory(UniqueFactory): True sage: x = polygen(ZZ, 'x') - sage: K. = QQ.extension(x^2 - 2) # optional - sage.rings.number_field - sage: E = K.over(QQ); E # optional - sage.rings.number_field + sage: K. = QQ.extension(x^2 - 2) # needs sage.rings.number_field + sage: E = K.over(QQ); E # needs sage.rings.number_field Field in a with defining polynomial x^2 - 2 over its base - sage: E2. = K.over(QQ) # optional - sage.rings.number_field - sage: E2 is E # optional - sage.rings.number_field + sage: E2. = K.over(QQ) # needs sage.rings.number_field + sage: E2 is E # needs sage.rings.number_field False """ def create_key_and_extra_args(self, ring, defining_morphism=None, gens=None, names=None, constructors=None): @@ -381,7 +382,7 @@ class RingExtensionFactory(UniqueFactory): 'print_options': {'print_elements_as': None, 'print_parent_as': None}})]}) - sage: RingExtension.create_key_and_extra_args(GF(5^4), GF(5^2), # optional - sage.rings.finite_rings + sage: RingExtension.create_key_and_extra_args(GF(5^4), GF(5^2), # needs sage.rings.finite_rings ....: names=('a',)) ((Ring morphism: From: Finite Field in z2 of size 5^2 @@ -561,8 +562,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): ... TypeError: only commutative rings are accepted - sage: K = GF(5^3) # optional - sage.rings.finite_rings - sage: K.over(K.frobenius_endomorphism()) # optional - sage.rings.finite_rings + sage: K = GF(5^3) # needs sage.rings.finite_rings + sage: K.over(K.frobenius_endomorphism()) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: exotic defining morphism between two rings in the tower; consider using another variable name @@ -625,12 +626,12 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: K. = QQ.extension(x^2 - 2) # optional - sage.rings.number_field - sage: E = K.over() # over QQ # optional - sage.rings.number_field + sage: K. = QQ.extension(x^2 - 2) # needs sage.rings.number_field + sage: E = K.over() # over QQ # needs sage.rings.number_field - sage: hasattr(E, 'automorphisms') # optional - sage.rings.number_field + sage: hasattr(E, 'automorphisms') # needs sage.rings.number_field True - sage: E.automorphisms() # optional - sage.rings.number_field + sage: E.automorphisms() # needs sage.rings.number_field [Ring endomorphism of Field in a with defining polynomial x^2 - 2 over its base Defn: a |--> a, Ring endomorphism of Field in a with defining polynomial x^2 - 2 over its base @@ -662,10 +663,10 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 2) # optional - sage.rings.number_field - sage: K. = A.over() # optional - sage.rings.number_field + sage: A. = QQ.extension(x^2 - 2) # needs sage.rings.number_field + sage: K. = A.over() # needs sage.rings.number_field - sage: dir(K) # optional - sage.rings.number_field + sage: dir(K) # needs sage.rings.number_field ['CartesianProduct', 'Element', 'Hom', @@ -694,8 +695,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES: - sage: E = GF(5^3).over() # optional - sage.rings.finite_rings - sage: hash(E) # random # optional - sage.rings.finite_rings + sage: E = GF(5^3).over() # needs sage.rings.finite_rings + sage: hash(E) # random # needs sage.rings.finite_rings 140257667982632 """ return hash_by_id(self) @@ -707,10 +708,10 @@ cdef class RingExtension_generic(CommutativeAlgebra): TESTS:: - sage: K = GF(7^3).over() # optional - sage.rings.finite_rings - sage: type(K) # optional - sage.rings.finite_rings + sage: K = GF(7^3).over() # needs sage.rings.finite_rings + sage: type(K) # needs sage.rings.finite_rings - sage: loads(dumps(K)) is K # optional - sage.rings.finite_rings + sage: loads(dumps(K)) is K # needs sage.rings.finite_rings True """ (defining_morphism, gens, names) = self._factory_data[2] @@ -723,8 +724,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: E = GF(5^3).over() # optional - sage.rings.finite_rings - sage: E.construction() # optional - sage.rings.finite_rings + sage: E = GF(5^3).over() # needs sage.rings.finite_rings + sage: E.construction() # needs sage.rings.finite_rings """ # One could define a construction functor K' -> K' otimes_K L, but we leave this to another issue @@ -765,18 +766,18 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: k = GF(5) # optional - sage.rings.finite_rings - sage: K. = GF(5^2).over(k) # optional - sage.rings.finite_rings - sage: L. = GF(5^4).over(K) # optional - sage.rings.finite_rings + sage: k = GF(5) # needs sage.rings.finite_rings + sage: K. = GF(5^2).over(k) # needs sage.rings.finite_rings + sage: L. = GF(5^4).over(K) # needs sage.rings.finite_rings - sage: x = L.from_base_ring(k(2)); x # optional - sage.rings.finite_rings + sage: x = L.from_base_ring(k(2)); x # needs sage.rings.finite_rings 2 - sage: x.parent() # optional - sage.rings.finite_rings + sage: x.parent() # needs sage.rings.finite_rings Field in v with defining polynomial x^2 + (3 - u)*x + u over its base - sage: x = L.from_base_ring(u); x # optional - sage.rings.finite_rings + sage: x = L.from_base_ring(u); x # needs sage.rings.finite_rings u - sage: x.parent() # optional - sage.rings.finite_rings + sage: x.parent() # needs sage.rings.finite_rings Field in v with defining polynomial x^2 + (3 - u)*x + u over its base """ if r not in self._base: @@ -798,25 +799,26 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: A. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: B. = GF(5^4).over(A) # optional - sage.rings.finite_rings - sage: C. = GF(5^12).over(B) # optional - sage.rings.finite_rings - sage: D. = GF(5^24).over(C) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: A. = GF(5^2).over() # over GF(5) + sage: B. = GF(5^4).over(A) + sage: C. = GF(5^12).over(B) + sage: D. = GF(5^24).over(C) Observe what happens when we modify the option ``over``:: - sage: D # optional - sage.rings.finite_rings + sage: D # needs sage.rings.finite_rings Field in d with defining polynomial x^2 + ((1 - a) + ((1 + 2*a) - b)*c + ((2 + a) + (1 - a)*b)*c^2)*x + c over its base - sage: D.print_options(over=2) # optional - sage.rings.finite_rings - sage: D # optional - sage.rings.finite_rings + sage: D.print_options(over=2) # needs sage.rings.finite_rings + sage: D # needs sage.rings.finite_rings Field in d with defining polynomial x^2 + ((1 - a) + ((1 + 2*a) - b)*c + ((2 + a) + (1 - a)*b)*c^2)*x + c over Field in c with defining polynomial x^3 + (1 + (2 - a)*b)*x^2 + (2 + 2*b)*x - b over Field in b with defining polynomial x^2 + (3 - a)*x + a over its base - sage: D.print_options(over=Infinity) # optional - sage.rings.finite_rings - sage: D # optional - sage.rings.finite_rings + sage: D.print_options(over=Infinity) # needs sage.rings.finite_rings + sage: D # needs sage.rings.finite_rings Field in d with defining polynomial x^2 + ((1 - a) + ((1 + 2*a) - b)*c + ((2 + a) + (1 - a)*b)*c^2)*x + c over Field in c with defining polynomial x^3 + (1 + (2 - a)*b)*x^2 + (2 + 2*b)*x - b over Field in b with defining polynomial x^2 + (3 - a)*x + a over @@ -825,19 +827,19 @@ cdef class RingExtension_generic(CommutativeAlgebra): Now the option ``base``:: - sage: d^2 # optional - sage.rings.finite_rings + sage: d^2 # needs sage.rings.finite_rings -c + ((-1 + a) + ((-1 + 3*a) + b)*c + ((3 - a) + (-1 + a)*b)*c^2)*d - sage: D.basis_over(B) # optional - sage.rings.finite_rings + sage: D.basis_over(B) # needs sage.rings.finite_rings [1, c, c^2, d, c*d, c^2*d] - sage: D.print_options(base=B) # optional - sage.rings.finite_rings - sage: d^2 # optional - sage.rings.finite_rings + sage: D.print_options(base=B) # needs sage.rings.finite_rings + sage: d^2 # needs sage.rings.finite_rings -c + (-1 + a)*d + ((-1 + 3*a) + b)*c*d + ((3 - a) + (-1 + a)*b)*c^2*d - sage: D.basis_over(A) # optional - sage.rings.finite_rings + sage: D.basis_over(A) # needs sage.rings.finite_rings [1, b, c, b*c, c^2, b*c^2, d, b*d, c*d, b*c*d, c^2*d, b*c^2*d] - sage: D.print_options(base=A) # optional - sage.rings.finite_rings - sage: d^2 # optional - sage.rings.finite_rings + sage: D.print_options(base=A) # needs sage.rings.finite_rings + sage: d^2 # needs sage.rings.finite_rings -c + (-1 + a)*d + (-1 + 3*a)*c*d + b*c*d + (3 - a)*c^2*d + (-1 + a)*b*c^2*d """ for (name, value) in options.items(): @@ -1041,21 +1043,21 @@ cdef class RingExtension_generic(CommutativeAlgebra): TESTS:: - sage: E1 = GF(3^6).over(GF(3^3)) # optional - sage.rings.finite_rings - sage: E1.coerce_map_from(GF(3^3)) # indirect doctest # optional - sage.rings.finite_rings + sage: E1 = GF(3^6).over(GF(3^3)) # needs sage.rings.finite_rings + sage: E1.coerce_map_from(GF(3^3)) # indirect doctest # needs sage.rings.finite_rings Ring morphism: From: Finite Field in z3 of size 3^3 To: Field in z6 with defining polynomial x^2 + (2*z3 + 1)*x + z3 over its base Defn: z3 |--> z3 - sage: E1.coerce_map_from(GF(3)) # indirect doctest # optional - sage.rings.finite_rings + sage: E1.coerce_map_from(GF(3)) # indirect doctest # needs sage.rings.finite_rings Ring morphism: From: Finite Field of size 3 To: Field in z6 with defining polynomial x^2 + (2*z3 + 1)*x + z3 over its base Defn: 1 |--> 1 - sage: E2 = GF(3^18).over(GF(3^9)) # optional - sage.rings.finite_rings - sage: E2.coerce_map_from(E1) # indirect doctest # optional - sage.rings.finite_rings + sage: E2 = GF(3^18).over(GF(3^9)) # needs sage.rings.finite_rings + sage: E2.coerce_map_from(E1) # indirect doctest # needs sage.rings.finite_rings Ring morphism: From: Field in z6 with defining polynomial x^2 + (2*z3 + 1)*x + z3 over its base To: Field in z18 with defining polynomial x^2 + (z9^8 + 2*z9^7 + z9^5 + 2*z9^4 + z9^2 + z9 + 1)*x + z9 over its base @@ -1063,11 +1065,12 @@ cdef class RingExtension_generic(CommutativeAlgebra): A test with iterated extensions:: - sage: A = GF(3^18).over(GF(3^3)) # simple extension GF(3^3) -> GF(3^18) # optional - sage.rings.finite_rings - sage: B = GF(3^18).over(E1) # iterated extension GF(3^3) -> GF(3^6) -> GF(3^18) # optional - sage.rings.finite_rings - sage: A.has_coerce_map_from(B) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: A = GF(3^18).over(GF(3^3)) # simple extension GF(3^3) -> GF(3^18) + sage: B = GF(3^18).over(E1) # iterated extension GF(3^3) -> GF(3^6) -> GF(3^18) + sage: A.has_coerce_map_from(B) False - sage: B.has_coerce_map_from(A) # optional - sage.rings.finite_rings + sage: B.has_coerce_map_from(A) True """ @@ -1087,17 +1090,17 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2) # optional - sage.rings.finite_rings - sage: K = GF(5^4).over(F) # optional - sage.rings.finite_rings - sage: K.base() # optional - sage.rings.finite_rings + sage: F = GF(5^2) # needs sage.rings.finite_rings + sage: K = GF(5^4).over(F) # needs sage.rings.finite_rings + sage: K.base() # needs sage.rings.finite_rings Finite Field in z2 of size 5^2 In case of iterated extensions, the base is itself an extension:: - sage: L = GF(5^8).over(K) # optional - sage.rings.finite_rings - sage: L.base() # optional - sage.rings.finite_rings + sage: L = GF(5^8).over(K) # needs sage.rings.finite_rings + sage: L.base() # needs sage.rings.finite_rings Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base - sage: L.base() is K # optional - sage.rings.finite_rings + sage: L.base() is K # needs sage.rings.finite_rings True .. SEEALSO:: @@ -1113,20 +1116,20 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: K = GF(5^4).over(F) # optional - sage.rings.finite_rings - sage: L = GF(5^12).over(K) # optional - sage.rings.finite_rings + sage: F = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: K = GF(5^4).over(F) # needs sage.rings.finite_rings + sage: L = GF(5^12).over(K) # needs sage.rings.finite_rings - sage: F.bases() # optional - sage.rings.finite_rings + sage: F.bases() # needs sage.rings.finite_rings [Field in z2 with defining polynomial x^2 + 4*x + 2 over its base, Finite Field of size 5] - sage: K.bases() # optional - sage.rings.finite_rings + sage: K.bases() # needs sage.rings.finite_rings [Field in z4 with defining polynomial x^2 + (3 - z2)*x + z2 over its base, Field in z2 with defining polynomial x^2 + 4*x + 2 over its base, Finite Field of size 5] - sage: L.bases() # optional - sage.rings.finite_rings + sage: L.bases() # needs sage.rings.finite_rings [Field in z12 with defining polynomial x^3 + (1 + (2 - z2)*z4)*x^2 + (2 + 2*z4)*x - z4 over its base, Field in z4 with defining polynomial x^2 + (3 - z2)*x + z2 over its base, @@ -1153,15 +1156,15 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: K = GF(5^4).over(F) # optional - sage.rings.finite_rings - sage: L = GF(5^12).over(K) # optional - sage.rings.finite_rings + sage: F = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: K = GF(5^4).over(F) # needs sage.rings.finite_rings + sage: L = GF(5^12).over(K) # needs sage.rings.finite_rings - sage: F.absolute_base() # optional - sage.rings.finite_rings + sage: F.absolute_base() # needs sage.rings.finite_rings Finite Field of size 5 - sage: K.absolute_base() # optional - sage.rings.finite_rings + sage: K.absolute_base() # needs sage.rings.finite_rings Finite Field of size 5 - sage: L.absolute_base() # optional - sage.rings.finite_rings + sage: L.absolute_base() # needs sage.rings.finite_rings Finite Field of size 5 .. SEEALSO:: @@ -1182,28 +1185,29 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: A = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings - sage: B = GF(5^12).over(A) # optional - sage.rings.finite_rings + sage: A = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings + sage: B = GF(5^12).over(A) # needs sage.rings.finite_rings - sage: A.is_defined_over(GF(5^2)) # optional - sage.rings.finite_rings + sage: A.is_defined_over(GF(5^2)) # needs sage.rings.finite_rings True - sage: A.is_defined_over(GF(5)) # optional - sage.rings.finite_rings + sage: A.is_defined_over(GF(5)) # needs sage.rings.finite_rings False - sage: B.is_defined_over(A) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: B.is_defined_over(A) True - sage: B.is_defined_over(GF(5^4)) # optional - sage.rings.finite_rings + sage: B.is_defined_over(GF(5^4)) True - sage: B.is_defined_over(GF(5^2)) # optional - sage.rings.finite_rings + sage: B.is_defined_over(GF(5^2)) True - sage: B.is_defined_over(GF(5)) # optional - sage.rings.finite_rings + sage: B.is_defined_over(GF(5)) False Note that an extension is defined over itself:: - sage: A.is_defined_over(A) # optional - sage.rings.finite_rings + sage: A.is_defined_over(A) # needs sage.rings.finite_rings True - sage: A.is_defined_over(GF(5^4)) # optional - sage.rings.finite_rings + sage: A.is_defined_over(GF(5^4)) # needs sage.rings.finite_rings True .. SEEALSO:: @@ -1234,26 +1238,27 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2) # optional - sage.rings.finite_rings - sage: K = GF(5^4).over(F) # optional - sage.rings.finite_rings - sage: L = GF(5^12).over(K) # optional - sage.rings.finite_rings - sage: L.bases() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5^2) + sage: K = GF(5^4).over(F) + sage: L = GF(5^12).over(K) + sage: L.bases() [Field in z12 with defining polynomial x^3 + (1 + (4*z2 + 2)*z4)*x^2 + (2 + 2*z4)*x - z4 over its base, Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base, Finite Field in z2 of size 5^2] - sage: L._check_base(K) # optional - sage.rings.finite_rings + sage: L._check_base(K) # needs sage.rings.finite_rings Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base - sage: L._check_base(GF(5^4)) # optional - sage.rings.finite_rings + sage: L._check_base(GF(5^4)) # needs sage.rings.finite_rings Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base - sage: L._check_base(GF(5^4)) is K # optional - sage.rings.finite_rings + sage: L._check_base(GF(5^4)) is K # needs sage.rings.finite_rings True When ``base`` is ``None``, the base of the extension is returned:: - sage: L._check_base(None) # optional - sage.rings.finite_rings + sage: L._check_base(None) # needs sage.rings.finite_rings Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base - sage: L._check_base(None) is L.base() # optional - sage.rings.finite_rings + sage: L._check_base(None) is L.base() # needs sage.rings.finite_rings True """ @@ -1279,17 +1284,17 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2) # optional - sage.rings.finite_rings - sage: K = GF(5^4).over(F) # optional - sage.rings.finite_rings - sage: L = GF(5^12).over(K) # optional - sage.rings.finite_rings + sage: F = GF(5^2) # needs sage.rings.finite_rings + sage: K = GF(5^4).over(F) # needs sage.rings.finite_rings + sage: L = GF(5^12).over(K) # needs sage.rings.finite_rings - sage: K.defining_morphism() # optional - sage.rings.finite_rings + sage: K.defining_morphism() # needs sage.rings.finite_rings Ring morphism: From: Finite Field in z2 of size 5^2 To: Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base Defn: z2 |--> z2 - sage: L.defining_morphism() # optional - sage.rings.finite_rings + sage: L.defining_morphism() # needs sage.rings.finite_rings Ring morphism: From: Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base To: Field in z12 with defining polynomial @@ -1299,14 +1304,14 @@ cdef class RingExtension_generic(CommutativeAlgebra): One can also pass in a base over which the extension is explicitly defined (see also :meth:`is_defined_over`):: - sage: L.defining_morphism(F) # optional - sage.rings.finite_rings + sage: L.defining_morphism(F) # needs sage.rings.finite_rings Ring morphism: From: Finite Field in z2 of size 5^2 To: Field in z12 with defining polynomial x^3 + (1 + (4*z2 + 2)*z4)*x^2 + (2 + 2*z4)*x - z4 over its base Defn: z2 |--> z2 - sage: L.defining_morphism(GF(5)) # optional - sage.rings.finite_rings + sage: L.defining_morphism(GF(5)) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field of size 5 @@ -1343,13 +1348,14 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: K.gens() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) + sage: K.gens() (a,) - sage: L. = GF(5^4).over(K) # optional - sage.rings.finite_rings - sage: L.gens() # optional - sage.rings.finite_rings + sage: L. = GF(5^4).over(K) + sage: L.gens() (b,) - sage: L.gens(GF(5)) # optional - sage.rings.finite_rings + sage: L.gens(GF(5)) (b, a) sage: S. = QQ[] @@ -1373,16 +1379,16 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: K.gens() # optional - sage.rings.finite_rings + sage: K = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: K.gens() # needs sage.rings.finite_rings (z2,) - sage: K.ngens() # optional - sage.rings.finite_rings + sage: K.ngens() # needs sage.rings.finite_rings 1 - sage: L = GF(5^4).over(K) # optional - sage.rings.finite_rings - sage: L.gens(GF(5)) # optional - sage.rings.finite_rings + sage: L = GF(5^4).over(K) # needs sage.rings.finite_rings + sage: L.gens(GF(5)) # needs sage.rings.finite_rings (z4, z2) - sage: L.ngens(GF(5)) # optional - sage.rings.finite_rings + sage: L.ngens(GF(5)) # needs sage.rings.finite_rings 2 """ return len(self.gens(base)) @@ -1393,15 +1399,15 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: x =K.gen(); x # optional - sage.rings.finite_rings + sage: K = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: x =K.gen(); x # needs sage.rings.finite_rings z2 Observe that the generator lives in the extension:: - sage: x.parent() # optional - sage.rings.finite_rings + sage: x.parent() # needs sage.rings.finite_rings Field in z2 with defining polynomial x^2 + 4*x + 2 over its base - sage: x.parent() is K # optional - sage.rings.finite_rings + sage: x.parent() is K # needs sage.rings.finite_rings True """ return self.gens()[0] @@ -1412,13 +1418,13 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: x = K.random_element(); x # random # optional - sage.rings.finite_rings + sage: K = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: x = K.random_element(); x # random # needs sage.rings.finite_rings 3 + z2 - sage: x.parent() # optional - sage.rings.finite_rings + sage: x.parent() # needs sage.rings.finite_rings Field in z2 with defining polynomial x^2 + 4*x + 2 over its base - sage: x.parent() is K # optional - sage.rings.finite_rings + sage: x.parent() is K # needs sage.rings.finite_rings True """ elt = self._backend.random_element() @@ -1435,29 +1441,29 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2) # optional - sage.rings.finite_rings - sage: K = GF(5^4).over(F) # optional - sage.rings.finite_rings - sage: L = GF(5^12).over(K) # optional - sage.rings.finite_rings + sage: F = GF(5^2) # needs sage.rings.finite_rings + sage: K = GF(5^4).over(F) # needs sage.rings.finite_rings + sage: L = GF(5^12).over(K) # needs sage.rings.finite_rings - sage: K.degree_over(F) # optional - sage.rings.finite_rings + sage: K.degree_over(F) # needs sage.rings.finite_rings 2 - sage: L.degree_over(K) # optional - sage.rings.finite_rings + sage: L.degree_over(K) # needs sage.rings.finite_rings 3 - sage: L.degree_over(F) # optional - sage.rings.finite_rings + sage: L.degree_over(F) # needs sage.rings.finite_rings 6 If ``base`` is omitted, the degree is computed over the base of the extension:: - sage: K.degree_over() # optional - sage.rings.finite_rings + sage: K.degree_over() # needs sage.rings.finite_rings 2 - sage: L.degree_over() # optional - sage.rings.finite_rings + sage: L.degree_over() # needs sage.rings.finite_rings 3 Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: K.degree_over(GF(5)) # optional - sage.rings.finite_rings + sage: K.degree_over(GF(5)) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field of size 5 @@ -1479,11 +1485,11 @@ cdef class RingExtension_generic(CommutativeAlgebra): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 2) # optional - sage.rings.number_field - sage: B. = QQ.extension(x^6 - 2) # optional - sage.rings.number_field - sage: f = A.hom([b^3]) # optional - sage.rings.number_field - sage: E = B.over(f) # optional - sage.rings.number_field - sage: E.degree_over() # indirect doctest # optional - sage.rings.number_field + sage: A. = QQ.extension(x^2 - 2) # needs sage.rings.number_field + sage: B. = QQ.extension(x^6 - 2) # needs sage.rings.number_field + sage: f = A.hom([b^3]) # needs sage.rings.number_field + sage: E = B.over(f) # needs sage.rings.number_field + sage: E.degree_over() # indirect doctest # needs sage.rings.number_field 3 """ if base is self: @@ -1501,20 +1507,20 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: A = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings - sage: B = GF(5^12).over(A) # optional - sage.rings.finite_rings + sage: A = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings + sage: B = GF(5^12).over(A) # needs sage.rings.finite_rings - sage: A.degree(GF(5^2)) # optional - sage.rings.finite_rings + sage: A.degree(GF(5^2)) # needs sage.rings.finite_rings 2 - sage: B.degree(A) # optional - sage.rings.finite_rings + sage: B.degree(A) # needs sage.rings.finite_rings 3 - sage: B.degree(GF(5^2)) # optional - sage.rings.finite_rings + sage: B.degree(GF(5^2)) # needs sage.rings.finite_rings 6 Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: A.degree(GF(5)) # optional - sage.rings.finite_rings + sage: A.degree(GF(5)) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field of size 5 @@ -1531,8 +1537,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: A = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings - sage: A.relative_degree() # optional - sage.rings.finite_rings + sage: A = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings + sage: A.relative_degree() # needs sage.rings.finite_rings 2 .. SEEALSO:: @@ -1547,12 +1553,12 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: A = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings - sage: B = GF(5^12).over(A) # optional - sage.rings.finite_rings + sage: A = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings + sage: B = GF(5^12).over(A) # needs sage.rings.finite_rings - sage: A.absolute_degree() # optional - sage.rings.finite_rings + sage: A.absolute_degree() # needs sage.rings.finite_rings 2 - sage: B.absolute_degree() # optional - sage.rings.finite_rings + sage: B.absolute_degree() # needs sage.rings.finite_rings 6 .. SEEALSO:: @@ -1572,18 +1578,18 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: L = GF(5^4).over(K) # optional - sage.rings.finite_rings + sage: K = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: L = GF(5^4).over(K) # needs sage.rings.finite_rings - sage: L.is_finite_over(K) # optional - sage.rings.finite_rings + sage: L.is_finite_over(K) # needs sage.rings.finite_rings True - sage: L.is_finite_over(GF(5)) # optional - sage.rings.finite_rings + sage: L.is_finite_over(GF(5)) # needs sage.rings.finite_rings True If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: L.is_finite_over() # optional - sage.rings.finite_rings + sage: L.is_finite_over() # needs sage.rings.finite_rings True """ cdef CommutativeRing b @@ -1617,8 +1623,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): TESTS:: - sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: K.is_finite_over() # indirect doctest # optional - sage.rings.finite_rings + sage: K = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: K.is_finite_over() # indirect doctest # needs sage.rings.finite_rings True """ raise NotImplementedError @@ -1635,18 +1641,18 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: L = GF(5^4).over(K) # optional - sage.rings.finite_rings + sage: K = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: L = GF(5^4).over(K) # needs sage.rings.finite_rings - sage: L.is_free_over(K) # optional - sage.rings.finite_rings + sage: L.is_free_over(K) # needs sage.rings.finite_rings True - sage: L.is_free_over(GF(5)) # optional - sage.rings.finite_rings + sage: L.is_free_over(GF(5)) # needs sage.rings.finite_rings True If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: L.is_free_over() # optional - sage.rings.finite_rings + sage: L.is_free_over() # needs sage.rings.finite_rings True """ cdef CommutativeRing b @@ -1680,8 +1686,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): TESTS:: - sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: K.is_free_over() # indirect doctest # optional - sage.rings.finite_rings + sage: K = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: K.is_free_over() # indirect doctest # needs sage.rings.finite_rings True """ raise NotImplementedError @@ -1696,17 +1702,17 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^5).over() # over GF(5) # optional - sage.rings.finite_rings - sage: K.is_field() # optional - sage.rings.finite_rings + sage: K = GF(5^5).over() # over GF(5) # needs sage.rings.finite_rings + sage: K.is_field() # needs sage.rings.finite_rings True - sage: S. = QQ[] # optional - sage.rings.finite_rings - sage: A = S.over(QQ) # optional - sage.rings.finite_rings - sage: A.is_field() # optional - sage.rings.finite_rings + sage: S. = QQ[] # needs sage.rings.finite_rings + sage: A = S.over(QQ) # needs sage.rings.finite_rings + sage: A.is_field() # needs sage.rings.finite_rings False - sage: B = A.fraction_field() # optional - sage.rings.finite_rings - sage: B.is_field() # optional - sage.rings.finite_rings + sage: B = A.fraction_field() # needs sage.rings.finite_rings + sage: B.is_field() # needs sage.rings.finite_rings True """ return self._backend.is_field(proof=proof) @@ -1733,46 +1739,46 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 5) # optional - sage.rings.number_field - sage: OK = A.over() # over ZZ # optional - sage.rings.number_field - sage: OK # optional - sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 5) # needs sage.rings.number_field + sage: OK = A.over() # over ZZ # needs sage.rings.number_field + sage: OK # needs sage.rings.number_field Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K1 = OK.fraction_field(); K1 # optional - sage.rings.number_field + sage: K1 = OK.fraction_field(); K1 # needs sage.rings.number_field Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K1.bases() # optional - sage.rings.number_field + sage: K1.bases() # needs sage.rings.number_field [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, Order in Number Field in a with defining polynomial x^2 - 5 over its base, Integer Ring] - sage: K2 = OK.fraction_field(extend_base=True); K2 # optional - sage.rings.number_field + sage: K2 = OK.fraction_field(extend_base=True); K2 # needs sage.rings.number_field Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K2.bases() # optional - sage.rings.number_field + sage: K2.bases() # needs sage.rings.number_field [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, Rational Field] Note that there is no coercion between `K_1` and `K_2`:: - sage: K1.has_coerce_map_from(K2) # optional - sage.rings.number_field + sage: K1.has_coerce_map_from(K2) # needs sage.rings.number_field False - sage: K2.has_coerce_map_from(K1) # optional - sage.rings.number_field + sage: K2.has_coerce_map_from(K1) # needs sage.rings.number_field False We check that when the extension is a field, its fraction field does not change:: - sage: K1.fraction_field() is K1 # optional - sage.rings.number_field + sage: K1.fraction_field() is K1 # needs sage.rings.number_field True - sage: K2.fraction_field() is K2 # optional - sage.rings.number_field + sage: K2.fraction_field() is K2 # needs sage.rings.number_field True TESTS:: - sage: A = GF(5).over(ZZ) # optional - sage.rings.finite_rings - sage: A.fraction_field(extend_base=True) # optional - sage.rings.finite_rings + sage: A = GF(5).over(ZZ) # needs sage.rings.finite_rings + sage: A.fraction_field(extend_base=True) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: the morphism is not injective @@ -1797,8 +1803,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): TESTS:: - sage: K = GF(5^2).over() # optional - sage.rings.finite_rings - sage: K.fraction_field() # indirect doctest # optional - sage.rings.finite_rings + sage: K = GF(5^2).over() # needs sage.rings.finite_rings + sage: K.fraction_field() # indirect doctest # needs sage.rings.finite_rings Field in z2 with defining polynomial x^2 + 4*x + 2 over its base sage: K = QQ.over(ZZ) @@ -1832,17 +1838,17 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2) # optional - sage.rings.finite_rings - sage: K = GF(5^4).over(F) # optional - sage.rings.finite_rings - sage: L = GF(5^12).over(F) # optional - sage.rings.finite_rings + sage: F = GF(5^2) # needs sage.rings.finite_rings + sage: K = GF(5^4).over(F) # needs sage.rings.finite_rings + sage: L = GF(5^12).over(F) # needs sage.rings.finite_rings - sage: K.Hom(L) # indirect doctest # optional - sage.rings.finite_rings + sage: K.Hom(L) # indirect doctest # needs sage.rings.finite_rings Set of Homomorphisms from Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base to Field in z12 with defining polynomial x^6 + (4*z2 + 3)*x^5 + x^4 + (3*z2 + 1)*x^3 + x^2 + (4*z2 + 1)*x + z2 over its base - sage: K.Hom(L, category=Sets()) # optional - sage.rings.finite_rings + sage: K.Hom(L, category=Sets()) # needs sage.rings.finite_rings Set of Morphisms from Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base to Field in z12 with defining polynomial x^6 + (4*z2 + 3)*x^5 + x^4 @@ -1880,12 +1886,12 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: L. = GF(5^6).over(K) # needs sage.rings.finite_rings We define (by hand) the relative Frobenius endomorphism of the extension `L/K`:: - sage: L.hom([b^25]) # optional - sage.rings.finite_rings + sage: L.hom([b^25]) # needs sage.rings.finite_rings Ring endomorphism of Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: b |--> 2 + 2*a*b + (2 - a)*b^2 @@ -1894,15 +1900,15 @@ cdef class RingExtension_generic(CommutativeAlgebra): because it is not a homomorphism of `K`-algebras. For this reason, the construction ``L.hom([b^5])`` fails:: - sage: L.hom([b^5]) # optional - sage.rings.finite_rings + sage: L.hom([b^5]) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: images do not define a valid homomorphism What we need is to specify a base map:: - sage: FrobK = K.hom([a^5]) # optional - sage.rings.finite_rings - sage: FrobL = L.hom([b^5], base_map=FrobK); FrobL # optional - sage.rings.finite_rings + sage: FrobK = K.hom([a^5]) # needs sage.rings.finite_rings + sage: FrobL = L.hom([b^5], base_map=FrobK); FrobL # needs sage.rings.finite_rings Ring endomorphism of Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: b |--> (-1 + a) + (1 + 2*a)*b + a*b^2 @@ -1911,13 +1917,13 @@ cdef class RingExtension_generic(CommutativeAlgebra): As a shortcut, we may use the following construction:: - sage: phi = L.hom([b^5, a^5]); phi # optional - sage.rings.finite_rings + sage: phi = L.hom([b^5, a^5]); phi # needs sage.rings.finite_rings Ring endomorphism of Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: b |--> (-1 + a) + (1 + 2*a)*b + a*b^2 with map on base ring: a |--> 1 - a - sage: phi == FrobL # optional - sage.rings.finite_rings + sage: phi == FrobL # needs sage.rings.finite_rings True """ if codomain is None: @@ -1936,14 +1942,15 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: K = GF(5^4).over(F) # optional - sage.rings.finite_rings - sage: L = GF(5^12).over(K) # optional - sage.rings.finite_rings - sage: F.characteristic() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5^2).over() # over GF(5) + sage: K = GF(5^4).over(F) + sage: L = GF(5^12).over(K) + sage: F.characteristic() 5 - sage: K.characteristic() # optional - sage.rings.finite_rings + sage: K.characteristic() 5 - sage: L.characteristic() # optional - sage.rings.finite_rings + sage: L.characteristic() 5 :: @@ -1954,27 +1961,29 @@ cdef class RingExtension_generic(CommutativeAlgebra): :: - sage: F = GF(11) # optional - sage.rings.finite_rings - sage: A. = F[] # optional - sage.rings.finite_rings - sage: K = Frac(F).over(F) # optional - sage.rings.finite_rings - sage: K.characteristic() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(11) + sage: A. = F[] + sage: K = Frac(F).over(F) + sage: K.characteristic() 11 :: - sage: E = GF(7).over(ZZ) # optional - sage.rings.finite_rings - sage: E.characteristic() # optional - sage.rings.finite_rings + sage: E = GF(7).over(ZZ) # needs sage.rings.finite_rings + sage: E.characteristic() # needs sage.rings.finite_rings 7 TESTS: Ensure issue :trac:`34692` is fixed:: - sage: Fq = GF(11) # optional - sage.rings.finite_rings - sage: FqX. = Fq[] # optional - sage.rings.finite_rings - sage: k = Frac(FqX) # optional - sage.rings.finite_rings - sage: K = k.over(FqX) # optional - sage.rings.finite_rings - sage: K.frobenius_endomorphism() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: Fq = GF(11) + sage: FqX. = Fq[] + sage: k = Frac(FqX) + sage: K = k.over(FqX) + sage: K.frobenius_endomorphism() Frobenius endomorphism x |--> x^11 of Fraction Field of Univariate Polynomial Ring in X over Finite Field of size 11 over its base @@ -2018,13 +2027,13 @@ cdef class RingExtensionFractionField(RingExtension_generic): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) # optional - sage.rings.number_field - sage: OK = A.over() # optional - sage.rings.number_field - sage: K = OK.fraction_field(); K # optional - sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 2) # needs sage.rings.number_field + sage: OK = A.over() # needs sage.rings.number_field + sage: K = OK.fraction_field(); K # needs sage.rings.number_field Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: TestSuite(K).run() # optional - sage.rings.number_field + sage: TestSuite(K).run() # needs sage.rings.number_field """ RingExtension_generic.__init__(self, defining_morphism, **kwargs) @@ -2040,15 +2049,15 @@ cdef class RingExtensionFractionField(RingExtension_generic): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) # optional - sage.rings.number_field - sage: OK = A.over() # optional - sage.rings.number_field - sage: K = OK.fraction_field(); K # optional - sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 2) # needs sage.rings.number_field + sage: OK = A.over() # needs sage.rings.number_field + sage: K = OK.fraction_field(); K # needs sage.rings.number_field Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: K.ring() # optional - sage.rings.number_field + sage: K.ring() # needs sage.rings.number_field Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: K.ring() is OK # optional - sage.rings.number_field + sage: K.ring() is OK # needs sage.rings.number_field True """ return self._ring @@ -2060,11 +2069,11 @@ cdef class RingExtensionFractionField(RingExtension_generic): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) # optional - sage.rings.number_field - sage: OK = A.over() # optional - sage.rings.number_field - sage: K = OK.fraction_field() # optional - sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 2) # needs sage.rings.number_field + sage: OK = A.over() # needs sage.rings.number_field + sage: K = OK.fraction_field() # needs sage.rings.number_field - sage: K._repr_topring() # optional - sage.rings.number_field + sage: K._repr_topring() # needs sage.rings.number_field 'Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2' """ if isinstance(self._ring, RingExtension_generic): @@ -2104,10 +2113,10 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: - sage: E = GF(5^4).over(GF(5^2)); E # optional - sage.rings.finite_rings + sage: E = GF(5^4).over(GF(5^2)); E # needs sage.rings.finite_rings Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base - sage: TestSuite(E).run() # optional - sage.rings.finite_rings + sage: TestSuite(E).run() # needs sage.rings.finite_rings """ Element = RingExtensionWithBasisElement @@ -2130,11 +2139,11 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: sage: x = polygen(ZZ, 'x') - sage: K. = QQ.extension(x^3 - 2) # optional - sage.rings.number_field - sage: E = K.over(); E # optional - sage.rings.number_field + sage: K. = QQ.extension(x^3 - 2) # needs sage.rings.number_field + sage: E = K.over(); E # needs sage.rings.number_field Field in a with defining polynomial x^3 - 2 over its base - sage: TestSuite(E).run() # optional - sage.rings.number_field + sage: TestSuite(E).run() # needs sage.rings.number_field """ RingExtension_generic.__init__(self, defining_morphism, **kwargs) self._basis = [ self(b) for b in basis ] @@ -2174,26 +2183,26 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: - sage: F = GF(5) # optional - sage.rings.finite_rings - sage: K = GF(5^2).over(F) # optional - sage.rings.finite_rings - sage: L = GF(5^4).over(K) # optional - sage.rings.finite_rings + sage: F = GF(5) # needs sage.rings.finite_rings + sage: K = GF(5^2).over(F) # needs sage.rings.finite_rings + sage: L = GF(5^4).over(K) # needs sage.rings.finite_rings - sage: L._print_option_base(F) is F # optional - sage.rings.finite_rings + sage: L._print_option_base(F) is F # needs sage.rings.finite_rings True - sage: L._print_option_base(K) is K # optional - sage.rings.finite_rings + sage: L._print_option_base(K) is K # needs sage.rings.finite_rings True - sage: L._print_option_base(GF(5^2)) is K # optional - sage.rings.finite_rings + sage: L._print_option_base(GF(5^2)) is K # needs sage.rings.finite_rings True - sage: L._print_option_base(None) is K # optional - sage.rings.finite_rings + sage: L._print_option_base(None) is K # needs sage.rings.finite_rings True - sage: L._print_option_base(L) # optional - sage.rings.finite_rings + sage: L._print_option_base(L) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: base must be strict - sage: K._print_option_base(L) # optional - sage.rings.finite_rings + sage: K._print_option_base(L) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Field in z4 with defining polynomial x^2 + (3 - z2)*x + z2 over its base @@ -2223,11 +2232,11 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 2) # optional - sage.rings.number_field - sage: B. = QQ.extension(x^6 - 2) # optional - sage.rings.number_field - sage: f = A.hom([b^3]) # optional - sage.rings.number_field - sage: E = B.over(f) # optional - sage.rings.number_field - sage: E.degree_over() # indirect doctest # optional - sage.rings.number_field + sage: A. = QQ.extension(x^2 - 2) # needs sage.rings.number_field + sage: B. = QQ.extension(x^6 - 2) # needs sage.rings.number_field + sage: f = A.hom([b^3]) # needs sage.rings.number_field + sage: E = B.over(f) # needs sage.rings.number_field + sage: E.degree_over() # indirect doctest # needs sage.rings.number_field 3 """ if base is self: @@ -2248,8 +2257,8 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: - sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: K.is_finite_over() # indirect doctest # optional - sage.rings.finite_rings + sage: K = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: K.is_finite_over() # indirect doctest # needs sage.rings.finite_rings True """ if base is self or base is self._base: @@ -2267,8 +2276,8 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: - sage: K = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: K.is_free_over() # indirect doctest # optional - sage.rings.finite_rings + sage: K = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: K.is_free_over() # indirect doctest # needs sage.rings.finite_rings True """ if base is self or base is self._base: @@ -2286,32 +2295,32 @@ cdef class RingExtensionWithBasis(RingExtension_generic): EXAMPLES:: - sage: F. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: K. = GF(5^4).over(F) # optional - sage.rings.finite_rings - sage: L. = GF(5^12).over(K) # optional - sage.rings.finite_rings + sage: F. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: K. = GF(5^4).over(F) # needs sage.rings.finite_rings + sage: L. = GF(5^12).over(K) # needs sage.rings.finite_rings - sage: L.basis_over(K) # optional - sage.rings.finite_rings + sage: L.basis_over(K) # needs sage.rings.finite_rings [1, c, c^2] - sage: L.basis_over(F) # optional - sage.rings.finite_rings + sage: L.basis_over(F) # needs sage.rings.finite_rings [1, b, c, b*c, c^2, b*c^2] - sage: L.basis_over(GF(5)) # optional - sage.rings.finite_rings + sage: L.basis_over(GF(5)) # needs sage.rings.finite_rings [1, a, b, a*b, c, a*c, b*c, a*b*c, c^2, a*c^2, b*c^2, a*b*c^2] If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: L.basis_over() # optional - sage.rings.finite_rings + sage: L.basis_over() # needs sage.rings.finite_rings [1, c, c^2] - sage: K.basis_over() # optional - sage.rings.finite_rings + sage: K.basis_over() # needs sage.rings.finite_rings [1, b] Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: L.degree_over(GF(5^6)) # optional - sage.rings.finite_rings + sage: L.degree_over(GF(5^6)) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z6 of size 5^6 @@ -2331,9 +2340,9 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^3 - 2) # optional - sage.rings.number_field - sage: K. = A.over() # optional - sage.rings.number_field - sage: K.basis_over() # optional - sage.rings.number_field + sage: A. = QQ.extension(x^3 - 2) # needs sage.rings.number_field + sage: K. = A.over() # needs sage.rings.number_field + sage: K.basis_over() # needs sage.rings.number_field [1, u, u^2] """ if base is self: @@ -2370,60 +2379,61 @@ cdef class RingExtensionWithBasis(RingExtension_generic): EXAMPLES:: - sage: F = GF(11) # optional - sage.rings.finite_rings - sage: K. = GF(11^2).over() # optional - sage.rings.finite_rings - sage: L. = GF(11^6).over(K) # optional - sage.rings.finite_rings + sage: F = GF(11) # needs sage.rings.finite_rings + sage: K. = GF(11^2).over() # needs sage.rings.finite_rings + sage: L. = GF(11^6).over(K) # needs sage.rings.finite_rings Forgetting a part of the multiplicative structure, the field L can be viewed as a vector space of dimension 3 over K, equipped with a distinguished basis, namely `(1, b, b^2)`:: - sage: V, i, j = L.free_module(K) # optional - sage.rings.finite_rings - sage: V # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: V, i, j = L.free_module(K) + sage: V Vector space of dimension 3 over Field in a with defining polynomial x^2 + 7*x + 2 over its base - sage: i # optional - sage.rings.finite_rings + sage: i Generic map: From: Vector space of dimension 3 over Field in a with defining polynomial x^2 + 7*x + 2 over its base To: Field in b with defining polynomial x^3 + (7 + 2*a)*x^2 + (2 - a)*x - a over its base - sage: j # optional - sage.rings.finite_rings + sage: j Generic map: From: Field in b with defining polynomial x^3 + (7 + 2*a)*x^2 + (2 - a)*x - a over its base To: Vector space of dimension 3 over Field in a with defining polynomial x^2 + 7*x + 2 over its base - sage: j(b) # optional - sage.rings.finite_rings + sage: j(b) # needs sage.rings.finite_rings (0, 1, 0) - sage: i((1, a, a+1)) # optional - sage.rings.finite_rings + sage: i((1, a, a+1)) # needs sage.rings.finite_rings 1 + a*b + (1 + a)*b^2 Similarly, one can view L as a F-vector space of dimension 6:: - sage: V, i, j, = L.free_module(F) # optional - sage.rings.finite_rings - sage: V # optional - sage.rings.finite_rings + sage: V, i, j, = L.free_module(F) # needs sage.rings.finite_rings + sage: V # needs sage.rings.finite_rings Vector space of dimension 6 over Finite Field of size 11 In this case, the isomorphisms between `V` and `L` are given by the basis `(1, a, b, ab, b^2, ab^2)`: - sage: j(a*b) # optional - sage.rings.finite_rings + sage: j(a*b) # needs sage.rings.finite_rings (0, 0, 0, 1, 0, 0) - sage: i((1,2,3,4,5,6)) # optional - sage.rings.finite_rings + sage: i((1,2,3,4,5,6)) # needs sage.rings.finite_rings (1 + 2*a) + (3 + 4*a)*b + (5 + 6*a)*b^2 When ``base`` is omitted, the default is the base of this extension:: - sage: L.free_module(map=False) # optional - sage.rings.finite_rings + sage: L.free_module(map=False) # needs sage.rings.finite_rings Vector space of dimension 3 over Field in a with defining polynomial x^2 + 7*x + 2 over its base Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: L.degree(GF(11^3)) # optional - sage.rings.finite_rings + sage: L.degree(GF(11^3)) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z3 of size 11^3 @@ -2459,9 +2469,9 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: - sage: K = GF(7^5).over() # optional - sage.rings.finite_rings - sage: L = GF(7^15).over(K) # optional - sage.rings.finite_rings - sage: for base in L.bases(): # optional - sage.rings.finite_rings + sage: K = GF(7^5).over() # needs sage.rings.finite_rings + sage: L = GF(7^15).over(K) # needs sage.rings.finite_rings + sage: for base in L.bases(): # needs sage.rings.finite_rings ....: V, i, j = L.free_module(base) ....: assert([ i(v) for v in V.basis() ] == L.basis_over(base)) ....: assert([ j(x) for x in L.basis_over(base) ] == V.basis()) @@ -2495,46 +2505,46 @@ cdef class RingExtensionWithBasis(RingExtension_generic): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 5) # optional - sage.rings.number_field - sage: OK = A.over() # over ZZ # optional - sage.rings.number_field - sage: OK # optional - sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 5) # needs sage.rings.number_field + sage: OK = A.over() # over ZZ # needs sage.rings.number_field + sage: OK # needs sage.rings.number_field Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K1 = OK.fraction_field(); K1 # optional - sage.rings.number_field + sage: K1 = OK.fraction_field(); K1 # needs sage.rings.number_field Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K1.bases() # optional - sage.rings.number_field + sage: K1.bases() # needs sage.rings.number_field [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, Order in Number Field in a with defining polynomial x^2 - 5 over its base, Integer Ring] - sage: K2 = OK.fraction_field(extend_base=True); K2 # optional - sage.rings.number_field + sage: K2 = OK.fraction_field(extend_base=True); K2 # needs sage.rings.number_field Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K2.bases() # optional - sage.rings.number_field + sage: K2.bases() # needs sage.rings.number_field [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, Rational Field] Note that there is no coercion map between `K_1` and `K_2`:: - sage: K1.has_coerce_map_from(K2) # optional - sage.rings.number_field + sage: K1.has_coerce_map_from(K2) # needs sage.rings.number_field False - sage: K2.has_coerce_map_from(K1) # optional - sage.rings.number_field + sage: K2.has_coerce_map_from(K1) # needs sage.rings.number_field False We check that when the extension is a field, its fraction field does not change:: - sage: K1.fraction_field() is K1 # optional - sage.rings.number_field + sage: K1.fraction_field() is K1 # needs sage.rings.number_field True - sage: K2.fraction_field() is K2 # optional - sage.rings.number_field + sage: K2.fraction_field() is K2 # needs sage.rings.number_field True TESTS:: - sage: A = GF(5).over(ZZ) # optional - sage.rings.finite_rings - sage: A.fraction_field(extend_base=True) # optional - sage.rings.finite_rings + sage: A = GF(5).over(ZZ) # needs sage.rings.finite_rings + sage: A.fraction_field(extend_base=True) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: the morphism is not injective @@ -2564,13 +2574,13 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^3 - 7) # optional - sage.rings.number_field - sage: K = A.over() # optional - sage.rings.number_field + sage: A. = QQ.extension(x^3 - 7) # needs sage.rings.number_field + sage: K = A.over() # needs sage.rings.number_field - sage: type(K) # optional - sage.rings.number_field + sage: type(K) # needs sage.rings.number_field - sage: TestSuite(K).run() # optional - sage.rings.number_field + sage: TestSuite(K).run() # needs sage.rings.number_field """ def __init__(self, defining_morphism, gen, names, check=True, **kwargs): @@ -2592,11 +2602,11 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): TESTS:: sage: x = polygen(ZZ, 'x') - sage: K. = QQ.extension(x^3 + 3*x + 1) # optional - sage.rings.number_field - sage: E = K.over(); E # optional - sage.rings.number_field + sage: K. = QQ.extension(x^3 + 3*x + 1) # needs sage.rings.number_field + sage: E = K.over(); E # needs sage.rings.number_field Field in a with defining polynomial x^3 + 3*x + 1 over its base - sage: TestSuite(E).run() # optional - sage.rings.number_field + sage: TestSuite(E).run() # needs sage.rings.number_field """ self._name = names[0] backend_base = backend_parent(defining_morphism.domain()) @@ -2623,12 +2633,12 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): EXAMPLES:: - sage: K. = GF(5^3).over() # optional - sage.rings.finite_rings - sage: K._repr_topring() # optional - sage.rings.finite_rings + sage: K. = GF(5^3).over() # needs sage.rings.finite_rings + sage: K._repr_topring() # needs sage.rings.finite_rings 'Field in a with defining polynomial x^3 + 3*x + 3' - sage: L. = GF(5^9).over(K) # optional - sage.rings.finite_rings - sage: L._repr_topring() # optional - sage.rings.finite_rings + sage: L. = GF(5^9).over(K) # needs sage.rings.finite_rings + sage: L._repr_topring() # needs sage.rings.finite_rings 'Field in b with defining polynomial x^3 + (1 + 3*a^2)*x^2 + (3 + 2*a + 2*a^2)*x - a' """ if self._name is None: @@ -2641,12 +2651,12 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): EXAMPLES:: - sage: K. = GF(5^3).over() # optional - sage.rings.finite_rings - sage: K._latex_topring() # optional - sage.rings.finite_rings + sage: K. = GF(5^3).over() # needs sage.rings.finite_rings + sage: K._latex_topring() # needs sage.rings.finite_rings '\\Bold{F}_{5}[a]' - sage: L. = GF(5^9).over(K) # optional - sage.rings.finite_rings - sage: L._latex_topring() # optional - sage.rings.finite_rings + sage: L. = GF(5^9).over(K) # needs sage.rings.finite_rings + sage: L._latex_topring() # needs sage.rings.finite_rings '\\Bold{F}_{5}[a][b]' """ if self._name is None: @@ -2667,18 +2677,18 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): EXAMPLES:: - sage: K. = GF(7^10).over(GF(7^2)); K # optional - sage.rings.finite_rings + sage: K. = GF(7^10).over(GF(7^2)); K # needs sage.rings.finite_rings Field in u with defining polynomial x^5 + (6*z2 + 4)*x^4 + (3*z2 + 5)*x^3 + (2*z2 + 2)*x^2 + 4*x + 6*z2 over its base - sage: P = K.modulus(); P # optional - sage.rings.finite_rings + sage: P = K.modulus(); P # needs sage.rings.finite_rings x^5 + (6*z2 + 4)*x^4 + (3*z2 + 5)*x^3 + (2*z2 + 2)*x^2 + 4*x + 6*z2 - sage: P(u) # optional - sage.rings.finite_rings + sage: P(u) # needs sage.rings.finite_rings 0 We can use a different variable name:: - sage: K.modulus('y') # optional - sage.rings.finite_rings + sage: K.modulus('y') # needs sage.rings.finite_rings y^5 + (6*z2 + 4)*y^4 + (3*z2 + 5)*y^3 + (2*z2 + 2)*y^2 + 4*y + 6*z2 """ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing @@ -2699,14 +2709,14 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: K.gens() # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: K.gens() # needs sage.rings.finite_rings (a,) - sage: L. = GF(5^4).over(K) # optional - sage.rings.finite_rings - sage: L.gens() # optional - sage.rings.finite_rings + sage: L. = GF(5^4).over(K) # needs sage.rings.finite_rings + sage: L.gens() # needs sage.rings.finite_rings (b,) - sage: L.gens(GF(5)) # optional - sage.rings.finite_rings + sage: L.gens(GF(5)) # needs sage.rings.finite_rings (b, a) """ if base is None: @@ -2741,46 +2751,46 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 5) # optional - sage.rings.number_field - sage: OK = A.over() # over ZZ # optional - sage.rings.number_field - sage: OK # optional - sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 5) # needs sage.rings.number_field + sage: OK = A.over() # over ZZ # needs sage.rings.number_field + sage: OK # needs sage.rings.number_field Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K1 = OK.fraction_field(); K1 # optional - sage.rings.number_field + sage: K1 = OK.fraction_field(); K1 # needs sage.rings.number_field Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K1.bases() # optional - sage.rings.number_field + sage: K1.bases() # needs sage.rings.number_field [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, Order in Number Field in a with defining polynomial x^2 - 5 over its base, Integer Ring] - sage: K2 = OK.fraction_field(extend_base=True); K2 # optional - sage.rings.number_field + sage: K2 = OK.fraction_field(extend_base=True); K2 # needs sage.rings.number_field Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K2.bases() # optional - sage.rings.number_field + sage: K2.bases() # needs sage.rings.number_field [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, Rational Field] Note that there is no coercion map between `K_1` and `K_2`:: - sage: K1.has_coerce_map_from(K2) # optional - sage.rings.number_field + sage: K1.has_coerce_map_from(K2) # needs sage.rings.number_field False - sage: K2.has_coerce_map_from(K1) # optional - sage.rings.number_field + sage: K2.has_coerce_map_from(K1) # needs sage.rings.number_field False We check that when the extension is a field, its fraction field does not change:: - sage: K1.fraction_field() is K1 # optional - sage.rings.number_field + sage: K1.fraction_field() is K1 # needs sage.rings.number_field True - sage: K2.fraction_field() is K2 # optional - sage.rings.number_field + sage: K2.fraction_field() is K2 # needs sage.rings.number_field True TESTS:: - sage: A = GF(5).over(ZZ) # optional - sage.rings.finite_rings - sage: A.fraction_field(extend_base=True) # optional - sage.rings.finite_rings + sage: A = GF(5).over(ZZ) # needs sage.rings.finite_rings + sage: A.fraction_field(extend_base=True) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: the morphism is not injective diff --git a/src/sage/rings/ring_extension_element.pyx b/src/sage/rings/ring_extension_element.pyx index 98539da208f..316bf64ae1e 100644 --- a/src/sage/rings/ring_extension_element.pyx +++ b/src/sage/rings/ring_extension_element.pyx @@ -43,9 +43,9 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K = GF(5^4).over() # optional - sage.rings.finite_rings - sage: x = K.random_element() # optional - sage.rings.finite_rings - sage: TestSuite(x).run() # optional - sage.rings.finite_rings + sage: K = GF(5^4).over() # needs sage.rings.finite_rings + sage: x = K.random_element() # needs sage.rings.finite_rings + sage: TestSuite(x).run() # needs sage.rings.finite_rings """ def __init__(self, RingExtension_generic parent, x, *args, **kwds): @@ -86,11 +86,12 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K = GF(5^3).over() # optional - sage.rings.finite_rings - sage: x = K.random_element() # optional - sage.rings.finite_rings - sage: type(x) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(5^3).over() + sage: x = K.random_element() + sage: type(x) - sage: loads(dumps(x)) == x # optional - sage.rings.finite_rings + sage: loads(dumps(x)) == x True """ return self._parent, (self._backend,) @@ -104,12 +105,12 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 2) # optional - sage.rings.number_field - sage: K. = A.over() # over QQ # optional - sage.rings.number_field + sage: A. = QQ.extension(x^2 - 2) # needs sage.rings.number_field + sage: K. = A.over() # over QQ # needs sage.rings.number_field - sage: hasattr(a, 'continued_fraction') # optional - sage.rings.number_field + sage: hasattr(a, 'continued_fraction') # needs sage.rings.number_field True - sage: a.continued_fraction() # optional - sage.rings.number_field + sage: a.continued_fraction() # needs sage.rings.number_field [1; (2)*] """ try: @@ -138,10 +139,10 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 2) # optional - sage.rings.number_field - sage: K. = A.over() # optional - sage.rings.number_field + sage: A. = QQ.extension(x^2 - 2) # needs sage.rings.number_field + sage: K. = A.over() # needs sage.rings.number_field - sage: dir(a) # optional - sage.rings.number_field + sage: dir(a) # needs sage.rings.number_field ['__abs__', '__add__', ... @@ -173,8 +174,8 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES: - sage: E. = GF(5^3).over() # optional - sage.rings.finite_rings - sage: hash(a) # optional - sage.rings.finite_rings + sage: E. = GF(5^3).over() # needs sage.rings.finite_rings + sage: hash(a) # needs sage.rings.finite_rings 5 """ return hash(self._backend) @@ -188,9 +189,9 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K. = GF(5^2).over() # optional - sage.rings.finite_rings - sage: L. = GF(5^4).over(K) # optional - sage.rings.finite_rings - sage: b._repr_() # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # needs sage.rings.finite_rings + sage: L. = GF(5^4).over(K) # needs sage.rings.finite_rings + sage: b._repr_() # needs sage.rings.finite_rings 'b' """ cdef RingExtension_generic parent = self._parent @@ -232,9 +233,9 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K. = GF(5^2).over() # optional - sage.rings.finite_rings - sage: L. = GF(5^4).over(K) # optional - sage.rings.finite_rings - sage: b._latex_() # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # needs sage.rings.finite_rings + sage: L. = GF(5^4).over(K) # needs sage.rings.finite_rings + sage: b._latex_() # needs sage.rings.finite_rings 'b' """ cdef RingExtension_generic parent = self._parent @@ -370,13 +371,14 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: - sage: K. = GF(5^2).over() # optional - sage.rings.finite_rings - sage: x = K.random_element() # optional - sage.rings.finite_rings - sage: x == x # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(5^2).over() + sage: x = K.random_element() + sage: x == x True - sage: x == x + 1 # optional - sage.rings.finite_rings + sage: x == x + 1 False - sage: x == x^25 # optional - sage.rings.finite_rings + sage: x == x^25 True """ return left._backend._richcmp_(backend_element(right), op) @@ -387,13 +389,13 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings - sage: x = K.random_element() # optional - sage.rings.finite_rings - sage: y = K.random_element() # optional - sage.rings.finite_rings + sage: K = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings + sage: x = K.random_element() # needs sage.rings.finite_rings + sage: y = K.random_element() # needs sage.rings.finite_rings - sage: (x+y).parent() is K # optional - sage.rings.finite_rings + sage: (x+y).parent() is K # needs sage.rings.finite_rings True - sage: x + y == y + x # optional - sage.rings.finite_rings + sage: x + y == y + x # needs sage.rings.finite_rings True """ cdef RingExtensionElement ans = PY_NEW(type(self)) @@ -407,13 +409,13 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings - sage: x = K.random_element() # optional - sage.rings.finite_rings + sage: K = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings + sage: x = K.random_element() # needs sage.rings.finite_rings - sage: y = -x # optional - sage.rings.finite_rings - sage: y.parent() is K # optional - sage.rings.finite_rings + sage: y = -x # needs sage.rings.finite_rings + sage: y.parent() is K # needs sage.rings.finite_rings True - sage: x + y == 0 # optional - sage.rings.finite_rings + sage: x + y == 0 # needs sage.rings.finite_rings True """ cdef RingExtensionElement ans = PY_NEW(type(self)) @@ -427,13 +429,13 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings - sage: x = K.random_element() # optional - sage.rings.finite_rings - sage: y = K.random_element() # optional - sage.rings.finite_rings + sage: K = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings + sage: x = K.random_element() # needs sage.rings.finite_rings + sage: y = K.random_element() # needs sage.rings.finite_rings - sage: (x-y).parent() is K # optional - sage.rings.finite_rings + sage: (x-y).parent() is K # needs sage.rings.finite_rings True - sage: x - y == x + (-y) # optional - sage.rings.finite_rings + sage: x - y == x + (-y) # needs sage.rings.finite_rings True """ cdef RingExtensionElement ans = PY_NEW(type(self)) @@ -447,13 +449,13 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings - sage: x = K.random_element() # optional - sage.rings.finite_rings - sage: y = K.random_element() # optional - sage.rings.finite_rings + sage: K = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings + sage: x = K.random_element() # needs sage.rings.finite_rings + sage: y = K.random_element() # needs sage.rings.finite_rings - sage: (x*y).parent() is K # optional - sage.rings.finite_rings + sage: (x*y).parent() is K # needs sage.rings.finite_rings True - sage: x * y == y * x # optional - sage.rings.finite_rings + sage: x * y == y * x # needs sage.rings.finite_rings True """ cdef RingExtensionElement ans = PY_NEW(type(self)) @@ -469,16 +471,16 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) # optional - sage.rings.number_field - sage: OK = A.over() # optional - sage.rings.number_field - sage: a = OK(a) # optional - sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 2) # needs sage.rings.number_field + sage: OK = A.over() # needs sage.rings.number_field + sage: a = OK(a) # needs sage.rings.number_field - sage: b = 1/a; b # optional - sage.rings.number_field + sage: b = 1/a; b # needs sage.rings.number_field a/2 - sage: b.parent() # optional - sage.rings.number_field + sage: b.parent() # needs sage.rings.number_field Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: a*b # optional - sage.rings.number_field + sage: a*b # needs sage.rings.number_field 1 """ cdef RingExtensionElement ans @@ -497,8 +499,8 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: - sage: K. = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings - sage: a.additive_order() # optional - sage.rings.finite_rings + sage: K. = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings + sage: a.additive_order() # needs sage.rings.finite_rings 5 """ return self._backend.additive_order() @@ -509,8 +511,8 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: - sage: K. = GF(5^4).over(GF(5^2)) # optional - sage.rings.finite_rings - sage: a.multiplicative_order() # optional - sage.rings.finite_rings + sage: K. = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings + sage: a.multiplicative_order() # needs sage.rings.finite_rings 624 """ return self._backend.multiplicative_order() @@ -553,9 +555,9 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): sage: A. = PolynomialRing(QQ) sage: E = A.over(QQ) - sage: E(x^2 + 1).is_prime() # optional - sage.libs.pari + sage: E(x^2 + 1).is_prime() # needs sage.libs.pari True - sage: E(x^2 - 1).is_prime() # optional - sage.libs.pari + sage: E(x^2 - 1).is_prime() # needs sage.libs.pari False """ return self._backend.is_prime() @@ -571,16 +573,16 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: - sage: K. = GF(5^3).over() # optional - sage.rings.finite_rings - sage: a.is_square() # optional - sage.rings.finite_rings + sage: K. = GF(5^3).over() # needs sage.rings.finite_rings + sage: a.is_square() # needs sage.rings.finite_rings False - sage: a.is_square(root=True) # optional - sage.rings.finite_rings + sage: a.is_square(root=True) # needs sage.rings.finite_rings (False, None) - sage: b = a + 1 # optional - sage.rings.finite_rings - sage: b.is_square() # optional - sage.rings.finite_rings + sage: b = a + 1 # needs sage.rings.finite_rings + sage: b.is_square() # needs sage.rings.finite_rings True - sage: b.is_square(root=True) # optional - sage.rings.finite_rings + sage: b.is_square(root=True) # needs sage.rings.finite_rings (True, 2 + 3*a + a^2) """ is_sq = self._backend.is_square() @@ -615,11 +617,12 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: - sage: K. = GF(5^3).over() # optional - sage.rings.finite_rings - sage: b = a + 1 # optional - sage.rings.finite_rings - sage: b.sqrt() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(5^3).over() + sage: b = a + 1 + sage: b.sqrt() 2 + 3*a + a^2 - sage: b.sqrt(all=True) # optional - sage.rings.finite_rings + sage: b.sqrt(all=True) [2 + 3*a + a^2, 3 + 2*a - a^2] """ sq = self._backend.sqrt(extend=extend, all=all) @@ -665,8 +668,8 @@ cdef class RingExtensionFractionFieldElement(RingExtensionElement): EXAMPLES: - sage: E. = GF(5^3).over() # optional - sage.rings.finite_rings - sage: hash(a) # optional - sage.rings.finite_rings + sage: E. = GF(5^3).over() # needs sage.rings.finite_rings + sage: hash(a) # needs sage.rings.finite_rings 5 """ return hash(self._backend) @@ -746,29 +749,29 @@ cdef class RingExtensionFractionFieldElement(RingExtensionElement): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) # optional - sage.rings.number_field - sage: OK = A.over() # over ZZ # optional - sage.rings.number_field - sage: K = OK.fraction_field(); K # optional - sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 2) # needs sage.rings.number_field + sage: OK = A.over() # over ZZ # needs sage.rings.number_field + sage: K = OK.fraction_field(); K # needs sage.rings.number_field Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: x = K(1/a); x # optional - sage.rings.number_field + sage: x = K(1/a); x # needs sage.rings.number_field a/2 - sage: num = x.numerator(); num # optional - sage.rings.number_field + sage: num = x.numerator(); num # needs sage.rings.number_field a The numerator is an element of the ring which was used to construct the fraction field:: - sage: num.parent() # optional - sage.rings.number_field + sage: num.parent() # needs sage.rings.number_field Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: num.parent() is OK # optional - sage.rings.number_field + sage: num.parent() is OK # needs sage.rings.number_field True TESTS:: - sage: x = K.random_element() # optional - sage.rings.number_field - sage: x == x.numerator() / x.denominator() # optional - sage.rings.number_field + sage: x = K.random_element() # needs sage.rings.number_field + sage: x == x.numerator() / x.denominator() # needs sage.rings.number_field True """ ring = (self._parent)._ring @@ -782,29 +785,29 @@ cdef class RingExtensionFractionFieldElement(RingExtensionElement): EXAMPLES:: sage: R. = ZZ[] - sage: A. = ZZ.extension(x^2 - 2) # optional - sage.rings.number_field - sage: OK = A.over() # over ZZ # optional - sage.rings.number_field - sage: K = OK.fraction_field(); K # optional - sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 2) # needs sage.rings.number_field + sage: OK = A.over() # over ZZ # needs sage.rings.number_field + sage: K = OK.fraction_field(); K # needs sage.rings.number_field Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: x = K(1/a); x # optional - sage.rings.number_field + sage: x = K(1/a); x # needs sage.rings.number_field a/2 - sage: denom = x.denominator(); denom # optional - sage.rings.number_field + sage: denom = x.denominator(); denom # needs sage.rings.number_field 2 The denominator is an element of the ring which was used to construct the fraction field:: - sage: denom.parent() # optional - sage.rings.number_field + sage: denom.parent() # needs sage.rings.number_field Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: denom.parent() is OK # optional - sage.rings.number_field + sage: denom.parent() is OK # needs sage.rings.number_field True TESTS:: - sage: x = K.random_element() # optional - sage.rings.number_field - sage: x == x.numerator() / x.denominator() # optional - sage.rings.number_field + sage: x = K.random_element() # needs sage.rings.number_field + sage: x == x.numerator() / x.denominator() # needs sage.rings.number_field True """ ring = (self._parent)._ring @@ -821,11 +824,12 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): TESTS:: - sage: K. = GF(5^3).over() # optional - sage.rings.finite_rings - sage: L. = GF(5^9).over(K) # optional - sage.rings.finite_rings - sage: type(b) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(5^3).over() + sage: L. = GF(5^9).over(K) + sage: type(b) - sage: TestSuite(b).run() # optional - sage.rings.finite_rings + sage: TestSuite(b).run() """ def __hash__(self): """ @@ -833,8 +837,8 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES: - sage: E. = GF(5^3).over() # optional - sage.rings.finite_rings - sage: hash(a) # optional - sage.rings.finite_rings + sage: E. = GF(5^3).over() # needs sage.rings.finite_rings + sage: hash(a) # needs sage.rings.finite_rings 5 """ return hash(self._backend) @@ -852,13 +856,13 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: K. = GF(5^3).over() # optional - sage.rings.finite_rings - sage: L. = GF(5^9).over(K) # optional - sage.rings.finite_rings - sage: u = 1/(a+b) # optional - sage.rings.finite_rings + sage: K. = GF(5^3).over() # needs sage.rings.finite_rings + sage: L. = GF(5^9).over(K) # needs sage.rings.finite_rings + sage: u = 1/(a+b) # needs sage.rings.finite_rings - sage: u._repr_extension(base=K) # optional - sage.rings.finite_rings + sage: u._repr_extension(base=K) # needs sage.rings.finite_rings '(2 + 2*a) + (-1 + a - a^2)*b + (2 + 3*a + 3*a^2)*b^2' - sage: u._repr_extension(base=GF(5)) # optional - sage.rings.finite_rings + sage: u._repr_extension(base=GF(5)) # needs sage.rings.finite_rings '2 + 2*a - b + a*b - a^2*b + 2*b^2 + 3*a*b^2 + 3*a^2*b^2' """ cdef RingExtensionWithBasis parent = self._parent @@ -930,13 +934,13 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: K. = GF(5^3).over() # optional - sage.rings.finite_rings - sage: L. = GF(5^9).over(K) # optional - sage.rings.finite_rings - sage: u = 1/(a+b) # optional - sage.rings.finite_rings + sage: K. = GF(5^3).over() # needs sage.rings.finite_rings + sage: L. = GF(5^9).over(K) # needs sage.rings.finite_rings + sage: u = 1/(a+b) # needs sage.rings.finite_rings - sage: u._latex_extension(base=K) # optional - sage.rings.finite_rings + sage: u._latex_extension(base=K) # needs sage.rings.finite_rings \left( 2 + 2 a \right) + \left( -1 + a - a^{2} \right) b + \left( 2 + 3 a + 3 a^{2} \right) b^{2} - sage: u._latex_extension(base=GF(5)) # optional - sage.rings.finite_rings + sage: u._latex_extension(base=GF(5)) # needs sage.rings.finite_rings 2 + 2 a - b + ab - a^{2}b + 2 b^{2} + 3 ab^{2} + 3 a^{2}b^{2} """ cdef RingExtensionWithBasis parent = self._parent @@ -996,28 +1000,29 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: F = GF(5) # optional - sage.rings.finite_rings - sage: K. = GF(5^2).over() # over F # optional - sage.rings.finite_rings - sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings - sage: x = (a+b)^4; x # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5) + sage: K. = GF(5^2).over() # over F + sage: L. = GF(5^6).over(K) + sage: x = (a+b)^4; x (-1 + a) + (3 + a)*b + (1 - a)*b^2 - sage: x.vector(K) # basis is (1, b, b^2) # optional - sage.rings.finite_rings + sage: x.vector(K) # basis is (1, b, b^2) # needs sage.rings.finite_rings (-1 + a, 3 + a, 1 - a) - sage: x.vector(F) # basis is (1, a, b, a*b, b^2, a*b^2) # optional - sage.rings.finite_rings + sage: x.vector(F) # basis is (1, a, b, a*b, b^2, a*b^2) # needs sage.rings.finite_rings (4, 1, 3, 1, 1, 4) If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: x.vector() # optional - sage.rings.finite_rings + sage: x.vector() # needs sage.rings.finite_rings (-1 + a, 3 + a, 1 - a) Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: x.vector(GF(5^3)) # optional - sage.rings.finite_rings + sage: x.vector(GF(5^3)) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z3 of size 5^3 @@ -1037,11 +1042,12 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): TESTS:: - sage: K = GF(11^10).over(GF(11^2)) # optional - sage.rings.finite_rings - sage: x = K.random_element() # optional - sage.rings.finite_rings - sage: coeffs = x.vector() # optional - sage.rings.finite_rings - sage: basis = K.basis_over() # optional - sage.rings.finite_rings - sage: x == sum(coeffs[i]*basis[i] for i in range(5)) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(11^10).over(GF(11^2)) + sage: x = K.random_element() + sage: coeffs = x.vector() + sage: basis = K.basis_over() + sage: x == sum(coeffs[i]*basis[i] for i in range(5)) True """ _, _, j = (self._parent)._free_module(base, map=True) @@ -1060,55 +1066,56 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: F. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: K. = GF(5^4).over(F) # optional - sage.rings.finite_rings - sage: L. = GF(5^12).over(K) # optional - sage.rings.finite_rings - sage: u = 1/(a + b + c); u # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = GF(5^2).over() # over GF(5) + sage: K. = GF(5^4).over(F) + sage: L. = GF(5^12).over(K) + sage: u = 1/(a + b + c); u (2 + (-1 - a)*b) + ((2 + 3*a) + (1 - a)*b)*c + ((-1 - a) - a*b)*c^2 - sage: P = u.polynomial(K); P # optional - sage.rings.finite_rings + sage: P = u.polynomial(K); P # needs sage.rings.finite_rings ((-1 - a) - a*b)*x^2 + ((2 + 3*a) + (1 - a)*b)*x + 2 + (-1 - a)*b - sage: P.base_ring() is K # optional - sage.rings.finite_rings + sage: P.base_ring() is K # needs sage.rings.finite_rings True - sage: P(c) == u # optional - sage.rings.finite_rings + sage: P(c) == u # needs sage.rings.finite_rings True When the base is `F`, we obtain a bivariate polynomial:: - sage: P = u.polynomial(F); P # optional - sage.rings.finite_rings + sage: P = u.polynomial(F); P # needs sage.rings.finite_rings (-a)*x0^2*x1 + (-1 - a)*x0^2 + (1 - a)*x0*x1 + (2 + 3*a)*x0 + (-1 - a)*x1 + 2 We check that its value at the generators is the element we started with:: - sage: L.gens(F) # optional - sage.rings.finite_rings + sage: L.gens(F) # needs sage.rings.finite_rings (c, b) - sage: P(c, b) == u # optional - sage.rings.finite_rings + sage: P(c, b) == u # needs sage.rings.finite_rings True Similarly, when the base is ``GF(5)``, we get a trivariate polynomial: - sage: P = u.polynomial(GF(5)); P # optional - sage.rings.finite_rings + sage: P = u.polynomial(GF(5)); P # needs sage.rings.finite_rings -x0^2*x1*x2 - x0^2*x2 - x0*x1*x2 - x0^2 + x0*x1 - 2*x0*x2 - x1*x2 + 2*x0 - x1 + 2 - sage: P(c, b, a) == u # optional - sage.rings.finite_rings + sage: P(c, b, a) == u # needs sage.rings.finite_rings True Different variable names can be specified:: - sage: u.polynomial(GF(5), var='y') # optional - sage.rings.finite_rings + sage: u.polynomial(GF(5), var='y') # needs sage.rings.finite_rings -y0^2*y1*y2 - y0^2*y2 - y0*y1*y2 - y0^2 + y0*y1 - 2*y0*y2 - y1*y2 + 2*y0 - y1 + 2 - sage: u.polynomial(GF(5), var=['x','y','z']) # optional - sage.rings.finite_rings + sage: u.polynomial(GF(5), var=['x','y','z']) # needs sage.rings.finite_rings -x^2*y*z - x^2*z - x*y*z - x^2 + x*y - 2*x*z - y*z + 2*x - y + 2 If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: u.polynomial() # optional - sage.rings.finite_rings + sage: u.polynomial() # needs sage.rings.finite_rings ((-1 - a) - a*b)*x^2 + ((2 + 3*a) + (1 - a)*b)*x + 2 + (-1 - a)*b Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: u.polynomial(GF(5^3)) # optional - sage.rings.finite_rings + sage: u.polynomial(GF(5^3)) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z3 of size 5^3 @@ -1149,19 +1156,19 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: K. = GF(5^3).over() # over GF(5) # optional - sage.rings.finite_rings - sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings - sage: u = a/(1+b) # optional - sage.rings.finite_rings + sage: K. = GF(5^3).over() # over GF(5) # needs sage.rings.finite_rings + sage: L. = GF(5^6).over(K) # needs sage.rings.finite_rings + sage: u = a/(1+b) # needs sage.rings.finite_rings - sage: u # optional - sage.rings.finite_rings + sage: u # needs sage.rings.finite_rings (2 + a + 3*a^2) + (3 + 3*a + a^2)*b - sage: b*u # optional - sage.rings.finite_rings + sage: b*u # needs sage.rings.finite_rings (3 + 2*a^2) + (2 + 2*a - a^2)*b - sage: u.matrix(K) # optional - sage.rings.finite_rings + sage: u.matrix(K) # needs sage.rings.finite_rings [2 + a + 3*a^2 3 + 3*a + a^2] [ 3 + 2*a^2 2 + 2*a - a^2] - sage: u.matrix(GF(5)) # optional - sage.rings.finite_rings + sage: u.matrix(GF(5)) # needs sage.rings.finite_rings [2 1 3 3 3 1] [1 3 1 2 0 3] [2 3 3 1 3 0] @@ -1172,14 +1179,14 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: u.matrix() # optional - sage.rings.finite_rings + sage: u.matrix() # needs sage.rings.finite_rings [2 + a + 3*a^2 3 + 3*a + a^2] [ 3 + 2*a^2 2 + 2*a - a^2] Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: u.matrix(GF(5^2)) # optional - sage.rings.finite_rings + sage: u.matrix(GF(5^2)) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z2 of size 5^2 @@ -1205,11 +1212,11 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): TESTS:: - sage: F = GF(11^2) # optional - sage.rings.finite_rings - sage: K = GF(11^6).over(F) # optional - sage.rings.finite_rings - sage: L = GF(11^18).over(K) # optional - sage.rings.finite_rings + sage: F = GF(11^2) # needs sage.rings.finite_rings + sage: K = GF(11^6).over(F) # needs sage.rings.finite_rings + sage: L = GF(11^18).over(K) # needs sage.rings.finite_rings - sage: for base in L.bases(): # optional - sage.rings.finite_rings + sage: for base in L.bases(): # needs sage.rings.finite_rings ....: x = L.random_element() ....: y = L.random_element() ....: assert((x+y).matrix(base) == x.matrix(base) + y.matrix(base)) @@ -1233,41 +1240,42 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: F = GF(5) # optional - sage.rings.finite_rings - sage: K. = GF(5^3).over(F) # optional - sage.rings.finite_rings - sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings - sage: u = a/(1+b) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5) + sage: K. = GF(5^3).over(F) + sage: L. = GF(5^6).over(K) + sage: u = a/(1+b) - sage: tr = u.trace(K); tr # optional - sage.rings.finite_rings + sage: tr = u.trace(K); tr # needs sage.rings.finite_rings -1 + 3*a + 2*a^2 We check that the trace lives in the base ring:: - sage: tr.parent() # optional - sage.rings.finite_rings + sage: tr.parent() # needs sage.rings.finite_rings Field in a with defining polynomial x^3 + 3*x + 3 over its base - sage: tr.parent() is K # optional - sage.rings.finite_rings + sage: tr.parent() is K # needs sage.rings.finite_rings True Similarly, one can compute the trace over F:: - sage: u.trace(F) # optional - sage.rings.finite_rings + sage: u.trace(F) # needs sage.rings.finite_rings 0 We check the transitivity of the trace:: - sage: u.trace(F) == tr.trace(F) # optional - sage.rings.finite_rings + sage: u.trace(F) == tr.trace(F) # needs sage.rings.finite_rings True If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: u.trace() # optional - sage.rings.finite_rings + sage: u.trace() # needs sage.rings.finite_rings -1 + 3*a + 2*a^2 Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: u.trace(GF(5^2)) # optional - sage.rings.finite_rings + sage: u.trace(GF(5^2)) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z2 of size 5^2 @@ -1292,15 +1300,15 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): TESTS:: - sage: F = GF(11^2) # optional - sage.rings.finite_rings - sage: K = GF(11^6).over(F) # optional - sage.rings.finite_rings - sage: L = GF(11^18).over(K) # optional - sage.rings.finite_rings + sage: F = GF(11^2) # needs sage.rings.finite_rings + sage: K = GF(11^6).over(F) # needs sage.rings.finite_rings + sage: L = GF(11^18).over(K) # needs sage.rings.finite_rings - sage: x = L.random_element() # optional - sage.rings.finite_rings - sage: x.trace(F) == x.trace().trace() # optional - sage.rings.finite_rings + sage: x = L.random_element() # needs sage.rings.finite_rings + sage: x.trace(F) == x.trace().trace() # needs sage.rings.finite_rings True - sage: for base in L.bases(): # optional - sage.rings.finite_rings + sage: for base in L.bases(): # needs sage.rings.finite_rings ....: x = L.random_element() ....: y = L.random_element() ....: assert(x.trace(base) == x.matrix(base).trace()) @@ -1327,41 +1335,42 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: F = GF(5) # optional - sage.rings.finite_rings - sage: K. = GF(5^3).over(F) # optional - sage.rings.finite_rings - sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings - sage: u = a/(1+b) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5) + sage: K. = GF(5^3).over(F) + sage: L. = GF(5^6).over(K) + sage: u = a/(1+b) - sage: nr = u.norm(K); nr # optional - sage.rings.finite_rings + sage: nr = u.norm(K); nr # needs sage.rings.finite_rings 3 + 2*a^2 We check that the norm lives in the base ring:: - sage: nr.parent() # optional - sage.rings.finite_rings + sage: nr.parent() # needs sage.rings.finite_rings Field in a with defining polynomial x^3 + 3*x + 3 over its base - sage: nr.parent() is K # optional - sage.rings.finite_rings + sage: nr.parent() is K # needs sage.rings.finite_rings True Similarly, one can compute the norm over F:: - sage: u.norm(F) # optional - sage.rings.finite_rings + sage: u.norm(F) # needs sage.rings.finite_rings 4 We check the transitivity of the norm:: - sage: u.norm(F) == nr.norm(F) # optional - sage.rings.finite_rings + sage: u.norm(F) == nr.norm(F) # needs sage.rings.finite_rings True If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: u.norm() # optional - sage.rings.finite_rings + sage: u.norm() # needs sage.rings.finite_rings 3 + 2*a^2 Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: u.norm(GF(5^2)) # optional - sage.rings.finite_rings + sage: u.norm(GF(5^2)) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z2 of size 5^2 @@ -1386,15 +1395,15 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): TESTS:: - sage: F = GF(11^2) # optional - sage.rings.finite_rings - sage: K = GF(11^6).over(F) # optional - sage.rings.finite_rings - sage: L = GF(11^18).over(K) # optional - sage.rings.finite_rings + sage: F = GF(11^2) # needs sage.rings.finite_rings + sage: K = GF(11^6).over(F) # needs sage.rings.finite_rings + sage: L = GF(11^18).over(K) # needs sage.rings.finite_rings - sage: x = L.random_element() # optional - sage.rings.finite_rings - sage: x.norm(F) == x.norm().norm() # optional - sage.rings.finite_rings + sage: x = L.random_element() # needs sage.rings.finite_rings + sage: x.norm(F) == x.norm().norm() # needs sage.rings.finite_rings True - sage: for base in L.bases(): # optional - sage.rings.finite_rings + sage: for base in L.bases(): # needs sage.rings.finite_rings ....: x = L.random_element() ....: y = L.random_element() ....: assert(x.norm(base) == x.matrix(base).determinant()) @@ -1421,46 +1430,47 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: F = GF(5) # optional - sage.rings.finite_rings - sage: K. = GF(5^3).over(F) # optional - sage.rings.finite_rings - sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings - sage: u = a/(1+b) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5) + sage: K. = GF(5^3).over(F) + sage: L. = GF(5^6).over(K) + sage: u = a/(1+b) - sage: chi = u.charpoly(K); chi # optional - sage.rings.finite_rings + sage: chi = u.charpoly(K); chi # needs sage.rings.finite_rings x^2 + (1 + 2*a + 3*a^2)*x + 3 + 2*a^2 We check that the charpoly has coefficients in the base ring:: - sage: chi.base_ring() # optional - sage.rings.finite_rings + sage: chi.base_ring() # needs sage.rings.finite_rings Field in a with defining polynomial x^3 + 3*x + 3 over its base - sage: chi.base_ring() is K # optional - sage.rings.finite_rings + sage: chi.base_ring() is K # needs sage.rings.finite_rings True and that it annihilates u:: - sage: chi(u) # optional - sage.rings.finite_rings + sage: chi(u) # needs sage.rings.finite_rings 0 Similarly, one can compute the characteristic polynomial over F:: - sage: u.charpoly(F) # optional - sage.rings.finite_rings + sage: u.charpoly(F) # needs sage.rings.finite_rings x^6 + x^4 + 2*x^3 + 3*x + 4 A different variable name can be specified:: - sage: u.charpoly(F, var='t') # optional - sage.rings.finite_rings + sage: u.charpoly(F, var='t') # needs sage.rings.finite_rings t^6 + t^4 + 2*t^3 + 3*t + 4 If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: u.charpoly() # optional - sage.rings.finite_rings + sage: u.charpoly() # needs sage.rings.finite_rings x^2 + (1 + 2*a + 3*a^2)*x + 3 + 2*a^2 Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: u.charpoly(GF(5^2)) # optional - sage.rings.finite_rings + sage: u.charpoly(GF(5^2)) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z2 of size 5^2 @@ -1470,9 +1480,9 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): We check that the characteristic polynomial of an element in the base ring is a power of a polynomial of degree 1:: - sage: S. = K[] # optional - sage.rings.finite_rings - sage: u = K.random_element() # optional - sage.rings.finite_rings - sage: L(u).charpoly() == (x - u)^2 # optional - sage.rings.finite_rings + sage: S. = K[] # needs sage.rings.finite_rings + sage: u = K.random_element() # needs sage.rings.finite_rings + sage: L(u).charpoly() == (x - u)^2 # needs sage.rings.finite_rings True """ return self.matrix(base).charpoly(var) @@ -1488,46 +1498,47 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: F = GF(5) # optional - sage.rings.finite_rings - sage: K. = GF(5^3).over(F) # optional - sage.rings.finite_rings - sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings - sage: u = 1 / (a+b) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5) + sage: K. = GF(5^3).over(F) + sage: L. = GF(5^6).over(K) + sage: u = 1 / (a+b) - sage: chi = u.minpoly(K); chi # optional - sage.rings.finite_rings + sage: chi = u.minpoly(K); chi # needs sage.rings.finite_rings x^2 + (2*a + a^2)*x - 1 + a We check that the minimal polynomial has coefficients in the base ring:: - sage: chi.base_ring() # optional - sage.rings.finite_rings + sage: chi.base_ring() # needs sage.rings.finite_rings Field in a with defining polynomial x^3 + 3*x + 3 over its base - sage: chi.base_ring() is K # optional - sage.rings.finite_rings + sage: chi.base_ring() is K # needs sage.rings.finite_rings True and that it annihilates u:: - sage: chi(u) # optional - sage.rings.finite_rings + sage: chi(u) # needs sage.rings.finite_rings 0 Similarly, one can compute the minimal polynomial over F:: - sage: u.minpoly(F) # optional - sage.rings.finite_rings + sage: u.minpoly(F) # needs sage.rings.finite_rings x^6 + 4*x^5 + x^4 + 2*x^2 + 3 A different variable name can be specified:: - sage: u.minpoly(F, var='t') # optional - sage.rings.finite_rings + sage: u.minpoly(F, var='t') # needs sage.rings.finite_rings t^6 + 4*t^5 + t^4 + 2*t^2 + 3 If ``base`` is omitted, it is set to its default which is the base of the extension:: - sage: u.minpoly() # optional - sage.rings.finite_rings + sage: u.minpoly() # needs sage.rings.finite_rings x^2 + (2*a + a^2)*x - 1 + a Note that ``base`` must be an explicit base over which the extension has been defined (as listed by the method :meth:`bases`):: - sage: u.minpoly(GF(5^2)) # optional - sage.rings.finite_rings + sage: u.minpoly(GF(5^2)) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not (explicitly) defined over Finite Field in z2 of size 5^2 @@ -1537,15 +1548,15 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): We check that the minimal polynomial of an element in the base ring has degree 1:: - sage: S. = K[] # optional - sage.rings.finite_rings - sage: u = K.random_element() # optional - sage.rings.finite_rings - sage: L(u).minpoly() == x - u # optional - sage.rings.finite_rings + sage: S. = K[] # needs sage.rings.finite_rings + sage: u = K.random_element() # needs sage.rings.finite_rings + sage: L(u).minpoly() == x - u # needs sage.rings.finite_rings True In a similar fashion, the minimal polynomial over `F` of an element of `K` should have degree 1 or 3:: - sage: L(u).minpoly(F).degree() in [ 1, 3 ] # optional - sage.rings.finite_rings + sage: L(u).minpoly(F).degree() in [ 1, 3 ] # needs sage.rings.finite_rings True """ cdef RingExtensionWithBasis parent = self._parent diff --git a/src/sage/rings/ring_extension_morphism.pyx b/src/sage/rings/ring_extension_morphism.pyx index bd5b012cfaa..fca3eca6f09 100644 --- a/src/sage/rings/ring_extension_morphism.pyx +++ b/src/sage/rings/ring_extension_morphism.pyx @@ -83,19 +83,19 @@ cdef class RingExtensionHomomorphism(RingMap): TESTS:: - sage: K. = GF(5^2).over() # optional - sage.rings.finite_rings - sage: L. = GF(5^4).over(K) # optional - sage.rings.finite_rings - sage: phi = L.hom([b^5, a^5]); phi # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # needs sage.rings.finite_rings + sage: L. = GF(5^4).over(K) # needs sage.rings.finite_rings + sage: phi = L.hom([b^5, a^5]); phi # needs sage.rings.finite_rings Ring endomorphism of Field in b with defining polynomial x^2 + (3 - a)*x + a over its base Defn: b |--> (2 + a) + 2*b with map on base ring: a |--> 1 - a - sage: type(phi) # optional - sage.rings.finite_rings + sage: type(phi) # needs sage.rings.finite_rings - sage: TestSuite(phi).run() # optional - sage.rings.finite_rings + sage: TestSuite(phi).run() # needs sage.rings.finite_rings """ def __init__(self, parent, defn, base_map=None, check=True): @@ -219,12 +219,12 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: f = K.hom([a^5]); f # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: f = K.hom([a^5]); f # needs sage.rings.finite_rings Ring endomorphism of Field in a with defining polynomial x^2 + 4*x + 2 over its base Defn: a |--> 1 - a - sage: f._repr_type() # optional - sage.rings.finite_rings + sage: f._repr_type() # needs sage.rings.finite_rings 'Ring' """ return "Ring" @@ -240,19 +240,19 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: sage: x = polygen(QQ, 'x') - sage: A. = QQ.extension(x^2 - 2) # optional - sage.rings.number_field - sage: K. = A.over() # optional - sage.rings.number_field - sage: f = K.hom([-sqrt2]); f # optional - sage.rings.number_field + sage: A. = QQ.extension(x^2 - 2) # needs sage.rings.number_field + sage: K. = A.over() # needs sage.rings.number_field + sage: f = K.hom([-sqrt2]); f # needs sage.rings.number_field Ring endomorphism of Field in sqrt2 with defining polynomial x^2 - 2 over its base Defn: sqrt2 |--> -sqrt2 - sage: f(sqrt2) # optional - sage.rings.number_field + sage: f(sqrt2) # needs sage.rings.number_field -sqrt2 TESTS:: sage: a = QQ.random_element() sage: b = QQ.random_element() - sage: f(a + b*sqrt2) == a - b*sqrt2 # optional - sage.rings.number_field + sage: f(a + b*sqrt2) == a - b*sqrt2 # needs sage.rings.number_field True """ y = self._backend(backend_element(x)) @@ -268,19 +268,19 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: - sage: F = GF(5) # optional - sage.rings.finite_rings - sage: K. = GF(5^2).over(F) # optional - sage.rings.finite_rings - sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings + sage: F = GF(5) # needs sage.rings.finite_rings + sage: K. = GF(5^2).over(F) # needs sage.rings.finite_rings + sage: L. = GF(5^6).over(K) # needs sage.rings.finite_rings We define the absolute Frobenius of L:: - sage: FrobL = L.hom([b^5, a^5]); FrobL # optional - sage.rings.finite_rings + sage: FrobL = L.hom([b^5, a^5]); FrobL # needs sage.rings.finite_rings Ring endomorphism of Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: b |--> (-1 + a) + (1 + 2*a)*b + a*b^2 with map on base ring: a |--> 1 - a - sage: FrobL.base_map() # optional - sage.rings.finite_rings + sage: FrobL.base_map() # needs sage.rings.finite_rings Ring morphism: From: Field in a with defining polynomial x^2 + 4*x + 2 over its base To: Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base @@ -289,11 +289,11 @@ cdef class RingExtensionHomomorphism(RingMap): The square of ``FrobL`` acts trivially on K; in other words, it has a trivial base map:: - sage: phi = FrobL^2; phi # optional - sage.rings.finite_rings + sage: phi = FrobL^2; phi # needs sage.rings.finite_rings Ring endomorphism of Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: b |--> 2 + 2*a*b + (2 - a)*b^2 - sage: phi.base_map() # optional - sage.rings.finite_rings + sage: phi.base_map() # needs sage.rings.finite_rings """ domain = self.domain() @@ -332,15 +332,15 @@ cdef class RingExtensionHomomorphism(RingMap): TESTS:: - sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: L. = GF(5^6).over(K) # needs sage.rings.finite_rings - sage: FrobK = K.hom([a^5]) # optional - sage.rings.finite_rings - sage: FrobL = L.hom([b^5], base_map=FrobK) # optional - sage.rings.finite_rings + sage: FrobK = K.hom([a^5]) # needs sage.rings.finite_rings + sage: FrobL = L.hom([b^5], base_map=FrobK) # needs sage.rings.finite_rings - sage: FrobK^2 == End(K).identity() # optional - sage.rings.finite_rings + sage: FrobK^2 == End(K).identity() # needs sage.rings.finite_rings True - sage: FrobL^6 == End(L).identity() # optional - sage.rings.finite_rings + sage: FrobL^6 == End(L).identity() # needs sage.rings.finite_rings True """ eq = are_equal_morphisms(self._backend, backend_morphism(other)) @@ -356,22 +356,23 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: FrobK = K.hom([a^5]) # optional - sage.rings.finite_rings - sage: FrobK.is_identity() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) + sage: FrobK = K.hom([a^5]) + sage: FrobK.is_identity() False - sage: (FrobK^2).is_identity() # optional - sage.rings.finite_rings + sage: (FrobK^2).is_identity() True Coercion maps are not considered as identity morphisms:: - sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings - sage: iota = L.defining_morphism(); iota # optional - sage.rings.finite_rings + sage: L. = GF(5^6).over(K) # needs sage.rings.finite_rings + sage: iota = L.defining_morphism(); iota # needs sage.rings.finite_rings Ring morphism: From: Field in a with defining polynomial x^2 + 4*x + 2 over its base To: Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: a |--> a - sage: iota.is_identity() # optional - sage.rings.finite_rings + sage: iota.is_identity() # needs sage.rings.finite_rings False """ if self.domain() is not self.codomain(): @@ -384,23 +385,23 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: - sage: K = GF(5^10).over(GF(5^5)) # optional - sage.rings.finite_rings - sage: iota = K.defining_morphism(); iota # optional - sage.rings.finite_rings + sage: K = GF(5^10).over(GF(5^5)) # needs sage.rings.finite_rings + sage: iota = K.defining_morphism(); iota # needs sage.rings.finite_rings Ring morphism: From: Finite Field in z5 of size 5^5 To: Field in z10 with defining polynomial x^2 + (2*z5^3 + 2*z5^2 + 4*z5 + 4)*x + z5 over its base Defn: z5 |--> z5 - sage: iota.is_injective() # optional - sage.rings.finite_rings + sage: iota.is_injective() # needs sage.rings.finite_rings True - sage: K = GF(7).over(ZZ) # optional - sage.rings.finite_rings - sage: iota = K.defining_morphism(); iota # optional - sage.rings.finite_rings + sage: K = GF(7).over(ZZ) # needs sage.rings.finite_rings + sage: iota = K.defining_morphism(); iota # needs sage.rings.finite_rings Ring morphism: From: Integer Ring To: Finite Field of size 7 over its base Defn: 1 |--> 1 - sage: iota.is_injective() # optional - sage.rings.finite_rings + sage: iota.is_injective() # needs sage.rings.finite_rings False """ return self._backend.is_injective() @@ -411,23 +412,23 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: - sage: K = GF(5^10).over(GF(5^5)) # optional - sage.rings.finite_rings - sage: iota = K.defining_morphism(); iota # optional - sage.rings.finite_rings + sage: K = GF(5^10).over(GF(5^5)) # needs sage.rings.finite_rings + sage: iota = K.defining_morphism(); iota # needs sage.rings.finite_rings Ring morphism: From: Finite Field in z5 of size 5^5 To: Field in z10 with defining polynomial x^2 + (2*z5^3 + 2*z5^2 + 4*z5 + 4)*x + z5 over its base Defn: z5 |--> z5 - sage: iota.is_surjective() # optional - sage.rings.finite_rings + sage: iota.is_surjective() # needs sage.rings.finite_rings False - sage: K = GF(7).over(ZZ) # optional - sage.rings.finite_rings - sage: iota = K.defining_morphism(); iota # optional - sage.rings.finite_rings + sage: K = GF(7).over(ZZ) # needs sage.rings.finite_rings + sage: iota = K.defining_morphism(); iota # needs sage.rings.finite_rings Ring morphism: From: Integer Ring To: Finite Field of size 7 over its base Defn: 1 |--> 1 - sage: iota.is_surjective() # optional - sage.rings.finite_rings + sage: iota.is_surjective() # needs sage.rings.finite_rings True """ return self._backend.is_surjective() @@ -441,11 +442,11 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: L. = GF(5^6).over(K) # optional - sage.rings.finite_rings - sage: FrobL = L.hom([b^5, a^5]) # absolute Frobenius # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: L. = GF(5^6).over(K) # needs sage.rings.finite_rings + sage: FrobL = L.hom([b^5, a^5]) # absolute Frobenius # needs sage.rings.finite_rings - sage: print(FrobL._repr_defn()) # optional - sage.rings.finite_rings + sage: print(FrobL._repr_defn()) # needs sage.rings.finite_rings b |--> (-1 + a) + (1 + 2*a)*b + a*b^2 with map on base ring: a |--> 1 - a @@ -473,13 +474,13 @@ cdef class RingExtensionHomomorphism(RingMap): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 5) # optional - sage.rings.number_field - sage: K. = A.over() # optional - sage.rings.number_field - sage: f = K.hom([-sqrt5]); f # optional - sage.rings.number_field + sage: A. = QQ.extension(x^2 - 5) # needs sage.rings.number_field + sage: K. = A.over() # needs sage.rings.number_field + sage: f = K.hom([-sqrt5]); f # needs sage.rings.number_field Ring endomorphism of Field in sqrt5 with defining polynomial x^2 - 5 over its base Defn: sqrt5 |--> -sqrt5 - sage: f^2 # indirect doctest # optional - sage.rings.number_field + sage: f^2 # indirect doctest # needs sage.rings.number_field Ring endomorphism of Field in sqrt5 with defining polynomial x^2 - 5 over its base Defn: sqrt5 |--> sqrt5 """ @@ -498,13 +499,13 @@ cdef class RingExtensionHomomorphism(RingMap): TESTS:: - sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: f = K.hom([a^5]) # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: f = K.hom([a^5]) # needs sage.rings.finite_rings - sage: g = copy(f) # indirect doctest # optional - sage.rings.finite_rings - sage: f == g # optional - sage.rings.finite_rings + sage: g = copy(f) # indirect doctest # needs sage.rings.finite_rings + sage: f == g # needs sage.rings.finite_rings True - sage: f is g # optional - sage.rings.finite_rings + sage: f is g # needs sage.rings.finite_rings False """ self._backend = _slots['_backend'] @@ -516,9 +517,9 @@ cdef class RingExtensionHomomorphism(RingMap): TESTS:: - sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: f = K.hom([a^5]) # optional - sage.rings.finite_rings - sage: loads(dumps(f)) == f # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: f = K.hom([a^5]) # needs sage.rings.finite_rings + sage: loads(dumps(f)) == f # needs sage.rings.finite_rings True """ slots = RingMap._extra_slots(self) @@ -533,17 +534,17 @@ cdef class RingExtensionBackendIsomorphism(RingExtensionHomomorphism): TESTS:: - sage: K = GF(11^9).over(GF(11^3)) # optional - sage.rings.finite_rings - sage: f = K.coerce_map_from(GF(11^9)); f # optional - sage.rings.finite_rings + sage: K = GF(11^9).over(GF(11^3)) # needs sage.rings.finite_rings + sage: f = K.coerce_map_from(GF(11^9)); f # needs sage.rings.finite_rings Coercion morphism: From: Finite Field in z9 of size 11^9 To: Field in z9 with defining polynomial x^3 + (9*z3^2 + 5*z3 + 1)*x^2 + (4*z3 + 3)*x + 10*z3 over its base - sage: type(f) # optional - sage.rings.finite_rings + sage: type(f) # needs sage.rings.finite_rings - sage: TestSuite(f).run() # optional - sage.rings.finite_rings + sage: TestSuite(f).run() # needs sage.rings.finite_rings """ def __init__(self, parent): r""" @@ -552,9 +553,9 @@ cdef class RingExtensionBackendIsomorphism(RingExtensionHomomorphism): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 5) # optional - sage.rings.number_field - sage: K = A.over() # optional - sage.rings.number_field - sage: K.coerce_map_from(A) # optional - sage.rings.number_field + sage: A. = QQ.extension(x^2 - 5) # needs sage.rings.number_field + sage: K = A.over() # needs sage.rings.number_field + sage: K.coerce_map_from(A) # needs sage.rings.number_field Coercion morphism: From: Number Field in a with defining polynomial x^2 - 5 To: Field in a with defining polynomial x^2 - 5 over its base @@ -569,13 +570,13 @@ cdef class RingExtensionBackendIsomorphism(RingExtensionHomomorphism): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: f = K.coerce_map_from(GF(5^2)); f # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: f = K.coerce_map_from(GF(5^2)); f # needs sage.rings.finite_rings Coercion morphism: From: Finite Field in z2 of size 5^2 To: Field in a with defining polynomial x^2 + 4*x + 2 over its base - sage: f._repr_type() # optional - sage.rings.finite_rings + sage: f._repr_type() # needs sage.rings.finite_rings 'Coercion' """ return "Coercion" @@ -586,13 +587,13 @@ cdef class RingExtensionBackendIsomorphism(RingExtensionHomomorphism): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: f = K.coerce_map_from(GF(5^2)); f # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: f = K.coerce_map_from(GF(5^2)); f # needs sage.rings.finite_rings Coercion morphism: From: Finite Field in z2 of size 5^2 To: Field in a with defining polynomial x^2 + 4*x + 2 over its base - sage: f._repr_defn() # optional - sage.rings.finite_rings + sage: f._repr_defn() # needs sage.rings.finite_rings '' """ return "" @@ -607,9 +608,9 @@ cdef class RingExtensionBackendIsomorphism(RingExtensionHomomorphism): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: f = K.coerce_map_from(GF(5^2)) # optional - sage.rings.finite_rings - sage: f(GF(5^2).gen()) # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: f = K.coerce_map_from(GF(5^2)) # needs sage.rings.finite_rings + sage: f(GF(5^2).gen()) # needs sage.rings.finite_rings a """ codomain = self.codomain() @@ -623,17 +624,17 @@ cdef class RingExtensionBackendReverseIsomorphism(RingExtensionHomomorphism): TESTS:: - sage: K = GF(11^9).over(GF(11^3)) # optional - sage.rings.finite_rings - sage: f = GF(11^9).convert_map_from(K); f # optional - sage.rings.finite_rings + sage: K = GF(11^9).over(GF(11^3)) # needs sage.rings.finite_rings + sage: f = GF(11^9).convert_map_from(K); f # needs sage.rings.finite_rings Canonical morphism: From: Field in z9 with defining polynomial x^3 + (9*z3^2 + 5*z3 + 1)*x^2 + (4*z3 + 3)*x + 10*z3 over its base To: Finite Field in z9 of size 11^9 - sage: type(f) # optional - sage.rings.finite_rings + sage: type(f) # needs sage.rings.finite_rings - sage: TestSuite(f).run() # optional - sage.rings.finite_rings + sage: TestSuite(f).run() # needs sage.rings.finite_rings """ def __init__(self, parent): @@ -643,9 +644,9 @@ cdef class RingExtensionBackendReverseIsomorphism(RingExtensionHomomorphism): TESTS:: sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 5) # optional - sage.rings.number_field - sage: K = A.over() # optional - sage.rings.number_field - sage: A.convert_map_from(K) # optional - sage.rings.number_field + sage: A. = QQ.extension(x^2 - 5) # needs sage.rings.number_field + sage: K = A.over() # needs sage.rings.number_field + sage: A.convert_map_from(K) # needs sage.rings.number_field Canonical morphism: From: Field in a with defining polynomial x^2 - 5 over its base To: Number Field in a with defining polynomial x^2 - 5 @@ -660,13 +661,13 @@ cdef class RingExtensionBackendReverseIsomorphism(RingExtensionHomomorphism): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: f = GF(5^2).convert_map_from(K); f # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: f = GF(5^2).convert_map_from(K); f # needs sage.rings.finite_rings Canonical morphism: From: Field in a with defining polynomial x^2 + 4*x + 2 over its base To: Finite Field in z2 of size 5^2 - sage: f._repr_type() # optional - sage.rings.finite_rings + sage: f._repr_type() # needs sage.rings.finite_rings 'Canonical' """ return "Canonical" @@ -677,13 +678,13 @@ cdef class RingExtensionBackendReverseIsomorphism(RingExtensionHomomorphism): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: f = GF(5^2).convert_map_from(K); f # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: f = GF(5^2).convert_map_from(K); f # needs sage.rings.finite_rings Canonical morphism: From: Field in a with defining polynomial x^2 + 4*x + 2 over its base To: Finite Field in z2 of size 5^2 - sage: f._repr_defn() # optional - sage.rings.finite_rings + sage: f._repr_defn() # needs sage.rings.finite_rings '' """ return "" @@ -698,9 +699,9 @@ cdef class RingExtensionBackendReverseIsomorphism(RingExtensionHomomorphism): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) # optional - sage.rings.finite_rings - sage: f = GF(5^2).convert_map_from(K) # optional - sage.rings.finite_rings - sage: f(a) # optional - sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings + sage: f = GF(5^2).convert_map_from(K) # needs sage.rings.finite_rings + sage: f(a) # needs sage.rings.finite_rings z2 """ return (x)._backend @@ -713,9 +714,9 @@ cdef class MapFreeModuleToRelativeRing(Map): TESTS:: - sage: K = GF(5^2).over() # optional - sage.rings.finite_rings - sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings - sage: type(i) # optional - sage.rings.finite_rings + sage: K = GF(5^2).over() # needs sage.rings.finite_rings + sage: V, i, j = K.free_module() # needs sage.rings.finite_rings + sage: type(i) # needs sage.rings.finite_rings """ @@ -731,9 +732,9 @@ cdef class MapFreeModuleToRelativeRing(Map): TESTS:: - sage: K = GF(11^6).over(GF(11^3)) # optional - sage.rings.finite_rings - sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings - sage: i # optional - sage.rings.finite_rings + sage: K = GF(11^6).over(GF(11^3)) # needs sage.rings.finite_rings + sage: V, i, j = K.free_module() # needs sage.rings.finite_rings + sage: i # needs sage.rings.finite_rings Generic map: From: Vector space of dimension 2 over Finite Field in z3 of size 11^3 To: Field in z6 with defining polynomial x^2 + (10*z3^2 + z3 + 6)*x + z3 over its base @@ -751,9 +752,9 @@ cdef class MapFreeModuleToRelativeRing(Map): EXAMPLES:: - sage: K = GF(11^6).over(GF(11^3)) # optional - sage.rings.finite_rings - sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings - sage: i.is_injective() # optional - sage.rings.finite_rings + sage: K = GF(11^6).over(GF(11^3)) # needs sage.rings.finite_rings + sage: V, i, j = K.free_module() # needs sage.rings.finite_rings + sage: i.is_injective() # needs sage.rings.finite_rings True """ return True @@ -764,9 +765,9 @@ cdef class MapFreeModuleToRelativeRing(Map): EXAMPLES:: - sage: K = GF(11^6).over(GF(11^3)) # optional - sage.rings.finite_rings - sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings - sage: i.is_surjective() # optional - sage.rings.finite_rings + sage: K = GF(11^6).over(GF(11^3)) # needs sage.rings.finite_rings + sage: V, i, j = K.free_module() # needs sage.rings.finite_rings + sage: i.is_surjective() # needs sage.rings.finite_rings True """ return True @@ -781,9 +782,9 @@ cdef class MapFreeModuleToRelativeRing(Map): EXAMPLES:: - sage: K. = GF(11^6).over(GF(11^3)) # optional - sage.rings.finite_rings - sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings - sage: i((0,1)) # optional - sage.rings.finite_rings + sage: K. = GF(11^6).over(GF(11^3)) # needs sage.rings.finite_rings + sage: V, i, j = K.free_module() # needs sage.rings.finite_rings + sage: i((0,1)) # needs sage.rings.finite_rings a """ cdef Element elt @@ -800,9 +801,9 @@ cdef class MapRelativeRingToFreeModule(Map): TESTS:: - sage: K = GF(5^2).over() # optional - sage.rings.finite_rings - sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings - sage: type(j) # optional - sage.rings.finite_rings + sage: K = GF(5^2).over() # needs sage.rings.finite_rings + sage: V, i, j = K.free_module() # needs sage.rings.finite_rings + sage: type(j) # needs sage.rings.finite_rings """ @@ -818,9 +819,9 @@ cdef class MapRelativeRingToFreeModule(Map): TESTS:: - sage: K = GF(11^6).over(GF(11^3)) # optional - sage.rings.finite_rings - sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings - sage: j # optional - sage.rings.finite_rings + sage: K = GF(11^6).over(GF(11^3)) # needs sage.rings.finite_rings + sage: V, i, j = K.free_module() # needs sage.rings.finite_rings + sage: j # needs sage.rings.finite_rings Generic map: From: Field in z6 with defining polynomial x^2 + (10*z3^2 + z3 + 6)*x + z3 over its base To: Vector space of dimension 2 over Finite Field in z3 of size 11^3 @@ -860,9 +861,9 @@ cdef class MapRelativeRingToFreeModule(Map): EXAMPLES:: - sage: K = GF(11^6).over(GF(11^3)) # optional - sage.rings.finite_rings - sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings - sage: j.is_injective() # optional - sage.rings.finite_rings + sage: K = GF(11^6).over(GF(11^3)) # needs sage.rings.finite_rings + sage: V, i, j = K.free_module() # needs sage.rings.finite_rings + sage: j.is_injective() # needs sage.rings.finite_rings True """ return True @@ -873,9 +874,9 @@ cdef class MapRelativeRingToFreeModule(Map): EXAMPLES:: - sage: K = GF(11^6).over(GF(11^3)) # optional - sage.rings.finite_rings - sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings - sage: j.is_surjective() # optional - sage.rings.finite_rings + sage: K = GF(11^6).over(GF(11^3)) # needs sage.rings.finite_rings + sage: V, i, j = K.free_module() # needs sage.rings.finite_rings + sage: j.is_surjective() # needs sage.rings.finite_rings True """ return True @@ -890,9 +891,9 @@ cdef class MapRelativeRingToFreeModule(Map): EXAMPLES:: - sage: K. = GF(11^6).over(GF(11^3)) # optional - sage.rings.finite_rings - sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings - sage: j(a) # optional - sage.rings.finite_rings + sage: K. = GF(11^6).over(GF(11^3)) # needs sage.rings.finite_rings + sage: V, i, j = K.free_module() # needs sage.rings.finite_rings + sage: j(a) # needs sage.rings.finite_rings (0, 1) """ coeffs = self.backend_coefficients(x) @@ -909,9 +910,9 @@ cdef class MapRelativeRingToFreeModule(Map): TESTS:: - sage: K. = GF(11^9).over(GF(11^3)) # optional - sage.rings.finite_rings - sage: V, i, j = K.free_module() # optional - sage.rings.finite_rings - sage: j(a + 2*a^2) # indirect doctest # optional - sage.rings.finite_rings + sage: K. = GF(11^9).over(GF(11^3)) # needs sage.rings.finite_rings + sage: V, i, j = K.free_module() # needs sage.rings.finite_rings + sage: j(a + 2*a^2) # indirect doctest # needs sage.rings.finite_rings (0, 1, 2) """ cdef list coeffs = [ ] diff --git a/src/sage/rings/tate_algebra_ideal.pyx b/src/sage/rings/tate_algebra_ideal.pyx index e9b45049897..e230a411397 100644 --- a/src/sage/rings/tate_algebra_ideal.pyx +++ b/src/sage/rings/tate_algebra_ideal.pyx @@ -623,7 +623,7 @@ cdef TateAlgebraElement regular_reduce(sgb, TateAlgebraTerm s, TateAlgebraElemen TESTS:: - sage: cython( # optional - sage.misc.cython + sage: cython( # needs sage.misc.cython ....: ''' ....: from sage.rings.tate_algebra_ideal cimport regular_reduce ....: def python_regular_reduce(gb, s, v, stopval): @@ -638,11 +638,12 @@ cdef TateAlgebraElement regular_reduce(sgb, TateAlgebraTerm s, TateAlgebraElemen sage: p1 = (tx, x^3 + 9*x*y) sage: p2 = (ty, x*y + 3*x^2*y) - sage: python_regular_reduce([p1,p2], tx*ty, v, 8) # indirect doctest + sage: python_regular_reduce([p1,p2], tx*ty, v, 8) # indirect doctest # needs sage.misc.cython (2 + O(3^8))*x^2*y + (1 + O(3^8))*x + (1 + O(3^8))*y + O(3^8 * ) - sage: python_regular_reduce([p1,p2], tx, v, 8) # indirect doctest - (2 + 2*3 + 2*3^2 + 2*3^3 + 2*3^4 + 2*3^5 + 2*3^6 + 2*3^7 + O(3^8))*x^3 + (2 + O(3^8))*x^2*y + (1 + O(3^8))*x + (1 + O(3^8))*y + O(3^8 * ) + sage: python_regular_reduce([p1,p2], tx, v, 8) # indirect doctest # needs sage.misc.cython + (2 + 2*3 + 2*3^2 + 2*3^3 + 2*3^4 + 2*3^5 + 2*3^6 + 2*3^7 + O(3^8))*x^3 + + (2 + O(3^8))*x^2*y + (1 + O(3^8))*x + (1 + O(3^8))*y + O(3^8 * ) """ # We assume that the elements of the sgb are such that lt(g) = p^v lm(g) to # avoid performing divisions @@ -713,11 +714,12 @@ cdef TateAlgebraElement reduce(gb, TateAlgebraElement v, stopval): sage: v = (x + y + 2*x^2*y - x^3*y^2).add_bigoh(8) sage: g1 = x*y + 3*x^2*y sage: g2 = x^3 + 9*y - sage: python_reduce([g1,g2], v, 8) # indirect doctest + sage: python_reduce([g1,g2], v, 8) # indirect doctest # needs sage.misc.cython (1 + O(3^8))*x + (1 + O(3^8))*y + O(3^8 * ) - sage: python_reduce([g1,g2], v, 5) # indirect doctest - (1 + O(3^8))*x + (1 + O(3^8))*y + (3^5 + O(3^8))*x^8*y^2 + (3^5 + 2*3^6 + 2*3^7 + O(3^8))*x^7*y + O(3^8 * ) + sage: python_reduce([g1,g2], v, 5) # indirect doctest # needs sage.misc.cython + (1 + O(3^8))*x + (1 + O(3^8))*y + (3^5 + O(3^8))*x^8*y^2 + + (3^5 + 2*3^6 + 2*3^7 + O(3^8))*x^7*y + O(3^8 * ) """ cdef dict coeffs = { } cdef TateAlgebraElement f diff --git a/src/sage/rings/tests.py b/src/sage/rings/tests.py index 85977bf587b..1f9d195a048 100644 --- a/src/sage/rings/tests.py +++ b/src/sage/rings/tests.py @@ -23,9 +23,9 @@ def prime_finite_field(): EXAMPLES:: sage: import sage.rings.tests - sage: K = sage.rings.tests.prime_finite_field(); K # optional - sage.rings.finite_rings + sage: K = sage.rings.tests.prime_finite_field(); K # needs sage.rings.finite_rings Finite Field of size ... - sage: K.cardinality().is_prime() # optional - sage.rings.finite_rings + sage: K.cardinality().is_prime() # needs sage.rings.finite_rings True """ from sage.rings.integer_ring import ZZ @@ -42,11 +42,11 @@ def finite_field(): EXAMPLES:: sage: import sage.rings.tests - sage: K = sage.rings.tests.finite_field(); K # optional - sage.rings.finite_rings + sage: K = sage.rings.tests.finite_field(); K # needs sage.rings.finite_rings Finite Field...of size ... - sage: K.cardinality().is_prime_power() # optional - sage.rings.finite_rings + sage: K.cardinality().is_prime_power() # needs sage.rings.finite_rings True - sage: while K.cardinality().is_prime(): # optional - sage.rings.finite_rings + sage: while K.cardinality().is_prime(): # needs sage.rings.finite_rings ....: K = sage.rings.tests.finite_field() """ from sage.rings.integer_ring import ZZ @@ -64,13 +64,14 @@ def small_finite_field(): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: import sage.rings.tests - sage: K = sage.rings.tests.small_finite_field(); K # optional - sage.rings.finite_rings + sage: K = sage.rings.tests.small_finite_field(); K Finite Field...of size ... - sage: q = K.cardinality() # optional - sage.rings.finite_rings - sage: q.is_prime_power() # optional - sage.rings.finite_rings + sage: q = K.cardinality() + sage: q.is_prime_power() True - sage: q <= 2^16 # optional - sage.rings.finite_rings + sage: q <= 2^16 True """ from sage.rings.integer_ring import ZZ @@ -107,7 +108,7 @@ def padic_field(): EXAMPLES:: sage: import sage.rings.tests - sage: sage.rings.tests.padic_field() # optional - sage.rings.padics + sage: sage.rings.tests.padic_field() # needs sage.rings.padics ...-adic Field with capped relative precision ... """ from sage.rings.integer_ring import ZZ @@ -124,7 +125,7 @@ def quadratic_number_field(): EXAMPLES:: sage: import sage.rings.tests - sage: K = sage.rings.tests.quadratic_number_field(); K # optional - sage.rings.number_field + sage: K = sage.rings.tests.quadratic_number_field(); K # needs sage.rings.number_field Number Field in a with defining polynomial x^2 ... with a = ... """ from sage.rings.integer_ring import ZZ @@ -142,9 +143,9 @@ def absolute_number_field(maxdeg=10): EXAMPLES:: sage: import sage.rings.tests - sage: K = sage.rings.tests.absolute_number_field(); K # optional - sage.rings.number_field + sage: K = sage.rings.tests.absolute_number_field(); K # needs sage.rings.number_field Number Field in a with defining polynomial ... - sage: K.degree() <= 10 # optional - sage.rings.number_field + sage: K.degree() <= 10 # needs sage.rings.number_field True """ from sage.rings.integer_ring import ZZ @@ -166,27 +167,28 @@ def relative_number_field(n=2, maxdeg=2): EXAMPLES:: + sage: # needs sage.rings.number_field sage: import sage.rings.tests - sage: K = sage.rings.tests.relative_number_field(3); K # optional - sage.rings.number_field + sage: K = sage.rings.tests.relative_number_field(3); K Number Field in aaa with defining polynomial x^2 ... over its base field - sage: K.relative_degree() # optional - sage.rings.number_field + sage: K.relative_degree() 2 - sage: L = K.base_ring() # optional - sage.rings.number_field - sage: L.relative_degree() # optional - sage.rings.number_field + sage: L = K.base_ring() + sage: L.relative_degree() 2 - sage: M = L.base_ring() # optional - sage.rings.number_field - sage: M.relative_degree() # optional - sage.rings.number_field + sage: M = L.base_ring() + sage: M.relative_degree() 2 - sage: M.base_ring() is QQ # optional - sage.rings.number_field + sage: M.base_ring() is QQ True TESTS: Check that :trac:`32117` is fixed:: - sage: set_random_seed(3030) # optional - sage.rings.number_field - sage: from sage.rings.tests import relative_number_field # optional - sage.rings.number_field - sage: _ = relative_number_field(3) # optional - sage.rings.number_field + sage: set_random_seed(3030) + sage: from sage.rings.tests import relative_number_field + sage: _ = relative_number_field(3) # needs sage.rings.number_field """ from sage.rings.integer_ring import ZZ K = absolute_number_field(maxdeg) @@ -333,7 +335,7 @@ def test_random_elements(level=MAX_LEVEL, trials=1): EXAMPLES:: sage: import sage.rings.tests - sage: sage.rings.tests.test_random_elements(trials=2, seed=0) # optional - sage.rings.number_field + sage: sage.rings.tests.test_random_elements(trials=2, seed=0) # needs sage.rings.number_field survived 0 tests Rational Field -1/2 @@ -382,7 +384,7 @@ def test_random_arith(level=MAX_LEVEL, trials=1): EXAMPLES:: sage: import sage.rings.tests - sage: sage.rings.tests.test_random_arith(trials=2, seed=0) # optional - sage.rings.number_field + sage: sage.rings.tests.test_random_arith(trials=2, seed=0) # needs sage.rings.number_field survived 0 tests Rational Field -1/2 -1/95 @@ -392,9 +394,9 @@ def test_random_arith(level=MAX_LEVEL, trials=1): a -2*a - 1 2*a - 30164 - sage: sage.rings.tests.test_random_arith(trials=10) # optional - sage.rings.finite_rings + sage: sage.rings.tests.test_random_arith(trials=10) # needs sage.rings.finite_rings survived 0 tests... - sage: sage.rings.tests.test_random_arith(trials=1000) # long time (5 seconds?), optional - sage.rings.finite_rings + sage: sage.rings.tests.test_random_arith(trials=1000) # long time (5 seconds?), needs sage.rings.finite_rings survived 0 tests... """ i = 0 @@ -438,15 +440,15 @@ def test_karatsuba_multiplication(base_ring, maxdeg1, maxdeg2, Test Karatsuba multiplication of polynomials of small degree over some common rings:: sage: rings = [QQ] - sage: rings += [ZZ[I], ZZ[I, sqrt(2)]] # optional - sage.rings.number_field - sage: rings += [GF(49, 'a')] # optional - sage.rings.finite_rings - sage: rings += [MatrixSpace(GF(17), 3)] # optional - sage.rings.finite_rings sage.modules + sage: rings += [ZZ[I], ZZ[I, sqrt(2)]] # needs sage.rings.number_field sage.symbolic + sage: rings += [GF(49, 'a')] # needs sage.rings.finite_rings + sage: rings += [MatrixSpace(GF(17), 3)] # needs sage.modules sage.rings.finite_rings sage: for C in rings: ....: test_karatsuba_multiplication(C, 10, 10) Zero-tests over ``QQbar`` are currently very slow, so we test only very small examples:: - sage: test_karatsuba_multiplication(QQbar, 3, 3, numtests=2) # long time # optional - sage.rings.number_field + sage: test_karatsuba_multiplication(QQbar, 3, 3, numtests=2) # long time, needs sage.rings.number_field Larger degrees (over ``ZZ``, using FLINT):: diff --git a/src/sage/rings/universal_cyclotomic_field.py b/src/sage/rings/universal_cyclotomic_field.py index 173224323ce..0c77ff11fb6 100644 --- a/src/sage/rings/universal_cyclotomic_field.py +++ b/src/sage/rings/universal_cyclotomic_field.py @@ -523,14 +523,14 @@ def _symbolic_(self, R): r""" TESTS:: - sage: SR(E(7)) # optional - sage.symbolic + sage: SR(E(7)) # needs sage.symbolic e^(2/7*I*pi) - sage: SR(E(5) + 2*E(5,2) + 3*E(5,3)) # optional - sage.symbolic + sage: SR(E(5) + 2*E(5,2) + 3*E(5,3)) # needs sage.symbolic -sqrt(5) + 1/4*I*sqrt(2*sqrt(5) + 10) - 1/4*I*sqrt(-2*sqrt(5) + 10) - 3/2 Test that the bug reported in :trac:`19912` has been fixed:: - sage: SR(1+E(4)) # optional - sage.symbolic + sage: SR(1+E(4)) # needs sage.symbolic I + 1 """ from sage.symbolic.constants import pi, I @@ -582,7 +582,8 @@ def to_cyclotomic_field(self, R=None): Using a non-standard embedding:: - sage: CF = CyclotomicField(5,embedding=CC(exp(4*pi*i/5))) + sage: # needs sage.symbolic + sage: CF = CyclotomicField(5, embedding=CC(exp(4*pi*i/5))) sage: x = E(5) sage: CC(x) 0.309016994374947 + 0.951056516295154*I @@ -723,7 +724,7 @@ def _eval_real_(self, R): sage: RR(E(7) + E(7,6)) 1.24697960371747 - sage: 2*cos(2*pi/7).n() + sage: 2*cos(2*pi/7).n() # needs sage.symbolic 1.24697960371747 Check that units are evaluated correctly (:trac:`23775`):: @@ -1485,7 +1486,7 @@ def _element_constructor_(self, elt): Some conversions from symbolic functions are possible:: sage: UCF = UniversalCyclotomicField() - sage: [UCF(sin(pi/k, hold=True)) for k in range(1,10)] + sage: [UCF(sin(pi/k, hold=True)) for k in range(1,10)] # needs sage.symbolic [0, 1, -1/2*E(12)^7 + 1/2*E(12)^11, @@ -1495,7 +1496,7 @@ def _element_constructor_(self, elt): -1/2*E(28)^19 + 1/2*E(28)^23, 1/2*E(16)^3 - 1/2*E(16)^5, -1/2*E(36)^25 + 1/2*E(36)^29] - sage: [UCF(cos(pi/k, hold=True)) for k in range(1,10)] + sage: [UCF(cos(pi/k, hold=True)) for k in range(1,10)] # needs sage.symbolic [-1, 0, 1/2, @@ -1506,8 +1507,9 @@ def _element_constructor_(self, elt): 1/2*E(16) - 1/2*E(16)^7, -1/2*E(9)^4 - 1/2*E(9)^5] - sage: UCF(1 + sqrt(-3/5)) - 4/5*E(15) + 4/5*E(15)^2 + 4/5*E(15)^4 + 6/5*E(15)^7 + 4/5*E(15)^8 + 6/5*E(15)^11 + 6/5*E(15)^13 + 6/5*E(15)^14 + sage: UCF(1 + sqrt(-3/5)) # needs sage.symbolic + 4/5*E(15) + 4/5*E(15)^2 + 4/5*E(15)^4 + 6/5*E(15)^7 + 4/5*E(15)^8 + + 6/5*E(15)^11 + 6/5*E(15)^13 + 6/5*E(15)^14 .. TODO:: From ffb797f52c6909aa68040b97eaa8046924088f12 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 13 Jul 2023 22:27:33 -0700 Subject: [PATCH 323/423] sage.rings: Update # needs --- src/sage/rings/continued_fraction.py | 59 ++++++++++++----------- src/sage/rings/fraction_field_element.pyx | 5 +- src/sage/rings/infinity.py | 4 +- src/sage/rings/integer.pyx | 5 +- src/sage/rings/power_series_ring.py | 6 +-- src/sage/rings/real_double.pyx | 3 +- 6 files changed, 44 insertions(+), 38 deletions(-) diff --git a/src/sage/rings/continued_fraction.py b/src/sage/rings/continued_fraction.py index c25a89cfd90..fa5ce286f6d 100644 --- a/src/sage/rings/continued_fraction.py +++ b/src/sage/rings/continued_fraction.py @@ -624,24 +624,25 @@ def _mpfr_(self, R): sage: cf.n(digits=8) 0.63459101 + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2, 'a', embedding=1.25) # needs sage.rings.number_field - sage: b = 504/253*a^2 + 635/253*a + 661/253 # needs sage.rings.number_field - sage: cf = continued_fraction(b); cf # needs sage.rings.number_field + sage: K. = NumberField(x^3 - 2, 'a', embedding=1.25) + sage: b = 504/253*a^2 + 635/253*a + 661/253 + sage: cf = continued_fraction(b); cf [8; 1, 14, 1, 10, 2, 1, 4, 12, 2, 3, 2, 1, 3, 4, 1, 1, 2, 14, 3, ...] - sage: cf.n(digits=3) # needs sage.rings.number_field + sage: cf.n(digits=3) 8.94 - sage: cf.n(digits=6) # needs sage.rings.number_field + sage: cf.n(digits=6) 8.93715 - sage: cf.n(digits=7) # needs sage.rings.number_field + sage: cf.n(digits=7) 8.937154 - sage: cf.n(digits=8) # needs sage.rings.number_field + sage: cf.n(digits=8) 8.9371541 - sage: cf.n(digits=9) # needs sage.rings.number_field + sage: cf.n(digits=9) 8.93715414 - sage: cf.n(digits=10) # needs sage.rings.number_field + sage: cf.n(digits=10) 8.937154138 - sage: cf.n(digits=11) # needs sage.rings.number_field + sage: cf.n(digits=11) 8.9371541378 TESTS: @@ -1919,19 +1920,20 @@ def quotient(self, n): The same computation with an element of a number field instead of ``pi`` gives a very satisfactory answer:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 - 2, embedding=1.25) # needs sage.rings.number_field - sage: c2 = continued_fraction(a2) # needs sage.rings.number_field - sage: p0 = c2.numerator(111); q0 = c2.denominator(111) # needs sage.rings.number_field - sage: p1 = c2.numerator(112); q1 = c2.denominator(112) # needs sage.rings.number_field - sage: num = (q0*a2 - p0); num.n() # needs sage.rings.number_field + sage: K. = NumberField(x^3 - 2, embedding=1.25) + sage: c2 = continued_fraction(a2) + sage: p0 = c2.numerator(111); q0 = c2.denominator(111) + sage: p1 = c2.numerator(112); q1 = c2.denominator(112) + sage: num = (q0*a2 - p0); num.n() -4.56719261665907e46 - sage: den = (q1*a2 - p1); den.n() # needs sage.rings.number_field + sage: den = (q1*a2 - p1); den.n() -3.65375409332726e47 - sage: a2 = -num/den # needs sage.rings.number_field - sage: b2 = RIF(a2); b2 # needs sage.rings.number_field + sage: a2 = -num/den + sage: b2 = RIF(a2); b2 1.002685823312715? - sage: b2.absolute_diameter() # needs sage.rings.number_field + sage: b2.absolute_diameter() 8.88178419700125e-16 The consequence is that the precision needed with ``c1`` grows when we @@ -2442,7 +2444,7 @@ def continued_fraction_list(x, type="std", partial_convergents=False, Fixed :trac:`18901`:: sage: a = 1.575709393346379 - sage: type(a) + sage: type(a) # needs sage.rings.real_mpfr sage: continued_fraction_list(a) [1, 1, 1, 2, 1, 4, 18, 1, 5, 2, 25037802, 7, 1, 3, 1, 28, 1, 8, 2] @@ -2575,20 +2577,21 @@ def continued_fraction(x, value=None): ``sqrt(2)`` above), it is much more convenient to use number fields as follows since preperiods and periods are computed:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 - 5, embedding=2.23) # needs sage.rings.number_field - sage: my_golden_ratio = (1 + sqrt5)/2 # needs sage.rings.number_field - sage: cf = continued_fraction((1+sqrt5)/2); cf # needs sage.rings.number_field + sage: K. = NumberField(x^2 - 5, embedding=2.23) + sage: my_golden_ratio = (1 + sqrt5)/2 + sage: cf = continued_fraction((1+sqrt5)/2); cf [(1)*] - sage: cf.convergent(12) # needs sage.rings.number_field + sage: cf.convergent(12) 377/233 - sage: cf.period() # needs sage.rings.number_field + sage: cf.period() (1,) - sage: cf = continued_fraction(2/3+sqrt5/5); cf # needs sage.rings.number_field + sage: cf = continued_fraction(2/3+sqrt5/5); cf [1; 8, (1, 3, 1, 1, 3, 9)*] - sage: cf.preperiod() # needs sage.rings.number_field + sage: cf.preperiod() (1, 8) - sage: cf.period() # needs sage.rings.number_field + sage: cf.period() (1, 3, 1, 1, 3, 9) sage: # needs sage.rings.number_field diff --git a/src/sage/rings/fraction_field_element.pyx b/src/sage/rings/fraction_field_element.pyx index d8517147070..ff79aa0c53b 100644 --- a/src/sage/rings/fraction_field_element.pyx +++ b/src/sage/rings/fraction_field_element.pyx @@ -145,6 +145,7 @@ cdef class FractionFieldElement(FieldElement): :: + sage: # needs sage.rings.number_field sage: Zx. = ZZ[] sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field sage: cc = K.hom([-i]) # needs sage.rings.number_field @@ -765,8 +766,8 @@ cdef class FractionFieldElement(FieldElement): """ EXAMPLES:: - sage: K. = Frac(I.parent()['x,y']) - sage: complex(x/(I*x) + (I*y)/y) + sage: K. = Frac(I.parent()['x,y']) # needs sage.symbolic + sage: complex(x/(I*x) + (I*y)/y) # needs sage.symbolic 0j """ return complex(self.__numerator) / complex(self.__denominator) diff --git a/src/sage/rings/infinity.py b/src/sage/rings/infinity.py index 19b52f7b242..eddcc8ccb57 100644 --- a/src/sage/rings/infinity.py +++ b/src/sage/rings/infinity.py @@ -379,7 +379,7 @@ def _add_(self, other): Traceback (most recent call last): ... SignError: cannot add unsigned infinities - sage: unsigned_infinity + oo*i + sage: unsigned_infinity + oo*i # needs sage.symbolic Traceback (most recent call last): ... SignError: cannot add unsigned infinities @@ -416,7 +416,7 @@ def _sub_(self, other): Traceback (most recent call last): ... SignError: cannot subtract unsigned infinities - sage: unsigned_infinity - oo*i + sage: unsigned_infinity - oo*i # needs sage.symbolic Traceback (most recent call last): ... SignError: cannot subtract unsigned infinities diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index 3e9fe6ce885..c64b0fb1156 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -4878,9 +4878,10 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: ZZ(5).global_height() # needs sage.rings.real_mpfr + sage: # needs sage.rings.real_mpfr + sage: ZZ(5).global_height() 1.60943791243410 - sage: ZZ(-2).global_height(prec=100) # needs sage.rings.real_mpfr + sage: ZZ(-2).global_height(prec=100) 0.69314718055994530941723212146 sage: exp(_) 2.0000000000000000000000000000 diff --git a/src/sage/rings/power_series_ring.py b/src/sage/rings/power_series_ring.py index e687681827d..034adde8f32 100644 --- a/src/sage/rings/power_series_ring.py +++ b/src/sage/rings/power_series_ring.py @@ -98,10 +98,10 @@ Choose another implementation of the attached polynomial ring:: sage: R. = PowerSeriesRing(ZZ) - sage: type(t.polynomial()) + sage: type(t.polynomial()) # needs sage.libs.flint <... 'sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint'> - sage: S. = PowerSeriesRing(ZZ, implementation='NTL') - sage: type(s.polynomial()) + sage: S. = PowerSeriesRing(ZZ, implementation='NTL') # needs sage.libs.ntl + sage: type(s.polynomial()) # needs sage.libs.ntl <... 'sage.rings.polynomial.polynomial_integer_dense_ntl.Polynomial_integer_dense_ntl'> AUTHORS: diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index 7fa6e4c6847..6be5c1211b9 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -676,7 +676,8 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): sage: f.factor() # abs tol 2e-5 # needs numpy (x - 1.0000065719436413) * (x^2 - 1.9999934280563585*x + 0.9999934280995487) """ - roots = f.roots(sage.rings.complex_double.CDF) + from sage.rings.complex_double import CDF + roots = f.roots(CDF) # collect real roots and conjugate pairs of non-real roots real_roots = [(r, e) for r, e in roots if r.imag().is_zero()] From 975b18106d03c6899eb2f08001e0d796914fefe2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 14 Jul 2023 00:18:52 -0700 Subject: [PATCH 324/423] sage.rings: Update # needs --- src/sage/rings/complex_double.pyx | 37 ++++++++++++++++--------------- src/sage/rings/complex_mpfr.pyx | 24 ++++++++++---------- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx index 1cabe39fedf..4b7fb798a67 100644 --- a/src/sage/rings/complex_double.pyx +++ b/src/sage/rings/complex_double.pyx @@ -315,13 +315,13 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): 2.0 - 3.0*I sage: CDF(4.5) # indirect doctest 4.5 - sage: CDF(1+I) # indirect doctest + sage: CDF(1+I) # indirect doctest # needs sage.symbolic 1.0 + 1.0*I - sage: CDF(pari(1)) + sage: CDF(pari(1)) # needs sage.libs.pari 1.0 - sage: CDF(pari("I")) + sage: CDF(pari("I")) # needs sage.libs.pari 1.0*I - sage: CDF(pari("x^2 + x + 1").polroots()[0]) + sage: CDF(pari("x^2 + x + 1").polroots()[0]) # needs sage.libs.pari -0.5 - 0.8660254037844386*I sage: from gmpy2 import mpc sage: CDF(mpc('2.0+1.0j')) @@ -338,22 +338,22 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): numbers and higher-precision ones, though of course there may be loss of precision:: - sage: a = ComplexField(200)(-2).sqrt(); a + sage: a = ComplexField(200)(-2).sqrt(); a # needs sage.rings.real_mpfr 1.4142135623730950488016887242096980785696718753769480731767*I - sage: b = CDF(a); b + sage: b = CDF(a); b # needs sage.rings.real_mpfr 1.4142135623730951*I - sage: a.parent()(b) + sage: a.parent()(b) # needs sage.rings.real_mpfr 1.4142135623730951454746218587388284504413604736328125000000*I - sage: a.parent()(b) == b + sage: a.parent()(b) == b # needs sage.rings.real_mpfr True - sage: b == CC(a) + sage: b == CC(a) # needs sage.rings.real_mpfr True TESTS: Check that :trac:`31836` is fixed:: - sage: a = CDF() ; a + sage: a = CDF(); a 0.0 sage: a.parent() Complex Double Field @@ -428,7 +428,8 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): TESTS:: - sage: CDF(1) + RR(1) + sage: # needs sage.rings.real_mpfr + sage: CDF(1) + RR(1) # needs sage.rings.real_mpfr 2.0 sage: CDF.0 - CC(1) - int(1) - RR(1) - QQbar(1) # needs sage.rings.number_field -4.0 + 1.0*I @@ -1014,7 +1015,7 @@ cdef class ComplexDoubleElement(FieldElement): sage: CDF.0._maxima_init_() '1.0000000000000000*%i' - sage: CDF(.5 + I)._maxima_init_() + sage: CDF(.5 + I)._maxima_init_() # needs sage.symbolic '0.50000000000000000 + 1.0000000000000000*%i' """ from .complex_mpfr import ComplexField @@ -1356,11 +1357,11 @@ cdef class ComplexDoubleElement(FieldElement): sage: CDF(6).argument() 0.0 - sage: CDF(i).argument() + sage: CDF(i).argument() # needs sage.symbolic 1.5707963267948966 sage: CDF(-1).argument() 3.141592653589793 - sage: CDF(-1 - 0.000001*i).argument() + sage: CDF(-1 - 0.000001*i).argument() # needs sage.symbolic -3.1415916535897934 """ return RealDoubleElement(gsl_complex_arg(self._complex)) @@ -1572,7 +1573,7 @@ cdef class ComplexDoubleElement(FieldElement): sage: CDF(0.5).is_integer() False - sage: CDF(I).is_integer() + sage: CDF(I).is_integer() # needs sage.symbolic False sage: CDF(2).is_integer() True @@ -2298,8 +2299,8 @@ cdef class ComplexDoubleElement(FieldElement): EXAMPLES:: - sage: i = CDF(I) - sage: (1+i).agm(2-i) # rel tol 1e-15 + sage: i = CDF(I) # needs sage.symbolic + sage: (1+i).agm(2-i) # rel tol 1e-15 # needs sage.symbolic 1.6278054848727064 + 0.1368275483973686*I An example to show that the returned value depends on the algorithm @@ -2547,7 +2548,7 @@ cdef class FloatToCDF(Morphism): 1.0 + 2.0*I sage: CDF('i') # indirect doctest 1.0*I - sage: CDF(2+i) # indirect doctest + sage: CDF(2+i) # indirect doctest # needs sage.symbolic 2.0 + 1.0*I """ cdef ComplexDoubleElement z = ComplexDoubleElement.__new__(ComplexDoubleElement) diff --git a/src/sage/rings/complex_mpfr.pyx b/src/sage/rings/complex_mpfr.pyx index 8ab4706ff1a..93ff6c213d8 100644 --- a/src/sage/rings/complex_mpfr.pyx +++ b/src/sage/rings/complex_mpfr.pyx @@ -146,11 +146,11 @@ def is_ComplexNumber(x): while elements of the class :class:`ComplexField_class` are of type :class:`ComplexNumber`:: - sage: c = 1 + 2*I - sage: is_ComplexNumber(c) + sage: c = 1 + 2*I # needs sage.symbolic + sage: is_ComplexNumber(c) # needs sage.symbolic False - sage: d = CC(1 + 2*I) - sage: is_ComplexNumber(d) + sage: d = CC(1 + 2*I) # needs sage.symbolic + sage: is_ComplexNumber(d) # needs sage.symbolic True """ return isinstance(x, ComplexNumber) @@ -457,12 +457,12 @@ class ComplexField_class(sage.rings.abc.ComplexField): 1.00000000000000 + 1.00000000000000*I sage: CC(2,3) 2.00000000000000 + 3.00000000000000*I - sage: CC(QQ[I].gen()) + sage: CC(QQ[I].gen()) # needs sage.symbolic 1.00000000000000*I - sage: CC.gen() + QQ[I].gen() + sage: CC.gen() + QQ[I].gen() # needs sage.symbolic 2.00000000000000*I sage: x = polygen(ZZ, 'x') - sage: CC.gen() + QQ.extension(x^2 + 1, 'I', embedding=None).gen() + sage: CC.gen() + QQ.extension(x^2 + 1, 'I', embedding=None).gen() # needs sage.rings.number_field Traceback (most recent call last): ... TypeError: unsupported operand parent(s) for +: 'Complex Field with 53 bits of precision' and 'Number Field in I with defining polynomial x^2 + 1' @@ -982,7 +982,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): Check that :trac:`12038` is resolved:: sage: from sage.rings.complex_mpfr import ComplexNumber as CN - sage: coerce(CN, 1+I) + sage: coerce(CN, 1+I) # needs sage.symbolic Traceback (most recent call last): ... TypeError: ...__init__() takes at least 2 positional arguments (1 given) @@ -999,11 +999,11 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: s1 = CC(exp(I)); s1 + sage: s1 = CC(exp(I)); s1 # needs sage.symbolic 0.540302305868140 + 0.841470984807897*I - sage: s1._interface_init_() + sage: s1._interface_init_() # needs sage.symbolic '0.54030230586813977 + 0.84147098480789650*I' - sage: s1 == CC(gp(s1)) + sage: s1 == CC(gp(s1)) # needs sage.libs.pari sage.symbolic True """ return self.str() @@ -1026,7 +1026,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): sage: CC.0._maxima_init_() '1.0000000000000000*%i' - sage: CC(.5 + I)._maxima_init_() + sage: CC(.5 + I)._maxima_init_() # needs sage.symbolic '0.50000000000000000 + 1.0000000000000000*%i' """ return self.str(istr='%i') From 35f4d526cac6ef1441c04d2b47a4ca089e28085a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 15 Jul 2023 23:55:19 -0700 Subject: [PATCH 325/423] sage.rings: Update # needs --- src/sage/rings/complex_double.pyx | 13 +-- src/sage/rings/complex_mpfr.pyx | 9 +- src/sage/rings/fraction_field_element.pyx | 12 +-- src/sage/rings/ideal.py | 13 +-- src/sage/rings/integer_fake.pxd | 2 +- src/sage/rings/invariants/invariant_theory.py | 9 +- src/sage/rings/morphism.pyx | 83 ++++++++++--------- src/sage/rings/ring.pyx | 9 +- src/sage/rings/ring_extension.pyx | 22 ++--- src/sage/rings/ring_extension_morphism.pyx | 9 +- .../non_negative_integer_semiring.py | 8 +- .../rings/semirings/tropical_semiring.pyx | 24 +++--- 12 files changed, 114 insertions(+), 99 deletions(-) diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx index 4b7fb798a67..7f3b7f63327 100644 --- a/src/sage/rings/complex_double.pyx +++ b/src/sage/rings/complex_double.pyx @@ -338,15 +338,16 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): numbers and higher-precision ones, though of course there may be loss of precision:: - sage: a = ComplexField(200)(-2).sqrt(); a # needs sage.rings.real_mpfr + sage: # needs sage.rings.real_mpfr + sage: a = ComplexField(200)(-2).sqrt(); a 1.4142135623730950488016887242096980785696718753769480731767*I - sage: b = CDF(a); b # needs sage.rings.real_mpfr + sage: b = CDF(a); b 1.4142135623730951*I - sage: a.parent()(b) # needs sage.rings.real_mpfr + sage: a.parent()(b) 1.4142135623730951454746218587388284504413604736328125000000*I - sage: a.parent()(b) == b # needs sage.rings.real_mpfr + sage: a.parent()(b) == b True - sage: b == CC(a) # needs sage.rings.real_mpfr + sage: b == CC(a) True TESTS: @@ -429,7 +430,7 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): TESTS:: sage: # needs sage.rings.real_mpfr - sage: CDF(1) + RR(1) # needs sage.rings.real_mpfr + sage: CDF(1) + RR(1) 2.0 sage: CDF.0 - CC(1) - int(1) - RR(1) - QQbar(1) # needs sage.rings.number_field -4.0 + 1.0*I diff --git a/src/sage/rings/complex_mpfr.pyx b/src/sage/rings/complex_mpfr.pyx index 93ff6c213d8..1b865147962 100644 --- a/src/sage/rings/complex_mpfr.pyx +++ b/src/sage/rings/complex_mpfr.pyx @@ -146,11 +146,12 @@ def is_ComplexNumber(x): while elements of the class :class:`ComplexField_class` are of type :class:`ComplexNumber`:: - sage: c = 1 + 2*I # needs sage.symbolic - sage: is_ComplexNumber(c) # needs sage.symbolic + sage: # needs sage.symbolic + sage: c = 1 + 2*I + sage: is_ComplexNumber(c) False - sage: d = CC(1 + 2*I) # needs sage.symbolic - sage: is_ComplexNumber(d) # needs sage.symbolic + sage: d = CC(1 + 2*I) + sage: is_ComplexNumber(d) True """ return isinstance(x, ComplexNumber) diff --git a/src/sage/rings/fraction_field_element.pyx b/src/sage/rings/fraction_field_element.pyx index ff79aa0c53b..ca130dfb0df 100644 --- a/src/sage/rings/fraction_field_element.pyx +++ b/src/sage/rings/fraction_field_element.pyx @@ -147,12 +147,12 @@ cdef class FractionFieldElement(FieldElement): sage: # needs sage.rings.number_field sage: Zx. = ZZ[] - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: cc = K.hom([-i]) # needs sage.rings.number_field - sage: R. = K[] # needs sage.rings.number_field - sage: F = R.fraction_field() # needs sage.rings.number_field - sage: phi = F.hom([F(b), F(a)], base_map=cc) # needs sage.rings.number_field - sage: phi(i/a) # needs sage.rings.number_field + sage: K. = NumberField(x^2 + 1) + sage: cc = K.hom([-i]) + sage: R. = K[] + sage: F = R.fraction_field() + sage: phi = F.hom([F(b), F(a)], base_map=cc) + sage: phi(i/a) ((-i))/b """ nnum = codomain.coerce(self.__numerator._im_gens_(codomain, im_gens, base_map=base_map)) diff --git a/src/sage/rings/ideal.py b/src/sage/rings/ideal.py index 97694acde35..1e6ff303384 100644 --- a/src/sage/rings/ideal.py +++ b/src/sage/rings/ideal.py @@ -510,15 +510,16 @@ def apply_morphism(self, phi): TESTS:: + sage: # needs sage.rings.number_fields sage: x = polygen(ZZ) - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_fields - sage: A = K.ideal(a) # needs sage.rings.number_fields - sage: taus = K.embeddings(K) # needs sage.rings.number_fields - sage: A.apply_morphism(taus[0]) # identity # needs sage.rings.number_fields + sage: K. = NumberField(x^2 + 1) + sage: A = K.ideal(a) + sage: taus = K.embeddings(K) + sage: A.apply_morphism(taus[0]) # identity Fractional ideal (a) - sage: A.apply_morphism(taus[1]) # complex conjugation # needs sage.rings.number_fields + sage: A.apply_morphism(taus[1]) # complex conjugation Fractional ideal (-a) - sage: A.apply_morphism(taus[0]) == A.apply_morphism(taus[1]) # needs sage.rings.number_fields + sage: A.apply_morphism(taus[0]) == A.apply_morphism(taus[1]) True :: diff --git a/src/sage/rings/integer_fake.pxd b/src/sage/rings/integer_fake.pxd index d900190f74d..4a02062c64b 100644 --- a/src/sage/rings/integer_fake.pxd +++ b/src/sage/rings/integer_fake.pxd @@ -17,7 +17,7 @@ This provides two functions: TESTS:: - sage: cython( # optional - sage.misc.cython + sage: cython( # needs sage.misc.cython ....: ''' ....: from sage.rings.integer_fake cimport Integer_AS_MPZ, is_Integer ....: from sage.rings.integer cimport Integer diff --git a/src/sage/rings/invariants/invariant_theory.py b/src/sage/rings/invariants/invariant_theory.py index f9b7f6a561b..5db39fd3b9d 100644 --- a/src/sage/rings/invariants/invariant_theory.py +++ b/src/sage/rings/invariants/invariant_theory.py @@ -214,14 +214,15 @@ def transvectant(f, g, h=1, scale='default'): factor will not be invertible in that case. The scale argument ``'none'`` can be used to compute the transvectant in this case:: - sage: R. = GF(5)[] # optional - sage.rings.finite_rings - sage: f = AlgebraicForm(2, 5, a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(5)[] + sage: f = AlgebraicForm(2, 5, a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 ....: + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5, x0, x1) - sage: transvectant(f, f, 4) # optional - sage.rings.finite_rings + sage: transvectant(f, f, 4) Traceback (most recent call last): ... ZeroDivisionError - sage: transvectant(f, f, 4, scale='none') # optional - sage.rings.finite_rings + sage: transvectant(f, f, 4, scale='none') Binary quadratic given by -a3^2*x0^2 + a2*a4*x0^2 + a2*a3*x0*x1 - a1*a4*x0*x1 - a2^2*x1^2 + a1*a3*x1^2 diff --git a/src/sage/rings/morphism.pyx b/src/sage/rings/morphism.pyx index 565d1b69316..af08b480dea 100644 --- a/src/sage/rings/morphism.pyx +++ b/src/sage/rings/morphism.pyx @@ -2468,11 +2468,12 @@ cdef class RingHomomorphism_from_fraction_field(RingHomomorphism): TESTS:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) # needs sage.rings.number_field - sage: f = A.coerce_map_from(ZZ) # needs sage.rings.number_field - sage: g = f.extend_to_fraction_field() # indirect doctest # needs sage.rings.number_field - sage: g # needs sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 2) + sage: f = A.coerce_map_from(ZZ) + sage: g = f.extend_to_fraction_field() # indirect doctest + sage: g Ring morphism: From: Rational Field To: Number Field in a with defining polynomial x^2 - 2 @@ -2521,8 +2522,9 @@ cdef class RingHomomorphism_from_fraction_field(RingHomomorphism): TESTS:: + sage: # needs sage.libs.singular sage: S. = QQ[] - sage: f = S.hom([x + 1]).extend_to_fraction_field() # needs sage.libs.singular + sage: f = S.hom([x + 1]).extend_to_fraction_field() sage: g = copy(f) # indirect doctest # needs sage.libs.singular sage: f == g # needs sage.libs.singular @@ -2665,12 +2667,13 @@ cdef class RingHomomorphism_cover(RingHomomorphism): EXAMPLES:: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ, 2) - sage: S. = R.quo(x^2 + y^2) # needs sage.libs.singular - sage: phi = S.cover() # needs sage.libs.singular - sage: phi == loads(dumps(phi)) # needs sage.libs.singular + sage: S. = R.quo(x^2 + y^2) + sage: phi = S.cover() + sage: phi == loads(dumps(phi)) True - sage: phi == R.quo(x^2 + y^3).cover() # needs sage.libs.singular + sage: phi == R.quo(x^2 + y^3).cover() False """ if not isinstance(other, RingHomomorphism_cover): @@ -2685,14 +2688,15 @@ cdef class RingHomomorphism_cover(RingHomomorphism): TESTS:: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ, 2) - sage: S. = R.quo(x^2 + y^2) # needs sage.libs.singular - sage: phi = S.cover() # needs sage.libs.singular - sage: type(phi) # needs sage.libs.singular + sage: S. = R.quo(x^2 + y^2) + sage: phi = S.cover() + sage: type(phi) - sage: hash(phi) == hash(phi) # needs sage.libs.singular + sage: hash(phi) == hash(phi) True - sage: {phi: 1}[phi] # needs sage.libs.singular + sage: {phi: 1}[phi] 1 """ return hash((self.domain(), self.codomain())) @@ -2757,17 +2761,18 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): EXAMPLES:: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ, 3) - sage: S. = R.quo(x^3 + y^3 + z^3) # needs sage.libs.singular - sage: phi = S.hom([b, c, a]); phi # needs sage.libs.singular + sage: S. = R.quo(x^3 + y^3 + z^3) + sage: phi = S.hom([b, c, a]); phi Ring endomorphism of Quotient of Multivariate Polynomial Ring in x, y, z over Rational Field by the ideal (x^3 + y^3 + z^3) Defn: a |--> b b |--> c c |--> a - sage: phi(a + b + c) # needs sage.libs.singular + sage: phi(a + b + c) a + b + c - sage: loads(dumps(phi)) == phi # needs sage.libs.singular + sage: loads(dumps(phi)) == phi True Validity of the homomorphism is determined, when possible, and a @@ -2813,22 +2818,23 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): EXAMPLES:: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ, 3) - sage: S. = R.quo(x^3 + y^3 + z^3) # needs sage.libs.singular - sage: phi = S.hom([b, c, a]); phi # needs sage.libs.singular + sage: S. = R.quo(x^3 + y^3 + z^3) + sage: phi = S.hom([b, c, a]); phi Ring endomorphism of Quotient of Multivariate Polynomial Ring in x, y, z over Rational Field by the ideal (x^3 + y^3 + z^3) Defn: a |--> b b |--> c c |--> a - sage: phi(a + b + c) # needs sage.libs.singular + sage: phi(a + b + c) a + b + c - sage: psi = copy(phi) # indirect doctest # needs sage.libs.singular - sage: psi == phi # needs sage.libs.singular + sage: psi = copy(phi) # indirect doctest + sage: psi == phi True - sage: psi is phi # needs sage.libs.singular + sage: psi is phi False - sage: psi(a) == phi(a) # needs sage.libs.singular + sage: psi(a) == phi(a) True """ @@ -2841,22 +2847,23 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): EXAMPLES:: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ, 3) - sage: S. = R.quo(x^3 + y^3 + z^3) # needs sage.libs.singular - sage: phi = S.hom([b, c, a]); phi # needs sage.libs.singular + sage: S. = R.quo(x^3 + y^3 + z^3) + sage: phi = S.hom([b, c, a]); phi Ring endomorphism of Quotient of Multivariate Polynomial Ring in x, y, z over Rational Field by the ideal (x^3 + y^3 + z^3) Defn: a |--> b b |--> c c |--> a - sage: phi(a + b + c) # needs sage.libs.singular + sage: phi(a + b + c) a + b + c - sage: psi = copy(phi) # indirect doctest # needs sage.libs.singular - sage: psi == phi # needs sage.libs.singular + sage: psi = copy(phi) # indirect doctest + sage: psi == phi True - sage: psi is phi # needs sage.libs.singular + sage: psi is phi False - sage: psi(a) == phi(a) # needs sage.libs.singular + sage: psi(a) == phi(a) True """ slots = RingHomomorphism._extra_slots(self) @@ -3047,16 +3054,16 @@ cdef class FrobeniusEndomorphism_generic(RingHomomorphism): EXAMPLES:: - sage: K = Frac(GF(25)['T']) # needs sage.rings.finite_rings - sage: phi = K.frobenius_endomorphism(2) # needs sage.rings.finite_rings - sage: phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = Frac(GF(25)['T']) + sage: phi = K.frobenius_endomorphism(2) + sage: phi Frobenius endomorphism x |--> x^(5^2) of Fraction Field of Univariate Polynomial Ring in T over Finite Field in z2 of size 5^2 - - sage: psi = loads(dumps(phi)); psi # needs sage.rings.finite_rings + sage: psi = loads(dumps(phi)); psi Frobenius endomorphism x |--> x^(5^2) of Fraction Field of Univariate Polynomial Ring in T over Finite Field in z2 of size 5^2 - sage: phi == psi # needs sage.rings.finite_rings + sage: phi == psi True """ slots = RingHomomorphism._extra_slots(self) diff --git a/src/sage/rings/ring.pyx b/src/sage/rings/ring.pyx index 8f2c55db2de..5c875dc33ba 100644 --- a/src/sage/rings/ring.pyx +++ b/src/sage/rings/ring.pyx @@ -1881,13 +1881,14 @@ cdef class DedekindDomain(IntegralDomain): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K = NumberField(x^2 + 1, 's') # needs sage.rings.number_field - sage: OK = K.ring_of_integers() # needs sage.rings.number_field - sage: OK.integral_closure() # needs sage.rings.number_field + sage: K = NumberField(x^2 + 1, 's') + sage: OK = K.ring_of_integers() + sage: OK.integral_closure() Gaussian Integers in Number Field in s with defining polynomial x^2 + 1 - sage: OK.integral_closure() == OK # needs sage.rings.number_field + sage: OK.integral_closure() == OK True sage: QQ.integral_closure() == QQ diff --git a/src/sage/rings/ring_extension.pyx b/src/sage/rings/ring_extension.pyx index 3f4acbef798..29fc330ce9e 100644 --- a/src/sage/rings/ring_extension.pyx +++ b/src/sage/rings/ring_extension.pyx @@ -1484,12 +1484,13 @@ cdef class RingExtension_generic(CommutativeAlgebra): TESTS:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 2) # needs sage.rings.number_field - sage: B. = QQ.extension(x^6 - 2) # needs sage.rings.number_field - sage: f = A.hom([b^3]) # needs sage.rings.number_field - sage: E = B.over(f) # needs sage.rings.number_field - sage: E.degree_over() # indirect doctest # needs sage.rings.number_field + sage: A. = QQ.extension(x^2 - 2) + sage: B. = QQ.extension(x^6 - 2) + sage: f = A.hom([b^3]) + sage: E = B.over(f) + sage: E.degree_over() # indirect doctest 3 """ if base is self: @@ -2231,12 +2232,13 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 2) # needs sage.rings.number_field - sage: B. = QQ.extension(x^6 - 2) # needs sage.rings.number_field - sage: f = A.hom([b^3]) # needs sage.rings.number_field - sage: E = B.over(f) # needs sage.rings.number_field - sage: E.degree_over() # indirect doctest # needs sage.rings.number_field + sage: A. = QQ.extension(x^2 - 2) + sage: B. = QQ.extension(x^6 - 2) + sage: f = A.hom([b^3]) + sage: E = B.over(f) + sage: E.degree_over() # indirect doctest 3 """ if base is self: diff --git a/src/sage/rings/ring_extension_morphism.pyx b/src/sage/rings/ring_extension_morphism.pyx index fca3eca6f09..596a36b8c96 100644 --- a/src/sage/rings/ring_extension_morphism.pyx +++ b/src/sage/rings/ring_extension_morphism.pyx @@ -239,13 +239,14 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(QQ, 'x') - sage: A. = QQ.extension(x^2 - 2) # needs sage.rings.number_field - sage: K. = A.over() # needs sage.rings.number_field - sage: f = K.hom([-sqrt2]); f # needs sage.rings.number_field + sage: A. = QQ.extension(x^2 - 2) + sage: K. = A.over() + sage: f = K.hom([-sqrt2]); f Ring endomorphism of Field in sqrt2 with defining polynomial x^2 - 2 over its base Defn: sqrt2 |--> -sqrt2 - sage: f(sqrt2) # needs sage.rings.number_field + sage: f(sqrt2) -sqrt2 TESTS:: diff --git a/src/sage/rings/semirings/non_negative_integer_semiring.py b/src/sage/rings/semirings/non_negative_integer_semiring.py index c041f18f99f..e56d7eb9bae 100644 --- a/src/sage/rings/semirings/non_negative_integer_semiring.py +++ b/src/sage/rings/semirings/non_negative_integer_semiring.py @@ -37,15 +37,15 @@ class NonNegativeIntegerSemiring(NonNegativeIntegers): Here is a piece of the Cayley graph for the multiplicative structure:: - sage: G = NN.cayley_graph(elements=range(9), generators=[0,1,2,3,5,7]) # optional - sage.graphs - sage: G # optional - sage.graphs + sage: G = NN.cayley_graph(elements=range(9), generators=[0,1,2,3,5,7]) # needs sage.graphs + sage: G # needs sage.graphs Looped multi-digraph on 9 vertices - sage: G.plot() # optional - sage.graphs + sage: G.plot() # needs sage.graphs sage.plot Graphics object consisting of 48 graphics primitives This is the Hasse diagram of the divisibility order on ``NN``. - sage: Poset(NN.cayley_graph(elements=[1..12], generators=[2,3,5,7,11])).show() # optional - sage.combinat sage.graphs + sage: Poset(NN.cayley_graph(elements=[1..12], generators=[2,3,5,7,11])).show() # needs sage.combinat sage.graphs sage.plot Note: as for :class:`NonNegativeIntegers `, ``NN`` is diff --git a/src/sage/rings/semirings/tropical_semiring.pyx b/src/sage/rings/semirings/tropical_semiring.pyx index 519f3213bd6..d9ddcd324fd 100644 --- a/src/sage/rings/semirings/tropical_semiring.pyx +++ b/src/sage/rings/semirings/tropical_semiring.pyx @@ -555,32 +555,32 @@ class TropicalSemiring(Parent, UniqueRepresentation): EXAMPLES:: - sage: TR = TropicalSemiring(RR) # optional - sage.rings.real_mpfr - sage: T60 = TropicalSemiring(RealField(60)) # optional - sage.rings.real_mpfr - sage: TR.has_coerce_map_from(T60) # optional - sage.rings.real_mpfr + sage: TR = TropicalSemiring(RR) # needs sage.rings.real_mpfr + sage: T60 = TropicalSemiring(RealField(60)) # needs sage.rings.real_mpfr + sage: TR.has_coerce_map_from(T60) # needs sage.rings.real_mpfr True sage: TQ = TropicalSemiring(QQ) sage: TQ.has_coerce_map_from(TropicalSemiring(ZZ)) True - sage: TR.has_coerce_map_from(TR) # optional - sage.rings.real_mpfr + sage: TR.has_coerce_map_from(TR) # needs sage.rings.real_mpfr True sage: TQ.has_coerce_map_from(TQ) True - sage: TR.has_coerce_map_from(TQ) # optional - sage.rings.real_mpfr + sage: TR.has_coerce_map_from(TQ) # needs sage.rings.real_mpfr True - sage: TR.has_coerce_map_from(float) # optional - sage.rings.real_mpfr + sage: TR.has_coerce_map_from(float) # needs sage.rings.real_mpfr False - sage: TR.has_coerce_map_from(RR) # optional - sage.rings.real_mpfr + sage: TR.has_coerce_map_from(RR) # needs sage.rings.real_mpfr False - sage: TR.has_coerce_map_from(QQ) # optional - sage.rings.real_mpfr + sage: TR.has_coerce_map_from(QQ) # needs sage.rings.real_mpfr False - sage: TR.coerce_map_from(T60)(T60(2)) # optional - sage.rings.real_mpfr + sage: TR.coerce_map_from(T60)(T60(2)) # needs sage.rings.real_mpfr 2.00000000000000 - sage: TR.coerce(T60(3.4)) # optional - sage.rings.real_mpfr + sage: TR.coerce(T60(3.4)) # needs sage.rings.real_mpfr 3.40000000000000 - sage: TR.coerce(T60.infinity()) # optional - sage.rings.real_mpfr + sage: TR.coerce(T60.infinity()) # needs sage.rings.real_mpfr +infinity - sage: TQ.coerce(TR(3.4)) # optional - sage.rings.real_mpfr + sage: TQ.coerce(TR(3.4)) # needs sage.rings.real_mpfr Traceback (most recent call last): ... TypeError: no canonical coercion from Tropical semiring over From 54725e22bde8ff306f056c6f9537c2043d4b5a04 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 21 Jul 2023 19:43:59 -0700 Subject: [PATCH 326/423] More # needs --- src/sage/rings/function_field/place.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/rings/function_field/place.py b/src/sage/rings/function_field/place.py index 48ea2a2c32f..89df586ce5b 100644 --- a/src/sage/rings/function_field/place.py +++ b/src/sage/rings/function_field/place.py @@ -25,16 +25,16 @@ sage: O = F.maximal_order() sage: p = O.ideal(x^2 + x + 1).place() # needs sage.libs.pari sage: k, fr_k, to_k = p.residue_field() # needs sage.rings.function_field - sage: k + sage: k # needs sage.rings.function_field Finite Field in z2 of size 2^2 The homomorphisms are between the valuation ring and the residue field:: - sage: fr_k + sage: fr_k # needs sage.rings.function_field Ring morphism: From: Finite Field in z2 of size 2^2 To: Valuation ring at Place (x^2 + x + 1) - sage: to_k + sage: to_k # needs sage.rings.function_field Ring morphism: From: Valuation ring at Place (x^2 + x + 1) To: Finite Field in z2 of size 2^2 From a86d13e2f6ce83871c1d3d0159f332bf4f2ead77 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 21 Jul 2023 20:42:38 -0700 Subject: [PATCH 327/423] src/sage/rings/derivation.py: Update # needs --- src/sage/rings/derivation.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/sage/rings/derivation.py b/src/sage/rings/derivation.py index 136c8c40307..26b6f2d5905 100644 --- a/src/sage/rings/derivation.py +++ b/src/sage/rings/derivation.py @@ -231,15 +231,15 @@ def __init__(self, domain, codomain, twist=None): sage: TestSuite(M).run() sage: from sage.rings.derivation import RingDerivationModule - sage: R5. = GF(5)[] # needs sage.rings.finite_rings + sage: R5. = GF(5)[] sage: R25. = GF(25)[] # needs sage.rings.finite_rings - sage: R7. = GF(7)[] # needs sage.rings.finite_rings + sage: R7. = GF(7)[] sage: RingDerivationModule(R5, R25) # needs sage.rings.finite_rings Module of derivations from Univariate Polynomial Ring in x over Finite Field of size 5 to Univariate Polynomial Ring in x over Finite Field in z2 of size 5^2 - sage: RingDerivationModule(R5, R5^2) # needs sage.rings.finite_rings + sage: RingDerivationModule(R5, R5^2) Traceback (most recent call last): ... TypeError: the codomain must be an algebra over the domain @@ -250,7 +250,7 @@ def __init__(self, domain, codomain, twist=None): TypeError: the codomain must be an algebra over the domain or a morphism with the correct domain - sage: theta = R5.hom([R5.gen()^2]) # needs sage.rings.finite_rings + sage: theta = R5.hom([R5.gen()^2]) sage: RingDerivationModule(R5, R25, twist=theta) # needs sage.rings.finite_rings Module of twisted derivations from Univariate Polynomial Ring in x over Finite Field of size 5 @@ -1074,10 +1074,10 @@ def _richcmp_(self, other, op): EXAMPLES:: - sage: R. = GF(5)[] # needs sage.rings.finite_rings - sage: D = sum(v*R.derivation(v) for v in R.gens()); D # needs sage.rings.finite_rings + sage: R. = GF(5)[] + sage: D = sum(v*R.derivation(v) for v in R.gens()); D x*d/dx + y*d/dy + z*d/dz - sage: D.pth_power() == D # needs sage.rings.finite_rings + sage: D.pth_power() == D True """ @@ -1915,19 +1915,19 @@ def list(self): EXAMPLES:: - sage: R. = GF(5)[[]] # needs sage.rings.finite_rings - sage: M = R.derivation_module() # needs sage.rings.finite_rings - sage: M.basis() # needs sage.rings.finite_rings + sage: R. = GF(5)[[]] + sage: M = R.derivation_module() + sage: M.basis() Family (d/dx, d/dy) - sage: R.derivation(x).list() # needs sage.rings.finite_rings + sage: R.derivation(x).list() [1, 0] - sage: R.derivation(y).list() # needs sage.rings.finite_rings + sage: R.derivation(y).list() [0, 1] - sage: f = x*R.derivation(x) + y*R.derivation(y); f # needs sage.rings.finite_rings + sage: f = x*R.derivation(x) + y*R.derivation(y); f x*d/dx + y*d/dy - sage: f.list() # needs sage.rings.finite_rings + sage: f.list() [x, y] """ From 96220860491fe20614a1b9691022a004499eae73 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 22 Jul 2023 02:54:35 -0700 Subject: [PATCH 328/423] sage.rings: Update # needs --- src/sage/rings/fraction_field.py | 7 +-- src/sage/rings/homset.py | 18 ++++--- src/sage/rings/integer.pyx | 7 +-- src/sage/rings/localization.py | 9 ++-- src/sage/rings/morphism.pyx | 6 +-- .../rings/multi_power_series_ring_element.py | 6 +-- src/sage/rings/quotient_ring.py | 2 +- src/sage/rings/rational_field.py | 12 ++--- src/sage/rings/real_lazy.pyx | 22 ++++----- src/sage/rings/ring_extension.pyx | 49 ++++++++++--------- src/sage/rings/ring_extension_element.pyx | 26 +++++----- src/sage/rings/ring_extension_morphism.pyx | 14 +++--- src/sage/rings/tests.py | 2 +- 13 files changed, 94 insertions(+), 86 deletions(-) diff --git a/src/sage/rings/fraction_field.py b/src/sage/rings/fraction_field.py index 5d7e4cfab4d..3a434ad5498 100644 --- a/src/sage/rings/fraction_field.py +++ b/src/sage/rings/fraction_field.py @@ -315,14 +315,15 @@ def _coerce_map_from_(self, S): Coercion from a localization:: + sage: # needs sage.libs.pari sage: R. = ZZ[] - sage: L = Localization(R, (x**2 + 1,7)) # needs sage.libs.pari + sage: L = Localization(R, (x**2 + 1,7)) sage: F = L.fraction_field() - sage: f = F.coerce_map_from(L); f # needs sage.libs.pari + sage: f = F.coerce_map_from(L); f Coercion map: From: Univariate Polynomial Ring in x over Integer Ring localized at (7, x^2 + 1) To: Fraction Field of Univariate Polynomial Ring in x over Integer Ring - sage: f(L(1/7)) == 1/7 # needs sage.libs.pari + sage: f(L(1/7)) == 1/7 True """ from sage.rings.rational_field import QQ diff --git a/src/sage/rings/homset.py b/src/sage/rings/homset.py index 6013a6ca28b..8eb523d4f69 100644 --- a/src/sage/rings/homset.py +++ b/src/sage/rings/homset.py @@ -266,10 +266,11 @@ class RingHomset_quo_ring(RingHomset_generic): :: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ, 2) - sage: S. = R.quotient(x^2 + y^2) # needs sage.libs.singular - sage: H = S.Hom(R) # needs sage.libs.singular - sage: H == loads(dumps(H)) # needs sage.libs.singular + sage: S. = R.quotient(x^2 + y^2) + sage: H = S.Hom(R) + sage: H == loads(dumps(H)) True We test pickling of actual homomorphisms in a quotient:: @@ -287,18 +288,19 @@ def _element_constructor_(self, x, base_map=None, check=True): EXAMPLES:: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ, 2) - sage: S. = R.quotient(x^2 + y^2) # needs sage.libs.singular - sage: H = S.Hom(R) # needs sage.libs.singular - sage: phi = H([b, a]); phi # needs sage.libs.singular + sage: S. = R.quotient(x^2 + y^2) + sage: H = S.Hom(R) + sage: phi = H([b, a]); phi Ring morphism: From: Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2) To: Multivariate Polynomial Ring in x, y over Rational Field Defn: a |--> b b |--> a sage: R2. = PolynomialRing(ZZ, 2) - sage: H2 = Hom(R2, S) # needs sage.libs.singular - sage: H2(phi) # needs sage.libs.singular + sage: H2 = Hom(R2, S) + sage: H2(phi) Composite map: From: Multivariate Polynomial Ring in x, y over Integer Ring To: Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2) diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index c64b0fb1156..762c8fb6318 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -2651,10 +2651,11 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): :: + sage: # needs sage.rings.real_mpfr sage: x = 3^100000 - sage: RR(log(RR(x), 3)) # needs sage.symbolic + sage: RR(log(RR(x), 3)) 100000.000000000 - sage: RR(log(RR(x + 100000), 3)) # needs sage.symbolic + sage: RR(log(RR(x + 100000), 3)) 100000.000000000 :: @@ -2812,7 +2813,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): The logarithm of zero is done likewise:: - sage: log(0) + sage: log(0) # needs sage.symbolic -Infinity Some rational bases yield integer logarithms (:trac:`21517`):: diff --git a/src/sage/rings/localization.py b/src/sage/rings/localization.py index b43fc573102..7b88eac1802 100644 --- a/src/sage/rings/localization.py +++ b/src/sage/rings/localization.py @@ -906,17 +906,18 @@ def _fraction_to_element(self, x): EXAMPLES:: + sage: # needs sage.libs.pari sage: P. = QQ[] sage: d = x**2 + y**2 + z**2 - sage: L = Localization(P, d) # needs sage.libs.pari - sage: L._fraction_to_element((x+y+z)/d) # needs sage.libs.pari + sage: L = Localization(P, d) + sage: L._fraction_to_element((x+y+z)/d) (x + y + z)/(x^2 + y^2 + z^2) - sage: _ in L # needs sage.libs.pari + sage: _ in L True TESTS:: - sage: TestSuite(L).run() # needs sage.libs.pari + sage: TestSuite(L).run() """ potential_non_unit_denom = self._cut_off_extra_units_from_base_ring_element(x.denominator()) if potential_non_unit_denom.is_unit(): diff --git a/src/sage/rings/morphism.pyx b/src/sage/rings/morphism.pyx index af08b480dea..eff6af6e04d 100644 --- a/src/sage/rings/morphism.pyx +++ b/src/sage/rings/morphism.pyx @@ -302,7 +302,7 @@ Embedding a number field into the reals:: sage: R. = PolynomialRing(QQ) sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: alpha = RR(2)^(1/3); alpha # needs sage.rings.number_field + sage: alpha = RR(2)^(1/3); alpha 1.25992104989487 sage: i = K.hom([alpha],check=False); i # needs sage.rings.number_field Ring morphism: @@ -971,7 +971,7 @@ cdef class RingHomomorphism(RingMap): sage: # needs sage.libs.singular sage: S. = QQ['u,v'].quotient('v^2 - 2') sage: f = QuadraticField(2).hom([v], S) # needs sage.rings.number_field - sage: I = S.ideal(u + v) # needs sage.rings.number_field + sage: I = S.ideal(u + v) sage: J = f.inverse_image(I) # needs sage.rings.number_field sage: J.is_zero() # needs sage.rings.number_field True @@ -1582,7 +1582,7 @@ cdef class RingHomomorphism(RingMap): :: sage: R. = LaurentPolynomialRing(QQ) - sage: R.hom([y, x], R).inverse() # needs sage.libs.singular + sage: R.hom([y, x], R).inverse() Traceback (most recent call last): ... NotImplementedError diff --git a/src/sage/rings/multi_power_series_ring_element.py b/src/sage/rings/multi_power_series_ring_element.py index 3ce76fdabf9..f1122ae27eb 100644 --- a/src/sage/rings/multi_power_series_ring_element.py +++ b/src/sage/rings/multi_power_series_ring_element.py @@ -1930,7 +1930,7 @@ def exp(self, prec=infinity): Another workaround for this limitation is to change base ring to one which is closed under exponentiation, such as `\RR` or `\CC`:: - sage: exp(g.change_ring(RDF)) # needs sage.symbolic + sage: exp(g.change_ring(RDF)) 7.38905609... + 7.38905609...*a + 7.38905609...*b + 3.69452804...*a^2 + 14.7781121...*a*b + 3.69452804...*b^2 + O(a, b)^3 @@ -1941,7 +1941,7 @@ def exp(self, prec=infinity): sage: exp(a) # needs sage.symbolic 1 + a + 1/2*a^2 + 1/6*a^3 + 1/24*a^4 + 1/120*a^5 + 1/720*a^6 + 1/5040*a^7 + 1/40320*a^8 + 1/362880*a^9 + 1/3628800*a^10 + 1/39916800*a^11 + O(a, b)^12 - sage: a.exp(prec=5) + sage: a.exp(prec=5) # needs sage.symbolic 1 + a + 1/2*a^2 + 1/6*a^3 + 1/24*a^4 + O(a, b)^5 sage: exp(a + T.O(5)) # needs sage.symbolic 1 + a + 1/2*a^2 + 1/6*a^3 + 1/24*a^4 + O(a, b)^5 @@ -2019,7 +2019,7 @@ def log(self, prec=infinity): Another workaround for this limitation is to change base ring to one which is closed under exponentiation, such as `\RR` or `\CC`:: - sage: log(g.change_ring(RDF)) # needs sage.symbolic + sage: log(g.change_ring(RDF)) 1.09861228... + 0.333333333...*a + 0.333333333...*b - 0.0555555555...*a^2 + 0.222222222...*a*b - 0.0555555555...*b^2 + 0.0123456790...*a^3 - 0.0740740740...*a^2*b - 0.0740740740...*a*b^2 + 0.0123456790...*b^3 diff --git a/src/sage/rings/quotient_ring.py b/src/sage/rings/quotient_ring.py index b00b253b40f..f6b9eea69d6 100644 --- a/src/sage/rings/quotient_ring.py +++ b/src/sage/rings/quotient_ring.py @@ -838,7 +838,7 @@ def defining_ideal(self): sage: R. = PolynomialRing(QQ, 2) sage: S. = QuotientRing(R, R.ideal(1 + y^2)) # needs sage.libs.singular sage: T. = QuotientRing(S, S.ideal(a)) # needs sage.libs.singular - sage: S.defining_ideal() # needs sage.libs.singular + sage: S.defining_ideal() Ideal (y^2 + 1) of Multivariate Polynomial Ring in x, y over Rational Field sage: T.defining_ideal() # needs sage.libs.singular Ideal (x, y^2 + 1) of Multivariate Polynomial Ring in x, y over Rational Field diff --git a/src/sage/rings/rational_field.py b/src/sage/rings/rational_field.py index 8efdc093636..d62dfee9ff3 100644 --- a/src/sage/rings/rational_field.py +++ b/src/sage/rings/rational_field.py @@ -443,7 +443,7 @@ def __truediv__(self, I): EXAMPLES:: - sage: QQ / ZZ # needs sage.groups + sage: QQ / ZZ Q/Z """ from sage.rings.ideal import Ideal_generic @@ -779,28 +779,28 @@ def hilbert_symbol_negative_at_S(self, S, b, check=True): TESTS:: - sage: QQ.hilbert_symbol_negative_at_S(5/2, -2) # needs sage.libs.pari sage.modules + sage: QQ.hilbert_symbol_negative_at_S(5/2, -2) # needs sage.modules Traceback (most recent call last): ... TypeError: first argument must be a list or integer :: - sage: QQ.hilbert_symbol_negative_at_S([1, 3], 0) # needs sage.libs.pari sage.modules + sage: QQ.hilbert_symbol_negative_at_S([1, 3], 0) # needs sage.modules Traceback (most recent call last): ... ValueError: second argument must be nonzero :: - sage: QQ.hilbert_symbol_negative_at_S([-1, 3, 5], 2) # needs sage.libs.pari sage.modules + sage: QQ.hilbert_symbol_negative_at_S([-1, 3, 5], 2) # needs sage.modules Traceback (most recent call last): ... ValueError: list should be of even cardinality :: - sage: QQ.hilbert_symbol_negative_at_S([1, 3], 2) # needs sage.libs.pari sage.modules + sage: QQ.hilbert_symbol_negative_at_S([1, 3], 2) # needs sage.modules Traceback (most recent call last): ... ValueError: all entries in list must be prime or -1 for @@ -823,7 +823,7 @@ def hilbert_symbol_negative_at_S(self, S, b, check=True): :: - sage: QQ.hilbert_symbol_negative_at_S([-1, 3], 2) # needs sage.libs.pari sage.modules + sage: QQ.hilbert_symbol_negative_at_S([-1, 3], 2) # needs sage.modules Traceback (most recent call last): ... ValueError: if the infinite place is in the list, the second diff --git a/src/sage/rings/real_lazy.pyx b/src/sage/rings/real_lazy.pyx index 6dbfce3d494..d969a9a4385 100644 --- a/src/sage/rings/real_lazy.pyx +++ b/src/sage/rings/real_lazy.pyx @@ -150,16 +150,16 @@ cdef class LazyField(Field): True sage: RLF.has_coerce_map_from(QQ) True - sage: RLF.has_coerce_map_from(AA) + sage: RLF.has_coerce_map_from(AA) # needs sage.rings.number_field True - sage: CLF.has_coerce_map_from(QQbar) + sage: CLF.has_coerce_map_from(QQbar) # needs sage.rings.number_field True sage: RLF.has_coerce_map_from(RDF) False sage: CLF.has_coerce_map_from(QQ) True - sage: CLF.has_coerce_map_from(QQbar) + sage: CLF.has_coerce_map_from(QQbar) # needs sage.rings.number_field True sage: CLF.has_coerce_map_from(CC) False @@ -407,7 +407,7 @@ class ComplexLazyField_class(LazyField): sage: CLF.interval_field() Complex Interval Field with 53 bits of precision - sage: CLF.interval_field(333) + sage: CLF.interval_field(333) # needs sage.rings.complex_interval_field Complex Interval Field with 333 bits of precision sage: CLF.interval_field() is CIF True @@ -427,7 +427,7 @@ class ComplexLazyField_class(LazyField): sage: CLF.gen() 1*I - sage: ComplexField(100)(CLF.gen()) + sage: ComplexField(100)(CLF.gen()) # needs sage.rings.number_field 1.0000000000000000000000000000*I """ if i == 0: @@ -872,7 +872,7 @@ cdef class LazyFieldElement(FieldElement): 1.732050807568878? sage: sin(a) # needs sage.symbolic 0.1411200080598673? - sage: RealField(160)(tanh(RLF(3))) # needs sage.symbolic + sage: RealField(160)(tanh(RLF(3))) 0.99505475368673045133188018525548847509781385470 """ if name in named_unops: @@ -1233,8 +1233,8 @@ cdef class LazyUnop(LazyFieldElement): sage: a = LazyUnop(RLF, 3, sqrt) sage: a.depth() 1 - sage: b = LazyUnop(RLF, a, sin) # needs sage.symbolic - sage: b.depth() # needs sage.symbolic + sage: b = LazyUnop(RLF, a, sin) + sage: b.depth() 2 """ return 1 + self._arg.depth() @@ -1626,13 +1626,13 @@ cdef class LazyAlgebraic(LazyFieldElement): sage: a = LazyAlgebraic(CLF, QQ['x'].cyclotomic_polynomial(7), 0.6+0.8*CC.0) sage: a 0.6234898018587335? + 0.7818314824680299?*I - sage: ComplexField(150)(a) # indirect doctest + sage: ComplexField(150)(a) # indirect doctest # needs sage.rings.number_field 0.62348980185873353052500488400423981063227473 + 0.78183148246802980870844452667405775023233452*I sage: a = LazyAlgebraic(CLF, QQ['x'].0^2-7, -2.0) - sage: RR(a) + sage: RR(a) # needs sage.rings.number_field -2.64575131106459 - sage: RR(a)^2 + sage: RR(a)^2 # needs sage.rings.number_field 7.00000000000000 """ if isinstance(R, type): diff --git a/src/sage/rings/ring_extension.pyx b/src/sage/rings/ring_extension.pyx index 29fc330ce9e..83a4bd1ea27 100644 --- a/src/sage/rings/ring_extension.pyx +++ b/src/sage/rings/ring_extension.pyx @@ -742,14 +742,15 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^3) - sage: E = K.over() - sage: E - Field in z3 with defining polynomial x^3 + 3*x + 3 over its base - sage: E.backend() - Finite Field in z3 of size 5^3 - sage: E.backend() is K - True + sage: # needs sage.rings.finite_rings + sage: K = GF(5^3) + sage: E = K.over() + sage: E + Field in z3 with defining polynomial x^3 + 3*x + 3 over its base + sage: E.backend() + Finite Field in z3 of size 5^3 + sage: E.backend() is K + True """ if force or self._is_backend_exposed: @@ -766,7 +767,7 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: k = GF(5) # needs sage.rings.finite_rings + sage: k = GF(5) sage: K. = GF(5^2).over(k) # needs sage.rings.finite_rings sage: L. = GF(5^4).over(K) # needs sage.rings.finite_rings @@ -1707,13 +1708,13 @@ cdef class RingExtension_generic(CommutativeAlgebra): sage: K.is_field() # needs sage.rings.finite_rings True - sage: S. = QQ[] # needs sage.rings.finite_rings - sage: A = S.over(QQ) # needs sage.rings.finite_rings - sage: A.is_field() # needs sage.rings.finite_rings + sage: S. = QQ[] + sage: A = S.over(QQ) + sage: A.is_field() False - sage: B = A.fraction_field() # needs sage.rings.finite_rings - sage: B.is_field() # needs sage.rings.finite_rings + sage: B = A.fraction_field() + sage: B.is_field() True """ return self._backend.is_field(proof=proof) @@ -1778,8 +1779,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): TESTS:: - sage: A = GF(5).over(ZZ) # needs sage.rings.finite_rings - sage: A.fraction_field(extend_base=True) # needs sage.rings.finite_rings + sage: A = GF(5).over(ZZ) + sage: A.fraction_field(extend_base=True) Traceback (most recent call last): ... ValueError: the morphism is not injective @@ -1971,8 +1972,8 @@ cdef class RingExtension_generic(CommutativeAlgebra): :: - sage: E = GF(7).over(ZZ) # needs sage.rings.finite_rings - sage: E.characteristic() # needs sage.rings.finite_rings + sage: E = GF(7).over(ZZ) + sage: E.characteristic() 7 TESTS: @@ -2184,7 +2185,7 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: - sage: F = GF(5) # needs sage.rings.finite_rings + sage: F = GF(5) sage: K = GF(5^2).over(F) # needs sage.rings.finite_rings sage: L = GF(5^4).over(K) # needs sage.rings.finite_rings @@ -2381,7 +2382,7 @@ cdef class RingExtensionWithBasis(RingExtension_generic): EXAMPLES:: - sage: F = GF(11) # needs sage.rings.finite_rings + sage: F = GF(11) sage: K. = GF(11^2).over() # needs sage.rings.finite_rings sage: L. = GF(11^6).over(K) # needs sage.rings.finite_rings @@ -2545,8 +2546,8 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: - sage: A = GF(5).over(ZZ) # needs sage.rings.finite_rings - sage: A.fraction_field(extend_base=True) # needs sage.rings.finite_rings + sage: A = GF(5).over(ZZ) + sage: A.fraction_field(extend_base=True) Traceback (most recent call last): ... ValueError: the morphism is not injective @@ -2791,8 +2792,8 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): TESTS:: - sage: A = GF(5).over(ZZ) # needs sage.rings.finite_rings - sage: A.fraction_field(extend_base=True) # needs sage.rings.finite_rings + sage: A = GF(5).over(ZZ) + sage: A.fraction_field(extend_base=True) Traceback (most recent call last): ... ValueError: the morphism is not injective diff --git a/src/sage/rings/ring_extension_element.pyx b/src/sage/rings/ring_extension_element.pyx index 316bf64ae1e..2cc370ab059 100644 --- a/src/sage/rings/ring_extension_element.pyx +++ b/src/sage/rings/ring_extension_element.pyx @@ -279,8 +279,8 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: - sage: F = GF(5^2) - sage: K. = GF(5^4).over(F) + sage: F = GF(5^2) # needs sage.rings.finite_rings + sage: K. = GF(5^4).over(F) # needs sage.rings.finite_rings sage: x = z^10 sage: x (z2 + 2) + (3*z2 + 1)*z @@ -301,8 +301,8 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: - sage: F = GF(5^2) - sage: K. = GF(5^4).over(F) + sage: F = GF(5^2) # needs sage.rings.finite_rings + sage: K. = GF(5^4).over(F) # needs sage.rings.finite_rings sage: x = z^3 + z^2 + z + 4 sage: y = x.in_base() sage: y @@ -321,7 +321,7 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): sage: S. = F[] sage: E = S.over(F) - sage: f = E(1) + sage: f = E(1) # needs sage.rings.number_field sage: g = f.in_base() sage: g 1 @@ -332,9 +332,9 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): We check the case of a tower of extensions:: - sage: F = GF(5^2) - sage: K. = GF(5^4).over(F) - sage: L. = GF(5^8).over(K) + sage: F = GF(5^2) # needs sage.rings.finite_rings + sage: K. = GF(5^4).over(F) # needs sage.rings.finite_rings + sage: L. = GF(5^8).over(K) # needs sage.rings.finite_rings sage: x = 4*v^7 + v^6 + 3*v^4 + v^3 + v^2 + 4 sage: x.in_base() u @@ -770,8 +770,9 @@ cdef class RingExtensionFractionFieldElement(RingExtensionElement): TESTS:: - sage: x = K.random_element() # needs sage.rings.number_field - sage: x == x.numerator() / x.denominator() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: x = K.random_element() + sage: x == x.numerator() / x.denominator() True """ ring = (self._parent)._ring @@ -806,8 +807,9 @@ cdef class RingExtensionFractionFieldElement(RingExtensionElement): TESTS:: - sage: x = K.random_element() # needs sage.rings.number_field - sage: x == x.numerator() / x.denominator() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: x = K.random_element() + sage: x == x.numerator() / x.denominator() True """ ring = (self._parent)._ring diff --git a/src/sage/rings/ring_extension_morphism.pyx b/src/sage/rings/ring_extension_morphism.pyx index 596a36b8c96..fe6797159ee 100644 --- a/src/sage/rings/ring_extension_morphism.pyx +++ b/src/sage/rings/ring_extension_morphism.pyx @@ -269,7 +269,7 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: - sage: F = GF(5) # needs sage.rings.finite_rings + sage: F = GF(5) sage: K. = GF(5^2).over(F) # needs sage.rings.finite_rings sage: L. = GF(5^6).over(K) # needs sage.rings.finite_rings @@ -396,13 +396,13 @@ cdef class RingExtensionHomomorphism(RingMap): sage: iota.is_injective() # needs sage.rings.finite_rings True - sage: K = GF(7).over(ZZ) # needs sage.rings.finite_rings - sage: iota = K.defining_morphism(); iota # needs sage.rings.finite_rings + sage: K = GF(7).over(ZZ) + sage: iota = K.defining_morphism(); iota Ring morphism: From: Integer Ring To: Finite Field of size 7 over its base Defn: 1 |--> 1 - sage: iota.is_injective() # needs sage.rings.finite_rings + sage: iota.is_injective() False """ return self._backend.is_injective() @@ -423,13 +423,13 @@ cdef class RingExtensionHomomorphism(RingMap): sage: iota.is_surjective() # needs sage.rings.finite_rings False - sage: K = GF(7).over(ZZ) # needs sage.rings.finite_rings - sage: iota = K.defining_morphism(); iota # needs sage.rings.finite_rings + sage: K = GF(7).over(ZZ) + sage: iota = K.defining_morphism(); iota Ring morphism: From: Integer Ring To: Finite Field of size 7 over its base Defn: 1 |--> 1 - sage: iota.is_surjective() # needs sage.rings.finite_rings + sage: iota.is_surjective() True """ return self._backend.is_surjective() diff --git a/src/sage/rings/tests.py b/src/sage/rings/tests.py index 1f9d195a048..5a648096f84 100644 --- a/src/sage/rings/tests.py +++ b/src/sage/rings/tests.py @@ -442,7 +442,7 @@ def test_karatsuba_multiplication(base_ring, maxdeg1, maxdeg2, sage: rings = [QQ] sage: rings += [ZZ[I], ZZ[I, sqrt(2)]] # needs sage.rings.number_field sage.symbolic sage: rings += [GF(49, 'a')] # needs sage.rings.finite_rings - sage: rings += [MatrixSpace(GF(17), 3)] # needs sage.modules sage.rings.finite_rings + sage: rings += [MatrixSpace(GF(17), 3)] # needs sage.modules sage: for C in rings: ....: test_karatsuba_multiplication(C, 10, 10) From 17495b7ef8c85e56bad781cb104c3cbf43294dea Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 30 Jul 2023 12:49:37 -0700 Subject: [PATCH 329/423] Update # needs --- src/sage/rings/ring_extension_element.pyx | 25 +++++++++++++---------- src/sage/rings/tests.py | 1 + 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/sage/rings/ring_extension_element.pyx b/src/sage/rings/ring_extension_element.pyx index 2cc370ab059..a902857d9f8 100644 --- a/src/sage/rings/ring_extension_element.pyx +++ b/src/sage/rings/ring_extension_element.pyx @@ -279,8 +279,9 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: - sage: F = GF(5^2) # needs sage.rings.finite_rings - sage: K. = GF(5^4).over(F) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5^2) + sage: K. = GF(5^4).over(F) sage: x = z^10 sage: x (z2 + 2) + (3*z2 + 1)*z @@ -301,8 +302,9 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: - sage: F = GF(5^2) # needs sage.rings.finite_rings - sage: K. = GF(5^4).over(F) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5^2) + sage: K. = GF(5^4).over(F) sage: x = z^3 + z^2 + z + 4 sage: y = x.in_base() sage: y @@ -312,29 +314,30 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): When the element is not in the base, an error is raised:: - sage: z.in_base() + sage: z.in_base() # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: z is not in the base :: + sage: # needs sage.rings.finite_rings sage: S. = F[] sage: E = S.over(F) sage: f = E(1) # needs sage.rings.number_field - sage: g = f.in_base() - sage: g + sage: g = f.in_base(); g # needs sage.rings.number_field 1 - sage: g.parent() + sage: g.parent() # needs sage.rings.number_field Finite Field in z2 of size 5^2 TESTS:: We check the case of a tower of extensions:: - sage: F = GF(5^2) # needs sage.rings.finite_rings - sage: K. = GF(5^4).over(F) # needs sage.rings.finite_rings - sage: L. = GF(5^8).over(K) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5^2) + sage: K. = GF(5^4).over(F) + sage: L. = GF(5^8).over(K) sage: x = 4*v^7 + v^6 + 3*v^4 + v^3 + v^2 + 4 sage: x.in_base() u diff --git a/src/sage/rings/tests.py b/src/sage/rings/tests.py index 5a648096f84..b3cd1c73a17 100644 --- a/src/sage/rings/tests.py +++ b/src/sage/rings/tests.py @@ -345,6 +345,7 @@ def test_random_elements(level=MAX_LEVEL, trials=1): -12 ---- + sage: # needs sage.libs.pari sage: sage.rings.tests.test_random_elements(trials=10) survived 0 tests... sage: sage.rings.tests.test_random_elements(trials=1000) # long time (5 seconds) From 56ac782053f01d0918ef2979946b6995bfa237c6 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 30 Jul 2023 15:06:46 -0700 Subject: [PATCH 330/423] src/sage/rings/rational_field.py: Update # needs --- src/sage/rings/rational_field.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/rings/rational_field.py b/src/sage/rings/rational_field.py index d62dfee9ff3..24f9ff7b1ba 100644 --- a/src/sage/rings/rational_field.py +++ b/src/sage/rings/rational_field.py @@ -443,7 +443,7 @@ def __truediv__(self, I): EXAMPLES:: - sage: QQ / ZZ + sage: QQ / ZZ # needs sage.modules Q/Z """ from sage.rings.ideal import Ideal_generic From 6426d6ad8cd073387d853d6f748d4ce69f08c6a2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 6 Aug 2023 14:49:01 -0700 Subject: [PATCH 331/423] sage.rings: Update # needs --- src/sage/rings/abc.pyx | 4 +-- .../rings/algebraic_closure_finite_field.py | 2 +- src/sage/rings/cfinite_sequence.py | 2 +- src/sage/rings/continued_fraction.py | 2 +- src/sage/rings/factorint_flint.pyx | 2 +- src/sage/rings/factorint_pari.pyx | 2 +- src/sage/rings/fast_arith.pyx | 2 +- src/sage/rings/infinity.py | 13 ++++---- src/sage/rings/integer.pyx | 4 ++- src/sage/rings/integer_ring.pyx | 2 +- src/sage/rings/localization.py | 30 ++++++++++--------- src/sage/rings/power_series_pari.pyx | 11 ++----- src/sage/rings/qqbar_decorators.py | 2 +- src/sage/rings/quotient_ring.py | 22 +++++++------- src/sage/rings/quotient_ring_element.py | 29 +++++++++--------- src/sage/rings/rational_field.py | 6 ++-- src/sage/rings/real_double.pyx | 2 +- src/sage/rings/real_interval_absolute.pyx | 1 + src/sage/rings/real_lazy.pyx | 2 +- src/sage/rings/ring_extension_conversion.pyx | 2 +- src/sage/rings/ring_extension_homset.py | 2 +- 21 files changed, 75 insertions(+), 69 deletions(-) diff --git a/src/sage/rings/abc.pyx b/src/sage/rings/abc.pyx index 860827b5ca5..8acbb4a6e5a 100644 --- a/src/sage/rings/abc.pyx +++ b/src/sage/rings/abc.pyx @@ -227,7 +227,7 @@ cdef class RealIntervalField(Field): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(RIF, sage.rings.abc.RealIntervalField) + sage: isinstance(RIF, sage.rings.abc.RealIntervalField) # needs sage.rings.real_interval_field True By design, there is a unique direct subclass:: @@ -327,7 +327,7 @@ class ComplexIntervalField(Field): EXAMPLES:: sage: import sage.rings.abc - sage: isinstance(CIF, sage.rings.abc.ComplexIntervalField) + sage: isinstance(CIF, sage.rings.abc.ComplexIntervalField) # needs sage.rings.complex_interval_field True By design, there is a unique direct subclass:: diff --git a/src/sage/rings/algebraic_closure_finite_field.py b/src/sage/rings/algebraic_closure_finite_field.py index b8dff4c3903..d7ad457f88c 100644 --- a/src/sage/rings/algebraic_closure_finite_field.py +++ b/src/sage/rings/algebraic_closure_finite_field.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.finite_rings +# sage.doctest: needs sage.rings.finite_rings r""" Algebraic closures of finite fields diff --git a/src/sage/rings/cfinite_sequence.py b/src/sage/rings/cfinite_sequence.py index 733fbcbd6a7..7229dab646a 100644 --- a/src/sage/rings/cfinite_sequence.py +++ b/src/sage/rings/cfinite_sequence.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.symbolic r""" C-Finite Sequences diff --git a/src/sage/rings/continued_fraction.py b/src/sage/rings/continued_fraction.py index fa5ce286f6d..b4d3ec2b518 100644 --- a/src/sage/rings/continued_fraction.py +++ b/src/sage/rings/continued_fraction.py @@ -265,7 +265,7 @@ def rat_interval_cf_list(r1, r2): sage: from sage.rings.continued_fraction import rat_interval_cf_list sage: rat_interval_cf_list(257/113, 5224/2297) [2, 3, 1, 1, 1, 4] - sage: for prec in range(10,54): + sage: for prec in range(10,54): # needs sage.rings.real_interval_field ....: R = RealIntervalField(prec) ....: for _ in range(100): ....: x = R.random_element() * R.random_element() + R.random_element() / 100 diff --git a/src/sage/rings/factorint_flint.pyx b/src/sage/rings/factorint_flint.pyx index 44d8c3ebd4a..7e08edafa97 100644 --- a/src/sage/rings/factorint_flint.pyx +++ b/src/sage/rings/factorint_flint.pyx @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.libs.flint +# sage.doctest: needs sage.libs.flint r""" Integer factorization using FLINT diff --git a/src/sage/rings/factorint_pari.pyx b/src/sage/rings/factorint_pari.pyx index b94682d0deb..8e5ed7c619e 100644 --- a/src/sage/rings/factorint_pari.pyx +++ b/src/sage/rings/factorint_pari.pyx @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.libs.pari +# sage.doctest: needs sage.libs.pari r""" Integer factorization using PARI diff --git a/src/sage/rings/fast_arith.pyx b/src/sage/rings/fast_arith.pyx index 06ef980c8be..bdb5884668e 100644 --- a/src/sage/rings/fast_arith.pyx +++ b/src/sage/rings/fast_arith.pyx @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.libs.pari +# sage.doctest: needs sage.libs.pari """ Basic arithmetic with C integers """ diff --git a/src/sage/rings/infinity.py b/src/sage/rings/infinity.py index eddcc8ccb57..552f2245c89 100644 --- a/src/sage/rings/infinity.py +++ b/src/sage/rings/infinity.py @@ -697,7 +697,7 @@ def _element_constructor_(self, x): (Infinity, Infinity) sage: UnsignedInfinityRing(CC(oo)), UnsignedInfinityRing(CC(-oo)) # needs sage.rings.real_mpfr (Infinity, Infinity) - sage: UnsignedInfinityRing(RIF(oo)), UnsignedInfinityRing(RIF(-oo)) + sage: UnsignedInfinityRing(RIF(oo)), UnsignedInfinityRing(RIF(-oo)) # needs sage.rings.real_interval_field (Infinity, Infinity) sage: UnsignedInfinityRing(float('+inf')), UnsignedInfinityRing(float('-inf')) (Infinity, Infinity) @@ -1139,7 +1139,7 @@ def _element_constructor_(self, x): (+Infinity, -Infinity) sage: InfinityRing(RR(oo)), InfinityRing(RR(-oo)) (+Infinity, -Infinity) - sage: InfinityRing(RIF(oo)), InfinityRing(RIF(-oo)) + sage: InfinityRing(RIF(oo)), InfinityRing(RIF(-oo)) # needs sage.rings.real_interval_field (+Infinity, -Infinity) sage: InfinityRing(float('+inf')), InfinityRing(float('-inf')) (+Infinity, -Infinity) @@ -1231,7 +1231,7 @@ def _coerce_map_from_(self, R): True sage: InfinityRing.has_coerce_map_from(RDF) True - sage: InfinityRing.has_coerce_map_from(RIF) + sage: InfinityRing.has_coerce_map_from(RIF) # needs sage.rings.real_interval_field True As explained above, comparison works by coercing to the @@ -1851,8 +1851,11 @@ def test_signed_infinity(pos_inf): EXAMPLES:: sage: from sage.rings.infinity import test_signed_infinity - sage: for pos_inf in [oo, float('+inf'), RLF(oo), RIF(oo), SR(oo)]: - ....: test_signed_infinity(pos_inf) + sage: test_signed_infinity(oo) + sage: test_signed_infinity(float('+inf')) + sage: test_signed_infinity(RLF(oo)) + sage: test_signed_infinity(RIF(oo)) # needs sage.rings.real_interval_field + sage: test_signed_infinity(SR(oo)) # needs sage.symbolic """ msg = 'testing {} ({})'.format(pos_inf, type(pos_inf)) assert InfinityRing(pos_inf) is infinity, msg diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index 762c8fb6318..f0f16784381 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -2660,6 +2660,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): :: + sage: # needs sage.rings.real_mpfr sage: x.exact_log(3) 100000 sage: (x + 1).exact_log(3) @@ -2669,6 +2670,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): :: + sage: # needs sage.rings.real_mpfr sage: x.exact_log(2.5) Traceback (most recent call last): ... @@ -3912,7 +3914,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): sage: p = next_prime(10^20) sage: q = next_prime(10^21) sage: n = p * q - sage: n.factor(algorithm='qsieve') + sage: n.factor(algorithm='qsieve') # needs sage.libs.flint doctest:... RuntimeWarning: the factorization returned by qsieve may be incomplete (the factors may not be prime) or even wrong; see qsieve? for details diff --git a/src/sage/rings/integer_ring.pyx b/src/sage/rings/integer_ring.pyx index 15375a7b1df..aa6d56981d2 100644 --- a/src/sage/rings/integer_ring.pyx +++ b/src/sage/rings/integer_ring.pyx @@ -1006,7 +1006,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain): Construction can be from a prime ideal instead of a prime:: - sage: ZZ.residue_field(ZZ.ideal(97)) # needs sage.libs.pari + sage: ZZ.residue_field(ZZ.ideal(97)) Residue field of Integers modulo 97 TESTS:: diff --git a/src/sage/rings/localization.py b/src/sage/rings/localization.py index 7b88eac1802..03e269fe27b 100644 --- a/src/sage/rings/localization.py +++ b/src/sage/rings/localization.py @@ -457,13 +457,14 @@ def is_unit(self): EXAMPLES:: + sage: # needs sage.libs.pari sage.singular sage: P. = QQ[] - sage: L = P.localization((x, y*z)) # needs sage.libs.pari - sage: L(y*z).is_unit() # needs sage.libs.pari + sage: L = P.localization((x, y*z)) + sage: L(y*z).is_unit() True - sage: L(z).is_unit() # needs sage.libs.pari + sage: L(z).is_unit() True - sage: L(x*y*z).is_unit() # needs sage.libs.pari + sage: L(x*y*z).is_unit() True """ return self.parent()._cut_off_extra_units_from_base_ring_element(self._value.numerator()).is_unit() @@ -490,7 +491,7 @@ def _richcmp_(self, other, op): """ EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.singular sage: P. = GF(7)[] sage: L = Localization(P, (x, y, z)) sage: L(1/x) < L(3/(x*y*z)**3) @@ -906,7 +907,7 @@ def _fraction_to_element(self, x): EXAMPLES:: - sage: # needs sage.libs.pari + sage: # needs sage.libs.pari sage.libs.singular sage: P. = QQ[] sage: d = x**2 + y**2 + z**2 sage: L = Localization(P, d) @@ -917,7 +918,7 @@ def _fraction_to_element(self, x): TESTS:: - sage: TestSuite(L).run() + sage: TestSuite(L).run() # needs sage.libs.pari sage.libs.singular """ potential_non_unit_denom = self._cut_off_extra_units_from_base_ring_element(x.denominator()) if potential_non_unit_denom.is_unit(): @@ -933,23 +934,24 @@ def _coerce_map_from_(self, S): EXAMPLES:: + sage: # needs sage.libs.pari sage.libs.singular sage: P. = QQ[] sage: L = Localization(P, y*z) - sage: M = Localization(P, (x, y, z)) # needs sage.libs.pari - sage: M._coerce_map_from_(L) # needs sage.libs.pari + sage: M = Localization(P, (x, y, z)) + sage: M._coerce_map_from_(L) True - sage: L._coerce_map_from_(M) # needs sage.libs.pari + sage: L._coerce_map_from_(M) False sage: Q. = ZZ[] sage: N = Localization(Q, v*w) sage: L._coerce_map_from_(N) True - sage: N._coerce_map_from_(M) # needs sage.libs.pari + sage: N._coerce_map_from_(M) False - sage: O = Localization(L, x**2 + 1) # needs sage.libs.pari - sage: O._coerce_map_from_(M) # needs sage.libs.pari + sage: O = Localization(L, x**2 + 1) + sage: O._coerce_map_from_(M) False - sage: O._coerce_map_from_(L) # needs sage.libs.pari + sage: O._coerce_map_from_(L) True """ if S is self.base_ring(): diff --git a/src/sage/rings/power_series_pari.pyx b/src/sage/rings/power_series_pari.pyx index 24f4fde5be3..94a6d1baacb 100644 --- a/src/sage/rings/power_series_pari.pyx +++ b/src/sage/rings/power_series_pari.pyx @@ -347,16 +347,14 @@ cdef class PowerSeries_pari(PowerSeries): Substituting `p`-adic numbers:: + sage: # needs sage.rings.padics sage: f(100 + O(5^7)) 5^4 + 3*5^5 + 4*5^6 + 2*5^7 + 2*5^8 + O(5^9) - sage: ff = PowerSeriesRing(pAdicRing(5), 't', implementation='pari')(f) sage: ff (1 + O(5^20))*t^2 + (1 + O(5^20))*t^3 + O(t^6) - sage: ff(100 + O(5^7)) 5^4 + 3*5^5 + 4*5^6 + 2*5^7 + 2*5^8 + O(5^9) - sage: ff(100 + O(2^7)) Traceback (most recent call last): ... @@ -373,17 +371,14 @@ cdef class PowerSeries_pari(PowerSeries): Traceback (most recent call last): ... ValueError: can only substitute elements of positive valuation - sage: f(t^-2) Traceback (most recent call last): ... ValueError: can only substitute elements of positive valuation - - sage: f(2 + O(5^3)) + sage: f(2 + O(5^3)) # needs sage.rings.padics Traceback (most recent call last): ... ValueError: can only substitute elements of positive valuation - sage: g = t^2 + t^3 sage: g(1 + t + O(t^2)) 2 + 5*t + O(t^2) @@ -492,7 +487,7 @@ cdef class PowerSeries_pari(PowerSeries): sage: f[:4] 32 - 80*t + 80*t^2 - 40*t^3 - sage: f = 1 + t^3 - 4*t^4 + O(t^7) ; f + sage: f = 1 + t^3 - 4*t^4 + O(t^7); f 1 + t^3 - 4*t^4 + O(t^7) sage: f[:4] 1 + t^3 + O(t^7) diff --git a/src/sage/rings/qqbar_decorators.py b/src/sage/rings/qqbar_decorators.py index 27448c2def6..c0505b11e8b 100644 --- a/src/sage/rings/qqbar_decorators.py +++ b/src/sage/rings/qqbar_decorators.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.number_field +# sage.doctest: needs sage.rings.number_field """ QQbar decorators diff --git a/src/sage/rings/quotient_ring.py b/src/sage/rings/quotient_ring.py index f6b9eea69d6..c796b24961b 100644 --- a/src/sage/rings/quotient_ring.py +++ b/src/sage/rings/quotient_ring.py @@ -222,17 +222,18 @@ def QuotientRing(R, I, names=None, **kwds): example, we end up modding out the ideal `(x)` from the ring `\QQ[x,y]`:: + sage: # needs sage.libs.pari sage.libs.singular sage: R. = PolynomialRing(QQ, 2) - sage: S. = QuotientRing(R, R.ideal(1 + y^2)) # needs sage.libs.pari - sage: T. = QuotientRing(S, S.ideal(a)) # needs sage.libs.pari - sage: T # needs sage.libs.pari + sage: S. = QuotientRing(R, R.ideal(1 + y^2)) + sage: T. = QuotientRing(S, S.ideal(a)) + sage: T Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x, y^2 + 1) - sage: R.gens(); S.gens(); T.gens() # needs sage.libs.pari + sage: R.gens(); S.gens(); T.gens() (x, y) (a, b) (0, d) - sage: for n in range(4): d^n # needs sage.libs.pari + sage: for n in range(4): d^n 1 d -1 @@ -835,12 +836,13 @@ def defining_ideal(self): homomorphism theorems, this is actually a quotient by a sum of two ideals:: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ, 2) - sage: S. = QuotientRing(R, R.ideal(1 + y^2)) # needs sage.libs.singular - sage: T. = QuotientRing(S, S.ideal(a)) # needs sage.libs.singular + sage: S. = QuotientRing(R, R.ideal(1 + y^2)) + sage: T. = QuotientRing(S, S.ideal(a)) sage: S.defining_ideal() Ideal (y^2 + 1) of Multivariate Polynomial Ring in x, y over Rational Field - sage: T.defining_ideal() # needs sage.libs.singular + sage: T.defining_ideal() Ideal (x, y^2 + 1) of Multivariate Polynomial Ring in x, y over Rational Field """ return self.__I @@ -978,10 +980,10 @@ def ideal(self, *gens, **kwds): sage: R. = PolynomialRing(QQ) sage: S = R.quotient_ring(x^2 + y^2) - sage: S.ideal() # needs sage.libs.pari + sage: S.ideal() # needs sage.libs.singular Ideal (0) of Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2) - sage: S.ideal(x + y + 1) # needs sage.libs.pari + sage: S.ideal(x + y + 1) # needs sage.libs.singular Ideal (xbar + ybar + 1) of Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2) diff --git a/src/sage/rings/quotient_ring_element.py b/src/sage/rings/quotient_ring_element.py index dc1fec51fad..752e03e8123 100644 --- a/src/sage/rings/quotient_ring_element.py +++ b/src/sage/rings/quotient_ring_element.py @@ -659,7 +659,7 @@ def _richcmp_(self, other, op): The issue from :trac:`8005` was most likely fixed as part of :trac:`9138`:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.singular sage: F = GF(5) sage: R. = F[] sage: I = Ideal(R, [x, y]) @@ -687,7 +687,7 @@ def lt(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.singular sage: R. = PolynomialRing(GF(7), 3, order='lex') sage: I = sage.rings.ideal.FieldIdeal(R) sage: Q = R.quo(I) @@ -710,7 +710,7 @@ def lm(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.singular sage: R. = PolynomialRing(GF(7), 3, order='lex') sage: I = sage.rings.ideal.FieldIdeal(R) sage: Q = R.quo(I) @@ -734,7 +734,7 @@ def lc(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.singular sage: R. = PolynomialRing(GF(7), 3, order='lex') sage: I = sage.rings.ideal.FieldIdeal(R) sage: Q = R.quo(I) @@ -811,7 +811,7 @@ def _singular_(self, singular=singular_default): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.singular sage: P. = PolynomialRing(GF(2), 2) sage: I = sage.rings.ideal.FieldIdeal(P) sage: Q = P.quo(I) @@ -834,11 +834,12 @@ def _singular_(self, singular=singular_default): TESTS:: - sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) # needs sage.libs.singular + sage: # needs sage.libs.singular + sage: R. = QQ[]; S. = R.quo(x^2 + y^2); type(a) - sage: (a - 2/3*b)._singular_() # needs sage.libs.singular + sage: (a - 2/3*b)._singular_() x-2/3*y - sage: S((a - 2/3*b)._singular_()) # needs sage.libs.singular + sage: S((a - 2/3*b)._singular_()) a - 2/3*b """ if singular is None: @@ -851,7 +852,7 @@ def _magma_init_(self, magma): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.singular sage: P. = PolynomialRing(GF(2)) sage: Q = P.quotient(sage.rings.ideal.FieldIdeal(P)) sage: xbar, ybar = Q.gens() @@ -870,7 +871,7 @@ def _macaulay2_(self, macaulay2=None): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.singular sage: R. = PolynomialRing(GF(7), 2) sage: Q = R.quotient([x^2 - y]) sage: x, y = Q.gens() @@ -895,7 +896,7 @@ def _macaulay2_(self, macaulay2=None): :: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.singular sage: R. = PolynomialRing(GF(7), 2) sage: Q = R.quotient([x^2 - y], names=R.gens()) sage: x, y = Q.gens() @@ -912,7 +913,7 @@ def _macaulay2_(self, macaulay2=None): Check that changing the currently defined global variables (`x`, `y`, ...) in Macaulay2 does not affect the result of this conversion:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.singular sage: R. = PolynomialRing(GF(7), 2) sage: Q = R.quotient([x^2 - y], names=R.gens()) sage: x, y = Q.gens() @@ -950,7 +951,7 @@ def reduce(self, G): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.singular sage: P. = PolynomialRing(GF(2), 5, order='lex') sage: I1 = ideal([a*b + c*d + 1, a*c*e + d*e, ....: a*b*e + c*e, b*c + c*d*e + 1]) @@ -962,7 +963,7 @@ def reduce(self, G): Notice that the result above is not minimal:: - sage: I2.reduce(f) # needs sage.rings.finite_rings + sage: I2.reduce(f) # needs sage.libs.singular 0 """ try: diff --git a/src/sage/rings/rational_field.py b/src/sage/rings/rational_field.py index 24f9ff7b1ba..6b47fdeab0a 100644 --- a/src/sage/rings/rational_field.py +++ b/src/sage/rings/rational_field.py @@ -728,16 +728,16 @@ def residue_field(self, p, check=True): INPUT: - - ``p`` - a prime integer. + - ``p`` -- a prime integer. - - ``check`` (default ``True``) - if ``True``, check the primality of + - ``check`` (default ``True``) -- if ``True``, check the primality of `p`, else do not. OUTPUT: The residue field at this prime. EXAMPLES:: - sage: QQ.residue_field(5) # needs sage.rings.finite_rings + sage: QQ.residue_field(5) Residue field of Integers modulo 5 sage: QQ.residue_field(next_prime(10^9)) # needs sage.rings.finite_rings Residue field of Integers modulo 1000000007 diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index 6be5c1211b9..5b1fe40d684 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -2075,7 +2075,7 @@ def is_RealDoubleElement(x): sage: from sage.rings.real_double import is_RealDoubleElement sage: is_RealDoubleElement(RDF(3)) True - sage: is_RealDoubleElement(RIF(3)) + sage: is_RealDoubleElement(RIF(3)) # needs sage.rings.real_interval_field False """ return isinstance(x, RealDoubleElement) diff --git a/src/sage/rings/real_interval_absolute.pyx b/src/sage/rings/real_interval_absolute.pyx index 3d0dabaaa5f..5caf4ac40f1 100644 --- a/src/sage/rings/real_interval_absolute.pyx +++ b/src/sage/rings/real_interval_absolute.pyx @@ -1,3 +1,4 @@ +# sage.doctest: # needs sage.symbolic """ Real intervals with a fixed absolute precision """ diff --git a/src/sage/rings/real_lazy.pyx b/src/sage/rings/real_lazy.pyx index d969a9a4385..0f797b039f5 100644 --- a/src/sage/rings/real_lazy.pyx +++ b/src/sage/rings/real_lazy.pyx @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.real_mpfr +# sage.doctest: needs sage.rings.real_mpfr """ Lazy real and complex numbers diff --git a/src/sage/rings/ring_extension_conversion.pyx b/src/sage/rings/ring_extension_conversion.pyx index 6ea90ddbdb5..eeb6077cd0a 100644 --- a/src/sage/rings/ring_extension_conversion.pyx +++ b/src/sage/rings/ring_extension_conversion.pyx @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.finite_rings +# sage.doctest: needs sage.rings.finite_rings ############################################################################# # Copyright (C) 2019 Xavier Caruso diff --git a/src/sage/rings/ring_extension_homset.py b/src/sage/rings/ring_extension_homset.py index 65c39803caa..d2c13a11f0e 100644 --- a/src/sage/rings/ring_extension_homset.py +++ b/src/sage/rings/ring_extension_homset.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.finite_rings +# sage.doctest: needs sage.rings.finite_rings r""" Homset between extensions of rings From 252fe206c96b8dac84db7e5607bf0dc3198e09d5 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 6 Aug 2023 18:29:45 -0700 Subject: [PATCH 332/423] sage.rings: Update # needs --- src/sage/rings/ring.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/rings/ring.pyx b/src/sage/rings/ring.pyx index 5c875dc33ba..62f1d362b54 100644 --- a/src/sage/rings/ring.pyx +++ b/src/sage/rings/ring.pyx @@ -893,7 +893,7 @@ cdef class Ring(ParentWithGens): Forward the proof flag to ``is_field``, see :trac:`22910`:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.singular sage: R1. = GF(5)[] sage: F1 = R1.quotient_ring(x^2 + x + 1) sage: R2. = F1[] From 33bf7beb545b4e2645db23dc0ee93a1d4305e31a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 12 Aug 2023 18:54:20 -0700 Subject: [PATCH 333/423] Update # needs --- src/sage/rings/tests.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/sage/rings/tests.py b/src/sage/rings/tests.py index b3cd1c73a17..809c3878c10 100644 --- a/src/sage/rings/tests.py +++ b/src/sage/rings/tests.py @@ -345,7 +345,7 @@ def test_random_elements(level=MAX_LEVEL, trials=1): -12 ---- - sage: # needs sage.libs.pari + sage: # needs sage.rings.number_field sage.rings.finite_rings sage.rings.padics sage: sage.rings.tests.test_random_elements(trials=10) survived 0 tests... sage: sage.rings.tests.test_random_elements(trials=1000) # long time (5 seconds) @@ -366,8 +366,9 @@ def test_random_elements(level=MAX_LEVEL, trials=1): @random_testing def test_random_arith(level=MAX_LEVEL, trials=1): """ - Create random elements of random rings and does some arithmetic - with them, until a crash occurs, in which case an exception is + Create random elements of random rings and do some arithmetic with them. + + Repeats until a crash occurs, in which case an exception is raised. Defaults to running a single trial, but more can be specified. To run tests in an infinite loop, you could use:: @@ -375,17 +376,18 @@ def test_random_arith(level=MAX_LEVEL, trials=1): INPUT: - - level -- (default: MAX_LEVEL); controls the types of rings to use - - trials -- A positive integer (default 1); the number of trials + - ``level`` -- (default: ``MAX_LEVEL``); controls the types of rings to use + - ``trials`` -- A positive integer (default: 1); the number of trials to run. - - seed -- the random seed to use; if not specified, uses a truly + - ``seed`` -- the random seed to use; if not specified, uses a truly random seed. - - print_seed -- If True (default False), prints the random seed chosen. + - ``print_seed`` -- If ``True`` (default: ``False``), prints the random seed chosen. EXAMPLES:: + sage: # needs sage.rings.number_field sage.rings.finite_rings sage.rings.padics sage: import sage.rings.tests - sage: sage.rings.tests.test_random_arith(trials=2, seed=0) # needs sage.rings.number_field + sage: sage.rings.tests.test_random_arith(trials=2, seed=0) survived 0 tests Rational Field -1/2 -1/95 @@ -394,10 +396,9 @@ def test_random_arith(level=MAX_LEVEL, trials=1): Number Field in a with defining polynomial x^2 - 15083 with a = 122.81286577553673? a -2*a - 1 2*a - 30164 - - sage: sage.rings.tests.test_random_arith(trials=10) # needs sage.rings.finite_rings + sage: sage.rings.tests.test_random_arith(trials=10) survived 0 tests... - sage: sage.rings.tests.test_random_arith(trials=1000) # long time (5 seconds?), needs sage.rings.finite_rings + sage: sage.rings.tests.test_random_arith(trials=1000) # long time (5 seconds?) survived 0 tests... """ i = 0 From 5c1e20a44dcfa9e7353271348a193d22ce7814ea Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 13 Aug 2023 12:07:18 -0700 Subject: [PATCH 334/423] sage --fixdoctests --no-test src/sage/rings --- src/sage/rings/tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/rings/tests.py b/src/sage/rings/tests.py index 809c3878c10..13a205195d5 100644 --- a/src/sage/rings/tests.py +++ b/src/sage/rings/tests.py @@ -345,7 +345,7 @@ def test_random_elements(level=MAX_LEVEL, trials=1): -12 ---- - sage: # needs sage.rings.number_field sage.rings.finite_rings sage.rings.padics + sage: # needs sage.rings.finite_rings sage.rings.number_field sage.rings.padics sage: sage.rings.tests.test_random_elements(trials=10) survived 0 tests... sage: sage.rings.tests.test_random_elements(trials=1000) # long time (5 seconds) @@ -385,7 +385,7 @@ def test_random_arith(level=MAX_LEVEL, trials=1): EXAMPLES:: - sage: # needs sage.rings.number_field sage.rings.finite_rings sage.rings.padics + sage: # needs sage.rings.finite_rings sage.rings.number_field sage.rings.padics sage: import sage.rings.tests sage: sage.rings.tests.test_random_arith(trials=2, seed=0) survived 0 tests From 27a85b6500c5bfa6fd47ba8fb84a2fa12bd000df Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 19 Aug 2023 20:47:41 -0700 Subject: [PATCH 335/423] src/sage/rings/number_field/number_field_ideal.py: Remove abuse of symbolic x in doctests --- .../rings/number_field/number_field_ideal.py | 96 ++++++++++++++++--- 1 file changed, 85 insertions(+), 11 deletions(-) diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py index b5e724a0ab4..aac441463ca 100644 --- a/src/sage/rings/number_field/number_field_ideal.py +++ b/src/sage/rings/number_field/number_field_ideal.py @@ -18,6 +18,7 @@ We test that pickling works:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 - 5) sage: I = K.ideal(2/(5+a)) sage: I == loads(dumps(I)) @@ -78,6 +79,7 @@ def __init__(self, field, gens, coerce=True): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 1) sage: K.ideal(7) Fractional ideal (7) @@ -154,6 +156,7 @@ def _magma_init_(self, magma): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^3 + 2) # optional - magma sage: I = K.ideal(5) # optional - magma sage: I._magma_init_(magma) # optional - magma @@ -171,6 +174,7 @@ def __hash__(self): """ EXAMPLES:: + sage: x = polygen(ZZ) sage: NumberField(x^2 + 1, 'a').ideal(7).__hash__() # random 7806919040325273549 """ @@ -186,6 +190,7 @@ def _latex_(self): r""" EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 23) sage: K.ideal([2, 1/2*a - 1/2])._latex_() '\\left(2, \\frac{1}{2} a - \\frac{1}{2}\\right)' @@ -232,6 +237,7 @@ def _richcmp_(self, other, op): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 3); K Number Field in a with defining polynomial x^2 + 3 sage: f = K.factor(15); f @@ -354,6 +360,7 @@ def _contains_(self, x): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 23); K Number Field in a with defining polynomial x^2 + 23 sage: I = K.factor(13)[0][0]; I @@ -406,6 +413,7 @@ def __elements_from_hnf(self, hnf): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^3 + 389); K Number Field in a with defining polynomial x^3 + 389 sage: I = K.factor(17)[0][0] @@ -433,7 +441,8 @@ def __repr__(self): EXAMPLES:: - sage: K. = NumberField(x^3-2) + sage: x = polygen(ZZ) + sage: K. = NumberField(x^3 - 2) sage: I = K.ideal(0); I Ideal (0) of Number Field in a with defining polynomial x^3 - 2 sage: type(I) @@ -466,6 +475,7 @@ def _repr_short(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^4 + 389); K Number Field in a with defining polynomial x^4 + 389 sage: I = K.factor(17)[0][0]; I @@ -502,6 +512,7 @@ def _gens_repr(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: sage.rings.number_field.number_field_ideal.SMALL_DISC 1000000 sage: K. = NumberField(x^4 + 3*x^2 - 17) @@ -536,6 +547,7 @@ def __pari__(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 23) sage: I = K.class_group().0.ideal(); I Fractional ideal (2, 1/2*w - 1/2) @@ -550,6 +562,7 @@ def _pari_init_(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 23) sage: I = K.class_group().0.ideal() sage: I._pari_init_() @@ -563,6 +576,7 @@ def pari_hnf(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: R. = PolynomialRing(QQ) sage: K. = NumberField(x^3 - 2) sage: I = K.ideal(2/(5+a)) @@ -610,6 +624,7 @@ def basis(self): Number fields defined by non-monic and non-integral polynomials are supported (:trac:`252`):: + sage: x = polygen(ZZ) sage: K. = NumberField(2*x^2 - 1/3) sage: K.ideal(a).basis() [1, a] @@ -665,6 +680,7 @@ def free_module(self): This also works for relative extensions:: + sage: x = polygen(ZZ) sage: K. = NumberField([x^2 + 1, x^2 + 2]) sage: I = K.fractional_ideal(4) sage: I.free_module() @@ -721,6 +737,7 @@ def reduce_equiv(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 23) sage: I = ideal(w*23^5); I Fractional ideal (6436343*w) @@ -748,6 +765,7 @@ def gens_reduced(self, proof=None): EXAMPLES:: + sage: x = polygen(ZZ) sage: R. = PolynomialRing(QQ) sage: K. = NumberField(x^2 + 5) sage: K.ideal(0).gens_reduced() @@ -810,6 +828,7 @@ def gens_two(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: R. = PolynomialRing(QQ) sage: K. = NumberField(x^2 + 5) sage: J = K.ideal([a + 2, 9]) @@ -861,6 +880,7 @@ def integral_basis(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: R. = PolynomialRing(QQ) sage: K. = NumberField(x^2 + 1) sage: J = K.ideal(i + 1) @@ -877,6 +897,7 @@ def integral_split(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: R. = PolynomialRing(QQ) sage: K. = NumberField(x^2 - 5) sage: I = K.ideal(2/(5+a)) @@ -923,6 +944,7 @@ def intersection(self, other): An example with non-principal ideals:: + sage: x = polygen(ZZ) sage: L. = NumberField(x^3 - 7) sage: p = L.ideal(a^2 + a + 1, 2) sage: q = L.ideal(a + 1) @@ -1152,7 +1174,7 @@ def is_principal(self, proof=None): sage: I = P^5 sage: I.is_principal() True - sage: I # random + sage: I # random Fractional ideal (-1/2*a + 3/2) sage: P = K.ideal([2]).factor()[1][0] sage: I = P^5 @@ -1197,6 +1219,7 @@ def ideal_class_log(self, proof=None): An example with a more complicated class group:: + sage: x = polygen(ZZ) sage: K. = NumberField([x^3 - x + 1, x^2 + 26]) sage: K.class_group() Class group of order 18 with structure C6 x C3 of @@ -1254,6 +1277,7 @@ def is_zero(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 2); K Number Field in a with defining polynomial x^2 + 2 sage: K.ideal(3).is_zero() @@ -1271,6 +1295,7 @@ def norm(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^4 + 23); K Number Field in a with defining polynomial x^4 + 23 sage: I = K.ideal(19); I @@ -1296,6 +1321,7 @@ def absolute_norm(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 1) sage: K.ideal(1 + 2*i).absolute_norm() 5 @@ -1308,6 +1334,7 @@ def relative_norm(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 1) sage: K.ideal(1 + 2*i).relative_norm() 5 @@ -1320,6 +1347,7 @@ def absolute_ramification_index(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 1) sage: K.ideal(1 + i).absolute_ramification_index() 2 @@ -1332,6 +1360,7 @@ def relative_ramification_index(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 1) sage: K.ideal(1 + i).relative_ramification_index() 2 @@ -1344,6 +1373,7 @@ def number_field(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 2); K Number Field in a with defining polynomial x^2 + 2 sage: K.ideal(3).number_field() @@ -1426,6 +1456,7 @@ def valuation(self, p): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^5 + 2); K Number Field in a with defining polynomial x^5 + 2 sage: i = K.ideal(38); i @@ -1520,6 +1551,7 @@ def random_element(self, *args, **kwds): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^3 + 2) sage: I = K.ideal(1 - a) sage: I.random_element() # random output @@ -1599,6 +1631,7 @@ def residue_symbol(self, e, m, check=True): Quadratic Residue (7 is not a square modulo 11):: + sage: x = polygen(ZZ) sage: K. = NumberField(x - 1) sage: K.ideal(11).residue_symbol(7,2) -1 @@ -1693,8 +1726,8 @@ def _quadratic_form(self): This is not defined for higher-degree extensions:: - sage: x = var('x') - sage: K. = NumberField(x**3-x-1) + sage: x = polygen(ZZ) + sage: K. = NumberField(x**3 - x - 1) sage: K.ideal(a)._quadratic_form() Traceback (most recent call last): ... @@ -1732,6 +1765,7 @@ def basis_to_module(B, K): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^4 + 1) sage: from sage.rings.number_field.number_field_ideal import basis_to_module sage: basis_to_module([K.0, K.0^2 + 3], K) @@ -1756,6 +1790,8 @@ def is_NumberFieldIdeal(x): False sage: is_NumberFieldIdeal(ideal(5)) False + + sage: x = polygen(ZZ) sage: k. = NumberField(x^2 + 2) sage: I = k.ideal([a + 1]); I Fractional ideal (a + 1) @@ -1775,6 +1811,7 @@ class NumberFieldFractionalIdeal(MultiplicativeGroupElement, NumberFieldIdeal, I EXAMPLES:: + sage: x = polygen(ZZ) sage: R. = PolynomialRing(QQ) sage: K. = NumberField(x^3 - 2) sage: I = K.ideal(2/(5+a)) @@ -1799,6 +1836,7 @@ def __init__(self, field, gens, coerce=True): EXAMPLES:: + sage: x = polygen(ZZ) sage: NumberField(x^2 + 1, 'a').ideal(7) Fractional ideal (7) """ @@ -1826,6 +1864,7 @@ def __repr__(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 5) sage: I = K.ideal([2,1+a]); I Fractional ideal (2, a + 1) @@ -1861,6 +1900,7 @@ def factor(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^4 + 23); K Number Field in a with defining polynomial x^4 + 23 sage: I = K.ideal(19); I @@ -1916,6 +1956,7 @@ def prime_factors(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 23) sage: I = ideal(w+1) sage: I.prime_factors() @@ -1933,6 +1974,7 @@ def _div_(self, other): EXAMPLES:: + sage: x = polygen(ZZ) sage: R. = PolynomialRing(QQ) sage: K. = NumberField(x^2 - 5) sage: I = K.ideal(2/(5+a)) @@ -1953,6 +1995,7 @@ def __invert__(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: R. = PolynomialRing(QQ) sage: K. = NumberField(x^3 - 2) sage: I = K.ideal(2/(5+a)) @@ -1977,6 +2020,7 @@ def is_maximal(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^3 + 3); K Number Field in a with defining polynomial x^3 + 3 sage: K.ideal(5).is_maximal() @@ -1999,7 +2043,7 @@ def is_trivial(self, proof=None): sage: J = F.ideal(5) sage: J.is_trivial() False - sage: (I+J).is_trivial() + sage: (I + J).is_trivial() True """ return self == self.number_field().ideal(1) @@ -2015,6 +2059,7 @@ def ramification_index(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 2); K Number Field in a with defining polynomial x^2 + 2 sage: f = K.factor(2); f @@ -2061,6 +2106,7 @@ def reduce(self, f): EXAMPLES:: + sage: x = polygen(ZZ) sage: k. = NumberField(x^3 + 11) sage: I = k.ideal(5, a^2 - a + 1) sage: c = 4*a + 9 @@ -2152,7 +2198,8 @@ def residues(self): EXAMPLES:: - sage: K.=NumberField(x^2 + 1) + sage: x = polygen(ZZ) + sage: K. = NumberField(x^2 + 1) sage: res = K.ideal(2).residues(); res xmrange_iter([[0, 1], [0, 1]], at 0x...>) sage: list(res) @@ -2216,6 +2263,7 @@ def invertible_residues(self, reduce=True): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 1) sage: ires = K.ideal(2).invertible_residues(); ires xmrange_iter([[0, 1]], at 0x...>) @@ -2286,6 +2334,7 @@ def invertible_residues_mod(self, subgp_gens=[], reduce=True): :: + sage: x = polygen(ZZ) sage: k. = NumberField(x^2 + 23) sage: I = k.ideal(a) sage: list(I.invertible_residues_mod([-1])) @@ -2356,7 +2405,8 @@ def denominator(self): EXAMPLES:: - sage: K.=NumberField(x^2 + 1) + sage: x = polygen(ZZ) + sage: K. = NumberField(x^2 + 1) sage: I = K.ideal((3+4*i)/5); I Fractional ideal (4/5*i + 3/5) sage: I.denominator() @@ -2386,7 +2436,8 @@ def numerator(self): EXAMPLES:: - sage: K.=NumberField(x^2 + 1) + sage: x = polygen(ZZ) + sage: K. = NumberField(x^2 + 1) sage: I = K.ideal((3+4*i)/5); I Fractional ideal (4/5*i + 3/5) sage: I.denominator() @@ -2429,6 +2480,7 @@ def is_coprime(self, other): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 1) sage: I = K.ideal(2 + i) sage: J = K.ideal(2 - i) @@ -2492,6 +2544,7 @@ def idealcoprime(self, J): EXAMPLES:: + sage: x = polygen(ZZ) sage: k. = NumberField(x^2 + 23) sage: A = k.ideal(a + 1) sage: B = k.ideal(3) @@ -2542,6 +2595,7 @@ def small_residue(self, f): :: + sage: x = polygen(ZZ) sage: k. = NumberField(x^2 + 5) sage: I = k.ideal(a) sage: I.small_residue(14) @@ -2576,6 +2630,7 @@ def _pari_bid_(self, flag=1): EXAMPLES:: + sage: x = polygen(ZZ) sage: k. = NumberField(x^4 + 13) sage: I = k.ideal(2, a^2 + 1) sage: hasattr(I, '_bid') @@ -2627,6 +2682,7 @@ def idealstar(self, flag=1): EXAMPLES:: + sage: x = polygen(ZZ) sage: k. = NumberField(x^3 - 11) sage: A = k.ideal(5) sage: G = A.idealstar(); G @@ -2699,6 +2755,7 @@ def ideallog(self, x, gens=None, check=True): EXAMPLES:: + sage: x = polygen(ZZ) sage: k. = NumberField(x^3 - 11) sage: A = k.ideal(5) sage: G = A.idealstar(2) @@ -2810,6 +2867,7 @@ def element_1_mod(self, other): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^3 - 2) sage: A = K.ideal(a + 1); A; A.norm() Fractional ideal (a + 1) @@ -2870,6 +2928,7 @@ def euler_phi(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 1) sage: I = K.ideal(2 + i) sage: [r for r in I.residues() if I.is_coprime(r)] @@ -2918,6 +2977,7 @@ def prime_to_S_part(self, S): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 - 23) sage: I = K.ideal(24) sage: S = [K.ideal(-a + 5), K.ideal(5)] @@ -2963,7 +3023,8 @@ def is_S_unit(self, S): EXAMPLES:: - sage: K. = NumberField(x^2+23) + sage: x = polygen(ZZ) + sage: K. = NumberField(x^2 + 23) sage: I = K.ideal(2) sage: P = I.factor()[0][0] sage: I.is_S_unit([P]) @@ -2994,9 +3055,10 @@ def is_S_integral(self, S): EXAMPLES:: - sage: K. = NumberField(x^2+23) + sage: x = polygen(ZZ) + sage: K. = NumberField(x^2 + 23) sage: I = K.ideal(1/2) - sage: P = K.ideal(2,1/2*a - 1/2) + sage: P = K.ideal(2, 1/2*a - 1/2) sage: I.is_S_integral([P]) False @@ -3025,6 +3087,7 @@ def prime_to_idealM_part(self, M): EXAMPLES:: + sage: x = polygen(ZZ) sage: k. = NumberField(x^2 + 23) sage: I = k.ideal(a + 1) sage: M = k.ideal(2, 1/2*a - 1/2) @@ -3072,6 +3135,7 @@ def _p_quotient(self, p): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 1); O = K.maximal_order() sage: I = K.factor(3)[0][0] sage: Q, quo, lift = I._p_quotient(3); Q @@ -3120,6 +3184,7 @@ def residue_field(self, names=None): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^3 - 7) sage: P = K.ideal(29).factor()[0][0] sage: P.residue_field() @@ -3208,6 +3273,7 @@ def residue_class_degree(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^5 + 2); K Number Field in a with defining polynomial x^5 + 2 sage: f = K.factor(19); f @@ -3252,6 +3318,7 @@ def is_NumberFieldFractionalIdeal(x): False sage: is_NumberFieldFractionalIdeal(ideal(5)) False + sage: x = polygen(ZZ) sage: k. = NumberField(x^2 + 2) sage: I = k.ideal([a + 1]); I Fractional ideal (a + 1) @@ -3278,6 +3345,7 @@ def __init__(self, K, M_OK_change, Q, I): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^3 + 4) sage: f = K.ideal(1 + a^2/2).residue_field().reduction_map(); f # indirect doctest Partially defined reduction map: @@ -3302,6 +3370,7 @@ def __call__(self, x): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^3 + 4) sage: f = K.ideal(1 + a^2/2).residue_field().reduction_map() sage: f(a) @@ -3317,6 +3386,7 @@ def __repr__(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^3 + 4) sage: f = K.ideal(1 + a^2/2).residue_field().reduction_map() sage: repr(f) @@ -3336,6 +3406,7 @@ def __init__(self, OK, M_OK_map, Q, I): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^3 + 4) sage: I = K.ideal(1 + a^2/2) sage: f = I.residue_field().lift_map() @@ -3354,6 +3425,7 @@ def __call__(self, x): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^3 + 4) sage: R = K.ideal(1 + a^2/2).residue_field() sage: f = R.lift_map() @@ -3382,6 +3454,7 @@ def __repr__(self): EXAMPLES:: + sage: x = polygen(ZZ) sage: K. = NumberField(x^3 + 4) sage: R = K.ideal(1 + a^2/2).residue_field() sage: repr(R.lift_map()) @@ -3400,6 +3473,7 @@ def quotient_char_p(I, p): sage: from sage.rings.number_field.number_field_ideal import quotient_char_p + sage: x = polygen(ZZ) sage: K. = NumberField(x^2 + 1); O = K.maximal_order(); I = K.fractional_ideal(15) sage: quotient_char_p(I, 5)[0] Vector space quotient V/W of dimension 2 over Finite Field of size 5 where From f5a24bef1e8aaecd5aa70ad5b8410748bdf2728f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 26 Aug 2023 22:31:24 -0700 Subject: [PATCH 336/423] sage.rings: Update # needs --- src/sage/rings/abc.pyx | 4 ++-- src/sage/rings/polynomial/polynomial_ring_constructor.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/rings/abc.pyx b/src/sage/rings/abc.pyx index 8acbb4a6e5a..6ad9dd8d6f0 100644 --- a/src/sage/rings/abc.pyx +++ b/src/sage/rings/abc.pyx @@ -232,7 +232,7 @@ cdef class RealIntervalField(Field): By design, there is a unique direct subclass:: - sage: sage.rings.abc.RealIntervalField.__subclasses__() + sage: sage.rings.abc.RealIntervalField.__subclasses__() # needs sage.rings.real_interval_field [] sage: len(sage.rings.abc.RealIntervalField.__subclasses__()) <= 1 @@ -332,7 +332,7 @@ class ComplexIntervalField(Field): By design, there is a unique direct subclass:: - sage: sage.rings.abc.ComplexIntervalField.__subclasses__() + sage: sage.rings.abc.ComplexIntervalField.__subclasses__() # needs sage.rings.complex_interval_field [] sage: len(sage.rings.abc.ComplexIntervalField.__subclasses__()) <= 1 diff --git a/src/sage/rings/polynomial/polynomial_ring_constructor.py b/src/sage/rings/polynomial/polynomial_ring_constructor.py index acaea2e3a16..2d1d04a9e73 100644 --- a/src/sage/rings/polynomial/polynomial_ring_constructor.py +++ b/src/sage/rings/polynomial/polynomial_ring_constructor.py @@ -578,7 +578,7 @@ def PolynomialRing(base_ring, *args, **kwds): sage: R. = PolynomialRing(PolynomialRing(GF(7),'k')); TestSuite(R).run(); R Univariate Polynomial Ring in w over Univariate Polynomial Ring in k over Finite Field of size 7 - sage: ZxNTL = PolynomialRing(ZZ, 'x', implementation='NTL'); TestSuite(ZxNTL).run(skip='_test_pickling'); ZxNTL + sage: ZxNTL = PolynomialRing(ZZ, 'x', implementation='NTL'); TestSuite(ZxNTL).run(skip='_test_pickling'); ZxNTL # needs sage.libs.ntl Univariate Polynomial Ring in x over Integer Ring (using NTL) sage: ZxFLINT = PolynomialRing(ZZ, 'x', implementation='FLINT'); TestSuite(ZxFLINT).run(); ZxFLINT Univariate Polynomial Ring in x over Integer Ring From 00713face1ca6816a9da5899da8b8502b07cd4b7 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 27 Aug 2023 13:40:33 -0700 Subject: [PATCH 337/423] sage.rings: Update # needs --- src/sage/rings/polynomial/infinite_polynomial_ring.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/rings/polynomial/infinite_polynomial_ring.py b/src/sage/rings/polynomial/infinite_polynomial_ring.py index 32f62258a7c..117dee3faf4 100644 --- a/src/sage/rings/polynomial/infinite_polynomial_ring.py +++ b/src/sage/rings/polynomial/infinite_polynomial_ring.py @@ -1364,7 +1364,7 @@ def key_basis(self): EXAMPLES:: sage: R. = InfinitePolynomialRing(GF(2)) - sage: R.key_basis() # needs sage.combinat + sage: R.key_basis() # needs sage.combinat sage.modules Key polynomial basis over Finite Field of size 2 """ from sage.combinat.key_polynomial import KeyPolynomialBasis From 0a3d56709c9273047e363359c500ebfdd76997fc Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 28 Aug 2023 20:48:10 -0700 Subject: [PATCH 338/423] sage.rings: Use more block tags --- src/sage/rings/complex_double.pyx | 8 +- src/sage/rings/complex_interval.pyx | 14 +- src/sage/rings/complex_mpfr.pyx | 55 +-- src/sage/rings/continued_fraction.py | 38 +- .../rings/finite_rings/integer_mod_ring.py | 2 +- src/sage/rings/fraction_field.py | 22 +- src/sage/rings/fraction_field_element.pyx | 8 +- src/sage/rings/function_field/constructor.py | 6 +- src/sage/rings/function_field/differential.py | 4 +- .../rings/function_field/function_field.py | 4 +- src/sage/rings/function_field/maps.py | 2 +- src/sage/rings/function_field/place.py | 8 +- .../rings/function_field/place_rational.py | 10 +- src/sage/rings/function_field/valuation.py | 4 +- src/sage/rings/ideal.py | 17 +- src/sage/rings/ideal_monoid.py | 2 +- src/sage/rings/infinity.py | 2 +- src/sage/rings/integer.pyx | 75 ++-- src/sage/rings/integer_ring.pyx | 37 +- src/sage/rings/laurent_series_ring.py | 19 +- .../rings/laurent_series_ring_element.pyx | 13 +- src/sage/rings/lazy_series.py | 315 +++++++------- src/sage/rings/lazy_series_ring.py | 134 +++--- src/sage/rings/morphism.pyx | 196 +++++---- src/sage/rings/multi_power_series_ring.py | 28 +- .../rings/multi_power_series_ring_element.py | 109 +++-- .../number_field/number_field_element.pyx | 12 +- .../polynomial/multi_polynomial_element.py | 2 +- .../polynomial/multi_polynomial_sequence.py | 30 +- .../rings/polynomial/polynomial_element.pyx | 8 +- .../polynomial/polynomial_modn_dense_ntl.pyx | 2 +- .../polynomial/polynomial_quotient_ring.py | 2 +- .../polynomial/polynomial_ring_constructor.py | 2 +- src/sage/rings/polynomial/symmetric_ideal.py | 2 +- src/sage/rings/polynomial/term_order.py | 48 +-- src/sage/rings/power_series_poly.pyx | 37 +- src/sage/rings/power_series_ring.py | 4 - src/sage/rings/power_series_ring_element.pyx | 46 +- .../rings/puiseux_series_ring_element.pyx | 11 +- src/sage/rings/qqbar.py | 162 +++---- src/sage/rings/quotient_ring.py | 113 ++--- src/sage/rings/quotient_ring_element.py | 13 +- src/sage/rings/rational.pyx | 78 ++-- src/sage/rings/rational_field.py | 19 +- src/sage/rings/real_arb.pyx | 4 +- src/sage/rings/real_double.pyx | 29 +- src/sage/rings/real_lazy.pyx | 2 +- src/sage/rings/real_mpfi.pyx | 32 +- src/sage/rings/real_mpfr.pyx | 9 +- src/sage/rings/ring.pyx | 60 +-- src/sage/rings/ring_extension.pyx | 395 +++++++++--------- src/sage/rings/ring_extension_element.pyx | 219 +++++----- src/sage/rings/ring_extension_morphism.pyx | 104 +++-- .../rings/semirings/tropical_semiring.pyx | 30 +- src/sage/rings/sum_of_squares.pyx | 4 +- 55 files changed, 1311 insertions(+), 1300 deletions(-) diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx index 7f3b7f63327..f2080959a54 100644 --- a/src/sage/rings/complex_double.pyx +++ b/src/sage/rings/complex_double.pyx @@ -315,7 +315,7 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): 2.0 - 3.0*I sage: CDF(4.5) # indirect doctest 4.5 - sage: CDF(1+I) # indirect doctest # needs sage.symbolic + sage: CDF(1+I) # indirect doctest # needs sage.symbolic 1.0 + 1.0*I sage: CDF(pari(1)) # needs sage.libs.pari 1.0 @@ -895,9 +895,9 @@ cdef class ComplexDoubleElement(FieldElement): sage: # optional - magma sage: CDF((1.2, 0.3))._magma_init_(magma) 'ComplexField(53 : Bits := true)![1.2, 0.3]' - sage: magma(CDF(1.2, 0.3)) + sage: magma(CDF(1.2, 0.3)) # indirect doctest 1.20000000000000 + 0.300000000000000*$.1 - sage: s = magma(CDF(1.2, 0.3)).sage(); s + sage: s = magma(CDF(1.2, 0.3)).sage(); s # indirect doctest 1.20000000000000 + 0.300000000000000*I sage: s.parent() Complex Field with 53 bits of precision @@ -2549,7 +2549,7 @@ cdef class FloatToCDF(Morphism): 1.0 + 2.0*I sage: CDF('i') # indirect doctest 1.0*I - sage: CDF(2+i) # indirect doctest # needs sage.symbolic + sage: CDF(2+i) # indirect doctest # needs sage.symbolic 2.0 + 1.0*I """ cdef ComplexDoubleElement z = ComplexDoubleElement.__new__(ComplexDoubleElement) diff --git a/src/sage/rings/complex_interval.pyx b/src/sage/rings/complex_interval.pyx index 05c77675c53..fdc3af338db 100644 --- a/src/sage/rings/complex_interval.pyx +++ b/src/sage/rings/complex_interval.pyx @@ -352,15 +352,15 @@ cdef class ComplexIntervalFieldElement(FieldElement): (2.50000000000000, 3.00000000000000) (-4.50000000000000, -4.00000000000000) - sage: z = CIF(RIF(sqrt(2), sqrt(3)), RIF(e, pi)) # needs sage.symbolic - sage: a, b, c, d = z.bisection() # needs sage.symbolic - sage: a.intersection(b).intersection(c).intersection(d) == CIF(z.center()) # needs sage.symbolic + sage: # needs sage.symbolic + sage: z = CIF(RIF(sqrt(2), sqrt(3)), RIF(e, pi)) + sage: a, b, c, d = z.bisection() + sage: a.intersection(b).intersection(c).intersection(d) == CIF(z.center()) True - - sage: zz = a.union(b).union(c).union(c) # needs sage.symbolic - sage: zz.real().endpoints() == z.real().endpoints() # needs sage.symbolic + sage: zz = a.union(b).union(c).union(c) + sage: zz.real().endpoints() == z.real().endpoints() True - sage: zz.imag().endpoints() == z.imag().endpoints() # needs sage.symbolic + sage: zz.imag().endpoints() == z.imag().endpoints() True """ a00 = self._new() diff --git a/src/sage/rings/complex_mpfr.pyx b/src/sage/rings/complex_mpfr.pyx index 1b865147962..8929faa9ae1 100644 --- a/src/sage/rings/complex_mpfr.pyx +++ b/src/sage/rings/complex_mpfr.pyx @@ -848,19 +848,20 @@ class ComplexField_class(sage.rings.abc.ComplexField): TESTS:: + sage: # needs sage.libs.pari sage: k = ComplexField(100) sage: R. = k[] - sage: k._factor_univariate_polynomial( x ) # needs sage.libs.pari + sage: k._factor_univariate_polynomial(x) x - sage: k._factor_univariate_polynomial( 2*x ) # needs sage.libs.pari + sage: k._factor_univariate_polynomial(2*x) (2.0000000000000000000000000000) * x - sage: k._factor_univariate_polynomial( x^2 ) # needs sage.libs.pari + sage: k._factor_univariate_polynomial(x^2) x^2 - sage: k._factor_univariate_polynomial( x^2 + 3 ) # needs sage.libs.pari + sage: k._factor_univariate_polynomial(x^2 + 3) (x - 1.7320508075688772935274463415*I) * (x + 1.7320508075688772935274463415*I) - sage: k._factor_univariate_polynomial( x^2 + 1 ) # needs sage.libs.pari + sage: k._factor_univariate_polynomial(x^2 + 1) (x - I) * (x + I) - sage: k._factor_univariate_polynomial( k(I) * (x^2 + 1) ) # needs sage.libs.pari + sage: k._factor_univariate_polynomial(k(I) * (x^2 + 1)) (1.0000000000000000000000000000*I) * (x - I) * (x + I) """ @@ -1266,20 +1267,22 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: - sage: a = CC(pi + I*e); a # needs sage.symbolic + sage: # needs sage.symbolic + sage: a = CC(pi + I*e); a 3.14159265358979 + 2.71828182845905*I - sage: a.str(truncate=True) # needs sage.symbolic + sage: a.str(truncate=True) '3.14159265358979 + 2.71828182845905*I' - sage: a.str() # needs sage.symbolic + sage: a.str() '3.1415926535897931 + 2.7182818284590451*I' - sage: a.str(base=2) # needs sage.symbolic + sage: a.str(base=2) '11.001001000011111101101010100010001000010110100011000 + 10.101101111110000101010001011000101000101011101101001*I' - sage: CC(0.5 + 0.625*I).str(base=2) # needs sage.symbolic + sage: CC(0.5 + 0.625*I).str(base=2) '0.10000000000000000000000000000000000000000000000000000 + 0.10100000000000000000000000000000000000000000000000000*I' - sage: a.str(base=16) # needs sage.symbolic + sage: a.str(base=16) '3.243f6a8885a30 + 2.b7e151628aed2*I' - sage: a.str(base=36) # needs sage.symbolic + sage: a.str(base=36) '3.53i5ab8p5fc + 2.puw5nggjf8f*I' + sage: CC(0) 0.000000000000000 sage: CC.0.str(istr='%i') @@ -1390,24 +1393,25 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): Coerce the object using the ``pari`` function:: + sage: # needs sage.libs.pari sage: a = ComplexNumber(2,1) - sage: pari(a) # needs sage.libs.pari + sage: pari(a) 2.00000000000000 + 1.00000000000000*I - sage: pari(a).type() # needs sage.libs.pari + sage: pari(a).type() 't_COMPLEX' - sage: type(pari(a)) # needs sage.libs.pari + sage: type(pari(a)) - sage: a.__pari__() # needs sage.libs.pari + sage: a.__pari__() 2.00000000000000 + 1.00000000000000*I - sage: type(a.__pari__()) # needs sage.libs.pari + sage: type(a.__pari__()) sage: a = CC(pi) # needs sage.symbolic - sage: pari(a) # needs sage.libs.pari sage.symbolic + sage: pari(a) # needs sage.symbolic 3.14159265358979 - sage: pari(a).type() # needs sage.libs.pari sage.symbolic + sage: pari(a).type() # needs sage.symbolic 't_REAL' sage: a = CC(-2).sqrt() - sage: pari(a) # needs sage.libs.pari + sage: pari(a) 1.41421356237310*I """ if self.is_real(): @@ -2897,14 +2901,15 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): EXAMPLES:: + sage: # needs sage.libs.pari sage: C, i = ComplexField(30).objgen() - sage: (1+i).gamma_inc(2 + 3*i) # abs tol 2e-10 # needs sage.libs.pari + sage: (1+i).gamma_inc(2 + 3*i) # abs tol 2e-10 0.0020969149 - 0.059981914*I - sage: (1+i).gamma_inc(5) # needs sage.libs.pari + sage: (1+i).gamma_inc(5) -0.0013781309 + 0.0065198200*I - sage: C(2).gamma_inc(1 + i) # needs sage.libs.pari + sage: C(2).gamma_inc(1 + i) 0.70709210 - 0.42035364*I - sage: CC(2).gamma_inc(5) # needs sage.libs.pari + sage: CC(2).gamma_inc(5) 0.0404276819945128 TESTS: diff --git a/src/sage/rings/continued_fraction.py b/src/sage/rings/continued_fraction.py index b4d3ec2b518..a3f877e423d 100644 --- a/src/sage/rings/continued_fraction.py +++ b/src/sage/rings/continued_fraction.py @@ -1330,13 +1330,13 @@ def period(self): EXAMPLES:: - sage: K. = QuadraticField(3) # needs sage.rings.number_field - sage: cf = continued_fraction(sqrt3); cf # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(3) + sage: cf = continued_fraction(sqrt3); cf [1; (1, 2)*] - sage: cf.period() # needs sage.rings.number_field + sage: cf.period() (1, 2) - - sage: for k in xsrange(2,40): # needs sage.rings.number_field + sage: for k in xsrange(2,40): ....: if not k.is_square(): ....: s = QuadraticField(k).gen() ....: cf = continued_fraction(s) @@ -1368,15 +1368,15 @@ def preperiod(self): EXAMPLES:: - sage: K. = QuadraticField(3) # needs sage.rings.number_field - sage: cf = continued_fraction(sqrt3); cf # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(3) + sage: cf = continued_fraction(sqrt3); cf [1; (1, 2)*] - sage: cf.preperiod() # needs sage.rings.number_field + sage: cf.preperiod() (1,) - - sage: cf = continued_fraction(sqrt3/7); cf # needs sage.rings.number_field + sage: cf = continued_fraction(sqrt3/7); cf [0; 4, (24, 8)*] - sage: cf.preperiod() # needs sage.rings.number_field + sage: cf.preperiod() (0, 4) """ return self._x1 @@ -1878,7 +1878,7 @@ def _repr_(self): EXAMPLES:: - sage: continued_fraction(pi) # indirect doctest # needs sage.symbolic + sage: continued_fraction(pi) # indirect doctest # needs sage.symbolic [3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, ...] """ return '[%d; ' % self.quotient(0) + ', '.join(str(self.quotient(i)) for i in range(1, 20)) + ", ...]" @@ -2379,23 +2379,23 @@ def continued_fraction_list(x, type="std", partial_convergents=False, sage: 2 + 1/(2 + 1/(1 + 1/(2 + 1/2))) 45/19 - sage: continued_fraction_list(45/19,type="hj") + sage: continued_fraction_list(45/19, type="hj") [3, 2, 3, 2, 3] sage: 3 - 1/(2 - 1/(3 - 1/(2 - 1/3))) 45/19 Specifying ``bits`` or ``nterms`` modify the length of the output:: - sage: continued_fraction_list(e, bits=20) # needs sage.symbolic + sage: # needs sage.symbolic + sage: continued_fraction_list(e, bits=20) [2, 1, 2, 1, 1, 4, 2] - sage: continued_fraction_list(sqrt(2)+sqrt(3), bits=30) # needs sage.symbolic + sage: continued_fraction_list(sqrt(2) + sqrt(3), bits=30) [3, 6, 1, 5, 7, 2] - sage: continued_fraction_list(pi, bits=53) # needs sage.symbolic + sage: continued_fraction_list(pi, bits=53) [3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14] - - sage: continued_fraction_list(log(3/2), nterms=15) # needs sage.symbolic + sage: continued_fraction_list(log(3/2), nterms=15) [0, 2, 2, 6, 1, 11, 2, 1, 2, 2, 1, 4, 3, 1, 1] - sage: continued_fraction_list(tan(sqrt(pi)), nterms=20) # needs sage.symbolic + sage: continued_fraction_list(tan(sqrt(pi)), nterms=20) [-5, 9, 4, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 2, 4, 3, 1, 63] When the continued fraction is infinite (ie ``x`` is an irrational number) diff --git a/src/sage/rings/finite_rings/integer_mod_ring.py b/src/sage/rings/finite_rings/integer_mod_ring.py index 20a876f4192..b615d3a8c1a 100644 --- a/src/sage/rings/finite_rings/integer_mod_ring.py +++ b/src/sage/rings/finite_rings/integer_mod_ring.py @@ -1600,7 +1600,7 @@ def _gap_init_(self): sage: R = Integers(12345678900) sage: R Ring of integers modulo 12345678900 - sage: gap(R) # indirect doctest # needs sage.libs.gap + sage: gap(R) # indirect doctest # needs sage.libs.gap (Integers mod 12345678900) """ return 'ZmodnZ({})'.format(self.order()) diff --git a/src/sage/rings/fraction_field.py b/src/sage/rings/fraction_field.py index 3a434ad5498..5d298720a90 100644 --- a/src/sage/rings/fraction_field.py +++ b/src/sage/rings/fraction_field.py @@ -264,12 +264,13 @@ def _coerce_map_from_(self, S): We demonstrate that :trac:`7958` is resolved in the case of number fields:: + sage: # needs sage.rings.number_field sage: _. = ZZ[] - sage: K. = NumberField(x^5 - 3*x^4 + 2424*x^3 + 2*x - 232) # needs sage.rings.number_field - sage: R = K.ring_of_integers() # needs sage.rings.number_field - sage: S. = R[] # needs sage.rings.number_field - sage: F = FractionField(S) # needs sage.rings.number_field - sage: F(1/a) # needs sage.rings.number_field + sage: K. = NumberField(x^5 - 3*x^4 + 2424*x^3 + 2*x - 232) + sage: R = K.ring_of_integers() + sage: S. = R[] + sage: F = FractionField(S) + sage: F(1/a) (a^4 - 3*a^3 + 2424*a^2 + 2)/232 Some corner cases have been known to fail in the past (:trac:`5917`):: @@ -396,12 +397,13 @@ def _number_field_to_frac_of_ring_of_integers(self, x): We demonstrate that :trac:`7958` is resolved in the case of number fields:: + sage: # needs sage.rings.number_field sage: _. = ZZ[] - sage: K. = NumberField(x^5 - 3*x^4 + 2424*x^3 + 2*x - 232) # needs sage.rings.number_field - sage: R = K.ring_of_integers() # needs sage.rings.number_field - sage: S. = R[] # needs sage.rings.number_field - sage: F = FractionField(S) # indirect doctest # needs sage.rings.number_field - sage: F(1/a) # needs sage.rings.number_field + sage: K. = NumberField(x^5 - 3*x^4 + 2424*x^3 + 2*x - 232) + sage: R = K.ring_of_integers() + sage: S. = R[] + sage: F = FractionField(S) # indirect doctest + sage: F(1/a) (a^4 - 3*a^3 + 2424*a^2 + 2)/232 """ f = x.polynomial() # Polynomial over QQ diff --git a/src/sage/rings/fraction_field_element.pyx b/src/sage/rings/fraction_field_element.pyx index ca130dfb0df..00bad2188ac 100644 --- a/src/sage/rings/fraction_field_element.pyx +++ b/src/sage/rings/fraction_field_element.pyx @@ -860,15 +860,15 @@ cdef class FractionFieldElement(FieldElement): sage: x,y = FR.gens() sage: a = x^2; a x^2 - sage: type(a.numerator()) # needs sage.lings.singular + sage: type(a.numerator()) # needs sage.libs.singular - sage: type(a.denominator()) # needs sage.lings.singular + sage: type(a.denominator()) # needs sage.libs.singular sage: a = x^(-2); a 1/x^2 - sage: type(a.numerator()) # needs sage.lings.singular + sage: type(a.numerator()) # needs sage.libs.singular - sage: type(a.denominator()) # needs sage.lings.singular + sage: type(a.denominator()) # needs sage.libs.singular sage: x^0 1 diff --git a/src/sage/rings/function_field/constructor.py b/src/sage/rings/function_field/constructor.py index 8e5ecd281ee..d1c63011d3c 100644 --- a/src/sage/rings/function_field/constructor.py +++ b/src/sage/rings/function_field/constructor.py @@ -150,7 +150,7 @@ def create_key(self,polynomial,names): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(x - y^2) # indirect doctest # needs sage.rings.function_field + sage: L. = K.extension(x - y^2) # indirect doctest # needs sage.rings.function_field TESTS: @@ -182,9 +182,9 @@ def create_object(self,version,key,**extra_args): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(x - y^2) # indirect doctest # needs sage.rings.function_field + sage: L. = K.extension(x - y^2) # indirect doctest # needs sage.rings.function_field sage: y2 = y*1 - sage: M. = K.extension(x - y2^2) # indirect doctest # needs sage.rings.function_field + sage: M. = K.extension(x - y2^2) # indirect doctest # needs sage.rings.function_field sage: L is M # needs sage.rings.function_field True """ diff --git a/src/sage/rings/function_field/differential.py b/src/sage/rings/function_field/differential.py index 03b327b1abf..9b6fec9a72d 100644 --- a/src/sage/rings/function_field/differential.py +++ b/src/sage/rings/function_field/differential.py @@ -152,8 +152,8 @@ def _latex_(self): sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(4)); _. = K[] sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field - sage: w = y.differential() - sage: latex(w) + sage: w = y.differential() # needs sage.rings.function_field + sage: latex(w) # needs sage.rings.function_field \left( x y^{2} + \frac{1}{x} y \right)\, dx """ if self._f.is_zero(): # zero differential diff --git a/src/sage/rings/function_field/function_field.py b/src/sage/rings/function_field/function_field.py index 973d9a8f505..26975773a88 100644 --- a/src/sage/rings/function_field/function_field.py +++ b/src/sage/rings/function_field/function_field.py @@ -129,7 +129,7 @@ sage: TestSuite(L).run(max_runs=8) # long time (25s) # needs sage.rings.function_field sage.rings.number_field sage: TestSuite(M).run(max_runs=8) # long time (35s) # needs sage.rings.finite_rings sage.rings.function_field sage: TestSuite(N).run(max_runs=8, skip='_test_derivation') # long time (15s), needs sage.rings.finite_rings - sage: TestSuite(O).run() + sage: TestSuite(O).run() # needs sage.rings.function_field sage: TestSuite(R).run() # needs sage.rings.finite_rings sage.rings.function_field sage: TestSuite(S).run() # long time (4s) # needs sage.rings.finite_rings sage.rings.function_field @@ -781,7 +781,7 @@ def _convert_map_from_(self, R): sage: K. = FunctionField(QQ) sage: R. = K[] sage: L. = K.extension(y^3 + x^3 + 4*x + 1) # needs sage.rings.function_field - sage: K(L(x)) # indirect doctest # needs sage.rings.function_field + sage: K(L(x)) # indirect doctest # needs sage.rings.function_field x """ try: diff --git a/src/sage/rings/function_field/maps.py b/src/sage/rings/function_field/maps.py index ead3310d054..223112c9ae8 100644 --- a/src/sage/rings/function_field/maps.py +++ b/src/sage/rings/function_field/maps.py @@ -221,7 +221,7 @@ def _call_(self, v): sage: R. = K[] sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field - sage: f(x*V.0 + (1/x^3)*V.1) # indirect doctest # needs sage.modules sage.rings.function_field + sage: f(x*V.0 + (1/x^3)*V.1) # indirect doctest # needs sage.modules sage.rings.function_field 1/x^3*y + x TESTS: diff --git a/src/sage/rings/function_field/place.py b/src/sage/rings/function_field/place.py index 89df586ce5b..dbc3ab0e767 100644 --- a/src/sage/rings/function_field/place.py +++ b/src/sage/rings/function_field/place.py @@ -24,17 +24,17 @@ sage: F. = FunctionField(GF(2)) sage: O = F.maximal_order() sage: p = O.ideal(x^2 + x + 1).place() # needs sage.libs.pari - sage: k, fr_k, to_k = p.residue_field() # needs sage.rings.function_field - sage: k # needs sage.rings.function_field + sage: k, fr_k, to_k = p.residue_field() # needs sage.libs.pari sage.rings.function_field + sage: k # needs sage.libs.pari sage.rings.function_field Finite Field in z2 of size 2^2 The homomorphisms are between the valuation ring and the residue field:: - sage: fr_k # needs sage.rings.function_field + sage: fr_k # needs sage.libs.pari sage.rings.function_field Ring morphism: From: Finite Field in z2 of size 2^2 To: Valuation ring at Place (x^2 + x + 1) - sage: to_k # needs sage.rings.function_field + sage: to_k # needs sage.libs.pari sage.rings.function_field Ring morphism: From: Valuation ring at Place (x^2 + x + 1) To: Finite Field in z2 of size 2^2 diff --git a/src/sage/rings/function_field/place_rational.py b/src/sage/rings/function_field/place_rational.py index b6fd87f4fc2..05511a65f4b 100644 --- a/src/sage/rings/function_field/place_rational.py +++ b/src/sage/rings/function_field/place_rational.py @@ -78,13 +78,13 @@ def residue_field(self, name=None): sage: O = F.maximal_order() sage: p = O.ideal(x^2 + x + 1).place() sage: k, fr_k, to_k = p.residue_field() # needs sage.rings.function_field - sage: k + sage: k # needs sage.rings.function_field Finite Field in z2 of size 2^2 - sage: fr_k + sage: fr_k # needs sage.rings.function_field Ring morphism: From: Finite Field in z2 of size 2^2 To: Valuation ring at Place (x^2 + x + 1) - sage: to_k + sage: to_k # needs sage.rings.function_field Ring morphism: From: Valuation ring at Place (x^2 + x + 1) To: Finite Field in z2 of size 2^2 @@ -170,8 +170,8 @@ def valuation_ring(self): sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: p = L.places_finite()[0] - sage: p.valuation_ring() + sage: p = L.places_finite()[0] # needs sage.rings.function_field + sage: p.valuation_ring() # needs sage.rings.function_field Valuation ring at Place (x, x*y) """ from .valuation_ring import FunctionFieldValuationRing diff --git a/src/sage/rings/function_field/valuation.py b/src/sage/rings/function_field/valuation.py index 5567c4db1ce..80d81cb53de 100644 --- a/src/sage/rings/function_field/valuation.py +++ b/src/sage/rings/function_field/valuation.py @@ -358,7 +358,7 @@ def create_key_and_extra_args_from_valuation_on_isomorphic_field(self, domain, v sage: R. = K[] sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field sage: v = K.valuation(1/x) # needs sage.rings.function_field - sage: w = v.extension(L) # indirect doctest # needs sage.rings.function_field + sage: w = v.extension(L) # indirect doctest # needs sage.rings.function_field """ from sage.categories.function_fields import FunctionFields @@ -1117,7 +1117,7 @@ class FunctionFieldFromLimitValuation(FiniteExtensionFromLimitValuation, Discret sage: K. = FunctionField(QQ) sage: R. = K[] sage: L. = K.extension(y^2 - (x^2 + x + 1)) # needs sage.rings.function_field - sage: v = K.valuation(x - 1) # indirect doctest # needs sage.rings.function_field + sage: v = K.valuation(x - 1) # indirect doctest # needs sage.rings.function_field sage: w = v.extension(L); w # needs sage.rings.function_field (x - 1)-adic valuation diff --git a/src/sage/rings/ideal.py b/src/sage/rings/ideal.py index 1e6ff303384..e7aeaa24cde 100644 --- a/src/sage/rings/ideal.py +++ b/src/sage/rings/ideal.py @@ -534,7 +534,7 @@ def apply_morphism(self, phi): Since 2 is totally ramified, complex conjugation fixes it:: - sage: B.apply_morphism(taus[1]) # complex conjugation # needs sage.rings.number_fields + sage: B.apply_morphism(taus[1]) # complex conjugation # needs sage.rings.number_fields Fractional ideal (2, a + 1) sage: taus[1](B) # needs sage.rings.number_fields Fractional ideal (2, a + 1) @@ -1650,25 +1650,26 @@ def residue_field(self): EXAMPLES:: + sage: # needs sage.libs.pari sage: P = ZZ.ideal(61); P Principal ideal (61) of Integer Ring - sage: F = P.residue_field(); F # needs sage.libs.pari + sage: F = P.residue_field(); F Residue field of Integers modulo 61 - sage: pi = F.reduction_map(); pi # needs sage.libs.pari + sage: pi = F.reduction_map(); pi Partially defined reduction map: From: Rational Field To: Residue field of Integers modulo 61 - sage: pi(123/234) # needs sage.libs.pari + sage: pi(123/234) 6 - sage: pi(1/61) # needs sage.libs.pari + sage: pi(1/61) Traceback (most recent call last): ... ZeroDivisionError: Cannot reduce rational 1/61 modulo 61: it has negative valuation - sage: lift = F.lift_map(); lift # needs sage.libs.pari + sage: lift = F.lift_map(); lift Lifting map: From: Residue field of Integers modulo 61 To: Integer Ring - sage: lift(F(12345/67890)) # needs sage.libs.pari + sage: lift(F(12345/67890)) 33 sage: (12345/67890) % 61 33 @@ -1713,7 +1714,7 @@ def __repr__(self): sage: from sage.rings.ideal import Ideal_fractional sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: Ideal_fractional(K, [a]) # indirect doctest # needs sage.rings.number_field + sage: Ideal_fractional(K, [a]) # indirect doctest # needs sage.rings.number_field Fractional ideal (a) of Number Field in a with defining polynomial x^2 + 1 """ return "Fractional ideal %s of %s"%(self._repr_short(), self.ring()) diff --git a/src/sage/rings/ideal_monoid.py b/src/sage/rings/ideal_monoid.py index ee3ac892b8f..0988ffc72e5 100644 --- a/src/sage/rings/ideal_monoid.py +++ b/src/sage/rings/ideal_monoid.py @@ -55,7 +55,7 @@ def __init__(self, R): sage: R = QuadraticField(-23, 'a') # needs sage.rings.number_field sage: from sage.rings.ideal_monoid import IdealMonoid - sage: M = IdealMonoid(R); M # indirect doctest # needs sage.rings.number_field + sage: M = IdealMonoid(R); M # indirect doctest # needs sage.rings.number_field Monoid of ideals of Number Field in a with defining polynomial x^2 + 23 with a = 4.795831523312720?*I diff --git a/src/sage/rings/infinity.py b/src/sage/rings/infinity.py index 552f2245c89..e945fcfe455 100644 --- a/src/sage/rings/infinity.py +++ b/src/sage/rings/infinity.py @@ -1725,7 +1725,7 @@ def _sympy_(self): EXAMPLES:: sage: import sympy # needs sympy - sage: bool(oo == sympy.oo) # indirect doctest # needs sympy + sage: bool(oo == sympy.oo) # indirect doctest # needs sympy True sage: bool(SR(oo) == sympy.oo) # needs sympy sage.symbolic True diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index f0f16784381..478babb559f 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -531,33 +531,34 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): Test conversion from PARI (:trac:`11685`):: - sage: ZZ(pari(-3)) # needs sage.libs.pari + sage: # needs sage.libs.pari + sage: ZZ(pari(-3)) -3 - sage: ZZ(pari("-3.0")) # needs sage.libs.pari + sage: ZZ(pari("-3.0")) -3 - sage: ZZ(pari("-3.5")) # needs sage.libs.pari + sage: ZZ(pari("-3.5")) Traceback (most recent call last): ... TypeError: Attempt to coerce non-integral real number to an Integer - sage: ZZ(pari("1e100")) # needs sage.libs.pari + sage: ZZ(pari("1e100")) Traceback (most recent call last): ... PariError: precision too low in truncr (precision loss in truncation) - sage: ZZ(pari("10^50")) # needs sage.libs.pari + sage: ZZ(pari("10^50")) 100000000000000000000000000000000000000000000000000 - sage: ZZ(pari("Pol(3)")) # needs sage.libs.pari + sage: ZZ(pari("Pol(3)")) 3 sage: ZZ(GF(3^20,'t')(1)) # needs sage.rings.finite_rings 1 - sage: ZZ(pari(GF(3^20,'t')(1))) # needs sage.libs.pari sage.rings.finite_rings + sage: ZZ(pari(GF(3^20,'t')(1))) # needs sage.rings.finite_rings 1 sage: x = polygen(QQ) sage: K. = NumberField(x^2 + 3) # needs sage.rings.number_field sage: ZZ(a^2) # needs sage.rings.number_field -3 - sage: ZZ(pari(a)^2) # needs sage.libs.pari sage.rings.number_field + sage: ZZ(pari(a)^2) # needs sage.rings.number_field -3 - sage: ZZ(pari("Mod(x, x^3+x+1)")) # Note error message refers to lifted element # needs sage.libs.pari + sage: ZZ(pari("Mod(x, x^3+x+1)")) # Note error message refers to lifted element Traceback (most recent call last): ... TypeError: Unable to coerce PARI x to an Integer @@ -2901,7 +2902,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): sage: y = Integer(145^145) sage: y.exp() # needs sage.symbolic e^25024207011349079210459585279553675697932183658421565260323592409432707306554163224876110094014450895759296242775250476115682350821522931225499163750010280453185147546962559031653355159703678703793369785727108337766011928747055351280379806937944746847277089168867282654496776717056860661614337004721164703369140625 - sage: y.exp(prec=53) # default RealField precision # needs sage.symbolic + sage: y.exp(prec=53) # default RealField precision # needs sage.symbolic +infinity """ from sage.functions.all import exp @@ -3444,6 +3445,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): sage: divmod(1, sys.maxsize+1r) # should not raise OverflowError: Python int too large to convert to C long (0, 1) + sage: import mpmath # needs mpmath sage: mpmath.mp.prec = 1000 # needs mpmath sage: root = mpmath.findroot(lambda x: x^2 - 3, 2) # needs mpmath @@ -5454,18 +5456,19 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: + sage: # needs sage.libs.pari sage: x = 10^200 + 357 - sage: x.is_pseudoprime() # needs sage.libs.pari + sage: x.is_pseudoprime() True - sage: (x^12).is_pseudoprime_power() # needs sage.libs.pari + sage: (x^12).is_pseudoprime_power() True - sage: (x^12).is_pseudoprime_power(get_data=True) # needs sage.libs.pari + sage: (x^12).is_pseudoprime_power(get_data=True) (1000...000357, 12) - sage: (997^100).is_pseudoprime_power() # needs sage.libs.pari + sage: (997^100).is_pseudoprime_power() True - sage: (998^100).is_pseudoprime_power() # needs sage.libs.pari + sage: (998^100).is_pseudoprime_power() False - sage: ((10^1000 + 453)^2).is_pseudoprime_power() # needs sage.libs.pari + sage: ((10^1000 + 453)^2).is_pseudoprime_power() True TESTS:: @@ -5541,26 +5544,27 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: + sage: n = 7 + sage: n.is_norm(QQ) + True + sage: n.is_norm(QQ, element=True) + (True, 7) + + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K = NumberField(x^2 - 2, 'beta') # needs sage.rings.number_field + sage: K = NumberField(x^2 - 2, 'beta') sage: n = 4 - sage: n.is_norm(K) # needs sage.rings.number_field + sage: n.is_norm(K) True - sage: 5.is_norm(K) # needs sage.rings.number_field + sage: 5.is_norm(K) False - sage: 7.is_norm(QQ) - True - sage: n.is_norm(K, element=True) # needs sage.rings.number_field + sage: n.is_norm(K, element=True) (True, -4*beta + 6) - sage: n.is_norm(K, element=True)[1].norm() # needs sage.rings.number_field + sage: n.is_norm(K, element=True)[1].norm() 4 sage: n = 5 - sage: n.is_norm(K, element=True) # needs sage.rings.number_field + sage: n.is_norm(K, element=True) (False, None) - sage: n = 7 - sage: n.is_norm(QQ, element=True) - (True, 7) - """ from sage.rings.rational_field import QQ return QQ(self).is_norm(K, element=element, proof=proof) @@ -6217,19 +6221,18 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): EXAMPLES:: - sage: import numpy # needs numpy - sage: numpy.array([1, 2, 3]) # needs numpy + sage: # needs numpy + sage: import numpy + sage: numpy.array([1, 2, 3]) array([1, 2, 3]) - sage: numpy.array([1, 2, 3]).dtype # needs numpy + sage: numpy.array([1, 2, 3]).dtype dtype('int32') # 32-bit dtype('int64') # 64-bit - - sage: numpy.array(2**40).dtype # needs numpy + sage: numpy.array(2**40).dtype dtype('int64') - sage: numpy.array(2**400).dtype # needs numpy + sage: numpy.array(2**400).dtype dtype('O') - - sage: numpy.array([1,2,3,0.1]).dtype # needs numpy + sage: numpy.array([1,2,3,0.1]).dtype dtype('float64') """ if mpz_fits_slong_p(self.value): diff --git a/src/sage/rings/integer_ring.pyx b/src/sage/rings/integer_ring.pyx index aa6d56981d2..cb97fec967f 100644 --- a/src/sage/rings/integer_ring.pyx +++ b/src/sage/rings/integer_ring.pyx @@ -394,19 +394,21 @@ cdef class IntegerRing_class(PrincipalIdealDomain): EXAMPLES:: - sage: ZZ[sqrt(2), sqrt(3)] # needs sage.rings.number_field sage.symbolic - Relative Order in Number Field in sqrt2 with defining polynomial x^2 - 2 over its base field sage: ZZ['x'] Univariate Polynomial Ring in x over Integer Ring sage: ZZ['x,y'] Multivariate Polynomial Ring in x, y over Integer Ring - sage: R = ZZ[sqrt(5) + 1]; R # needs sage.rings.number_field sage.symbolic + + sage: # needs sage.rings.number_field sage.symbolic + sage: ZZ[sqrt(2), sqrt(3)] + Relative Order in Number Field in sqrt2 with defining polynomial x^2 - 2 over its base field + sage: R = ZZ[sqrt(5) + 1]; R Order in Number Field in a with defining polynomial x^2 - 2*x - 4 with a = 3.236067977499790? - sage: R.is_maximal() # needs sage.rings.number_field sage.symbolic + sage: R.is_maximal() False - sage: R = ZZ[(1 + sqrt(5))/2]; R # needs sage.rings.number_field sage.symbolic + sage: R = ZZ[(1 + sqrt(5))/2]; R Order in Number Field in a with defining polynomial x^2 - x - 1 with a = 1.618033988749895? - sage: R.is_maximal() # needs sage.rings.number_field sage.symbolic + sage: R.is_maximal() True """ if x in self: @@ -1279,40 +1281,41 @@ cdef class IntegerRing_class(PrincipalIdealDomain): TESTS:: + sage: # needs sage.libs.pari sage: R. = PolynomialRing(ZZ, sparse=True) sage: p = (x + 1)^23 * (x - 1)^23 * (x - 100) * (x + 5445)^5 - sage: ZZ._roots_univariate_polynomial(p) # needs sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p) [(100, 1), (-5445, 5), (1, 23), (-1, 23)] sage: p *= (1 + x^3458645 - 76*x^3435423343 + x^45346567867756556) - sage: ZZ._roots_univariate_polynomial(p) # needs sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p) [(1, 23), (-1, 23), (100, 1), (-5445, 5)] sage: p *= x^156468451540687043504386074354036574634735074 - sage: ZZ._roots_univariate_polynomial(p) # needs sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p) [(0, 156468451540687043504386074354036574634735074), (1, 23), (-1, 23), (100, 1), (-5445, 5)] - sage: ZZ._roots_univariate_polynomial(p, multiplicities=False) # needs sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p, multiplicities=False) [0, 1, -1, 100, -5445] + sage: # needs sage.libs.pari sage: R. = PolynomialRing(ZZ, sparse=False) sage: p = (x + 1)^23 * (x - 1)^23 * (x - 100) * (x + 5445)^5 - sage: ZZ._roots_univariate_polynomial(p) # needs sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p) [(100, 1), (-5445, 5), (1, 23), (-1, 23)] - sage: ZZ._roots_univariate_polynomial(p, multiplicities=False) # needs sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p, multiplicities=False) [100, -5445, 1, -1] - - sage: ZZ._roots_univariate_polynomial(p, algorithm="sparse") # needs sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p, algorithm="sparse") [(100, 1), (-5445, 5), (1, 23), (-1, 23)] - sage: ZZ._roots_univariate_polynomial(p, algorithm="dense") # needs sage.libs.pari + sage: ZZ._roots_univariate_polynomial(p, algorithm="dense") [(100, 1), (-5445, 5), (1, 23), (-1, 23)] sage: ZZ._roots_univariate_polynomial(p, algorithm="foobar") Traceback (most recent call last): ... ValueError: unknown algorithm 'foobar' - sage: p = x^20 * p + sage: p = x^20 * p # needs sage.libs.pari sage: ZZ._roots_univariate_polynomial(p, algorithm="sparse") # needs sage.libs.pari [(0, 20), (100, 1), (-5445, 5), (1, 23), (-1, 23)] sage: ZZ._roots_univariate_polynomial(p, algorithm="dense") # needs sage.libs.pari @@ -1468,7 +1471,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain): EXAMPLES:: - sage: gap(ZZ) # indirect doctest # needs sage.libs.gap + sage: gap(ZZ) # indirect doctest # needs sage.libs.gap Integers """ return 'Integers' diff --git a/src/sage/rings/laurent_series_ring.py b/src/sage/rings/laurent_series_ring.py index a5fc28597eb..565e5d12f4c 100644 --- a/src/sage/rings/laurent_series_ring.py +++ b/src/sage/rings/laurent_series_ring.py @@ -461,24 +461,25 @@ def _element_constructor_(self, x, n=0, prec=infinity): Various conversions from PARI (see also :trac:`2508`):: + sage: # needs sage.libs.pari sage: L. = LaurentSeriesRing(QQ, default_prec=10) - sage: L(pari('1/x')) # needs sage.libs.pari + sage: L(pari('1/x')) q^-1 - sage: L(pari('polchebyshev(5)')) # needs sage.libs.pari + sage: L(pari('polchebyshev(5)')) 5*q - 20*q^3 + 16*q^5 - sage: L(pari('polchebyshev(5) - 1/x^4')) # needs sage.libs.pari + sage: L(pari('polchebyshev(5) - 1/x^4')) -q^-4 + 5*q - 20*q^3 + 16*q^5 - sage: L(pari('1/polchebyshev(5)')) # needs sage.libs.pari + sage: L(pari('1/polchebyshev(5)')) 1/5*q^-1 + 4/5*q + 64/25*q^3 + 192/25*q^5 + 2816/125*q^7 + O(q^9) - sage: L(pari('polchebyshev(5) + O(x^40)')) # needs sage.libs.pari + sage: L(pari('polchebyshev(5) + O(x^40)')) 5*q - 20*q^3 + 16*q^5 + O(q^40) - sage: L(pari('polchebyshev(5) - 1/x^4 + O(x^40)')) # needs sage.libs.pari + sage: L(pari('polchebyshev(5) - 1/x^4 + O(x^40)')) -q^-4 + 5*q - 20*q^3 + 16*q^5 + O(q^40) - sage: L(pari('1/polchebyshev(5) + O(x^10)')) # needs sage.libs.pari + sage: L(pari('1/polchebyshev(5) + O(x^10)')) 1/5*q^-1 + 4/5*q + 64/25*q^3 + 192/25*q^5 + 2816/125*q^7 + 8192/125*q^9 + O(q^10) - sage: L(pari('1/polchebyshev(5) + O(x^10)'), -10) # Multiply by q^-10 # needs sage.libs.pari + sage: L(pari('1/polchebyshev(5) + O(x^10)'), -10) # Multiply by q^-10 1/5*q^-11 + 4/5*q^-9 + 64/25*q^-7 + 192/25*q^-5 + 2816/125*q^-3 + 8192/125*q^-1 + O(1) - sage: L(pari('O(x^-10)')) # needs sage.libs.pari + sage: L(pari('O(x^-10)')) O(q^-10) Check that :trac:`30073` is fixed:: diff --git a/src/sage/rings/laurent_series_ring_element.pyx b/src/sage/rings/laurent_series_ring_element.pyx index 9b8ad96eb09..52d84e8edb2 100644 --- a/src/sage/rings/laurent_series_ring_element.pyx +++ b/src/sage/rings/laurent_series_ring_element.pyx @@ -280,18 +280,19 @@ cdef class LaurentSeries(AlgebraElement): def _im_gens_(self, codomain, im_gens, base_map=None): """ Return the image of this series under the map that sends the generators of - the parent to im_gens. + the parent to ``im_gens``. EXAMPLES:: + sage: # needs sage.rings.number_field sage: Zx. = ZZ[] - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: R. = LaurentSeriesRing(K) # needs sage.rings.number_field - sage: z = t^-1 + i*t # needs sage.rings.number_field - sage: z._im_gens_(R, [t^2]) # needs sage.rings.number_field + sage: K. = NumberField(x^2 + 1) + sage: R. = LaurentSeriesRing(K) + sage: z = t^-1 + i*t + sage: z._im_gens_(R, [t^2]) t^-2 + i*t^2 - The argument base_map is not yet supported, because it isn't over power series:: + The argument ``base_map`` is not yet supported, because it isn't over power series:: sage: cc = K.hom([i]) # needs sage.rings.number_field sage: z._im_gens_(R, [t^2], base_map=cc) # needs sage.rings.number_field diff --git a/src/sage/rings/lazy_series.py b/src/sage/rings/lazy_series.py index 78fbbf67afc..aef134a609d 100644 --- a/src/sage/rings/lazy_series.py +++ b/src/sage/rings/lazy_series.py @@ -91,13 +91,13 @@ We can change the base ring:: sage: h = g.change_ring(QQ) - sage: h.parent() + sage: h.parent() # needs sage.combinat Lazy Laurent Series Ring in z over Rational Field - sage: h + sage: h # needs sage.combinat 4*z + 6*z^2 + 8*z^3 + 19*z^4 + 38*z^5 + 71*z^6 + 130*z^7 + O(z^8) - sage: hinv = h^-1; hinv + sage: hinv = h^-1; hinv # needs sage.combinat 1/4*z^-1 - 3/8 + 1/16*z - 17/32*z^2 + 5/64*z^3 - 29/128*z^4 + 165/256*z^5 + O(z^6) - sage: hinv.valuation() + sage: hinv.valuation() # needs sage.combinat -1 TESTS: @@ -171,30 +171,30 @@ ....: yield n ....: n += 1 - sage: L. = LazyLaurentSeriesRing(GF(2)) # needs sage.rings.finite_rings - sage: check(L, lambda n: n, valuation=-5) # needs sage.rings.finite_rings - sage: check(L, gen(), valuation=-5) # needs sage.rings.finite_rings + sage: L. = LazyLaurentSeriesRing(GF(2)) + sage: check(L, lambda n: n, valuation=-5) + sage: check(L, gen(), valuation=-5) sage: L = LazyDirichletSeriesRing(QQbar, "s") # needs sage.rings.number_field sage: check(L, lambda n: n, valuation=2) # needs sage.rings.number_field - sage: check(L, gen(), valuation=2) # needs sage.rings.number_field + sage: check(L, gen(), valuation=2) - sage: L. = LazyPowerSeriesRing(GF(2)) # needs sage.rings.finite_rings - sage: check(L, lambda n: n, valuation=0) # needs sage.rings.finite_rings - sage: check(L, gen(), valuation=0) # needs sage.rings.finite_rings + sage: L. = LazyPowerSeriesRing(GF(2)) + sage: check(L, lambda n: n, valuation=0) + sage: check(L, gen(), valuation=0) - sage: L. = LazyPowerSeriesRing(GF(2)) # needs sage.rings.finite_rings + sage: L. = LazyPowerSeriesRing(GF(2)) sage: check(L, lambda n: (x + y)^n, valuation=None) # needs sage.rings.finite_rings - sage: def gen(): # needs sage.rings.finite_rings + sage: def gen(): ....: n = 0 ....: while True: ....: yield (x+y)^n ....: n += 1 sage: check(L, gen(), valuation=None) # needs sage.rings.finite_rings - sage: s = SymmetricFunctions(GF(2)).s() # needs sage.combinat sage.rings.finite_rings - sage: L = LazySymmetricFunctions(s) # needs sage.combinat sage.rings.finite_rings - sage: check(L, lambda n: sum(k*s(la) for k, la in enumerate(Partitions(n))), # needs sage.combinat sage.rings.finite_rings + sage: s = SymmetricFunctions(GF(2)).s() # needs sage.combinat + sage: L = LazySymmetricFunctions(s) # needs sage.combinat + sage: check(L, lambda n: sum(k*s(la) for k, la in enumerate(Partitions(n))), # needs sage.combinat ....: valuation=0) """ @@ -436,9 +436,9 @@ def coefficients(self, n=None): sage: f.coefficients() lazy list [1, 1, -1/6, ...] - sage: L. = LazyPowerSeriesRing(GF(2)) # needs sage.rings.finite_rings - sage: f = L(lambda n: n) # needs sage.rings.finite_rings - sage: f.coefficients(5) # needs sage.rings.finite_rings + sage: L. = LazyPowerSeriesRing(GF(2)) + sage: f = L(lambda n: n) + sage: f.coefficients(5) [1, 1, 1, 1, 1] """ coeff_stream = self._coeff_stream @@ -498,7 +498,7 @@ def map_coefficients(self, f): sage: s = L(lambda n: n-1) sage: s # needs sage.symbolic 1/(2^z) + 2/3^z + 3/4^z + 4/5^z + 5/6^z + 6/7^z + O(1/(8^z)) - sage: ms = s.map_coefficients(lambda c: c + 1) + sage: ms = s.map_coefficients(lambda c: c + 1) # needs sage.symbolic sage: ms # needs sage.symbolic 2/2^z + 3/3^z + 4/4^z + 5/5^z + 6/6^z + 7/7^z + 8/8^z + O(1/(9^z)) @@ -1117,7 +1117,7 @@ def define(self, s): sage: C.define(1 + z*C^2) sage: C 1 + z + 2*z^2 + 5*z^3 + 14*z^4 + 42*z^5 + 132*z^6 + O(z^7) - sage: binomial(2000, 1000) / C[1000] + sage: binomial(2000, 1000) / C[1000] # needs sage.symbolic 1001 The Catalan numbers but with a valuation 1:: @@ -1336,7 +1336,7 @@ def define(self, s): sage: L = LazySymmetricFunctions(s) sage: f = L.undefined() sage: f.define(1+(s[1]*f).revert()) - sage: f + sage: f # needs lrcalc_python s[] + s[1] + (-s[1,1]-s[2]) + (3*s[1,1,1]+6*s[2,1]+3*s[3]) + (-13*s[1,1,1,1]-39*s[2,1,1]-26*s[2,2]-39*s[3,1]-13*s[4]) @@ -1344,7 +1344,7 @@ def define(self, s): + (-419*s[1,1,1,1,1,1]-2095*s[2,1,1,1,1]-3771*s[2,2,1,1]-2095*s[2,2,2]-4190*s[3,1,1,1]-6704*s[3,2,1]-2095*s[3,3]-4190*s[4,1,1]-3771*s[4,2]-2095*s[5,1]-419*s[6]) + O^7 - sage: (f*s[1]).revert() + 1 - f # needs sage.combinat + sage: (f*s[1]).revert() + 1 - f # needs lrcalc_python sage.combinat O^7 """ @@ -1615,30 +1615,28 @@ def _add_(self, other): Similarly for Dirichlet series:: + sage: # needs sage.symbolic sage: L = LazyDirichletSeriesRing(ZZ, "z") sage: s = L(lambda n: n) - sage: s # needs sage.symbolic + sage: s 1 + 2/2^z + 3/3^z + 4/4^z + 5/5^z + 6/6^z + 7/7^z + O(1/(8^z)) sage: t = L(constant=1) - sage: t # needs sage.symbolic + sage: t 1 + 1/(2^z) + 1/(3^z) + O(1/(4^z)) sage: st = s + t - sage: st # needs sage.symbolic + sage: st 2 + 3/2^z + 4/3^z + 5/4^z + 6/5^z + 7/6^z + 8/7^z + O(1/(8^z)) - sage: r = L(constant=-1) sage: rt = r + t - sage: rt # needs sage.symbolic + sage: rt 0 - sage: r = L([1,2,3]) sage: rt = r + t - sage: rt # needs sage.symbolic + sage: rt 2 + 3/2^z + 4/3^z + 1/(4^z) + 1/(5^z) + 1/(6^z) + O(1/(7^z)) - sage: r = L([1,2,3], constant=-1) sage: rt = r + t - sage: rt # needs sage.symbolic + sage: rt 2 + 3/2^z + 4/3^z """ P = self.parent() @@ -1831,20 +1829,20 @@ def _acted_upon_(self, scalar, self_on_left): Similarly for Dirichlet series:: + sage: # needs sage.symbolic sage: L = LazyDirichletSeriesRing(ZZ, "z") sage: g = L([0,1]) - sage: 2 * g # needs sage.symbolic + sage: 2 * g 2/2^z - sage: -1 * g # needs sage.symbolic + sage: -1 * g -1/(2^z) - sage: 0*g # needs sage.symbolic + sage: 0*g 0 sage: M = L(lambda n: n) - sage: M # needs sage.symbolic + sage: M 1 + 2/2^z + 3/3^z + 4/4^z + 5/5^z + 6/6^z + 7/7^z + O(1/(8^z)) - sage: 3 * M # needs sage.symbolic + sage: 3 * M 3 + 6/2^z + 9/3^z + 12/4^z + 15/5^z + 18/6^z + 21/7^z + O(1/(8^z)) - sage: 1 * M is M True @@ -2012,7 +2010,7 @@ def sin(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # needs sage.symbolic sage: sin(z)[0:6] == sin(x).series(x, 6).coefficients(sparse=False) True """ @@ -2177,17 +2175,17 @@ def arccos(self): EXAMPLES:: sage: L. = LazyLaurentSeriesRing(RR) - sage: arccos(z) + sage: arccos(z) # needs sage.symbolic 1.57079632679490 - 1.00000000000000*z + 0.000000000000000*z^2 - 0.166666666666667*z^3 + 0.000000000000000*z^4 - 0.0750000000000000*z^5 + O(1.00000000000000*z^7) - sage: L. = LazyLaurentSeriesRing(SR) - sage: arccos(z/(1-z)) + sage: L. = LazyLaurentSeriesRing(SR) # needs sage.symbolic + sage: arccos(z/(1-z)) # needs sage.symbolic 1/2*pi - z - z^2 - 7/6*z^3 - 3/2*z^4 - 83/40*z^5 - 73/24*z^6 + O(z^7) - sage: L. = LazyPowerSeriesRing(SR) - sage: arccos(x/(1-y)) + sage: L. = LazyPowerSeriesRing(SR) # needs sage.symbolic + sage: arccos(x/(1-y)) # needs sage.symbolic 1/2*pi + (-x) + (-x*y) + ((-1/6)*x^3-x*y^2) + ((-1/2)*x^3*y-x*y^3) + ((-3/40)*x^5-x^3*y^2-x*y^4) + ((-3/8)*x^5*y+(-5/3)*x^3*y^3-x*y^5) + O(x,y)^7 @@ -2240,17 +2238,17 @@ def arccot(self): EXAMPLES:: sage: L. = LazyLaurentSeriesRing(RR) - sage: arccot(z) + sage: arccot(z) # needs sage.symbolic 1.57079632679490 - 1.00000000000000*z + 0.000000000000000*z^2 + 0.333333333333333*z^3 + 0.000000000000000*z^4 - 0.200000000000000*z^5 + O(1.00000000000000*z^7) - sage: L. = LazyLaurentSeriesRing(SR) - sage: arccot(z/(1-z)) + sage: L. = LazyLaurentSeriesRing(SR) # needs sage.symbolic + sage: arccot(z/(1-z)) # needs sage.symbolic 1/2*pi - z - z^2 - 2/3*z^3 + 4/5*z^5 + 4/3*z^6 + O(z^7) - sage: L. = LazyPowerSeriesRing(SR) - sage: acot(x/(1-y)) + sage: L. = LazyPowerSeriesRing(SR) # needs sage.symbolic + sage: acot(x/(1-y)) # needs sage.symbolic 1/2*pi + (-x) + (-x*y) + (1/3*x^3-x*y^2) + (x^3*y-x*y^3) + ((-1/5)*x^5+2*x^3*y^2-x*y^4) + (-x^5*y+10/3*x^3*y^3-x*y^5) + O(x,y)^7 @@ -2327,11 +2325,11 @@ def tanh(self): EXAMPLES:: sage: L. = LazyLaurentSeriesRing(QQ) - sage: tanh(z) + sage: tanh(z) # needs sage.libs.flint z - 1/3*z^3 + 2/15*z^5 - 17/315*z^7 + O(z^8) sage: L. = LazyPowerSeriesRing(QQ) - sage: tanh(x/(1-y)) + sage: tanh(x/(1-y)) # needs sage.libs.flint x + x*y + (-1/3*x^3+x*y^2) + (-x^3*y+x*y^3) + (2/15*x^5-2*x^3*y^2+x*y^4) + (2/3*x^5*y-10/3*x^3*y^3+x*y^5) + (-17/315*x^7+2*x^5*y^2-5*x^3*y^4+x*y^6) + O(x,y)^8 @@ -2360,10 +2358,10 @@ def coth(self): EXAMPLES:: sage: L. = LazyLaurentSeriesRing(QQ) - sage: coth(z) + sage: coth(z) # needs sage.libs.flint z^-1 + 1/3*z - 1/45*z^3 + 2/945*z^5 + O(z^6) - sage: coth(z + z^2) + sage: coth(z + z^2) # needs sage.libs.flint z^-1 - 1 + 4/3*z - 2/3*z^2 + 44/45*z^3 - 16/15*z^4 + 884/945*z^5 + O(z^6) TESTS:: @@ -2390,11 +2388,11 @@ def sech(self): EXAMPLES:: sage: L. = LazyLaurentSeriesRing(QQ) - sage: sech(z) + sage: sech(z) # needs sage.libs.flint 1 - 1/2*z^2 + 5/24*z^4 - 61/720*z^6 + O(z^7) sage: L. = LazyPowerSeriesRing(QQ) - sage: sech(x/(1-y)) + sage: sech(x/(1-y)) # needs sage.libs.flint 1 + (-1/2*x^2) + (-x^2*y) + (5/24*x^4-3/2*x^2*y^2) + (5/6*x^4*y-2*x^2*y^3) + (-61/720*x^6+25/12*x^4*y^2-5/2*x^2*y^4) + O(x,y)^7 @@ -2422,11 +2420,11 @@ def csch(self): EXAMPLES:: sage: L. = LazyLaurentSeriesRing(QQ) - sage: csch(z) + sage: csch(z) # needs sage.libs.flint z^-1 - 1/6*z + 7/360*z^3 - 31/15120*z^5 + O(z^6) sage: L. = LazyLaurentSeriesRing(QQ) - sage: csch(z/(1-z)) + sage: csch(z/(1-z)) # needs sage.libs.flint z^-1 - 1 - 1/6*z - 1/6*z^2 - 53/360*z^3 - 13/120*z^4 - 787/15120*z^5 + O(z^6) TESTS:: @@ -2632,16 +2630,17 @@ def __pow__(self, n): EXAMPLES:: + sage: # needs sage.symbolic sage: D = LazyDirichletSeriesRing(QQ, 's') sage: Z = D(constant=1) - sage: Z^2 # needs sage.symbolic + sage: Z^2 1 + 2/2^s + 2/3^s + 3/4^s + 2/5^s + 4/6^s + 2/7^s + O(1/(8^s)) sage: f = Z^(1/3) - sage: f # needs sage.symbolic + sage: f 1 + 1/3/2^s + 1/3/3^s + 2/9/4^s + 1/3/5^s + 1/9/6^s + 1/3/7^s + O(1/(8^s)) - sage: f^2 # needs sage.symbolic + sage: f^2 1 + 2/3/2^s + 2/3/3^s + 5/9/4^s + 2/3/5^s + 4/9/6^s + 2/3/7^s + O(1/(8^s)) - sage: f^3 - Z # needs sage.symbolic + sage: f^3 - Z O(1/(8^s)) sage: L. = LazyLaurentSeriesRing(QQ) @@ -2822,10 +2821,10 @@ def _mul_(self, other): Check products with exact series:: - sage: L([1], constant=3)^2 # needs sage.symbolic + sage: L([1], constant=3)^2 1 + 6*z + 15*z^2 + 24*z^3 + 33*z^4 + 42*z^5 + 51*z^6 + O(z^7) - sage: (1+z) * L([1,0,1], constant=1) # needs sage.symbolic + sage: (1+z) * L([1,0,1], constant=1) 1 + z + z^2 + 2*z^3 + 2*z^4 + 2*z^5 + O(z^6) """ P = self.parent() @@ -3138,7 +3137,7 @@ def _div_(self, other): sage: 1 / (1 - y) 1 + y + y^2 + y^3 + y^4 + y^5 + y^6 + O(x,y)^7 - sage: (x + y) / (1 - y) + sage: (x + y) / (1 - y) # needs sage.libs.singular (x+y) + (x*y+y^2) + (x*y^2+y^3) + (x*y^3+y^4) + (x*y^4+y^5) + (x*y^5+y^6) + (x*y^6+y^7) + O(x,y)^8 TESTS:: @@ -3314,7 +3313,7 @@ def exp(self): 1 + z + 1/2*z^2 + 1/6*z^3 + 1/24*z^4 + 1/120*z^5 + 1/720*z^6 + O(z^7) sage: exp(z + z^2) 1 + z + 3/2*z^2 + 7/6*z^3 + 25/24*z^4 + 27/40*z^5 + 331/720*z^6 + O(z^7) - sage: exp(0) + sage: exp(0) # needs sage.symbolic 1 sage: exp(1 + z) Traceback (most recent call last): @@ -3329,7 +3328,7 @@ def exp(self): TESTS:: - sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") + sage: L. = LazyLaurentSeriesRing(QQ); x = var("x") # needs sage.symbolic sage: exp(z)[0:6] == exp(x).series(x, 6).coefficients(sparse=False) True @@ -3385,7 +3384,7 @@ def log(self): sage: log(1+z)[0:6] == log(1+x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True - sage: log(z) # needs sage.symbolic + sage: log(z) Traceback (most recent call last): ... ValueError: can only compose with a positive valuation series @@ -3513,17 +3512,17 @@ def _im_gens_(self, codomain, im_gens, base_map=None): EXAMPLES:: + sage: # needs sage.rings.number_field sage: Z. = ZZ[] - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: R. = LazyLaurentSeriesRing(K) # needs sage.rings.number_field - sage: f = R(lambda n: i^n, valuation=-2); f # needs sage.rings.number_field + sage: K. = NumberField(x^2 + 1) + sage: R. = LazyLaurentSeriesRing(K) + sage: f = R(lambda n: i^n, valuation=-2); f -t^-2 - i*t^-1 + 1 + i*t - t^2 - i*t^3 + t^4 + O(t^5) - sage: f._im_gens_(R, [t + t^2]) # needs sage.rings.number_field + sage: f._im_gens_(R, [t + t^2]) -t^-2 + (-i + 2)*t^-1 + (i - 2) + 4*t + (2*i - 6)*t^2 + (-2*i + 4)*t^3 + (-2*i - 7)*t^4 + O(t^5) - - sage: cc = K.hom([-i]) # needs sage.rings.number_field - sage: f._im_gens_(R, [t + t^2], base_map=cc) # needs sage.rings.number_field + sage: cc = K.hom([-i]) + sage: f._im_gens_(R, [t + t^2], base_map=cc) -t^-2 + (i + 2)*t^-1 + (-i - 2) + 4*t + (-2*i - 6)*t^2 + (2*i + 4)*t^3 + (2*i - 7)*t^4 + O(t^5) """ @@ -3783,7 +3782,7 @@ def __call__(self, g, *, check=True): ValueError: can only compose with a positive valuation series sage: e5 = L(e, degree=5) - sage: e5 # needs sage.symbolic + sage: e5 1 + z + 1/2*z^2 + 1/6*z^3 + 1/24*z^4 sage: e5(g) # needs sage.symbolic 1 + 1/(2^s) + 3/2/4^s + 1/(5^s) + 2/6^s + O(1/(8^s)) @@ -4557,9 +4556,10 @@ def __call__(self, *g, check=True): We perform the composition with a lazy Dirichlet series:: + sage: # needs sage.symbolic sage: D = LazyDirichletSeriesRing(QQ, "s") sage: g = D(constant=1)-1 - sage: g # needs sage.symbolic + sage: g 1/(2^s) + 1/(3^s) + 1/(4^s) + O(1/(5^s)) sage: f = 1 / (1 - x - y*z); f 1 + x + (x^2+y*z) + (x^3+2*x*y*z) + (x^4+3*x^2*y*z+y^2*z^2) @@ -4567,12 +4567,12 @@ def __call__(self, *g, check=True): + (x^6+5*x^4*y*z+6*x^2*y^2*z^2+y^3*z^3) + O(x,y,z)^7 sage: fog = f(g, g, g) - sage: fog # needs sage.symbolic + sage: fog 1 + 1/(2^s) + 1/(3^s) + 3/4^s + 1/(5^s) + 5/6^s + O(1/(7^s)) sage: fg = 1 / (1 - g - g*g) - sage: fg # needs sage.symbolic + sage: fg 1 + 1/(2^s) + 1/(3^s) + 3/4^s + 1/(5^s) + 5/6^s + 1/(7^s) + O(1/(8^s)) - sage: fog - fg # needs sage.symbolic + sage: fog - fg O(1/(8^s)) sage: f = 1 / (1 - 2*a) @@ -5217,11 +5217,11 @@ def _floordiv_(self, other): sage: g = x^2 + y*x sage: x // g 0 - sage: g = (x^2 + y*x) / (1 - x + x*y) + sage: g = (x^2 + y*x) / (1 - x + x*y) # needs sage.libs.singular sage: x // g 0 - sage: f = (x + y) / (1 - x - y + x*y) - sage: f // g + sage: f = (x + y) / (1 - x - y + x*y) # needs sage.libs.singular + sage: f // g # needs sage.libs.singular 0 sage: L. = LazyPowerSeriesRing(QQ) @@ -5466,22 +5466,18 @@ def is_unit(self): EXAMPLES:: - sage: m = SymmetricFunctions(ZZ).m() # needs sage.modules - sage: L = LazySymmetricFunctions(m) # needs sage.modules - - sage: L(2*m[1]).is_unit() # needs sage.modules + sage: # needs sage.modules + sage: m = SymmetricFunctions(ZZ).m() + sage: L = LazySymmetricFunctions(m) + sage: L(2*m[1]).is_unit() False - - sage: L(-1 + 2*m[1]).is_unit() # needs sage.modules + sage: L(-1 + 2*m[1]).is_unit() True - - sage: L(2 + m[1]).is_unit() # needs sage.modules + sage: L(2 + m[1]).is_unit() False - - sage: m = SymmetricFunctions(QQ).m() # needs sage.modules - sage: L = LazySymmetricFunctions(m) # needs sage.modules - - sage: L(2 + 3*m[1]).is_unit() # needs sage.modules + sage: m = SymmetricFunctions(QQ).m() + sage: L = LazySymmetricFunctions(m) + sage: L(2 + 3*m[1]).is_unit() True """ if self.is_zero(): # now 0 != 1 @@ -5524,25 +5520,23 @@ def __call__(self, *args, check=True): EXAMPLES:: + sage: # needs sage.modules sage: P. = QQ[] - sage: s = SymmetricFunctions(P).s() # needs sage.modules - sage: L = LazySymmetricFunctions(s) # needs sage.modules - sage: f = s[2] # needs sage.modules - sage: g = s[3] # needs sage.modules - sage: L(f)(L(g)) - L(f(g)) # needs sage.modules + sage: s = SymmetricFunctions(P).s() + sage: L = LazySymmetricFunctions(s) + sage: f = s[2] + sage: g = s[3] + sage: L(f)(L(g)) - L(f(g)) 0 - - sage: f = s[2] + s[2,1] # needs sage.modules - sage: g = s[1] + s[2,2] # needs sage.modules - sage: L(f)(L(g)) - L(f(g)) # needs sage.modules + sage: f = s[2] + s[2,1] + sage: g = s[1] + s[2,2] + sage: L(f)(L(g)) - L(f(g)) 0 - - sage: L(f)(g) - L(f(g)) # needs sage.modules + sage: L(f)(g) - L(f(g)) 0 - - sage: f = s[2] + s[2,1] # needs sage.modules - sage: g = s[1] + s[2,2] # needs sage.modules - sage: L(f)(L(q*g)) - L(f(q*g)) # needs sage.modules + sage: f = s[2] + s[2,1] + sage: g = s[1] + s[2,2] + sage: L(f)(L(q*g)) - L(f(q*g)) 0 The Frobenius character of the permutation action on set @@ -5567,11 +5561,11 @@ def __call__(self, *args, check=True): sage: S2 = LazySymmetricFunctions(tensor([s, s])) sage: A = S(s[1,1,1]) sage: B = S2(X+Y) - sage: A(B) + sage: A(B) # needs lrcalc_python (s[]#s[1,1,1]+s[1]#s[1,1]+s[1,1]#s[1]+s[1,1,1]#s[]) sage: H = S(lambda n: s[n]) # needs sage.modules - sage: H(S2(X*Y)) # needs sage.modules + sage: H(S2(X*Y)) # needs lrcalc_python sage.modules (s[]#s[]) + (s[1]#s[1]) + (s[1,1]#s[1,1]+s[2]#s[2]) + (s[1,1,1]#s[1,1,1]+s[2,1]#s[2,1]+s[3]#s[3]) + O^7 sage: H(S2(X+Y)) # needs sage.modules @@ -5588,19 +5582,19 @@ def __call__(self, *args, check=True): sage: s = SymmetricFunctions(QQ).s() sage: S = LazySymmetricFunctions(s) sage: f = 1 / (1 - S(s[2])) - sage: g = f(s[2]); g + sage: g = f(s[2]); g # needs lrcalc_python s[] + (s[2,2]+s[4]) + O^7 - sage: S(sum(f[i](s[2]) for i in range(5))).truncate(10) == g.truncate(10) + sage: S(sum(f[i](s[2]) for i in range(5))).truncate(10) == g.truncate(10) # needs lrcalc_python True sage: f = 1 / (1 - S(s[2])) sage: g = S(s[1]) / (1 - S(s[1])) - sage: f(g) + sage: f(g) # needs lrcalc_python s[] + s[2] + (s[1,1,1]+2*s[2,1]+s[3]) + (2*s[1,1,1,1]+4*s[2,1,1]+5*s[2,2]+5*s[3,1]+3*s[4]) + (2*s[1,1,1,1,1]+10*s[2,1,1,1]+14*s[2,2,1]+18*s[3,1,1]+16*s[3,2]+14*s[4,1]+4*s[5]) + (3*s[1,1,1,1,1,1]+22*s[2,1,1,1,1]+38*s[2,2,1,1]+28*s[2,2,2]+48*s[3,1,1,1]+82*s[3,2,1]+25*s[3,3]+51*s[4,1,1]+56*s[4,2]+31*s[5,1]+9*s[6]) + O^7 - sage: f(0) + sage: f(0) # needs lrcalc_python 1 sage: f(s(1)) Traceback (most recent call last): @@ -5736,18 +5730,15 @@ def revert(self): sage: f = L(a + b*p[1]) sage: f.revert() (((-a)/b)*p[]) + 1/b*p[1] - - sage: f = L(2*p[1]) # needs sage.modules - sage: f.revert() # needs sage.modules + sage: f = L(2*p[1]) + sage: f.revert() 1/2*p[1] - - sage: f = L(2*p[1] + p[1,1]) # needs sage.modules - sage: f.revert() # needs sage.modules + sage: f = L(2*p[1] + p[1,1]) + sage: f.revert() 1/2*p[1] + (-1/8*p[1,1]) + (1/16*p[1,1,1]) + (-5/128*p[1,1,1,1]) + (7/256*p[1,1,1,1,1]) + (-21/1024*p[1,1,1,1,1,1]) + (33/2048*p[1,1,1,1,1,1,1]) + O^8 - - sage: f.revert()(f) # needs sage.modules + sage: f.revert()(f) p[1] + O^8 ALGORITHM: @@ -5855,7 +5846,7 @@ def derivative_with_respect_to_p1(self, n=1): sage: C = T(lambda n: (sum(euler_phi(k)*p([k])**(n//k) ....: for k in divisors(n))/n if n > 0 else 0)) sage: L = T(lambda n: p([1]*n)) - sage: L - C.derivative_with_respect_to_p1() + sage: L - C.derivative_with_respect_to_p1() # needs sage.libs.pari O^6 TESTS:: @@ -5923,13 +5914,14 @@ def functorial_composition(self, *args): \mathfrak{p}_{2}`, where `\mathfrak{p}` is the :class:`~sage.combinat.species.subset_species.SubsetSpecies`.:: + sage: # needs sage.modules sage: R. = QQ[] - sage: h = SymmetricFunctions(R).h() # needs sage.modules - sage: m = SymmetricFunctions(R).m() # needs sage.modules - sage: L = LazySymmetricFunctions(m) # needs sage.modules - sage: P = L(lambda n: sum(q^k*h[n-k]*h[k] for k in range(n+1))) # needs sage.modules - sage: P2 = L(lambda n: h[2]*h[n-2], valuation=2) # needs sage.modules - sage: P.functorial_composition(P2)[:4] # needs sage.modules + sage: h = SymmetricFunctions(R).h() + sage: m = SymmetricFunctions(R).m() + sage: L = LazySymmetricFunctions(m) + sage: P = L(lambda n: sum(q^k*h[n-k]*h[k] for k in range(n+1))) + sage: P2 = L(lambda n: h[2]*h[n-2], valuation=2) + sage: P.functorial_composition(P2)[:4] # needs sage.libs.pari [m[], m[1], (q+1)*m[1, 1] + (q+1)*m[2], @@ -5937,12 +5929,12 @@ def functorial_composition(self, *args): For example, there are:: - sage: P.functorial_composition(P2)[4].coefficient([4])[3] # needs sage.modules + sage: P.functorial_composition(P2)[4].coefficient([4])[3] # needs sage.libs.pari sage.modules 3 unlabelled graphs on 4 vertices and 3 edges, and:: - sage: P.functorial_composition(P2)[4].coefficient([2,2])[3] # needs sage.modules + sage: P.functorial_composition(P2)[4].coefficient([2,2])[3] # needs sage.libs.pari sage.modules 8 labellings of their vertices with two 1's and two 2's. @@ -5959,7 +5951,7 @@ def functorial_composition(self, *args): sage: Ep = p[1]*E.derivative_with_respect_to_p1(); Ep h[1] + (h[1,1]) + (h[2,1]) + (h[3,1]) + (h[4,1]) + (h[5,1]) + O^7 sage: f = L(lambda n: h[n-n//2, n//2]) - sage: f - Ep.functorial_composition(f) + sage: f - Ep.functorial_composition(f) # needs sage.libs.pari O^7 The functorial composition distributes over the sum:: @@ -5978,7 +5970,7 @@ def functorial_composition(self, *args): sage: h = SymmetricFunctions(QQ).h() # needs sage.modules sage: L = LazySymmetricFunctions(h) # needs sage.modules - sage: L(h[2,1]).functorial_composition(3*h[0]) # needs sage.modules + sage: L(h[2,1]).functorial_composition(3*h[0]) # needs sage.libs.pari sage.modules 3*h[] + O^7 Check an instance of a non-group action:: @@ -5989,7 +5981,7 @@ def functorial_composition(self, *args): sage: L = LazySymmetricFunctions(p) sage: f = L(lambda n: s[n]) sage: g = 2*s[2, 1, 1] + s[2, 2] + 3*s[4] - sage: r = f.functorial_composition(g); r[4] + sage: r = f.functorial_composition(g); r[4] # needs sage.libs.pari Traceback (most recent call last): ... ValueError: the argument is not the Frobenius character of a permutation representation @@ -6146,7 +6138,7 @@ def arithmetic_product(self, *args, check=True): sage: C = species.CycleSpecies().cycle_index_series() sage: c = L(lambda n: C[n]) sage: Lplus = L(lambda n: p([1]*n), valuation=1) - sage: r = c.arithmetic_product(Lplus); r + sage: r = c.arithmetic_product(Lplus); r # needs sage.libs.pari m[1] + (3*m[1,1]+2*m[2]) + (8*m[1,1,1]+4*m[2,1]+2*m[3]) + (42*m[1,1,1,1]+21*m[2,1,1]+12*m[2,2]+7*m[3,1]+3*m[4]) @@ -6156,7 +6148,7 @@ def arithmetic_product(self, *args, check=True): In particular, the number of regular octopuses is:: - sage: [r[n].coefficient([1]*n) for n in range(8)] # needs sage.modules + sage: [r[n].coefficient([1]*n) for n in range(8)] # needs sage.libs.pari sage.modules [0, 1, 3, 8, 42, 144, 1440, 5760] It is shown in [MM2008]_ that the exponential generating @@ -6194,7 +6186,7 @@ def arithmetic_product(self, *args, check=True): s[2, 2, 1, 1] + s[3, 1, 1, 1] + s[3, 2, 1] + s[3, 3] + 2*s[4, 1, 1] sage: f = 1/(1-L(s[1])) # needs sage.modules - sage: f.arithmetic_product(s[1]) - f # needs sage.modules + sage: f.arithmetic_product(s[1]) - f # needs lrcalc_python sage.modules O^7 Check that the arithmetic product of symmetric functions with @@ -6323,7 +6315,7 @@ def symmetric_function(self, degree=None): sage: elt.symmetric_function() s[2] sage: f = 1 / (1 - elt) - sage: f + sage: f # needs lrcalc_python s[] + s[2] + (s[2,2]+s[3,1]+s[4]) + (s[2,2,2]+2*s[3,2,1]+s[3,3]+s[4,1,1]+3*s[4,2]+2*s[5,1]+s[6]) + O^7 sage: f.symmetric_function() Traceback (most recent call last): @@ -6331,15 +6323,15 @@ def symmetric_function(self, degree=None): ValueError: not a symmetric function sage: # needs sage.modules - sage: f4 = f.truncate(5); f4 + sage: f4 = f.truncate(5); f4 # needs lrcalc_python s[] + s[2] + (s[2,2]+s[3,1]+s[4]) - sage: f4.symmetric_function() + sage: f4.symmetric_function() # needs lrcalc_python s[] + s[2] + s[2, 2] + s[3, 1] + s[4] - sage: f4.symmetric_function() == f.symmetric_function(4) + sage: f4.symmetric_function() == f.symmetric_function(4) # needs lrcalc_python True sage: S.zero().symmetric_function() 0 - sage: f4.symmetric_function(0) + sage: f4.symmetric_function(0) # needs lrcalc_python s[] """ @@ -6422,9 +6414,9 @@ def valuation(self): sage: (mu - mu).valuation() # needs sage.libs.pari +Infinity sage: g = L(constant=1, valuation=2) - sage: g.valuation() + sage: g.valuation() # needs sage.symbolic log(2) - sage: (g*g).valuation() + sage: (g*g).valuation() # needs sage.symbolic 2*log(2) """ if isinstance(self._coeff_stream, Stream_zero): @@ -6448,7 +6440,7 @@ def _mul_(self, other): 1 + 1/(2^s) + 1/(3^s) + O(1/(4^s)) sage: zeta * zeta # needs sage.symbolic 1 + 2/2^s + 2/3^s + 3/4^s + 2/5^s + 4/6^s + 2/7^s + O(1/(8^s)) - sage: [number_of_divisors(n) for n in range(1, 8)] + sage: [number_of_divisors(n) for n in range(1, 8)] # needs sage.libs.pari [1, 2, 2, 3, 2, 4, 2] sage: mu = D(moebius) @@ -6521,10 +6513,10 @@ def __invert__(self): TESTS:: sage: L = LazyDirichletSeriesRing(ZZ, "z", sparse=False) - sage: ~L(constant=1) - L(moebius) + sage: ~L(constant=1) - L(moebius) # needs sage.libs.pari O(1/(8^z)) sage: L = LazyDirichletSeriesRing(ZZ, "z", sparse=True) - sage: ~L(constant=1) - L(moebius) + sage: ~L(constant=1) - L(moebius) # needs sage.libs.pari O(1/(8^z)) Trying to invert a non-invertible 'exact' series raises a @@ -6571,12 +6563,13 @@ def __call__(self, p, *, check=True): sage: Z = D(constant=1) sage: from sage.arith.misc import dedekind_psi sage: Psi = D(dedekind_psi) - sage: Z(s)*Z(s-1)/Z(2*s) - Psi + sage: Z(s)*Z(s-1)/Z(2*s) - Psi # needs sage.symbolic O(1/(8^s)) - sage: Z(s)*Z(s-1)/Z(2*s-2) - (1/Psi).map_coefficients(abs) + sage: Z(s)*Z(s-1)/Z(2*s-2) - (1/Psi).map_coefficients(abs) # needs sage.symbolic O(1/(8^s)) + sage: # needs sage.symbolic sage: Z(5) zeta(5) sage: Z(1+I) @@ -6605,11 +6598,11 @@ def __call__(self, p, *, check=True): 5 sage: f = D([1,2,-3,-4], constant=2) - sage: bool(f(2) == -1 + -5/3^2 + -6/4^2 + 2*zeta(2)) + sage: bool(f(2) == -1 + -5/3^2 + -6/4^2 + 2*zeta(2)) # needs sage.symbolic True - sage: f(0) + sage: f(0) # needs sage.symbolic -13 - sage: f(1) + sage: f(1) # needs sage.symbolic Infinity """ P = self.parent() @@ -6655,24 +6648,22 @@ def _format_series(self, formatter, format_strings=False): TESTS:: + sage: # needs sage.symbolic sage: L = LazyDirichletSeriesRing(QQ, "s") sage: f = L(constant=1) - sage: f._format_series(repr) # needs sage.symbolic + sage: f._format_series(repr) '1 + 1/(2^s) + 1/(3^s) + O(1/(4^s))' - sage: f._format_series(unicode_art) # needs sage.symbolic + sage: f._format_series(unicode_art) -s -s 1 + 2 + 3 + O(1/(4^s)) - - sage: L([1,-1,1])._format_series(repr) # needs sage.symbolic + sage: L([1,-1,1])._format_series(repr) '1 - 1/(2^s) + 1/(3^s)' - - sage: L([1,-1,1])._format_series(ascii_art) # needs sage.symbolic + sage: L([1,-1,1])._format_series(ascii_art) -s -s 1 + -2 + 3 - sage: R. = QQ[] sage: L = LazyDirichletSeriesRing(R, "s") - sage: L([1,-1 + x,1/3])._format_series(ascii_art) # needs sage.symbolic + sage: L([1,-1 + x,1/3])._format_series(ascii_art) ( -s) (3 ) ( -s ) (---) diff --git a/src/sage/rings/lazy_series_ring.py b/src/sage/rings/lazy_series_ring.py index 07ea18fafa0..f1dbbe5f5ce 100644 --- a/src/sage/rings/lazy_series_ring.py +++ b/src/sage/rings/lazy_series_ring.py @@ -155,10 +155,10 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No If ``x`` can be converted into an element of the underlying Laurent polynomial ring, we do this:: - sage: L = LazyLaurentSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings - sage: L(2) # needs sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(2), 'z') + sage: L(2) 0 - sage: L(3) # needs sage.rings.finite_rings + sage: L(3) 1 In particular, ``x`` can be a Laurent polynomial:: @@ -256,13 +256,13 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No sage: D = LazyDirichletSeriesRing(QQ, "s") sage: L. = LazyLaurentSeriesRing(D) - sage: L(lambda n: 1/factorial(n), valuation=0) + sage: L(lambda n: 1/factorial(n), valuation=0) # needs sage.symbolic (1 + 1/2/2^s + 1/6/3^s + 1/24/4^s + 1/120/5^s + 1/720/6^s + 1/5040/7^s + O(1/(8^s))) We can also specify that the given function should be interpreted as the coefficients of the Laurent series:: - sage: L(coefficients=lambda n: 1/factorial(n), valuation=0) + sage: L(coefficients=lambda n: 1/factorial(n), valuation=0) # needs sage.symbolic 1 + z + 1/2*z^2 + 1/6*z^3 + 1/24*z^4 + 1/120*z^5 + 1/720*z^6 + O(z^7) When the argument ``x`` is callable and not convertible into @@ -272,14 +272,14 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No sage: R. = QQ[] sage: D = LazyDirichletSeriesRing(ZZ, 't') - sage: D(1+2*q) + sage: D(1+2*q) # needs sage.symbolic 3 + 5/2^t + 7/3^t + 9/4^t + 11/5^t + 13/6^t + 15/7^t + O(1/(8^t)) In this example, the Dirichlet series ``m`` is considered as an element in the base ring:: sage: m = D(moebius) - sage: s = L(m, valuation=0) + sage: s = L(m, valuation=0) # needs sage.symbolic sage: s[0] 1 - 1/(2^s) - 1/(3^s) - 1/(5^s) + 1/(6^s) - 1/(7^s) + O(1/(8^s)) sage: s[1] @@ -401,7 +401,7 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No sage: D = LazyDirichletSeriesRing(ZZ, "s") sage: E = LazyDirichletSeriesRing(QQ, "t") - sage: D(E([1,2,3])) + sage: D(E([1,2,3])) # needs sage.symbolic 1 + 2/2^s + 3/3^s This gives zero:: @@ -760,14 +760,14 @@ def characteristic(self): sage: L.characteristic() 0 - sage: R. = LazyLaurentSeriesRing(GF(11)); R # needs sage.rings.finite_rings + sage: R. = LazyLaurentSeriesRing(GF(11)); R Lazy Laurent Series Ring in w over Finite Field of size 11 - sage: R.characteristic() # needs sage.rings.finite_rings + sage: R.characteristic() 11 - sage: R. = LazyPowerSeriesRing(GF(7)); R # needs sage.rings.finite_rings + sage: R. = LazyPowerSeriesRing(GF(7)); R Multivariate Lazy Taylor Series Ring in x, y over Finite Field of size 7 - sage: R.characteristic() # needs sage.rings.finite_rings + sage: R.characteristic() 7 sage: L = LazyDirichletSeriesRing(ZZ, "s") @@ -782,13 +782,13 @@ def _coerce_map_from_(self, S): EXAMPLES:: - sage: L = LazyLaurentSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings - sage: L.has_coerce_map_from(ZZ) # needs sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(2), 'z') + sage: L.has_coerce_map_from(ZZ) True - sage: L.has_coerce_map_from(GF(2)) # needs sage.rings.finite_rings + sage: L.has_coerce_map_from(GF(2)) True sage: R = LazyPowerSeriesRing(ZZ, 'z') - sage: L.has_coerce_map_from(R) # needs sage.rings.finite_rings + sage: L.has_coerce_map_from(R) True sage: L = LazyLaurentSeriesRing(QQ, 'z') @@ -802,10 +802,10 @@ def _coerce_map_from_(self, S): sage: L.has_coerce_map_from(R) False - sage: L = LazyPowerSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings - sage: L.has_coerce_map_from(ZZ) # needs sage.rings.finite_rings + sage: L = LazyPowerSeriesRing(GF(2), 'z') + sage: L.has_coerce_map_from(ZZ) True - sage: L.has_coerce_map_from(GF(2)) # needs sage.rings.finite_rings + sage: L.has_coerce_map_from(GF(2)) True sage: # needs sage.modules sage.rings.finite_rings @@ -1207,13 +1207,13 @@ def __init__(self, base_ring, names, sparse=True, category=None): (euclidean domains and infinite enumerated sets and metric spaces) and infinite sets) - sage: L = LazyLaurentSeriesRing(GF(5), 't') # needs sage.rings.finite_rings - sage: TestSuite(L).run() # needs sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(5), 't') + sage: TestSuite(L).run() - sage: L = LazyLaurentSeriesRing(GF(5)['x'], 't') # needs sage.rings.finite_rings - sage: TestSuite(L).run() # needs sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(5)['x'], 't') + sage: TestSuite(L).run() - sage: L = LazyLaurentSeriesRing(GF(5)['x, y'], 't') # needs sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(5)['x, y'], 't') sage: TestSuite(L).run() # needs sage.rings.finite_rings sage: L = LazyLaurentSeriesRing(Zmod(6), 't') @@ -1257,7 +1257,7 @@ def _repr_(self): EXAMPLES:: - sage: LazyLaurentSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings + sage: LazyLaurentSeriesRing(GF(2), 'z') Lazy Laurent Series Ring in z over Finite Field of size 2 """ return "Lazy Laurent Series Ring in {} over {}".format(self.variable_name(), self.base_ring()) @@ -1268,8 +1268,8 @@ def _latex_(self): EXAMPLES:: - sage: L = LazyLaurentSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings - sage: latex(L) # needs sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(2), 'z') + sage: latex(L) \Bold{F}_{2} (\!(z)\!) """ from sage.misc.latex import latex @@ -1354,16 +1354,16 @@ def some_elements(self): -2*z^-3 - 2*z^-2 + 4*z^-1 + 11 - z - 34*z^2 - 31*z^3 + O(z^4), 4*z^-2 + z^-1 + z + 4*z^2 + 9*z^3 + 16*z^4 + O(z^5)] - sage: L = LazyLaurentSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings - sage: L.some_elements()[:7] # needs sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(2), 'z') + sage: L.some_elements()[:7] [0, 1, z, z^-4 + z^-3 + z^2 + z^3, z^-2, 1 + z + z^3 + z^4 + z^6 + O(z^7), z^-1 + z + z^3 + O(z^5)] - sage: L = LazyLaurentSeriesRing(GF(3), 'z') # needs sage.rings.finite_rings - sage: L.some_elements()[:7] # needs sage.rings.finite_rings + sage: L = LazyLaurentSeriesRing(GF(3), 'z') + sage: L.some_elements()[:7] [0, 1, z, z^-3 + z^-1 + 2 + z + z^2 + z^3, z^-2, @@ -1562,7 +1562,7 @@ def q_pochhammer(self, q=None): sage: R = ZZ['q'].fraction_field() sage: q = R.gen() sage: L. = LazyLaurentSeriesRing(LazyDirichletSeriesRing(R, "s")) - sage: z.q_pochhammer(q) + sage: z.q_pochhammer(q) # needs sage.symbolic 1 + ((1/(q-1)))*z + ((q/(q^3-q^2-q+1)))*z^2 + ... + O(z^7) REFERENCES: @@ -1612,7 +1612,7 @@ def euler(self): TESTS:: sage: L. = LazyLaurentSeriesRing(LazyDirichletSeriesRing(QQ, "s")) - sage: q.euler() + sage: q.euler() # needs sage.symbolic 1 - q - q^2 + q^5 + O(q^7) REFERENCES: @@ -1671,11 +1671,11 @@ def __init__(self, base_ring, names, sparse=True, category=None): sage: L = LazyPowerSeriesRing(QQ, 's, t') sage: TestSuite(L).run(skip="_test_fraction_field") - sage: L = LazyPowerSeriesRing(GF(5), 't') # needs sage.rings.finite_rings - sage: TestSuite(L).run() # needs sage.rings.finite_rings + sage: L = LazyPowerSeriesRing(GF(5), 't') + sage: TestSuite(L).run() - sage: L = LazyPowerSeriesRing(GF(5), 's, t') # needs sage.rings.finite_rings - sage: TestSuite(L).run(skip=['_test_fraction_field']) # needs sage.rings.finite_rings + sage: L = LazyPowerSeriesRing(GF(5), 's, t') + sage: TestSuite(L).run(skip=['_test_fraction_field']) sage: L = LazyPowerSeriesRing(Zmod(6), 't') sage: TestSuite(L).run(skip=['_test_revert']) @@ -1757,7 +1757,7 @@ def _repr_(self): EXAMPLES:: - sage: LazyPowerSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings + sage: LazyPowerSeriesRing(GF(2), 'z') Lazy Taylor Series Ring in z over Finite Field of size 2 """ BR = self.base_ring() @@ -1772,8 +1772,8 @@ def _latex_(self): EXAMPLES:: - sage: L = LazyPowerSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings - sage: latex(L) # needs sage.rings.finite_rings + sage: L = LazyPowerSeriesRing(GF(2), 'z') + sage: latex(L) \Bold{F}_{2} [\![z]\!] """ from sage.misc.latex import latex @@ -1871,10 +1871,10 @@ def _element_constructor_(self, x=None, valuation=None, constant=None, degree=No EXAMPLES:: - sage: L = LazyPowerSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings - sage: L(2) # needs sage.rings.finite_rings + sage: L = LazyPowerSeriesRing(GF(2), 'z') + sage: L(2) 0 - sage: L(3) # needs sage.rings.finite_rings + sage: L(3) 1 sage: L = LazyPowerSeriesRing(ZZ, 'z') @@ -2193,15 +2193,15 @@ def some_elements(self): 1 + z - 2*z^2 - 7*z^3 - z^4 + 20*z^5 + 23*z^6 + O(z^7), z + 4*z^2 + 9*z^3 + 16*z^4 + 25*z^5 + 36*z^6 + O(z^7)] - sage: L = LazyPowerSeriesRing(GF(3)["q"], 'z') # needs sage.rings.finite_rings - sage: L.some_elements()[:6] # needs sage.rings.finite_rings + sage: L = LazyPowerSeriesRing(GF(3)["q"], 'z') + sage: L.some_elements()[:6] [0, 1, z + q*z^2 + q*z^3 + q*z^4 + O(z^5), z + z^2 + z^3, 1 + z + z^2 + 2*z^3 + 2*z^4 + 2*z^5 + O(z^6), z + z^2 + z^4 + z^5 + O(z^7)] - sage: L = LazyPowerSeriesRing(GF(3), 'q, t') # needs sage.rings.finite_rings - sage: L.some_elements()[:6] # needs sage.rings.finite_rings + sage: L = LazyPowerSeriesRing(GF(3), 'q, t') + sage: L.some_elements()[:6] [0, 1, q, q + q^2 + q^3, 1 + q + q^2 + (-q^3) + (-q^4) + (-q^5) + (-q^6) + O(q,t)^7, @@ -2277,21 +2277,21 @@ def __init__(self, basis, sparse=True, category=None): sage: s = SymmetricFunctions(QQ).s() # needs sage.modules sage: L = LazySymmetricFunctions(s) # needs sage.modules - sage: TestSuite(L).run() # needs sage.modules + sage: TestSuite(L).run() # needs lrcalc_python sage.modules - sage: p = SymmetricFunctions(GF(5)).p() # needs sage.modules sage.rings.finite_rings - sage: L = LazySymmetricFunctions(p) # needs sage.modules sage.rings.finite_rings - sage: TestSuite(L).run() # needs sage.modules sage.rings.finite_rings + sage: p = SymmetricFunctions(GF(5)).p() # needs sage.modules + sage: L = LazySymmetricFunctions(p) # needs sage.modules + sage: TestSuite(L).run() # needs sage.modules Reversion will only work when the base ring is a field:: sage: s = SymmetricFunctions(ZZ).s() # needs sage.modules sage: L = LazySymmetricFunctions(s) # needs sage.modules - sage: TestSuite(L).run(skip=['_test_revert']) # needs sage.modules + sage: TestSuite(L).run(skip=['_test_revert']) # needs lrcalc_python sage.modules sage: s = SymmetricFunctions(QQ["q"]).s() # needs sage.modules sage: L = LazySymmetricFunctions(s) # needs sage.modules - sage: TestSuite(L).run(skip=['_test_revert']) # needs sage.modules + sage: TestSuite(L).run(skip=['_test_revert']) # needs lrcalc_python sage.modules Options are remembered across doctests:: @@ -2347,8 +2347,8 @@ def _repr_(self): EXAMPLES:: - sage: s = SymmetricFunctions(GF(2)).s() # needs sage.modules sage.rings.finite_rings - sage: LazySymmetricFunctions(s) # needs sage.modules sage.rings.finite_rings + sage: s = SymmetricFunctions(GF(2)).s() # needs sage.modules + sage: LazySymmetricFunctions(s) # needs sage.modules Lazy completion of Symmetric Functions over Finite Field of size 2 in the Schur basis """ return "Lazy completion of {}".format(self._laurent_poly_ring) @@ -2359,9 +2359,9 @@ def _latex_(self): EXAMPLES:: - sage: s = SymmetricFunctions(GF(2)).s() # needs sage.modules sage.rings.finite_rings - sage: L = LazySymmetricFunctions(s) # needs sage.modules sage.rings.finite_rings - sage: latex(L) # needs sage.modules sage.rings.finite_rings + sage: s = SymmetricFunctions(GF(2)).s() # needs sage.modules + sage: L = LazySymmetricFunctions(s) # needs sage.modules + sage: latex(L) # needs sage.modules \text{\texttt{Symmetric{ }Functions{ }over{ }Finite{ }Field{ }of{ }size{ }2{ }in{ }the{ }Schur{ }basis}} """ from sage.misc.latex import latex @@ -2589,9 +2589,9 @@ def some_elements(self): EXAMPLES:: - sage: m = SymmetricFunctions(GF(5)).m() # needs sage.modules sage.rings.finite_rings - sage: L = LazySymmetricFunctions(m) # needs sage.modules sage.rings.finite_rings - sage: L.some_elements()[:5] # needs sage.modules sage.rings.finite_rings + sage: m = SymmetricFunctions(GF(5)).m() # needs sage.modules + sage: L = LazySymmetricFunctions(m) # needs sage.modules + sage: L.some_elements()[:5] # needs sage.modules [0, m[], 2*m[] + 2*m[1] + 3*m[2], 2*m[1] + 3*m[2], 3*m[] + 2*m[1] + (m[1,1]+m[2]) + (2*m[1,1,1]+m[3]) @@ -2846,7 +2846,7 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No sage: X = L(constant=5, degree=3) sage: X # needs sage.symbolic 5/3^z + 5/4^z + 5/5^z + O(1/(6^z)) - sage: X.valuation() + sage: X.valuation() # needs sage.symbolic log(3) sage: e = L(moebius) sage: e # needs sage.symbolic @@ -2880,14 +2880,14 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No TESTS:: - sage: L = LazyDirichletSeriesRing(GF(2), 'z') # needs sage.rings.finite_rings + sage: L = LazyDirichletSeriesRing(GF(2), 'z') Traceback (most recent call last): ... ValueError: positive characteristic not allowed for Dirichlet series sage: L. = LazyLaurentSeriesRing(QQ) sage: D = LazyDirichletSeriesRing(QQ, 't') - sage: d = D(L.one()) + sage: d = D(L.one()) # needs sage.symbolic sage: d # needs sage.symbolic 1 + 1/(2^t) + 1/(3^t) + 1/(4^t) + 1/(5^t) + 1/(6^t) + 1/(7^t) + O(1/(8^t)) @@ -2898,7 +2898,7 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No 2 + 6/2^t + 12/3^t + 20/4^t + 30/5^t + 42/6^t + 56/7^t + O(1/(8^t)) sage: s = D(lambda n: n) - sage: d2 = D(s, valuation=2) + sage: d2 = D(s, valuation=2) # needs sage.symbolic sage: d2 # needs sage.symbolic 1/(2^t) + 2/3^t + 3/4^t + 4/5^t + 5/6^t + 6/7^t + 7/8^t + O(1/(9^t)) @@ -2907,8 +2907,8 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No sage: m # needs sage.symbolic -1/(2^s) - 1/(3^s) - 1/(5^s) + 1/(6^s) - 1/(7^s) + O(1/(9^s)) sage: D = LazyDirichletSeriesRing(QQ, 't') - sage: dm = D(m) - sage: dm # needs sage.symbolic + sage: dm = D(m) # needs sage.libs.pari + sage: dm # needs sage.libs.pari sage.symbolic -1/(2^t) - 1/(3^t) - 1/(5^t) + 1/(6^t) - 1/(7^t) + O(1/(9^t)) """ if isinstance(x, (list, tuple)): diff --git a/src/sage/rings/morphism.pyx b/src/sage/rings/morphism.pyx index eff6af6e04d..8f7c0176ccb 100644 --- a/src/sage/rings/morphism.pyx +++ b/src/sage/rings/morphism.pyx @@ -99,16 +99,17 @@ Inclusion map from the reals to the complexes:: A map from a multivariate polynomial ring to itself:: sage: R. = PolynomialRing(QQ,3) - sage: phi = R.hom([y,z,x^2]); phi + sage: phi = R.hom([y, z, x^2]); phi Ring endomorphism of Multivariate Polynomial Ring in x, y, z over Rational Field Defn: x |--> y y |--> z z |--> x^2 - sage: phi(x+y+z) + sage: phi(x + y + z) x^2 + y + z An endomorphism of a quotient of a multi-variate polynomial ring:: + sage; # needs sage.libs.singular sage: R. = PolynomialRing(QQ) sage: S. = quo(R, ideal(1 + y^2)) # needs sage.libs.singular sage: phi = S.hom([a^2, -b]) # needs sage.libs.singular @@ -203,14 +204,15 @@ Inclusion from `\QQ` to the 3-adic field:: An automorphism of a quotient of a univariate polynomial ring:: + sage: # needs sage.libs.pari sage: R. = PolynomialRing(QQ) - sage: S. = R.quo(x^2 - 2) # needs sage.libs.pari - sage: sqrt2^2 # needs sage.libs.pari + sage: S. = R.quo(x^2 - 2) + sage: sqrt2^2 2 - sage: (3+sqrt2)^10 # needs sage.libs.pari + sage: (3+sqrt2)^10 993054*sqrt2 + 1404491 - sage: c = S.hom([-sqrt2]) # needs sage.libs.pari - sage: c(1+sqrt2) # needs sage.libs.pari + sage: c = S.hom([-sqrt2]) + sage: c(1+sqrt2) -sqrt2 + 1 Note that Sage verifies that the morphism is valid:: @@ -276,11 +278,13 @@ positive:: sage: R.hom([1/t]) Traceback (most recent call last): ... - ValueError: relations do not all (canonically) map to 0 under map determined by images of generators + ValueError: relations do not all (canonically) map to 0 + under map determined by images of generators sage: R.hom([1]) Traceback (most recent call last): ... - ValueError: relations do not all (canonically) map to 0 under map determined by images of generators + ValueError: relations do not all (canonically) map to 0 + under map determined by images of generators Complex conjugation on cyclotomic fields:: @@ -300,20 +304,21 @@ Complex conjugation on cyclotomic fields:: Embedding a number field into the reals:: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: K. = NumberField(x^3 - 2) sage: alpha = RR(2)^(1/3); alpha 1.25992104989487 - sage: i = K.hom([alpha],check=False); i # needs sage.rings.number_field + sage: i = K.hom([alpha],check=False); i Ring morphism: From: Number Field in beta with defining polynomial x^3 - 2 To: Real Field with 53 bits of precision Defn: beta |--> 1.25992104989487 - sage: i(beta) # needs sage.rings.number_field + sage: i(beta) 1.25992104989487 - sage: i(beta^3) # needs sage.rings.number_field + sage: i(beta^3) 2.00000000000000 - sage: i(beta^2 + 1) # needs sage.rings.number_field + sage: i(beta^2 + 1) 2.58740105196820 An example from Jim Carlson:: @@ -832,21 +837,22 @@ cdef class RingHomomorphism(RingMap): We check that composition works when there is a base map:: + sage: # needs sage.rings.finite_rings sage: R. = ZZ[] - sage: K. = GF(7^2) # needs sage.rings.finite_rings - sage: L. = K.extension(x^3 - 3) # needs sage.rings.finite_rings - sage: phi = L.hom([u^7], base_map=K.frobenius_endomorphism()) # needs sage.rings.finite_rings - sage: phi # needs sage.rings.finite_rings + sage: K. = GF(7^2) + sage: L. = K.extension(x^3 - 3) + sage: phi = L.hom([u^7], base_map=K.frobenius_endomorphism()) + sage: phi Ring endomorphism of Univariate Quotient Polynomial Ring in u over Finite Field in a of size 7^2 with modulus u^3 + 4 Defn: u |--> 2*u with map of base ring - sage: psi = phi^3; psi # needs sage.rings.finite_rings + sage: psi = phi^3; psi Ring endomorphism of Univariate Quotient Polynomial Ring in u over Finite Field in a of size 7^2 with modulus u^3 + 4 Defn: u |--> u with map of base ring - sage: psi(a) == phi(phi(phi(a))) # needs sage.rings.finite_rings + sage: psi(a) == phi(phi(phi(a))) True It also works when the image of the base map is not contained within the base ring of the codomain:: @@ -968,14 +974,14 @@ cdef class RingHomomorphism(RingMap): The image of the inverse image ideal can be strictly smaller than the original ideal:: - sage: # needs sage.libs.singular + sage: # needs sage.libs.singular sage.rings.number_field sage: S. = QQ['u,v'].quotient('v^2 - 2') - sage: f = QuadraticField(2).hom([v], S) # needs sage.rings.number_field + sage: f = QuadraticField(2).hom([v], S) sage: I = S.ideal(u + v) - sage: J = f.inverse_image(I) # needs sage.rings.number_field - sage: J.is_zero() # needs sage.rings.number_field + sage: J = f.inverse_image(I) + sage: J.is_zero() True - sage: f(J) < I # needs sage.rings.number_field + sage: f(J) < I True Fractional ideals are not yet fully supported:: @@ -1107,20 +1113,21 @@ cdef class RingHomomorphism(RingMap): Check cases involving quotient rings in which a generator is constant (:trac:`31178`):: + sage: # needs sage.libs.singular sage: R. = QQ[] - sage: B. = R.quotient(R.ideal(x)) # needs sage.libs.singular - sage: g = R.hom([d^2, d^3], B) # needs sage.libs.singular - sage: g.inverse_image(d) # needs sage.libs.singular + sage: B. = R.quotient(R.ideal(x)) + sage: g = R.hom([d^2, d^3], B) + sage: g.inverse_image(d) Traceback (most recent call last): ... ValueError: element d does not have preimage - sage: g.inverse_image(d^2) # needs sage.libs.singular + sage: g.inverse_image(d^2) x - sage: g.inverse_image(d^3) # needs sage.libs.singular + sage: g.inverse_image(d^3) y - sage: A. = R.quotient(R.ideal(y^2 - x^3)) # needs sage.libs.singular - sage: h = A.hom([d^2, d^3], B) # needs sage.libs.singular - sage: h.inverse_image(d^2) # needs sage.libs.singular + sage: A. = R.quotient(R.ideal(y^2 - x^3)) + sage: h = A.hom([d^2, d^3], B) + sage: h.inverse_image(d^2) a Check that quotient rings are handled correctly (:trac:`33217`):: @@ -1367,17 +1374,18 @@ cdef class RingHomomorphism(RingMap): The following non-linear homomorphism is not invertible, but it induces an isomorphism on a quotient ring:: + sage: # needs sage.libs.singular sage: R. = QQ[] sage: f = R.hom([y*z, x*z, x*y], R) - sage: f.inverse() # needs sage.libs.singular + sage: f.inverse() Traceback (most recent call last): ... ZeroDivisionError: ring homomorphism not surjective - sage: f.is_injective() # needs sage.libs.singular + sage: f.is_injective() True - sage: Q. = R.quotient(x*y*z - 1) # needs sage.libs.singular - sage: g = Q.hom([y*z, x*z, x*y], Q) # needs sage.libs.singular - sage: g.inverse() # needs sage.libs.singular + sage: Q. = R.quotient(x*y*z - 1) + sage: g = Q.hom([y*z, x*z, x*y], Q) + sage: g.inverse() Ring endomorphism of Quotient of Multivariate Polynomial Ring in x, y, z over Rational Field by the ideal (x*y*z - 1) Defn: x |--> y*z @@ -1481,18 +1489,19 @@ cdef class RingHomomorphism(RingMap): Morphisms involving quotient rings:: + sage: # needs sage.libs.singular sage: R. = QQ[] - sage: S. = QQ['s,u,t'].quotient('u-t^2') # needs sage.libs.singular - sage: f = R.hom([s, -t], S) # needs sage.libs.singular - sage: (f.inverse() * f).is_identity() # needs sage.libs.singular + sage: S. = QQ['s,u,t'].quotient('u-t^2') + sage: f = R.hom([s, -t], S) + sage: (f.inverse() * f).is_identity() True - sage: Q. = R.quotient(x - y^2) # needs sage.libs.singular - sage: g = Q.hom([v, -w], Q) # needs sage.libs.singular - sage: g.inverse()(g(v)) == v and g.inverse()(g(w)) == w # needs sage.libs.singular + sage: Q. = R.quotient(x - y^2) + sage: g = Q.hom([v, -w], Q) + sage: g.inverse()(g(v)) == v and g.inverse()(g(w)) == w True sage: S. = QQ[] - sage: h = Q.hom([z^2, -z], S) # needs sage.libs.singular - sage: h.inverse()(h(v)) == v and h.inverse()(h(w)) == w # needs sage.libs.singular + sage: h = Q.hom([z^2, -z], S) + sage: h.inverse()(h(v)) == v and h.inverse()(h(w)) == w True Morphisms between number fields and quotient rings:: @@ -1528,23 +1537,24 @@ cdef class RingHomomorphism(RingMap): Non-injective homomorphisms:: + sage: # needs sage.libs.singular sage: R. = QQ[] sage: S. = QQ[] - sage: S.hom([x, y, 0], R).inverse() # needs sage.libs.singular + sage: S.hom([x, y, 0], R).inverse() Traceback (most recent call last): ... ZeroDivisionError: ring homomorphism not injective sage: T. = QQ[] - sage: R.hom([2*z, 3*z], T).inverse() # needs sage.libs.singular + sage: R.hom([2*z, 3*z], T).inverse() Traceback (most recent call last): ... ZeroDivisionError: ring homomorphism not injective - sage: Q. = R.quotient([x^5, y^4]) # needs sage.libs.singular - sage: R.hom([u, v], Q).inverse() # needs sage.libs.singular + sage: Q. = R.quotient([x^5, y^4]) + sage: R.hom([u, v], Q).inverse() Traceback (most recent call last): ... ZeroDivisionError: ring homomorphism not injective - sage: Q.cover().inverse() # needs sage.libs.singular + sage: Q.cover().inverse() Traceback (most recent call last): ... ZeroDivisionError: ring homomorphism not injective @@ -1821,12 +1831,13 @@ cdef class RingHomomorphism_im_gens(RingHomomorphism): You can give a map of the base ring:: + sage: # needs sage.rings.number_field sage: Zx. = ZZ[] - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: cc = K.hom([-i]) # needs sage.rings.number_field - sage: R. = K[] # needs sage.rings.number_field - sage: z = 1 + i*t + (3+4*i)*t^2 # needs sage.rings.number_field - sage: z._im_gens_(R, [t^2], base_map=cc) # needs sage.rings.number_field + sage: K. = NumberField(x^2 + 1) + sage: cc = K.hom([-i]) + sage: R. = K[] + sage: z = 1 + i*t + (3+4*i)*t^2 + sage: z._im_gens_(R, [t^2], base_map=cc) (-4*i + 3)*t^4 - i*t^2 + 1 The base map's codomain is extended to the whole codomain:: @@ -1909,21 +1920,22 @@ cdef class RingHomomorphism_im_gens(RingHomomorphism): EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = ZZ[] - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: cc = K.hom([-i]) # needs sage.rings.number_field - sage: S. = K[] # needs sage.rings.number_field - sage: phi = S.hom([y^2], base_map=cc) # needs sage.rings.number_field - sage: phi # needs sage.rings.number_field + sage: K. = NumberField(x^2 + 1) + sage: cc = K.hom([-i]) + sage: S. = K[] + sage: phi = S.hom([y^2], base_map=cc) + sage: phi Ring endomorphism of Univariate Polynomial Ring in y over Number Field in i with defining polynomial x^2 + 1 Defn: y |--> y^2 with map of base ring - sage: phi(y) # needs sage.rings.number_field + sage: phi(y) y^2 - sage: phi(i*y) # needs sage.rings.number_field + sage: phi(i*y) -i*y^2 - sage: phi.base_map() # needs sage.rings.number_field + sage: phi.base_map() Composite map: From: Number Field in i with defining polynomial x^2 + 1 To: Univariate Polynomial Ring in y over Number Field in i @@ -1985,17 +1997,18 @@ cdef class RingHomomorphism_im_gens(RingHomomorphism): A single variate quotient over `\QQ`:: + sage: # needs sage.libs.pari sage: R. = QQ[] - sage: Q. = R.quotient(x^2 + x + 1) # needs sage.libs.pari - sage: f1 = R.hom([a]) # needs sage.libs.pari - sage: f2 = R.hom([a + a^2 + a + 1]) # needs sage.libs.pari - sage: f1 == f2 # needs sage.libs.pari + sage: Q. = R.quotient(x^2 + x + 1) + sage: f1 = R.hom([a]) + sage: f2 = R.hom([a + a^2 + a + 1]) + sage: f1 == f2 True - sage: f1 == R.hom([a^2]) # needs sage.libs.pari + sage: f1 == R.hom([a^2]) False - sage: f1(x^3 + x) # needs sage.libs.pari + sage: f1(x^3 + x) a + 1 - sage: f2(x^3 + x) # needs sage.libs.pari + sage: f2(x^3 + x) a + 1 TESTS:: @@ -2013,7 +2026,6 @@ cdef class RingHomomorphism_im_gens(RingHomomorphism): A multivariate quotient over a finite field:: - sage: # needs sage.rings.finite_rings sage: R. = GF(7)[] sage: Q. = R.quotient([x^2 + x + 1, y^2 + y + 1]) sage: f1 = R.hom([a, b]) @@ -2238,13 +2250,14 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): EXAMPLES:: + sage: # needs sage.modules sage: R. = QQ[] sage: S. = QQ[] sage: f = R.hom([2*z, 3*z], S) - sage: MR = MatrixSpace(R, 2) # needs sage.modules - sage: MS = MatrixSpace(S, 2) # needs sage.modules - sage: g = MR.hom(f, MS) # needs sage.modules - sage: g.underlying_map() == f # needs sage.modules + sage: MR = MatrixSpace(R, 2) + sage: MS = MatrixSpace(S, 2) + sage: g = MR.hom(f, MS) + sage: g.underlying_map() == f True """ return self._underlying @@ -2317,15 +2330,16 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): A multivariate polynomial ring over a single variate quotient over `\QQ`:: + sage: # needs sage.libs.pari sage.libs.singular sage.modules sage: R. = QQ[] - sage: Q. = R.quotient(x^2 + x + 1) # needs sage.libs.pari sage.modules - sage: f1 = R.hom([a]) # needs sage.libs.pari sage.libs.singular sage.modules - sage: f2 = R.hom([a + a^2 + a + 1]) # needs sage.libs.pari sage.libs.singular sage.modules + sage: Q. = R.quotient(x^2 + x + 1) + sage: f1 = R.hom([a]) + sage: f2 = R.hom([a + a^2 + a + 1]) sage: PR. = R[] - sage: PQ = Q['s','t'] # needs sage.libs.pari sage.libs.singular sage.modules - sage: f1P = PR.hom(f1,PQ) # needs sage.libs.pari sage.libs.singular sage.modules - sage: f2P = PR.hom(f2,PQ) # needs sage.libs.pari sage.libs.singular sage.modules - sage: f1P == f2P # needs sage.libs.pari sage.libs.singular sage.modules + sage: PQ = Q['s','t'] + sage: f1P = PR.hom(f1,PQ) + sage: f2P = PR.hom(f2,PQ) + sage: f1P == f2P True TESTS:: @@ -2343,21 +2357,21 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): A matrix ring over a multivariate quotient over a finite field:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.modules sage: R. = GF(7)[] sage: Q. = R.quotient([x^2 + x + 1, y^2 + y + 1]) sage: f1 = R.hom([a, b]) sage: f2 = R.hom([a + a^2 + a + 1, b + b^2 + b + 1]) - sage: MR = MatrixSpace(R, 2) # needs sage.modules - sage: MQ = MatrixSpace(Q, 2) # needs sage.modules - sage: f1M = MR.hom(f1, MQ) # needs sage.modules - sage: f2M = MR.hom(f2, MQ) # needs sage.modules - sage: f1M == f2M # needs sage.modules + sage: MR = MatrixSpace(R, 2) + sage: MQ = MatrixSpace(Q, 2) + sage: f1M = MR.hom(f1, MQ) + sage: f2M = MR.hom(f2, MQ) + sage: f1M == f2M True TESTS:: - sage: f1M == loads(dumps(f1M)) # needs sage.modules sage.rings.finite_rings + sage: f1M == loads(dumps(f1M)) # needs sage.modules True """ if not isinstance(other, RingHomomorphism_from_base): @@ -2380,7 +2394,7 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): sage: f = R1.hom([x + y, x - y]) sage: R2 = MatrixSpace(FractionField(R1)['t'], 2) # needs sage.modules sage: g = R2.hom(f, R2) # needs sage.modules - sage: g #indirect doctest # needs sage.modules + sage: g # indirect doctest # needs sage.modules Ring endomorphism of Full MatrixSpace of 2 by 2 dense matrices over Univariate Polynomial Ring in t over Fraction Field of Multivariate Polynomial Ring in x, y over Integer Ring Defn: Induced from base ring by diff --git a/src/sage/rings/multi_power_series_ring.py b/src/sage/rings/multi_power_series_ring.py index 3e65e05f6af..fe7ca905fc7 100644 --- a/src/sage/rings/multi_power_series_ring.py +++ b/src/sage/rings/multi_power_series_ring.py @@ -160,19 +160,19 @@ Coercion from symbolic ring:: - sage: x,y = var('x,y') # needs sage.symbolic + sage: # needs sage.symbolic + sage: x,y = var('x,y') sage: S = PowerSeriesRing(GF(11),2,'x,y'); S Multivariate Power Series Ring in x, y over Finite Field of size 11 - sage: type(x) # needs sage.symbolic + sage: type(x) - sage: type(S(x)) # needs sage.rings.finite_rings sage.symbolic + sage: type(S(x)) - - sage: f = S(2/7 -100*x^2 + 1/3*x*y + y^2).O(3); f # needs sage.rings.finite_rings sage.symbolic + sage: f = S(2/7 -100*x^2 + 1/3*x*y + y^2).O(3); f 5 - x^2 + 4*x*y + y^2 + O(x, y)^3 - sage: f.parent() # needs sage.rings.finite_rings sage.symbolic + sage: f.parent() Multivariate Power Series Ring in x, y over Finite Field of size 11 - sage: f.parent() == S # needs sage.rings.finite_rings sage.symbolic + sage: f.parent() == S True The implementation of the multivariate power series ring uses a combination @@ -391,7 +391,6 @@ def _repr_(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: R. = PowerSeriesRing(GF(17)) sage: R #indirect doctest Multivariate Power Series Ring in x, y over Finite Field of size 17 @@ -710,14 +709,15 @@ def _is_valid_homomorphism_(self, codomain, im_gens, base_map=None): You must either give a base map or there must be a coercion from the base ring to the codomain:: + sage: # needs sage.rings.number_field sage: T. = ZZ[] - sage: K. = NumberField(t^2 + 1) # needs sage.rings.number_field - sage: Q8. = CyclotomicField(8) # needs sage.rings.number_field - sage: X. = PowerSeriesRing(Q8) # needs sage.rings.number_field - sage: M. = PowerSeriesRing(K) # needs sage.rings.number_field - sage: M._is_valid_homomorphism_(X, [x,x,x+x^2]) # no coercion # needs sage.rings.number_field + sage: K. = NumberField(t^2 + 1) + sage: Q8. = CyclotomicField(8) + sage: X. = PowerSeriesRing(Q8) + sage: M. = PowerSeriesRing(K) + sage: M._is_valid_homomorphism_(X, [x,x,x+x^2]) # no coercion False - sage: M._is_valid_homomorphism_(X, [x,x,x+x^2], base_map=K.hom([z^2])) # needs sage.rings.number_field + sage: M._is_valid_homomorphism_(X, [x,x,x+x^2], base_map=K.hom([z^2])) True """ try: diff --git a/src/sage/rings/multi_power_series_ring_element.py b/src/sage/rings/multi_power_series_ring_element.py index f1122ae27eb..8be86e21b89 100644 --- a/src/sage/rings/multi_power_series_ring_element.py +++ b/src/sage/rings/multi_power_series_ring_element.py @@ -275,7 +275,7 @@ class MPowerSeries(PowerSeries): sage: S.random_element(4) # random -2*t + t^2 - 12*s^3 + O(s, t)^4 - sage: T.random_element(10) # random # needs sage.rings.finite_rings + sage: T.random_element(10) # random # needs sage.rings.finite_rings -t1^2*t3^2*t4^2 + t1^5*t3^3*t4 + O(t0, t1, t2, t3, t4)^10 @@ -460,13 +460,14 @@ def __call__(self, *x, **kwds): Since :trac:`26105` you can specify a map on the base ring:: + sage: # needs sage.rings.number_field sage: Zx. = ZZ[] - sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field - sage: cc = K.hom([-i]) # needs sage.rings.number_field - sage: R. = PowerSeriesRing(K) # needs sage.rings.number_field - sage: f = s^2 + i*s*t + (3+4*i)*s^3 + R.O(4); f # needs sage.rings.number_field + sage: K. = NumberField(x^2 + 1) + sage: cc = K.hom([-i]) + sage: R. = PowerSeriesRing(K) + sage: f = s^2 + i*s*t + (3+4*i)*s^3 + R.O(4); f s^2 + i*s*t + (4*i + 3)*s^3 + O(s, t)^4 - sage: f(t, s, base_map=cc) # needs sage.rings.number_field + sage: f(t, s, base_map=cc) (-i)*s*t + t^2 + (-4*i + 3)*t^3 + O(s, t)^4 """ if len(x) != self.parent().ngens(): @@ -568,7 +569,6 @@ def _value(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: R. = PowerSeriesRing(GF(5)); R Multivariate Power Series Ring in a, b, c over Finite Field of size 5 @@ -605,7 +605,6 @@ def _latex_(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: M = PowerSeriesRing(GF(5),3,'t'); M Multivariate Power Series Ring in t0, t1, t2 over Finite Field of size 5 sage: t = M.gens() @@ -712,7 +711,6 @@ def _richcmp_(self, other, op): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: R. = PowerSeriesRing(GF(5)); R Multivariate Power Series Ring in a, b, c over Finite Field of size 5 sage: f = a + b + c + a^2*c @@ -724,7 +722,6 @@ def _richcmp_(self, other, op): Ordering is determined by underlying polynomial ring:: - sage: # needs sage.rings.finite_rings sage: a > b True sage: a > a^2 @@ -896,27 +893,25 @@ def quo_rem(self, other, precision=None): EXAMPLES:: + sage: # needs sage.libs.singular sage: R. = PowerSeriesRing(ZZ) sage: f = 1 + a + b - a*b + R.O(3) sage: g = 1 + 2*a - 3*a*b + R.O(3) - sage: q, r = f.quo_rem(g); q, r # needs sage.libs.singular + sage: q, r = f.quo_rem(g); q, r (1 - a + b + 2*a^2 + O(a, b, c)^3, 0 + O(a, b, c)^3) - sage: f == q*g + r # needs sage.libs.singular + sage: f == q*g + r True - - sage: q, r = (a*f).quo_rem(g); q, r # needs sage.libs.singular + sage: q, r = (a*f).quo_rem(g); q, r (a - a^2 + a*b + 2*a^3 + O(a, b, c)^4, 0 + O(a, b, c)^4) - sage: a*f == q*g + r # needs sage.libs.singular + sage: a*f == q*g + r True - - sage: q, r = (a*f).quo_rem(a*g); q, r # needs sage.libs.singular + sage: q, r = (a*f).quo_rem(a*g); q, r (1 - a + b + 2*a^2 + O(a, b, c)^3, 0 + O(a, b, c)^4) - sage: a*f == q*(a*g) + r # needs sage.libs.singular + sage: a*f == q*(a*g) + r True - - sage: q, r = (a*f).quo_rem(b*g); q, r # needs sage.libs.singular + sage: q, r = (a*f).quo_rem(b*g); q, r (a - 3*a^2 + O(a, b, c)^3, a + a^2 + O(a, b, c)^4) - sage: a*f == q*(b*g) + r # needs sage.libs.singular + sage: a*f == q*(b*g) + r True Trying to divide two polynomials, we run into the issue that @@ -925,57 +920,54 @@ def quo_rem(self, other, precision=None): algorithm would never terminate). Here, default precision comes to our help:: - sage: (1 + a^3).quo_rem(a + a^2) # needs sage.libs.singular + sage: # needs sage.libs.singular + sage: (1 + a^3).quo_rem(a + a^2) (a^2 - a^3 + a^4 - a^5 + a^6 - a^7 + a^8 - a^9 + a^10 + O(a, b, c)^11, 1 + O(a, b, c)^12) - - sage: (1 + a^3 + a*b).quo_rem(b + c) # needs sage.libs.singular + sage: (1 + a^3 + a*b).quo_rem(b + c) (a + O(a, b, c)^11, 1 - a*c + a^3 + O(a, b, c)^12) - sage: (1 + a^3 + a*b).quo_rem(b + c, precision=17) # needs sage.libs.singular + sage: (1 + a^3 + a*b).quo_rem(b + c, precision=17) (a + O(a, b, c)^16, 1 - a*c + a^3 + O(a, b, c)^17) - - sage: (a^2 + b^2 + c^2).quo_rem(a + b + c) # needs sage.libs.singular + sage: (a^2 + b^2 + c^2).quo_rem(a + b + c) (a - b - c + O(a, b, c)^11, 2*b^2 + 2*b*c + 2*c^2 + O(a, b, c)^12) - - sage: (a^2 + b^2 + c^2).quo_rem(1/(1+a+b+c)) # needs sage.libs.singular + sage: (a^2 + b^2 + c^2).quo_rem(1/(1+a+b+c)) (a^2 + b^2 + c^2 + a^3 + a^2*b + a^2*c + a*b^2 + a*c^2 + b^3 + b^2*c + b*c^2 + c^3 + O(a, b, c)^14, 0) - - sage: (a^2 + b^2 + c^2).quo_rem(a/(1+a+b+c)) # needs sage.libs.singular + sage: (a^2 + b^2 + c^2).quo_rem(a/(1+a+b+c)) (a + a^2 + a*b + a*c + O(a, b, c)^13, b^2 + c^2) - - sage: (1 + a + a^15).quo_rem(a^2) # needs sage.libs.singular + sage: (1 + a + a^15).quo_rem(a^2) (0 + O(a, b, c)^10, 1 + a + O(a, b, c)^12) - sage: (1 + a + a^15).quo_rem(a^2, precision=15) # needs sage.libs.singular + sage: (1 + a + a^15).quo_rem(a^2, precision=15) (0 + O(a, b, c)^13, 1 + a + O(a, b, c)^15) - sage: (1 + a + a^15).quo_rem(a^2, precision=16) # needs sage.libs.singular + sage: (1 + a + a^15).quo_rem(a^2, precision=16) (a^13 + O(a, b, c)^14, 1 + a + O(a, b, c)^16) Illustrating the dependency on the ordering of variables:: - sage: (1 + a + b).quo_rem(b + c) # needs sage.libs.singular + sage: # needs sage.libs.singular + sage: (1 + a + b).quo_rem(b + c) (1 + O(a, b, c)^11, 1 + a - c + O(a, b, c)^12) - sage: (1 + b + c).quo_rem(c + a) # needs sage.libs.singular + sage: (1 + b + c).quo_rem(c + a) (0 + O(a, b, c)^11, 1 + b + c + O(a, b, c)^12) - sage: (1 + c + a).quo_rem(a + b) # needs sage.libs.singular + sage: (1 + c + a).quo_rem(a + b) (1 + O(a, b, c)^11, 1 - b + c + O(a, b, c)^12) TESTS:: - sage: (f).quo_rem(R.zero()) + sage: (f).quo_rem(R.zero()) # needs sage.libs.singular Traceback (most recent call last): ... ZeroDivisionError - sage: (f).quo_rem(R.zero().add_bigoh(2)) + sage: (f).quo_rem(R.zero().add_bigoh(2)) # needs sage.libs.singular Traceback (most recent call last): ... ZeroDivisionError Coercion is applied on ``other``:: - sage: (a + b).quo_rem(1) + sage: (a + b).quo_rem(1) # needs sage.libs.singular (a + b + O(a, b, c)^12, 0 + O(a, b, c)^12) sage: R. = PowerSeriesRing(QQ) @@ -1164,7 +1156,6 @@ def variables(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: T = PowerSeriesRing(GF(3),5,'t'); T Multivariate Power Series Ring in t0, t1, t2, t3, t4 over Finite Field of size 3 @@ -1905,13 +1896,13 @@ def exp(self, prec=infinity): sage: T. = PowerSeriesRing(ZZ, 2) sage: f = a + b + a*b + T.O(3) - sage: exp(f) # needs sage.symbolic + sage: exp(f) 1 + a + b + 1/2*a^2 + 2*a*b + 1/2*b^2 + O(a, b)^3 - sage: f.exp() # needs sage.symbolic + sage: f.exp() 1 + a + b + 1/2*a^2 + 2*a*b + 1/2*b^2 + O(a, b)^3 - sage: f.exp(prec=2) # needs sage.symbolic + sage: f.exp(prec=2) 1 + a + b + O(a, b)^2 - sage: log(exp(f)) - f # needs sage.symbolic + sage: log(exp(f)) - f 0 + O(a, b)^3 If the power series has a constant coefficient `c` and @@ -1920,7 +1911,7 @@ def exp(self, prec=infinity): are not yet implemented and therefore such cases raise an error:: sage: g = 2 + f - sage: exp(g) # needs sage.symbolic + sage: exp(g) Traceback (most recent call last): ... TypeError: unsupported operand parent(s) for *: 'Symbolic Ring' and @@ -1938,17 +1929,17 @@ def exp(self, prec=infinity): sage: T.default_prec() 12 - sage: exp(a) # needs sage.symbolic + sage: exp(a) 1 + a + 1/2*a^2 + 1/6*a^3 + 1/24*a^4 + 1/120*a^5 + 1/720*a^6 + 1/5040*a^7 + 1/40320*a^8 + 1/362880*a^9 + 1/3628800*a^10 + 1/39916800*a^11 + O(a, b)^12 - sage: a.exp(prec=5) # needs sage.symbolic + sage: a.exp(prec=5) 1 + a + 1/2*a^2 + 1/6*a^3 + 1/24*a^4 + O(a, b)^5 - sage: exp(a + T.O(5)) # needs sage.symbolic + sage: exp(a + T.O(5)) 1 + a + 1/2*a^2 + 1/6*a^3 + 1/24*a^4 + O(a, b)^5 TESTS:: - sage: exp(a^2 + T.O(5)) # needs sage.symbolic + sage: exp(a^2 + T.O(5)) 1 + a^2 + 1/2*a^4 + O(a, b)^5 """ R = self.parent() @@ -1997,11 +1988,11 @@ def log(self, prec=infinity): sage: T. = PowerSeriesRing(ZZ, 2) sage: f = 1 + a + b + a*b + T.O(5) - sage: f.log() # needs sage.symbolic + sage: f.log() a + b - 1/2*a^2 - 1/2*b^2 + 1/3*a^3 + 1/3*b^3 - 1/4*a^4 - 1/4*b^4 + O(a, b)^5 - sage: log(f) # needs sage.symbolic + sage: log(f) a + b - 1/2*a^2 - 1/2*b^2 + 1/3*a^3 + 1/3*b^3 - 1/4*a^4 - 1/4*b^4 + O(a, b)^5 - sage: exp(log(f)) - f # needs sage.symbolic + sage: exp(log(f)) - f 0 + O(a, b)^5 If the power series has a constant coefficient `c` and @@ -2010,7 +2001,7 @@ def log(self, prec=infinity): are not yet implemented and therefore such cases raise an error:: sage: g = 2 + f - sage: log(g) # needs sage.symbolic + sage: log(g) Traceback (most recent call last): ... TypeError: unsupported operand parent(s) for -: 'Symbolic Ring' and 'Power @@ -2028,15 +2019,15 @@ def log(self, prec=infinity): TESTS:: - sage: (1+a).log(prec=10).exp() # needs sage.symbolic + sage: (1+a).log(prec=10).exp() 1 + a + O(a, b)^10 - sage: a.exp(prec=10).log() # needs sage.symbolic + sage: a.exp(prec=10).log() a + O(a, b)^10 - sage: log(1+a) # needs sage.symbolic + sage: log(1+a) a - 1/2*a^2 + 1/3*a^3 - 1/4*a^4 + 1/5*a^5 - 1/6*a^6 + 1/7*a^7 - 1/8*a^8 + 1/9*a^9 - 1/10*a^10 + 1/11*a^11 + O(a, b)^12 - sage: -log(1-a+T.O(5)) # needs sage.symbolic + sage: -log(1-a+T.O(5)) a + 1/2*a^2 + 1/3*a^3 + 1/4*a^4 + O(a, b)^5 sage: a.log(prec=10) Traceback (most recent call last): diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx index 27e33ad5be0..a5c56f7f39d 100644 --- a/src/sage/rings/number_field/number_field_element.pyx +++ b/src/sage/rings/number_field/number_field_element.pyx @@ -2942,16 +2942,16 @@ cdef class NumberFieldElement(NumberFieldElement_base): EXAMPLES:: sage: K. = QuadraticField(2) - sage: SR(a) # indirect doctest # needs sage.symbolic + sage: SR(a) # indirect doctest # needs sage.symbolic sqrt(2) - sage: SR(3*a-5) # indirect doctest # needs sage.symbolic + sage: SR(3*a-5) # indirect doctest # needs sage.symbolic 3*sqrt(2) - 5 sage: K. = QuadraticField(2, embedding=-1.4) - sage: SR(a) # indirect doctest # needs sage.symbolic + sage: SR(a) # indirect doctest # needs sage.symbolic -sqrt(2) sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 - 2) - sage: SR(a) # indirect doctest # needs sage.symbolic + sage: SR(a) # indirect doctest # needs sage.symbolic Traceback (most recent call last): ... TypeError: an embedding into RR or CC must be specified @@ -2959,7 +2959,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): Now a more complicated example:: sage: K. = NumberField(x^3 + x - 1, embedding=0.68) - sage: b = SR(a); b # indirect doctest # needs sage.symbolic + sage: b = SR(a); b # indirect doctest # needs sage.symbolic (1/18*sqrt(31)*sqrt(3) + 1/2)^(1/3) - 1/3/(1/18*sqrt(31)*sqrt(3) + 1/2)^(1/3) sage: (b^3 + b - 1).canonicalize_radical() # needs sage.symbolic 0 @@ -2974,7 +2974,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): Special case for cyclotomic fields:: sage: K. = CyclotomicField(19) - sage: SR(zeta) # indirect doctest # needs sage.symbolic + sage: SR(zeta) # indirect doctest # needs sage.symbolic e^(2/19*I*pi) sage: CC(zeta) 0.945817241700635 + 0.324699469204683*I diff --git a/src/sage/rings/polynomial/multi_polynomial_element.py b/src/sage/rings/polynomial/multi_polynomial_element.py index 27b6f577f16..f4f631e2b46 100644 --- a/src/sage/rings/polynomial/multi_polynomial_element.py +++ b/src/sage/rings/polynomial/multi_polynomial_element.py @@ -220,7 +220,7 @@ def _im_gens_(self, codomain, im_gens, base_map=None): sage: R. = PolynomialRing(QQbar, 2) # needs sage.rings.number_field sage: f = R.hom([y, x], R) # needs sage.rings.number_field - sage: f(x^2 + 3*y^5) # indirect doctest # needs sage.rings.number_field + sage: f(x^2 + 3*y^5) # indirect doctest # needs sage.rings.number_field 3*x^5 + y^2 You can specify a map on the base ring:: diff --git a/src/sage/rings/polynomial/multi_polynomial_sequence.py b/src/sage/rings/polynomial/multi_polynomial_sequence.py index 22c92ba44d6..7a4519bf823 100644 --- a/src/sage/rings/polynomial/multi_polynomial_sequence.py +++ b/src/sage/rings/polynomial/multi_polynomial_sequence.py @@ -229,7 +229,7 @@ def PolynomialSequence(arg1, arg2=None, immutable=False, cr=False, cr_str=None): If a list of tuples is provided, those form the parts:: - sage: F = Sequence([I.gens(),I.gens()], I.ring()); F # indirect doctest # needs sage.libs.singular + sage: F = Sequence([I.gens(),I.gens()], I.ring()); F # indirect doctest # needs sage.libs.singular [a + 2*b + 2*c + 2*d - 1, a^2 + 2*b^2 + 2*c^2 + 2*d^2 - a, 2*a*b + 2*b*c + 2*c*d - b, @@ -396,7 +396,7 @@ def __init__(self, parts, ring, immutable=False, cr=False, cr_str=None): sage: P. = PolynomialRing(GF(127), 4) sage: I = sage.rings.ideal.Katsura(P) # needs sage.rings.finite_rings - sage: Sequence([I.gens()], I.ring()) # indirect doctest # needs sage.rings.finite_rings + sage: Sequence([I.gens()], I.ring()) # indirect doctest # needs sage.rings.finite_rings [a + 2*b + 2*c + 2*d - 1, a^2 + 2*b^2 + 2*c^2 + 2*d^2 - a, 2*a*b + 2*b*c + 2*c*d - b, b^2 + 2*a*c + 2*b*d - c] @@ -1276,13 +1276,14 @@ def eliminate_linear_variables(self, maxlength=Infinity, skip=None, return_reduc If the input system is detected to be inconsistent then ``[1]`` is returned, and the list of reductors is empty:: - sage: R. = BooleanPolynomialRing() # needs sage.rings.polynomial.pbori - sage: S = Sequence([x*y*z + x*y + z*y + x*z, x + y + z + 1, x + y + z]) # needs sage.rings.polynomial.pbori - sage: S.eliminate_linear_variables() # needs sage.rings.polynomial.pbori + sage: # needs sage.rings.polynomial.pbori + sage: R. = BooleanPolynomialRing() + sage: S = Sequence([x*y*z + x*y + z*y + x*z, x + y + z + 1, x + y + z]) + sage: S.eliminate_linear_variables() [1] - sage: R. = BooleanPolynomialRing() # needs sage.rings.polynomial.pbori - sage: S = Sequence([x*y*z + x*y + z*y + x*z, x + y + z + 1, x + y + z]) # needs sage.rings.polynomial.pbori - sage: S.eliminate_linear_variables(return_reductors=True) # needs sage.rings.polynomial.pbori + sage: R. = BooleanPolynomialRing() + sage: S = Sequence([x*y*z + x*y + z*y + x*z, x + y + z + 1, x + y + z]) + sage: S.eliminate_linear_variables(return_reductors=True) ([1], []) @@ -1306,13 +1307,14 @@ def eliminate_linear_variables(self, maxlength=Infinity, skip=None, return_reduc We test a case which would increase the degree with ``polybori=True``:: - sage: B. = BooleanPolynomialRing() # needs sage.rings.polynomial.pbori - sage: f = a*d + a + b*d + c*d + 1 # needs sage.rings.polynomial.pbori - sage: Sequence([f, a + b*c + c+d + 1]).eliminate_linear_variables() # needs sage.rings.polynomial.pbori + sage: # needs sage.rings.polynomial.pbori + sage: B. = BooleanPolynomialRing() + sage: f = a*d + a + b*d + c*d + 1 + sage: Sequence([f, a + b*c + c+d + 1]).eliminate_linear_variables() [a*d + a + b*d + c*d + 1, a + b*c + c + d + 1] - sage: B. = BooleanPolynomialRing() # needs sage.rings.polynomial.pbori - sage: f = a*d + a + b*d + c*d + 1 # needs sage.rings.polynomial.pbori - sage: Sequence([f, a + b*c + c+d + 1]).eliminate_linear_variables(use_polybori=True) # needs sage.rings.polynomial.pbori + sage: B. = BooleanPolynomialRing() + sage: f = a*d + a + b*d + c*d + 1 + sage: Sequence([f, a + b*c + c+d + 1]).eliminate_linear_variables(use_polybori=True) [b*c*d + b*c + b*d + c + d] .. NOTE:: diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index 4d4b9dd10f5..7f9f8dff42e 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -9833,13 +9833,13 @@ cdef class Polynomial(CommutativePolynomial): sage: # needs sage.libs.pari sage: R. = ZZ[] - sage: (2*x).is_squarefree() # needs sage.libs.pari + sage: (2*x).is_squarefree() True - sage: (4*x).is_squarefree() # needs sage.libs.pari + sage: (4*x).is_squarefree() False - sage: (2*x^2).is_squarefree() # needs sage.libs.pari + sage: (2*x^2).is_squarefree() False - sage: R(0).is_squarefree() # needs sage.libs.pari + sage: R(0).is_squarefree() False sage: S. = QQ[] diff --git a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx index 57468e3510f..add6792f99c 100644 --- a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx +++ b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx @@ -553,7 +553,7 @@ def small_roots(self, X=None, beta=1.0, epsilon=None, **kwds): sage: from sage.misc.verbose import set_verbose sage: set_verbose(2) - sage: d = f.small_roots(X=2^hidden-1, beta=0.5)[0] # time random # needs sage.symbolic + sage: d = f.small_roots(X=2^hidden-1, beta=0.5)[0] # time random # needs sage.symbolic verbose 2 () m = 4 verbose 2 () t = 4 verbose 2 () X = 1298074214633706907132624082305023 diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py index 07d5e0cb837..9d31364e7e9 100644 --- a/src/sage/rings/polynomial/polynomial_quotient_ring.py +++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py @@ -1458,7 +1458,7 @@ def S_class_group(self, S, proof=True): `x^2 + 31` from 12 to 2, i.e. we lose a generator of order 6 (this was fixed in :trac:`14489`):: - sage: S.S_class_group([K.ideal(a)]) # representation varies # not tested, needs sage.rings.number_field + sage: S.S_class_group([K.ideal(a)]) # representation varies # not tested, needs sage.rings.number_field [((1/4*xbar^2 + 31/4, (-1/8*a + 1/8)*xbar^2 - 31/8*a + 31/8, 1/16*xbar^3 + 1/16*xbar^2 + 31/16*xbar + 31/16, -1/16*a*xbar^3 + (1/16*a + 1/8)*xbar^2 - 31/16*a*xbar + 31/16*a + 31/8), diff --git a/src/sage/rings/polynomial/polynomial_ring_constructor.py b/src/sage/rings/polynomial/polynomial_ring_constructor.py index 2d1d04a9e73..ecccc51519e 100644 --- a/src/sage/rings/polynomial/polynomial_ring_constructor.py +++ b/src/sage/rings/polynomial/polynomial_ring_constructor.py @@ -578,7 +578,7 @@ def PolynomialRing(base_ring, *args, **kwds): sage: R. = PolynomialRing(PolynomialRing(GF(7),'k')); TestSuite(R).run(); R Univariate Polynomial Ring in w over Univariate Polynomial Ring in k over Finite Field of size 7 - sage: ZxNTL = PolynomialRing(ZZ, 'x', implementation='NTL'); TestSuite(ZxNTL).run(skip='_test_pickling'); ZxNTL # needs sage.libs.ntl + sage: ZxNTL = PolynomialRing(ZZ, 'x', implementation='NTL'); TestSuite(ZxNTL).run(skip='_test_pickling'); ZxNTL # needs sage.libs.ntl Univariate Polynomial Ring in x over Integer Ring (using NTL) sage: ZxFLINT = PolynomialRing(ZZ, 'x', implementation='FLINT'); TestSuite(ZxFLINT).run(); ZxFLINT Univariate Polynomial Ring in x over Integer Ring diff --git a/src/sage/rings/polynomial/symmetric_ideal.py b/src/sage/rings/polynomial/symmetric_ideal.py index 84138cd8975..e13abffd50c 100644 --- a/src/sage/rings/polynomial/symmetric_ideal.py +++ b/src/sage/rings/polynomial/symmetric_ideal.py @@ -242,7 +242,7 @@ def _contains_(self, p): sage: I # needs sage.combinat Symmetric Ideal (x_1^2 + x_1, x_2 - x_1) of Infinite polynomial ring in x over Rational Field - sage: x[2]^2 + x[3] in I # indirect doctest # needs sage.combinat + sage: x[2]^2 + x[3] in I # indirect doctest # needs sage.combinat True """ try: diff --git a/src/sage/rings/polynomial/term_order.py b/src/sage/rings/polynomial/term_order.py index a3321cf1bb2..dc306c2ee39 100644 --- a/src/sage/rings/polynomial/term_order.py +++ b/src/sage/rings/polynomial/term_order.py @@ -932,7 +932,7 @@ def sortkey_matrix(self, f): EXAMPLES:: sage: P. = PolynomialRing(QQbar, 2, order='m(1,3,1,0)') # needs sage.rings.number_field - sage: y > x^2 # indirect doctest # needs sage.rings.number_field + sage: y > x^2 # indirect doctest # needs sage.rings.number_field True sage: y > x^3 # needs sage.rings.number_field False @@ -952,7 +952,7 @@ def sortkey_lex(self, f): EXAMPLES:: sage: P. = PolynomialRing(QQbar, 2, order='lex') # needs sage.rings.number_field - sage: x > y^2 # indirect doctest # needs sage.rings.number_field + sage: x > y^2 # indirect doctest # needs sage.rings.number_field True sage: x > 1 # needs sage.rings.number_field True @@ -971,7 +971,7 @@ def sortkey_invlex(self, f): EXAMPLES:: sage: P. = PolynomialRing(QQbar, 2, order='invlex') # needs sage.rings.number_field - sage: x > y^2 # indirect doctest # needs sage.rings.number_field + sage: x > y^2 # indirect doctest # needs sage.rings.number_field False sage: x > 1 # needs sage.rings.number_field True @@ -990,7 +990,7 @@ def sortkey_deglex(self, f): EXAMPLES:: sage: P. = PolynomialRing(QQbar, 2, order='deglex') # needs sage.rings.number_field - sage: x > y^2 # indirect doctest # needs sage.rings.number_field + sage: x > y^2 # indirect doctest # needs sage.rings.number_field False sage: x > 1 # needs sage.rings.number_field True @@ -1010,7 +1010,7 @@ def sortkey_degrevlex(self, f): EXAMPLES:: sage: P. = PolynomialRing(QQbar, 2, order='degrevlex') # needs sage.rings.number_field - sage: x > y^2 # indirect doctest # needs sage.rings.number_field + sage: x > y^2 # indirect doctest # needs sage.rings.number_field False sage: x > 1 # needs sage.rings.number_field True @@ -1032,7 +1032,7 @@ def sortkey_neglex(self, f): EXAMPLES:: sage: P. = PolynomialRing(QQbar, 2, order='neglex') # needs sage.rings.number_field - sage: x > y^2 # indirect doctest # needs sage.rings.number_field + sage: x > y^2 # indirect doctest # needs sage.rings.number_field False sage: x > 1 # needs sage.rings.number_field False @@ -1051,7 +1051,7 @@ def sortkey_negdegrevlex(self, f): EXAMPLES:: sage: P. = PolynomialRing(QQbar, 2, order='negdegrevlex') # needs sage.rings.number_field - sage: x > y^2 # indirect doctest # needs sage.rings.number_field + sage: x > y^2 # indirect doctest # needs sage.rings.number_field True sage: x > 1 # needs sage.rings.number_field False @@ -1071,7 +1071,7 @@ def sortkey_negdeglex(self, f): EXAMPLES:: sage: P. = PolynomialRing(QQbar, 2, order='negdeglex') # needs sage.rings.number_field - sage: x > y^2 # indirect doctest # needs sage.rings.number_field + sage: x > y^2 # indirect doctest # needs sage.rings.number_field True sage: x > 1 # needs sage.rings.number_field False @@ -1090,7 +1090,7 @@ def sortkey_degneglex(self, f): EXAMPLES:: sage: P. = PolynomialRing(QQbar, 3, order='degneglex') # needs sage.rings.number_field - sage: x*y > y*z # indirect doctest # needs sage.rings.number_field + sage: x*y > y*z # indirect doctest # needs sage.rings.number_field False sage: x*y > x # needs sage.rings.number_field True @@ -1110,7 +1110,7 @@ def sortkey_wdegrevlex(self, f): sage: t = TermOrder('wdegrevlex',(3,2)) sage: P. = PolynomialRing(QQbar, 2, order=t) # needs sage.rings.number_field - sage: x > y^2 # indirect doctest # needs sage.rings.number_field + sage: x > y^2 # indirect doctest # needs sage.rings.number_field False sage: x^2 > y^3 # needs sage.rings.number_field True @@ -1131,7 +1131,7 @@ def sortkey_wdeglex(self, f): sage: t = TermOrder('wdeglex',(3,2)) sage: P. = PolynomialRing(QQbar, 2, order=t) # needs sage.rings.number_field - sage: x > y^2 # indirect doctest # needs sage.rings.number_field + sage: x > y^2 # indirect doctest # needs sage.rings.number_field False sage: x > y # needs sage.rings.number_field True @@ -1151,7 +1151,7 @@ def sortkey_negwdeglex(self, f): sage: t = TermOrder('negwdeglex',(3,2)) sage: P. = PolynomialRing(QQbar, 2, order=t) # needs sage.rings.number_field - sage: x > y^2 # indirect doctest # needs sage.rings.number_field + sage: x > y^2 # indirect doctest # needs sage.rings.number_field True sage: x^2 > y^3 # needs sage.rings.number_field True @@ -1171,7 +1171,7 @@ def sortkey_negwdegrevlex(self, f): sage: t = TermOrder('negwdegrevlex',(3,2)) sage: P. = PolynomialRing(QQbar, 2, order=t) # needs sage.rings.number_field - sage: x > y^2 # indirect doctest # needs sage.rings.number_field + sage: x > y^2 # indirect doctest # needs sage.rings.number_field True sage: x^2 > y^3 # needs sage.rings.number_field True @@ -1192,7 +1192,7 @@ def sortkey_block(self, f): sage: P. = PolynomialRing(QQbar, 6, # needs sage.rings.number_field ....: order='degrevlex(3),degrevlex(3)') - sage: a > c^4 # indirect doctest # needs sage.rings.number_field + sage: a > c^4 # indirect doctest # needs sage.rings.number_field False sage: a > e^4 # needs sage.rings.number_field True @@ -1227,7 +1227,7 @@ def greater_tuple_matrix(self,f,g): EXAMPLES:: sage: P. = PolynomialRing(QQbar, 2, order='m(1,3,1,0)') # needs sage.rings.number_field - sage: y > x^2 # indirect doctest # needs sage.rings.number_field + sage: y > x^2 # indirect doctest # needs sage.rings.number_field True sage: y > x^3 # needs sage.rings.number_field False @@ -1256,7 +1256,7 @@ def greater_tuple_lex(self,f,g): EXAMPLES:: sage: P. = PolynomialRing(QQbar, 3, order='lex') # needs sage.rings.number_field - sage: f = x + y^2; f.lm() # indirect doctest # needs sage.rings.number_field + sage: f = x + y^2; f.lm() # indirect doctest # needs sage.rings.number_field x This method is called by the lm/lc/lt methods of @@ -1278,7 +1278,7 @@ def greater_tuple_invlex(self,f,g): EXAMPLES:: sage: P. = PolynomialRing(QQbar, 3, order='invlex') # needs sage.rings.number_field - sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field + sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field y sage: f = y + x^2; f.lm() # needs sage.rings.number_field y @@ -1302,7 +1302,7 @@ def greater_tuple_deglex(self,f,g): EXAMPLES:: sage: P. = PolynomialRing(QQbar, 3, order='deglex') # needs sage.rings.number_field - sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field + sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field x sage: f = x + y^2*z; f.lm() # needs sage.rings.number_field y^2*z @@ -1328,7 +1328,7 @@ def greater_tuple_degrevlex(self,f,g): EXAMPLES:: sage: P. = PolynomialRing(QQbar, 3, order='degrevlex') # needs sage.rings.number_field - sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field + sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field x sage: f = x + y^2*z; f.lm() # needs sage.rings.number_field y^2*z @@ -1412,7 +1412,7 @@ def greater_tuple_degneglex(self,f,g): EXAMPLES:: sage: P. = PolynomialRing(QQbar, 3, order='degneglex') # needs sage.rings.number_field - sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field + sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field y sage: f = x + y^2*z; f.lm() # needs sage.rings.number_field y^2*z @@ -1442,7 +1442,7 @@ def greater_tuple_neglex(self,f,g): sage: P. = PolynomialRing(QQbar, 6, # needs sage.rings.number_field ....: order='degrevlex(3),degrevlex(3)') - sage: f = a + c^4; f.lm() # indirect doctest # needs sage.rings.number_field + sage: f = a + c^4; f.lm() # indirect doctest # needs sage.rings.number_field c^4 sage: g = a + e^4; g.lm() # needs sage.rings.number_field a @@ -1464,7 +1464,7 @@ def greater_tuple_wdeglex(self,f,g): sage: t = TermOrder('wdeglex',(1,2,3)) sage: P. = PolynomialRing(QQbar, 3, order=t) # needs sage.rings.number_field - sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field + sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field y sage: f = x*y + z; f.lm() # needs sage.rings.number_field x*y @@ -1491,7 +1491,7 @@ def greater_tuple_wdegrevlex(self,f,g): sage: t = TermOrder('wdegrevlex',(1,2,3)) sage: P. = PolynomialRing(QQbar, 3, order=t) # needs sage.rings.number_field - sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field + sage: f = x + y; f.lm() # indirect doctest # needs sage.rings.number_field y sage: f = x + y^2*z; f.lm() # needs sage.rings.number_field y^2*z @@ -1581,7 +1581,7 @@ def greater_tuple_block(self, f,g): sage: P. = PolynomialRing(QQbar, 6, # needs sage.rings.number_field ....: order='degrevlex(3),degrevlex(3)') - sage: f = a + c^4; f.lm() # indirect doctest # needs sage.rings.number_field + sage: f = a + c^4; f.lm() # indirect doctest # needs sage.rings.number_field c^4 sage: g = a + e^4; g.lm() # needs sage.rings.number_field a diff --git a/src/sage/rings/power_series_poly.pyx b/src/sage/rings/power_series_poly.pyx index e3c4305c823..c2c1436d388 100644 --- a/src/sage/rings/power_series_poly.pyx +++ b/src/sage/rings/power_series_poly.pyx @@ -158,7 +158,6 @@ cdef class PowerSeries_poly(PowerSeries): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: R. = GF(11)[[]] sage: bool(1 + t + O(t^18)) True @@ -268,7 +267,6 @@ cdef class PowerSeries_poly(PowerSeries): Arguments beyond the first can refer to the base ring:: - sage: # needs sage.rings.finite_rings sage: P. = GF(5)[] sage: Q. = P[[]] sage: h = (1 - x*y)^-1 + O(y^7); h @@ -278,9 +276,9 @@ cdef class PowerSeries_poly(PowerSeries): These secondary values can also be specified using keywords:: - sage: h(y=y^2, x=3) # needs sage.rings.finite_rings + sage: h(y=y^2, x=3) 1 + 3*y^2 + 4*y^4 + 2*y^6 + y^8 + 3*y^10 + 4*y^12 + O(y^14) - sage: h(y^2, x=3) # needs sage.rings.finite_rings + sage: h(y^2, x=3) 1 + 3*y^2 + 4*y^4 + 2*y^6 + y^8 + 3*y^10 + 4*y^12 + O(y^14) """ P = self.parent() @@ -376,29 +374,27 @@ cdef class PowerSeries_poly(PowerSeries): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: R. = GF(7)[[]] sage: f = 3 + 6*t^3 + O(t^5) sage: f._unsafe_mutate(0, 5) sage: f 5 + 6*t^3 + O(t^5) - sage: f._unsafe_mutate(2, 1) ; f + sage: f._unsafe_mutate(2, 1); f 5 + t^2 + 6*t^3 + O(t^5) - Mutating can even bump up the precision:: - sage: # needs sage.rings.finite_rings - sage: f._unsafe_mutate(6, 1) ; f + sage: f._unsafe_mutate(6, 1); f 5 + t^2 + 6*t^3 + t^6 + O(t^7) - sage: f._unsafe_mutate(0, 0) ; f + sage: f._unsafe_mutate(0, 0); f t^2 + 6*t^3 + t^6 + O(t^7) - sage: f._unsafe_mutate(1, 0) ; f + sage: f._unsafe_mutate(1, 0); f t^2 + 6*t^3 + t^6 + O(t^7) - sage: f._unsafe_mutate(11,0) ; f + sage: f._unsafe_mutate(11,0); f t^2 + 6*t^3 + t^6 + O(t^12) - sage: g = t + O(t^7) # needs sage.rings.finite_rings - sage: g._unsafe_mutate(1,0) ; g # needs sage.rings.finite_rings + sage: g = t + O(t^7) + sage: g._unsafe_mutate(1,0); g O(t^7) """ self.__f._unsafe_mutate(i, value) @@ -438,7 +434,7 @@ cdef class PowerSeries_poly(PowerSeries): 32 - 80*t + 80*t^2 - 40*t^3 + 10*t^4 - t^5 sage: f[:4] 32 - 80*t + 80*t^2 - 40*t^3 - sage: f = 1 + t^3 - 4*t^4 + O(t^7) ; f + sage: f = 1 + t^3 - 4*t^4 + O(t^7); f 1 + t^3 - 4*t^4 + O(t^7) sage: f[:4] 1 + t^3 + O(t^7) @@ -895,7 +891,7 @@ cdef class PowerSeries_poly(PowerSeries): sage: t = PowerSeriesRing(QQ,'t').gen() sage: f = t + 5*t^2 + 21*t^3 - sage: g = f.integral() ; g + sage: g = f.integral(); g 1/2*t^2 + 5/3*t^3 + 21/4*t^4 sage: g.parent() Power Series Ring in t over Rational Field @@ -1195,20 +1191,21 @@ cdef class PowerSeries_poly(PowerSeries): EXAMPLES:: + sage: # needs sage.symbolic sage: R. = PowerSeriesRing(QQ) sage: s = R([1,2,3,4,5], prec=10); s 1 + 2*x + 3*x^2 + 4*x^3 + 5*x^4 + O(x^10) - sage: SR(s) # needs sage.symbolic + sage: SR(s) 1 + 2*x + 3*x^2 + 4*x^3 + 5*x^4 + Order(x^10) - sage: SR(s).is_terminating_series() # needs sage.symbolic + sage: SR(s).is_terminating_series() False - sage: SR(s).variables() # needs sage.symbolic + sage: SR(s).variables() (x,) sage: s = R([1,2,3,4,5]); s 1 + 2*x + 3*x^2 + 4*x^3 + 5*x^4 - sage: SR(s) # needs sage.symbolic + sage: SR(s) 1 + 2*x + 3*x^2 + 4*x^3 + 5*x^4 - sage: _.is_terminating_series() # needs sage.symbolic + sage: _.is_terminating_series() True TESTS: diff --git a/src/sage/rings/power_series_ring.py b/src/sage/rings/power_series_ring.py index 034adde8f32..8bf2d900f45 100644 --- a/src/sage/rings/power_series_ring.py +++ b/src/sage/rings/power_series_ring.py @@ -520,7 +520,6 @@ def __init__(self, base_ring, name=None, default_prec=None, sparse=False, commutative ring, but also a complete discrete valuation ring (CDVR). The appropriate (sub)category is automatically set in this case:: - sage: # needs sage.rings.finite_rings sage: k = GF(11) sage: R. = k[[]] sage: R.category() @@ -617,7 +616,6 @@ def _repr_(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: R = GF(17)[['y']] sage: R Power Series Ring in y over Finite Field of size 17 @@ -664,7 +662,6 @@ def _latex_(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: R = GF(17)[['y']] sage: latex(R) # indirect doctest \Bold{F}_{17}[[y]] @@ -683,7 +680,6 @@ def _coerce_map_from_(self, S): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: A = GF(17)[['x']] sage: A.has_coerce_map_from(ZZ) # indirect doctest True diff --git a/src/sage/rings/power_series_ring_element.pyx b/src/sage/rings/power_series_ring_element.pyx index 3579ac38953..52c4cf782d8 100644 --- a/src/sage/rings/power_series_ring_element.pyx +++ b/src/sage/rings/power_series_ring_element.pyx @@ -483,7 +483,6 @@ cdef class PowerSeries(AlgebraElement): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: A. = PowerSeriesRing(GF(5)) sage: x = t + t^2 + O(t^5) sage: x.lift_to_precision(10) @@ -846,23 +845,23 @@ cdef class PowerSeries(AlgebraElement): EXAMPLES:: - sage: # needs sage.rings.complex_double + sage: # needs sage.rings.complex_double sage.symbolic sage: R. = CDF[[]] - sage: f = CDF(pi)^2 + m^3 + CDF(e)*m^4 + O(m^10); f # abs tol 5e-16 # needs sage.symbolic + sage: f = CDF(pi)^2 + m^3 + CDF(e)*m^4 + O(m^10); f # abs tol 5e-16 9.869604401089358 + 0.0*m + 0.0*m^2 + 1.0*m^3 + 2.718281828459045*m^4 + O(m^10) - sage: f[-5] # needs sage.symbolic + sage: f[-5] 0.0 - sage: f[0] # needs sage.symbolic + sage: f[0] 9.869604401089358 - sage: f[4] # abs tol 5e-16 # needs sage.symbolic + sage: f[4] # abs tol 5e-16 2.718281828459045 - sage: f[9] # needs sage.symbolic + sage: f[9] 0.0 - sage: f[10] # needs sage.symbolic + sage: f[10] Traceback (most recent call last): ... IndexError: coefficient not known - sage: f[1000] # needs sage.symbolic + sage: f[1000] Traceback (most recent call last): ... IndexError: coefficient not known @@ -1198,11 +1197,11 @@ cdef class PowerSeries(AlgebraElement): sage: # needs sage.libs.pari sage: R. = PowerSeriesRing(QQ, implementation='pari') - sage: f = exp(x) + O(x^7); f # needs sage.symbolic + sage: f = exp(x) + O(x^7); f 1 + x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + 1/120*x^5 + 1/720*x^6 + O(x^7) - sage: f << 2 # needs sage.symbolic + sage: f << 2 x^2 + x^3 + 1/2*x^4 + 1/6*x^5 + 1/24*x^6 + 1/120*x^7 + 1/720*x^8 + O(x^9) - sage: (f << 99) >> 99 # needs sage.symbolic + sage: (f << 99) >> 99 1 + x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + 1/120*x^5 + 1/720*x^6 + O(x^7) """ return self.shift(n) @@ -1217,14 +1216,14 @@ cdef class PowerSeries(AlgebraElement): sage: # needs sage.libs.pari sage: R. = PowerSeriesRing(QQ, implementation='pari') - sage: f = exp(x) + O(x^7) # needs sage.symbolic - sage: f >> 3 # needs sage.symbolic + sage: f = exp(x) + O(x^7) + sage: f >> 3 1/6 + 1/24*x + 1/120*x^2 + 1/720*x^3 + O(x^4) - sage: f >> 7 # needs sage.symbolic + sage: f >> 7 O(x^0) - sage: f >> 99 # needs sage.symbolic + sage: f >> 99 O(x^0) - sage: (f >> 99) << 99 # needs sage.symbolic + sage: (f >> 99) << 99 O(x^99) """ return self.shift(-n) @@ -1301,9 +1300,9 @@ cdef class PowerSeries(AlgebraElement): Tests other implementations:: - sage: R. = PowerSeriesRing(GF(11), implementation='pari') # needs sage.rings.finite_rings - sage: f = q - q^3 + O(q^10) # needs sage.rings.finite_rings - sage: f.map_coefficients(lambda c: c - 2) # needs sage.rings.finite_rings + sage: R. = PowerSeriesRing(GF(11), implementation='pari') + sage: f = q - q^3 + O(q^10) + sage: f.map_coefficients(lambda c: c - 2) 10*q + 8*q^3 + O(q^10) """ pol = self.polynomial() @@ -1768,7 +1767,6 @@ cdef class PowerSeries(AlgebraElement): Positive characteristic:: - sage: # needs sage.rings.finite_rings sage: R. = GF(3)[[]] sage: p = 1 + 2 * u^2 sage: p.nth_root(4) @@ -2792,12 +2790,12 @@ cdef class PowerSeries(AlgebraElement): sage: k. = QQ[[]] sage: f = 1 + 17*w + 15*w^3 + O(w^5) - sage: pari(f) # indirect doctest # needs sage.libs.pari + sage: pari(f) # indirect doctest # needs sage.libs.pari 1 + 17*w + 15*w^3 + O(w^5) - sage: pari(1 - 19*w + w^5) # indirect doctest # needs sage.libs.pari + sage: pari(1 - 19*w + w^5) # indirect doctest # needs sage.libs.pari w^5 - 19*w + 1 sage: R. = Zmod(6)[[]] - sage: pari(1 + x + 8*x^3 + O(x^8)) # indirect doctest # needs sage.libs.pari + sage: pari(1 + x + 8*x^3 + O(x^8)) # indirect doctest # needs sage.libs.pari Mod(1, 6) + Mod(1, 6)*x + Mod(2, 6)*x^3 + O(x^8) TESTS:: diff --git a/src/sage/rings/puiseux_series_ring_element.pyx b/src/sage/rings/puiseux_series_ring_element.pyx index 9465e20ba1b..503d11ee975 100644 --- a/src/sage/rings/puiseux_series_ring_element.pyx +++ b/src/sage/rings/puiseux_series_ring_element.pyx @@ -218,13 +218,14 @@ cdef class PuiseuxSeries(AlgebraElement): """ EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = PuiseuxSeriesRing(ZZ) sage: p = x^(1/3) + x**3 - sage: t = p._im_gens_(QQbar, [2]) # needs sage.rings.number_field - sage: t in QQbar # needs sage.rings.number_field + sage: t = p._im_gens_(QQbar, [2]) + sage: t in QQbar True - sage: f = R.hom([QQbar(2)], check=False) # needs sage.rings.number_field - sage: t == f(p) # needs sage.rings.number_field + sage: f = R.hom([QQbar(2)], check=False) + sage: t == f(p) True """ return self(codomain(im_gens[0])) @@ -871,7 +872,6 @@ cdef class PuiseuxSeries(AlgebraElement): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: P. = PolynomialRing(GF(5)) sage: R. = PuiseuxSeriesRing(P) sage: p = 3*y*x**(-2/3) + 2*y**2*x**(1/5); p @@ -945,7 +945,6 @@ cdef class PuiseuxSeries(AlgebraElement): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: R. = PuiseuxSeriesRing(GF(3)) sage: p = (x**(-1/3) + 2*x**3)**2; p x^(-2/3) + x^(8/3) + x^6 diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py index 7c3e6262448..4be1f45c1e2 100644 --- a/src/sage/rings/qqbar.py +++ b/src/sage/rings/qqbar.py @@ -109,23 +109,24 @@ We can convert from symbolic expressions:: - sage: QQbar(sqrt(-5)) # needs sage.symbolic + sage: # needs sage.symbolic + sage: QQbar(sqrt(-5)) 2.236067977499790?*I - sage: AA(sqrt(2) + sqrt(3)) # needs sage.symbolic + sage: AA(sqrt(2) + sqrt(3)) 3.146264369941973? sage: QQbar(I) I - sage: QQbar(I * golden_ratio) # needs sage.symbolic + sage: QQbar(I * golden_ratio) 1.618033988749895?*I - sage: AA(golden_ratio)^2 - AA(golden_ratio) # needs sage.symbolic + sage: AA(golden_ratio)^2 - AA(golden_ratio) 1 - sage: QQbar((-8)^(1/3)) # needs sage.symbolic + sage: QQbar((-8)^(1/3)) 1.000000000000000? + 1.732050807568878?*I - sage: AA((-8)^(1/3)) # needs sage.symbolic + sage: AA((-8)^(1/3)) -2 - sage: QQbar((-4)^(1/4)) # needs sage.symbolic + sage: QQbar((-4)^(1/4)) 1 + 1*I - sage: AA((-4)^(1/4)) # needs sage.symbolic + sage: AA((-4)^(1/4)) Traceback (most recent call last): ... ValueError: Cannot coerce algebraic number with non-zero imaginary part to algebraic real @@ -385,24 +386,22 @@ sage: loads(dumps(QQbar.zeta(5))) == QQbar.zeta(5) True - sage: t = QQbar(sqrt(2)); type(t._descr) # needs sage.symbolic + sage: # needs sage.symbolic + sage: t = QQbar(sqrt(2)); type(t._descr) - sage: loads(dumps(t)) == QQbar(sqrt(2)) # needs sage.symbolic + sage: loads(dumps(t)) == QQbar(sqrt(2)) True - - sage: t.exactify(); type(t._descr) # needs sage.symbolic + sage: t.exactify(); type(t._descr) - sage: loads(dumps(t)) == QQbar(sqrt(2)) # needs sage.symbolic + sage: loads(dumps(t)) == QQbar(sqrt(2)) True - - sage: t = ~QQbar(sqrt(2)); type(t._descr) # needs sage.symbolic + sage: t = ~QQbar(sqrt(2)); type(t._descr) - sage: loads(dumps(t)) == 1/QQbar(sqrt(2)) # needs sage.symbolic + sage: loads(dumps(t)) == 1/QQbar(sqrt(2)) True - - sage: t = QQbar(sqrt(2)) + QQbar(sqrt(3)); type(t._descr) # needs sage.symbolic + sage: t = QQbar(sqrt(2)) + QQbar(sqrt(3)); type(t._descr) - sage: loads(dumps(t)) == QQbar(sqrt(2)) + QQbar(sqrt(3)) # needs sage.symbolic + sage: loads(dumps(t)) == QQbar(sqrt(2)) + QQbar(sqrt(3)) True We can convert elements of ``QQbar`` and ``AA`` into the following @@ -1636,7 +1635,7 @@ def _element_constructor_(self, x): EXAMPLES:: - sage: sqrt(2) in QQbar # indirect doctest # needs sage.symbolic + sage: sqrt(2) in QQbar # indirect doctest # needs sage.symbolic True sage: 22/7 in QQbar True @@ -3499,17 +3498,19 @@ def is_simple(self): sage: from sage.rings.qqbar import ANRational sage: ANRational(1/2).is_simple() True - sage: rt2 = AA(sqrt(2)) # needs sage.symbolic - sage: rt3 = AA(sqrt(3)) # needs sage.symbolic - sage: rt2b = rt3 + rt2 - rt3 # needs sage.symbolic - sage: rt2.exactify() # needs sage.symbolic - sage: rt2._descr.is_simple() # needs sage.symbolic + + sage: # needs sage.symbolic + sage: rt2 = AA(sqrt(2)) + sage: rt3 = AA(sqrt(3)) + sage: rt2b = rt3 + rt2 - rt3 + sage: rt2.exactify() + sage: rt2._descr.is_simple() True - sage: rt2b.exactify() # needs sage.symbolic - sage: rt2b._descr.is_simple() # needs sage.symbolic + sage: rt2b.exactify() + sage: rt2b._descr.is_simple() False - sage: rt2b.simplify() # needs sage.symbolic - sage: rt2b._descr.is_simple() # needs sage.symbolic + sage: rt2b.simplify() + sage: rt2b._descr.is_simple() True """ return False @@ -4046,11 +4047,13 @@ def __bool__(self): sage: a = QQbar(2).sqrt() - 16616132878186749607/11749380235262596085 sage: b = QQbar(2).sqrt() - 6882627592338442563/4866752642924153522 sage: c = QQbar(3).sqrt() - 142437039878091970439/82236063316189858921 - sage: d = (59/2)**(1000/7) # needs sage.symbolic - sage: e = (a + b + c) * (a + b - c) * (a - b) * (a - b - c) / d # needs sage.symbolic - sage: bool(e) # needs sage.symbolic + + sage: # needs sage.symbolic + sage: d = (59/2)**(1000/7) + sage: e = (a + b + c) * (a + b - c) * (a - b) * (a - b - c) / d + sage: bool(e) True - sage: bool(e.abs() < 2**-500) # needs sage.symbolic + sage: bool(e.abs() < 2**-500) True An identity between roots of unity:: @@ -4746,28 +4749,29 @@ def radical_expression(self): EXAMPLES:: - sage: AA(1/sqrt(5)).radical_expression() # needs sage.symbolic + sage: # needs sage.symbolic + sage: AA(1/sqrt(5)).radical_expression() sqrt(1/5) - sage: AA(sqrt(5 + sqrt(5))).radical_expression() # needs sage.symbolic + sage: AA(sqrt(5 + sqrt(5))).radical_expression() sqrt(sqrt(5) + 5) - sage: QQbar.zeta(5).radical_expression() # needs sage.symbolic + sage: QQbar.zeta(5).radical_expression() 1/4*sqrt(5) + 1/2*sqrt(-1/2*sqrt(5) - 5/2) - 1/4 sage: x = polygen(QQ, 'x') sage: a = (x^7 - x - 1).roots(AA, False)[0] - sage: a.radical_expression() # needs sage.symbolic + sage: a.radical_expression() 1.112775684278706? - sage: a.radical_expression().parent() == SR # needs sage.symbolic + sage: a.radical_expression().parent() == SR False sage: a = sorted((x^7-x-1).roots(QQbar, False), key=imag)[0] - sage: a.radical_expression() # needs sage.symbolic + sage: a.radical_expression() -0.3636235193291805? - 0.9525611952610331?*I - sage: QQbar.zeta(5).imag().radical_expression() # needs sage.symbolic + sage: QQbar.zeta(5).imag().radical_expression() 1/2*sqrt(1/2*sqrt(5) + 5/2) - sage: AA(5/3).radical_expression() # needs sage.symbolic + sage: AA(5/3).radical_expression() 5/3 - sage: AA(5/3).radical_expression().parent() == SR # needs sage.symbolic + sage: AA(5/3).radical_expression().parent() == SR True - sage: QQbar(0).radical_expression() # needs sage.symbolic + sage: QQbar(0).radical_expression() 0 TESTS: @@ -4946,9 +4950,9 @@ def _richcmp_(self, other, op): False sage: QQbar(2) == 2 True - sage: QQbar(2) == GF(7)(2) # needs sage.rings.finite_rings + sage: QQbar(2) == GF(7)(2) False - sage: GF(7)(2) in QQbar # needs sage.rings.finite_rings + sage: GF(7)(2) in QQbar False sage: QQbar.zeta(6) != QQbar(1/2 + I*sqrt(3)/2) # needs sage.symbolic @@ -4957,7 +4961,7 @@ def _richcmp_(self, other, op): True sage: QQbar(2) != 2 False - sage: QQbar(2) != GF(7)(2) # needs sage.rings.finite_rings + sage: QQbar(2) != GF(7)(2) True sage: QQbar.zeta(3).real() == -1/2 @@ -4977,22 +4981,22 @@ def _richcmp_(self, other, op): Check that :trac:`29220` is fixed:: - sage: a = AA(2**(1/2) - 2**(1/3)) # needs sage.symbolic + sage: # needs sage.symbolic + sage: a = AA(2**(1/2) - 2**(1/3)) sage: b = 808620184/5240825825 - sage: a < b # needs sage.symbolic + sage: a < b True - sage: a < b # needs sage.symbolic + sage: a < b True - - sage: a = AA(2^(1/3)) # needs sage.symbolic + sage: a = AA(2^(1/3)) sage: r = 3085094589/2448641198 - sage: a < r # needs sage.symbolic + sage: a < r False - sage: a > r # needs sage.symbolic + sage: a > r True - sage: a < r # needs sage.symbolic + sage: a < r False - sage: a > r # needs sage.symbolic + sage: a > r True """ if self is other: @@ -5132,15 +5136,17 @@ def _integer_(self, ZZ=None): Traceback (most recent call last): ... ValueError: Cannot coerce algebraic number with non-zero imaginary part to algebraic real - sage: QQbar(sqrt(17))._integer_() # needs sage.symbolic + + sage: # needs sage.symbolic + sage: QQbar(sqrt(17))._integer_() Traceback (most recent call last): ... ValueError: Cannot coerce non-integral Algebraic Real 4.123105625617660? to Integer - sage: QQbar(sqrt(16))._integer_() # needs sage.symbolic + sage: QQbar(sqrt(16))._integer_() 4 - sage: v = QQbar(1 + I*sqrt(3))^5 + QQbar(16*sqrt(3)*I); v # needs sage.symbolic + sage: v = QQbar(1 + I*sqrt(3))^5 + QQbar(16*sqrt(3)*I); v 16.00000000000000? + 0.?e-17*I - sage: v._integer_() # needs sage.symbolic + sage: v._integer_() 16 """ return AA(self)._integer_(ZZ) @@ -5159,15 +5165,17 @@ def _rational_(self): Traceback (most recent call last): ... ValueError: Cannot coerce algebraic number with non-zero imaginary part to algebraic real - sage: QQbar(sqrt(2))._rational_() # needs sage.symbolic + + sage: # needs sage.symbolic + sage: QQbar(sqrt(2))._rational_() Traceback (most recent call last): ... ValueError: Cannot coerce irrational Algebraic Real 1.414213562373095? to Rational - sage: v1 = QQbar(1/3 + I*sqrt(5))^7 # needs sage.symbolic - sage: v2 = QQbar((100336/729*golden_ratio - 50168/729)*I) # needs sage.symbolic - sage: v = v1 + v2; v # needs sage.symbolic + sage: v1 = QQbar(1/3 + I*sqrt(5))^7 + sage: v2 = QQbar((100336/729*golden_ratio - 50168/729)*I) + sage: v = v1 + v2; v -259.6909007773206? + 0.?e-15*I - sage: v._rational_() # needs sage.symbolic + sage: v._rational_() -567944/2187 """ return AA(self)._rational_() @@ -5525,14 +5533,12 @@ def _richcmp_(self, other, op): True sage: y < y False - - sage: z = x1 - x2 # needs sage.symbolic - sage: z == 0 # needs sage.symbolic + sage: z = x1 - x2 + sage: z == 0 True - - sage: a = x1 - x2 # needs sage.symbolic - sage: b = x1 - x2 # needs sage.symbolic - sage: a == b # needs sage.symbolic + sage: a = x1 - x2 + sage: b = x1 - x2 + sage: a == b True """ if self is other: @@ -8102,13 +8108,15 @@ def rational_argument(self, n): EXAMPLES:: - sage: a = QQbar(sqrt(-2)) + QQbar(sqrt(3)) # needs sage.symbolic - sage: a.exactify() # needs sage.symbolic - sage: b = a._descr # needs sage.symbolic - sage: type(b) # needs sage.symbolic + sage: # needs sage.symbolic + sage: a = QQbar(sqrt(-2)) + QQbar(sqrt(3)) + sage: a.exactify() + sage: b = a._descr + sage: type(b) - sage: b.rational_argument(a) is None # needs sage.symbolic + sage: b.rational_argument(a) is None True + sage: x = polygen(QQ) sage: a = (x^4 + 1).roots(QQbar, multiplicities=False)[0] sage: a.exactify() @@ -8415,7 +8423,7 @@ def __init__(self, left, right, op): EXAMPLES:: - sage: t = QQbar(sqrt(2)) + QQbar(sqrt(3)); type(t._descr) # indirect doctest # needs sage.symbolic + sage: t = QQbar(sqrt(2)) + QQbar(sqrt(3)); type(t._descr) # indirect doctest # needs sage.symbolic """ self._left = left diff --git a/src/sage/rings/quotient_ring.py b/src/sage/rings/quotient_ring.py index c796b24961b..d2c3d160518 100644 --- a/src/sage/rings/quotient_ring.py +++ b/src/sage/rings/quotient_ring.py @@ -182,15 +182,16 @@ def QuotientRing(R, I, names=None, **kwds): With polynomial rings (note that the variable name of the quotient ring can be specified as shown below):: + sage: # needs sage.libs.pari sage: P. = QQ[] - sage: R. = QuotientRing(P, P.ideal(x^2 + 1)) # needs sage.libs.pari - sage: R # needs sage.libs.pari + sage: R. = QuotientRing(P, P.ideal(x^2 + 1)) + sage: R Univariate Quotient Polynomial Ring in xx over Rational Field with modulus x^2 + 1 - sage: R.gens(); R.gen() # needs sage.libs.pari + sage: R.gens(); R.gen() (xx,) xx - sage: for n in range(4): xx^n # needs sage.libs.pari + sage: for n in range(4): xx^n 1 xx -1 @@ -198,14 +199,15 @@ def QuotientRing(R, I, names=None, **kwds): :: + sage: # needs sage.libs.pari sage: P. = QQ[] - sage: S = QuotientRing(P, P.ideal(x^2 - 2)) # needs sage.libs.pari - sage: S # needs sage.libs.pari + sage: S = QuotientRing(P, P.ideal(x^2 - 2)) + sage: S Univariate Quotient Polynomial Ring in xbar over Rational Field with modulus x^2 - 2 - sage: xbar = S.gen(); S.gen() # needs sage.libs.pari + sage: xbar = S.gen(); S.gen() xbar - sage: for n in range(3): xbar^n # needs sage.libs.pari + sage: for n in range(3): xbar^n 1 xbar 2 @@ -435,13 +437,14 @@ class QuotientRing_nc(ring.Ring, sage.structure.parent_gens.ParentWithGens): :: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ, 2) - sage: S. = R.quo(1 + y^2) # needs sage.libs.singular - sage: T. = S.quo(a) # needs sage.libs.singular - sage: T # needs sage.libs.singular + sage: S. = R.quo(1 + y^2) + sage: T. = S.quo(a) + sage: T Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x, y^2 + 1) - sage: T.gens() # needs sage.libs.singular + sage: T.gens() (0, d) """ Element = quotient_ring_element.QuotientRingElement @@ -516,10 +519,12 @@ def construction(self): sage: I = R.ideal([4 + 3*x + x^2, 1 + x^2]) sage: R.quotient_ring(I).construction() (QuotientFunctor, Univariate Polynomial Ring in x over Integer Ring) - sage: F. = FreeAlgebra(QQ, implementation='letterplace') # needs sage.combinat sage.libs.singular sage.modules - sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F # needs sage.combinat sage.libs.singular sage.modules - sage: Q = F.quo(I) # needs sage.combinat sage.libs.singular sage.modules - sage: Q.construction() # needs sage.combinat sage.libs.singular sage.modules + + sage: # needs sage.combinat sage.libs.singular sage.modules + sage: F. = FreeAlgebra(QQ, implementation='letterplace') + sage: I = F * [x*y + y*z, x^2 + x*y - y*x - y^2] * F + sage: Q = F.quo(I) + sage: Q.construction() (QuotientFunctor, Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field) @@ -612,9 +617,10 @@ def is_commutative(self): In the next example, the generators apparently commute:: - sage: J = F * [x*y - y*x, x*z - z*x, y*z - z*y, x^3 - y^3] * F # needs sage.combinat sage.libs.singular sage.modules - sage: R = F.quo(J) # needs sage.combinat sage.libs.singular sage.modules - sage: R.is_commutative() # needs sage.combinat sage.libs.singular sage.modules + sage: # needs sage.combinat sage.libs.singular sage.modules + sage: J = F * [x*y - y*x, x*z - z*x, y*z - z*y, x^3 - y^3] * F + sage: R = F.quo(J) + sage: R.is_commutative() True """ @@ -654,21 +660,22 @@ def cover(self): :: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ) sage: Q = R.quo((x^2, y^2)) - sage: pi = Q.cover() # needs sage.libs.singular - sage: pi(x^3 + y) # needs sage.libs.singular + sage: pi = Q.cover() + sage: pi(x^3 + y) ybar - sage: l = pi.lift(x + y^3) # needs sage.libs.singular - sage: l # needs sage.libs.singular + sage: l = pi.lift(x + y^3) + sage: l x - sage: l = pi.lift(); l # needs sage.libs.singular + sage: l = pi.lift(); l Set-theoretic ring morphism: From: Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2, y^2) To: Multivariate Polynomial Ring in x, y over Rational Field Defn: Choice of lifting map - sage: l(x + y^3) # needs sage.libs.singular + sage: l(x + y^3) x """ try: @@ -688,23 +695,24 @@ def lifting_map(self): EXAMPLES:: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ, 2) sage: S = R.quotient(x^2 + y^2) - sage: pi = S.cover(); pi # needs sage.libs.singular + sage: pi = S.cover(); pi Ring morphism: From: Multivariate Polynomial Ring in x, y over Rational Field To: Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2) Defn: Natural quotient map - sage: L = S.lifting_map(); L # needs sage.libs.singular + sage: L = S.lifting_map(); L Set-theoretic ring morphism: From: Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2) To: Multivariate Polynomial Ring in x, y over Rational Field Defn: Choice of lifting map - sage: L(S.0) # needs sage.libs.singular + sage: L(S.0) x - sage: L(S.1) # needs sage.libs.singular + sage: L(S.1) y Note that some reduction may be applied so that the lift of a @@ -1036,13 +1044,14 @@ def _element_constructor_(self, x, coerce=True): :: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ, 2) - sage: S. = R.quotient(x^2 + y^2) # needs sage.libs.singular - sage: S.coerce(0) # needs sage.libs.singular + sage: S. = R.quotient(x^2 + y^2) + sage: S.coerce(0) 0 - sage: S.coerce(2/3) # needs sage.libs.singular + sage: S.coerce(2/3) 2/3 - sage: S.coerce(a^2 - b) # needs sage.libs.singular + sage: S.coerce(a^2 - b) -b^2 - b sage: S.coerce(GF(7)(3)) Traceback (most recent call last): @@ -1180,17 +1189,18 @@ def ngens(self): :: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ,2) - sage: S. = QuotientRing(R, R.ideal(1 + y^2)) # needs sage.libs.singular - sage: T. = QuotientRing(S, S.ideal(a)) # needs sage.libs.singular - sage: T # needs sage.libs.singular + sage: S. = QuotientRing(R, R.ideal(1 + y^2)) + sage: T. = QuotientRing(S, S.ideal(a)) + sage: T Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x, y^2 + 1) - sage: R.gens(); S.gens(); T.gens() # needs sage.libs.singular + sage: R.gens(); S.gens(); T.gens() (x, y) (a, b) (0, d) - sage: R.ngens(); S.ngens(); T.ngens() # needs sage.libs.singular + sage: R.ngens(); S.ngens(); T.ngens() 2 2 2 @@ -1209,19 +1219,20 @@ def gen(self, i=0): :: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ,2) - sage: S. = QuotientRing(R, R.ideal(1 + y^2)) # needs sage.libs.singular - sage: T. = QuotientRing(S, S.ideal(a)) # needs sage.libs.singular - sage: T # needs sage.libs.singular + sage: S. = QuotientRing(R, R.ideal(1 + y^2)) + sage: T. = QuotientRing(S, S.ideal(a)) + sage: T Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x, y^2 + 1) sage: R.gen(0); R.gen(1) x y - sage: S.gen(0); S.gen(1) # needs sage.libs.singular + sage: S.gen(0); S.gen(1) a b - sage: T.gen(0); T.gen(1) # needs sage.libs.singular + sage: T.gen(0); T.gen(1) 0 d """ @@ -1307,7 +1318,7 @@ def _magma_init_(self, magma): sage: P. = PolynomialRing(GF(2)) sage: Q = P.quotient(sage.rings.ideal.FieldIdeal(P)) - sage: magma(Q) # optional - magma # needs sage.rings.finite_rings + sage: magma(Q) # optional - magma Affine Algebra of rank 2 over GF(2) Graded Reverse Lexicographical Order Variables: x, y @@ -1391,7 +1402,7 @@ def _macaulay2_init_(self, macaulay2=None): x - y sage: R. = PolynomialRing(ZZ, 4) - sage: I = R.ideal([x*y-z^2, y^2-w^2]) + sage: I = R.ideal([x*y - z^2, y^2 - w^2]) sage: Q = R.quotient(I); Q Quotient of Multivariate Polynomial Ring in x, y, z, w over Integer Ring by the ideal (x*y - z^2, y^2 - w^2) sage: Q._macaulay2_init_() # optional - macaulay2 @@ -1400,13 +1411,12 @@ def _macaulay2_init_(self, macaulay2=None): 2 2 2 (x*y - z , y - w ) - sage: # needs sage.rings.finite_rings sage: R. = PolynomialRing(GF(101), 2) sage: I = R.ideal([x^2 + x, y^2 + y]) sage: Q = R.quotient_ring(I); Q Quotient of Multivariate Polynomial Ring in x, y over Finite Field of size 101 by the ideal (x^2 + x, y^2 + y) - sage: Q._macaulay2_init_() # optional - macaulay2 + sage: Q._macaulay2_init_() # optional - macaulay2 ZZ ---[x...y] 101 @@ -1479,13 +1489,14 @@ def _contains_(self, other): :: + sage: # needs sage.libs.pari sage: R. = QQ[] - sage: S. = R.quotient(T^3 - 1) # needs sage.libs.pari - sage: 1 in S.ideal(t^2 - 1) # needs sage.libs.pari + sage: S. = R.quotient(T^3 - 1) + sage: 1 in S.ideal(t^2 - 1) False - sage: 7 in S.ideal(t^2 + 1) # needs sage.libs.pari + sage: 7 in S.ideal(t^2 + 1) True - sage: 5-5*t in S.ideal(t^2 - 1) # needs sage.libs.pari + sage: 5-5*t in S.ideal(t^2 - 1) True """ R = self.ring() diff --git a/src/sage/rings/quotient_ring_element.py b/src/sage/rings/quotient_ring_element.py index 752e03e8123..f67c7192f11 100644 --- a/src/sage/rings/quotient_ring_element.py +++ b/src/sage/rings/quotient_ring_element.py @@ -476,16 +476,17 @@ def _im_gens_(self, codomain, im_gens, base_map=None): Ring homomorphisms whose domain is the fraction field of a quotient ring work correctly (see :trac:`16135`):: + sage: # needs sage.libs.singular sage: R. = QQ[] - sage: K = R.quotient(x^2 - y^3).fraction_field() # needs sage.libs.singular + sage: K = R.quotient(x^2 - y^3).fraction_field() sage: L. = FunctionField(QQ) - sage: f = K.hom((t^3, t^2)) # needs sage.libs.singular - sage: list(map(f, K.gens())) # needs sage.libs.singular + sage: f = K.hom((t^3, t^2)) + sage: list(map(f, K.gens())) [t^3, t^2] - sage: xbar, ybar = K.gens() # needs sage.libs.singular - sage: f(1/ybar) # needs sage.libs.singular + sage: xbar, ybar = K.gens() + sage: f(1/ybar) 1/t^2 - sage: f(xbar/ybar) # needs sage.libs.singular + sage: f(xbar/ybar) t """ return self.lift()._im_gens_(codomain, im_gens, base_map=base_map) diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx index 90b07c7914b..39d69e76d33 100644 --- a/src/sage/rings/rational.pyx +++ b/src/sage/rings/rational.pyx @@ -302,21 +302,23 @@ cpdef rational_power_parts(a, Rational b, factor_limit=10**5): sage: rational_power_parts(-1, -1/3) (1, -1) - sage: (-1)^(-1/3) # needs sage.symbolic - -(-1)^(2/3) - sage: 1 / ((-1)^(1/3)) # needs sage.symbolic - -(-1)^(2/3) sage: rational_power_parts(-1, 2/3) (1, -1) - sage: (-1)^(2/3) # needs sage.symbolic - (-1)^(2/3) sage: all(rational_power_parts(-1, i/77) == (1,-1) for i in range(1,9)) True - sage: (-1)^(1/3)*(-1)^(1/5) # needs sage.symbolic + + sage: # needs sage.symbolic + sage: (-1)^(-1/3) + -(-1)^(2/3) + sage: 1 / ((-1)^(1/3)) + -(-1)^(2/3) + sage: (-1)^(2/3) + (-1)^(2/3) + sage: (-1)^(1/3)*(-1)^(1/5) (-1)^(8/15) - sage: bool((-1)^(2/3) == -1/2 + sqrt(3)/2*I) # needs sage.symbolic + sage: bool((-1)^(2/3) == -1/2 + sqrt(3)/2*I) True - sage: all((-1)^(p/q) == cos(p*pi/q) + I * sin(p*pi/q) # needs sage.symbolic + sage: all((-1)^(p/q) == cos(p*pi/q) + I * sin(p*pi/q) ....: for p in srange(1, 6) for q in srange(1, 6)) True @@ -972,12 +974,13 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: - sage: n = 1/2; n._sympy_() # needs sympy + sage: # needs sympy + sage: n = 1/2; n._sympy_() 1/2 - sage: n = -1/5; n._sympy_() # needs sympy + sage: n = -1/5; n._sympy_() -1/5 - sage: from sympy import Symbol # needs sympy - sage: QQ(1) + Symbol('x')*QQ(2) # needs sympy + sage: from sympy import Symbol + sage: QQ(1) + Symbol('x')*QQ(2) 2*x + 1 """ import sympy @@ -1045,16 +1048,15 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: - sage: import numpy # needs numpy - sage: numpy.array([1, 2, 3/1]) # needs numpy + sage: # needs numpy + sage: import numpy + sage: numpy.array([1, 2, 3/1]) array([1, 2, 3]) - - sage: numpy.array(QQ(2**40)).dtype # needs numpy + sage: numpy.array(QQ(2**40)).dtype dtype('int64') - sage: numpy.array(QQ(2**400)).dtype # needs numpy + sage: numpy.array(QQ(2**400)).dtype dtype('O') - - sage: numpy.array([1, 1/2, 3/4]) # needs numpy + sage: numpy.array([1, 1/2, 3/4]) array([1. , 0.5 , 0.75]) """ if mpz_cmp_ui(mpq_denref(self.value), 1) == 0: @@ -1350,16 +1352,17 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: + sage: # needs sage.rings.real_mpfr sage: a = QQ(6/25) - sage: a.global_height_arch() + a.global_height_non_arch() # needs sage.rings.real_mpfr + sage: a.global_height_arch() + a.global_height_non_arch() 3.21887582486820 - sage: a.global_height() # needs sage.rings.real_mpfr + sage: a.global_height() 3.21887582486820 - sage: (1/a).global_height() # needs sage.rings.real_mpfr + sage: (1/a).global_height() 3.21887582486820 - sage: QQ(0).global_height() # needs sage.rings.real_mpfr + sage: QQ(0).global_height() 0.000000000000000 - sage: QQ(1).global_height() # needs sage.rings.real_mpfr + sage: QQ(1).global_height() 0.000000000000000 """ from sage.rings.real_mpfr import RealField @@ -1418,17 +1421,18 @@ cdef class Rational(sage.structure.element.FieldElement): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(QQ, 'x') - sage: K = NumberField(x^2 - 2, 'beta') # needs sage.rings.number_field - sage: (1/7).is_norm(K) # needs sage.rings.number_field + sage: K = NumberField(x^2 - 2, 'beta') + sage: (1/7).is_norm(K) True - sage: (1/10).is_norm(K) # needs sage.rings.number_field + sage: (1/10).is_norm(K) False - sage: 0.is_norm(K) # needs sage.rings.number_field + sage: 0.is_norm(K) True - sage: (1/7).is_norm(K, element=True) # needs sage.rings.number_field + sage: (1/7).is_norm(K, element=True) (True, 1/7*beta + 3/7) - sage: (1/10).is_norm(K, element=True) # needs sage.rings.number_field + sage: (1/10).is_norm(K, element=True) (False, None) sage: (1/691).is_norm(QQ, element=True) (True, 1/691) @@ -1444,18 +1448,18 @@ cdef class Rational(sage.structure.element.FieldElement): A non-Galois number field:: - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: B, e = (3/5).is_norm(K, element=True); B # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = NumberField(x^3 - 2) + sage: B, e = (3/5).is_norm(K, element=True); B True - sage: e.norm() # needs sage.rings.number_field + sage: e.norm() 3/5 - - sage: 7.is_norm(K) # needs sage.rings.number_field + sage: 7.is_norm(K) Traceback (most recent call last): ... NotImplementedError: is_norm is not implemented unconditionally for norms from non-Galois number fields - sage: 7.is_norm(K, proof=False) # needs sage.rings.number_field + sage: 7.is_norm(K, proof=False) False AUTHORS: diff --git a/src/sage/rings/rational_field.py b/src/sage/rings/rational_field.py index 6b47fdeab0a..eb8f087691f 100644 --- a/src/sage/rings/rational_field.py +++ b/src/sage/rings/rational_field.py @@ -1525,7 +1525,7 @@ def _gap_init_(self): EXAMPLES:: - sage: gap(QQ) # indirect doctest # needs sage.libs.gap + sage: gap(QQ) # indirect doctest # needs sage.libs.gap Rationals """ return 'Rationals' @@ -1638,21 +1638,22 @@ def _factor_univariate_polynomial(self, f): TESTS:: + sage: # needs sage.libs.pari sage: R. = QQ[] - sage: QQ._factor_univariate_polynomial(x) # needs sage.libs.pari + sage: QQ._factor_univariate_polynomial(x) x - sage: QQ._factor_univariate_polynomial(2*x) # needs sage.libs.pari + sage: QQ._factor_univariate_polynomial(2*x) (2) * x - sage: QQ._factor_univariate_polynomial((x^2 - 1/4)^4) # needs sage.libs.pari + sage: QQ._factor_univariate_polynomial((x^2 - 1/4)^4) (x - 1/2)^4 * (x + 1/2)^4 - sage: QQ._factor_univariate_polynomial((2*x + 1) * (3*x^2 - 5)^2) # needs sage.libs.pari + sage: QQ._factor_univariate_polynomial((2*x + 1) * (3*x^2 - 5)^2) (18) * (x + 1/2) * (x^2 - 5/3)^2 - sage: f = prod((k^2*x^k + k)^(k-1) for k in primes(10)) # needs sage.libs.pari - sage: QQ._factor_univariate_polynomial(f) # needs sage.libs.pari + sage: f = prod((k^2*x^k + k)^(k-1) for k in primes(10)) + sage: QQ._factor_univariate_polynomial(f) (1751787911376562500) * (x^2 + 1/2) * (x^3 + 1/3)^2 * (x^5 + 1/5)^4 * (x^7 + 1/7)^6 - sage: QQ._factor_univariate_polynomial(10*x^5 - 1) # needs sage.libs.pari + sage: QQ._factor_univariate_polynomial(10*x^5 - 1) (10) * (x^5 - 1/10) - sage: QQ._factor_univariate_polynomial(10*x^5 - 10) # needs sage.libs.pari + sage: QQ._factor_univariate_polynomial(10*x^5 - 10) (10) * (x - 1) * (x^4 + x^3 + x^2 + x + 1) """ diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx index 3a93dc4645b..802e4567fc3 100644 --- a/src/sage/rings/real_arb.pyx +++ b/src/sage/rings/real_arb.pyx @@ -908,7 +908,7 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField): TESTS:: - sage: RBF.gamma(RLF(pi)) # abs tol 1e-13 # needs sage.symbolic + sage: RBF.gamma(RLF(pi)) # abs tol 1e-13 # needs sage.symbolic [2.28803779534003 +/- 4.12e-15] """ cdef RealBall res @@ -3571,7 +3571,7 @@ cdef class RealBall(RingElement): TESTS:: - sage: RBF(Si(1)) # abs tol 1e-15 # needs sage.symbolic + sage: RBF(Si(1)) # abs tol 1e-15 # needs sage.symbolic [0.946083070367183 +/- 9.22e-16] """ cdef RealBall res = self._new() diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index 5b1fe40d684..f3183dcb050 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -650,22 +650,23 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): TESTS:: + sage: # needs numpy sage: R. = RDF[] - sage: RDF._factor_univariate_polynomial(x) # needs numpy + sage: RDF._factor_univariate_polynomial(x) x - sage: RDF._factor_univariate_polynomial(2*x) # needs numpy + sage: RDF._factor_univariate_polynomial(2*x) (2.0) * x - sage: RDF._factor_univariate_polynomial(x^2) # needs numpy + sage: RDF._factor_univariate_polynomial(x^2) x^2 - sage: RDF._factor_univariate_polynomial(x^2 + 1) # needs numpy + sage: RDF._factor_univariate_polynomial(x^2 + 1) x^2 + 1.0 - sage: RDF._factor_univariate_polynomial(x^2 - 1) # needs numpy + sage: RDF._factor_univariate_polynomial(x^2 - 1) (x - 1.0) * (x + 1.0) The implementation relies on the ``roots()`` method which often reports roots not to be real even though they are:: - sage: f = (x-1)^3 + sage: f = (x-1)^3 # needs numpy sage: f.roots(ring=CDF) # abs tol 2e-5 # needs numpy [(1.0000065719436413, 1), (0.9999967140281792 - 5.691454546815028e-06*I, 1), @@ -815,14 +816,16 @@ cdef class RealDoubleElement(FieldElement): can only happen if the input number is (up to sign) exactly a power of 2:: - sage: a - a.ulp()/3 == a # needs sage.symbolic + sage: # needs sage.symbolic + sage: a - a.ulp()/3 == a True - sage: a + a.ulp()/3 == a # needs sage.symbolic + sage: a + a.ulp()/3 == a True - sage: b - b.ulp()/3 == b # needs sage.symbolic + sage: b - b.ulp()/3 == b True - sage: b + b.ulp()/3 == b # needs sage.symbolic + sage: b + b.ulp()/3 == b True + sage: c = RDF(1) sage: c - c.ulp()/3 == c False @@ -1271,8 +1274,8 @@ cdef class RealDoubleElement(FieldElement): sage: # needs sage.symbolic sage: a = RDF(exp(1.0)); a 2.718281828459045 - sage: sign,mantissa,exponent = RDF(exp(1.0)).sign_mantissa_exponent() - sage: sign,mantissa,exponent + sage: sign, mantissa, exponent = RDF(exp(1.0)).sign_mantissa_exponent() + sage: sign, mantissa, exponent (1, 6121026514868073, -51) sage: sign*mantissa*(2**exponent) == a True @@ -1676,7 +1679,7 @@ cdef class RealDoubleElement(FieldElement): EXAMPLES:: - sage: CDF(RDF(1/3)) # indirect doctest # needs sage.rings.complex_double + sage: CDF(RDF(1/3)) # indirect doctest # needs sage.rings.complex_double 0.3333333333333333 """ return CDF(self._value) diff --git a/src/sage/rings/real_lazy.pyx b/src/sage/rings/real_lazy.pyx index 0f797b039f5..fb96ae89407 100644 --- a/src/sage/rings/real_lazy.pyx +++ b/src/sage/rings/real_lazy.pyx @@ -1626,7 +1626,7 @@ cdef class LazyAlgebraic(LazyFieldElement): sage: a = LazyAlgebraic(CLF, QQ['x'].cyclotomic_polynomial(7), 0.6+0.8*CC.0) sage: a 0.6234898018587335? + 0.7818314824680299?*I - sage: ComplexField(150)(a) # indirect doctest # needs sage.rings.number_field + sage: ComplexField(150)(a) # indirect doctest # needs sage.rings.number_field 0.62348980185873353052500488400423981063227473 + 0.78183148246802980870844452667405775023233452*I sage: a = LazyAlgebraic(CLF, QQ['x'].0^2-7, -2.0) diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx index 6577ec8e733..b11fba1ac59 100644 --- a/src/sage/rings/real_mpfi.pyx +++ b/src/sage/rings/real_mpfi.pyx @@ -1408,7 +1408,7 @@ cdef class RealIntervalFieldElement(RingElement): EXAMPLES:: - sage: hash(RIF(e)) == hash(RIF(e)) # indirect doctest # needs sage.symbolic + sage: hash(RIF(e)) == hash(RIF(e)) # indirect doctest # needs sage.symbolic True """ return hash(self.str(16)) @@ -2401,17 +2401,19 @@ cdef class RealIntervalFieldElement(RingElement): 1.00000000000000 sage: RIF(1, 2).relative_diameter() 0.666666666666667 - sage: RIF(pi).diameter() # needs sage.symbolic + + sage: # needs sage.symbolic + sage: RIF(pi).diameter() 1.41357985842823e-16 - sage: RIF(pi).absolute_diameter() # needs sage.symbolic + sage: RIF(pi).absolute_diameter() 4.44089209850063e-16 - sage: RIF(pi).relative_diameter() # needs sage.symbolic + sage: RIF(pi).relative_diameter() 1.41357985842823e-16 - sage: (RIF(pi) - RIF(3, 22/7)).diameter() # needs sage.symbolic + sage: (RIF(pi) - RIF(3, 22/7)).diameter() 0.142857142857144 - sage: (RIF(pi) - RIF(3, 22/7)).absolute_diameter() # needs sage.symbolic + sage: (RIF(pi) - RIF(3, 22/7)).absolute_diameter() 0.142857142857144 - sage: (RIF(pi) - RIF(3, 22/7)).relative_diameter() # needs sage.symbolic + sage: (RIF(pi) - RIF(3, 22/7)).relative_diameter() 2.03604377705518 """ cdef RealNumber x @@ -2433,21 +2435,23 @@ cdef class RealIntervalFieldElement(RingElement): EXAMPLES:: - sage: RIF(pi).fp_rank_diameter() # needs sage.symbolic - 1 sage: RIF(12345).fp_rank_diameter() 0 - sage: RIF(-sqrt(2)).fp_rank_diameter() # needs sage.symbolic - 1 sage: RIF(5/8).fp_rank_diameter() 0 sage: RIF(5/7).fp_rank_diameter() 1 - sage: a = RIF(pi)^12345; a # needs sage.symbolic + + sage: # needs sage.symbolic + sage: RIF(pi).fp_rank_diameter() + 1 + sage: RIF(-sqrt(2)).fp_rank_diameter() + 1 + sage: a = RIF(pi)^12345; a 2.06622879260?e6137 - sage: a.fp_rank_diameter() # needs sage.symbolic + sage: a.fp_rank_diameter() 30524 - sage: (RIF(sqrt(2)) - RIF(sqrt(2))).fp_rank_diameter() # needs sage.symbolic + sage: (RIF(sqrt(2)) - RIF(sqrt(2))).fp_rank_diameter() 9671406088542672151117826 # 32-bit 41538374868278620559869609387229186 # 64-bit diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index ac3a41ce5ef..1d1143c5548 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -1438,12 +1438,13 @@ cdef class RealNumber(sage.structure.element.RingElement): EXAMPLES:: - sage: import numpy # needs numpy - sage: numpy.arange(10.0) # needs numpy + sage: # needs numpy + sage: import numpy + sage: numpy.arange(10.0) array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]) - sage: numpy.array([1.0, 1.1, 1.2]).dtype # needs numpy + sage: numpy.array([1.0, 1.1, 1.2]).dtype dtype('float64') - sage: numpy.array([1.000000000000000000000000000000000000]).dtype # needs numpy + sage: numpy.array([1.000000000000000000000000000000000000]).dtype dtype('O') """ if (self._parent).__prec <= 53: diff --git a/src/sage/rings/ring.pyx b/src/sage/rings/ring.pyx index 62f1d362b54..54c8053062b 100644 --- a/src/sage/rings/ring.pyx +++ b/src/sage/rings/ring.pyx @@ -282,7 +282,7 @@ cdef class Ring(ParentWithGens): EXAMPLES:: - sage: FreeAlgebra(QQ, 3, 'x').category() # todo: use a ring which is not an algebra! # needs sage.combinat sage.modules + sage: FreeAlgebra(QQ, 3, 'x').category() # todo: use a ring which is not an algebra! # needs sage.combinat sage.modules Category of algebras with basis over Rational Field Since a quotient of the integers is its own base ring, and during @@ -969,18 +969,21 @@ cdef class Ring(ParentWithGens): zeta3 sage: CyclotomicField(3).zeta(3).multiplicative_order() # needs sage.rings.number_field 3 - sage: a = GF(7).zeta(); a # needs sage.rings.finite_rings + + sage: # needs sage.rings.finite_rings + sage: a = GF(7).zeta(); a 3 - sage: a.multiplicative_order() # needs sage.rings.finite_rings + sage: a.multiplicative_order() 6 - sage: a = GF(49,'z').zeta(); a # needs sage.rings.finite_rings + sage: a = GF(49,'z').zeta(); a z - sage: a.multiplicative_order() # needs sage.rings.finite_rings + sage: a.multiplicative_order() 48 - sage: a = GF(49,'z').zeta(2); a # needs sage.rings.finite_rings + sage: a = GF(49,'z').zeta(2); a 6 - sage: a.multiplicative_order() # needs sage.rings.finite_rings + sage: a.multiplicative_order() 2 + sage: QQ.zeta(3) Traceback (most recent call last): ... @@ -1511,18 +1514,19 @@ cdef class CommutativeRing(Ring): Elements in `M` acts as derivations at `(0,1,2)`:: - sage: Dx = M.gen(0); Dx # needs sage.modules + sage: # needs sage.modules + sage: Dx = M.gen(0); Dx d/dx - sage: Dy = M.gen(1); Dy # needs sage.modules + sage: Dy = M.gen(1); Dy d/dy - sage: Dz = M.gen(2); Dz # needs sage.modules + sage: Dz = M.gen(2); Dz d/dz sage: f = x^2 + y^2 + z^2 - sage: Dx(f) # = 2*x evaluated at (0,1,2) # needs sage.modules + sage: Dx(f) # = 2*x evaluated at (0,1,2) 0 - sage: Dy(f) # = 2*y evaluated at (0,1,2) # needs sage.modules + sage: Dy(f) # = 2*y evaluated at (0,1,2) 2 - sage: Dz(f) # = 2*z evaluated at (0,1,2) # needs sage.modules + sage: Dz(f) # = 2*z evaluated at (0,1,2) 4 An example with a twisting homomorphism:: @@ -1990,23 +1994,24 @@ cdef class PrincipalIdealDomain(IntegralDomain): over an extension ring. Note that ``gcd`` requires x and y to be coercible:: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: S. = NumberField(x^2 - 2, 'a') # needs sage.rings.number_field - sage: f = (x - a)*(x + a); g = (x - a)*(x^2 - 2) # needs sage.rings.number_field - sage: print(f); print(g) # needs sage.rings.number_field + sage: S. = NumberField(x^2 - 2, 'a') + sage: f = (x - a)*(x + a); g = (x - a)*(x^2 - 2) + sage: print(f); print(g) x^2 - 2 x^3 - a*x^2 - 2*x + 2*a - sage: f in R # needs sage.rings.number_field + sage: f in R True - sage: g in R # needs sage.rings.number_field + sage: g in R False - sage: R.gcd(f, g) # needs sage.rings.number_field + sage: R.gcd(f, g) Traceback (most recent call last): ... TypeError: Unable to coerce 2*a to a rational - sage: R.base_extend(S).gcd(f,g) # needs sage.rings.number_field + sage: R.base_extend(S).gcd(f,g) x^2 - 2 - sage: R.base_extend(S).gcd(f, (x - a)*(x^2 - 3)) # needs sage.rings.number_field + sage: R.base_extend(S).gcd(f, (x - a)*(x^2 - 3)) x - a """ if coerce: @@ -2358,16 +2363,17 @@ cdef class Algebra(Ring): EXAMPLES:: - sage: B = QuaternionAlgebra(2) # needs sage.combinat sage.modules - sage: B.has_standard_involution() # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.modules + sage: B = QuaternionAlgebra(2) + sage: B.has_standard_involution() True sage: R. = PolynomialRing(QQ) sage: K. = NumberField(x**2 - 2) # needs sage.rings.number_field - sage: A = QuaternionAlgebra(K, -2, 5) # needs sage.combinat sage.modules sage.rings.number_field - sage: A.has_standard_involution() # needs sage.combinat sage.modules sage.rings.number_field + sage: A = QuaternionAlgebra(K, -2, 5) # needs sage.rings.number_field + sage: A.has_standard_involution() # needs sage.rings.number_field True - sage: L. = FreeAlgebra(QQ, 2) # needs sage.combinat sage.modules - sage: L.has_standard_involution() # needs sage.combinat sage.modules + sage: L. = FreeAlgebra(QQ, 2) + sage: L.has_standard_involution() Traceback (most recent call last): ... NotImplementedError: has_standard_involution is not implemented for this algebra diff --git a/src/sage/rings/ring_extension.pyx b/src/sage/rings/ring_extension.pyx index 83a4bd1ea27..a1e785aaefc 100644 --- a/src/sage/rings/ring_extension.pyx +++ b/src/sage/rings/ring_extension.pyx @@ -74,16 +74,16 @@ computes the coordinates of an element according to the above basis:: One can also compute traces and norms with respect to any base of the tower:: - sage: u.trace() # over K # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: u.trace() # over K (2*z2 + 1) + (2*z2 + 1)*a - sage: u.trace(F) # needs sage.rings.finite_rings + sage: u.trace(F) z2 + 1 - sage: u.trace().trace() # over K, then over F # needs sage.rings.finite_rings + sage: u.trace().trace() # over K, then over F z2 + 1 - - sage: u.norm() # over K # needs sage.rings.finite_rings + sage: u.norm() # over K (z2 + 1) + (4*z2 + 2)*a - sage: u.norm(F) # needs sage.rings.finite_rings + sage: u.norm(F) 2*z2 + 2 And minimal polynomials:: @@ -625,13 +625,13 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = QQ.extension(x^2 - 2) # needs sage.rings.number_field - sage: E = K.over() # over QQ # needs sage.rings.number_field - - sage: hasattr(E, 'automorphisms') # needs sage.rings.number_field + sage: K. = QQ.extension(x^2 - 2) + sage: E = K.over() # over QQ + sage: hasattr(E, 'automorphisms') True - sage: E.automorphisms() # needs sage.rings.number_field + sage: E.automorphisms() [Ring endomorphism of Field in a with defining polynomial x^2 - 2 over its base Defn: a |--> a, Ring endomorphism of Field in a with defining polynomial x^2 - 2 over its base @@ -767,18 +767,17 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: k = GF(5) - sage: K. = GF(5^2).over(k) # needs sage.rings.finite_rings - sage: L. = GF(5^4).over(K) # needs sage.rings.finite_rings - - sage: x = L.from_base_ring(k(2)); x # needs sage.rings.finite_rings + sage: K. = GF(5^2).over(k) + sage: L. = GF(5^4).over(K) + sage: x = L.from_base_ring(k(2)); x 2 - sage: x.parent() # needs sage.rings.finite_rings + sage: x.parent() Field in v with defining polynomial x^2 + (3 - u)*x + u over its base - - sage: x = L.from_base_ring(u); x # needs sage.rings.finite_rings + sage: x = L.from_base_ring(u); x u - sage: x.parent() # needs sage.rings.finite_rings + sage: x.parent() Field in v with defining polynomial x^2 + (3 - u)*x + u over its base """ if r not in self._base: @@ -808,18 +807,17 @@ cdef class RingExtension_generic(CommutativeAlgebra): Observe what happens when we modify the option ``over``:: - sage: D # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: D Field in d with defining polynomial x^2 + ((1 - a) + ((1 + 2*a) - b)*c + ((2 + a) + (1 - a)*b)*c^2)*x + c over its base - - sage: D.print_options(over=2) # needs sage.rings.finite_rings - sage: D # needs sage.rings.finite_rings + sage: D.print_options(over=2) + sage: D Field in d with defining polynomial x^2 + ((1 - a) + ((1 + 2*a) - b)*c + ((2 + a) + (1 - a)*b)*c^2)*x + c over Field in c with defining polynomial x^3 + (1 + (2 - a)*b)*x^2 + (2 + 2*b)*x - b over Field in b with defining polynomial x^2 + (3 - a)*x + a over its base - - sage: D.print_options(over=Infinity) # needs sage.rings.finite_rings - sage: D # needs sage.rings.finite_rings + sage: D.print_options(over=Infinity) + sage: D Field in d with defining polynomial x^2 + ((1 - a) + ((1 + 2*a) - b)*c + ((2 + a) + (1 - a)*b)*c^2)*x + c over Field in c with defining polynomial x^3 + (1 + (2 - a)*b)*x^2 + (2 + 2*b)*x - b over Field in b with defining polynomial x^2 + (3 - a)*x + a over @@ -828,19 +826,18 @@ cdef class RingExtension_generic(CommutativeAlgebra): Now the option ``base``:: - sage: d^2 # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: d^2 -c + ((-1 + a) + ((-1 + 3*a) + b)*c + ((3 - a) + (-1 + a)*b)*c^2)*d - - sage: D.basis_over(B) # needs sage.rings.finite_rings + sage: D.basis_over(B) [1, c, c^2, d, c*d, c^2*d] - sage: D.print_options(base=B) # needs sage.rings.finite_rings - sage: d^2 # needs sage.rings.finite_rings + sage: D.print_options(base=B) + sage: d^2 -c + (-1 + a)*d + ((-1 + 3*a) + b)*c*d + ((3 - a) + (-1 + a)*b)*c^2*d - - sage: D.basis_over(A) # needs sage.rings.finite_rings + sage: D.basis_over(A) [1, b, c, b*c, c^2, b*c^2, d, b*d, c*d, b*c*d, c^2*d, b*c^2*d] - sage: D.print_options(base=A) # needs sage.rings.finite_rings - sage: d^2 # needs sage.rings.finite_rings + sage: D.print_options(base=A) + sage: d^2 -c + (-1 + a)*d + (-1 + 3*a)*c*d + b*c*d + (3 - a)*c^2*d + (-1 + a)*b*c^2*d """ for (name, value) in options.items(): @@ -1044,21 +1041,20 @@ cdef class RingExtension_generic(CommutativeAlgebra): TESTS:: - sage: E1 = GF(3^6).over(GF(3^3)) # needs sage.rings.finite_rings - sage: E1.coerce_map_from(GF(3^3)) # indirect doctest # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: E1 = GF(3^6).over(GF(3^3)) + sage: E1.coerce_map_from(GF(3^3)) # indirect doctest Ring morphism: From: Finite Field in z3 of size 3^3 To: Field in z6 with defining polynomial x^2 + (2*z3 + 1)*x + z3 over its base Defn: z3 |--> z3 - - sage: E1.coerce_map_from(GF(3)) # indirect doctest # needs sage.rings.finite_rings + sage: E1.coerce_map_from(GF(3)) # indirect doctest Ring morphism: From: Finite Field of size 3 To: Field in z6 with defining polynomial x^2 + (2*z3 + 1)*x + z3 over its base Defn: 1 |--> 1 - - sage: E2 = GF(3^18).over(GF(3^9)) # needs sage.rings.finite_rings - sage: E2.coerce_map_from(E1) # indirect doctest # needs sage.rings.finite_rings + sage: E2 = GF(3^18).over(GF(3^9)) + sage: E2.coerce_map_from(E1) # indirect doctest Ring morphism: From: Field in z6 with defining polynomial x^2 + (2*z3 + 1)*x + z3 over its base To: Field in z18 with defining polynomial x^2 + (z9^8 + 2*z9^7 + z9^5 + 2*z9^4 + z9^2 + z9 + 1)*x + z9 over its base @@ -1117,20 +1113,18 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings - sage: K = GF(5^4).over(F) # needs sage.rings.finite_rings - sage: L = GF(5^12).over(K) # needs sage.rings.finite_rings - - sage: F.bases() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5^2).over() # over GF(5) + sage: K = GF(5^4).over(F) + sage: L = GF(5^12).over(K) + sage: F.bases() [Field in z2 with defining polynomial x^2 + 4*x + 2 over its base, Finite Field of size 5] - - sage: K.bases() # needs sage.rings.finite_rings + sage: K.bases() [Field in z4 with defining polynomial x^2 + (3 - z2)*x + z2 over its base, Field in z2 with defining polynomial x^2 + 4*x + 2 over its base, Finite Field of size 5] - - sage: L.bases() # needs sage.rings.finite_rings + sage: L.bases() [Field in z12 with defining polynomial x^3 + (1 + (2 - z2)*z4)*x^2 + (2 + 2*z4)*x - z4 over its base, Field in z4 with defining polynomial x^2 + (3 - z2)*x + z2 over its base, @@ -1157,15 +1151,15 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings - sage: K = GF(5^4).over(F) # needs sage.rings.finite_rings - sage: L = GF(5^12).over(K) # needs sage.rings.finite_rings - - sage: F.absolute_base() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5^2).over() # over GF(5) + sage: K = GF(5^4).over(F) + sage: L = GF(5^12).over(K) + sage: F.absolute_base() Finite Field of size 5 - sage: K.absolute_base() # needs sage.rings.finite_rings + sage: K.absolute_base() Finite Field of size 5 - sage: L.absolute_base() # needs sage.rings.finite_rings + sage: L.absolute_base() Finite Field of size 5 .. SEEALSO:: @@ -1186,12 +1180,12 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: A = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings - sage: B = GF(5^12).over(A) # needs sage.rings.finite_rings - - sage: A.is_defined_over(GF(5^2)) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: A = GF(5^4).over(GF(5^2)) + sage: B = GF(5^12).over(A) + sage: A.is_defined_over(GF(5^2)) True - sage: A.is_defined_over(GF(5)) # needs sage.rings.finite_rings + sage: A.is_defined_over(GF(5)) False sage: # needs sage.rings.finite_rings @@ -1247,12 +1241,11 @@ cdef class RingExtension_generic(CommutativeAlgebra): [Field in z12 with defining polynomial x^3 + (1 + (4*z2 + 2)*z4)*x^2 + (2 + 2*z4)*x - z4 over its base, Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base, Finite Field in z2 of size 5^2] - - sage: L._check_base(K) # needs sage.rings.finite_rings + sage: L._check_base(K) Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base - sage: L._check_base(GF(5^4)) # needs sage.rings.finite_rings + sage: L._check_base(GF(5^4)) Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base - sage: L._check_base(GF(5^4)) is K # needs sage.rings.finite_rings + sage: L._check_base(GF(5^4)) is K True When ``base`` is ``None``, the base of the extension is returned:: @@ -1285,17 +1278,16 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2) # needs sage.rings.finite_rings - sage: K = GF(5^4).over(F) # needs sage.rings.finite_rings - sage: L = GF(5^12).over(K) # needs sage.rings.finite_rings - - sage: K.defining_morphism() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5^2) + sage: K = GF(5^4).over(F) + sage: L = GF(5^12).over(K) + sage: K.defining_morphism() Ring morphism: From: Finite Field in z2 of size 5^2 To: Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base Defn: z2 |--> z2 - - sage: L.defining_morphism() # needs sage.rings.finite_rings + sage: L.defining_morphism() Ring morphism: From: Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base To: Field in z12 with defining polynomial @@ -1311,7 +1303,6 @@ cdef class RingExtension_generic(CommutativeAlgebra): To: Field in z12 with defining polynomial x^3 + (1 + (4*z2 + 2)*z4)*x^2 + (2 + 2*z4)*x - z4 over its base Defn: z2 |--> z2 - sage: L.defining_morphism(GF(5)) # needs sage.rings.finite_rings Traceback (most recent call last): ... @@ -1380,16 +1371,16 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings - sage: K.gens() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(5^2).over() # over GF(5) + sage: K.gens() (z2,) - sage: K.ngens() # needs sage.rings.finite_rings + sage: K.ngens() 1 - - sage: L = GF(5^4).over(K) # needs sage.rings.finite_rings - sage: L.gens(GF(5)) # needs sage.rings.finite_rings + sage: L = GF(5^4).over(K) + sage: L.gens(GF(5)) (z4, z2) - sage: L.ngens(GF(5)) # needs sage.rings.finite_rings + sage: L.ngens(GF(5)) 2 """ return len(self.gens(base)) @@ -1401,7 +1392,7 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: sage: K = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings - sage: x =K.gen(); x # needs sage.rings.finite_rings + sage: x = K.gen(); x # needs sage.rings.finite_rings z2 Observe that the generator lives in the extension:: @@ -1419,13 +1410,13 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings - sage: x = K.random_element(); x # random # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(5^2).over() # over GF(5) + sage: x = K.random_element(); x # random 3 + z2 - - sage: x.parent() # needs sage.rings.finite_rings + sage: x.parent() Field in z2 with defining polynomial x^2 + 4*x + 2 over its base - sage: x.parent() is K # needs sage.rings.finite_rings + sage: x.parent() is K True """ elt = self._backend.random_element() @@ -1442,15 +1433,15 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2) # needs sage.rings.finite_rings - sage: K = GF(5^4).over(F) # needs sage.rings.finite_rings - sage: L = GF(5^12).over(K) # needs sage.rings.finite_rings - - sage: K.degree_over(F) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5^2) + sage: K = GF(5^4).over(F) + sage: L = GF(5^12).over(K) + sage: K.degree_over(F) 2 - sage: L.degree_over(K) # needs sage.rings.finite_rings + sage: L.degree_over(K) 3 - sage: L.degree_over(F) # needs sage.rings.finite_rings + sage: L.degree_over(F) 6 If ``base`` is omitted, the degree is computed over the base @@ -1509,14 +1500,14 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: A = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings - sage: B = GF(5^12).over(A) # needs sage.rings.finite_rings - - sage: A.degree(GF(5^2)) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: A = GF(5^4).over(GF(5^2)) + sage: B = GF(5^12).over(A) + sage: A.degree(GF(5^2)) 2 - sage: B.degree(A) # needs sage.rings.finite_rings + sage: B.degree(A) 3 - sage: B.degree(GF(5^2)) # needs sage.rings.finite_rings + sage: B.degree(GF(5^2)) 6 Note that ``base`` must be an explicit base over which the @@ -1555,12 +1546,12 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: A = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings - sage: B = GF(5^12).over(A) # needs sage.rings.finite_rings - - sage: A.absolute_degree() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: A = GF(5^4).over(GF(5^2)) + sage: B = GF(5^12).over(A) + sage: A.absolute_degree() 2 - sage: B.absolute_degree() # needs sage.rings.finite_rings + sage: B.absolute_degree() 6 .. SEEALSO:: @@ -1580,12 +1571,12 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings - sage: L = GF(5^4).over(K) # needs sage.rings.finite_rings - - sage: L.is_finite_over(K) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(5^2).over() # over GF(5) + sage: L = GF(5^4).over(K) + sage: L.is_finite_over(K) True - sage: L.is_finite_over(GF(5)) # needs sage.rings.finite_rings + sage: L.is_finite_over(GF(5)) True If ``base`` is omitted, it is set to its default which is the @@ -1643,12 +1634,12 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: K = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings - sage: L = GF(5^4).over(K) # needs sage.rings.finite_rings - - sage: L.is_free_over(K) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(5^2).over() # over GF(5) + sage: L = GF(5^4).over(K) + sage: L.is_free_over(K) True - sage: L.is_free_over(GF(5)) # needs sage.rings.finite_rings + sage: L.is_free_over(GF(5)) True If ``base`` is omitted, it is set to its default which is the @@ -1740,25 +1731,24 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 5) # needs sage.rings.number_field - sage: OK = A.over() # over ZZ # needs sage.rings.number_field - sage: OK # needs sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 5) + sage: OK = A.over() # over ZZ + sage: OK Order in Number Field in a with defining polynomial x^2 - 5 over its base - - sage: K1 = OK.fraction_field(); K1 # needs sage.rings.number_field + sage: K1 = OK.fraction_field(); K1 Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K1.bases() # needs sage.rings.number_field + sage: K1.bases() [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, Order in Number Field in a with defining polynomial x^2 - 5 over its base, Integer Ring] - - sage: K2 = OK.fraction_field(extend_base=True); K2 # needs sage.rings.number_field + sage: K2 = OK.fraction_field(extend_base=True); K2 Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K2.bases() # needs sage.rings.number_field + sage: K2.bases() [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, Rational Field] @@ -1840,17 +1830,16 @@ cdef class RingExtension_generic(CommutativeAlgebra): EXAMPLES:: - sage: F = GF(5^2) # needs sage.rings.finite_rings - sage: K = GF(5^4).over(F) # needs sage.rings.finite_rings - sage: L = GF(5^12).over(F) # needs sage.rings.finite_rings - - sage: K.Hom(L) # indirect doctest # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(5^2) + sage: K = GF(5^4).over(F) + sage: L = GF(5^12).over(F) + sage: K.Hom(L) # indirect doctest Set of Homomorphisms from Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base to Field in z12 with defining polynomial x^6 + (4*z2 + 3)*x^5 + x^4 + (3*z2 + 1)*x^3 + x^2 + (4*z2 + 1)*x + z2 over its base - - sage: K.Hom(L, category=Sets()) # needs sage.rings.finite_rings + sage: K.Hom(L, category=Sets()) Set of Morphisms from Field in z4 with defining polynomial x^2 + (4*z2 + 3)*x + z2 over its base to Field in z12 with defining polynomial x^6 + (4*z2 + 3)*x^5 + x^4 @@ -2028,14 +2017,14 @@ cdef class RingExtensionFractionField(RingExtension_generic): TESTS:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) # needs sage.rings.number_field - sage: OK = A.over() # needs sage.rings.number_field - sage: K = OK.fraction_field(); K # needs sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 2) + sage: OK = A.over() + sage: K = OK.fraction_field(); K Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2 over its base - - sage: TestSuite(K).run() # needs sage.rings.number_field + sage: TestSuite(K).run() """ RingExtension_generic.__init__(self, defining_morphism, **kwargs) @@ -2050,16 +2039,16 @@ cdef class RingExtensionFractionField(RingExtension_generic): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) # needs sage.rings.number_field - sage: OK = A.over() # needs sage.rings.number_field - sage: K = OK.fraction_field(); K # needs sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 2) + sage: OK = A.over() + sage: K = OK.fraction_field(); K Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2 over its base - - sage: K.ring() # needs sage.rings.number_field + sage: K.ring() Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: K.ring() is OK # needs sage.rings.number_field + sage: K.ring() is OK True """ return self._ring @@ -2070,12 +2059,12 @@ cdef class RingExtensionFractionField(RingExtension_generic): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) # needs sage.rings.number_field - sage: OK = A.over() # needs sage.rings.number_field - sage: K = OK.fraction_field() # needs sage.rings.number_field - - sage: K._repr_topring() # needs sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 2) + sage: OK = A.over() + sage: K = OK.fraction_field() + sage: K._repr_topring() 'Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2' """ if isinstance(self._ring, RingExtension_generic): @@ -2188,22 +2177,18 @@ cdef class RingExtensionWithBasis(RingExtension_generic): sage: F = GF(5) sage: K = GF(5^2).over(F) # needs sage.rings.finite_rings sage: L = GF(5^4).over(K) # needs sage.rings.finite_rings - sage: L._print_option_base(F) is F # needs sage.rings.finite_rings True sage: L._print_option_base(K) is K # needs sage.rings.finite_rings True sage: L._print_option_base(GF(5^2)) is K # needs sage.rings.finite_rings True - sage: L._print_option_base(None) is K # needs sage.rings.finite_rings True - sage: L._print_option_base(L) # needs sage.rings.finite_rings Traceback (most recent call last): ... ValueError: base must be strict - sage: K._print_option_base(L) # needs sage.rings.finite_rings Traceback (most recent call last): ... @@ -2298,17 +2283,15 @@ cdef class RingExtensionWithBasis(RingExtension_generic): EXAMPLES:: - sage: F. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings - sage: K. = GF(5^4).over(F) # needs sage.rings.finite_rings - sage: L. = GF(5^12).over(K) # needs sage.rings.finite_rings - - sage: L.basis_over(K) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = GF(5^2).over() # over GF(5) + sage: K. = GF(5^4).over(F) + sage: L. = GF(5^12).over(K) + sage: L.basis_over(K) [1, c, c^2] - - sage: L.basis_over(F) # needs sage.rings.finite_rings + sage: L.basis_over(F) [1, b, c, b*c, c^2, b*c^2] - - sage: L.basis_over(GF(5)) # needs sage.rings.finite_rings + sage: L.basis_over(GF(5)) [1, a, b, a*b, c, a*c, b*c, a*b*c, c^2, a*c^2, b*c^2, a*b*c^2] If ``base`` is omitted, it is set to its default which is the @@ -2407,10 +2390,9 @@ cdef class RingExtensionWithBasis(RingExtension_generic): x^3 + (7 + 2*a)*x^2 + (2 - a)*x - a over its base To: Vector space of dimension 3 over Field in a with defining polynomial x^2 + 7*x + 2 over its base - - sage: j(b) # needs sage.rings.finite_rings + sage: j(b) (0, 1, 0) - sage: i((1, a, a+1)) # needs sage.rings.finite_rings + sage: i((1, a, a+1)) 1 + a*b + (1 + a)*b^2 Similarly, one can view L as a F-vector space of dimension 6:: @@ -2507,25 +2489,24 @@ cdef class RingExtensionWithBasis(RingExtension_generic): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 5) # needs sage.rings.number_field - sage: OK = A.over() # over ZZ # needs sage.rings.number_field - sage: OK # needs sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 5) + sage: OK = A.over() # over ZZ + sage: OK Order in Number Field in a with defining polynomial x^2 - 5 over its base - - sage: K1 = OK.fraction_field(); K1 # needs sage.rings.number_field + sage: K1 = OK.fraction_field(); K1 Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K1.bases() # needs sage.rings.number_field + sage: K1.bases() [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, Order in Number Field in a with defining polynomial x^2 - 5 over its base, Integer Ring] - - sage: K2 = OK.fraction_field(extend_base=True); K2 # needs sage.rings.number_field + sage: K2 = OK.fraction_field(extend_base=True); K2 Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K2.bases() # needs sage.rings.number_field + sage: K2.bases() [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, Rational Field] @@ -2576,14 +2557,13 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): TESTS:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^3 - 7) # needs sage.rings.number_field - sage: K = A.over() # needs sage.rings.number_field - - sage: type(K) # needs sage.rings.number_field + sage: A. = QQ.extension(x^3 - 7) + sage: K = A.over() + sage: type(K) - - sage: TestSuite(K).run() # needs sage.rings.number_field + sage: TestSuite(K).run() """ def __init__(self, defining_morphism, gen, names, check=True, **kwargs): @@ -2636,12 +2616,12 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): EXAMPLES:: - sage: K. = GF(5^3).over() # needs sage.rings.finite_rings - sage: K._repr_topring() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(5^3).over() + sage: K._repr_topring() 'Field in a with defining polynomial x^3 + 3*x + 3' - - sage: L. = GF(5^9).over(K) # needs sage.rings.finite_rings - sage: L._repr_topring() # needs sage.rings.finite_rings + sage: L. = GF(5^9).over(K) + sage: L._repr_topring() 'Field in b with defining polynomial x^3 + (1 + 3*a^2)*x^2 + (3 + 2*a + 2*a^2)*x - a' """ if self._name is None: @@ -2654,12 +2634,12 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): EXAMPLES:: - sage: K. = GF(5^3).over() # needs sage.rings.finite_rings - sage: K._latex_topring() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(5^3).over() + sage: K._latex_topring() '\\Bold{F}_{5}[a]' - - sage: L. = GF(5^9).over(K) # needs sage.rings.finite_rings - sage: L._latex_topring() # needs sage.rings.finite_rings + sage: L. = GF(5^9).over(K) + sage: L._latex_topring() '\\Bold{F}_{5}[a][b]' """ if self._name is None: @@ -2680,13 +2660,13 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): EXAMPLES:: - sage: K. = GF(7^10).over(GF(7^2)); K # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(7^10).over(GF(7^2)); K Field in u with defining polynomial x^5 + (6*z2 + 4)*x^4 + (3*z2 + 5)*x^3 + (2*z2 + 2)*x^2 + 4*x + 6*z2 over its base - - sage: P = K.modulus(); P # needs sage.rings.finite_rings + sage: P = K.modulus(); P x^5 + (6*z2 + 4)*x^4 + (3*z2 + 5)*x^3 + (2*z2 + 2)*x^2 + 4*x + 6*z2 - sage: P(u) # needs sage.rings.finite_rings + sage: P(u) 0 We can use a different variable name:: @@ -2712,14 +2692,14 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings - sage: K.gens() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) + sage: K.gens() (a,) - - sage: L. = GF(5^4).over(K) # needs sage.rings.finite_rings - sage: L.gens() # needs sage.rings.finite_rings + sage: L. = GF(5^4).over(K) + sage: L.gens() (b,) - sage: L.gens(GF(5)) # needs sage.rings.finite_rings + sage: L.gens(GF(5)) (b, a) """ if base is None: @@ -2753,25 +2733,24 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 5) # needs sage.rings.number_field - sage: OK = A.over() # over ZZ # needs sage.rings.number_field - sage: OK # needs sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 5) + sage: OK = A.over() # over ZZ + sage: OK Order in Number Field in a with defining polynomial x^2 - 5 over its base - - sage: K1 = OK.fraction_field(); K1 # needs sage.rings.number_field + sage: K1 = OK.fraction_field(); K1 Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K1.bases() # needs sage.rings.number_field + sage: K1.bases() [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, Order in Number Field in a with defining polynomial x^2 - 5 over its base, Integer Ring] - - sage: K2 = OK.fraction_field(extend_base=True); K2 # needs sage.rings.number_field + sage: K2 = OK.fraction_field(extend_base=True); K2 Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base - sage: K2.bases() # needs sage.rings.number_field + sage: K2.bases() [Fraction Field of Order in Number Field in a with defining polynomial x^2 - 5 over its base, Rational Field] diff --git a/src/sage/rings/ring_extension_element.pyx b/src/sage/rings/ring_extension_element.pyx index a902857d9f8..694ab2a05fc 100644 --- a/src/sage/rings/ring_extension_element.pyx +++ b/src/sage/rings/ring_extension_element.pyx @@ -104,13 +104,13 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 2) # needs sage.rings.number_field - sage: K. = A.over() # over QQ # needs sage.rings.number_field - - sage: hasattr(a, 'continued_fraction') # needs sage.rings.number_field + sage: A. = QQ.extension(x^2 - 2) + sage: K. = A.over() # over QQ + sage: hasattr(a, 'continued_fraction') True - sage: a.continued_fraction() # needs sage.rings.number_field + sage: a.continued_fraction() [1; (2)*] """ try: @@ -138,11 +138,11 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 2) # needs sage.rings.number_field - sage: K. = A.over() # needs sage.rings.number_field - - sage: dir(a) # needs sage.rings.number_field + sage: A. = QQ.extension(x^2 - 2) + sage: K. = A.over() + sage: dir(a) ['__abs__', '__add__', ... @@ -324,10 +324,10 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): sage: # needs sage.rings.finite_rings sage: S. = F[] sage: E = S.over(F) - sage: f = E(1) # needs sage.rings.number_field - sage: g = f.in_base(); g # needs sage.rings.number_field + sage: f = E(1) + sage: g = f.in_base(); g 1 - sage: g.parent() # needs sage.rings.number_field + sage: g.parent() Finite Field in z2 of size 5^2 TESTS:: @@ -392,13 +392,13 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings - sage: x = K.random_element() # needs sage.rings.finite_rings - sage: y = K.random_element() # needs sage.rings.finite_rings - - sage: (x+y).parent() is K # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(5^4).over(GF(5^2)) + sage: x = K.random_element() + sage: y = K.random_element() + sage: (x+y).parent() is K True - sage: x + y == y + x # needs sage.rings.finite_rings + sage: x + y == y + x True """ cdef RingExtensionElement ans = PY_NEW(type(self)) @@ -412,13 +412,13 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings - sage: x = K.random_element() # needs sage.rings.finite_rings - - sage: y = -x # needs sage.rings.finite_rings - sage: y.parent() is K # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(5^4).over(GF(5^2)) + sage: x = K.random_element() + sage: y = -x + sage: y.parent() is K True - sage: x + y == 0 # needs sage.rings.finite_rings + sage: x + y == 0 True """ cdef RingExtensionElement ans = PY_NEW(type(self)) @@ -432,13 +432,13 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings - sage: x = K.random_element() # needs sage.rings.finite_rings - sage: y = K.random_element() # needs sage.rings.finite_rings - - sage: (x-y).parent() is K # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(5^4).over(GF(5^2)) + sage: x = K.random_element() + sage: y = K.random_element() + sage: (x - y).parent() is K True - sage: x - y == x + (-y) # needs sage.rings.finite_rings + sage: x - y == x + (-y) True """ cdef RingExtensionElement ans = PY_NEW(type(self)) @@ -452,13 +452,13 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: - sage: K = GF(5^4).over(GF(5^2)) # needs sage.rings.finite_rings - sage: x = K.random_element() # needs sage.rings.finite_rings - sage: y = K.random_element() # needs sage.rings.finite_rings - - sage: (x*y).parent() is K # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(5^4).over(GF(5^2)) + sage: x = K.random_element() + sage: y = K.random_element() + sage: (x*y).parent() is K True - sage: x * y == y * x # needs sage.rings.finite_rings + sage: x * y == y * x True """ cdef RingExtensionElement ans = PY_NEW(type(self)) @@ -473,17 +473,17 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): TESTS:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) # needs sage.rings.number_field - sage: OK = A.over() # needs sage.rings.number_field - sage: a = OK(a) # needs sage.rings.number_field - - sage: b = 1/a; b # needs sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 2) + sage: OK = A.over() + sage: a = OK(a) + sage: b = 1/a; b a/2 - sage: b.parent() # needs sage.rings.number_field + sage: b.parent() Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: a*b # needs sage.rings.number_field + sage: a*b 1 """ cdef RingExtensionElement ans @@ -576,16 +576,16 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): EXAMPLES:: - sage: K. = GF(5^3).over() # needs sage.rings.finite_rings - sage: a.is_square() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(5^3).over() + sage: a.is_square() False - sage: a.is_square(root=True) # needs sage.rings.finite_rings + sage: a.is_square(root=True) (False, None) - - sage: b = a + 1 # needs sage.rings.finite_rings - sage: b.is_square() # needs sage.rings.finite_rings + sage: b = a + 1 + sage: b.is_square() True - sage: b.is_square(root=True) # needs sage.rings.finite_rings + sage: b.is_square(root=True) (True, 2 + 3*a + a^2) """ is_sq = self._backend.is_square() @@ -751,16 +751,16 @@ cdef class RingExtensionFractionFieldElement(RingExtensionElement): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: A. = ZZ.extension(x^2 - 2) # needs sage.rings.number_field - sage: OK = A.over() # over ZZ # needs sage.rings.number_field - sage: K = OK.fraction_field(); K # needs sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 2) + sage: OK = A.over() # over ZZ + sage: K = OK.fraction_field(); K Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2 over its base - - sage: x = K(1/a); x # needs sage.rings.number_field + sage: x = K(1/a); x a/2 - sage: num = x.numerator(); num # needs sage.rings.number_field + sage: num = x.numerator(); num a The numerator is an element of the ring which was used @@ -794,7 +794,6 @@ cdef class RingExtensionFractionFieldElement(RingExtensionElement): sage: K = OK.fraction_field(); K # needs sage.rings.number_field Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: x = K(1/a); x # needs sage.rings.number_field a/2 sage: denom = x.denominator(); denom # needs sage.rings.number_field @@ -861,13 +860,13 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: K. = GF(5^3).over() # needs sage.rings.finite_rings - sage: L. = GF(5^9).over(K) # needs sage.rings.finite_rings - sage: u = 1/(a+b) # needs sage.rings.finite_rings - - sage: u._repr_extension(base=K) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(5^3).over() + sage: L. = GF(5^9).over(K) + sage: u = 1/(a+b) + sage: u._repr_extension(base=K) '(2 + 2*a) + (-1 + a - a^2)*b + (2 + 3*a + 3*a^2)*b^2' - sage: u._repr_extension(base=GF(5)) # needs sage.rings.finite_rings + sage: u._repr_extension(base=GF(5)) '2 + 2*a - b + a*b - a^2*b + 2*b^2 + 3*a*b^2 + 3*a^2*b^2' """ cdef RingExtensionWithBasis parent = self._parent @@ -939,13 +938,13 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: K. = GF(5^3).over() # needs sage.rings.finite_rings - sage: L. = GF(5^9).over(K) # needs sage.rings.finite_rings - sage: u = 1/(a+b) # needs sage.rings.finite_rings - - sage: u._latex_extension(base=K) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(5^3).over() + sage: L. = GF(5^9).over(K) + sage: u = 1/(a+b) + sage: u._latex_extension(base=K) \left( 2 + 2 a \right) + \left( -1 + a - a^{2} \right) b + \left( 2 + 3 a + 3 a^{2} \right) b^{2} - sage: u._latex_extension(base=GF(5)) # needs sage.rings.finite_rings + sage: u._latex_extension(base=GF(5)) 2 + 2 a - b + ab - a^{2}b + 2 b^{2} + 3 ab^{2} + 3 a^{2}b^{2} """ cdef RingExtensionWithBasis parent = self._parent @@ -1011,11 +1010,9 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): sage: L. = GF(5^6).over(K) sage: x = (a+b)^4; x (-1 + a) + (3 + a)*b + (1 - a)*b^2 - - sage: x.vector(K) # basis is (1, b, b^2) # needs sage.rings.finite_rings + sage: x.vector(K) # basis is (1, b, b^2) (-1 + a, 3 + a, 1 - a) - - sage: x.vector(F) # basis is (1, a, b, a*b, b^2, a*b^2) # needs sage.rings.finite_rings + sage: x.vector(F) # basis is (1, a, b, a*b, b^2, a*b^2) (4, 1, 3, 1, 1, 4) If ``base`` is omitted, it is set to its default which is the @@ -1077,12 +1074,11 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): sage: L. = GF(5^12).over(K) sage: u = 1/(a + b + c); u (2 + (-1 - a)*b) + ((2 + 3*a) + (1 - a)*b)*c + ((-1 - a) - a*b)*c^2 - - sage: P = u.polynomial(K); P # needs sage.rings.finite_rings + sage: P = u.polynomial(K); P ((-1 - a) - a*b)*x^2 + ((2 + 3*a) + (1 - a)*b)*x + 2 + (-1 - a)*b - sage: P.base_ring() is K # needs sage.rings.finite_rings + sage: P.base_ring() is K True - sage: P(c) == u # needs sage.rings.finite_rings + sage: P(c) == u True When the base is `F`, we obtain a bivariate polynomial:: @@ -1161,19 +1157,18 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): EXAMPLES:: - sage: K. = GF(5^3).over() # over GF(5) # needs sage.rings.finite_rings - sage: L. = GF(5^6).over(K) # needs sage.rings.finite_rings - sage: u = a/(1+b) # needs sage.rings.finite_rings - - sage: u # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(5^3).over() # over GF(5) + sage: L. = GF(5^6).over(K) + sage: u = a/(1+b) + sage: u (2 + a + 3*a^2) + (3 + 3*a + a^2)*b - sage: b*u # needs sage.rings.finite_rings + sage: b*u (3 + 2*a^2) + (2 + 2*a - a^2)*b - sage: u.matrix(K) # needs sage.rings.finite_rings + sage: u.matrix(K) [2 + a + 3*a^2 3 + 3*a + a^2] [ 3 + 2*a^2 2 + 2*a - a^2] - - sage: u.matrix(GF(5)) # needs sage.rings.finite_rings + sage: u.matrix(GF(5)) [2 1 3 3 3 1] [1 3 1 2 0 3] [2 3 3 1 3 0] @@ -1217,11 +1212,11 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): TESTS:: - sage: F = GF(11^2) # needs sage.rings.finite_rings - sage: K = GF(11^6).over(F) # needs sage.rings.finite_rings - sage: L = GF(11^18).over(K) # needs sage.rings.finite_rings - - sage: for base in L.bases(): # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(11^2) + sage: K = GF(11^6).over(F) + sage: L = GF(11^18).over(K) + sage: for base in L.bases(): ....: x = L.random_element() ....: y = L.random_element() ....: assert((x+y).matrix(base) == x.matrix(base) + y.matrix(base)) @@ -1250,8 +1245,7 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): sage: K. = GF(5^3).over(F) sage: L. = GF(5^6).over(K) sage: u = a/(1+b) - - sage: tr = u.trace(K); tr # needs sage.rings.finite_rings + sage: tr = u.trace(K); tr -1 + 3*a + 2*a^2 We check that the trace lives in the base ring:: @@ -1305,15 +1299,14 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): TESTS:: - sage: F = GF(11^2) # needs sage.rings.finite_rings - sage: K = GF(11^6).over(F) # needs sage.rings.finite_rings - sage: L = GF(11^18).over(K) # needs sage.rings.finite_rings - - sage: x = L.random_element() # needs sage.rings.finite_rings - sage: x.trace(F) == x.trace().trace() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(11^2) + sage: K = GF(11^6).over(F) + sage: L = GF(11^18).over(K) + sage: x = L.random_element() + sage: x.trace(F) == x.trace().trace() True - - sage: for base in L.bases(): # needs sage.rings.finite_rings + sage: for base in L.bases(): ....: x = L.random_element() ....: y = L.random_element() ....: assert(x.trace(base) == x.matrix(base).trace()) @@ -1345,8 +1338,7 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): sage: K. = GF(5^3).over(F) sage: L. = GF(5^6).over(K) sage: u = a/(1+b) - - sage: nr = u.norm(K); nr # needs sage.rings.finite_rings + sage: nr = u.norm(K); nr 3 + 2*a^2 We check that the norm lives in the base ring:: @@ -1400,15 +1392,14 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): TESTS:: - sage: F = GF(11^2) # needs sage.rings.finite_rings - sage: K = GF(11^6).over(F) # needs sage.rings.finite_rings - sage: L = GF(11^18).over(K) # needs sage.rings.finite_rings - - sage: x = L.random_element() # needs sage.rings.finite_rings - sage: x.norm(F) == x.norm().norm() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = GF(11^2) + sage: K = GF(11^6).over(F) + sage: L = GF(11^18).over(K) + sage: x = L.random_element() + sage: x.norm(F) == x.norm().norm() True - - sage: for base in L.bases(): # needs sage.rings.finite_rings + sage: for base in L.bases(): ....: x = L.random_element() ....: y = L.random_element() ....: assert(x.norm(base) == x.matrix(base).determinant()) @@ -1440,8 +1431,7 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): sage: K. = GF(5^3).over(F) sage: L. = GF(5^6).over(K) sage: u = a/(1+b) - - sage: chi = u.charpoly(K); chi # needs sage.rings.finite_rings + sage: chi = u.charpoly(K); chi x^2 + (1 + 2*a + 3*a^2)*x + 3 + 2*a^2 We check that the charpoly has coefficients in the base ring:: @@ -1508,8 +1498,7 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): sage: K. = GF(5^3).over(F) sage: L. = GF(5^6).over(K) sage: u = 1 / (a+b) - - sage: chi = u.minpoly(K); chi # needs sage.rings.finite_rings + sage: chi = u.minpoly(K); chi x^2 + (2*a + a^2)*x - 1 + a We check that the minimal polynomial has coefficients in the base ring:: diff --git a/src/sage/rings/ring_extension_morphism.pyx b/src/sage/rings/ring_extension_morphism.pyx index fe6797159ee..f861d015a35 100644 --- a/src/sage/rings/ring_extension_morphism.pyx +++ b/src/sage/rings/ring_extension_morphism.pyx @@ -83,20 +83,18 @@ cdef class RingExtensionHomomorphism(RingMap): TESTS:: - sage: K. = GF(5^2).over() # needs sage.rings.finite_rings - sage: L. = GF(5^4).over(K) # needs sage.rings.finite_rings - sage: phi = L.hom([b^5, a^5]); phi # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(5^2).over() + sage: L. = GF(5^4).over(K) + sage: phi = L.hom([b^5, a^5]); phi Ring endomorphism of Field in b with defining polynomial x^2 + (3 - a)*x + a over its base Defn: b |--> (2 + a) + 2*b with map on base ring: a |--> 1 - a - - sage: type(phi) # needs sage.rings.finite_rings + sage: type(phi) - - sage: TestSuite(phi).run() # needs sage.rings.finite_rings - + sage: TestSuite(phi).run() """ def __init__(self, parent, defn, base_map=None, check=True): r""" @@ -333,15 +331,14 @@ cdef class RingExtensionHomomorphism(RingMap): TESTS:: - sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings - sage: L. = GF(5^6).over(K) # needs sage.rings.finite_rings - - sage: FrobK = K.hom([a^5]) # needs sage.rings.finite_rings - sage: FrobL = L.hom([b^5], base_map=FrobK) # needs sage.rings.finite_rings - - sage: FrobK^2 == End(K).identity() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) + sage: L. = GF(5^6).over(K) + sage: FrobK = K.hom([a^5]) + sage: FrobL = L.hom([b^5], base_map=FrobK) + sage: FrobK^2 == End(K).identity() True - sage: FrobL^6 == End(L).identity() # needs sage.rings.finite_rings + sage: FrobL^6 == End(L).identity() True """ eq = are_equal_morphisms(self._backend, backend_morphism(other)) @@ -367,13 +364,14 @@ cdef class RingExtensionHomomorphism(RingMap): Coercion maps are not considered as identity morphisms:: - sage: L. = GF(5^6).over(K) # needs sage.rings.finite_rings - sage: iota = L.defining_morphism(); iota # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: L. = GF(5^6).over(K) + sage: iota = L.defining_morphism(); iota Ring morphism: From: Field in a with defining polynomial x^2 + 4*x + 2 over its base To: Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: a |--> a - sage: iota.is_identity() # needs sage.rings.finite_rings + sage: iota.is_identity() False """ if self.domain() is not self.codomain(): @@ -386,14 +384,15 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: - sage: K = GF(5^10).over(GF(5^5)) # needs sage.rings.finite_rings - sage: iota = K.defining_morphism(); iota # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(5^10).over(GF(5^5)) + sage: iota = K.defining_morphism(); iota Ring morphism: From: Finite Field in z5 of size 5^5 To: Field in z10 with defining polynomial x^2 + (2*z5^3 + 2*z5^2 + 4*z5 + 4)*x + z5 over its base Defn: z5 |--> z5 - sage: iota.is_injective() # needs sage.rings.finite_rings + sage: iota.is_injective() True sage: K = GF(7).over(ZZ) @@ -413,14 +412,15 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: - sage: K = GF(5^10).over(GF(5^5)) # needs sage.rings.finite_rings - sage: iota = K.defining_morphism(); iota # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(5^10).over(GF(5^5)) + sage: iota = K.defining_morphism(); iota Ring morphism: From: Finite Field in z5 of size 5^5 To: Field in z10 with defining polynomial x^2 + (2*z5^3 + 2*z5^2 + 4*z5 + 4)*x + z5 over its base Defn: z5 |--> z5 - sage: iota.is_surjective() # needs sage.rings.finite_rings + sage: iota.is_surjective() False sage: K = GF(7).over(ZZ) @@ -443,11 +443,11 @@ cdef class RingExtensionHomomorphism(RingMap): EXAMPLES:: - sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings - sage: L. = GF(5^6).over(K) # needs sage.rings.finite_rings - sage: FrobL = L.hom([b^5, a^5]) # absolute Frobenius # needs sage.rings.finite_rings - - sage: print(FrobL._repr_defn()) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) + sage: L. = GF(5^6).over(K) + sage: FrobL = L.hom([b^5, a^5]) # absolute Frobenius + sage: print(FrobL._repr_defn()) b |--> (-1 + a) + (1 + 2*a)*b + a*b^2 with map on base ring: a |--> 1 - a @@ -474,14 +474,14 @@ cdef class RingExtensionHomomorphism(RingMap): TESTS:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: A. = QQ.extension(x^2 - 5) # needs sage.rings.number_field - sage: K. = A.over() # needs sage.rings.number_field - sage: f = K.hom([-sqrt5]); f # needs sage.rings.number_field + sage: A. = QQ.extension(x^2 - 5) + sage: K. = A.over() + sage: f = K.hom([-sqrt5]); f Ring endomorphism of Field in sqrt5 with defining polynomial x^2 - 5 over its base Defn: sqrt5 |--> -sqrt5 - - sage: f^2 # indirect doctest # needs sage.rings.number_field + sage: f^2 # indirect doctest Ring endomorphism of Field in sqrt5 with defining polynomial x^2 - 5 over its base Defn: sqrt5 |--> sqrt5 """ @@ -500,13 +500,13 @@ cdef class RingExtensionHomomorphism(RingMap): TESTS:: - sage: K. = GF(5^2).over() # over GF(5) # needs sage.rings.finite_rings - sage: f = K.hom([a^5]) # needs sage.rings.finite_rings - - sage: g = copy(f) # indirect doctest # needs sage.rings.finite_rings - sage: f == g # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(5^2).over() # over GF(5) + sage: f = K.hom([a^5]) + sage: g = copy(f) # indirect doctest + sage: f == g True - sage: f is g # needs sage.rings.finite_rings + sage: f is g False """ self._backend = _slots['_backend'] @@ -535,17 +535,16 @@ cdef class RingExtensionBackendIsomorphism(RingExtensionHomomorphism): TESTS:: - sage: K = GF(11^9).over(GF(11^3)) # needs sage.rings.finite_rings - sage: f = K.coerce_map_from(GF(11^9)); f # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(11^9).over(GF(11^3)) + sage: f = K.coerce_map_from(GF(11^9)); f Coercion morphism: From: Finite Field in z9 of size 11^9 To: Field in z9 with defining polynomial x^3 + (9*z3^2 + 5*z3 + 1)*x^2 + (4*z3 + 3)*x + 10*z3 over its base - - sage: type(f) # needs sage.rings.finite_rings + sage: type(f) - - sage: TestSuite(f).run() # needs sage.rings.finite_rings + sage: TestSuite(f).run() """ def __init__(self, parent): r""" @@ -625,17 +624,16 @@ cdef class RingExtensionBackendReverseIsomorphism(RingExtensionHomomorphism): TESTS:: - sage: K = GF(11^9).over(GF(11^3)) # needs sage.rings.finite_rings - sage: f = GF(11^9).convert_map_from(K); f # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(11^9).over(GF(11^3)) + sage: f = GF(11^9).convert_map_from(K); f Canonical morphism: From: Field in z9 with defining polynomial x^3 + (9*z3^2 + 5*z3 + 1)*x^2 + (4*z3 + 3)*x + 10*z3 over its base To: Finite Field in z9 of size 11^9 - - sage: type(f) # needs sage.rings.finite_rings + sage: type(f) - - sage: TestSuite(f).run() # needs sage.rings.finite_rings + sage: TestSuite(f).run() """ def __init__(self, parent): diff --git a/src/sage/rings/semirings/tropical_semiring.pyx b/src/sage/rings/semirings/tropical_semiring.pyx index d9ddcd324fd..2922298e286 100644 --- a/src/sage/rings/semirings/tropical_semiring.pyx +++ b/src/sage/rings/semirings/tropical_semiring.pyx @@ -555,32 +555,34 @@ class TropicalSemiring(Parent, UniqueRepresentation): EXAMPLES:: - sage: TR = TropicalSemiring(RR) # needs sage.rings.real_mpfr - sage: T60 = TropicalSemiring(RealField(60)) # needs sage.rings.real_mpfr - sage: TR.has_coerce_map_from(T60) # needs sage.rings.real_mpfr - True sage: TQ = TropicalSemiring(QQ) + sage: TQ.has_coerce_map_from(TQ) + True sage: TQ.has_coerce_map_from(TropicalSemiring(ZZ)) True - sage: TR.has_coerce_map_from(TR) # needs sage.rings.real_mpfr + + sage: # needs sage.rings.real_mpfr + sage: TR = TropicalSemiring(RR) + sage: T60 = TropicalSemiring(RealField(60)) + sage: TR.has_coerce_map_from(T60) True - sage: TQ.has_coerce_map_from(TQ) + sage: TR.has_coerce_map_from(TR) True - sage: TR.has_coerce_map_from(TQ) # needs sage.rings.real_mpfr + sage: TR.has_coerce_map_from(TQ) True - sage: TR.has_coerce_map_from(float) # needs sage.rings.real_mpfr + sage: TR.has_coerce_map_from(float) False - sage: TR.has_coerce_map_from(RR) # needs sage.rings.real_mpfr + sage: TR.has_coerce_map_from(RR) False - sage: TR.has_coerce_map_from(QQ) # needs sage.rings.real_mpfr + sage: TR.has_coerce_map_from(QQ) False - sage: TR.coerce_map_from(T60)(T60(2)) # needs sage.rings.real_mpfr + sage: TR.coerce_map_from(T60)(T60(2)) 2.00000000000000 - sage: TR.coerce(T60(3.4)) # needs sage.rings.real_mpfr + sage: TR.coerce(T60(3.4)) 3.40000000000000 - sage: TR.coerce(T60.infinity()) # needs sage.rings.real_mpfr + sage: TR.coerce(T60.infinity()) +infinity - sage: TQ.coerce(TR(3.4)) # needs sage.rings.real_mpfr + sage: TQ.coerce(TR(3.4)) Traceback (most recent call last): ... TypeError: no canonical coercion from Tropical semiring over diff --git a/src/sage/rings/sum_of_squares.pyx b/src/sage/rings/sum_of_squares.pyx index 8c97f25b0df..b8f719d4dac 100644 --- a/src/sage/rings/sum_of_squares.pyx +++ b/src/sage/rings/sum_of_squares.pyx @@ -166,7 +166,7 @@ def two_squares_pyx(uint32_t n): TESTS:: sage: s = lambda t: sum(i^2 for i in t) - sage: for ij in Subsets(Subsets(45000, 15).random_element(), 2): # optional - sage.combinat + sage: for ij in Subsets(Subsets(45000, 15).random_element(), 2): # needs sage.combinat ....: if s(two_squares_pyx(s(ij))) != s(ij): ....: print("hey") @@ -254,7 +254,7 @@ def three_squares_pyx(uint32_t n): TESTS:: sage: s = lambda t: sum(i^2 for i in t) - sage: for ijk in Subsets(Subsets(35000,15).random_element(),3): # optional - sage.combinat + sage: for ijk in Subsets(Subsets(35000,15).random_element(),3): # needs sage.combinat ....: if s(three_squares_pyx(s(ijk))) != s(ijk): ....: print("hey") """ From d35d2bac39aa9ce5ddb3c179296cb0cb38770c8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Tue, 29 Aug 2023 07:43:50 +0200 Subject: [PATCH 339/423] fix details --- src/sage/geometry/hyperplane_arrangement/library.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sage/geometry/hyperplane_arrangement/library.py b/src/sage/geometry/hyperplane_arrangement/library.py index 916e08791b3..017f4ecdb8b 100644 --- a/src/sage/geometry/hyperplane_arrangement/library.py +++ b/src/sage/geometry/hyperplane_arrangement/library.py @@ -233,7 +233,7 @@ def coordinate(self, n, K=QQ, names=None): x = H.gens() return H(x) - def Coxeter(self, data, K=QQ, names=None, m=1): + def Coxeter(self, data, K=QQ, names=None): r""" Return the Coxeter arrangement. @@ -270,10 +270,10 @@ def Coxeter(self, data, K=QQ, names=None, m=1): sage: # needs sage.combinat sage: hyperplane_arrangements.Coxeter(4) Arrangement of 6 hyperplanes of dimension 4 and rank 3 - sage: hyperplane_arrangements.Shi("B4") - Arrangement of 32 hyperplanes of dimension 4 and rank 4 - sage: hyperplane_arrangements.Shi("A3", m=2) - Arrangement of 24 hyperplanes of dimension 4 and rank 3 + sage: hyperplane_arrangements.Coxeter("B4") + Arrangement of 16 hyperplanes of dimension 4 and rank 4 + sage: hyperplane_arrangements.Coxeter("A3") + Arrangement of 6 hyperplanes of dimension 4 and rank 3 If the Cartan type is not crystallographic, the Coxeter arrangement is not implemented yet:: From 95cd4091f5215cafe3ee57524198d3d29aeb1125 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 29 Aug 2023 09:21:13 -0700 Subject: [PATCH 340/423] sage.rings: Use more block tags --- src/sage/rings/morphism.pyx | 24 ++++++++----------- .../number_field/number_field_element.pyx | 17 ++++++------- src/sage/rings/qqbar.py | 21 ++++++++-------- src/sage/rings/quotient_ring.py | 20 +++++++++------- 4 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/sage/rings/morphism.pyx b/src/sage/rings/morphism.pyx index 8f7c0176ccb..797445e78eb 100644 --- a/src/sage/rings/morphism.pyx +++ b/src/sage/rings/morphism.pyx @@ -109,26 +109,25 @@ A map from a multivariate polynomial ring to itself:: An endomorphism of a quotient of a multi-variate polynomial ring:: - sage; # needs sage.libs.singular + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ) - sage: S. = quo(R, ideal(1 + y^2)) # needs sage.libs.singular - sage: phi = S.hom([a^2, -b]) # needs sage.libs.singular - sage: phi # needs sage.libs.singular + sage: S. = quo(R, ideal(1 + y^2)) + sage: phi = S.hom([a^2, -b]) + sage: phi Ring endomorphism of Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (y^2 + 1) Defn: a |--> a^2 b |--> -b - sage: phi(b) # needs sage.libs.singular + sage: phi(b) -b - sage: phi(a^2 + b^2) # needs sage.libs.singular + sage: phi(a^2 + b^2) a^4 - 1 The reduction map from the integers to the integers modulo 8, viewed as a quotient ring:: sage: R = ZZ.quo(8*ZZ) - sage: pi = R.cover() - sage: pi + sage: pi = R.cover(); pi Ring morphism: From: Integer Ring To: Ring of integers modulo 8 @@ -239,7 +238,6 @@ Endomorphism of power series ring:: Frobenius on a power series ring over a finite field:: - sage: # needs sage.rings.finite_rings sage: R. = PowerSeriesRing(GF(5)) sage: f = R.hom([t^5]); f Ring endomorphism of Power Series Ring in t over Finite Field of size 5 @@ -323,7 +321,7 @@ Embedding a number field into the reals:: An example from Jim Carlson:: - sage: K = QQ # by the way :-) + sage: K = QQ # by the way :-) sage: R. = K[]; R Multivariate Polynomial Ring in a, b, c, d over Rational Field sage: S. = K[]; S @@ -336,9 +334,9 @@ An example from Jim Carlson:: b |--> 0 c |--> 0 d |--> u - sage: f(a+b+c+d) + sage: f(a + b + c + d) u - sage: f( (a+b+c+d)^2 ) + sage: f((a+b+c+d)^2) u^2 TESTS:: @@ -369,8 +367,6 @@ compare equal:: sage: R. = k[] sage: F4. = R.quo(x^2+x+1) sage: H = End(F4) - - sage: # needs sage.rings.finite_rings sage: from sage.rings.morphism import * sage: phi1 = H.identity(); phi1 Identity endomorphism of Univariate Quotient Polynomial Ring in a diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx index a5c56f7f39d..1a405e705bc 100644 --- a/src/sage/rings/number_field/number_field_element.pyx +++ b/src/sage/rings/number_field/number_field_element.pyx @@ -2941,24 +2941,25 @@ cdef class NumberFieldElement(NumberFieldElement_base): EXAMPLES:: + sage: # needs sage.symbolic sage: K. = QuadraticField(2) - sage: SR(a) # indirect doctest # needs sage.symbolic + sage: SR(a) # indirect doctest sqrt(2) - sage: SR(3*a-5) # indirect doctest # needs sage.symbolic + sage: SR(3*a - 5) # indirect doctest 3*sqrt(2) - 5 sage: K. = QuadraticField(2, embedding=-1.4) - sage: SR(a) # indirect doctest # needs sage.symbolic + sage: SR(a) # indirect doctest -sqrt(2) sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 - 2) - sage: SR(a) # indirect doctest # needs sage.symbolic + sage: SR(a) # indirect doctest Traceback (most recent call last): ... TypeError: an embedding into RR or CC must be specified Now a more complicated example:: - sage: K. = NumberField(x^3 + x - 1, embedding=0.68) + sage: K. = NumberField(x^3 + x - 1, embedding=0.68) # needs sage.symbolic sage: b = SR(a); b # indirect doctest # needs sage.symbolic (1/18*sqrt(31)*sqrt(3) + 1/2)^(1/3) - 1/3/(1/18*sqrt(31)*sqrt(3) + 1/2)^(1/3) sage: (b^3 + b - 1).canonicalize_radical() # needs sage.symbolic @@ -2989,20 +2990,20 @@ cdef class NumberFieldElement(NumberFieldElement_base): embedded into the symbolic ring, which will usually get printed as a numerical approximation:: - sage: K. = NumberField(x^5-x+1, embedding=-1) + sage: K. = NumberField(x^5-x+1, embedding=-1) # needs sage.symbolic sage: SR(a) # needs sage.symbolic -1.167303978261419? :: - sage: K. = NumberField(x^6-x^3-1, embedding=1) + sage: K. = NumberField(x^6-x^3-1, embedding=1) # needs sage.symbolic sage: SR(a) # needs sage.symbolic (1/2*sqrt(5) + 1/2)^(1/3) In this field, general elements cannot be written in terms of radicals, but particular elements might be:: - sage: K. = NumberField(x^10 + 6*x^6 + 9*x^2 + 1, embedding=CC(0.332*I)) + sage: K. = NumberField(x^10 + 6*x^6 + 9*x^2 + 1, embedding=CC(0.332*I)) # needs sage.symbolic sage: SR(a) # needs sage.symbolic 0.3319890295845093?*I sage: SR(a^5+3*a) # needs sage.symbolic diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py index 4be1f45c1e2..ed3b1071b04 100644 --- a/src/sage/rings/qqbar.py +++ b/src/sage/rings/qqbar.py @@ -2582,29 +2582,29 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal [(361/29286*a^5 - 19/3254*a^4 - 14359/29286*a^3 + 401/29286*a^2 + 18183/1627*a + 15930/1627, 1), (49/117144*a^5 - 179/39048*a^4 - 3247/117144*a^3 + 22553/117144*a^2 + 1744/4881*a - 17195/6508, 1), (-1493/117144*a^5 + 407/39048*a^4 + 60683/117144*a^3 - 24157/117144*a^2 - 56293/4881*a - 53033/6508, 1)] - sage: rt2 = AA(sqrt(2)); rt2 # needs sage.symbolic + + sage: # needs sage.symbolic + sage: rt2 = AA(sqrt(2)); rt2 1.414213562373095? - sage: rt3 = AA(sqrt(3)); rt3 # needs sage.symbolic + sage: rt3 = AA(sqrt(3)); rt3 1.732050807568878? - sage: rt3a = QQbar(sqrt(3)); rt3a # needs sage.symbolic + sage: rt3a = QQbar(sqrt(3)); rt3a 1.732050807568878? sage: qqI = QQbar.zeta(4); qqI I sage: z3 = QQbar.zeta(3); z3 -0.500000000000000? + 0.866025403784439?*I - sage: rt2b = rt3 + rt2 - rt3; rt2b # needs sage.symbolic + sage: rt2b = rt3 + rt2 - rt3; rt2b 1.414213562373095? - sage: rt2c = z3 + rt2 - z3; rt2c # needs sage.symbolic + sage: rt2c = z3 + rt2 - z3; rt2c 1.414213562373095? + 0.?e-19*I - - sage: number_field_elements_from_algebraics(rt2) # needs sage.symbolic + sage: number_field_elements_from_algebraics(rt2) (Number Field in a with defining polynomial y^2 - 2, a, Ring morphism: From: Number Field in a with defining polynomial y^2 - 2 To: Algebraic Real Field Defn: a |--> 1.414213562373095?) - - sage: number_field_elements_from_algebraics((rt2,rt3)) # needs sage.symbolic + sage: number_field_elements_from_algebraics((rt2,rt3)) (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, [-a^3 + 3*a, a^2 - 2], Ring morphism: From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1 @@ -2725,7 +2725,8 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal [a^10 - 5*a^5 + 2, -a^8 + 4*a^3] sage: hom Ring morphism: - From: Number Field in a with defining polynomial y^15 - 9*y^10 + 21*y^5 - 3 with a = 0.6866813218928813? + From: Number Field in a with defining polynomial y^15 - 9*y^10 + 21*y^5 - 3 + with a = 0.6866813218928813? To: Algebraic Real Field Defn: a |--> 0.6866813218928813? diff --git a/src/sage/rings/quotient_ring.py b/src/sage/rings/quotient_ring.py index d2c3d160518..7bdcee92a11 100644 --- a/src/sage/rings/quotient_ring.py +++ b/src/sage/rings/quotient_ring.py @@ -898,11 +898,11 @@ def is_integral_domain(self, proof=True): EXAMPLES:: sage: R. = QQ[] - sage: R.quo(x^2 - y).is_integral_domain() # needs sage.singular + sage: R.quo(x^2 - y).is_integral_domain() # needs sage.libs.singular True - sage: R.quo(x^2 - y^2).is_integral_domain() # needs sage.singular + sage: R.quo(x^2 - y^2).is_integral_domain() # needs sage.libs.singular False - sage: R.quo(x^2 - y^2).is_integral_domain(proof=False) # needs sage.singular + sage: R.quo(x^2 - y^2).is_integral_domain(proof=False) # needs sage.libs.singular False sage: R. = ZZ[] sage: Q = R.quotient_ring([a, b]) @@ -1102,15 +1102,17 @@ def _coerce_map_from_(self, R): sage: R. = PolynomialRing(QQ) sage: I = R.ideal(x^2 + y^2) sage: J = R.ideal(x^2 + y^2, x^3 - y) - sage: I < J # needs sage.libs.singular - True sage: S = R.quotient(I) sage: T = R.quotient(J) - sage: T.has_coerce_map_from(S) # needs sage.libs.singular + + sage: # needs sage.libs.singular + sage: I < J True - sage: S.quotient_ring(x^4 - x*y + 1).has_coerce_map_from(S) # needs sage.libs.singular + sage: T.has_coerce_map_from(S) True - sage: S.has_coerce_map_from(T) # needs sage.libs.singular + sage: S.quotient_ring(x^4 - x*y + 1).has_coerce_map_from(S) + True + sage: S.has_coerce_map_from(T) False We also allow coercions with the cover rings:: @@ -1318,7 +1320,7 @@ def _magma_init_(self, magma): sage: P. = PolynomialRing(GF(2)) sage: Q = P.quotient(sage.rings.ideal.FieldIdeal(P)) - sage: magma(Q) # optional - magma + sage: magma(Q) # indirect doctest # optional - magma Affine Algebra of rank 2 over GF(2) Graded Reverse Lexicographical Order Variables: x, y From e384b4751f76b6d3b2f28108ad44996a0963e093 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 29 Aug 2023 11:22:46 -0700 Subject: [PATCH 341/423] sage.rings: Use more block tags --- src/sage/rings/function_field/constructor.py | 15 +- src/sage/rings/function_field/maps.py | 294 +++++++++--------- .../number_field/number_field_element.pyx | 2 +- src/sage/rings/quotient_ring.py | 4 +- src/sage/rings/rational.pyx | 19 +- src/sage/rings/real_mpfr.pyx | 18 +- src/sage/rings/ring_extension.pyx | 20 +- src/sage/rings/ring_extension_element.pyx | 11 +- 8 files changed, 205 insertions(+), 178 deletions(-) diff --git a/src/sage/rings/function_field/constructor.py b/src/sage/rings/function_field/constructor.py index d1c63011d3c..7063eb6acff 100644 --- a/src/sage/rings/function_field/constructor.py +++ b/src/sage/rings/function_field/constructor.py @@ -132,7 +132,7 @@ class FunctionFieldExtensionFactory(UniqueFactory): EXAMPLES:: sage: K. = FunctionField(QQ) - sage: R.=K[] + sage: R. = K[] sage: y2 = y*1 sage: y2 is y False @@ -156,14 +156,15 @@ def create_key(self,polynomial,names): Verify that :trac:`16530` has been resolved:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - x) # needs sage.rings.function_field - sage: R. = L[] # needs sage.rings.function_field - sage: M. = L.extension(z - 1) # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x) + sage: R. = L[] + sage: M. = L.extension(z - 1) sage: R. = K[] - sage: N. = K.extension(z - 1) # needs sage.rings.function_field - sage: M is N # needs sage.rings.function_field + sage: N. = K.extension(z - 1) + sage: M is N False """ @@ -182,7 +183,7 @@ def create_object(self,version,key,**extra_args): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(x - y^2) # indirect doctest # needs sage.rings.function_field + sage: L. = K.extension(x - y^2) # indirect doctest # needs sage.rings.function_field sage: y2 = y*1 sage: M. = K.extension(x - y2^2) # indirect doctest # needs sage.rings.function_field sage: L is M # needs sage.rings.function_field diff --git a/src/sage/rings/function_field/maps.py b/src/sage/rings/function_field/maps.py index 223112c9ae8..85377f1c894 100644 --- a/src/sage/rings/function_field/maps.py +++ b/src/sage/rings/function_field/maps.py @@ -9,17 +9,19 @@ sage: K.hom(1/x) Function Field endomorphism of Rational function field in x over Rational Field Defn: x |--> 1/x - sage: L. = K.extension(y^2 - x) # needs sage.rings.function_field - sage: K.hom(y) # needs sage.rings.function_field + + sage: # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x) + sage: K.hom(y) Function Field morphism: From: Rational function field in x over Rational Field To: Function field in y defined by y^2 - x Defn: x |--> y - sage: L.hom([y,x]) # needs sage.rings.function_field + sage: L.hom([y,x]) Function Field endomorphism of Function field in y defined by y^2 - x Defn: y |--> y x |--> x - sage: L.hom([x,y]) # needs sage.rings.function_field + sage: L.hom([x,y]) Traceback (most recent call last): ... ValueError: invalid morphism @@ -71,10 +73,11 @@ class FunctionFieldVectorSpaceIsomorphism(Morphism): EXAMPLES:: + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field - sage: isinstance(f, sage.rings.function_field.maps.FunctionFieldVectorSpaceIsomorphism) # needs sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) + sage: V, f, t = L.vector_space() + sage: isinstance(f, sage.rings.function_field.maps.FunctionFieldVectorSpaceIsomorphism) True """ def _repr_(self) -> str: @@ -83,14 +86,15 @@ def _repr_(self) -> str: EXAMPLES:: + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field - sage: f # needs sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) + sage: V, f, t = L.vector_space() + sage: f Isomorphism: From: Vector space of dimension 2 over Rational function field in x over Rational Field To: Function field in y defined by y^2 - x*y + 4*x^3 - sage: t # needs sage.modules sage.rings.function_field + sage: t Isomorphism: From: Function field in y defined by y^2 - x*y + 4*x^3 To: Vector space of dimension 2 over Rational function field in x over Rational Field @@ -106,10 +110,11 @@ def is_injective(self) -> bool: EXAMPLES:: + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field - sage: f.is_injective() # needs sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) + sage: V, f, t = L.vector_space() + sage: f.is_injective() True """ return True @@ -120,10 +125,11 @@ def is_surjective(self) -> bool: EXAMPLES:: + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field - sage: f.is_surjective() # needs sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) + sage: V, f, t = L.vector_space() + sage: f.is_surjective() True """ return True @@ -143,15 +149,15 @@ def _richcmp_(self, other, op): sage: K = QQ['x'].fraction_field() sage: L = K.function_field() sage: f = K.coerce_map_from(L) + sage: f == f + True - sage: K = QQbar['x'].fraction_field() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K = QQbar['x'].fraction_field() sage: L = K.function_field() sage: g = K.coerce_map_from(L) - - sage: f == g # needs sage.rings.number_field + sage: f == g False - sage: f == f - True """ if type(self) is not type(other): @@ -186,9 +192,10 @@ class MapVectorSpaceToFunctionField(FunctionFieldVectorSpaceIsomorphism): EXAMPLES:: + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: V, f, t = L.vector_space(); f # needs sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) + sage: V, f, t = L.vector_space(); f Isomorphism: From: Vector space of dimension 2 over Rational function field in x over Rational Field To: Function field in y defined by y^2 - x*y + 4*x^3 @@ -197,9 +204,10 @@ def __init__(self, V, K): """ EXAMPLES:: + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: V, f, t = L.vector_space(); type(f) # needs sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) + sage: V, f, t = L.vector_space(); type(f) """ self._V = V @@ -217,20 +225,22 @@ def _call_(self, v): EXAMPLES:: + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field - sage: f(x*V.0 + (1/x^3)*V.1) # indirect doctest # needs sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) + sage: V, f, t = L.vector_space() + sage: f(x*V.0 + (1/x^3)*V.1) # indirect doctest 1/x^3*y + x TESTS: Test that this map is a bijection for some random inputs:: - sage: R. = L[] # needs sage.rings.function_field - sage: M. = L.extension(z^3 - y - x) # needs sage.rings.function_field - sage: for F in [K, L, M]: # needs sage.modules sage.rings.function_field + sage: # needs sage.modules sage.rings.function_field + sage: R. = L[] + sage: M. = L.extension(z^3 - y - x) + sage: for F in [K, L, M]: ....: for base in F._intermediate_fields(K): ....: V, f, t = F.vector_space(base) ....: for i in range(100): @@ -261,10 +271,11 @@ def domain(self): EXAMPLES:: + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field - sage: f.domain() # needs sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) + sage: V, f, t = L.vector_space() + sage: f.domain() Vector space of dimension 2 over Rational function field in x over Rational Field """ return self._V @@ -275,10 +286,11 @@ def codomain(self): EXAMPLES:: + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field - sage: f.codomain() # needs sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) + sage: V, f, t = L.vector_space() + sage: f.codomain() Function field in y defined by y^2 - x*y + 4*x^3 """ return self._K @@ -290,9 +302,10 @@ class MapFunctionFieldToVectorSpace(FunctionFieldVectorSpaceIsomorphism): EXAMPLES:: + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: V, f, t = L.vector_space(); t # needs sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) + sage: V, f, t = L.vector_space(); t Isomorphism: From: Function field in y defined by y^2 - x*y + 4*x^3 To: Vector space of dimension 2 over Rational function field in x over Rational Field @@ -309,10 +322,11 @@ def __init__(self, K, V): EXAMPLES:: + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field - sage: TestSuite(t).run(skip="_test_category") # needs sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) + sage: V, f, t = L.vector_space() + sage: TestSuite(t).run(skip="_test_category") """ self._V = V self._K = K @@ -326,19 +340,21 @@ def _call_(self, x): EXAMPLES:: + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field - sage: t(x + (1/x^3)*y) # indirect doctest # needs sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) + sage: V, f, t = L.vector_space() + sage: t(x + (1/x^3)*y) # indirect doctest (x, 1/x^3) TESTS: Test that this map is a bijection for some random inputs:: - sage: R. = L[] # needs sage.rings.function_field - sage: M. = L.extension(z^3 - y - x) # needs sage.rings.function_field - sage: for F in [K, L, M]: # needs sage.modules sage.rings.function_field + sage: # needs sage.modules sage.rings.function_field + sage: R. = L[] + sage: M. = L.extension(z^3 - y - x) + sage: for F in [K, L, M]: ....: for base in F._intermediate_fields(K): ....: V, f, t = F.vector_space(base) ....: for i in range(100): @@ -391,11 +407,11 @@ def _repr_type(self) -> str: EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^3 + 6*x^3 + x) # needs sage.rings.function_field - sage: f = L.hom(y*2) # needs sage.rings.function_field - sage: f._repr_type() # needs sage.rings.function_field + sage: L. = K.extension(y^3 + 6*x^3 + x) + sage: f = L.hom(y*2) + sage: f._repr_type() 'Function Field' """ return "Function Field" @@ -406,11 +422,11 @@ def _repr_defn(self) -> str: EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^3 + 6*x^3 + x) # needs sage.rings.function_field - sage: f = L.hom(y*2) # needs sage.rings.function_field - sage: f._repr_defn() # needs sage.rings.function_field + sage: L. = K.extension(y^3 + 6*x^3 + x) + sage: f = L.hom(y*2) + sage: f._repr_defn() 'y |--> 2*y' """ a = '%s |--> %s' % (self.domain().variable_name(), self._im_gen) @@ -425,15 +441,15 @@ class FunctionFieldMorphism_polymod(FunctionFieldMorphism): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^3 + 6*x^3 + x) # needs sage.rings.function_field - sage: f = L.hom(y*2); f # needs sage.rings.function_field + sage: L. = K.extension(y^3 + 6*x^3 + x) + sage: f = L.hom(y*2); f Function Field endomorphism of Function field in y defined by y^3 + 6*x^3 + x Defn: y |--> 2*y - sage: factor(L.polynomial()) # needs sage.rings.function_field + sage: factor(L.polynomial()) y^3 + 6*x^3 + x - sage: f(y).charpoly('y') # needs sage.rings.function_field + sage: f(y).charpoly('y') y^3 + 6*x^3 + x """ def __init__(self, parent, im_gen, base_morphism): @@ -442,11 +458,11 @@ def __init__(self, parent, im_gen, base_morphism): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^3 + 6*x^3 + x) # needs sage.rings.function_field - sage: f = L.hom(y*2) # needs sage.rings.function_field - sage: TestSuite(f).run(skip="_test_category") # needs sage.rings.function_field + sage: L. = K.extension(y^3 + 6*x^3 + x) + sage: f = L.hom(y*2) + sage: TestSuite(f).run(skip="_test_category") """ FunctionFieldMorphism.__init__(self, parent, im_gen, base_morphism) # Verify that the morphism is valid: @@ -462,12 +478,12 @@ def _call_(self, x): """ EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^3 + 6*x^3 + x); f = L.hom(y*2) # needs sage.rings.function_field - sage: f(y/x + x^2/(x+1)) # indirect doctest # needs sage.rings.function_field + sage: L. = K.extension(y^3 + 6*x^3 + x); f = L.hom(y*2) + sage: f(y/x + x^2/(x+1)) # indirect doctest 2/x*y + x^2/(x + 1) - sage: f(y) # needs sage.rings.function_field + sage: f(y) 2*y """ v = x.list() @@ -503,7 +519,7 @@ def _call_(self, x): sage: f = K.hom(1/x); f Function Field endomorphism of Rational function field in x over Finite Field of size 7 Defn: x |--> 1/x - sage: f(x+1) # indirect doctest + sage: f(x + 1) # indirect doctest (x + 1)/x sage: 1/x + 1 (x + 1)/x @@ -569,7 +585,7 @@ def _repr_type(self) -> str: EXAMPLES:: sage: K. = FunctionField(QQ) - sage: QQ.convert_map_from(K) # indirect doctest + sage: QQ.convert_map_from(K) # indirect doctest Conversion map: From: Rational function field in x over Rational Field To: Rational Field @@ -724,23 +740,23 @@ class FunctionFieldCompletion(Map): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: p = L.places_finite()[0] # needs sage.rings.function_field - sage: m = L.completion(p) # needs sage.rings.function_field - sage: m # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: p = L.places_finite()[0] + sage: m = L.completion(p) + sage: m Completion map: From: Function field in y defined by y^2 + y + (x^2 + 1)/x To: Laurent Series Ring in s over Finite Field of size 2 - sage: m(x) # needs sage.rings.function_field + sage: m(x) s^2 + s^3 + s^4 + s^5 + s^7 + s^8 + s^9 + s^10 + s^12 + s^13 + s^15 + s^16 + s^17 + s^19 + O(s^22) - sage: m(y) # needs sage.rings.function_field + sage: m(y) s^-1 + 1 + s^3 + s^5 + s^7 + s^9 + s^13 + s^15 + s^17 + O(s^19) - sage: m(x*y) == m(x) * m(y) # needs sage.rings.function_field + sage: m(x*y) == m(x) * m(y) True - sage: m(x+y) == m(x) + m(y) # needs sage.rings.function_field + sage: m(x+y) == m(x) + m(y) True The variable name of the series can be supplied. If the place is not @@ -764,12 +780,12 @@ def __init__(self, field, place, name=None, prec=None, gen_name=None): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: p = L.places_finite()[0] # needs sage.rings.function_field - sage: m = L.completion(p) # needs sage.rings.function_field - sage: m # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: p = L.places_finite()[0] + sage: m = L.completion(p) + sage: m Completion map: From: Function field in y defined by y^2 + y + (x^2 + 1)/x To: Laurent Series Ring in s over Finite Field of size 2 @@ -803,12 +819,12 @@ def _repr_type(self) -> str: EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: p = L.places_finite()[0] # needs sage.rings.function_field - sage: m = L.completion(p) # needs sage.rings.function_field - sage: m # indirect doctest # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: p = L.places_finite()[0] + sage: m = L.completion(p) + sage: m # indirect doctest Completion map: From: Function field in y defined by y^2 + y + (x^2 + 1)/x To: Laurent Series Ring in s over Finite Field of size 2 @@ -821,12 +837,12 @@ def _call_(self, f): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: p = L.places_finite()[0] # needs sage.rings.function_field - sage: m = L.completion(p) # needs sage.rings.function_field - sage: m(y) # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: p = L.places_finite()[0] + sage: m = L.completion(p) + sage: m(y) s^-1 + 1 + s^3 + s^5 + s^7 + s^9 + s^13 + s^15 + s^17 + O(s^19) """ if self._precision == infinity: @@ -840,12 +856,12 @@ def _call_with_args(self, f, args, kwds): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: p = L.places_finite()[0] # needs sage.rings.function_field - sage: m = L.completion(p) # needs sage.rings.function_field - sage: m(x+y, 10) # indirect doctest # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: p = L.places_finite()[0] + sage: m = L.completion(p) + sage: m(x+y, 10) # indirect doctest s^-1 + 1 + s^2 + s^4 + s^8 + O(s^9) """ if self._precision == infinity: @@ -865,12 +881,12 @@ def _expand(self, f, prec=None): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: p = L.places_finite()[0] # needs sage.rings.function_field - sage: m = L.completion(p) # needs sage.rings.function_field - sage: m(x, prec=20) # indirect doctest # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: p = L.places_finite()[0] + sage: m = L.completion(p) + sage: m(x, prec=20) # indirect doctest s^2 + s^3 + s^4 + s^5 + s^7 + s^8 + s^9 + s^10 + s^12 + s^13 + s^15 + s^16 + s^17 + s^19 + O(s^22) """ @@ -900,16 +916,16 @@ def _expand_lazy(self, f): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: p = L.places_finite()[0] # needs sage.rings.function_field - sage: m = L.completion(p, prec=infinity) # needs sage.rings.function_field - sage: e = m(x); e # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: p = L.places_finite()[0] + sage: m = L.completion(p, prec=infinity) + sage: e = m(x); e s^2 + s^3 + s^4 + s^5 + s^7 + s^8 + ... - sage: e.coefficient(99) # indirect doctest # needs sage.rings.function_field + sage: e.coefficient(99) # indirect doctest 0 - sage: e.coefficient(100) # needs sage.rings.function_field + sage: e.coefficient(100) 1 """ place = self._place @@ -933,12 +949,12 @@ def default_precision(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: p = L.places_finite()[0] # needs sage.rings.function_field - sage: m = L.completion(p) # needs sage.rings.function_field - sage: m.default_precision() # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: p = L.places_finite()[0] + sage: m = L.completion(p) + sage: m.default_precision() 20 """ return self._precision @@ -954,15 +970,15 @@ def _repr_(self) -> str: EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: p = L.places_finite()[0] # needs sage.rings.function_field - sage: R = p.valuation_ring() # needs sage.rings.function_field - sage: k, fr_k, to_k = R.residue_field() # needs sage.rings.function_field - sage: k # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: p = L.places_finite()[0] + sage: R = p.valuation_ring() + sage: k, fr_k, to_k = R.residue_field() + sage: k Finite Field of size 2 - sage: fr_k # needs sage.rings.function_field + sage: fr_k Ring morphism: From: Finite Field of size 2 To: Valuation ring at Place (x, x*y) @@ -983,14 +999,14 @@ def _repr_(self) -> str: EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(5)); R. = PolynomialRing(K) - sage: F. = K.extension(t^2-x^3-1) # needs sage.rings.function_field - sage: O = F.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(x - 2) # needs sage.rings.function_field - sage: D = I.divisor() # needs sage.rings.function_field - sage: V, from_V, to_V = D.function_space() # needs sage.rings.function_field - sage: from_V # needs sage.rings.function_field + sage: F. = K.extension(t^2-x^3-1) + sage: O = F.maximal_order() + sage: I = O.ideal(x - 2) + sage: D = I.divisor() + sage: V, from_V, to_V = D.function_space() + sage: from_V Linear map: From: Vector space of dimension 2 over Finite Field of size 5 To: Function field in y defined by y^2 + 4*x^3 + 4 @@ -1011,14 +1027,14 @@ def _repr_(self) -> str: EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(5)); R. = PolynomialRing(K) - sage: F. = K.extension(t^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = F.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(x - 2) # needs sage.rings.function_field - sage: D = I.divisor() # needs sage.rings.function_field - sage: V, from_V, to_V = D.function_space() # needs sage.rings.function_field - sage: to_V # needs sage.rings.function_field + sage: F. = K.extension(t^2 - x^3 - 1) + sage: O = F.maximal_order() + sage: I = O.ideal(x - 2) + sage: D = I.divisor() + sage: V, from_V, to_V = D.function_space() + sage: to_V Section of linear map: From: Function field in y defined by y^2 + 4*x^3 + 4 To: Vector space of dimension 2 over Finite Field of size 5 diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx index 1a405e705bc..4cf97ff4efd 100644 --- a/src/sage/rings/number_field/number_field_element.pyx +++ b/src/sage/rings/number_field/number_field_element.pyx @@ -2967,7 +2967,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): Make sure we got the right one:: - sage: CC(a) + sage: CC(a) # needs sage.symbolic 0.682327803828019 sage: CC(b) # needs sage.symbolic 0.682327803828019 diff --git a/src/sage/rings/quotient_ring.py b/src/sage/rings/quotient_ring.py index 7bdcee92a11..1b3086aaab8 100644 --- a/src/sage/rings/quotient_ring.py +++ b/src/sage/rings/quotient_ring.py @@ -728,7 +728,7 @@ def lifting_map(self): Test that there also is a lift for rings that are no instances of :class:`~sage.rings.ring.Ring` (see :trac:`11068`):: - sage: # needs sage.modules sage.rings.finite_rings + sage: # needs sage.modules sage: MS = MatrixSpace(GF(5), 2, 2) sage: I = MS * [MS.0*MS.1, MS.2 + MS.3] * MS sage: Q = MS.quo(I) @@ -1085,7 +1085,7 @@ def _coerce_map_from_(self, R): sage: R. = PolynomialRing(QQ) sage: S = R.quotient_ring(x^2 + y^2) - sage: S.has_coerce_map_from(R) # indirect doctest + sage: S.has_coerce_map_from(R) # indirect doctest True sage: S.has_coerce_map_from(QQ) True diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx index 39d69e76d33..f8843a2cee7 100644 --- a/src/sage/rings/rational.pyx +++ b/src/sage/rings/rational.pyx @@ -1915,24 +1915,27 @@ cdef class Rational(sage.structure.element.FieldElement): sage: n = 2/3 sage: n.sqrt() # needs sage.symbolic sqrt(2/3) - sage: n.sqrt(prec=10) # needs sage.rings.real_mpfr + + sage: # needs sage.rings.real_mpfr + sage: n.sqrt(prec=10) 0.82 - sage: n.sqrt(prec=100) # needs sage.rings.real_mpfr + sage: n.sqrt(prec=100) 0.81649658092772603273242802490 - sage: n.sqrt(prec=100)^2 # needs sage.rings.real_mpfr + sage: n.sqrt(prec=100)^2 0.66666666666666666666666666667 - sage: n.sqrt(prec=53, all=True) # needs sage.rings.real_mpfr + sage: n.sqrt(prec=53, all=True) [0.816496580927726, -0.816496580927726] + sage: sqrt(-2/3, prec=53) + 0.816496580927726*I + sage: sqrt(-2/3, prec=53, all=True) + [0.816496580927726*I, -0.816496580927726*I] + sage: n.sqrt(extend=False, all=True) Traceback (most recent call last): ... ValueError: square root of 2/3 not a rational number sage: sqrt(-2/3, all=True) # needs sage.symbolic [sqrt(-2/3), -sqrt(-2/3)] - sage: sqrt(-2/3, prec=53) # needs sage.rings.real_mpfr - 0.816496580927726*I - sage: sqrt(-2/3, prec=53, all=True) # needs sage.rings.real_mpfr - [0.816496580927726*I, -0.816496580927726*I] AUTHORS: diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index 1d1143c5548..6b00131c21c 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -3297,12 +3297,13 @@ cdef class RealNumber(sage.structure.element.RingElement): EXAMPLES:: + sage: # needs sage.symbolic sage: R = RealField(100) - sage: R(pi) # needs sage.symbolic + sage: R(pi) 3.1415926535897932384626433833 - sage: axiom(R(pi)) # optional - axiom # needs sage.symbolic + sage: axiom(R(pi)) # indirect doctest # optional - axiom 3.1415926535 8979323846 26433833 - sage: fricas(R(pi)) # optional - fricas # needs sage.symbolic + sage: fricas(R(pi)) # optional - fricas 3.1415926535_8979323846_26433833 """ @@ -3791,14 +3792,17 @@ cdef class RealNumber(sage.structure.element.RingElement): -333/1000 sage: RR(3/4).nearby_rational(max_denominator=2) 1 - sage: RR(pi).nearby_rational(max_denominator=120) # needs sage.symbolic + + sage: # needs sage.symbolic + sage: RR(pi).nearby_rational(max_denominator=120) 355/113 - sage: RR(pi).nearby_rational(max_denominator=10000) # needs sage.symbolic + sage: RR(pi).nearby_rational(max_denominator=10000) 355/113 - sage: RR(pi).nearby_rational(max_denominator=100000) # needs sage.symbolic + sage: RR(pi).nearby_rational(max_denominator=100000) 312689/99532 - sage: RR(pi).nearby_rational(max_denominator=1) # needs sage.symbolic + sage: RR(pi).nearby_rational(max_denominator=1) 3 + sage: RR(-3.5).nearby_rational(max_denominator=1) -3 diff --git a/src/sage/rings/ring_extension.pyx b/src/sage/rings/ring_extension.pyx index a1e785aaefc..f6ce2b04826 100644 --- a/src/sage/rings/ring_extension.pyx +++ b/src/sage/rings/ring_extension.pyx @@ -2174,25 +2174,27 @@ cdef class RingExtensionWithBasis(RingExtension_generic): TESTS:: + sage: # needs sage.rings.finite_rings sage: F = GF(5) - sage: K = GF(5^2).over(F) # needs sage.rings.finite_rings - sage: L = GF(5^4).over(K) # needs sage.rings.finite_rings - sage: L._print_option_base(F) is F # needs sage.rings.finite_rings + sage: K = GF(5^2).over(F) + sage: L = GF(5^4).over(K) + sage: L._print_option_base(F) is F True - sage: L._print_option_base(K) is K # needs sage.rings.finite_rings + sage: L._print_option_base(K) is K True - sage: L._print_option_base(GF(5^2)) is K # needs sage.rings.finite_rings + sage: L._print_option_base(GF(5^2)) is K True - sage: L._print_option_base(None) is K # needs sage.rings.finite_rings + sage: L._print_option_base(None) is K True - sage: L._print_option_base(L) # needs sage.rings.finite_rings + sage: L._print_option_base(L) Traceback (most recent call last): ... ValueError: base must be strict - sage: K._print_option_base(L) # needs sage.rings.finite_rings + sage: K._print_option_base(L) Traceback (most recent call last): ... - ValueError: not (explicitly) defined over Field in z4 with defining polynomial x^2 + (3 - z2)*x + z2 over its base + ValueError: not (explicitly) defined over Field in z4 + with defining polynomial x^2 + (3 - z2)*x + z2 over its base """ if 'print_elements_as' in self._print_options: diff --git a/src/sage/rings/ring_extension_element.pyx b/src/sage/rings/ring_extension_element.pyx index 694ab2a05fc..fb80ba84e6e 100644 --- a/src/sage/rings/ring_extension_element.pyx +++ b/src/sage/rings/ring_extension_element.pyx @@ -788,15 +788,16 @@ cdef class RingExtensionFractionFieldElement(RingExtensionElement): EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = ZZ[] - sage: A. = ZZ.extension(x^2 - 2) # needs sage.rings.number_field - sage: OK = A.over() # over ZZ # needs sage.rings.number_field - sage: K = OK.fraction_field(); K # needs sage.rings.number_field + sage: A. = ZZ.extension(x^2 - 2) + sage: OK = A.over() # over ZZ + sage: K = OK.fraction_field(); K Fraction Field of Order in Number Field in a with defining polynomial x^2 - 2 over its base - sage: x = K(1/a); x # needs sage.rings.number_field + sage: x = K(1/a); x a/2 - sage: denom = x.denominator(); denom # needs sage.rings.number_field + sage: denom = x.denominator(); denom 2 The denominator is an element of the ring which was used From 5adb9d7ade2ed4b3d543768e712851fab1337dc3 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 29 Aug 2023 18:00:58 -0400 Subject: [PATCH 342/423] m4/sage_spkg_configure.m4: reduce python package ./configure noise When --enable-system-site-packages is not given, the associated ./configure checks short-circuit and will not detect any system packages. During this no-op it is however rather vociferous: ## ---------------------------------------------------------- ## ## Checking whether SageMath should install SPKG alabaster... ## ## ---------------------------------------------------------- ## configure:18401: checking if --enable-system-site-packages was used configure:18457: result: no; skipping check configure:18487: no suitable system package found for SPKG alabaster This commit redirects the output from ./configure to hide those messages in the absence of --enable-system-site-packages. They are hidden only from the console; config.log retains everything for debugging purposes. --- m4/sage_spkg_configure.m4 | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/m4/sage_spkg_configure.m4 b/m4/sage_spkg_configure.m4 index a0eeaa53a74..1f07d7cd294 100644 --- a/m4/sage_spkg_configure.m4 +++ b/m4/sage_spkg_configure.m4 @@ -58,6 +58,31 @@ dnl indicate why m4_pushdef([SPKG_USE_SYSTEM], [sage_use_system_]SPKG_NAME) # BEGIN SAGE_SPKG_CONFIGURE_]m4_toupper($1)[ +dnl Hide the output from Python (system site package) checks +dnl when --enable-system-site-packages was not given. This +dnl doesn't affect the test results but it minimizes the noise +dnl in the ./configure output. The config.log however retains +dnl everything. +dnl +dnl Open descriptor 9 as a copy of AS_MESSAGE_FD, so that it +dnl can later be used to restore AS_MESSAGE_FD. Afterwards, +dnl send AS_MESSAGE_FD to /dev/null. We'll restore it if this +dnl isn't a python package or if --enable-system-site-packages +dnl was given (or at the end of this macro, if nothing else). +exec 9<&AS_MESSAGE_FD +exec AS_MESSAGE_FD>/dev/null + +AS_IF([test "${enable_system_site_packages}" = "yes"], [ + dnl Python package checks are enabled, so restore AS_MESSAGE_FD + exec AS_MESSAGE_FD<&9 +]) + +SPKG_CONFIGURE="${SAGE_ROOT}/build/pkgs/$1/spkg-configure.m4" +AS_IF([! grep -q [SAGE_PYTHON_PACKAGE_CHECK] "${SPKG_CONFIGURE}"],[ + dnl Not a python package, so restore AS_MESSAGE_FD + exec AS_MESSAGE_FD<&9 +]) + echo "-----------------------------------------------------------------------------" >& AS_MESSAGE_FD echo "Checking whether SageMath should install SPKG $1..." >& AS_MESSAGE_FD AS_BOX([Checking whether SageMath should install SPKG $1...]) >& AS_MESSAGE_LOG_FD @@ -140,6 +165,13 @@ AS_VAR_IF(SPKG_INSTALL, [no], [ dnl Run POST $5 +dnl Restore the message file descriptor that we clobbered earlier +dnl for the sake of hiding site package check noise. It's possible +dnl that we've already done this above, but it doesn't hurt to do +dnl it again, and we want everything "back to normal" at the end +dnl of this macro. +exec AS_MESSAGE_FD<&9 + # END SAGE_SPKG_CONFIGURE_]m4_toupper($1)[ m4_popdef([SPKG_USE_SYSTEM]) m4_popdef([SPKG_REQUIRE]) From d8afc4c5123af7fd2bc24e2354b7fd69b14db4f1 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 29 Aug 2023 15:51:52 -0700 Subject: [PATCH 343/423] tox.ini (sitepackages): Use IGNORE_MISSING_SYSTEM_PACKAGES=yes --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index 94b42e39c25..0f4fb121c0d 100644 --- a/tox.ini +++ b/tox.ini @@ -609,6 +609,8 @@ setenv = # ALL_EXTRA_SAGE_PACKAGES={env:EXTRA_SAGE_PACKAGES_0:} {env:EXTRA_SAGE_PACKAGES_1:} {env:EXTRA_SAGE_PACKAGES_2:} {env:EXTRA_SAGE_PACKAGES_3:} {env:EXTRA_SAGE_PACKAGES_4:} {env:EXTRA_SAGE_PACKAGES_5:} {env:EXTRA_SAGE_PACKAGES:} + sitepackages: IGNORE_MISSING_SYSTEM_PACKAGES=yes + # environment will be skipped if regular expression does not match against the sys.platform string platform = local-macos: darwin From 30013bb97b11dfc2c0b143c80e606c1229b98874 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 29 Aug 2023 18:57:18 -0400 Subject: [PATCH 344/423] build/pkgs/setuptools_scm/distros/gentoo.txt: fix package name This was renamed from setuptools_scm to setuptools-scm in Gentoo on Fri Mar 3 2023. --- build/pkgs/setuptools_scm/distros/gentoo.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/setuptools_scm/distros/gentoo.txt b/build/pkgs/setuptools_scm/distros/gentoo.txt index 89895971525..46efc2bdeb4 100644 --- a/build/pkgs/setuptools_scm/distros/gentoo.txt +++ b/build/pkgs/setuptools_scm/distros/gentoo.txt @@ -1 +1 @@ -dev-python/setuptools_scm +dev-python/setuptools-scm From 4e40f000b702cfa0027ef39626819a97947c8240 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 29 Aug 2023 18:07:21 -0700 Subject: [PATCH 345/423] .tox, .github/workflows/ci-linux.yml: Test -standard-sitepackages --- .github/workflows/ci-linux.yml | 20 ++++++++++++++++++++ tox.ini | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 5f049741eab..e4f424380df 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -63,6 +63,26 @@ jobs: ["standard"] docker_push_repository: ghcr.io/${{ github.repository }}/ + standard-sitepackages: + if: ${{ success() || failure() }} + needs: [standard-pre] + uses: ./.github/workflows/docker.yml + with: + # Build incrementally from previous stage (pre) + incremental: true + free_disk_space: true + from_docker_repository: ghcr.io/${{ github.repository }}/ + from_docker_target: "with-targets-pre" + from_docker_tag: "$(echo $BUILD_TAG | sed s/-sitepackages//)" + docker_targets: "with-targets with-targets-optional" + # FIXME: duplicated from env.TARGETS + targets: build doc-html + targets_optional: ptest + tox_packages_factors: >- + ["standard-sitepackages"] + docker_push_repository: ghcr.io/${{ github.repository }}/ + max_parallel: 10 + minimal-pre: if: ${{ success() || failure() }} # It does not really "need" it. diff --git a/tox.ini b/tox.ini index 0f4fb121c0d..939f1b7d0f4 100644 --- a/tox.ini +++ b/tox.ini @@ -478,7 +478,8 @@ setenv = # docker: FULL_BASE_IMAGE_AND_TAG={env:ARCH_IMAGE_PREFIX:}{env:BASE_IMAGE}{env:ARCH_IMAGE_SUFFIX:}:{env:ARCH_TAG_PREFIX:}{env:BASE_TAG}{env:ARCH_TAG_SUFFIX:} docker-incremental: FULL_BASE_IMAGE_AND_TAG={env:FROM_DOCKER_REPOSITORY:ghcr.io/sagemath/sage/}sage-$(echo {envname} | sed -E "s/(docker-|-incremental)//g")-{env:FROM_DOCKER_TARGET:with-targets}:{env:FROM_DOCKER_TAG:dev} - docker-incremental: SKIP_SYSTEM_PKG_INSTALL=yes + docker-incremental: SKIP_SYSTEM_PKG_INSTALL=yes + docker-incremental-sitepackages: SKIP_SYSTEM_PKG_INSTALL=no # docker-nobootstrap: BOOTSTRAP=./bootstrap -D ### From 5ca3ac9f9da40b5fe155f5f99c48f40c61a7f3d1 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 29 Aug 2023 19:53:31 -0700 Subject: [PATCH 346/423] build/pkgs: Add distros/*.txt for some Python packages --- build/pkgs/cython/distros/arch.txt | 1 + build/pkgs/cython/distros/debian.txt | 1 + build/pkgs/cython/distros/fedora.txt | 1 + build/pkgs/cython/distros/gentoo.txt | 1 + build/pkgs/cython/distros/opensuse.txt | 1 + build/pkgs/dateutil/distros/arch.txt | 1 + build/pkgs/dateutil/distros/debian.txt | 1 + build/pkgs/dateutil/distros/fedora.txt | 1 + build/pkgs/dateutil/distros/freebsd.txt | 1 + build/pkgs/dateutil/distros/opensuse.txt | 1 + build/pkgs/importlib_metadata/distros/arch.txt | 1 + build/pkgs/importlib_metadata/distros/debian.txt | 1 + build/pkgs/importlib_metadata/distros/fedora.txt | 1 + build/pkgs/importlib_metadata/distros/freebsd.txt | 1 + build/pkgs/importlib_metadata/distros/opensuse.txt | 1 + build/pkgs/ipykernel/distros/arch.txt | 1 + build/pkgs/ipykernel/distros/debian.txt | 1 + build/pkgs/ipykernel/distros/fedora.txt | 1 + build/pkgs/ipykernel/distros/freebsd.txt | 1 + build/pkgs/ipykernel/distros/opensuse.txt | 1 + build/pkgs/ipython/distros/arch.txt | 1 + build/pkgs/ipython/distros/debian.txt | 1 + build/pkgs/ipython/distros/fedora.txt | 1 + build/pkgs/ipython/distros/freebsd.txt | 1 + build/pkgs/jsonschema/distros/arch.txt | 1 + build/pkgs/jsonschema/distros/debian.txt | 1 + build/pkgs/jsonschema/distros/fedora.txt | 1 + build/pkgs/jupyterlab_widgets/distros/arch.txt | 1 + build/pkgs/jupyterlab_widgets/distros/freebsd.txt | 1 + build/pkgs/jupyterlab_widgets/distros/opensuse.txt | 1 + build/pkgs/pexpect/distros/arch.txt | 1 + build/pkgs/pexpect/distros/fedora.txt | 1 + build/pkgs/pexpect/distros/freebsd.txt | 1 + build/pkgs/pip/distros/debian.txt | 1 + build/pkgs/pip/distros/fedora.txt | 1 + build/pkgs/pip/distros/freebsd.txt | 1 + build/pkgs/prompt_toolkit/distros/arch.txt | 1 + build/pkgs/prompt_toolkit/distros/debian.txt | 1 + build/pkgs/prompt_toolkit/distros/fedora.txt | 1 + build/pkgs/prompt_toolkit/distros/freebsd.txt | 1 + build/pkgs/prompt_toolkit/distros/opensuse.txt | 2 +- build/pkgs/ptyprocess/distros/arch.txt | 1 + build/pkgs/ptyprocess/distros/fedora.txt | 1 + build/pkgs/ptyprocess/distros/freebsd.txt | 1 + build/pkgs/pycosat/distros/alpine.txt | 1 + build/pkgs/pycosat/distros/arch.txt | 1 + build/pkgs/pycosat/distros/fedora.txt | 1 + build/pkgs/pycosat/distros/freebsd.txt | 1 + build/pkgs/pyparsing/distros/arch.txt | 1 + build/pkgs/pyparsing/distros/freebsd.txt | 1 + build/pkgs/sphinx/distros/arch.txt | 1 + build/pkgs/sphinx/distros/debian.txt | 1 + build/pkgs/sphinx/distros/fedora.txt | 1 + build/pkgs/sphinx/distros/freebsd.txt | 1 + build/pkgs/typing_extensions/distros/arch.txt | 1 + build/pkgs/typing_extensions/distros/debian.txt | 1 + build/pkgs/typing_extensions/distros/fedora.txt | 1 + build/pkgs/typing_extensions/distros/freebsd.txt | 1 + build/pkgs/typing_extensions/distros/gentoo.txt | 1 + build/pkgs/typing_extensions/distros/opensuse.txt | 1 + build/pkgs/tzlocal/distros/arch.txt | 1 + build/pkgs/tzlocal/distros/debian.txt | 1 + build/pkgs/tzlocal/distros/fedora.txt | 1 + build/pkgs/tzlocal/distros/freebsd.txt | 1 + build/pkgs/urllib3/distros/arch.txt | 1 + build/pkgs/urllib3/distros/debian.txt | 1 + build/pkgs/urllib3/distros/fedora.txt | 1 + build/pkgs/urllib3/distros/freebsd.txt | 1 + build/pkgs/urllib3/distros/opensuse.txt | 1 + 69 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 build/pkgs/cython/distros/arch.txt create mode 100644 build/pkgs/cython/distros/debian.txt create mode 100644 build/pkgs/cython/distros/fedora.txt create mode 100644 build/pkgs/cython/distros/gentoo.txt create mode 100644 build/pkgs/cython/distros/opensuse.txt create mode 100644 build/pkgs/dateutil/distros/arch.txt create mode 100644 build/pkgs/dateutil/distros/debian.txt create mode 100644 build/pkgs/dateutil/distros/fedora.txt create mode 100644 build/pkgs/dateutil/distros/freebsd.txt create mode 100644 build/pkgs/dateutil/distros/opensuse.txt create mode 100644 build/pkgs/importlib_metadata/distros/arch.txt create mode 100644 build/pkgs/importlib_metadata/distros/debian.txt create mode 100644 build/pkgs/importlib_metadata/distros/fedora.txt create mode 100644 build/pkgs/importlib_metadata/distros/freebsd.txt create mode 100644 build/pkgs/importlib_metadata/distros/opensuse.txt create mode 100644 build/pkgs/ipykernel/distros/arch.txt create mode 100644 build/pkgs/ipykernel/distros/debian.txt create mode 100644 build/pkgs/ipykernel/distros/fedora.txt create mode 100644 build/pkgs/ipykernel/distros/freebsd.txt create mode 100644 build/pkgs/ipykernel/distros/opensuse.txt create mode 100644 build/pkgs/ipython/distros/arch.txt create mode 100644 build/pkgs/ipython/distros/debian.txt create mode 100644 build/pkgs/ipython/distros/fedora.txt create mode 100644 build/pkgs/ipython/distros/freebsd.txt create mode 100644 build/pkgs/jsonschema/distros/arch.txt create mode 100644 build/pkgs/jsonschema/distros/debian.txt create mode 100644 build/pkgs/jsonschema/distros/fedora.txt create mode 100644 build/pkgs/jupyterlab_widgets/distros/arch.txt create mode 100644 build/pkgs/jupyterlab_widgets/distros/freebsd.txt create mode 100644 build/pkgs/jupyterlab_widgets/distros/opensuse.txt create mode 100644 build/pkgs/pexpect/distros/arch.txt create mode 100644 build/pkgs/pexpect/distros/fedora.txt create mode 100644 build/pkgs/pexpect/distros/freebsd.txt create mode 100644 build/pkgs/pip/distros/debian.txt create mode 100644 build/pkgs/pip/distros/fedora.txt create mode 100644 build/pkgs/pip/distros/freebsd.txt create mode 100644 build/pkgs/prompt_toolkit/distros/arch.txt create mode 100644 build/pkgs/prompt_toolkit/distros/debian.txt create mode 100644 build/pkgs/prompt_toolkit/distros/fedora.txt create mode 100644 build/pkgs/prompt_toolkit/distros/freebsd.txt create mode 100644 build/pkgs/ptyprocess/distros/arch.txt create mode 100644 build/pkgs/ptyprocess/distros/fedora.txt create mode 100644 build/pkgs/ptyprocess/distros/freebsd.txt create mode 100644 build/pkgs/pycosat/distros/alpine.txt create mode 100644 build/pkgs/pycosat/distros/arch.txt create mode 100644 build/pkgs/pycosat/distros/fedora.txt create mode 100644 build/pkgs/pycosat/distros/freebsd.txt create mode 100644 build/pkgs/pyparsing/distros/arch.txt create mode 100644 build/pkgs/pyparsing/distros/freebsd.txt create mode 100644 build/pkgs/sphinx/distros/arch.txt create mode 100644 build/pkgs/sphinx/distros/debian.txt create mode 100644 build/pkgs/sphinx/distros/fedora.txt create mode 100644 build/pkgs/sphinx/distros/freebsd.txt create mode 100644 build/pkgs/typing_extensions/distros/arch.txt create mode 100644 build/pkgs/typing_extensions/distros/debian.txt create mode 100644 build/pkgs/typing_extensions/distros/fedora.txt create mode 100644 build/pkgs/typing_extensions/distros/freebsd.txt create mode 100644 build/pkgs/typing_extensions/distros/gentoo.txt create mode 100644 build/pkgs/typing_extensions/distros/opensuse.txt create mode 100644 build/pkgs/tzlocal/distros/arch.txt create mode 100644 build/pkgs/tzlocal/distros/debian.txt create mode 100644 build/pkgs/tzlocal/distros/fedora.txt create mode 100644 build/pkgs/tzlocal/distros/freebsd.txt create mode 100644 build/pkgs/urllib3/distros/arch.txt create mode 100644 build/pkgs/urllib3/distros/debian.txt create mode 100644 build/pkgs/urllib3/distros/fedora.txt create mode 100644 build/pkgs/urllib3/distros/freebsd.txt create mode 100644 build/pkgs/urllib3/distros/opensuse.txt diff --git a/build/pkgs/cython/distros/arch.txt b/build/pkgs/cython/distros/arch.txt new file mode 100644 index 00000000000..f6629e02456 --- /dev/null +++ b/build/pkgs/cython/distros/arch.txt @@ -0,0 +1 @@ +cython diff --git a/build/pkgs/cython/distros/debian.txt b/build/pkgs/cython/distros/debian.txt new file mode 100644 index 00000000000..f6629e02456 --- /dev/null +++ b/build/pkgs/cython/distros/debian.txt @@ -0,0 +1 @@ +cython diff --git a/build/pkgs/cython/distros/fedora.txt b/build/pkgs/cython/distros/fedora.txt new file mode 100644 index 00000000000..002d1b93c6f --- /dev/null +++ b/build/pkgs/cython/distros/fedora.txt @@ -0,0 +1 @@ +Cython diff --git a/build/pkgs/cython/distros/gentoo.txt b/build/pkgs/cython/distros/gentoo.txt new file mode 100644 index 00000000000..bb1512a15ba --- /dev/null +++ b/build/pkgs/cython/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/cython diff --git a/build/pkgs/cython/distros/opensuse.txt b/build/pkgs/cython/distros/opensuse.txt new file mode 100644 index 00000000000..c6e300e6a2b --- /dev/null +++ b/build/pkgs/cython/distros/opensuse.txt @@ -0,0 +1 @@ +python-Cython diff --git a/build/pkgs/dateutil/distros/arch.txt b/build/pkgs/dateutil/distros/arch.txt new file mode 100644 index 00000000000..0f08daace31 --- /dev/null +++ b/build/pkgs/dateutil/distros/arch.txt @@ -0,0 +1 @@ +python-dateutil diff --git a/build/pkgs/dateutil/distros/debian.txt b/build/pkgs/dateutil/distros/debian.txt new file mode 100644 index 00000000000..0f08daace31 --- /dev/null +++ b/build/pkgs/dateutil/distros/debian.txt @@ -0,0 +1 @@ +python-dateutil diff --git a/build/pkgs/dateutil/distros/fedora.txt b/build/pkgs/dateutil/distros/fedora.txt new file mode 100644 index 00000000000..0f08daace31 --- /dev/null +++ b/build/pkgs/dateutil/distros/fedora.txt @@ -0,0 +1 @@ +python-dateutil diff --git a/build/pkgs/dateutil/distros/freebsd.txt b/build/pkgs/dateutil/distros/freebsd.txt new file mode 100644 index 00000000000..c336f5e0b1d --- /dev/null +++ b/build/pkgs/dateutil/distros/freebsd.txt @@ -0,0 +1 @@ +devel/py-dateutil diff --git a/build/pkgs/dateutil/distros/opensuse.txt b/build/pkgs/dateutil/distros/opensuse.txt new file mode 100644 index 00000000000..a6c93c7710a --- /dev/null +++ b/build/pkgs/dateutil/distros/opensuse.txt @@ -0,0 +1 @@ +python-python-dateutil diff --git a/build/pkgs/importlib_metadata/distros/arch.txt b/build/pkgs/importlib_metadata/distros/arch.txt new file mode 100644 index 00000000000..b3c206287ec --- /dev/null +++ b/build/pkgs/importlib_metadata/distros/arch.txt @@ -0,0 +1 @@ +python-importlib-metadata diff --git a/build/pkgs/importlib_metadata/distros/debian.txt b/build/pkgs/importlib_metadata/distros/debian.txt new file mode 100644 index 00000000000..b3c206287ec --- /dev/null +++ b/build/pkgs/importlib_metadata/distros/debian.txt @@ -0,0 +1 @@ +python-importlib-metadata diff --git a/build/pkgs/importlib_metadata/distros/fedora.txt b/build/pkgs/importlib_metadata/distros/fedora.txt new file mode 100644 index 00000000000..b3c206287ec --- /dev/null +++ b/build/pkgs/importlib_metadata/distros/fedora.txt @@ -0,0 +1 @@ +python-importlib-metadata diff --git a/build/pkgs/importlib_metadata/distros/freebsd.txt b/build/pkgs/importlib_metadata/distros/freebsd.txt new file mode 100644 index 00000000000..23518da7cff --- /dev/null +++ b/build/pkgs/importlib_metadata/distros/freebsd.txt @@ -0,0 +1 @@ +devel/py-importlib-metadata diff --git a/build/pkgs/importlib_metadata/distros/opensuse.txt b/build/pkgs/importlib_metadata/distros/opensuse.txt new file mode 100644 index 00000000000..b3c206287ec --- /dev/null +++ b/build/pkgs/importlib_metadata/distros/opensuse.txt @@ -0,0 +1 @@ +python-importlib-metadata diff --git a/build/pkgs/ipykernel/distros/arch.txt b/build/pkgs/ipykernel/distros/arch.txt new file mode 100644 index 00000000000..286458797f7 --- /dev/null +++ b/build/pkgs/ipykernel/distros/arch.txt @@ -0,0 +1 @@ +python-ipykernel diff --git a/build/pkgs/ipykernel/distros/debian.txt b/build/pkgs/ipykernel/distros/debian.txt new file mode 100644 index 00000000000..d919f6f3190 --- /dev/null +++ b/build/pkgs/ipykernel/distros/debian.txt @@ -0,0 +1 @@ +ipykernel diff --git a/build/pkgs/ipykernel/distros/fedora.txt b/build/pkgs/ipykernel/distros/fedora.txt new file mode 100644 index 00000000000..286458797f7 --- /dev/null +++ b/build/pkgs/ipykernel/distros/fedora.txt @@ -0,0 +1 @@ +python-ipykernel diff --git a/build/pkgs/ipykernel/distros/freebsd.txt b/build/pkgs/ipykernel/distros/freebsd.txt new file mode 100644 index 00000000000..92235f132be --- /dev/null +++ b/build/pkgs/ipykernel/distros/freebsd.txt @@ -0,0 +1 @@ +devel/py-ipykernel diff --git a/build/pkgs/ipykernel/distros/opensuse.txt b/build/pkgs/ipykernel/distros/opensuse.txt new file mode 100644 index 00000000000..286458797f7 --- /dev/null +++ b/build/pkgs/ipykernel/distros/opensuse.txt @@ -0,0 +1 @@ +python-ipykernel diff --git a/build/pkgs/ipython/distros/arch.txt b/build/pkgs/ipython/distros/arch.txt new file mode 100644 index 00000000000..49a7ffe2a95 --- /dev/null +++ b/build/pkgs/ipython/distros/arch.txt @@ -0,0 +1 @@ +ipython diff --git a/build/pkgs/ipython/distros/debian.txt b/build/pkgs/ipython/distros/debian.txt new file mode 100644 index 00000000000..49a7ffe2a95 --- /dev/null +++ b/build/pkgs/ipython/distros/debian.txt @@ -0,0 +1 @@ +ipython diff --git a/build/pkgs/ipython/distros/fedora.txt b/build/pkgs/ipython/distros/fedora.txt new file mode 100644 index 00000000000..49a7ffe2a95 --- /dev/null +++ b/build/pkgs/ipython/distros/fedora.txt @@ -0,0 +1 @@ +ipython diff --git a/build/pkgs/ipython/distros/freebsd.txt b/build/pkgs/ipython/distros/freebsd.txt new file mode 100644 index 00000000000..3252ee7fbc1 --- /dev/null +++ b/build/pkgs/ipython/distros/freebsd.txt @@ -0,0 +1 @@ +devel/ipython diff --git a/build/pkgs/jsonschema/distros/arch.txt b/build/pkgs/jsonschema/distros/arch.txt new file mode 100644 index 00000000000..8943c30f9ed --- /dev/null +++ b/build/pkgs/jsonschema/distros/arch.txt @@ -0,0 +1 @@ +python-jsonschema diff --git a/build/pkgs/jsonschema/distros/debian.txt b/build/pkgs/jsonschema/distros/debian.txt new file mode 100644 index 00000000000..8943c30f9ed --- /dev/null +++ b/build/pkgs/jsonschema/distros/debian.txt @@ -0,0 +1 @@ +python-jsonschema diff --git a/build/pkgs/jsonschema/distros/fedora.txt b/build/pkgs/jsonschema/distros/fedora.txt new file mode 100644 index 00000000000..8943c30f9ed --- /dev/null +++ b/build/pkgs/jsonschema/distros/fedora.txt @@ -0,0 +1 @@ +python-jsonschema diff --git a/build/pkgs/jupyterlab_widgets/distros/arch.txt b/build/pkgs/jupyterlab_widgets/distros/arch.txt new file mode 100644 index 00000000000..0800dc09838 --- /dev/null +++ b/build/pkgs/jupyterlab_widgets/distros/arch.txt @@ -0,0 +1 @@ +jupyterlab-widgets diff --git a/build/pkgs/jupyterlab_widgets/distros/freebsd.txt b/build/pkgs/jupyterlab_widgets/distros/freebsd.txt new file mode 100644 index 00000000000..6fc98fe86a0 --- /dev/null +++ b/build/pkgs/jupyterlab_widgets/distros/freebsd.txt @@ -0,0 +1 @@ +devel/py-jupyterlab-widgets diff --git a/build/pkgs/jupyterlab_widgets/distros/opensuse.txt b/build/pkgs/jupyterlab_widgets/distros/opensuse.txt new file mode 100644 index 00000000000..651221f2ba2 --- /dev/null +++ b/build/pkgs/jupyterlab_widgets/distros/opensuse.txt @@ -0,0 +1 @@ +python-jupyterlab-widgets diff --git a/build/pkgs/pexpect/distros/arch.txt b/build/pkgs/pexpect/distros/arch.txt new file mode 100644 index 00000000000..74d08141569 --- /dev/null +++ b/build/pkgs/pexpect/distros/arch.txt @@ -0,0 +1 @@ +python-pexpect diff --git a/build/pkgs/pexpect/distros/fedora.txt b/build/pkgs/pexpect/distros/fedora.txt new file mode 100644 index 00000000000..74d08141569 --- /dev/null +++ b/build/pkgs/pexpect/distros/fedora.txt @@ -0,0 +1 @@ +python-pexpect diff --git a/build/pkgs/pexpect/distros/freebsd.txt b/build/pkgs/pexpect/distros/freebsd.txt new file mode 100644 index 00000000000..767fd38a2fa --- /dev/null +++ b/build/pkgs/pexpect/distros/freebsd.txt @@ -0,0 +1 @@ +misc/py-pexpect diff --git a/build/pkgs/pip/distros/debian.txt b/build/pkgs/pip/distros/debian.txt new file mode 100644 index 00000000000..311c1b821ca --- /dev/null +++ b/build/pkgs/pip/distros/debian.txt @@ -0,0 +1 @@ +python-pip diff --git a/build/pkgs/pip/distros/fedora.txt b/build/pkgs/pip/distros/fedora.txt new file mode 100644 index 00000000000..311c1b821ca --- /dev/null +++ b/build/pkgs/pip/distros/fedora.txt @@ -0,0 +1 @@ +python-pip diff --git a/build/pkgs/pip/distros/freebsd.txt b/build/pkgs/pip/distros/freebsd.txt new file mode 100644 index 00000000000..7b125c1bfa4 --- /dev/null +++ b/build/pkgs/pip/distros/freebsd.txt @@ -0,0 +1 @@ +devel/py-pip diff --git a/build/pkgs/prompt_toolkit/distros/arch.txt b/build/pkgs/prompt_toolkit/distros/arch.txt new file mode 100644 index 00000000000..89b0ac83a9b --- /dev/null +++ b/build/pkgs/prompt_toolkit/distros/arch.txt @@ -0,0 +1 @@ +python-importlib_resources diff --git a/build/pkgs/prompt_toolkit/distros/debian.txt b/build/pkgs/prompt_toolkit/distros/debian.txt new file mode 100644 index 00000000000..2b0146fc669 --- /dev/null +++ b/build/pkgs/prompt_toolkit/distros/debian.txt @@ -0,0 +1 @@ +importlib-resources diff --git a/build/pkgs/prompt_toolkit/distros/fedora.txt b/build/pkgs/prompt_toolkit/distros/fedora.txt new file mode 100644 index 00000000000..967f8570d4f --- /dev/null +++ b/build/pkgs/prompt_toolkit/distros/fedora.txt @@ -0,0 +1 @@ +python-prompt-toolkit diff --git a/build/pkgs/prompt_toolkit/distros/freebsd.txt b/build/pkgs/prompt_toolkit/distros/freebsd.txt new file mode 100644 index 00000000000..a2f0c05129b --- /dev/null +++ b/build/pkgs/prompt_toolkit/distros/freebsd.txt @@ -0,0 +1 @@ +devel/py-importlib-resources diff --git a/build/pkgs/prompt_toolkit/distros/opensuse.txt b/build/pkgs/prompt_toolkit/distros/opensuse.txt index 424253f1340..89b0ac83a9b 100644 --- a/build/pkgs/prompt_toolkit/distros/opensuse.txt +++ b/build/pkgs/prompt_toolkit/distros/opensuse.txt @@ -1 +1 @@ -python3-prompt_toolkit +python-importlib_resources diff --git a/build/pkgs/ptyprocess/distros/arch.txt b/build/pkgs/ptyprocess/distros/arch.txt new file mode 100644 index 00000000000..911a22468fc --- /dev/null +++ b/build/pkgs/ptyprocess/distros/arch.txt @@ -0,0 +1 @@ +python-ptyprocess diff --git a/build/pkgs/ptyprocess/distros/fedora.txt b/build/pkgs/ptyprocess/distros/fedora.txt new file mode 100644 index 00000000000..911a22468fc --- /dev/null +++ b/build/pkgs/ptyprocess/distros/fedora.txt @@ -0,0 +1 @@ +python-ptyprocess diff --git a/build/pkgs/ptyprocess/distros/freebsd.txt b/build/pkgs/ptyprocess/distros/freebsd.txt new file mode 100644 index 00000000000..bc587f2e5fc --- /dev/null +++ b/build/pkgs/ptyprocess/distros/freebsd.txt @@ -0,0 +1 @@ +sysutils/py-ptyprocess diff --git a/build/pkgs/pycosat/distros/alpine.txt b/build/pkgs/pycosat/distros/alpine.txt new file mode 100644 index 00000000000..7eb034d6713 --- /dev/null +++ b/build/pkgs/pycosat/distros/alpine.txt @@ -0,0 +1 @@ +py3-pycosat diff --git a/build/pkgs/pycosat/distros/arch.txt b/build/pkgs/pycosat/distros/arch.txt new file mode 100644 index 00000000000..dab3122ef4c --- /dev/null +++ b/build/pkgs/pycosat/distros/arch.txt @@ -0,0 +1 @@ +python-pycosat diff --git a/build/pkgs/pycosat/distros/fedora.txt b/build/pkgs/pycosat/distros/fedora.txt new file mode 100644 index 00000000000..dab3122ef4c --- /dev/null +++ b/build/pkgs/pycosat/distros/fedora.txt @@ -0,0 +1 @@ +python-pycosat diff --git a/build/pkgs/pycosat/distros/freebsd.txt b/build/pkgs/pycosat/distros/freebsd.txt new file mode 100644 index 00000000000..35e4e7730cc --- /dev/null +++ b/build/pkgs/pycosat/distros/freebsd.txt @@ -0,0 +1 @@ +math/py-pycosat diff --git a/build/pkgs/pyparsing/distros/arch.txt b/build/pkgs/pyparsing/distros/arch.txt new file mode 100644 index 00000000000..428820c215f --- /dev/null +++ b/build/pkgs/pyparsing/distros/arch.txt @@ -0,0 +1 @@ +python-pyparsing diff --git a/build/pkgs/pyparsing/distros/freebsd.txt b/build/pkgs/pyparsing/distros/freebsd.txt new file mode 100644 index 00000000000..39fdc921fd0 --- /dev/null +++ b/build/pkgs/pyparsing/distros/freebsd.txt @@ -0,0 +1 @@ +devel/py-pyparsing diff --git a/build/pkgs/sphinx/distros/arch.txt b/build/pkgs/sphinx/distros/arch.txt new file mode 100644 index 00000000000..db9f745da4c --- /dev/null +++ b/build/pkgs/sphinx/distros/arch.txt @@ -0,0 +1 @@ +python-sphinx diff --git a/build/pkgs/sphinx/distros/debian.txt b/build/pkgs/sphinx/distros/debian.txt new file mode 100644 index 00000000000..6966869c705 --- /dev/null +++ b/build/pkgs/sphinx/distros/debian.txt @@ -0,0 +1 @@ +sphinx diff --git a/build/pkgs/sphinx/distros/fedora.txt b/build/pkgs/sphinx/distros/fedora.txt new file mode 100644 index 00000000000..db9f745da4c --- /dev/null +++ b/build/pkgs/sphinx/distros/fedora.txt @@ -0,0 +1 @@ +python-sphinx diff --git a/build/pkgs/sphinx/distros/freebsd.txt b/build/pkgs/sphinx/distros/freebsd.txt new file mode 100644 index 00000000000..f7f30dba25f --- /dev/null +++ b/build/pkgs/sphinx/distros/freebsd.txt @@ -0,0 +1 @@ +textproc/py-sphinx diff --git a/build/pkgs/typing_extensions/distros/arch.txt b/build/pkgs/typing_extensions/distros/arch.txt new file mode 100644 index 00000000000..92ad68dabc4 --- /dev/null +++ b/build/pkgs/typing_extensions/distros/arch.txt @@ -0,0 +1 @@ +python-typing_extensions diff --git a/build/pkgs/typing_extensions/distros/debian.txt b/build/pkgs/typing_extensions/distros/debian.txt new file mode 100644 index 00000000000..8c13a4539ac --- /dev/null +++ b/build/pkgs/typing_extensions/distros/debian.txt @@ -0,0 +1 @@ +python-typing-extensions diff --git a/build/pkgs/typing_extensions/distros/fedora.txt b/build/pkgs/typing_extensions/distros/fedora.txt new file mode 100644 index 00000000000..8c13a4539ac --- /dev/null +++ b/build/pkgs/typing_extensions/distros/fedora.txt @@ -0,0 +1 @@ +python-typing-extensions diff --git a/build/pkgs/typing_extensions/distros/freebsd.txt b/build/pkgs/typing_extensions/distros/freebsd.txt new file mode 100644 index 00000000000..b4424d384df --- /dev/null +++ b/build/pkgs/typing_extensions/distros/freebsd.txt @@ -0,0 +1 @@ +devel/py-typing-extensions diff --git a/build/pkgs/typing_extensions/distros/gentoo.txt b/build/pkgs/typing_extensions/distros/gentoo.txt new file mode 100644 index 00000000000..20b3d1de123 --- /dev/null +++ b/build/pkgs/typing_extensions/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/typing-extensions diff --git a/build/pkgs/typing_extensions/distros/opensuse.txt b/build/pkgs/typing_extensions/distros/opensuse.txt new file mode 100644 index 00000000000..92ad68dabc4 --- /dev/null +++ b/build/pkgs/typing_extensions/distros/opensuse.txt @@ -0,0 +1 @@ +python-typing_extensions diff --git a/build/pkgs/tzlocal/distros/arch.txt b/build/pkgs/tzlocal/distros/arch.txt new file mode 100644 index 00000000000..1de39af60b2 --- /dev/null +++ b/build/pkgs/tzlocal/distros/arch.txt @@ -0,0 +1 @@ +python-tzlocal diff --git a/build/pkgs/tzlocal/distros/debian.txt b/build/pkgs/tzlocal/distros/debian.txt new file mode 100644 index 00000000000..1de39af60b2 --- /dev/null +++ b/build/pkgs/tzlocal/distros/debian.txt @@ -0,0 +1 @@ +python-tzlocal diff --git a/build/pkgs/tzlocal/distros/fedora.txt b/build/pkgs/tzlocal/distros/fedora.txt new file mode 100644 index 00000000000..1de39af60b2 --- /dev/null +++ b/build/pkgs/tzlocal/distros/fedora.txt @@ -0,0 +1 @@ +python-tzlocal diff --git a/build/pkgs/tzlocal/distros/freebsd.txt b/build/pkgs/tzlocal/distros/freebsd.txt new file mode 100644 index 00000000000..c42ec397d1c --- /dev/null +++ b/build/pkgs/tzlocal/distros/freebsd.txt @@ -0,0 +1 @@ +devel/py-tzlocal diff --git a/build/pkgs/urllib3/distros/arch.txt b/build/pkgs/urllib3/distros/arch.txt new file mode 100644 index 00000000000..af6e58664fb --- /dev/null +++ b/build/pkgs/urllib3/distros/arch.txt @@ -0,0 +1 @@ +python-urllib3 diff --git a/build/pkgs/urllib3/distros/debian.txt b/build/pkgs/urllib3/distros/debian.txt new file mode 100644 index 00000000000..af6e58664fb --- /dev/null +++ b/build/pkgs/urllib3/distros/debian.txt @@ -0,0 +1 @@ +python-urllib3 diff --git a/build/pkgs/urllib3/distros/fedora.txt b/build/pkgs/urllib3/distros/fedora.txt new file mode 100644 index 00000000000..af6e58664fb --- /dev/null +++ b/build/pkgs/urllib3/distros/fedora.txt @@ -0,0 +1 @@ +python-urllib3 diff --git a/build/pkgs/urllib3/distros/freebsd.txt b/build/pkgs/urllib3/distros/freebsd.txt new file mode 100644 index 00000000000..751c1d25c41 --- /dev/null +++ b/build/pkgs/urllib3/distros/freebsd.txt @@ -0,0 +1 @@ +net/py-urllib3 diff --git a/build/pkgs/urllib3/distros/opensuse.txt b/build/pkgs/urllib3/distros/opensuse.txt new file mode 100644 index 00000000000..af6e58664fb --- /dev/null +++ b/build/pkgs/urllib3/distros/opensuse.txt @@ -0,0 +1 @@ +python-urllib3 From b0b6cc6edf3d9f90327e73bf37240869d66b5357 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 29 Aug 2023 21:23:40 -0700 Subject: [PATCH 347/423] build/pkgs: Add distros/*.txt for some more Python packages --- build/pkgs/cycler/distros/arch.txt | 1 + build/pkgs/cycler/distros/debian.txt | 1 + build/pkgs/cycler/distros/fedora.txt | 1 + build/pkgs/cycler/distros/freebsd.txt | 1 + build/pkgs/cycler/distros/opensuse.txt | 1 + build/pkgs/gmpy2/distros/arch.txt | 1 + build/pkgs/gmpy2/distros/debian.txt | 1 + build/pkgs/gmpy2/distros/fedora.txt | 1 + build/pkgs/gmpy2/distros/freebsd.txt | 1 + build/pkgs/gmpy2/distros/gentoo.txt | 1 + build/pkgs/gmpy2/distros/opensuse.txt | 1 + build/pkgs/pkgconfig/distros/arch.txt | 1 + build/pkgs/pkgconfig/distros/debian.txt | 1 + build/pkgs/pkgconfig/distros/fedora.txt | 1 + build/pkgs/pkgconfig/distros/freebsd.txt | 1 + build/pkgs/pplpy/distros/arch.txt | 1 + build/pkgs/pplpy/distros/fedora.txt | 1 + build/pkgs/pplpy/distros/freebsd.txt | 1 + build/pkgs/pplpy/distros/void.txt | 1 + build/pkgs/python_igraph/distros/arch.txt | 1 + build/pkgs/python_igraph/distros/debian.txt | 1 + build/pkgs/python_igraph/distros/fedora.txt | 1 + build/pkgs/python_igraph/distros/freebsd.txt | 1 + build/pkgs/rpy2/distros/arch.txt | 1 + build/pkgs/rpy2/distros/debian.txt | 1 + build/pkgs/rpy2/distros/freebsd.txt | 1 + build/pkgs/rpy2/distros/macports.txt | 1 + build/pkgs/rpy2/distros/opensuse.txt | 1 + build/pkgs/sphinxcontrib_applehelp/distros/arch.txt | 1 + build/pkgs/sphinxcontrib_applehelp/distros/fedora.txt | 1 + build/pkgs/sphinxcontrib_applehelp/distros/freebsd.txt | 1 + build/pkgs/sphinxcontrib_applehelp/distros/opensuse.txt | 2 +- build/pkgs/sphinxcontrib_devhelp/distros/arch.txt | 1 + build/pkgs/sphinxcontrib_devhelp/distros/fedora.txt | 1 + build/pkgs/sphinxcontrib_devhelp/distros/freebsd.txt | 1 + build/pkgs/sphinxcontrib_devhelp/distros/opensuse.txt | 1 + build/pkgs/sphinxcontrib_htmlhelp/distros/arch.txt | 1 + build/pkgs/sphinxcontrib_htmlhelp/distros/fedora.txt | 1 + build/pkgs/sphinxcontrib_htmlhelp/distros/freebsd.txt | 1 + build/pkgs/sphinxcontrib_htmlhelp/distros/opensuse.txt | 1 + build/pkgs/sphinxcontrib_jsmath/distros/arch.txt | 1 + build/pkgs/sphinxcontrib_jsmath/distros/fedora.txt | 1 + build/pkgs/sphinxcontrib_jsmath/distros/freebsd.txt | 1 + build/pkgs/sphinxcontrib_jsmath/distros/opensuse.txt | 1 + build/pkgs/sphinxcontrib_qthelp/distros/arch.txt | 1 + build/pkgs/sphinxcontrib_qthelp/distros/fedora.txt | 1 + build/pkgs/sphinxcontrib_qthelp/distros/freebsd.txt | 1 + build/pkgs/sphinxcontrib_qthelp/distros/opensuse.txt | 1 + build/pkgs/sphinxcontrib_serializinghtml/distros/arch.txt | 1 + build/pkgs/sphinxcontrib_serializinghtml/distros/fedora.txt | 1 + build/pkgs/sphinxcontrib_serializinghtml/distros/freebsd.txt | 1 + build/pkgs/sphinxcontrib_serializinghtml/distros/opensuse.txt | 2 +- build/pkgs/sphinxcontrib_websupport/distros/arch.txt | 1 + build/pkgs/sphinxcontrib_websupport/distros/fedora.txt | 1 + build/pkgs/sphinxcontrib_websupport/distros/freebsd.txt | 1 + build/pkgs/sphinxcontrib_websupport/distros/opensuse.txt | 2 +- 56 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 build/pkgs/cycler/distros/arch.txt create mode 100644 build/pkgs/cycler/distros/debian.txt create mode 100644 build/pkgs/cycler/distros/fedora.txt create mode 100644 build/pkgs/cycler/distros/freebsd.txt create mode 100644 build/pkgs/cycler/distros/opensuse.txt create mode 100644 build/pkgs/gmpy2/distros/arch.txt create mode 100644 build/pkgs/gmpy2/distros/debian.txt create mode 100644 build/pkgs/gmpy2/distros/fedora.txt create mode 100644 build/pkgs/gmpy2/distros/freebsd.txt create mode 100644 build/pkgs/gmpy2/distros/gentoo.txt create mode 100644 build/pkgs/gmpy2/distros/opensuse.txt create mode 100644 build/pkgs/pkgconfig/distros/arch.txt create mode 100644 build/pkgs/pkgconfig/distros/debian.txt create mode 100644 build/pkgs/pkgconfig/distros/fedora.txt create mode 100644 build/pkgs/pkgconfig/distros/freebsd.txt create mode 100644 build/pkgs/pplpy/distros/arch.txt create mode 100644 build/pkgs/pplpy/distros/fedora.txt create mode 100644 build/pkgs/pplpy/distros/freebsd.txt create mode 100644 build/pkgs/pplpy/distros/void.txt create mode 100644 build/pkgs/python_igraph/distros/arch.txt create mode 100644 build/pkgs/python_igraph/distros/debian.txt create mode 100644 build/pkgs/python_igraph/distros/fedora.txt create mode 100644 build/pkgs/python_igraph/distros/freebsd.txt create mode 100644 build/pkgs/rpy2/distros/arch.txt create mode 100644 build/pkgs/rpy2/distros/debian.txt create mode 100644 build/pkgs/rpy2/distros/freebsd.txt create mode 100644 build/pkgs/rpy2/distros/macports.txt create mode 100644 build/pkgs/rpy2/distros/opensuse.txt create mode 100644 build/pkgs/sphinxcontrib_applehelp/distros/arch.txt create mode 100644 build/pkgs/sphinxcontrib_applehelp/distros/fedora.txt create mode 100644 build/pkgs/sphinxcontrib_applehelp/distros/freebsd.txt create mode 100644 build/pkgs/sphinxcontrib_devhelp/distros/arch.txt create mode 100644 build/pkgs/sphinxcontrib_devhelp/distros/fedora.txt create mode 100644 build/pkgs/sphinxcontrib_devhelp/distros/freebsd.txt create mode 100644 build/pkgs/sphinxcontrib_devhelp/distros/opensuse.txt create mode 100644 build/pkgs/sphinxcontrib_htmlhelp/distros/arch.txt create mode 100644 build/pkgs/sphinxcontrib_htmlhelp/distros/fedora.txt create mode 100644 build/pkgs/sphinxcontrib_htmlhelp/distros/freebsd.txt create mode 100644 build/pkgs/sphinxcontrib_htmlhelp/distros/opensuse.txt create mode 100644 build/pkgs/sphinxcontrib_jsmath/distros/arch.txt create mode 100644 build/pkgs/sphinxcontrib_jsmath/distros/fedora.txt create mode 100644 build/pkgs/sphinxcontrib_jsmath/distros/freebsd.txt create mode 100644 build/pkgs/sphinxcontrib_jsmath/distros/opensuse.txt create mode 100644 build/pkgs/sphinxcontrib_qthelp/distros/arch.txt create mode 100644 build/pkgs/sphinxcontrib_qthelp/distros/fedora.txt create mode 100644 build/pkgs/sphinxcontrib_qthelp/distros/freebsd.txt create mode 100644 build/pkgs/sphinxcontrib_qthelp/distros/opensuse.txt create mode 100644 build/pkgs/sphinxcontrib_serializinghtml/distros/arch.txt create mode 100644 build/pkgs/sphinxcontrib_serializinghtml/distros/fedora.txt create mode 100644 build/pkgs/sphinxcontrib_serializinghtml/distros/freebsd.txt create mode 100644 build/pkgs/sphinxcontrib_websupport/distros/arch.txt create mode 100644 build/pkgs/sphinxcontrib_websupport/distros/fedora.txt create mode 100644 build/pkgs/sphinxcontrib_websupport/distros/freebsd.txt diff --git a/build/pkgs/cycler/distros/arch.txt b/build/pkgs/cycler/distros/arch.txt new file mode 100644 index 00000000000..5727259aca6 --- /dev/null +++ b/build/pkgs/cycler/distros/arch.txt @@ -0,0 +1 @@ +python-cycler diff --git a/build/pkgs/cycler/distros/debian.txt b/build/pkgs/cycler/distros/debian.txt new file mode 100644 index 00000000000..5727259aca6 --- /dev/null +++ b/build/pkgs/cycler/distros/debian.txt @@ -0,0 +1 @@ +python-cycler diff --git a/build/pkgs/cycler/distros/fedora.txt b/build/pkgs/cycler/distros/fedora.txt new file mode 100644 index 00000000000..5727259aca6 --- /dev/null +++ b/build/pkgs/cycler/distros/fedora.txt @@ -0,0 +1 @@ +python-cycler diff --git a/build/pkgs/cycler/distros/freebsd.txt b/build/pkgs/cycler/distros/freebsd.txt new file mode 100644 index 00000000000..6da1dabb333 --- /dev/null +++ b/build/pkgs/cycler/distros/freebsd.txt @@ -0,0 +1 @@ +devel/py-cycler diff --git a/build/pkgs/cycler/distros/opensuse.txt b/build/pkgs/cycler/distros/opensuse.txt new file mode 100644 index 00000000000..93efd62d380 --- /dev/null +++ b/build/pkgs/cycler/distros/opensuse.txt @@ -0,0 +1 @@ +python-Cycler diff --git a/build/pkgs/gmpy2/distros/arch.txt b/build/pkgs/gmpy2/distros/arch.txt new file mode 100644 index 00000000000..d4464a5ce2c --- /dev/null +++ b/build/pkgs/gmpy2/distros/arch.txt @@ -0,0 +1 @@ +python-gmpy2 diff --git a/build/pkgs/gmpy2/distros/debian.txt b/build/pkgs/gmpy2/distros/debian.txt new file mode 100644 index 00000000000..d4464a5ce2c --- /dev/null +++ b/build/pkgs/gmpy2/distros/debian.txt @@ -0,0 +1 @@ +python-gmpy2 diff --git a/build/pkgs/gmpy2/distros/fedora.txt b/build/pkgs/gmpy2/distros/fedora.txt new file mode 100644 index 00000000000..d4464a5ce2c --- /dev/null +++ b/build/pkgs/gmpy2/distros/fedora.txt @@ -0,0 +1 @@ +python-gmpy2 diff --git a/build/pkgs/gmpy2/distros/freebsd.txt b/build/pkgs/gmpy2/distros/freebsd.txt new file mode 100644 index 00000000000..0d9d2c435a6 --- /dev/null +++ b/build/pkgs/gmpy2/distros/freebsd.txt @@ -0,0 +1 @@ +math/py-gmpy2 diff --git a/build/pkgs/gmpy2/distros/gentoo.txt b/build/pkgs/gmpy2/distros/gentoo.txt new file mode 100644 index 00000000000..519f9d8729a --- /dev/null +++ b/build/pkgs/gmpy2/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/gmpy diff --git a/build/pkgs/gmpy2/distros/opensuse.txt b/build/pkgs/gmpy2/distros/opensuse.txt new file mode 100644 index 00000000000..d4464a5ce2c --- /dev/null +++ b/build/pkgs/gmpy2/distros/opensuse.txt @@ -0,0 +1 @@ +python-gmpy2 diff --git a/build/pkgs/pkgconfig/distros/arch.txt b/build/pkgs/pkgconfig/distros/arch.txt new file mode 100644 index 00000000000..38a18b3565f --- /dev/null +++ b/build/pkgs/pkgconfig/distros/arch.txt @@ -0,0 +1 @@ +python-pkgconfig diff --git a/build/pkgs/pkgconfig/distros/debian.txt b/build/pkgs/pkgconfig/distros/debian.txt new file mode 100644 index 00000000000..38a18b3565f --- /dev/null +++ b/build/pkgs/pkgconfig/distros/debian.txt @@ -0,0 +1 @@ +python-pkgconfig diff --git a/build/pkgs/pkgconfig/distros/fedora.txt b/build/pkgs/pkgconfig/distros/fedora.txt new file mode 100644 index 00000000000..38a18b3565f --- /dev/null +++ b/build/pkgs/pkgconfig/distros/fedora.txt @@ -0,0 +1 @@ +python-pkgconfig diff --git a/build/pkgs/pkgconfig/distros/freebsd.txt b/build/pkgs/pkgconfig/distros/freebsd.txt new file mode 100644 index 00000000000..d26a4e96787 --- /dev/null +++ b/build/pkgs/pkgconfig/distros/freebsd.txt @@ -0,0 +1 @@ +devel/py-pkgconfig diff --git a/build/pkgs/pplpy/distros/arch.txt b/build/pkgs/pplpy/distros/arch.txt new file mode 100644 index 00000000000..579bdb042f6 --- /dev/null +++ b/build/pkgs/pplpy/distros/arch.txt @@ -0,0 +1 @@ +python-pplpy diff --git a/build/pkgs/pplpy/distros/fedora.txt b/build/pkgs/pplpy/distros/fedora.txt new file mode 100644 index 00000000000..579bdb042f6 --- /dev/null +++ b/build/pkgs/pplpy/distros/fedora.txt @@ -0,0 +1 @@ +python-pplpy diff --git a/build/pkgs/pplpy/distros/freebsd.txt b/build/pkgs/pplpy/distros/freebsd.txt new file mode 100644 index 00000000000..2006f870646 --- /dev/null +++ b/build/pkgs/pplpy/distros/freebsd.txt @@ -0,0 +1 @@ +math/py-pplpy diff --git a/build/pkgs/pplpy/distros/void.txt b/build/pkgs/pplpy/distros/void.txt new file mode 100644 index 00000000000..f39eaff76ae --- /dev/null +++ b/build/pkgs/pplpy/distros/void.txt @@ -0,0 +1 @@ +python3-pplpy diff --git a/build/pkgs/python_igraph/distros/arch.txt b/build/pkgs/python_igraph/distros/arch.txt new file mode 100644 index 00000000000..03f8142066f --- /dev/null +++ b/build/pkgs/python_igraph/distros/arch.txt @@ -0,0 +1 @@ +python-igraph diff --git a/build/pkgs/python_igraph/distros/debian.txt b/build/pkgs/python_igraph/distros/debian.txt new file mode 100644 index 00000000000..03f8142066f --- /dev/null +++ b/build/pkgs/python_igraph/distros/debian.txt @@ -0,0 +1 @@ +python-igraph diff --git a/build/pkgs/python_igraph/distros/fedora.txt b/build/pkgs/python_igraph/distros/fedora.txt new file mode 100644 index 00000000000..03f8142066f --- /dev/null +++ b/build/pkgs/python_igraph/distros/fedora.txt @@ -0,0 +1 @@ +python-igraph diff --git a/build/pkgs/python_igraph/distros/freebsd.txt b/build/pkgs/python_igraph/distros/freebsd.txt new file mode 100644 index 00000000000..d86a516f3ed --- /dev/null +++ b/build/pkgs/python_igraph/distros/freebsd.txt @@ -0,0 +1 @@ +math/py-igraph diff --git a/build/pkgs/rpy2/distros/arch.txt b/build/pkgs/rpy2/distros/arch.txt new file mode 100644 index 00000000000..9748535a285 --- /dev/null +++ b/build/pkgs/rpy2/distros/arch.txt @@ -0,0 +1 @@ +python-rpy2 diff --git a/build/pkgs/rpy2/distros/debian.txt b/build/pkgs/rpy2/distros/debian.txt new file mode 100644 index 00000000000..8f389862688 --- /dev/null +++ b/build/pkgs/rpy2/distros/debian.txt @@ -0,0 +1 @@ +rpy2 diff --git a/build/pkgs/rpy2/distros/freebsd.txt b/build/pkgs/rpy2/distros/freebsd.txt new file mode 100644 index 00000000000..21caa8b9edd --- /dev/null +++ b/build/pkgs/rpy2/distros/freebsd.txt @@ -0,0 +1 @@ +math/py-rpy2 diff --git a/build/pkgs/rpy2/distros/macports.txt b/build/pkgs/rpy2/distros/macports.txt new file mode 100644 index 00000000000..71f03850a9b --- /dev/null +++ b/build/pkgs/rpy2/distros/macports.txt @@ -0,0 +1 @@ +py-rpy2 diff --git a/build/pkgs/rpy2/distros/opensuse.txt b/build/pkgs/rpy2/distros/opensuse.txt new file mode 100644 index 00000000000..9748535a285 --- /dev/null +++ b/build/pkgs/rpy2/distros/opensuse.txt @@ -0,0 +1 @@ +python-rpy2 diff --git a/build/pkgs/sphinxcontrib_applehelp/distros/arch.txt b/build/pkgs/sphinxcontrib_applehelp/distros/arch.txt new file mode 100644 index 00000000000..3754baa21f5 --- /dev/null +++ b/build/pkgs/sphinxcontrib_applehelp/distros/arch.txt @@ -0,0 +1 @@ +python-sphinxcontrib-applehelp diff --git a/build/pkgs/sphinxcontrib_applehelp/distros/fedora.txt b/build/pkgs/sphinxcontrib_applehelp/distros/fedora.txt new file mode 100644 index 00000000000..3754baa21f5 --- /dev/null +++ b/build/pkgs/sphinxcontrib_applehelp/distros/fedora.txt @@ -0,0 +1 @@ +python-sphinxcontrib-applehelp diff --git a/build/pkgs/sphinxcontrib_applehelp/distros/freebsd.txt b/build/pkgs/sphinxcontrib_applehelp/distros/freebsd.txt new file mode 100644 index 00000000000..73fbc3bf7ad --- /dev/null +++ b/build/pkgs/sphinxcontrib_applehelp/distros/freebsd.txt @@ -0,0 +1 @@ +textproc/py-sphinxcontrib-applehelp diff --git a/build/pkgs/sphinxcontrib_applehelp/distros/opensuse.txt b/build/pkgs/sphinxcontrib_applehelp/distros/opensuse.txt index adedbd455f8..3754baa21f5 100644 --- a/build/pkgs/sphinxcontrib_applehelp/distros/opensuse.txt +++ b/build/pkgs/sphinxcontrib_applehelp/distros/opensuse.txt @@ -1 +1 @@ -python3-sphinxcontrib-applehelp +python-sphinxcontrib-applehelp diff --git a/build/pkgs/sphinxcontrib_devhelp/distros/arch.txt b/build/pkgs/sphinxcontrib_devhelp/distros/arch.txt new file mode 100644 index 00000000000..0b1b3e44a6b --- /dev/null +++ b/build/pkgs/sphinxcontrib_devhelp/distros/arch.txt @@ -0,0 +1 @@ +python-sphinxcontrib-devhelp diff --git a/build/pkgs/sphinxcontrib_devhelp/distros/fedora.txt b/build/pkgs/sphinxcontrib_devhelp/distros/fedora.txt new file mode 100644 index 00000000000..0b1b3e44a6b --- /dev/null +++ b/build/pkgs/sphinxcontrib_devhelp/distros/fedora.txt @@ -0,0 +1 @@ +python-sphinxcontrib-devhelp diff --git a/build/pkgs/sphinxcontrib_devhelp/distros/freebsd.txt b/build/pkgs/sphinxcontrib_devhelp/distros/freebsd.txt new file mode 100644 index 00000000000..86982bcbd27 --- /dev/null +++ b/build/pkgs/sphinxcontrib_devhelp/distros/freebsd.txt @@ -0,0 +1 @@ +textproc/py-sphinxcontrib-devhelp diff --git a/build/pkgs/sphinxcontrib_devhelp/distros/opensuse.txt b/build/pkgs/sphinxcontrib_devhelp/distros/opensuse.txt new file mode 100644 index 00000000000..0b1b3e44a6b --- /dev/null +++ b/build/pkgs/sphinxcontrib_devhelp/distros/opensuse.txt @@ -0,0 +1 @@ +python-sphinxcontrib-devhelp diff --git a/build/pkgs/sphinxcontrib_htmlhelp/distros/arch.txt b/build/pkgs/sphinxcontrib_htmlhelp/distros/arch.txt new file mode 100644 index 00000000000..81390fd522f --- /dev/null +++ b/build/pkgs/sphinxcontrib_htmlhelp/distros/arch.txt @@ -0,0 +1 @@ +python-sphinxcontrib-htmlhelp diff --git a/build/pkgs/sphinxcontrib_htmlhelp/distros/fedora.txt b/build/pkgs/sphinxcontrib_htmlhelp/distros/fedora.txt new file mode 100644 index 00000000000..81390fd522f --- /dev/null +++ b/build/pkgs/sphinxcontrib_htmlhelp/distros/fedora.txt @@ -0,0 +1 @@ +python-sphinxcontrib-htmlhelp diff --git a/build/pkgs/sphinxcontrib_htmlhelp/distros/freebsd.txt b/build/pkgs/sphinxcontrib_htmlhelp/distros/freebsd.txt new file mode 100644 index 00000000000..9b97c55996b --- /dev/null +++ b/build/pkgs/sphinxcontrib_htmlhelp/distros/freebsd.txt @@ -0,0 +1 @@ +textproc/py-sphinxcontrib-htmlhelp diff --git a/build/pkgs/sphinxcontrib_htmlhelp/distros/opensuse.txt b/build/pkgs/sphinxcontrib_htmlhelp/distros/opensuse.txt new file mode 100644 index 00000000000..81390fd522f --- /dev/null +++ b/build/pkgs/sphinxcontrib_htmlhelp/distros/opensuse.txt @@ -0,0 +1 @@ +python-sphinxcontrib-htmlhelp diff --git a/build/pkgs/sphinxcontrib_jsmath/distros/arch.txt b/build/pkgs/sphinxcontrib_jsmath/distros/arch.txt new file mode 100644 index 00000000000..2b4927832ac --- /dev/null +++ b/build/pkgs/sphinxcontrib_jsmath/distros/arch.txt @@ -0,0 +1 @@ +python-sphinxcontrib-jsmath diff --git a/build/pkgs/sphinxcontrib_jsmath/distros/fedora.txt b/build/pkgs/sphinxcontrib_jsmath/distros/fedora.txt new file mode 100644 index 00000000000..2b4927832ac --- /dev/null +++ b/build/pkgs/sphinxcontrib_jsmath/distros/fedora.txt @@ -0,0 +1 @@ +python-sphinxcontrib-jsmath diff --git a/build/pkgs/sphinxcontrib_jsmath/distros/freebsd.txt b/build/pkgs/sphinxcontrib_jsmath/distros/freebsd.txt new file mode 100644 index 00000000000..78aa428cb13 --- /dev/null +++ b/build/pkgs/sphinxcontrib_jsmath/distros/freebsd.txt @@ -0,0 +1 @@ +textproc/py-sphinxcontrib-jsmath diff --git a/build/pkgs/sphinxcontrib_jsmath/distros/opensuse.txt b/build/pkgs/sphinxcontrib_jsmath/distros/opensuse.txt new file mode 100644 index 00000000000..2b4927832ac --- /dev/null +++ b/build/pkgs/sphinxcontrib_jsmath/distros/opensuse.txt @@ -0,0 +1 @@ +python-sphinxcontrib-jsmath diff --git a/build/pkgs/sphinxcontrib_qthelp/distros/arch.txt b/build/pkgs/sphinxcontrib_qthelp/distros/arch.txt new file mode 100644 index 00000000000..2c11924a5df --- /dev/null +++ b/build/pkgs/sphinxcontrib_qthelp/distros/arch.txt @@ -0,0 +1 @@ +python-sphinxcontrib-qthelp diff --git a/build/pkgs/sphinxcontrib_qthelp/distros/fedora.txt b/build/pkgs/sphinxcontrib_qthelp/distros/fedora.txt new file mode 100644 index 00000000000..2c11924a5df --- /dev/null +++ b/build/pkgs/sphinxcontrib_qthelp/distros/fedora.txt @@ -0,0 +1 @@ +python-sphinxcontrib-qthelp diff --git a/build/pkgs/sphinxcontrib_qthelp/distros/freebsd.txt b/build/pkgs/sphinxcontrib_qthelp/distros/freebsd.txt new file mode 100644 index 00000000000..77ff8756694 --- /dev/null +++ b/build/pkgs/sphinxcontrib_qthelp/distros/freebsd.txt @@ -0,0 +1 @@ +textproc/py-sphinxcontrib-qthelp diff --git a/build/pkgs/sphinxcontrib_qthelp/distros/opensuse.txt b/build/pkgs/sphinxcontrib_qthelp/distros/opensuse.txt new file mode 100644 index 00000000000..2c11924a5df --- /dev/null +++ b/build/pkgs/sphinxcontrib_qthelp/distros/opensuse.txt @@ -0,0 +1 @@ +python-sphinxcontrib-qthelp diff --git a/build/pkgs/sphinxcontrib_serializinghtml/distros/arch.txt b/build/pkgs/sphinxcontrib_serializinghtml/distros/arch.txt new file mode 100644 index 00000000000..46d22be403f --- /dev/null +++ b/build/pkgs/sphinxcontrib_serializinghtml/distros/arch.txt @@ -0,0 +1 @@ +python-sphinxcontrib-serializinghtml diff --git a/build/pkgs/sphinxcontrib_serializinghtml/distros/fedora.txt b/build/pkgs/sphinxcontrib_serializinghtml/distros/fedora.txt new file mode 100644 index 00000000000..46d22be403f --- /dev/null +++ b/build/pkgs/sphinxcontrib_serializinghtml/distros/fedora.txt @@ -0,0 +1 @@ +python-sphinxcontrib-serializinghtml diff --git a/build/pkgs/sphinxcontrib_serializinghtml/distros/freebsd.txt b/build/pkgs/sphinxcontrib_serializinghtml/distros/freebsd.txt new file mode 100644 index 00000000000..de7f59bad6e --- /dev/null +++ b/build/pkgs/sphinxcontrib_serializinghtml/distros/freebsd.txt @@ -0,0 +1 @@ +textproc/py-sphinxcontrib-serializinghtml diff --git a/build/pkgs/sphinxcontrib_serializinghtml/distros/opensuse.txt b/build/pkgs/sphinxcontrib_serializinghtml/distros/opensuse.txt index 1a8ea8424a7..46d22be403f 100644 --- a/build/pkgs/sphinxcontrib_serializinghtml/distros/opensuse.txt +++ b/build/pkgs/sphinxcontrib_serializinghtml/distros/opensuse.txt @@ -1 +1 @@ -python3-sphinxcontrib-serializinghtml +python-sphinxcontrib-serializinghtml diff --git a/build/pkgs/sphinxcontrib_websupport/distros/arch.txt b/build/pkgs/sphinxcontrib_websupport/distros/arch.txt new file mode 100644 index 00000000000..a9a5a1a1727 --- /dev/null +++ b/build/pkgs/sphinxcontrib_websupport/distros/arch.txt @@ -0,0 +1 @@ +python-sphinxcontrib-websupport diff --git a/build/pkgs/sphinxcontrib_websupport/distros/fedora.txt b/build/pkgs/sphinxcontrib_websupport/distros/fedora.txt new file mode 100644 index 00000000000..a9a5a1a1727 --- /dev/null +++ b/build/pkgs/sphinxcontrib_websupport/distros/fedora.txt @@ -0,0 +1 @@ +python-sphinxcontrib-websupport diff --git a/build/pkgs/sphinxcontrib_websupport/distros/freebsd.txt b/build/pkgs/sphinxcontrib_websupport/distros/freebsd.txt new file mode 100644 index 00000000000..b8911943237 --- /dev/null +++ b/build/pkgs/sphinxcontrib_websupport/distros/freebsd.txt @@ -0,0 +1 @@ +textproc/py-sphinxcontrib-websupport diff --git a/build/pkgs/sphinxcontrib_websupport/distros/opensuse.txt b/build/pkgs/sphinxcontrib_websupport/distros/opensuse.txt index 2c8e8e8d34d..a9a5a1a1727 100644 --- a/build/pkgs/sphinxcontrib_websupport/distros/opensuse.txt +++ b/build/pkgs/sphinxcontrib_websupport/distros/opensuse.txt @@ -1 +1 @@ -python3-sphinxcontrib-websupport +python-sphinxcontrib-websupport From 82436dee0cb09e76d55456e478968f04bb7fd228 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 29 Aug 2023 22:10:37 -0700 Subject: [PATCH 348/423] .tox, .github/workflows/ci-linux.yml: Test -standard-sitepackages (fixup) --- .github/workflows/ci-linux.yml | 1 - tox.ini | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index e4f424380df..8a2ea35cfba 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -73,7 +73,6 @@ jobs: free_disk_space: true from_docker_repository: ghcr.io/${{ github.repository }}/ from_docker_target: "with-targets-pre" - from_docker_tag: "$(echo $BUILD_TAG | sed s/-sitepackages//)" docker_targets: "with-targets with-targets-optional" # FIXME: duplicated from env.TARGETS targets: build doc-html diff --git a/tox.ini b/tox.ini index 939f1b7d0f4..020df1643bc 100644 --- a/tox.ini +++ b/tox.ini @@ -477,7 +477,7 @@ setenv = # Resulting full image:tag name # docker: FULL_BASE_IMAGE_AND_TAG={env:ARCH_IMAGE_PREFIX:}{env:BASE_IMAGE}{env:ARCH_IMAGE_SUFFIX:}:{env:ARCH_TAG_PREFIX:}{env:BASE_TAG}{env:ARCH_TAG_SUFFIX:} - docker-incremental: FULL_BASE_IMAGE_AND_TAG={env:FROM_DOCKER_REPOSITORY:ghcr.io/sagemath/sage/}sage-$(echo {envname} | sed -E "s/(docker-|-incremental)//g")-{env:FROM_DOCKER_TARGET:with-targets}:{env:FROM_DOCKER_TAG:dev} + docker-incremental: FULL_BASE_IMAGE_AND_TAG={env:FROM_DOCKER_REPOSITORY:ghcr.io/sagemath/sage/}sage-$(echo {envname} | sed -E "s/(docker-|-incremental|-sitepackages)//g")-{env:FROM_DOCKER_TARGET:with-targets}:{env:FROM_DOCKER_TAG:dev} docker-incremental: SKIP_SYSTEM_PKG_INSTALL=yes docker-incremental-sitepackages: SKIP_SYSTEM_PKG_INSTALL=no # From 6d3ddc501d98295d51a186b877f64d151a1ea8ba Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 29 Aug 2023 22:16:29 -0700 Subject: [PATCH 349/423] build/pkgs/*/distros/debian.txt: Use python3-* packages --- build/pkgs/cycler/distros/debian.txt | 2 +- build/pkgs/dateutil/distros/debian.txt | 2 +- build/pkgs/gmpy2/distros/debian.txt | 2 +- build/pkgs/importlib_metadata/distros/debian.txt | 2 +- build/pkgs/jsonschema/distros/debian.txt | 2 +- build/pkgs/pip/distros/debian.txt | 2 +- build/pkgs/pkgconfig/distros/debian.txt | 2 +- build/pkgs/python_igraph/distros/debian.txt | 2 +- build/pkgs/typing_extensions/distros/debian.txt | 2 +- build/pkgs/tzlocal/distros/debian.txt | 2 +- build/pkgs/urllib3/distros/debian.txt | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/build/pkgs/cycler/distros/debian.txt b/build/pkgs/cycler/distros/debian.txt index 5727259aca6..c77685dd417 100644 --- a/build/pkgs/cycler/distros/debian.txt +++ b/build/pkgs/cycler/distros/debian.txt @@ -1 +1 @@ -python-cycler +python3-cycler diff --git a/build/pkgs/dateutil/distros/debian.txt b/build/pkgs/dateutil/distros/debian.txt index 0f08daace31..2f46170765c 100644 --- a/build/pkgs/dateutil/distros/debian.txt +++ b/build/pkgs/dateutil/distros/debian.txt @@ -1 +1 @@ -python-dateutil +python3-dateutil diff --git a/build/pkgs/gmpy2/distros/debian.txt b/build/pkgs/gmpy2/distros/debian.txt index d4464a5ce2c..afdd6281722 100644 --- a/build/pkgs/gmpy2/distros/debian.txt +++ b/build/pkgs/gmpy2/distros/debian.txt @@ -1 +1 @@ -python-gmpy2 +python3-gmpy2 diff --git a/build/pkgs/importlib_metadata/distros/debian.txt b/build/pkgs/importlib_metadata/distros/debian.txt index b3c206287ec..c005bf38793 100644 --- a/build/pkgs/importlib_metadata/distros/debian.txt +++ b/build/pkgs/importlib_metadata/distros/debian.txt @@ -1 +1 @@ -python-importlib-metadata +python3-importlib-metadata diff --git a/build/pkgs/jsonschema/distros/debian.txt b/build/pkgs/jsonschema/distros/debian.txt index 8943c30f9ed..047e6cc5d1d 100644 --- a/build/pkgs/jsonschema/distros/debian.txt +++ b/build/pkgs/jsonschema/distros/debian.txt @@ -1 +1 @@ -python-jsonschema +python3-jsonschema diff --git a/build/pkgs/pip/distros/debian.txt b/build/pkgs/pip/distros/debian.txt index 311c1b821ca..39bd9fc5097 100644 --- a/build/pkgs/pip/distros/debian.txt +++ b/build/pkgs/pip/distros/debian.txt @@ -1 +1 @@ -python-pip +python3-pip diff --git a/build/pkgs/pkgconfig/distros/debian.txt b/build/pkgs/pkgconfig/distros/debian.txt index 38a18b3565f..38e5106dd74 100644 --- a/build/pkgs/pkgconfig/distros/debian.txt +++ b/build/pkgs/pkgconfig/distros/debian.txt @@ -1 +1 @@ -python-pkgconfig +python3-pkgconfig diff --git a/build/pkgs/python_igraph/distros/debian.txt b/build/pkgs/python_igraph/distros/debian.txt index 03f8142066f..218ba998007 100644 --- a/build/pkgs/python_igraph/distros/debian.txt +++ b/build/pkgs/python_igraph/distros/debian.txt @@ -1 +1 @@ -python-igraph +python3-igraph diff --git a/build/pkgs/typing_extensions/distros/debian.txt b/build/pkgs/typing_extensions/distros/debian.txt index 8c13a4539ac..424ebf1a645 100644 --- a/build/pkgs/typing_extensions/distros/debian.txt +++ b/build/pkgs/typing_extensions/distros/debian.txt @@ -1 +1 @@ -python-typing-extensions +python3-typing-extensions diff --git a/build/pkgs/tzlocal/distros/debian.txt b/build/pkgs/tzlocal/distros/debian.txt index 1de39af60b2..95d2d705c05 100644 --- a/build/pkgs/tzlocal/distros/debian.txt +++ b/build/pkgs/tzlocal/distros/debian.txt @@ -1 +1 @@ -python-tzlocal +python3-tzlocal diff --git a/build/pkgs/urllib3/distros/debian.txt b/build/pkgs/urllib3/distros/debian.txt index af6e58664fb..918569f9677 100644 --- a/build/pkgs/urllib3/distros/debian.txt +++ b/build/pkgs/urllib3/distros/debian.txt @@ -1 +1 @@ -python-urllib3 +python3-urllib3 From 0d2da8c77f50f3f9325a96d24011e0712a6c43c7 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 29 Aug 2023 22:32:57 -0700 Subject: [PATCH 350/423] build/pkgs/ipython/distros/debian.txt: Fixup --- build/pkgs/ipython/distros/debian.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/ipython/distros/debian.txt b/build/pkgs/ipython/distros/debian.txt index 49a7ffe2a95..c32c6b449cf 100644 --- a/build/pkgs/ipython/distros/debian.txt +++ b/build/pkgs/ipython/distros/debian.txt @@ -1 +1 @@ -ipython +python3-ipython From 65a90e45018b0952a8c60cbf7ee2d11077a4cb7f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 30 Aug 2023 09:59:18 -0700 Subject: [PATCH 351/423] .github/workflows/docker.yml: Add opensuse-tumbleweed (currently using python3.11) --- .github/workflows/docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3c53c936237..2e867ca1b54 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -59,6 +59,7 @@ on: "opensuse-15.4-gcc_11-python3.10", "opensuse-15.5-gcc_11-python3.11", "opensuse-tumbleweed-python3.10", + "opensuse-tumbleweed", "conda-forge", "ubuntu-bionic-gcc_8-i386", "debian-buster-i386", From d809ea51436a1e1d817ee2a56bc6df5a7313ffda Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 30 Aug 2023 10:00:13 -0700 Subject: [PATCH 352/423] build/pkgs/*/distros/opensuse.txt: Use python3${MINOR}-* packages --- build/pkgs/alabaster/distros/opensuse.txt | 2 +- build/pkgs/babel/distros/opensuse.txt | 2 +- build/pkgs/bleach/distros/opensuse.txt | 2 +- build/pkgs/certifi/distros/opensuse.txt | 2 +- build/pkgs/cffi/distros/opensuse.txt | 2 +- build/pkgs/cvxopt/distros/opensuse.txt | 2 +- build/pkgs/cycler/distros/opensuse.txt | 2 +- build/pkgs/cython/distros/opensuse.txt | 2 +- build/pkgs/dateutil/distros/opensuse.txt | 2 +- build/pkgs/decorator/distros/opensuse.txt | 2 +- build/pkgs/docutils/distros/opensuse.txt | 2 +- build/pkgs/gmpy2/distros/opensuse.txt | 2 +- build/pkgs/html5lib/distros/opensuse.txt | 2 +- build/pkgs/idna/distros/opensuse.txt | 2 +- build/pkgs/importlib_metadata/distros/opensuse.txt | 2 +- build/pkgs/ipykernel/distros/opensuse.txt | 2 +- build/pkgs/ipython/distros/opensuse.txt | 2 +- build/pkgs/jinja2/distros/opensuse.txt | 2 +- build/pkgs/jsonschema/distros/opensuse.txt | 2 +- build/pkgs/jupyter_client/distros/opensuse.txt | 2 +- build/pkgs/jupyter_core/distros/opensuse.txt | 2 +- build/pkgs/jupyterlab_widgets/distros/opensuse.txt | 2 +- build/pkgs/markupsafe/distros/opensuse.txt | 2 +- build/pkgs/matplotlib/distros/opensuse.txt | 2 +- build/pkgs/mpmath/distros/opensuse.txt | 2 +- build/pkgs/networkx/distros/opensuse.txt | 2 +- build/pkgs/nibabel/distros/opensuse.txt | 2 +- build/pkgs/numpy/distros/opensuse.txt | 2 +- build/pkgs/packaging/distros/opensuse.txt | 2 +- build/pkgs/pandocfilters/distros/opensuse.txt | 2 +- build/pkgs/pexpect/distros/opensuse.txt | 2 +- build/pkgs/pickleshare/distros/opensuse.txt | 2 +- build/pkgs/pillow/distros/opensuse.txt | 2 +- build/pkgs/pip/distros/opensuse.txt | 2 +- build/pkgs/pluggy/distros/opensuse.txt | 2 +- build/pkgs/prometheus_client/distros/opensuse.txt | 2 +- build/pkgs/prompt_toolkit/distros/opensuse.txt | 2 +- build/pkgs/ptyprocess/distros/opensuse.txt | 2 +- build/pkgs/py/distros/opensuse.txt | 2 +- build/pkgs/pybtex/distros/opensuse.txt | 2 +- build/pkgs/pycparser/distros/opensuse.txt | 2 +- build/pkgs/pygments/distros/opensuse.txt | 2 +- build/pkgs/pyparsing/distros/opensuse.txt | 2 +- build/pkgs/python3/distros/opensuse.txt | 2 +- build/pkgs/pytz/distros/opensuse.txt | 2 +- build/pkgs/pyx/distros/opensuse.txt | 2 +- build/pkgs/pyzmq/distros/opensuse.txt | 2 +- build/pkgs/requests/distros/opensuse.txt | 2 +- build/pkgs/rpy2/distros/opensuse.txt | 2 +- build/pkgs/scipy/distros/opensuse.txt | 2 +- build/pkgs/send2trash/distros/opensuse.txt | 2 +- build/pkgs/setuptools/distros/opensuse.txt | 2 +- build/pkgs/setuptools_scm/distros/opensuse.txt | 2 +- build/pkgs/simplegeneric/distros/opensuse.txt | 2 +- build/pkgs/six/distros/opensuse.txt | 2 +- build/pkgs/snowballstemmer/distros/opensuse.txt | 2 +- build/pkgs/sphinx/distros/opensuse.txt | 2 +- build/pkgs/sphinxcontrib_applehelp/distros/opensuse.txt | 2 +- build/pkgs/sphinxcontrib_devhelp/distros/opensuse.txt | 2 +- build/pkgs/sphinxcontrib_htmlhelp/distros/opensuse.txt | 2 +- build/pkgs/sphinxcontrib_jsmath/distros/opensuse.txt | 2 +- build/pkgs/sphinxcontrib_qthelp/distros/opensuse.txt | 2 +- build/pkgs/sphinxcontrib_serializinghtml/distros/opensuse.txt | 2 +- build/pkgs/sphinxcontrib_websupport/distros/opensuse.txt | 2 +- build/pkgs/sqlalchemy/distros/opensuse.txt | 2 +- build/pkgs/sympy/distros/opensuse.txt | 2 +- build/pkgs/texttable/distros/opensuse.txt | 2 +- build/pkgs/toml/distros/opensuse.txt | 2 +- build/pkgs/tornado/distros/opensuse.txt | 2 +- build/pkgs/traitlets/distros/opensuse.txt | 2 +- build/pkgs/typing_extensions/distros/opensuse.txt | 2 +- build/pkgs/tzlocal/distros/opensuse.txt | 2 +- build/pkgs/urllib3/distros/opensuse.txt | 2 +- build/pkgs/vcversioner/distros/opensuse.txt | 2 +- build/pkgs/wcwidth/distros/opensuse.txt | 2 +- build/pkgs/webencodings/distros/opensuse.txt | 2 +- build/pkgs/wheel/distros/opensuse.txt | 2 +- 77 files changed, 77 insertions(+), 77 deletions(-) diff --git a/build/pkgs/alabaster/distros/opensuse.txt b/build/pkgs/alabaster/distros/opensuse.txt index dcc39f9e849..debe990ce19 100644 --- a/build/pkgs/alabaster/distros/opensuse.txt +++ b/build/pkgs/alabaster/distros/opensuse.txt @@ -1 +1 @@ -python3-alabaster +python3${PYTHON_MINOR}-alabaster diff --git a/build/pkgs/babel/distros/opensuse.txt b/build/pkgs/babel/distros/opensuse.txt index 70bb05b1327..6372e2e77da 100644 --- a/build/pkgs/babel/distros/opensuse.txt +++ b/build/pkgs/babel/distros/opensuse.txt @@ -1 +1 @@ -python3-Babel +python3${PYTHON_MINOR}-Babel diff --git a/build/pkgs/bleach/distros/opensuse.txt b/build/pkgs/bleach/distros/opensuse.txt index 6d37c4c79f0..0e329f6dd62 100644 --- a/build/pkgs/bleach/distros/opensuse.txt +++ b/build/pkgs/bleach/distros/opensuse.txt @@ -1 +1 @@ -python3-bleach +python3${PYTHON_MINOR}-bleach diff --git a/build/pkgs/certifi/distros/opensuse.txt b/build/pkgs/certifi/distros/opensuse.txt index f585a823bf3..9f7a6b5c964 100644 --- a/build/pkgs/certifi/distros/opensuse.txt +++ b/build/pkgs/certifi/distros/opensuse.txt @@ -1 +1 @@ -python3-certifi +python3${PYTHON_MINOR}-certifi diff --git a/build/pkgs/cffi/distros/opensuse.txt b/build/pkgs/cffi/distros/opensuse.txt index 68ec4dda5ba..6bce4cd18b5 100644 --- a/build/pkgs/cffi/distros/opensuse.txt +++ b/build/pkgs/cffi/distros/opensuse.txt @@ -1 +1 @@ -python3-cffi +python3${PYTHON_MINOR}-cffi diff --git a/build/pkgs/cvxopt/distros/opensuse.txt b/build/pkgs/cvxopt/distros/opensuse.txt index 2bb6ad1e834..e254c198706 100644 --- a/build/pkgs/cvxopt/distros/opensuse.txt +++ b/build/pkgs/cvxopt/distros/opensuse.txt @@ -1 +1 @@ -python3-cvxopt +python3${PYTHON_MINOR}-cvxopt diff --git a/build/pkgs/cycler/distros/opensuse.txt b/build/pkgs/cycler/distros/opensuse.txt index 93efd62d380..6aab7454acb 100644 --- a/build/pkgs/cycler/distros/opensuse.txt +++ b/build/pkgs/cycler/distros/opensuse.txt @@ -1 +1 @@ -python-Cycler +python3${PYTHON_MINOR}-Cycler diff --git a/build/pkgs/cython/distros/opensuse.txt b/build/pkgs/cython/distros/opensuse.txt index c6e300e6a2b..09d8844feaf 100644 --- a/build/pkgs/cython/distros/opensuse.txt +++ b/build/pkgs/cython/distros/opensuse.txt @@ -1 +1 @@ -python-Cython +python3${PYTHON_MINOR}-Cython diff --git a/build/pkgs/dateutil/distros/opensuse.txt b/build/pkgs/dateutil/distros/opensuse.txt index a6c93c7710a..ba37df671e5 100644 --- a/build/pkgs/dateutil/distros/opensuse.txt +++ b/build/pkgs/dateutil/distros/opensuse.txt @@ -1 +1 @@ -python-python-dateutil +python3${PYTHON_MINOR}-python-dateutil diff --git a/build/pkgs/decorator/distros/opensuse.txt b/build/pkgs/decorator/distros/opensuse.txt index 46c478e1513..4b9085da296 100644 --- a/build/pkgs/decorator/distros/opensuse.txt +++ b/build/pkgs/decorator/distros/opensuse.txt @@ -1 +1 @@ -python3-decorator +python3${PYTHON_MINOR}-decorator diff --git a/build/pkgs/docutils/distros/opensuse.txt b/build/pkgs/docutils/distros/opensuse.txt index a4bb792a5a4..a7fcdac14ef 100644 --- a/build/pkgs/docutils/distros/opensuse.txt +++ b/build/pkgs/docutils/distros/opensuse.txt @@ -1 +1 @@ -python3-docutils +python3${PYTHON_MINOR}-docutils diff --git a/build/pkgs/gmpy2/distros/opensuse.txt b/build/pkgs/gmpy2/distros/opensuse.txt index d4464a5ce2c..36d52b88ba6 100644 --- a/build/pkgs/gmpy2/distros/opensuse.txt +++ b/build/pkgs/gmpy2/distros/opensuse.txt @@ -1 +1 @@ -python-gmpy2 +python3${PYTHON_MINOR}-gmpy2 diff --git a/build/pkgs/html5lib/distros/opensuse.txt b/build/pkgs/html5lib/distros/opensuse.txt index 6d7b8dfb001..99d5afb4a02 100644 --- a/build/pkgs/html5lib/distros/opensuse.txt +++ b/build/pkgs/html5lib/distros/opensuse.txt @@ -1 +1 @@ -python3-html5lib +python3${PYTHON_MINOR}-html5lib diff --git a/build/pkgs/idna/distros/opensuse.txt b/build/pkgs/idna/distros/opensuse.txt index de48e70887b..ea8400fa563 100644 --- a/build/pkgs/idna/distros/opensuse.txt +++ b/build/pkgs/idna/distros/opensuse.txt @@ -1 +1 @@ -python3-idna +python3${PYTHON_MINOR}-idna diff --git a/build/pkgs/importlib_metadata/distros/opensuse.txt b/build/pkgs/importlib_metadata/distros/opensuse.txt index b3c206287ec..7a665131cd4 100644 --- a/build/pkgs/importlib_metadata/distros/opensuse.txt +++ b/build/pkgs/importlib_metadata/distros/opensuse.txt @@ -1 +1 @@ -python-importlib-metadata +python3${PYTHON_MINOR}-importlib-metadata diff --git a/build/pkgs/ipykernel/distros/opensuse.txt b/build/pkgs/ipykernel/distros/opensuse.txt index 286458797f7..1485db27e0d 100644 --- a/build/pkgs/ipykernel/distros/opensuse.txt +++ b/build/pkgs/ipykernel/distros/opensuse.txt @@ -1 +1 @@ -python-ipykernel +python3${PYTHON_MINOR}-ipykernel diff --git a/build/pkgs/ipython/distros/opensuse.txt b/build/pkgs/ipython/distros/opensuse.txt index c32c6b449cf..32aac30ae1e 100644 --- a/build/pkgs/ipython/distros/opensuse.txt +++ b/build/pkgs/ipython/distros/opensuse.txt @@ -1 +1 @@ -python3-ipython +python3${PYTHON_MINOR}-ipython diff --git a/build/pkgs/jinja2/distros/opensuse.txt b/build/pkgs/jinja2/distros/opensuse.txt index f2db865ab36..8ad585a7ef3 100644 --- a/build/pkgs/jinja2/distros/opensuse.txt +++ b/build/pkgs/jinja2/distros/opensuse.txt @@ -1 +1 @@ -python3-jinja2 +python3${PYTHON_MINOR}-jinja2 diff --git a/build/pkgs/jsonschema/distros/opensuse.txt b/build/pkgs/jsonschema/distros/opensuse.txt index 047e6cc5d1d..2a587a55946 100644 --- a/build/pkgs/jsonschema/distros/opensuse.txt +++ b/build/pkgs/jsonschema/distros/opensuse.txt @@ -1 +1 @@ -python3-jsonschema +python3${PYTHON_MINOR}-jsonschema diff --git a/build/pkgs/jupyter_client/distros/opensuse.txt b/build/pkgs/jupyter_client/distros/opensuse.txt index 0159b2d7b90..a1e21956a79 100644 --- a/build/pkgs/jupyter_client/distros/opensuse.txt +++ b/build/pkgs/jupyter_client/distros/opensuse.txt @@ -1 +1 @@ -python3-jupyter-client +python3${PYTHON_MINOR}-jupyter-client diff --git a/build/pkgs/jupyter_core/distros/opensuse.txt b/build/pkgs/jupyter_core/distros/opensuse.txt index 2f316f2ee07..2c677674477 100644 --- a/build/pkgs/jupyter_core/distros/opensuse.txt +++ b/build/pkgs/jupyter_core/distros/opensuse.txt @@ -1 +1 @@ -python3-jupyter-core +python3${PYTHON_MINOR}-jupyter-core diff --git a/build/pkgs/jupyterlab_widgets/distros/opensuse.txt b/build/pkgs/jupyterlab_widgets/distros/opensuse.txt index 651221f2ba2..04706eee600 100644 --- a/build/pkgs/jupyterlab_widgets/distros/opensuse.txt +++ b/build/pkgs/jupyterlab_widgets/distros/opensuse.txt @@ -1 +1 @@ -python-jupyterlab-widgets +python3${PYTHON_MINOR}-jupyterlab-widgets diff --git a/build/pkgs/markupsafe/distros/opensuse.txt b/build/pkgs/markupsafe/distros/opensuse.txt index 483c7ee1e18..8c103c6b5e5 100644 --- a/build/pkgs/markupsafe/distros/opensuse.txt +++ b/build/pkgs/markupsafe/distros/opensuse.txt @@ -1 +1 @@ -python3-MarkupSafe +python3${PYTHON_MINOR}-MarkupSafe diff --git a/build/pkgs/matplotlib/distros/opensuse.txt b/build/pkgs/matplotlib/distros/opensuse.txt index 13743297213..40f1130ec6f 100644 --- a/build/pkgs/matplotlib/distros/opensuse.txt +++ b/build/pkgs/matplotlib/distros/opensuse.txt @@ -1 +1 @@ -python3-matplotlib +python3${PYTHON_MINOR}-matplotlib diff --git a/build/pkgs/mpmath/distros/opensuse.txt b/build/pkgs/mpmath/distros/opensuse.txt index fbc82a97e07..8b65d97862d 100644 --- a/build/pkgs/mpmath/distros/opensuse.txt +++ b/build/pkgs/mpmath/distros/opensuse.txt @@ -1 +1 @@ -python3-mpmath +python3${PYTHON_MINOR}-mpmath diff --git a/build/pkgs/networkx/distros/opensuse.txt b/build/pkgs/networkx/distros/opensuse.txt index 67790667af2..7c421f08d48 100644 --- a/build/pkgs/networkx/distros/opensuse.txt +++ b/build/pkgs/networkx/distros/opensuse.txt @@ -1 +1 @@ -python3-networkx +python3${PYTHON_MINOR}-networkx diff --git a/build/pkgs/nibabel/distros/opensuse.txt b/build/pkgs/nibabel/distros/opensuse.txt index 19df029d93f..1a7f1fd31f7 100644 --- a/build/pkgs/nibabel/distros/opensuse.txt +++ b/build/pkgs/nibabel/distros/opensuse.txt @@ -1 +1 @@ -python3-nibabel +python3${PYTHON_MINOR}-nibabel diff --git a/build/pkgs/numpy/distros/opensuse.txt b/build/pkgs/numpy/distros/opensuse.txt index 79d5c5a1429..2e278515236 100644 --- a/build/pkgs/numpy/distros/opensuse.txt +++ b/build/pkgs/numpy/distros/opensuse.txt @@ -1 +1 @@ -python3-numpy +python3${PYTHON_MINOR}-numpy diff --git a/build/pkgs/packaging/distros/opensuse.txt b/build/pkgs/packaging/distros/opensuse.txt index 8f1c0ffc29f..bec5186f923 100644 --- a/build/pkgs/packaging/distros/opensuse.txt +++ b/build/pkgs/packaging/distros/opensuse.txt @@ -1 +1 @@ -python3-packaging +python3${PYTHON_MINOR}-packaging diff --git a/build/pkgs/pandocfilters/distros/opensuse.txt b/build/pkgs/pandocfilters/distros/opensuse.txt index d0d4c24e15e..843b3c1b32b 100644 --- a/build/pkgs/pandocfilters/distros/opensuse.txt +++ b/build/pkgs/pandocfilters/distros/opensuse.txt @@ -1 +1 @@ -python3-pandocfilters +python3${PYTHON_MINOR}-pandocfilters diff --git a/build/pkgs/pexpect/distros/opensuse.txt b/build/pkgs/pexpect/distros/opensuse.txt index 8d745ee4a07..f8cc97d1599 100644 --- a/build/pkgs/pexpect/distros/opensuse.txt +++ b/build/pkgs/pexpect/distros/opensuse.txt @@ -1 +1 @@ -python3-pexpect +python3${PYTHON_MINOR}-pexpect diff --git a/build/pkgs/pickleshare/distros/opensuse.txt b/build/pkgs/pickleshare/distros/opensuse.txt index a00907d167b..260701493fc 100644 --- a/build/pkgs/pickleshare/distros/opensuse.txt +++ b/build/pkgs/pickleshare/distros/opensuse.txt @@ -1 +1 @@ -python3-pickleshare +python3${PYTHON_MINOR}-pickleshare diff --git a/build/pkgs/pillow/distros/opensuse.txt b/build/pkgs/pillow/distros/opensuse.txt index 88283bea6d9..8261b108af6 100644 --- a/build/pkgs/pillow/distros/opensuse.txt +++ b/build/pkgs/pillow/distros/opensuse.txt @@ -1 +1 @@ -python3-Pillow +python3${PYTHON_MINOR}-Pillow diff --git a/build/pkgs/pip/distros/opensuse.txt b/build/pkgs/pip/distros/opensuse.txt index 39bd9fc5097..eb4aa7ea9f1 100644 --- a/build/pkgs/pip/distros/opensuse.txt +++ b/build/pkgs/pip/distros/opensuse.txt @@ -1 +1 @@ -python3-pip +python3${PYTHON_MINOR}-pip diff --git a/build/pkgs/pluggy/distros/opensuse.txt b/build/pkgs/pluggy/distros/opensuse.txt index 43a3acf0462..42720b43944 100644 --- a/build/pkgs/pluggy/distros/opensuse.txt +++ b/build/pkgs/pluggy/distros/opensuse.txt @@ -1 +1 @@ -python3-pluggy +python3${PYTHON_MINOR}-pluggy diff --git a/build/pkgs/prometheus_client/distros/opensuse.txt b/build/pkgs/prometheus_client/distros/opensuse.txt index 4d7723ec37e..c061661b6e6 100644 --- a/build/pkgs/prometheus_client/distros/opensuse.txt +++ b/build/pkgs/prometheus_client/distros/opensuse.txt @@ -1 +1 @@ -python3-prometheus_client +python3${PYTHON_MINOR}-prometheus_client diff --git a/build/pkgs/prompt_toolkit/distros/opensuse.txt b/build/pkgs/prompt_toolkit/distros/opensuse.txt index 89b0ac83a9b..3c48b809bc1 100644 --- a/build/pkgs/prompt_toolkit/distros/opensuse.txt +++ b/build/pkgs/prompt_toolkit/distros/opensuse.txt @@ -1 +1 @@ -python-importlib_resources +python3${PYTHON_MINOR}-importlib_resources diff --git a/build/pkgs/ptyprocess/distros/opensuse.txt b/build/pkgs/ptyprocess/distros/opensuse.txt index ad4f6db1ca7..846495a86e8 100644 --- a/build/pkgs/ptyprocess/distros/opensuse.txt +++ b/build/pkgs/ptyprocess/distros/opensuse.txt @@ -1 +1 @@ -python3-ptyprocess +python3${PYTHON_MINOR}-ptyprocess diff --git a/build/pkgs/py/distros/opensuse.txt b/build/pkgs/py/distros/opensuse.txt index 81fefe60903..c03de61a449 100644 --- a/build/pkgs/py/distros/opensuse.txt +++ b/build/pkgs/py/distros/opensuse.txt @@ -1 +1 @@ -python3-py +python3${PYTHON_MINOR}-py diff --git a/build/pkgs/pybtex/distros/opensuse.txt b/build/pkgs/pybtex/distros/opensuse.txt index bdd39a48fde..e482a1bfea0 100644 --- a/build/pkgs/pybtex/distros/opensuse.txt +++ b/build/pkgs/pybtex/distros/opensuse.txt @@ -1 +1 @@ -python3-pybtex +python3${PYTHON_MINOR}-pybtex diff --git a/build/pkgs/pycparser/distros/opensuse.txt b/build/pkgs/pycparser/distros/opensuse.txt index 0ba4f8b19f5..503e7c176d1 100644 --- a/build/pkgs/pycparser/distros/opensuse.txt +++ b/build/pkgs/pycparser/distros/opensuse.txt @@ -1 +1 @@ -python3-pycparser +python3${PYTHON_MINOR}-pycparser diff --git a/build/pkgs/pygments/distros/opensuse.txt b/build/pkgs/pygments/distros/opensuse.txt index 3ab37929b2c..ef63366ff27 100644 --- a/build/pkgs/pygments/distros/opensuse.txt +++ b/build/pkgs/pygments/distros/opensuse.txt @@ -1 +1 @@ -python3-pygments +python3${PYTHON_MINOR}-pygments diff --git a/build/pkgs/pyparsing/distros/opensuse.txt b/build/pkgs/pyparsing/distros/opensuse.txt index 492a7ce0a69..2a91a003cf9 100644 --- a/build/pkgs/pyparsing/distros/opensuse.txt +++ b/build/pkgs/pyparsing/distros/opensuse.txt @@ -1 +1 @@ -python3-pyparsing +python3${PYTHON_MINOR}-pyparsing diff --git a/build/pkgs/python3/distros/opensuse.txt b/build/pkgs/python3/distros/opensuse.txt index 07358a92e89..760ddd76f2c 100644 --- a/build/pkgs/python3/distros/opensuse.txt +++ b/build/pkgs/python3/distros/opensuse.txt @@ -1 +1 @@ -python3-devel +python3${PYTHON_MINOR}-devel diff --git a/build/pkgs/pytz/distros/opensuse.txt b/build/pkgs/pytz/distros/opensuse.txt index 1b20e1dbb77..232b99a6d04 100644 --- a/build/pkgs/pytz/distros/opensuse.txt +++ b/build/pkgs/pytz/distros/opensuse.txt @@ -1 +1 @@ -python3-pytz +python3${PYTHON_MINOR}-pytz diff --git a/build/pkgs/pyx/distros/opensuse.txt b/build/pkgs/pyx/distros/opensuse.txt index 03265558e86..f7dd2365b82 100644 --- a/build/pkgs/pyx/distros/opensuse.txt +++ b/build/pkgs/pyx/distros/opensuse.txt @@ -1 +1 @@ -python3-PyX +python3${PYTHON_MINOR}-PyX diff --git a/build/pkgs/pyzmq/distros/opensuse.txt b/build/pkgs/pyzmq/distros/opensuse.txt index 265a272130e..fe243347c49 100644 --- a/build/pkgs/pyzmq/distros/opensuse.txt +++ b/build/pkgs/pyzmq/distros/opensuse.txt @@ -1 +1 @@ -python3-pyzmq +python3${PYTHON_MINOR}-pyzmq diff --git a/build/pkgs/requests/distros/opensuse.txt b/build/pkgs/requests/distros/opensuse.txt index 43147b2be74..c1581ad8a95 100644 --- a/build/pkgs/requests/distros/opensuse.txt +++ b/build/pkgs/requests/distros/opensuse.txt @@ -1 +1 @@ -python3-requests +python3${PYTHON_MINOR}-requests diff --git a/build/pkgs/rpy2/distros/opensuse.txt b/build/pkgs/rpy2/distros/opensuse.txt index 9748535a285..5b9c1542845 100644 --- a/build/pkgs/rpy2/distros/opensuse.txt +++ b/build/pkgs/rpy2/distros/opensuse.txt @@ -1 +1 @@ -python-rpy2 +python3${PYTHON_MINOR}-rpy2 diff --git a/build/pkgs/scipy/distros/opensuse.txt b/build/pkgs/scipy/distros/opensuse.txt index 12b366666d6..d2bc2a30a85 100644 --- a/build/pkgs/scipy/distros/opensuse.txt +++ b/build/pkgs/scipy/distros/opensuse.txt @@ -1 +1 @@ -python3-scipy +python3${PYTHON_MINOR}-scipy diff --git a/build/pkgs/send2trash/distros/opensuse.txt b/build/pkgs/send2trash/distros/opensuse.txt index 404e2bd3580..8d3c81fa23c 100644 --- a/build/pkgs/send2trash/distros/opensuse.txt +++ b/build/pkgs/send2trash/distros/opensuse.txt @@ -1 +1 @@ -python3-Send2Trash +python3${PYTHON_MINOR}-Send2Trash diff --git a/build/pkgs/setuptools/distros/opensuse.txt b/build/pkgs/setuptools/distros/opensuse.txt index 1c0901c0374..b2d8de78f80 100644 --- a/build/pkgs/setuptools/distros/opensuse.txt +++ b/build/pkgs/setuptools/distros/opensuse.txt @@ -1 +1 @@ -python3-setuptools +python3${PYTHON_MINOR}-setuptools diff --git a/build/pkgs/setuptools_scm/distros/opensuse.txt b/build/pkgs/setuptools_scm/distros/opensuse.txt index 2aa5ca12cba..cacb303c566 100644 --- a/build/pkgs/setuptools_scm/distros/opensuse.txt +++ b/build/pkgs/setuptools_scm/distros/opensuse.txt @@ -1 +1 @@ -python3-setuptools_scm +python3${PYTHON_MINOR}-setuptools_scm diff --git a/build/pkgs/simplegeneric/distros/opensuse.txt b/build/pkgs/simplegeneric/distros/opensuse.txt index d788a7233a7..ddc1661a230 100644 --- a/build/pkgs/simplegeneric/distros/opensuse.txt +++ b/build/pkgs/simplegeneric/distros/opensuse.txt @@ -1 +1 @@ -python3-simplegeneric +python3${PYTHON_MINOR}-simplegeneric diff --git a/build/pkgs/six/distros/opensuse.txt b/build/pkgs/six/distros/opensuse.txt index 68ff8595d0b..127cfc6a26a 100644 --- a/build/pkgs/six/distros/opensuse.txt +++ b/build/pkgs/six/distros/opensuse.txt @@ -1 +1 @@ -python3-six +python3${PYTHON_MINOR}-six diff --git a/build/pkgs/snowballstemmer/distros/opensuse.txt b/build/pkgs/snowballstemmer/distros/opensuse.txt index 09b2636df60..a21cc876a24 100644 --- a/build/pkgs/snowballstemmer/distros/opensuse.txt +++ b/build/pkgs/snowballstemmer/distros/opensuse.txt @@ -1 +1 @@ -python3-snowballstemmer +python3${PYTHON_MINOR}-snowballstemmer diff --git a/build/pkgs/sphinx/distros/opensuse.txt b/build/pkgs/sphinx/distros/opensuse.txt index bc54d0bd553..0aa0566b066 100644 --- a/build/pkgs/sphinx/distros/opensuse.txt +++ b/build/pkgs/sphinx/distros/opensuse.txt @@ -1 +1 @@ -python3-Sphinx +python3${PYTHON_MINOR}-Sphinx diff --git a/build/pkgs/sphinxcontrib_applehelp/distros/opensuse.txt b/build/pkgs/sphinxcontrib_applehelp/distros/opensuse.txt index 3754baa21f5..9d71e79f307 100644 --- a/build/pkgs/sphinxcontrib_applehelp/distros/opensuse.txt +++ b/build/pkgs/sphinxcontrib_applehelp/distros/opensuse.txt @@ -1 +1 @@ -python-sphinxcontrib-applehelp +python3${PYTHON_MINOR}-sphinxcontrib-applehelp diff --git a/build/pkgs/sphinxcontrib_devhelp/distros/opensuse.txt b/build/pkgs/sphinxcontrib_devhelp/distros/opensuse.txt index 0b1b3e44a6b..95012c2425d 100644 --- a/build/pkgs/sphinxcontrib_devhelp/distros/opensuse.txt +++ b/build/pkgs/sphinxcontrib_devhelp/distros/opensuse.txt @@ -1 +1 @@ -python-sphinxcontrib-devhelp +python3${PYTHON_MINOR}-sphinxcontrib-devhelp diff --git a/build/pkgs/sphinxcontrib_htmlhelp/distros/opensuse.txt b/build/pkgs/sphinxcontrib_htmlhelp/distros/opensuse.txt index 81390fd522f..5859fe855bb 100644 --- a/build/pkgs/sphinxcontrib_htmlhelp/distros/opensuse.txt +++ b/build/pkgs/sphinxcontrib_htmlhelp/distros/opensuse.txt @@ -1 +1 @@ -python-sphinxcontrib-htmlhelp +python3${PYTHON_MINOR}-sphinxcontrib-htmlhelp diff --git a/build/pkgs/sphinxcontrib_jsmath/distros/opensuse.txt b/build/pkgs/sphinxcontrib_jsmath/distros/opensuse.txt index 2b4927832ac..dbe478264db 100644 --- a/build/pkgs/sphinxcontrib_jsmath/distros/opensuse.txt +++ b/build/pkgs/sphinxcontrib_jsmath/distros/opensuse.txt @@ -1 +1 @@ -python-sphinxcontrib-jsmath +python3${PYTHON_MINOR}-sphinxcontrib-jsmath diff --git a/build/pkgs/sphinxcontrib_qthelp/distros/opensuse.txt b/build/pkgs/sphinxcontrib_qthelp/distros/opensuse.txt index 2c11924a5df..9462502bae5 100644 --- a/build/pkgs/sphinxcontrib_qthelp/distros/opensuse.txt +++ b/build/pkgs/sphinxcontrib_qthelp/distros/opensuse.txt @@ -1 +1 @@ -python-sphinxcontrib-qthelp +python3${PYTHON_MINOR}-sphinxcontrib-qthelp diff --git a/build/pkgs/sphinxcontrib_serializinghtml/distros/opensuse.txt b/build/pkgs/sphinxcontrib_serializinghtml/distros/opensuse.txt index 46d22be403f..7a647e3e36a 100644 --- a/build/pkgs/sphinxcontrib_serializinghtml/distros/opensuse.txt +++ b/build/pkgs/sphinxcontrib_serializinghtml/distros/opensuse.txt @@ -1 +1 @@ -python-sphinxcontrib-serializinghtml +python3${PYTHON_MINOR}-sphinxcontrib-serializinghtml diff --git a/build/pkgs/sphinxcontrib_websupport/distros/opensuse.txt b/build/pkgs/sphinxcontrib_websupport/distros/opensuse.txt index a9a5a1a1727..d01c76bd534 100644 --- a/build/pkgs/sphinxcontrib_websupport/distros/opensuse.txt +++ b/build/pkgs/sphinxcontrib_websupport/distros/opensuse.txt @@ -1 +1 @@ -python-sphinxcontrib-websupport +python3${PYTHON_MINOR}-sphinxcontrib-websupport diff --git a/build/pkgs/sqlalchemy/distros/opensuse.txt b/build/pkgs/sqlalchemy/distros/opensuse.txt index 023e06b7468..0a1757fd5b3 100644 --- a/build/pkgs/sqlalchemy/distros/opensuse.txt +++ b/build/pkgs/sqlalchemy/distros/opensuse.txt @@ -1 +1 @@ -python3-SQLAlchemy +python3${PYTHON_MINOR}-SQLAlchemy diff --git a/build/pkgs/sympy/distros/opensuse.txt b/build/pkgs/sympy/distros/opensuse.txt index db423c87ba7..bea17da35b4 100644 --- a/build/pkgs/sympy/distros/opensuse.txt +++ b/build/pkgs/sympy/distros/opensuse.txt @@ -1 +1 @@ -python3-sympy +python3${PYTHON_MINOR}-sympy diff --git a/build/pkgs/texttable/distros/opensuse.txt b/build/pkgs/texttable/distros/opensuse.txt index 8f8e7e29d7a..d4959328e94 100644 --- a/build/pkgs/texttable/distros/opensuse.txt +++ b/build/pkgs/texttable/distros/opensuse.txt @@ -1 +1 @@ -python3-texttable +python3${PYTHON_MINOR}-texttable diff --git a/build/pkgs/toml/distros/opensuse.txt b/build/pkgs/toml/distros/opensuse.txt index 543e89d2a6f..fbc340aee15 100644 --- a/build/pkgs/toml/distros/opensuse.txt +++ b/build/pkgs/toml/distros/opensuse.txt @@ -1 +1 @@ -python3-toml +python3${PYTHON_MINOR}-toml diff --git a/build/pkgs/tornado/distros/opensuse.txt b/build/pkgs/tornado/distros/opensuse.txt index 426685be95b..1f37b341221 100644 --- a/build/pkgs/tornado/distros/opensuse.txt +++ b/build/pkgs/tornado/distros/opensuse.txt @@ -1 +1 @@ -python3-tornado +python3${PYTHON_MINOR}-tornado diff --git a/build/pkgs/traitlets/distros/opensuse.txt b/build/pkgs/traitlets/distros/opensuse.txt index 93cb8375e46..f0cc6730e1f 100644 --- a/build/pkgs/traitlets/distros/opensuse.txt +++ b/build/pkgs/traitlets/distros/opensuse.txt @@ -1 +1 @@ -python3-traitlets +python3${PYTHON_MINOR}-traitlets diff --git a/build/pkgs/typing_extensions/distros/opensuse.txt b/build/pkgs/typing_extensions/distros/opensuse.txt index 92ad68dabc4..62a10cbbc72 100644 --- a/build/pkgs/typing_extensions/distros/opensuse.txt +++ b/build/pkgs/typing_extensions/distros/opensuse.txt @@ -1 +1 @@ -python-typing_extensions +python3${PYTHON_MINOR}-typing_extensions diff --git a/build/pkgs/tzlocal/distros/opensuse.txt b/build/pkgs/tzlocal/distros/opensuse.txt index 95d2d705c05..2e4de5e9e49 100644 --- a/build/pkgs/tzlocal/distros/opensuse.txt +++ b/build/pkgs/tzlocal/distros/opensuse.txt @@ -1 +1 @@ -python3-tzlocal +python3${PYTHON_MINOR}-tzlocal diff --git a/build/pkgs/urllib3/distros/opensuse.txt b/build/pkgs/urllib3/distros/opensuse.txt index af6e58664fb..7466e3c2bdd 100644 --- a/build/pkgs/urllib3/distros/opensuse.txt +++ b/build/pkgs/urllib3/distros/opensuse.txt @@ -1 +1 @@ -python-urllib3 +python3${PYTHON_MINOR}-urllib3 diff --git a/build/pkgs/vcversioner/distros/opensuse.txt b/build/pkgs/vcversioner/distros/opensuse.txt index 3a9b9818aa4..a9b307f8509 100644 --- a/build/pkgs/vcversioner/distros/opensuse.txt +++ b/build/pkgs/vcversioner/distros/opensuse.txt @@ -1 +1 @@ -python3-vcversioner +python3${PYTHON_MINOR}-vcversioner diff --git a/build/pkgs/wcwidth/distros/opensuse.txt b/build/pkgs/wcwidth/distros/opensuse.txt index 2974220c878..8fea03a6c67 100644 --- a/build/pkgs/wcwidth/distros/opensuse.txt +++ b/build/pkgs/wcwidth/distros/opensuse.txt @@ -1 +1 @@ -python3-wcwidth +python3${PYTHON_MINOR}-wcwidth diff --git a/build/pkgs/webencodings/distros/opensuse.txt b/build/pkgs/webencodings/distros/opensuse.txt index ac30c2f3307..b8d9c4d299c 100644 --- a/build/pkgs/webencodings/distros/opensuse.txt +++ b/build/pkgs/webencodings/distros/opensuse.txt @@ -1 +1 @@ -python3-webencodings +python3${PYTHON_MINOR}-webencodings diff --git a/build/pkgs/wheel/distros/opensuse.txt b/build/pkgs/wheel/distros/opensuse.txt index 3c066725a1d..3df335c1375 100644 --- a/build/pkgs/wheel/distros/opensuse.txt +++ b/build/pkgs/wheel/distros/opensuse.txt @@ -1 +1 @@ -python3-wheel +python3${PYTHON_MINOR}-wheel From c076df43eff6d282d81abc5d25688018cd256cc3 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 30 Aug 2023 10:15:56 -0700 Subject: [PATCH 353/423] build/bin/write-dockerfile.sh: Substitute ${PYTHON_MINOR} --- build/bin/write-dockerfile.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/bin/write-dockerfile.sh b/build/bin/write-dockerfile.sh index 85b51245b29..6980f6b6e4b 100755 --- a/build/bin/write-dockerfile.sh +++ b/build/bin/write-dockerfile.sh @@ -16,7 +16,7 @@ export PATH="$SAGE_ROOT"/build/bin:$PATH SYSTEM_PACKAGES=$EXTRA_SYSTEM_PACKAGES CONFIGURE_ARGS="--enable-option-checking " for SPKG in $(sage-package list --has-file=spkg-configure.m4 $SAGE_PACKAGE_LIST_ARGS) $EXTRA_SAGE_PACKAGES; do - SYSTEM_PACKAGE=$(sage-get-system-packages $SYSTEM $SPKG) + SYSTEM_PACKAGE=$(sage-get-system-packages $SYSTEM $SPKG | sed 's/${PYTHON_MINOR}/'${PYTHON_MINOR}'/g') if [ -n "${SYSTEM_PACKAGE}" ]; then # SYSTEM_PACKAGE can be empty if, for example, the environment # variable ENABLE_SYSTEM_SITE_PACKAGES is empty. From 409ac5ac2135e2a6d912b916f14981d186ae319c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 30 Aug 2023 15:21:59 -0400 Subject: [PATCH 354/423] configure.ac: remove pyvenv.cfg when ./configure is run This is necessary to trigger a rebuild of pyvenv.cfg, in case the value of --enable-system-site-packages has changed. --- configure.ac | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/configure.ac b/configure.ac index 26515d45839..701731ae191 100644 --- a/configure.ac +++ b/configure.ac @@ -609,6 +609,21 @@ AC_CONFIG_COMMANDS(links, [ eval SAGE_VENV="$SAGE_VENV"dnl eval so as to evaluate the embedded ${SAGE_LOCAL} ]) +AC_CONFIG_COMMANDS([pyenv.cfg],[ + dnl Erase the venv configuration so that it will be recreated, + dnl in case SAGE_VENV_FLAGS has changed. In particular we need + dnl to be able to toggle --enable-system-site-packages and have + dnl it actually take effect. + AC_MSG_NOTICE([Removing ${SAGE_VENV}/pyvenv.cfg in case SAGE_VENV_FLAGS have changed]) + rm -f "${SAGE_VENV}/pyvenv.cfg" +],[ + dnl Set $SAGE_LOCAL which does not happen automatically in + dnl in AC_CONFIG_COMMANDS actions. + SAGE_LOCAL="$SAGE_LOCAL" + dnl Evaluate the ${SAGE_LOCAL} often embedded in SAGE_VENV + eval SAGE_VENV="$SAGE_VENV" +]) + AC_OUTPUT() SAGE_SYSTEM_PACKAGE_NOTICE() From a1d8273bb0907d38f8d5486c7b0feea128c93096 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 30 Aug 2023 15:42:29 -0400 Subject: [PATCH 355/423] Revert "configure.ac: remove pyvenv.cfg when ./configure is run" This reverts commit 409ac5ac2135e2a6d912b916f14981d186ae319c. --- configure.ac | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/configure.ac b/configure.ac index 701731ae191..26515d45839 100644 --- a/configure.ac +++ b/configure.ac @@ -609,21 +609,6 @@ AC_CONFIG_COMMANDS(links, [ eval SAGE_VENV="$SAGE_VENV"dnl eval so as to evaluate the embedded ${SAGE_LOCAL} ]) -AC_CONFIG_COMMANDS([pyenv.cfg],[ - dnl Erase the venv configuration so that it will be recreated, - dnl in case SAGE_VENV_FLAGS has changed. In particular we need - dnl to be able to toggle --enable-system-site-packages and have - dnl it actually take effect. - AC_MSG_NOTICE([Removing ${SAGE_VENV}/pyvenv.cfg in case SAGE_VENV_FLAGS have changed]) - rm -f "${SAGE_VENV}/pyvenv.cfg" -],[ - dnl Set $SAGE_LOCAL which does not happen automatically in - dnl in AC_CONFIG_COMMANDS actions. - SAGE_LOCAL="$SAGE_LOCAL" - dnl Evaluate the ${SAGE_LOCAL} often embedded in SAGE_VENV - eval SAGE_VENV="$SAGE_VENV" -]) - AC_OUTPUT() SAGE_SYSTEM_PACKAGE_NOTICE() From ab4904bf0b806aa9014f0dc8386e74b79843ed35 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 30 Aug 2023 14:29:09 -0700 Subject: [PATCH 356/423] build/make/Makefile.in: Use a file separate from pyvenv.cfg as installation record --- build/make/Makefile.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build/make/Makefile.in b/build/make/Makefile.in index 7622c5f0f13..5c5a1a43d0c 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -227,6 +227,7 @@ SAGE_I_TARGETS = sagelib doc python3_venv _clean-broken-gcc PYTHON_FOR_VENV = @PYTHON_FOR_VENV@ +SAGE_VENV_FLAGS = @SAGE_VENV_FLAGS@ ifneq ($(PYTHON_FOR_VENV),) # Special rule for making the Python virtualenv from the system Python (Python @@ -239,10 +240,11 @@ ifneq ($(PYTHON_FOR_VENV),) ifeq ($(PYTHON),python3) PYTHON = python3_venv endif -inst_python3_venv = $(SAGE_VENV)/pyvenv.cfg +inst_python3_venv = $(SAGE_VENV)/$(SPKG_INST_RELDIR)/python3_venv-$(subst /,-,$(PYTHON_FOR_VENV))$(findstring --system-site-packages,$(SAGE_VENV_FLAGS)) $(inst_python3_venv): - $(PYTHON_FOR_VENV) $(SAGE_ROOT)/build/bin/sage-venv @SAGE_VENV_FLAGS@ "$(SAGE_VENV)" + $(PYTHON_FOR_VENV) $(SAGE_ROOT)/build/bin/sage-venv $(SAGE_VENV_FLAGS) "$(SAGE_VENV)" + touch $@ endif # Build everything and start Sage. From 0e0285cd34787d186d8d50e9437f6a10e0e21f41 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 30 Aug 2023 14:37:21 -0700 Subject: [PATCH 357/423] build/pkgs/setuptools_scm/distros: Add more --- build/pkgs/setuptools_scm/distros/arch.txt | 1 + build/pkgs/setuptools_scm/distros/debian.txt | 1 + build/pkgs/setuptools_scm/distros/fedora.txt | 1 + build/pkgs/setuptools_scm/distros/freebsd.txt | 1 + 4 files changed, 4 insertions(+) create mode 100644 build/pkgs/setuptools_scm/distros/arch.txt create mode 100644 build/pkgs/setuptools_scm/distros/debian.txt create mode 100644 build/pkgs/setuptools_scm/distros/fedora.txt create mode 100644 build/pkgs/setuptools_scm/distros/freebsd.txt diff --git a/build/pkgs/setuptools_scm/distros/arch.txt b/build/pkgs/setuptools_scm/distros/arch.txt new file mode 100644 index 00000000000..2b97444decf --- /dev/null +++ b/build/pkgs/setuptools_scm/distros/arch.txt @@ -0,0 +1 @@ +python-setuptools-scm diff --git a/build/pkgs/setuptools_scm/distros/debian.txt b/build/pkgs/setuptools_scm/distros/debian.txt new file mode 100644 index 00000000000..bcfdd6ebcdd --- /dev/null +++ b/build/pkgs/setuptools_scm/distros/debian.txt @@ -0,0 +1 @@ +setuptools-scm diff --git a/build/pkgs/setuptools_scm/distros/fedora.txt b/build/pkgs/setuptools_scm/distros/fedora.txt new file mode 100644 index 00000000000..720fd2897be --- /dev/null +++ b/build/pkgs/setuptools_scm/distros/fedora.txt @@ -0,0 +1 @@ +python-setuptools_scm diff --git a/build/pkgs/setuptools_scm/distros/freebsd.txt b/build/pkgs/setuptools_scm/distros/freebsd.txt new file mode 100644 index 00000000000..ba714681e0a --- /dev/null +++ b/build/pkgs/setuptools_scm/distros/freebsd.txt @@ -0,0 +1 @@ +devel/py-setuptools_scm From 34b8808b8a9030069c66cd986f17b3c08eb2995c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 30 Aug 2023 18:14:16 -0400 Subject: [PATCH 358/423] build/make/Makefile.in: ensure $(SAGE_VENV)/$(SPKG_INST_RELDIR) exists We touch a file inside $(SAGE_VENV)/$(SPKG_INST_RELDIR) to create the installation record "inst_python3_venv" but that directory must exist first. We add the prerequisite and "mkdir -p" to create it when it does not. --- build/make/Makefile.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/make/Makefile.in b/build/make/Makefile.in index 5c5a1a43d0c..caf86fdeaf8 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -242,7 +242,9 @@ PYTHON = python3_venv endif inst_python3_venv = $(SAGE_VENV)/$(SPKG_INST_RELDIR)/python3_venv-$(subst /,-,$(PYTHON_FOR_VENV))$(findstring --system-site-packages,$(SAGE_VENV_FLAGS)) -$(inst_python3_venv): +$(SAGE_VENV)/$(SPKG_INST_RELDIR): + mkdir -p $@ +$(inst_python3_venv): $(SAGE_VENV)/$(SPKG_INST_RELDIR) $(PYTHON_FOR_VENV) $(SAGE_ROOT)/build/bin/sage-venv $(SAGE_VENV_FLAGS) "$(SAGE_VENV)" touch $@ endif From faace2f036b1104851f3cae4107354bdd2493444 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 30 Aug 2023 16:55:43 -0700 Subject: [PATCH 359/423] build/pkgs/jupyter_core/dependencies: Add build dep hatchling --- build/pkgs/jupyter_core/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/jupyter_core/dependencies b/build/pkgs/jupyter_core/dependencies index 6aeda10f20d..8fbd6477646 100644 --- a/build/pkgs/jupyter_core/dependencies +++ b/build/pkgs/jupyter_core/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) traitlets +$(PYTHON) traitlets | $(PYTHON_TOOLCHAIN) hatchling ---------- All lines of this file are ignored except the first. From 182b9bc461cbc0963176e6fbb7fad8c52d2da511 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 30 Aug 2023 18:24:31 -0700 Subject: [PATCH 360/423] sage.rings: More block tags, other tag fixes --- src/sage/rings/complex_interval.pyx | 11 +++-- src/sage/rings/lazy_series_ring.py | 2 +- src/sage/rings/localization.py | 48 +++++++++---------- .../rings/multi_power_series_ring_element.py | 2 +- 4 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/sage/rings/complex_interval.pyx b/src/sage/rings/complex_interval.pyx index fdc3af338db..7fe25fd8114 100644 --- a/src/sage/rings/complex_interval.pyx +++ b/src/sage/rings/complex_interval.pyx @@ -290,19 +290,20 @@ cdef class ComplexIntervalFieldElement(FieldElement): Exact and nearly exact points are still visible:: - sage: plot(CIF(pi, 1), color='red') + plot(CIF(1, e), color='purple') + plot(CIF(-1, -1)) # needs sage.plot + sage: # needs sage.plot + sage: plot(CIF(pi, 1), color='red') + plot(CIF(1, e), color='purple') + plot(CIF(-1, -1)) Graphics object consisting of 6 graphics primitives A demonstration that `z \mapsto z^2` acts chaotically on `|z|=1`:: - sage: # needs sage.symbolic + sage: # needs sage.plot sage.symbolic sage: z = CIF(0, 2*pi/1000).exp() - sage: g = Graphics() # needs sage.plot - sage: for i in range(40): # needs sage.plot + sage: g = Graphics() + sage: for i in range(40): ....: z = z^2 ....: g += z.plot(color=(1./(40-i), 0, 1)) ... - sage: g # needs sage.plot + sage: g Graphics object consisting of 80 graphics primitives """ from sage.plot.polygon import polygon2d diff --git a/src/sage/rings/lazy_series_ring.py b/src/sage/rings/lazy_series_ring.py index f1dbbe5f5ce..faff4a5a52a 100644 --- a/src/sage/rings/lazy_series_ring.py +++ b/src/sage/rings/lazy_series_ring.py @@ -1214,7 +1214,7 @@ def __init__(self, base_ring, names, sparse=True, category=None): sage: TestSuite(L).run() sage: L = LazyLaurentSeriesRing(GF(5)['x, y'], 't') - sage: TestSuite(L).run() # needs sage.rings.finite_rings + sage: TestSuite(L).run() sage: L = LazyLaurentSeriesRing(Zmod(6), 't') sage: TestSuite(L).run(skip=['_test_revert']) diff --git a/src/sage/rings/localization.py b/src/sage/rings/localization.py index 03e269fe27b..9ed5586e325 100644 --- a/src/sage/rings/localization.py +++ b/src/sage/rings/localization.py @@ -9,19 +9,20 @@ EXAMPLES:: + sage: # needs sage.modules sage: LZ = Localization(ZZ, (5,11)) - sage: m = matrix(LZ, [[5, 7], [0,11]]) # needs sage.modules - sage: m.parent() # needs sage.modules + sage: m = matrix(LZ, [[5, 7], [0,11]]) + sage: m.parent() Full MatrixSpace of 2 by 2 dense matrices over Integer Ring localized at (5, 11) - sage: ~m # parent of inverse is different: see documentation of m.__invert__ # needs sage.modules + sage: ~m # parent of inverse is different: see documentation of m.__invert__ [ 1/5 -7/55] [ 0 1/11] - sage: _.parent() # needs sage.modules + sage: _.parent() Full MatrixSpace of 2 by 2 dense matrices over Rational Field - sage: mi = matrix(LZ, ~m) # needs sage.modules - sage: mi.parent() # needs sage.modules + sage: mi = matrix(LZ, ~m) + sage: mi.parent() Full MatrixSpace of 2 by 2 dense matrices over Integer Ring localized at (5, 11) - sage: mi == ~m # needs sage.modules + sage: mi == ~m True The next example defines the most general ring containing the coefficients of the irreducible @@ -76,7 +77,6 @@ Obtain specializations in positive characteristic:: - sage: # needs sage.rings.finite_rings sage: Fp = GF(17) sage: f = L.hom((3,5,7,11), codomain=Fp); f # needs sage.libs.pari Ring morphism: @@ -618,29 +618,30 @@ class Localization(IntegralDomain, UniqueRepresentation): ValueError: all given elements are invertible in 7-adic Ring with capped relative precision 20 + sage: # needs sage.libs.pari sage: R. = ZZ[] - sage: L = R.localization(x**2 + 1) # needs sage.libs.pari + sage: L = R.localization(x**2 + 1) sage: s = (x+5)/(x**2+1) - sage: s in L # needs sage.libs.pari + sage: s in L True sage: t = (x+5)/(x**2+2) sage: t in L False - sage: L(t) # needs sage.libs.pari + sage: L(t) Traceback (most recent call last): ... TypeError: fraction must have unit denominator - sage: L(s) in R # needs sage.libs.pari + sage: L(s) in R False - sage: y = L(x) # needs sage.libs.pari - sage: g = L(s) # needs sage.libs.pari - sage: g.parent() # needs sage.libs.pari + sage: y = L(x) + sage: g = L(s) + sage: g.parent() Univariate Polynomial Ring in x over Integer Ring localized at (x^2 + 1,) - sage: f = (y+5)/(y**2+1); f # needs sage.libs.pari + sage: f = (y+5)/(y**2+1); f (x + 5)/(x^2 + 1) - sage: f == g # needs sage.libs.pari + sage: f == g True - sage: (y+5)/(y**2+2) # needs sage.libs.pari + sage: (y+5)/(y**2+2) Traceback (most recent call last): ... ValueError: factor x^2 + 2 of denominator is not a unit @@ -761,23 +762,22 @@ def _is_valid_homomorphism_(self, codomain, im_gens, base_map=None): TESTS:: + sage: # needs sage.libs.pari sage: phi = R.hom([5]) - sage: L._is_valid_homomorphism_(ZZ, [3], base_map=phi) # needs sage.libs.pari + sage: L._is_valid_homomorphism_(ZZ, [3], base_map=phi) Traceback (most recent call last): ... ValueError: given base_map is not compatible with im_gens - sage: L._is_valid_homomorphism_(ZZ, [5], base_map=phi) # needs sage.libs.pari + sage: L._is_valid_homomorphism_(ZZ, [5], base_map=phi) Traceback (most recent call last): ... ValueError: images of some localized elements fail to be units - sage: phi = R.hom([5], codomain=QQ) - sage: L._is_valid_homomorphism_(ZZ, [5], base_map=phi) # needs sage.libs.pari + sage: L._is_valid_homomorphism_(ZZ, [5], base_map=phi) Traceback (most recent call last): ... ValueError: codomain of base_map must be Integer Ring - - sage: L._is_valid_homomorphism_(QQ, [5], base_map=phi) # needs sage.libs.pari + sage: L._is_valid_homomorphism_(QQ, [5], base_map=phi) True """ B = self.base_ring() diff --git a/src/sage/rings/multi_power_series_ring_element.py b/src/sage/rings/multi_power_series_ring_element.py index 8be86e21b89..56262c56cee 100644 --- a/src/sage/rings/multi_power_series_ring_element.py +++ b/src/sage/rings/multi_power_series_ring_element.py @@ -1081,7 +1081,7 @@ def __mod__(self, other): False sage: g in R.base_extend(Zmod(2)) True - sage: g.polynomial() == f.polynomial() % 2 # needs sage.libs.singular + sage: g.polynomial() == f.polynomial() % 2 # needs sage.libs.singular True """ if isinstance(other, (int, Integer)): From 59e556e6498a0516c6b4340ee546ec6b393fa9de Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 30 Aug 2023 18:56:17 -0700 Subject: [PATCH 361/423] src/sage/rings/localization.py: Change # needs sage.rings.finite_rings to more precise sage.libs.pari; use more block tags --- src/sage/rings/localization.py | 52 +++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/src/sage/rings/localization.py b/src/sage/rings/localization.py index 9ed5586e325..20c090da681 100644 --- a/src/sage/rings/localization.py +++ b/src/sage/rings/localization.py @@ -77,8 +77,9 @@ Obtain specializations in positive characteristic:: + sage: # needs sage.libs.pari sage.modules sage: Fp = GF(17) - sage: f = L.hom((3,5,7,11), codomain=Fp); f # needs sage.libs.pari + sage: f = L.hom((3,5,7,11), codomain=Fp); f Ring morphism: From: Multivariate Polynomial Ring in u0, u1, u2, q over Integer Ring localized at (q, q + 1, u2, u1, u1 - u2, u0, u0 - u2, u0 - u1, u2*q - u1, u2*q - u0, @@ -88,17 +89,17 @@ u1 |--> 5 u2 |--> 7 q |--> 11 - sage: mFp1 = matrix({k: f(v) for k, v in m1.dict().items()}); mFp1 # needs sage.libs.pari sage.modules + sage: mFp1 = matrix({k: f(v) for k, v in m1.dict().items()}); mFp1 [5 0 0] [0 3 0] [0 0 3] - sage: mFp1.base_ring() # needs sage.libs.pari sage.modules + sage: mFp1.base_ring() Finite Field of size 17 - sage: mFp2 = matrix({k: f(v) for k, v in m2.dict().items()}); mFp2 # needs sage.libs.pari sage.modules + sage: mFp2 = matrix({k: f(v) for k, v in m2.dict().items()}); mFp2 [ 2 3 0] [ 9 8 0] [ 0 0 16] - sage: mFp3 = matrix({k: f(v) for k, v in m3.dict().items()}); mFp3 # needs sage.libs.pari sage.modules + sage: mFp3 = matrix({k: f(v) for k, v in m3.dict().items()}); mFp3 [16 0 0] [ 0 4 5] [ 0 7 6] @@ -116,25 +117,28 @@ u1 |--> 5 u2 |--> 7 q |--> 11 - sage: mQ1 = matrix({k: fQ(v) for k, v in m1.dict().items()}); mQ1 # needs sage.modules sage.rings.finite_rings + + sage: # needs sage.libs.pari sage.modules sage.rings.finite_rings + sage: mQ1 = matrix({k: fQ(v) for k, v in m1.dict().items()}); mQ1 [5 0 0] [0 3 0] [0 0 3] - sage: mQ1.base_ring() # needs sage.modules sage.rings.finite_rings + sage: mQ1.base_ring() Rational Field - sage: mQ2 = matrix({k: fQ(v) for k, v in m2.dict().items()}); mQ2 # needs sage.modules sage.rings.finite_rings + sage: mQ2 = matrix({k: fQ(v) for k, v in m2.dict().items()}); mQ2 [-15 -14 0] [ 26 25 0] [ 0 0 -1] - sage: mQ3 = matrix({k: fQ(v) for k, v in m3.dict().items()}); mQ3 # needs sage.modules sage.rings.finite_rings + sage: mQ3 = matrix({k: fQ(v) for k, v in m3.dict().items()}); mQ3 [ -1 0 0] [ 0 -15/26 11/26] [ 0 301/26 275/26] + sage: # needs sage.libs.pari sage.libs.singular sage: S. = QQ[] sage: T = S.quo(x + y + z) - sage: F = T.fraction_field() # needs sage.libs.pari sage.libs.singular - sage: fF = L.hom((x, y, z, t), codomain=F); fF # needs sage.libs.pari sage.libs.singular + sage: F = T.fraction_field() + sage: fF = L.hom((x, y, z, t), codomain=F); fF Ring morphism: From: Multivariate Polynomial Ring in u0, u1, u2, q over Integer Ring localized at (q, q + 1, u2, u1, u1 - u2, u0, u0 - u2, u0 - u1, @@ -145,11 +149,11 @@ u1 |--> ybar u2 |--> zbar q |--> tbar - sage: mF1 = matrix({k: fF(v) for k, v in m1.dict().items()}); mF1 # needs sage.libs.pari sage.libs.singular sage.modules + sage: mF1 = matrix({k: fF(v) for k, v in m1.dict().items()}); mF1 # needs sage.modules [ ybar 0 0] [ 0 -ybar - zbar 0] [ 0 0 -ybar - zbar] - sage: mF1.base_ring() == F # needs sage.libs.pari sage.libs.singular sage.modules + sage: mF1.base_ring() == F # needs sage.modules True TESTS:: @@ -211,15 +215,16 @@ def normalize_extra_units(base_ring, add_units, warning=True): ....: [3*x, z*y**2, 2*z, 18*(x*y*z)**2, x*z, 6*x*z, 5]) [z, y, x] + sage: # needs sage.libs.singular sage: R. = ZZ[] - sage: Q. = R.quo(x**2 - 5) # needs sage.libs.singular - sage: p = b**2 - 5 # needs sage.libs.singular - sage: p == (b-a)*(b+a) # needs sage.libs.singular + sage: Q. = R.quo(x**2 - 5) + sage: p = b**2 - 5 + sage: p == (b-a)*(b+a) True - sage: normalize_extra_units(Q, [p]) # needs sage.libs.pari sage.libs.singular + sage: normalize_extra_units(Q, [p]) # needs sage.libs.pari doctest:...: UserWarning: Localization may not be represented uniquely [b^2 - 5] - sage: normalize_extra_units(Q, [p], warning=False) # needs sage.libs.pari sage.libs.singular + sage: normalize_extra_units(Q, [p], warning=False) # needs sage.libs.pari [b^2 - 5] """ # convert to base ring @@ -256,7 +261,7 @@ class LocalizationElement(IntegralDomainElement): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.pari sage: from sage.rings.localization import LocalizationElement sage: P. = GF(5)[] sage: L = P.localization((x, y*z - x)) @@ -716,7 +721,7 @@ def _repr_(self): EXAMPLES:: sage: R. = GF(3)[] - sage: Localization(R, a**2 - 1) # needs sage.rings.finite_rings + sage: Localization(R, a**2 - 1) # needs sage.libs.pari Univariate Polynomial Ring in a over Finite Field of size 3 localized at (a + 1, a + 2) """ @@ -967,7 +972,7 @@ def fraction_field(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.pari sage: R. = GF(5)[] sage: L = Localization(R, (a**2 - 3, a)) sage: L.fraction_field() @@ -983,9 +988,10 @@ def characteristic(self): EXAMPLES:: + sage: # needs sage.libs.pari sage: R. = GF(5)[] - sage: L = R.localization((a**2 - 3, a)) # needs sage.rings.finite_rings - sage: L.characteristic() # needs sage.rings.finite_rings + sage: L = R.localization((a**2 - 3, a)) + sage: L.characteristic() 5 """ return self.base_ring().characteristic() From 733d5c2243373d31fe56c770d11696612cb1b9e7 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 30 Aug 2023 19:01:55 -0700 Subject: [PATCH 362/423] src/sage/rings/multi_power_series_ring_element.py: Remove unnecessary # needs sage.rings.finite_rings --- .../rings/multi_power_series_ring_element.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/sage/rings/multi_power_series_ring_element.py b/src/sage/rings/multi_power_series_ring_element.py index 56262c56cee..eb41c15586c 100644 --- a/src/sage/rings/multi_power_series_ring_element.py +++ b/src/sage/rings/multi_power_series_ring_element.py @@ -252,8 +252,6 @@ class MPowerSeries(PowerSeries): sage: g = 1 + s + t - s*t + S.O(5); g 1 + s + t - s*t + O(s, t)^5 - - sage: # needs sage.rings.finite_rings sage: T = PowerSeriesRing(GF(3),5,'t'); T Multivariate Power Series Ring in t0, t1, t2, t3, t4 over Finite Field of size 3 @@ -265,17 +263,17 @@ class MPowerSeries(PowerSeries): sage: w in T True - sage: w = t[0] - 2*t[0]*t[2] + 5*t[4]^3 - t[0]^3*t[2]^2 + T.O(6) # needs sage.rings.finite_rings - sage: w # needs sage.rings.finite_rings + sage: w = t[0] - 2*t[0]*t[2] + 5*t[4]^3 - t[0]^3*t[2]^2 + T.O(6) + sage: w t0 + t0*t2 - t4^3 - t0^3*t2^2 + O(t0, t1, t2, t3, t4)^6 Get random elements:: - sage: S.random_element(4) # random + sage: S.random_element(4) # random -2*t + t^2 - 12*s^3 + O(s, t)^4 - sage: T.random_element(10) # random # needs sage.rings.finite_rings + sage: T.random_element(10) # random -t1^2*t3^2*t4^2 + t1^5*t3^3*t4 + O(t0, t1, t2, t3, t4)^10 @@ -515,9 +513,9 @@ def _subs_formal(self, *x, **kwds): z sage: f = -2/33*s*t^2 - 1/5*t^5 - s^5*t + s^2*t^4 - sage: f(z,z) #indirect doctest + sage: f(z,z) # indirect doctest -2/33*z^3 - 1/5*z^5 - sage: f(z,1) #indirect doctest + sage: f(z,1) # indirect doctest -1/5 - 2/33*z + z^2 - z^5 sage: RF = RealField(10) # needs sage.rings.real_mpfr sage: f(z, RF(1)) # indirect doctest # needs sage.rings.real_mpfr @@ -540,7 +538,8 @@ def _subs_formal(self, *x, **kwds): sage: f(m,m) # needs sage.modules Traceback (most recent call last): ... - AttributeError: 'sage.matrix.matrix_rational_dense.Matrix_rational_dense' object has no attribute 'add_bigoh' + AttributeError: 'sage.matrix.matrix_rational_dense.Matrix_rational_dense' + object has no attribute 'add_bigoh' """ from sage.misc.misc_c import prod From 569bcc247b2a844ff411930cb7d333887c843345 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 30 Aug 2023 19:10:21 -0700 Subject: [PATCH 363/423] src/sage/rings/ring_extension.pyx: Remove unnecessary # needs sage.rings.finite_rings --- src/sage/rings/ring_extension.pyx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/sage/rings/ring_extension.pyx b/src/sage/rings/ring_extension.pyx index f6ce2b04826..d9438aaa648 100644 --- a/src/sage/rings/ring_extension.pyx +++ b/src/sage/rings/ring_extension.pyx @@ -1952,7 +1952,6 @@ cdef class RingExtension_generic(CommutativeAlgebra): :: - sage: # needs sage.rings.finite_rings sage: F = GF(11) sage: A. = F[] sage: K = Frac(F).over(F) @@ -1969,7 +1968,6 @@ cdef class RingExtension_generic(CommutativeAlgebra): Ensure issue :trac:`34692` is fixed:: - sage: # needs sage.rings.finite_rings sage: Fq = GF(11) sage: FqX. = Fq[] sage: k = Frac(FqX) From 33eb52ab0320925e44ce2e438daed006657ef224 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 30 Aug 2023 19:42:05 -0700 Subject: [PATCH 364/423] build/pkgs/{pip,setuptools_scm}: Update lower bounds --- build/pkgs/pip/install-requires.txt | 3 ++- build/pkgs/setuptools_scm/install-requires.txt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build/pkgs/pip/install-requires.txt b/build/pkgs/pip/install-requires.txt index 7af2e246633..5e76a10f694 100644 --- a/build/pkgs/pip/install-requires.txt +++ b/build/pkgs/pip/install-requires.txt @@ -1,2 +1,3 @@ -pip >=21.3 +pip >=22.1 # for use of the "in-tree-build" feature, default since 21.3, by the Sage distribution +# for use of --config-settings, 22.1 diff --git a/build/pkgs/setuptools_scm/install-requires.txt b/build/pkgs/setuptools_scm/install-requires.txt index ee00ef62d52..34188327a0f 100644 --- a/build/pkgs/setuptools_scm/install-requires.txt +++ b/build/pkgs/setuptools_scm/install-requires.txt @@ -1 +1,2 @@ -setuptools_scm >=4.1.2 +# matplotlib-3.6.2 needs >= 7 +setuptools_scm >=7 From 3aa39bef405c1efb014789408095a578dba33df9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 30 Aug 2023 20:01:12 -0700 Subject: [PATCH 365/423] build/pkgs/setuptools/install-requires.txt: Set upper bound --- build/pkgs/setuptools/install-requires.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/setuptools/install-requires.txt b/build/pkgs/setuptools/install-requires.txt index 0810ca37277..e0cf7c9b5dc 100644 --- a/build/pkgs/setuptools/install-requires.txt +++ b/build/pkgs/setuptools/install-requires.txt @@ -1 +1 @@ -setuptools >=49.6.0 +setuptools >=49.6.0, <64 From fec85fd7a0c902ce81b986e3efb793adcf2bb353 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 30 Aug 2023 20:25:56 -0700 Subject: [PATCH 366/423] build/pkgs/pybind11/install-requires.txt: Increase lower bound --- build/pkgs/pybind11/install-requires.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/pybind11/install-requires.txt b/build/pkgs/pybind11/install-requires.txt index 7f37917011f..6c44c4bd07e 100644 --- a/build/pkgs/pybind11/install-requires.txt +++ b/build/pkgs/pybind11/install-requires.txt @@ -1 +1 @@ -pybind11 >=2.5.0 +pybind11 >=2.6 From 3ea8061e6dd32509fb4398f221c6f474a20335d0 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 30 Aug 2023 22:48:23 -0700 Subject: [PATCH 367/423] build/pkgs/pygments/install-requires.txt: Increase lower bound --- build/pkgs/pygments/install-requires.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/pygments/install-requires.txt b/build/pkgs/pygments/install-requires.txt index 0d0dc97d523..337e5bbad8b 100644 --- a/build/pkgs/pygments/install-requires.txt +++ b/build/pkgs/pygments/install-requires.txt @@ -1 +1 @@ -pygments >=2.3.1 +pygments >=2.12 From 68095a8f70ef392308971a19c7909818c1b1f232 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 30 Aug 2023 23:48:47 -0700 Subject: [PATCH 368/423] build/pkgs/ipython/install-requires.txt: Lower the upper bound --- build/pkgs/ipython/install-requires.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/pkgs/ipython/install-requires.txt b/build/pkgs/ipython/install-requires.txt index 4616117aa08..03d4a4f3413 100644 --- a/build/pkgs/ipython/install-requires.txt +++ b/build/pkgs/ipython/install-requires.txt @@ -1 +1,2 @@ -ipython >=7.13.0, <8.11.0 +ipython >=7.13.0, <8.9.0 +# ipython >= 8.9.0 requires prompt_toolkit too new for Sage From af2488f63c0a18abe225feb685a4338aecee97f2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 31 Aug 2023 00:00:06 -0700 Subject: [PATCH 369/423] build/pkgs/cppy/install-requires.txt: Set lower bound --- build/pkgs/cppy/install-requires.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/cppy/install-requires.txt b/build/pkgs/cppy/install-requires.txt index 9d2b4aaeee0..42667a30148 100644 --- a/build/pkgs/cppy/install-requires.txt +++ b/build/pkgs/cppy/install-requires.txt @@ -1 +1 @@ -cppy +cppy >=1.2.0 From 24063e1555fbe2556a9ac1508575f32d601b18d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Thu, 31 Aug 2023 14:30:29 +0200 Subject: [PATCH 370/423] minor details in graph_plot --- src/sage/graphs/graph_plot.py | 63 ++++++++++++++++------------------- 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/src/sage/graphs/graph_plot.py b/src/sage/graphs/graph_plot.py index 0a7dbb81fc6..7908454db54 100644 --- a/src/sage/graphs/graph_plot.py +++ b/src/sage/graphs/graph_plot.py @@ -168,8 +168,7 @@ 'Which graphviz layout program to use -- one of ' '"circo", "dot", "fdp", "neato", or "twopi".', 'by_component': - 'Whether to do the spring layout by connected component -- a boolean.', - } + 'Whether to do the spring layout by connected component -- a boolean.'} graphplot_options = layout_options.copy() @@ -225,8 +224,7 @@ 'graph_border': 'Whether or not to draw a frame around the graph.', 'edge_labels_background': - 'The color of the background of the edge labels.', - }) + 'The color of the background of the edge labels.'}) _PLOT_OPTIONS_TABLE = "" @@ -235,9 +233,7 @@ __doc__ = __doc__.format(PLOT_OPTIONS_TABLE=_PLOT_OPTIONS_TABLE) -DEFAULT_SHOW_OPTIONS = { - 'figsize' : (4, 4) - } +DEFAULT_SHOW_OPTIONS = {'figsize': (4, 4)} DEFAULT_PLOT_OPTIONS = { 'vertex_size' : 200, @@ -258,8 +254,7 @@ 'dist' : .075, 'max_dist' : 1.5, 'loop_size' : .075, - 'edge_labels_background' : 'white' - } + 'edge_labels_background' : 'white'} class GraphPlot(SageObject): @@ -582,7 +577,7 @@ def set_edges(self, **edge_options): Set edge plotting parameters for the ``GraphPlot`` object. This function is called by the constructor but can also be called to - update the vertex options of an existing ``GraphPlot`` object. + update the edge options of an existing ``GraphPlot`` object. Note that the changes are cumulative. EXAMPLES:: @@ -719,8 +714,8 @@ def set_edges(self, **edge_options): if 'edge_style' in self._options: from sage.plot.misc import get_matplotlib_linestyle eoptions['linestyle'] = get_matplotlib_linestyle( - self._options['edge_style'], - return_type='long') + self._options['edge_style'], + return_type='long') if 'edge_thickness' in self._options: eoptions['thickness'] = self._options['edge_thickness'] @@ -832,20 +827,20 @@ def set_edges(self, **edge_options): # Compute perpendicular bisector p1 = self._pos[a] p2 = self._pos[b] - m = ((p1[0] + p2[0])/2., (p1[1] + p2[1])/2.) # midpoint + m = ((p1[0] + p2[0]) / 2., (p1[1] + p2[1]) / 2.) # midpoint if not p1[1] == p2[1]: - s = (p1[0] - p2[0])/(p2[1] - p1[1]) # perp slope + s = (p1[0] - p2[0]) / (p2[1] - p1[1]) # perp slope def y(x): - return s*(x - m[0]) + m[1] # perp bisector line + return s * (x - m[0]) + m[1] # perp bisector line # f, g are functions to determine x-values of point # on line y at distance d from point m (on each side) def f(d): - return sqrt(d**2/(1. + s**2)) + m[0] + return sqrt(d**2 / (1. + s**2)) + m[0] def g(d): - return -sqrt(d**2/(1. + s**2)) + m[0] + return -sqrt(d**2 / (1. + s**2)) + m[0] odd_x = f even_x = g @@ -897,31 +892,31 @@ def even_xy(d): even_end = ph(even_xy(k), p2, vr)[1] self._plot_components['edges'].append( arrow(path=[[odd_start, odd_xy(k), odd_end]], - head=local_labels[2*i][2], zorder=1, - rgbcolor=local_labels[2*i][1], + head=local_labels[2 * i][2], zorder=1, + rgbcolor=local_labels[2 * i][1], **eoptions)) self._plot_components['edges'].append( arrow(path=[[even_start, even_xy(k), even_end]], - head=local_labels[2*i + 1][2], zorder=1, - rgbcolor=local_labels[2*i + 1][1], + head=local_labels[2 * i + 1][2], zorder=1, + rgbcolor=local_labels[2 * i + 1][1], **eoptions)) else: self._plot_components['edges'].append( bezier_path([[p1, odd_xy(k), p2]], zorder=1, - rgbcolor=local_labels[2*i][1], + rgbcolor=local_labels[2 * i][1], **eoptions)) self._plot_components['edges'].append( bezier_path([[p1, even_xy(k), p2]], zorder=1, - rgbcolor=local_labels[2*i + 1][1], + rgbcolor=local_labels[2 * i + 1][1], **eoptions)) if labels: j = k / 2.0 bg = self._options['edge_labels_background'] self._plot_components['edge_labels'].append( - text(local_labels[2*i][0], odd_xy(j), + text(local_labels[2 * i][0], odd_xy(j), background_color=bg)) self._plot_components['edge_labels'].append( - text(local_labels[2*i + 1][0], even_xy(j), + text(local_labels[2 * i + 1][0], even_xy(j), background_color=bg)) if len_local_labels % 2: # draw line for last odd @@ -941,7 +936,7 @@ def even_xy(d): bg = self._options['edge_labels_background'] self._plot_components['edge_labels'].append( text(str(edges_to_draw[a, b][0][0]), - [(C[0] + D[0])/2., (C[1] + D[1])/2.], + [(C[0] + D[0]) / 2., (C[1] + D[1]) / 2.], background_color=bg)) elif is_directed: self._plot_components['edges'].append( @@ -959,8 +954,8 @@ def even_xy(d): bg = self._options['edge_labels_background'] self._plot_components['edge_labels'].append( text(str(edges_to_draw[a, b][0][0]), - [(self._pos[a][0] + self._pos[b][0])/2., - (self._pos[a][1] + self._pos[b][1])/2.], + [(self._pos[a][0] + self._pos[b][0]) / 2., + (self._pos[a][1] + self._pos[b][1]) / 2.], background_color=bg)) def _polar_hack_for_multidigraph(self, A, B, VR): @@ -991,7 +986,6 @@ def _polar_hack_for_multidigraph(self, A, B, VR): sage: GP._polar_hack_for_multidigraph((int(0), int(1)), ....: (int(2), int(2)), .1) ([0.08..., 1.04...], [1.91..., 1.95...]) - """ D = [float(B[i] - A[i]) for i in range(2)] R = sqrt(D[0]**2 + D[1]**2) @@ -1415,7 +1409,7 @@ def plot(self, **kwds): sage: p = graphs.PetersenGraph().plot(egabrag='garbage') Traceback (most recent call last): ... - ValueError: Invalid input 'egabrag=garbage' + ValueError: invalid input 'egabrag=garbage' Make sure that no graphics primitive is clipped:: @@ -1441,7 +1435,7 @@ def plot(self, **kwds): # Check the arguments for o in options: if o not in graphplot_options and o not in G._extra_kwds: - raise ValueError("Invalid input '{}={}'".format(o, options[o])) + raise ValueError("invalid input '{}={}'".format(o, options[o])) for comp in self._plot_components.values(): if not isinstance(comp, list): @@ -1488,13 +1482,12 @@ def layout_tree(self, root, orientation): sage: T = Graph() sage: T.add_edges(G.min_spanning_tree(starting_vertex=0)) sage: T.show(layout='tree', tree_root=0) # indirect doctest - """ T = self._graph if not self._graph.is_tree(): - raise RuntimeError("Cannot use tree layout on this graph: " - "self.is_tree() returns False.") + raise RuntimeError("cannot use tree layout on this graph: " + "self.is_tree() returns False") children = {root: T.neighbors(root)} @@ -1544,7 +1537,7 @@ def slide(v, dx): if x < ox: slide(p, ox - x) x = ox - obstruction[y] = x+1 + obstruction[y] = x + 1 continue t = C.pop() From 0cb24cee01833ecb443ddfb84ff2c51f6c8feb86 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 31 Aug 2023 09:23:59 -0400 Subject: [PATCH 371/423] build/pkgs/babel/install-requires.txt: increase lower bound Require at least babel-2.11.0 for the bugfix, * Use email.Message for pofile header parsing instead of the deprecated cgi.parse_header function. :gh:`876` - Aarni Koskela This avoids deprecation warnings that cause some of our doctests to fail; for example, sage: sage_getdoc(foo) DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13 'Construct a Foo.\n' in src/doc/en/developer/coding_basics.rst. --- build/pkgs/babel/install-requires.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/babel/install-requires.txt b/build/pkgs/babel/install-requires.txt index 1d0d6191bb9..b4db5e907f3 100644 --- a/build/pkgs/babel/install-requires.txt +++ b/build/pkgs/babel/install-requires.txt @@ -1 +1 @@ -babel >=2.6.0 +babel >=2.11.0 From 54592ee643ef06b7d9cf187fea73dcbfae04c650 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 31 Aug 2023 09:33:46 -0400 Subject: [PATCH 372/423] build/pkgs/pythran/install-requires.txt: add lower bound Require at least pythran-0.12.1 for the bugfix in upstream commit cd68ac68, "Only use numpy.distutils conditionally." Earlier versions of pythran can emit deprecation warnings that cause the test suite to fail; for example, sage: cython("cdef class A:\n cdef public int a") DeprecationWarning: `numpy.distutils` is deprecated since NumPy 1.23.0, as a result of the deprecation of `distutils` itself. It will be removed for Python >= 3.12. For older Python versions it will remain present. It is recommended to use `setuptools < 60.0` for those Python versions. For more details, see: https://numpy.org/devdocs/reference/distutils_status_migration.html --- build/pkgs/pythran/install-requires.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/pythran/install-requires.txt b/build/pkgs/pythran/install-requires.txt index 86d056b339f..f365e5f4971 100644 --- a/build/pkgs/pythran/install-requires.txt +++ b/build/pkgs/pythran/install-requires.txt @@ -1 +1 @@ -pythran +pythran >=0.12.1 From df9e5ace20753c3f7ea4a01558eaa7dc2d1ce71a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 31 Aug 2023 11:26:49 -0700 Subject: [PATCH 373/423] build/pkgs/*/dependencies: Reduce $(PYTHON) to an order-only dependency --- build/pkgs/admcycles/dependencies | 2 +- build/pkgs/alabaster/dependencies | 2 +- build/pkgs/appdirs/dependencies | 2 +- build/pkgs/appnope/dependencies | 2 +- build/pkgs/argon2_cffi/dependencies | 2 +- build/pkgs/argon2_cffi_bindings/dependencies | 2 +- build/pkgs/asttokens/dependencies | 2 +- build/pkgs/attrs/dependencies | 2 +- build/pkgs/auditwheel_or_delocate/dependencies | 2 +- build/pkgs/awali/dependencies | 2 +- build/pkgs/babel/dependencies | 2 +- build/pkgs/backcall/dependencies | 2 +- build/pkgs/beautifulsoup4/dependencies | 2 +- build/pkgs/beniget/dependencies | 2 +- build/pkgs/bleach/dependencies | 2 +- build/pkgs/certifi/dependencies | 2 +- build/pkgs/cffi/dependencies | 2 +- build/pkgs/charset_normalizer/dependencies | 2 +- build/pkgs/contourpy/dependencies | 2 +- build/pkgs/conway_polynomials/dependencies | 2 +- build/pkgs/cppy/dependencies | 2 +- build/pkgs/cryptominisat/dependencies | 2 +- build/pkgs/cvxopt/dependencies | 2 +- build/pkgs/cvxpy/dependencies | 2 +- build/pkgs/cycler/dependencies | 2 +- build/pkgs/cylp/dependencies | 2 +- build/pkgs/cypari/dependencies | 2 +- build/pkgs/cysignals/dependencies | 2 +- build/pkgs/cython/dependencies | 2 +- build/pkgs/database_cubic_hecke/dependencies | 2 +- build/pkgs/database_knotinfo/dependencies | 2 +- build/pkgs/dateutil/dependencies | 2 +- build/pkgs/debugpy/dependencies | 2 +- build/pkgs/decorator/dependencies | 2 +- build/pkgs/defusedxml/dependencies | 2 +- build/pkgs/deprecation/dependencies | 2 +- build/pkgs/distlib/dependencies | 2 +- build/pkgs/docutils/dependencies | 2 +- build/pkgs/dot2tex/dependencies | 2 +- build/pkgs/ecos_python/dependencies | 2 +- build/pkgs/editables/dependencies | 2 +- build/pkgs/elliptic_curves/dependencies | 2 +- build/pkgs/entrypoints/dependencies | 2 +- build/pkgs/executing/dependencies | 2 +- build/pkgs/fastjsonschema/dependencies | 2 +- build/pkgs/filelock/dependencies | 2 +- build/pkgs/flit_core/dependencies | 2 +- build/pkgs/fonttools/dependencies | 2 +- build/pkgs/fpylll/dependencies | 2 +- build/pkgs/furo/dependencies | 2 +- build/pkgs/gambit/dependencies | 2 +- build/pkgs/gap_jupyter/dependencies | 2 +- build/pkgs/gast/dependencies | 2 +- build/pkgs/gdb/dependencies | 2 +- build/pkgs/gitpython/dependencies | 2 +- build/pkgs/gmpy2/dependencies | 2 +- build/pkgs/hatch_fancy_pypi_readme/dependencies | 2 +- build/pkgs/hatch_nodejs_version/dependencies | 2 +- build/pkgs/hatch_vcs/dependencies | 2 +- build/pkgs/hatchling/dependencies | 2 +- build/pkgs/html5lib/dependencies | 2 +- build/pkgs/idna/dependencies | 2 +- build/pkgs/imagesize/dependencies | 2 +- build/pkgs/importlib_metadata/dependencies | 2 +- build/pkgs/importlib_resources/dependencies | 2 +- build/pkgs/ipykernel/dependencies | 2 +- build/pkgs/ipympl/dependencies | 2 +- build/pkgs/ipython/dependencies | 2 +- build/pkgs/ipython_genutils/dependencies | 2 +- build/pkgs/ipywidgets/dependencies | 2 +- build/pkgs/jedi/dependencies | 2 +- build/pkgs/jinja2/dependencies | 2 +- build/pkgs/jsonschema/dependencies | 2 +- build/pkgs/jupymake/dependencies | 2 +- build/pkgs/jupyter_client/dependencies | 2 +- build/pkgs/jupyter_core/dependencies | 2 +- build/pkgs/jupyter_jsmol/dependencies | 2 +- build/pkgs/jupyter_packaging/dependencies | 2 +- build/pkgs/jupyter_sphinx/dependencies | 2 +- build/pkgs/jupyterlab/dependencies | 2 +- build/pkgs/jupyterlab_pygments/dependencies | 2 +- build/pkgs/jupyterlab_widgets/dependencies | 2 +- build/pkgs/kiwisolver/dependencies | 2 +- build/pkgs/lrcalc_python/dependencies | 2 +- build/pkgs/markupsafe/dependencies | 2 +- build/pkgs/mathics/dependencies | 2 +- build/pkgs/mathics_scanner/dependencies | 2 +- build/pkgs/matplotlib/dependencies | 2 +- build/pkgs/matplotlib_inline/dependencies | 2 +- build/pkgs/memory_allocator/dependencies | 2 +- build/pkgs/meson/dependencies | 2 +- build/pkgs/meson_python/dependencies | 2 +- build/pkgs/mistune/dependencies | 2 +- build/pkgs/mpmath/dependencies | 2 +- build/pkgs/nbclient/dependencies | 2 +- build/pkgs/nbconvert/dependencies | 2 +- build/pkgs/nbformat/dependencies | 2 +- build/pkgs/nest_asyncio/dependencies | 2 +- build/pkgs/networkx/dependencies | 2 +- build/pkgs/ninja_build/dependencies | 2 +- build/pkgs/nodeenv/dependencies | 2 +- build/pkgs/notebook/dependencies | 2 +- build/pkgs/notedown/dependencies | 2 +- build/pkgs/numpy/dependencies | 2 +- build/pkgs/ore_algebra/dependencies | 2 +- build/pkgs/osqp_python/dependencies | 2 +- build/pkgs/p_group_cohomology/dependencies | 2 +- build/pkgs/packaging/dependencies | 2 +- build/pkgs/palettable/dependencies | 2 +- build/pkgs/pandoc_attributes/dependencies | 2 +- build/pkgs/pandocfilters/dependencies | 2 +- build/pkgs/pari_jupyter/dependencies | 2 +- build/pkgs/parso/dependencies | 2 +- build/pkgs/pathspec/dependencies | 2 +- build/pkgs/pexpect/dependencies | 2 +- build/pkgs/phitigra/dependencies | 2 +- build/pkgs/pickleshare/dependencies | 2 +- build/pkgs/pillow/dependencies | 2 +- build/pkgs/pint/dependencies | 2 +- build/pkgs/pip/dependencies | 2 +- build/pkgs/pkgconfig/dependencies | 2 +- build/pkgs/platformdirs/dependencies | 2 +- build/pkgs/pluggy/dependencies | 2 +- build/pkgs/ply/dependencies | 2 +- build/pkgs/poetry_core/dependencies | 2 +- build/pkgs/pplpy/dependencies | 2 +- build/pkgs/primecountpy/dependencies | 2 +- build/pkgs/prometheus_client/dependencies | 2 +- build/pkgs/prompt_toolkit/dependencies | 2 +- build/pkgs/ptyprocess/dependencies | 2 +- build/pkgs/pure_eval/dependencies | 2 +- build/pkgs/py/dependencies | 2 +- build/pkgs/pybind11/dependencies | 2 +- build/pkgs/pycosat/dependencies | 2 +- build/pkgs/pycparser/dependencies | 2 +- build/pkgs/pycryptosat/dependencies | 2 +- build/pkgs/pycygwin/dependencies | 2 +- build/pkgs/pygments/dependencies | 2 +- build/pkgs/pygraphviz/dependencies | 2 +- build/pkgs/pynormaliz/dependencies | 2 +- build/pkgs/pyparsing/dependencies | 2 +- build/pkgs/pyppeteer/dependencies | 2 +- build/pkgs/pyproject_metadata/dependencies | 2 +- build/pkgs/pyrsistent/dependencies | 2 +- build/pkgs/pyscipopt/dependencies | 2 +- build/pkgs/pysingular/dependencies | 2 +- build/pkgs/pytest/dependencies | 2 +- build/pkgs/pytest_mock/dependencies | 2 +- build/pkgs/pytest_xdist/dependencies | 2 +- build/pkgs/python_build/dependencies | 2 +- build/pkgs/python_igraph/dependencies | 2 +- build/pkgs/pythran/dependencies | 2 +- build/pkgs/pytz/dependencies | 2 +- build/pkgs/pytz_deprecation_shim/dependencies | 2 +- build/pkgs/pyzmq/dependencies | 2 +- build/pkgs/qdldl_python/dependencies | 2 +- build/pkgs/requests/dependencies | 2 +- build/pkgs/retrolab/dependencies | 2 +- build/pkgs/rpy2/dependencies | 2 +- build/pkgs/rst2ipynb/dependencies | 2 +- build/pkgs/sage_conf/dependencies | 2 +- build/pkgs/sage_docbuild/dependencies | 2 +- build/pkgs/sage_flatsurf/dependencies | 2 +- build/pkgs/sage_numerical_backends_coin/dependencies | 2 +- build/pkgs/sage_numerical_backends_cplex/dependencies | 2 +- build/pkgs/sage_numerical_backends_gurobi/dependencies | 2 +- build/pkgs/sage_setup/dependencies | 2 +- build/pkgs/sage_sws2rst/dependencies | 2 +- build/pkgs/sagelib/dependencies | 2 +- build/pkgs/sagemath_bliss/dependencies | 2 +- build/pkgs/sagemath_categories/dependencies | 2 +- build/pkgs/sagemath_coxeter3/dependencies | 2 +- build/pkgs/sagemath_environment/dependencies | 2 +- build/pkgs/sagemath_mcqd/dependencies | 2 +- build/pkgs/sagemath_meataxe/dependencies | 2 +- build/pkgs/sagemath_objects/dependencies | 2 +- build/pkgs/sagemath_repl/dependencies | 2 +- build/pkgs/sagemath_sirocco/dependencies | 2 +- build/pkgs/sagemath_tdlib/dependencies | 2 +- build/pkgs/sagenb_export/dependencies | 2 +- build/pkgs/sagetex/dependencies | 2 +- build/pkgs/scipy/dependencies | 2 +- build/pkgs/scs/dependencies | 2 +- build/pkgs/send2trash/dependencies | 2 +- build/pkgs/setuptools/dependencies | 2 +- build/pkgs/setuptools_scm/dependencies | 2 +- build/pkgs/setuptools_scm_git_archive/dependencies | 2 +- build/pkgs/setuptools_wheel/dependencies | 2 +- build/pkgs/simplegeneric/dependencies | 2 +- build/pkgs/singular_jupyter/dependencies | 2 +- build/pkgs/six/dependencies | 2 +- build/pkgs/slabbe/dependencies | 2 +- build/pkgs/snappy/dependencies | 2 +- build/pkgs/snowballstemmer/dependencies | 2 +- build/pkgs/soupsieve/dependencies | 2 +- build/pkgs/sphinx/dependencies | 2 +- build/pkgs/sphinx_basic_ng/dependencies | 2 +- build/pkgs/sphinx_copybutton/dependencies | 2 +- build/pkgs/sphinxcontrib_applehelp/dependencies | 2 +- build/pkgs/sphinxcontrib_devhelp/dependencies | 2 +- build/pkgs/sphinxcontrib_htmlhelp/dependencies | 2 +- build/pkgs/sphinxcontrib_jsmath/dependencies | 2 +- build/pkgs/sphinxcontrib_qthelp/dependencies | 2 +- build/pkgs/sphinxcontrib_serializinghtml/dependencies | 2 +- build/pkgs/sphinxcontrib_websupport/dependencies | 2 +- build/pkgs/stack_data/dependencies | 2 +- build/pkgs/surface_dynamics/dependencies | 2 +- build/pkgs/symengine_py/dependencies | 2 +- build/pkgs/sympy/dependencies | 2 +- build/pkgs/terminado/dependencies | 2 +- build/pkgs/texttable/dependencies | 2 +- build/pkgs/tinycss2/dependencies | 2 +- build/pkgs/toml/dependencies | 2 +- build/pkgs/tomli/dependencies | 2 +- build/pkgs/tomlkit/dependencies | 2 +- build/pkgs/tornado/dependencies | 2 +- build/pkgs/tox/dependencies | 2 +- build/pkgs/traitlets/dependencies | 2 +- build/pkgs/typing_extensions/dependencies | 2 +- build/pkgs/tzdata/dependencies | 2 +- build/pkgs/tzlocal/dependencies | 2 +- build/pkgs/urllib3/dependencies | 2 +- build/pkgs/vcversioner/dependencies | 2 +- build/pkgs/virtualenv/dependencies | 2 +- build/pkgs/wcwidth/dependencies | 2 +- build/pkgs/webencodings/dependencies | 2 +- build/pkgs/wheel/dependencies | 2 +- build/pkgs/widgetsnbextension/dependencies | 2 +- build/pkgs/zipp/dependencies | 2 +- 229 files changed, 229 insertions(+), 229 deletions(-) diff --git a/build/pkgs/admcycles/dependencies b/build/pkgs/admcycles/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/admcycles/dependencies +++ b/build/pkgs/admcycles/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/alabaster/dependencies b/build/pkgs/alabaster/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/alabaster/dependencies +++ b/build/pkgs/alabaster/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/appdirs/dependencies b/build/pkgs/appdirs/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/appdirs/dependencies +++ b/build/pkgs/appdirs/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/appnope/dependencies b/build/pkgs/appnope/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/appnope/dependencies +++ b/build/pkgs/appnope/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/argon2_cffi/dependencies b/build/pkgs/argon2_cffi/dependencies index d1b259926f8..920046ab33d 100644 --- a/build/pkgs/argon2_cffi/dependencies +++ b/build/pkgs/argon2_cffi/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) argon2_cffi_bindings | $(PYTHON_TOOLCHAIN) flit_core + argon2_cffi_bindings | $(PYTHON_TOOLCHAIN) flit_core $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/argon2_cffi_bindings/dependencies b/build/pkgs/argon2_cffi_bindings/dependencies index 0d815c35f4b..4b9d24ccf44 100644 --- a/build/pkgs/argon2_cffi_bindings/dependencies +++ b/build/pkgs/argon2_cffi_bindings/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) cffi setuptools_scm + | $(PYTHON_TOOLCHAIN) cffi setuptools_scm $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/asttokens/dependencies b/build/pkgs/asttokens/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/asttokens/dependencies +++ b/build/pkgs/asttokens/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/attrs/dependencies b/build/pkgs/attrs/dependencies index 4361e46ddaf..9be6b4aab7c 100644 --- a/build/pkgs/attrs/dependencies +++ b/build/pkgs/attrs/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) vcversioner | $(PYTHON_TOOLCHAIN) + vcversioner | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/auditwheel_or_delocate/dependencies b/build/pkgs/auditwheel_or_delocate/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/auditwheel_or_delocate/dependencies +++ b/build/pkgs/auditwheel_or_delocate/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/awali/dependencies b/build/pkgs/awali/dependencies index b125e2ded92..09b60167a34 100644 --- a/build/pkgs/awali/dependencies +++ b/build/pkgs/awali/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) cmake cython nbconvert ncurses + cmake cython nbconvert ncurses | $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/babel/dependencies b/build/pkgs/babel/dependencies index 41462907c20..802e470da86 100644 --- a/build/pkgs/babel/dependencies +++ b/build/pkgs/babel/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) pytz + | $(PYTHON_TOOLCHAIN) pytz $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/backcall/dependencies b/build/pkgs/backcall/dependencies index 902a5feed13..4fedbe70cd1 100644 --- a/build/pkgs/backcall/dependencies +++ b/build/pkgs/backcall/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) flit_core tomli + | $(PYTHON_TOOLCHAIN) flit_core tomli $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/beautifulsoup4/dependencies b/build/pkgs/beautifulsoup4/dependencies index 01af7f65566..c9982dd1882 100644 --- a/build/pkgs/beautifulsoup4/dependencies +++ b/build/pkgs/beautifulsoup4/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) soupsieve | $(PYTHON_TOOLCHAIN) + soupsieve | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/beniget/dependencies b/build/pkgs/beniget/dependencies index d792a85db72..96da9efd5ac 100644 --- a/build/pkgs/beniget/dependencies +++ b/build/pkgs/beniget/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) gast | $(PYTHON_TOOLCHAIN) + gast | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/bleach/dependencies b/build/pkgs/bleach/dependencies index 4a74f9bfd68..c7ac2e8b3e7 100644 --- a/build/pkgs/bleach/dependencies +++ b/build/pkgs/bleach/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) packaging six webencodings | $(PYTHON_TOOLCHAIN) + packaging six webencodings | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/certifi/dependencies b/build/pkgs/certifi/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/certifi/dependencies +++ b/build/pkgs/certifi/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/cffi/dependencies b/build/pkgs/cffi/dependencies index 9e4c266ad69..9af7c6ed3db 100644 --- a/build/pkgs/cffi/dependencies +++ b/build/pkgs/cffi/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) pycparser + | $(PYTHON_TOOLCHAIN) pycparser $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/charset_normalizer/dependencies b/build/pkgs/charset_normalizer/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/charset_normalizer/dependencies +++ b/build/pkgs/charset_normalizer/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/contourpy/dependencies b/build/pkgs/contourpy/dependencies index 0740ab1d4a7..d12b50bf33c 100644 --- a/build/pkgs/contourpy/dependencies +++ b/build/pkgs/contourpy/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) numpy | $(PYTHON_TOOLCHAIN) pybind11 + numpy | $(PYTHON_TOOLCHAIN) pybind11 $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/conway_polynomials/dependencies b/build/pkgs/conway_polynomials/dependencies index 1700e743d59..6b134137610 100644 --- a/build/pkgs/conway_polynomials/dependencies +++ b/build/pkgs/conway_polynomials/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) +| $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/cppy/dependencies b/build/pkgs/cppy/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/cppy/dependencies +++ b/build/pkgs/cppy/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/cryptominisat/dependencies b/build/pkgs/cryptominisat/dependencies index 15e88888b6d..e30473e40f6 100644 --- a/build/pkgs/cryptominisat/dependencies +++ b/build/pkgs/cryptominisat/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) m4ri zlib libpng | cmake boost_cropped + m4ri zlib libpng | cmake boost_cropped $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/cvxopt/dependencies b/build/pkgs/cvxopt/dependencies index d47ae01f215..33055fe8bf4 100644 --- a/build/pkgs/cvxopt/dependencies +++ b/build/pkgs/cvxopt/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) numpy $(BLAS) gsl glpk suitesparse | $(PYTHON_TOOLCHAIN) pkgconfig + numpy $(BLAS) gsl glpk suitesparse | $(PYTHON_TOOLCHAIN) pkgconfig $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/cvxpy/dependencies b/build/pkgs/cvxpy/dependencies index 540b44ff0f2..42cfab890cc 100644 --- a/build/pkgs/cvxpy/dependencies +++ b/build/pkgs/cvxpy/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) numpy scipy glpk cvxopt osqp_python ecos_python scs | $(PYTHON_TOOLCHAIN) + numpy scipy glpk cvxopt osqp_python ecos_python scs | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/cycler/dependencies b/build/pkgs/cycler/dependencies index 730af09b339..2218ed812dd 100644 --- a/build/pkgs/cycler/dependencies +++ b/build/pkgs/cycler/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) six | $(PYTHON_TOOLCHAIN) + six | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/cylp/dependencies b/build/pkgs/cylp/dependencies index 3c541129eb9..d2c6405119d 100644 --- a/build/pkgs/cylp/dependencies +++ b/build/pkgs/cylp/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) numpy scipy cbc | $(PYTHON_TOOLCHAIN) cython + numpy scipy cbc | $(PYTHON_TOOLCHAIN) cython $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/cypari/dependencies b/build/pkgs/cypari/dependencies index 72b5af7ad81..69dfe7e7d8a 100644 --- a/build/pkgs/cypari/dependencies +++ b/build/pkgs/cypari/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) cython pari cysignals | $(PYTHON_TOOLCHAIN) + cython pari cysignals | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/cysignals/dependencies b/build/pkgs/cysignals/dependencies index d3225d480f1..cd45ae2076c 100644 --- a/build/pkgs/cysignals/dependencies +++ b/build/pkgs/cysignals/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) cython pari | $(PYTHON_TOOLCHAIN) + cython pari | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/cython/dependencies b/build/pkgs/cython/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/cython/dependencies +++ b/build/pkgs/cython/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/database_cubic_hecke/dependencies b/build/pkgs/database_cubic_hecke/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/database_cubic_hecke/dependencies +++ b/build/pkgs/database_cubic_hecke/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/database_knotinfo/dependencies b/build/pkgs/database_knotinfo/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/database_knotinfo/dependencies +++ b/build/pkgs/database_knotinfo/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/dateutil/dependencies b/build/pkgs/dateutil/dependencies index 7a972de985e..a90844872ae 100644 --- a/build/pkgs/dateutil/dependencies +++ b/build/pkgs/dateutil/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) six | $(PYTHON_TOOLCHAIN) + six | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/debugpy/dependencies b/build/pkgs/debugpy/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/debugpy/dependencies +++ b/build/pkgs/debugpy/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/decorator/dependencies b/build/pkgs/decorator/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/decorator/dependencies +++ b/build/pkgs/decorator/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/defusedxml/dependencies b/build/pkgs/defusedxml/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/defusedxml/dependencies +++ b/build/pkgs/defusedxml/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/deprecation/dependencies b/build/pkgs/deprecation/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/deprecation/dependencies +++ b/build/pkgs/deprecation/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/distlib/dependencies b/build/pkgs/distlib/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/distlib/dependencies +++ b/build/pkgs/distlib/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/docutils/dependencies b/build/pkgs/docutils/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/docutils/dependencies +++ b/build/pkgs/docutils/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/dot2tex/dependencies b/build/pkgs/dot2tex/dependencies index c1925d16b73..75d8c64edb5 100644 --- a/build/pkgs/dot2tex/dependencies +++ b/build/pkgs/dot2tex/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) pyparsing + | $(PYTHON_TOOLCHAIN) pyparsing $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/ecos_python/dependencies b/build/pkgs/ecos_python/dependencies index ecd3af7675b..aaf3b261709 100644 --- a/build/pkgs/ecos_python/dependencies +++ b/build/pkgs/ecos_python/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) numpy scipy | $(PYTHON_TOOLCHAIN) + numpy scipy | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/editables/dependencies b/build/pkgs/editables/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/editables/dependencies +++ b/build/pkgs/editables/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/elliptic_curves/dependencies b/build/pkgs/elliptic_curves/dependencies index 6b134137610..3518086ab84 100644 --- a/build/pkgs/elliptic_curves/dependencies +++ b/build/pkgs/elliptic_curves/dependencies @@ -1,4 +1,4 @@ -| $(PYTHON) +| $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/entrypoints/dependencies b/build/pkgs/entrypoints/dependencies index 902a5feed13..4fedbe70cd1 100644 --- a/build/pkgs/entrypoints/dependencies +++ b/build/pkgs/entrypoints/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) flit_core tomli + | $(PYTHON_TOOLCHAIN) flit_core tomli $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/executing/dependencies b/build/pkgs/executing/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/executing/dependencies +++ b/build/pkgs/executing/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/fastjsonschema/dependencies b/build/pkgs/fastjsonschema/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/fastjsonschema/dependencies +++ b/build/pkgs/fastjsonschema/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/filelock/dependencies b/build/pkgs/filelock/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/filelock/dependencies +++ b/build/pkgs/filelock/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/flit_core/dependencies b/build/pkgs/flit_core/dependencies index 93c460228b4..644ad35f773 100644 --- a/build/pkgs/flit_core/dependencies +++ b/build/pkgs/flit_core/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | pip + | pip $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/fonttools/dependencies b/build/pkgs/fonttools/dependencies index 9c736669d9a..909380550a2 100644 --- a/build/pkgs/fonttools/dependencies +++ b/build/pkgs/fonttools/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) cython + | $(PYTHON_TOOLCHAIN) cython $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/fpylll/dependencies b/build/pkgs/fpylll/dependencies index 4b4fb1b44fb..4837249bcfa 100644 --- a/build/pkgs/fpylll/dependencies +++ b/build/pkgs/fpylll/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) cython cysignals numpy fplll + cython cysignals numpy fplll | $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/furo/dependencies b/build/pkgs/furo/dependencies index fec067b2058..07434099dee 100644 --- a/build/pkgs/furo/dependencies +++ b/build/pkgs/furo/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) beautifulsoup4 sphinx pygments sphinx_basic_ng | $(PYTHON_TOOLCHAIN) + beautifulsoup4 sphinx pygments sphinx_basic_ng | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/gambit/dependencies b/build/pkgs/gambit/dependencies index 1f00cbf5321..e026bfaacf9 100644 --- a/build/pkgs/gambit/dependencies +++ b/build/pkgs/gambit/dependencies @@ -1,4 +1,4 @@ -cython | $(PYTHON_TOOLCHAIN) +cython | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/gap_jupyter/dependencies b/build/pkgs/gap_jupyter/dependencies index 41133c3ff0a..89f9b88dd92 100644 --- a/build/pkgs/gap_jupyter/dependencies +++ b/build/pkgs/gap_jupyter/dependencies @@ -1 +1 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) ipython gap + | $(PYTHON_TOOLCHAIN) ipython gap $(PYTHON) diff --git a/build/pkgs/gast/dependencies b/build/pkgs/gast/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/gast/dependencies +++ b/build/pkgs/gast/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/gdb/dependencies b/build/pkgs/gdb/dependencies index bdf81f77180..cf6822bb92e 100644 --- a/build/pkgs/gdb/dependencies +++ b/build/pkgs/gdb/dependencies @@ -1,4 +1,4 @@ -mpfr zlib ncurses $(PYTHON) xz +mpfr zlib ncurses xz | $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/gitpython/dependencies b/build/pkgs/gitpython/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/gitpython/dependencies +++ b/build/pkgs/gitpython/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/gmpy2/dependencies b/build/pkgs/gmpy2/dependencies index 98c6065dc87..b1f92b9241d 100644 --- a/build/pkgs/gmpy2/dependencies +++ b/build/pkgs/gmpy2/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) $(MP_LIBRARY) mpfr mpc | $(PYTHON_TOOLCHAIN) + $(MP_LIBRARY) mpfr mpc | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/hatch_fancy_pypi_readme/dependencies b/build/pkgs/hatch_fancy_pypi_readme/dependencies index 8cd44d06682..cfb7c484697 100644 --- a/build/pkgs/hatch_fancy_pypi_readme/dependencies +++ b/build/pkgs/hatch_fancy_pypi_readme/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) hatchling + | $(PYTHON_TOOLCHAIN) hatchling $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/hatch_nodejs_version/dependencies b/build/pkgs/hatch_nodejs_version/dependencies index e9293f104ca..85e8893f785 100644 --- a/build/pkgs/hatch_nodejs_version/dependencies +++ b/build/pkgs/hatch_nodejs_version/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) hatchling | $(PYTHON_TOOLCHAIN) + hatchling | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/hatch_vcs/dependencies b/build/pkgs/hatch_vcs/dependencies index 8cd44d06682..cfb7c484697 100644 --- a/build/pkgs/hatch_vcs/dependencies +++ b/build/pkgs/hatch_vcs/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) hatchling + | $(PYTHON_TOOLCHAIN) hatchling $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/hatchling/dependencies b/build/pkgs/hatchling/dependencies index 84b5ea48ccc..4c10ae56e2e 100644 --- a/build/pkgs/hatchling/dependencies +++ b/build/pkgs/hatchling/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) pathspec tomli editables pluggy packaging | $(PYTHON_TOOLCHAIN) + pathspec tomli editables pluggy packaging | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/html5lib/dependencies b/build/pkgs/html5lib/dependencies index 89200065387..7ebee8487db 100644 --- a/build/pkgs/html5lib/dependencies +++ b/build/pkgs/html5lib/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) webencodings | $(PYTHON_TOOLCHAIN) + webencodings | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/idna/dependencies b/build/pkgs/idna/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/idna/dependencies +++ b/build/pkgs/idna/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/imagesize/dependencies b/build/pkgs/imagesize/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/imagesize/dependencies +++ b/build/pkgs/imagesize/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/importlib_metadata/dependencies b/build/pkgs/importlib_metadata/dependencies index 77aa2a42f93..3c8d3aeb24e 100644 --- a/build/pkgs/importlib_metadata/dependencies +++ b/build/pkgs/importlib_metadata/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) zipp typing_extensions | $(PYTHON_TOOLCHAIN) tomli + zipp typing_extensions | $(PYTHON_TOOLCHAIN) tomli $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/importlib_resources/dependencies b/build/pkgs/importlib_resources/dependencies index 58927ab6f75..655283898b7 100644 --- a/build/pkgs/importlib_resources/dependencies +++ b/build/pkgs/importlib_resources/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) zipp | $(PYTHON_TOOLCHAIN) + zipp | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/ipykernel/dependencies b/build/pkgs/ipykernel/dependencies index 792c3e70634..7e153a0cb46 100644 --- a/build/pkgs/ipykernel/dependencies +++ b/build/pkgs/ipykernel/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) ipython_genutils importlib_metadata matplotlib_inline ipython jupyter_client tornado appnope traitlets executing | $(PYTHON_TOOLCHAIN) + ipython_genutils importlib_metadata matplotlib_inline ipython jupyter_client tornado appnope traitlets executing | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/ipympl/dependencies b/build/pkgs/ipympl/dependencies index 05d47407b15..90b85bcfdbc 100644 --- a/build/pkgs/ipympl/dependencies +++ b/build/pkgs/ipympl/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) ipywidgets matplotlib ipykernel | $(PYTHON_TOOLCHAIN) jupyter_packaging + ipywidgets matplotlib ipykernel | $(PYTHON_TOOLCHAIN) jupyter_packaging $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/ipython/dependencies b/build/pkgs/ipython/dependencies index 38dad7b80ee..48ad216441c 100644 --- a/build/pkgs/ipython/dependencies +++ b/build/pkgs/ipython/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) jinja2 tornado pyzmq pickleshare simplegeneric traitlets decorator wcwidth prompt_toolkit pygments pexpect appnope backcall jedi stack_data | $(PYTHON_TOOLCHAIN) + jinja2 tornado pyzmq pickleshare simplegeneric traitlets decorator wcwidth prompt_toolkit pygments pexpect appnope backcall jedi stack_data | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/ipython_genutils/dependencies b/build/pkgs/ipython_genutils/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/ipython_genutils/dependencies +++ b/build/pkgs/ipython_genutils/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/ipywidgets/dependencies b/build/pkgs/ipywidgets/dependencies index 64f5151c754..bcb4e030b7d 100644 --- a/build/pkgs/ipywidgets/dependencies +++ b/build/pkgs/ipywidgets/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) widgetsnbextension jupyterlab_widgets | $(PYTHON_TOOLCHAIN) ipykernel ipython traitlets + widgetsnbextension jupyterlab_widgets | $(PYTHON_TOOLCHAIN) ipykernel ipython traitlets $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/jedi/dependencies b/build/pkgs/jedi/dependencies index 60b5f820a37..0e2212bd149 100644 --- a/build/pkgs/jedi/dependencies +++ b/build/pkgs/jedi/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) parso | $(PYTHON_TOOLCHAIN) + parso | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/jinja2/dependencies b/build/pkgs/jinja2/dependencies index 6947978ec42..151ae9767d1 100644 --- a/build/pkgs/jinja2/dependencies +++ b/build/pkgs/jinja2/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) markupsafe docutils | $(PYTHON_TOOLCHAIN) + markupsafe docutils | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/jsonschema/dependencies b/build/pkgs/jsonschema/dependencies index 51698156cf0..d0211604157 100644 --- a/build/pkgs/jsonschema/dependencies +++ b/build/pkgs/jsonschema/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) vcversioner attrs importlib_metadata pyrsistent | $(PYTHON_TOOLCHAIN) hatchling hatch_vcs hatch_fancy_pypi_readme + vcversioner attrs importlib_metadata pyrsistent | $(PYTHON_TOOLCHAIN) hatchling hatch_vcs hatch_fancy_pypi_readme $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/jupymake/dependencies b/build/pkgs/jupymake/dependencies index c8ed956ad6a..aa714006aae 100644 --- a/build/pkgs/jupymake/dependencies +++ b/build/pkgs/jupymake/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) polymake | $(PYTHON_TOOLCHAIN) + polymake | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/jupyter_client/dependencies b/build/pkgs/jupyter_client/dependencies index 29d5d3b6bf3..dcc8c256fad 100644 --- a/build/pkgs/jupyter_client/dependencies +++ b/build/pkgs/jupyter_client/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) jupyter_core | $(PYTHON_TOOLCHAIN) pyzmq dateutil nest_asyncio tornado traitlets entrypoints hatchling + jupyter_core | $(PYTHON_TOOLCHAIN) pyzmq dateutil nest_asyncio tornado traitlets entrypoints hatchling $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/jupyter_core/dependencies b/build/pkgs/jupyter_core/dependencies index 8fbd6477646..a312196cbed 100644 --- a/build/pkgs/jupyter_core/dependencies +++ b/build/pkgs/jupyter_core/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) traitlets | $(PYTHON_TOOLCHAIN) hatchling + traitlets | $(PYTHON_TOOLCHAIN) hatchling $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/jupyter_jsmol/dependencies b/build/pkgs/jupyter_jsmol/dependencies index a6d87526311..104c23d159f 100644 --- a/build/pkgs/jupyter_jsmol/dependencies +++ b/build/pkgs/jupyter_jsmol/dependencies @@ -1,4 +1,4 @@ -ipywidgets jupyter_packaging $(PYTHON) | $(PYTHON_TOOLCHAIN) +ipywidgets jupyter_packaging | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/jupyter_packaging/dependencies b/build/pkgs/jupyter_packaging/dependencies index 838afe13edf..11e420a0a7b 100644 --- a/build/pkgs/jupyter_packaging/dependencies +++ b/build/pkgs/jupyter_packaging/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) packaging deprecation tomlkit | $(PYTHON_TOOLCHAIN) hatchling + packaging deprecation tomlkit | $(PYTHON_TOOLCHAIN) hatchling $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/jupyter_sphinx/dependencies b/build/pkgs/jupyter_sphinx/dependencies index 785929f6ea8..37476f7a572 100644 --- a/build/pkgs/jupyter_sphinx/dependencies +++ b/build/pkgs/jupyter_sphinx/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) sphinx ipywidgets ipython nbconvert nbformat | $(PYTHON_TOOLCHAIN) + sphinx ipywidgets ipython nbconvert nbformat | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/jupyterlab/dependencies b/build/pkgs/jupyterlab/dependencies index 98ad2e94050..059006650e1 100644 --- a/build/pkgs/jupyterlab/dependencies +++ b/build/pkgs/jupyterlab/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) vcversioner jupyter_core jupyter_client jinja2 tornado ipython packaging terminado traitlets nbconvert send2trash nbformat prometheus_client ipython_genutils argon2_cffi pyzmq idna requests jsonschema babel notebook | $(PYTHON_TOOLCHAIN) + vcversioner jupyter_core jupyter_client jinja2 tornado ipython packaging terminado traitlets nbconvert send2trash nbformat prometheus_client ipython_genutils argon2_cffi pyzmq idna requests jsonschema babel notebook | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/jupyterlab_pygments/dependencies b/build/pkgs/jupyterlab_pygments/dependencies index a59532cdda1..fd3f15b7aa3 100644 --- a/build/pkgs/jupyterlab_pygments/dependencies +++ b/build/pkgs/jupyterlab_pygments/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) pygments | $(PYTHON_TOOLCHAIN) + pygments | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/jupyterlab_widgets/dependencies b/build/pkgs/jupyterlab_widgets/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/jupyterlab_widgets/dependencies +++ b/build/pkgs/jupyterlab_widgets/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/kiwisolver/dependencies b/build/pkgs/kiwisolver/dependencies index 5df13094620..1ba038a9b7a 100644 --- a/build/pkgs/kiwisolver/dependencies +++ b/build/pkgs/kiwisolver/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) cppy | $(PYTHON_TOOLCHAIN) + cppy | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/lrcalc_python/dependencies b/build/pkgs/lrcalc_python/dependencies index 27c96045586..d7e0cec0534 100644 --- a/build/pkgs/lrcalc_python/dependencies +++ b/build/pkgs/lrcalc_python/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) lrcalc | $(PYTHON_TOOLCHAIN) cython + lrcalc | $(PYTHON_TOOLCHAIN) cython $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/markupsafe/dependencies b/build/pkgs/markupsafe/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/markupsafe/dependencies +++ b/build/pkgs/markupsafe/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/mathics/dependencies b/build/pkgs/mathics/dependencies index ac723a5ac26..11d5626d8c7 100644 --- a/build/pkgs/mathics/dependencies +++ b/build/pkgs/mathics/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) pint palettable mathics_scanner + | $(PYTHON_TOOLCHAIN) pint palettable mathics_scanner $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/mathics_scanner/dependencies b/build/pkgs/mathics_scanner/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/mathics_scanner/dependencies +++ b/build/pkgs/mathics_scanner/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/matplotlib/dependencies b/build/pkgs/matplotlib/dependencies index cfcf3edda7e..a2592fe7c6d 100644 --- a/build/pkgs/matplotlib/dependencies +++ b/build/pkgs/matplotlib/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) numpy freetype pillow dateutil pyparsing tornado six cycler qhull fonttools contourpy | $(PYTHON_TOOLCHAIN) kiwisolver certifi setuptools_scm_git_archive + numpy freetype pillow dateutil pyparsing tornado six cycler qhull fonttools contourpy | $(PYTHON_TOOLCHAIN) kiwisolver certifi setuptools_scm_git_archive $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/matplotlib_inline/dependencies b/build/pkgs/matplotlib_inline/dependencies index 1da34eeae60..a1a8daa948c 100644 --- a/build/pkgs/matplotlib_inline/dependencies +++ b/build/pkgs/matplotlib_inline/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) traitlets | $(PYTHON_TOOLCHAIN) + traitlets | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/memory_allocator/dependencies b/build/pkgs/memory_allocator/dependencies index 296a2bebad3..1db13c07e43 100644 --- a/build/pkgs/memory_allocator/dependencies +++ b/build/pkgs/memory_allocator/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) cython | $(PYTHON_TOOLCHAIN) + cython | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/meson/dependencies b/build/pkgs/meson/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/meson/dependencies +++ b/build/pkgs/meson/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/meson_python/dependencies b/build/pkgs/meson_python/dependencies index 160adbf36c9..01b5cb597b0 100644 --- a/build/pkgs/meson_python/dependencies +++ b/build/pkgs/meson_python/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) meson pyproject_metadata tomli ninja_build patchelf | $(PYTHON_TOOLCHAIN) + meson pyproject_metadata tomli ninja_build patchelf | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/mistune/dependencies b/build/pkgs/mistune/dependencies index 296a2bebad3..1db13c07e43 100644 --- a/build/pkgs/mistune/dependencies +++ b/build/pkgs/mistune/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) cython | $(PYTHON_TOOLCHAIN) + cython | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/mpmath/dependencies b/build/pkgs/mpmath/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/mpmath/dependencies +++ b/build/pkgs/mpmath/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/nbclient/dependencies b/build/pkgs/nbclient/dependencies index e21070fd3af..acec3fadace 100644 --- a/build/pkgs/nbclient/dependencies +++ b/build/pkgs/nbclient/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) jupyter_client nbformat | $(PYTHON_TOOLCHAIN) + jupyter_client nbformat | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/nbconvert/dependencies b/build/pkgs/nbconvert/dependencies index b423493e603..09dfbf42cb8 100644 --- a/build/pkgs/nbconvert/dependencies +++ b/build/pkgs/nbconvert/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) mistune jinja2 pygments traitlets jupyter_core nbformat entrypoints bleach pandocfilters defusedxml jupyter_client jupyterlab_pygments nbclient beautifulsoup4 markupsafe | $(PYTHON_TOOLCHAIN) + mistune jinja2 pygments traitlets jupyter_core nbformat entrypoints bleach pandocfilters defusedxml jupyter_client jupyterlab_pygments nbclient beautifulsoup4 markupsafe | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/nbformat/dependencies b/build/pkgs/nbformat/dependencies index 6c8921f1382..a6f9cc5f425 100644 --- a/build/pkgs/nbformat/dependencies +++ b/build/pkgs/nbformat/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) jsonschema fastjsonschema jupyter_core traitlets | $(PYTHON_TOOLCHAIN) hatchling hatch_nodejs_version + jsonschema fastjsonschema jupyter_core traitlets | $(PYTHON_TOOLCHAIN) hatchling hatch_nodejs_version $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/nest_asyncio/dependencies b/build/pkgs/nest_asyncio/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/nest_asyncio/dependencies +++ b/build/pkgs/nest_asyncio/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/networkx/dependencies b/build/pkgs/networkx/dependencies index 8eb6920e25d..fdba548c01a 100644 --- a/build/pkgs/networkx/dependencies +++ b/build/pkgs/networkx/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) decorator | $(PYTHON_TOOLCHAIN) scipy + decorator | $(PYTHON_TOOLCHAIN) scipy $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/ninja_build/dependencies b/build/pkgs/ninja_build/dependencies index 6b134137610..3518086ab84 100644 --- a/build/pkgs/ninja_build/dependencies +++ b/build/pkgs/ninja_build/dependencies @@ -1,4 +1,4 @@ -| $(PYTHON) +| $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/nodeenv/dependencies b/build/pkgs/nodeenv/dependencies index 16df46f57ee..04eff0c842c 100644 --- a/build/pkgs/nodeenv/dependencies +++ b/build/pkgs/nodeenv/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) certifi + | $(PYTHON_TOOLCHAIN) certifi $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/notebook/dependencies b/build/pkgs/notebook/dependencies index 9f5cb330ae2..9e6cbf4b36d 100644 --- a/build/pkgs/notebook/dependencies +++ b/build/pkgs/notebook/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) ipython jupyter_client ipykernel nbconvert nbformat jinja2 tornado terminado send2trash prometheus_client argon2_cffi + | $(PYTHON_TOOLCHAIN) ipython jupyter_client ipykernel nbconvert nbformat jinja2 tornado terminado send2trash prometheus_client argon2_cffi $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/notedown/dependencies b/build/pkgs/notedown/dependencies index ea77eefc7f4..3dcb5b1900f 100644 --- a/build/pkgs/notedown/dependencies +++ b/build/pkgs/notedown/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) $(PYTHON_TOOLCHAIN) | pip nbformat nbconvert six pandoc_attributes + $(PYTHON_TOOLCHAIN) | pip nbformat nbconvert six pandoc_attributes $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/numpy/dependencies b/build/pkgs/numpy/dependencies index d3c0f0055e4..63faafe335a 100644 --- a/build/pkgs/numpy/dependencies +++ b/build/pkgs/numpy/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) $(BLAS) gfortran | $(PYTHON_TOOLCHAIN) pkgconfig cython + $(BLAS) gfortran | $(PYTHON_TOOLCHAIN) pkgconfig cython $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/ore_algebra/dependencies b/build/pkgs/ore_algebra/dependencies index 05ba0d8954b..126e8ceee06 100644 --- a/build/pkgs/ore_algebra/dependencies +++ b/build/pkgs/ore_algebra/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) $(SAGERUNTIME) + | $(PYTHON_TOOLCHAIN) $(SAGERUNTIME) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/osqp_python/dependencies b/build/pkgs/osqp_python/dependencies index 4f344bba626..6cc50626d1d 100644 --- a/build/pkgs/osqp_python/dependencies +++ b/build/pkgs/osqp_python/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) qdldl_python numpy scipy | $(PYTHON_TOOLCHAIN) cmake + qdldl_python numpy scipy | $(PYTHON_TOOLCHAIN) cmake $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/p_group_cohomology/dependencies b/build/pkgs/p_group_cohomology/dependencies index a9d113183c5..57ea7e0dd94 100644 --- a/build/pkgs/p_group_cohomology/dependencies +++ b/build/pkgs/p_group_cohomology/dependencies @@ -1 +1 @@ -$(PYTHON) cython cysignals singular meataxe modular_resolution $(SAGE_SRC)/sage/matrix/matrix_gfpn_dense.pxd $(SAGE_SRC)/sage/structure/element.pxd $(SAGE_SRC)/sage/matrix/matrix_gfpn_dense.pxd $(SAGE_SRC)/sage/matrix/matrix0.pxd $(SAGE_SRC)/sage/libs/meataxe.pxd $(SAGE_SRC)/sage/rings/morphism.pxd | $(PYTHON_TOOLCHAIN) matplotlib gap xz $(SAGERUNTIME) ipywidgets + cython cysignals singular meataxe modular_resolution $(SAGE_SRC)/sage/matrix/matrix_gfpn_dense.pxd $(SAGE_SRC)/sage/structure/element.pxd $(SAGE_SRC)/sage/matrix/matrix_gfpn_dense.pxd $(SAGE_SRC)/sage/matrix/matrix0.pxd $(SAGE_SRC)/sage/libs/meataxe.pxd $(SAGE_SRC)/sage/rings/morphism.pxd | $(PYTHON_TOOLCHAIN) matplotlib gap xz $(SAGERUNTIME) ipywidgets $(PYTHON) diff --git a/build/pkgs/packaging/dependencies b/build/pkgs/packaging/dependencies index 2323f9df04a..17220ffcc37 100644 --- a/build/pkgs/packaging/dependencies +++ b/build/pkgs/packaging/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | setuptools pip wheel pyparsing setuptools_wheel + | setuptools pip wheel pyparsing setuptools_wheel $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/palettable/dependencies b/build/pkgs/palettable/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/palettable/dependencies +++ b/build/pkgs/palettable/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pandoc_attributes/dependencies b/build/pkgs/pandoc_attributes/dependencies index 64f88253c78..cc9d4970706 100644 --- a/build/pkgs/pandoc_attributes/dependencies +++ b/build/pkgs/pandoc_attributes/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) $(PYTHON_TOOLCHAIN) | pip pandocfilters + $(PYTHON_TOOLCHAIN) | pip pandocfilters $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pandocfilters/dependencies b/build/pkgs/pandocfilters/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/pandocfilters/dependencies +++ b/build/pkgs/pandocfilters/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pari_jupyter/dependencies b/build/pkgs/pari_jupyter/dependencies index 44eaa153cc2..f7f0020c13b 100644 --- a/build/pkgs/pari_jupyter/dependencies +++ b/build/pkgs/pari_jupyter/dependencies @@ -1 +1 @@ -$(PYTHON) pari | $(PYTHON_TOOLCHAIN) cython notebook jupyter_core + pari | $(PYTHON_TOOLCHAIN) cython notebook jupyter_core $(PYTHON) diff --git a/build/pkgs/parso/dependencies b/build/pkgs/parso/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/parso/dependencies +++ b/build/pkgs/parso/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pathspec/dependencies b/build/pkgs/pathspec/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/pathspec/dependencies +++ b/build/pkgs/pathspec/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pexpect/dependencies b/build/pkgs/pexpect/dependencies index 4a942502496..d3f8eced66f 100644 --- a/build/pkgs/pexpect/dependencies +++ b/build/pkgs/pexpect/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) ptyprocess | $(PYTHON_TOOLCHAIN) + ptyprocess | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/phitigra/dependencies b/build/pkgs/phitigra/dependencies index 7aeb0c77c74..61dca76d6bc 100644 --- a/build/pkgs/phitigra/dependencies +++ b/build/pkgs/phitigra/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) ipywidgets pillow numpy | $(PYTHON_TOOLCHAIN) + ipywidgets pillow numpy | $(PYTHON_TOOLCHAIN) $(PYTHON) These dependencies include the install-requires of ipycanvas. ---------- diff --git a/build/pkgs/pickleshare/dependencies b/build/pkgs/pickleshare/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/pickleshare/dependencies +++ b/build/pkgs/pickleshare/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pillow/dependencies b/build/pkgs/pillow/dependencies index 2ece64e58e8..f2500281136 100644 --- a/build/pkgs/pillow/dependencies +++ b/build/pkgs/pillow/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) zlib freetype | $(PYTHON_TOOLCHAIN) pkgconf + zlib freetype | $(PYTHON_TOOLCHAIN) pkgconf $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pint/dependencies b/build/pkgs/pint/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/pint/dependencies +++ b/build/pkgs/pint/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pip/dependencies b/build/pkgs/pip/dependencies index 618d627629a..dac3579f7e3 100644 --- a/build/pkgs/pip/dependencies +++ b/build/pkgs/pip/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) setuptools wheel + setuptools wheel | $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pkgconfig/dependencies b/build/pkgs/pkgconfig/dependencies index 6dfe046e55e..b52668ccb01 100644 --- a/build/pkgs/pkgconfig/dependencies +++ b/build/pkgs/pkgconfig/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) pkgconf poetry_core + | $(PYTHON_TOOLCHAIN) pkgconf poetry_core $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/platformdirs/dependencies b/build/pkgs/platformdirs/dependencies index 5b4aec583a4..952ebfb66cd 100644 --- a/build/pkgs/platformdirs/dependencies +++ b/build/pkgs/platformdirs/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) setuptools_scm | $(PYTHON_TOOLCHAIN) hatchling hatch_vcs + setuptools_scm | $(PYTHON_TOOLCHAIN) hatchling hatch_vcs $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pluggy/dependencies b/build/pkgs/pluggy/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/pluggy/dependencies +++ b/build/pkgs/pluggy/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/ply/dependencies b/build/pkgs/ply/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/ply/dependencies +++ b/build/pkgs/ply/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/poetry_core/dependencies b/build/pkgs/poetry_core/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/poetry_core/dependencies +++ b/build/pkgs/poetry_core/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pplpy/dependencies b/build/pkgs/pplpy/dependencies index 84d4fbab430..f61061ddefe 100644 --- a/build/pkgs/pplpy/dependencies +++ b/build/pkgs/pplpy/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) $(MP_LIBRARY) gmpy2 cysignals mpfr mpc ppl | $(PYTHON_TOOLCHAIN) sphinx + $(MP_LIBRARY) gmpy2 cysignals mpfr mpc ppl | $(PYTHON_TOOLCHAIN) sphinx $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/primecountpy/dependencies b/build/pkgs/primecountpy/dependencies index c141a1d7c2f..ce1374b2a0e 100644 --- a/build/pkgs/primecountpy/dependencies +++ b/build/pkgs/primecountpy/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) primecount cysignals | $(PYTHON_TOOLCHAIN) cython + primecount cysignals | $(PYTHON_TOOLCHAIN) cython $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/prometheus_client/dependencies b/build/pkgs/prometheus_client/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/prometheus_client/dependencies +++ b/build/pkgs/prometheus_client/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/prompt_toolkit/dependencies b/build/pkgs/prompt_toolkit/dependencies index 57465daf937..2bdb6af86bc 100644 --- a/build/pkgs/prompt_toolkit/dependencies +++ b/build/pkgs/prompt_toolkit/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) six wcwidth | $(PYTHON_TOOLCHAIN) + six wcwidth | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/ptyprocess/dependencies b/build/pkgs/ptyprocess/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/ptyprocess/dependencies +++ b/build/pkgs/ptyprocess/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pure_eval/dependencies b/build/pkgs/pure_eval/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/pure_eval/dependencies +++ b/build/pkgs/pure_eval/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/py/dependencies b/build/pkgs/py/dependencies index 14a312e5dee..995ddecb8f4 100644 --- a/build/pkgs/py/dependencies +++ b/build/pkgs/py/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) setuptools_scm + | $(PYTHON_TOOLCHAIN) setuptools_scm $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pybind11/dependencies b/build/pkgs/pybind11/dependencies index da2b0925acd..ca33204bd52 100644 --- a/build/pkgs/pybind11/dependencies +++ b/build/pkgs/pybind11/dependencies @@ -1 +1 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) diff --git a/build/pkgs/pycosat/dependencies b/build/pkgs/pycosat/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/pycosat/dependencies +++ b/build/pkgs/pycosat/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pycparser/dependencies b/build/pkgs/pycparser/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/pycparser/dependencies +++ b/build/pkgs/pycparser/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pycryptosat/dependencies b/build/pkgs/pycryptosat/dependencies index b897ff72eae..c51735427aa 100644 --- a/build/pkgs/pycryptosat/dependencies +++ b/build/pkgs/pycryptosat/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) m4ri zlib libpng cryptominisat | cmake boost_cropped $(PYTHON_TOOLCHAIN) + m4ri zlib libpng cryptominisat | cmake boost_cropped $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pycygwin/dependencies b/build/pkgs/pycygwin/dependencies index 296a2bebad3..1db13c07e43 100644 --- a/build/pkgs/pycygwin/dependencies +++ b/build/pkgs/pycygwin/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) cython | $(PYTHON_TOOLCHAIN) + cython | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pygments/dependencies b/build/pkgs/pygments/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/pygments/dependencies +++ b/build/pkgs/pygments/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pygraphviz/dependencies b/build/pkgs/pygraphviz/dependencies index 232dc205925..a723707e09c 100644 --- a/build/pkgs/pygraphviz/dependencies +++ b/build/pkgs/pygraphviz/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) libgraphviz | $(PYTHON_TOOLCHAIN) + libgraphviz | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pynormaliz/dependencies b/build/pkgs/pynormaliz/dependencies index 76200c19d23..1fca858579e 100644 --- a/build/pkgs/pynormaliz/dependencies +++ b/build/pkgs/pynormaliz/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) normaliz | $(PYTHON_TOOLCHAIN) + normaliz | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pyparsing/dependencies b/build/pkgs/pyparsing/dependencies index 2471ffdf59d..22915b3da68 100644 --- a/build/pkgs/pyparsing/dependencies +++ b/build/pkgs/pyparsing/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | pip wheel flit_core tomli + | pip wheel flit_core tomli $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pyppeteer/dependencies b/build/pkgs/pyppeteer/dependencies index 1c2d4afb8d4..7d9ec36f9c7 100644 --- a/build/pkgs/pyppeteer/dependencies +++ b/build/pkgs/pyppeteer/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) appdirs importlib_metadata urllib3 certifi | $(PYTHON_TOOLCHAIN) + appdirs importlib_metadata urllib3 certifi | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pyproject_metadata/dependencies b/build/pkgs/pyproject_metadata/dependencies index 6d5368db738..3df264eee42 100644 --- a/build/pkgs/pyproject_metadata/dependencies +++ b/build/pkgs/pyproject_metadata/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) packaging pyparsing | $(PYTHON_TOOLCHAIN) + packaging pyparsing | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pyrsistent/dependencies b/build/pkgs/pyrsistent/dependencies index 4361e46ddaf..9be6b4aab7c 100644 --- a/build/pkgs/pyrsistent/dependencies +++ b/build/pkgs/pyrsistent/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) vcversioner | $(PYTHON_TOOLCHAIN) + vcversioner | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pyscipopt/dependencies b/build/pkgs/pyscipopt/dependencies index 66f72c29e1a..3c4a108db0f 100644 --- a/build/pkgs/pyscipopt/dependencies +++ b/build/pkgs/pyscipopt/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) scip | $(PYTHON_TOOLCHAIN) cython + scip | $(PYTHON_TOOLCHAIN) cython $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pysingular/dependencies b/build/pkgs/pysingular/dependencies index bd58b826630..075bad15831 100644 --- a/build/pkgs/pysingular/dependencies +++ b/build/pkgs/pysingular/dependencies @@ -1 +1 @@ -$(PYTHON) singular | $(PYTHON_TOOLCHAIN) + singular | $(PYTHON_TOOLCHAIN) $(PYTHON) diff --git a/build/pkgs/pytest/dependencies b/build/pkgs/pytest/dependencies index 7e5a90a20bd..af3334a7daf 100644 --- a/build/pkgs/pytest/dependencies +++ b/build/pkgs/pytest/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) pluggy packaging attrs py pyparsing importlib_metadata tomli | $(PYTHON_TOOLCHAIN) + pluggy packaging attrs py pyparsing importlib_metadata tomli | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pytest_mock/dependencies b/build/pkgs/pytest_mock/dependencies index 37ea60eb442..720c11ec214 100644 --- a/build/pkgs/pytest_mock/dependencies +++ b/build/pkgs/pytest_mock/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) pytest packaging attrs pluggy tomli py pyparsing | $(PYTHON_TOOLCHAIN) + pytest packaging attrs pluggy tomli py pyparsing | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pytest_xdist/dependencies b/build/pkgs/pytest_xdist/dependencies index aa8c608f663..19d8b032667 100644 --- a/build/pkgs/pytest_xdist/dependencies +++ b/build/pkgs/pytest_xdist/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) pytest | $(PYTHON_TOOLCHAIN) + pytest | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/python_build/dependencies b/build/pkgs/python_build/dependencies index 769e08a8c26..b72a6d1c776 100644 --- a/build/pkgs/python_build/dependencies +++ b/build/pkgs/python_build/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) pyparsing tomli packaging | $(PYTHON_TOOLCHAIN) + pyparsing tomli packaging | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/python_igraph/dependencies b/build/pkgs/python_igraph/dependencies index 67ed15160f4..dde58706323 100644 --- a/build/pkgs/python_igraph/dependencies +++ b/build/pkgs/python_igraph/dependencies @@ -1,4 +1,4 @@ -igraph texttable $(PYTHON) | $(PYTHON_TOOLCHAIN) +igraph texttable | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pythran/dependencies b/build/pkgs/pythran/dependencies index 8a64589c0bc..3845adb7a2c 100644 --- a/build/pkgs/pythran/dependencies +++ b/build/pkgs/pythran/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) beniget gast ply numpy | $(PYTHON_TOOLCHAIN) + beniget gast ply numpy | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pytz/dependencies b/build/pkgs/pytz/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/pytz/dependencies +++ b/build/pkgs/pytz/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pytz_deprecation_shim/dependencies b/build/pkgs/pytz_deprecation_shim/dependencies index 232fe6c0554..2ea28ad2718 100644 --- a/build/pkgs/pytz_deprecation_shim/dependencies +++ b/build/pkgs/pytz_deprecation_shim/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) tzdata | $(PYTHON_TOOLCHAIN) + tzdata | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pyzmq/dependencies b/build/pkgs/pyzmq/dependencies index c72b3d23340..5031d872d13 100644 --- a/build/pkgs/pyzmq/dependencies +++ b/build/pkgs/pyzmq/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) cython zeromq | $(PYTHON_TOOLCHAIN) + cython zeromq | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/qdldl_python/dependencies b/build/pkgs/qdldl_python/dependencies index 48c2586b9f4..757104fcba0 100644 --- a/build/pkgs/qdldl_python/dependencies +++ b/build/pkgs/qdldl_python/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) pybind11 numpy scipy | $(PYTHON_TOOLCHAIN) cmake + pybind11 numpy scipy | $(PYTHON_TOOLCHAIN) cmake $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/requests/dependencies b/build/pkgs/requests/dependencies index b896dbc3cac..668fe014f12 100644 --- a/build/pkgs/requests/dependencies +++ b/build/pkgs/requests/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) idna urllib3 certifi charset_normalizer + | $(PYTHON_TOOLCHAIN) idna urllib3 certifi charset_normalizer $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/retrolab/dependencies b/build/pkgs/retrolab/dependencies index 531f28310be..58027d3558c 100644 --- a/build/pkgs/retrolab/dependencies +++ b/build/pkgs/retrolab/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) jupyterlab | $(PYTHON_TOOLCHAIN) + jupyterlab | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/rpy2/dependencies b/build/pkgs/rpy2/dependencies index b8937d88769..b88615716d4 100644 --- a/build/pkgs/rpy2/dependencies +++ b/build/pkgs/rpy2/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) r cffi tzlocal pytz jinja2 | $(PYTHON_TOOLCHAIN) pycparser + r cffi tzlocal pytz jinja2 | $(PYTHON_TOOLCHAIN) pycparser $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/rst2ipynb/dependencies b/build/pkgs/rst2ipynb/dependencies index 7fcda2181e1..d828daf957d 100644 --- a/build/pkgs/rst2ipynb/dependencies +++ b/build/pkgs/rst2ipynb/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) pandoc | $(PYTHON_TOOLCHAIN) notedown + pandoc | $(PYTHON_TOOLCHAIN) notedown $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sage_conf/dependencies b/build/pkgs/sage_conf/dependencies index 0479fd1d280..f2bd00aaf0d 100644 --- a/build/pkgs/sage_conf/dependencies +++ b/build/pkgs/sage_conf/dependencies @@ -1 +1 @@ -$(PYTHON) $(SAGE_ROOT)/pkgs/sage-conf/_sage_conf/_conf.py $(SAGE_ROOT)/pkgs/sage-conf/setup.cfg $(SAGE_ROOT)/pkgs/sage-conf/bin/sage-env-config | $(PYTHON_TOOLCHAIN) + $(SAGE_ROOT)/pkgs/sage-conf/_sage_conf/_conf.py $(SAGE_ROOT)/pkgs/sage-conf/setup.cfg $(SAGE_ROOT)/pkgs/sage-conf/bin/sage-env-config | $(PYTHON_TOOLCHAIN) $(PYTHON) diff --git a/build/pkgs/sage_docbuild/dependencies b/build/pkgs/sage_docbuild/dependencies index 376ad09772a..c21e4b287e3 100644 --- a/build/pkgs/sage_docbuild/dependencies +++ b/build/pkgs/sage_docbuild/dependencies @@ -1 +1 @@ -$(PYTHON) sphinx $(SAGE_ROOT)/pkgs/sage-docbuild/sage_docbuild/*.py $(SAGE_ROOT)/pkgs/sage-docbuild/sage_docbuild/ext/*.py | $(PYTHON_TOOLCHAIN) sagelib + sphinx $(SAGE_ROOT)/pkgs/sage-docbuild/sage_docbuild/*.py $(SAGE_ROOT)/pkgs/sage-docbuild/sage_docbuild/ext/*.py | $(PYTHON_TOOLCHAIN) sagelib $(PYTHON) diff --git a/build/pkgs/sage_flatsurf/dependencies b/build/pkgs/sage_flatsurf/dependencies index 4c62fdd4fef..c706908baa7 100644 --- a/build/pkgs/sage_flatsurf/dependencies +++ b/build/pkgs/sage_flatsurf/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) surface_dynamics $(SAGERUNTIME) + | $(PYTHON_TOOLCHAIN) surface_dynamics $(SAGERUNTIME) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sage_numerical_backends_coin/dependencies b/build/pkgs/sage_numerical_backends_coin/dependencies index 4cbde1164f2..0448728cea5 100644 --- a/build/pkgs/sage_numerical_backends_coin/dependencies +++ b/build/pkgs/sage_numerical_backends_coin/dependencies @@ -1,4 +1,4 @@ -cbc cysignals $(SAGE_SRC)/sage/numerical/backends/generic_backend.pxd $(SAGE_SRC)/sage/cpython/string.pxd $(SAGE_SRC)/sage/cpython/string_impl.h | $(SAGERUNTIME) $(PYTHON_TOOLCHAIN) cython ipywidgets +cbc cysignals $(SAGE_SRC)/sage/numerical/backends/generic_backend.pxd $(SAGE_SRC)/sage/cpython/string.pxd $(SAGE_SRC)/sage/cpython/string_impl.h | $(SAGERUNTIME) $(PYTHON_TOOLCHAIN) cython ipywidgets $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sage_numerical_backends_cplex/dependencies b/build/pkgs/sage_numerical_backends_cplex/dependencies index 0b35afa3540..840bdcabd34 100644 --- a/build/pkgs/sage_numerical_backends_cplex/dependencies +++ b/build/pkgs/sage_numerical_backends_cplex/dependencies @@ -1,4 +1,4 @@ -cysignals $(SAGE_SRC)/sage/numerical/backends/generic_backend.pxd $(SAGE_SRC)/sage/cpython/string.pxd $(SAGE_SRC)/sage/cpython/string_impl.h | $(SAGERUNTIME) $(PYTHON_TOOLCHAIN) cython ipywidgets +cysignals $(SAGE_SRC)/sage/numerical/backends/generic_backend.pxd $(SAGE_SRC)/sage/cpython/string.pxd $(SAGE_SRC)/sage/cpython/string_impl.h | $(SAGERUNTIME) $(PYTHON_TOOLCHAIN) cython ipywidgets $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sage_numerical_backends_gurobi/dependencies b/build/pkgs/sage_numerical_backends_gurobi/dependencies index 0b35afa3540..840bdcabd34 100644 --- a/build/pkgs/sage_numerical_backends_gurobi/dependencies +++ b/build/pkgs/sage_numerical_backends_gurobi/dependencies @@ -1,4 +1,4 @@ -cysignals $(SAGE_SRC)/sage/numerical/backends/generic_backend.pxd $(SAGE_SRC)/sage/cpython/string.pxd $(SAGE_SRC)/sage/cpython/string_impl.h | $(SAGERUNTIME) $(PYTHON_TOOLCHAIN) cython ipywidgets +cysignals $(SAGE_SRC)/sage/numerical/backends/generic_backend.pxd $(SAGE_SRC)/sage/cpython/string.pxd $(SAGE_SRC)/sage/cpython/string_impl.h | $(SAGERUNTIME) $(PYTHON_TOOLCHAIN) cython ipywidgets $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sage_setup/dependencies b/build/pkgs/sage_setup/dependencies index 8c2e218f49a..cae3faf9049 100644 --- a/build/pkgs/sage_setup/dependencies +++ b/build/pkgs/sage_setup/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) cython pkgconfig jinja2 $(SAGE_ROOT)/pkgs/sage-setup/sage_setup/*.py $(SAGE_ROOT)/pkgs/sage-setup/sage_setup/autogen/interpreters/specs/*.py $(SAGE_ROOT)/pkgs/sage-setup/sage_setup/command/*.py | $(PYTHON_TOOLCHAIN) + cython pkgconfig jinja2 $(SAGE_ROOT)/pkgs/sage-setup/sage_setup/*.py $(SAGE_ROOT)/pkgs/sage-setup/sage_setup/autogen/interpreters/specs/*.py $(SAGE_ROOT)/pkgs/sage-setup/sage_setup/command/*.py | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sage_sws2rst/dependencies b/build/pkgs/sage_sws2rst/dependencies index 5ca5e27df75..f32c4fc594d 100644 --- a/build/pkgs/sage_sws2rst/dependencies +++ b/build/pkgs/sage_sws2rst/dependencies @@ -1 +1 @@ -$(PYTHON) beautifulsoup4 $(SAGE_ROOT)/pkgs/sage-sws2rst/*.py | $(PYTHON_TOOLCHAIN) + beautifulsoup4 $(SAGE_ROOT)/pkgs/sage-sws2rst/*.py | $(PYTHON_TOOLCHAIN) $(PYTHON) diff --git a/build/pkgs/sagelib/dependencies b/build/pkgs/sagelib/dependencies index 9b8c062d3c3..4d756744e65 100644 --- a/build/pkgs/sagelib/dependencies +++ b/build/pkgs/sagelib/dependencies @@ -1,4 +1,4 @@ -FORCE $(SCRIPTS) arb boost_cropped $(BLAS) brial cliquer cypari cysignals cython ecl eclib ecm flint libgd gap giac givaro glpk gmpy2 gsl iml importlib_metadata importlib_resources jinja2 jupyter_core lcalc lrcalc_python libbraiding libhomfly libpng linbox m4ri m4rie memory_allocator mpc mpfi mpfr $(MP_LIBRARY) ntl numpy pari pip pkgconfig planarity ppl pplpy primesieve primecount primecountpy pycygwin $(PYTHON) requests rw sage_conf singular symmetrica typing_extensions $(PCFILES) | $(PYTHON_TOOLCHAIN) sage_setup +FORCE $(SCRIPTS) arb boost_cropped $(BLAS) brial cliquer cypari cysignals cython ecl eclib ecm flint libgd gap giac givaro glpk gmpy2 gsl iml importlib_metadata importlib_resources jinja2 jupyter_core lcalc lrcalc_python libbraiding libhomfly libpng linbox m4ri m4rie memory_allocator mpc mpfi mpfr $(MP_LIBRARY) ntl numpy pari pip pkgconfig planarity ppl pplpy primesieve primecount primecountpy pycygwin requests rw sage_conf singular symmetrica typing_extensions $(PCFILES) | $(PYTHON_TOOLCHAIN) sage_setup $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sagemath_bliss/dependencies b/build/pkgs/sagemath_bliss/dependencies index 279e79ace91..a7915e316b9 100644 --- a/build/pkgs/sagemath_bliss/dependencies +++ b/build/pkgs/sagemath_bliss/dependencies @@ -1 +1 @@ -$(PYTHON) bliss cysignals | $(PYTHON_TOOLCHAIN) sage_setup sage_conf sagemath_environment cython pkgconfig + bliss cysignals | $(PYTHON_TOOLCHAIN) sage_setup sage_conf sagemath_environment cython pkgconfig $(PYTHON) diff --git a/build/pkgs/sagemath_categories/dependencies b/build/pkgs/sagemath_categories/dependencies index d8b6bdbd4a7..9fa43a64aae 100644 --- a/build/pkgs/sagemath_categories/dependencies +++ b/build/pkgs/sagemath_categories/dependencies @@ -1 +1 @@ -$(PYTHON) sagemath_objects | $(PYTHON_TOOLCHAIN) sagemath_environment sage_setup cython pkgconfig python_build + sagemath_objects | $(PYTHON_TOOLCHAIN) sagemath_environment sage_setup cython pkgconfig python_build $(PYTHON) diff --git a/build/pkgs/sagemath_coxeter3/dependencies b/build/pkgs/sagemath_coxeter3/dependencies index 615392ca427..ada45656089 100644 --- a/build/pkgs/sagemath_coxeter3/dependencies +++ b/build/pkgs/sagemath_coxeter3/dependencies @@ -1 +1 @@ -$(PYTHON) coxeter3 | $(PYTHON_TOOLCHAIN) sage_setup sagemath_environment cython pkgconfig + coxeter3 | $(PYTHON_TOOLCHAIN) sage_setup sagemath_environment cython pkgconfig $(PYTHON) diff --git a/build/pkgs/sagemath_environment/dependencies b/build/pkgs/sagemath_environment/dependencies index 605611e7a21..0f36ec317e6 100644 --- a/build/pkgs/sagemath_environment/dependencies +++ b/build/pkgs/sagemath_environment/dependencies @@ -1 +1 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) python_build + | $(PYTHON_TOOLCHAIN) python_build $(PYTHON) diff --git a/build/pkgs/sagemath_mcqd/dependencies b/build/pkgs/sagemath_mcqd/dependencies index e383df7dafa..9896fdaccfc 100644 --- a/build/pkgs/sagemath_mcqd/dependencies +++ b/build/pkgs/sagemath_mcqd/dependencies @@ -1 +1 @@ -$(PYTHON) mcqd memory_allocator cysignals | $(PYTHON_TOOLCHAIN) sage_setup cython pkgconfig + mcqd memory_allocator cysignals | $(PYTHON_TOOLCHAIN) sage_setup cython pkgconfig $(PYTHON) diff --git a/build/pkgs/sagemath_meataxe/dependencies b/build/pkgs/sagemath_meataxe/dependencies index f100932802a..c333fcc61db 100644 --- a/build/pkgs/sagemath_meataxe/dependencies +++ b/build/pkgs/sagemath_meataxe/dependencies @@ -1 +1 @@ -$(PYTHON) meataxe | $(PYTHON_TOOLCHAIN) sage_setup sagemath_environment cython pkgconfig + meataxe | $(PYTHON_TOOLCHAIN) sage_setup sagemath_environment cython pkgconfig $(PYTHON) diff --git a/build/pkgs/sagemath_objects/dependencies b/build/pkgs/sagemath_objects/dependencies index 807b8b17215..ffc14bb6ba6 100644 --- a/build/pkgs/sagemath_objects/dependencies +++ b/build/pkgs/sagemath_objects/dependencies @@ -1,3 +1,3 @@ -FORCE $(PYTHON) cysignals gmpy2 | $(PYTHON_TOOLCHAIN) sagemath_environment sage_setup cython pkgconfig python_build +FORCE cysignals gmpy2 | $(PYTHON_TOOLCHAIN) sagemath_environment sage_setup cython pkgconfig python_build $(PYTHON) # FORCE: Always run the spkg-install script diff --git a/build/pkgs/sagemath_repl/dependencies b/build/pkgs/sagemath_repl/dependencies index ebc253dac5b..7d7ba20c5dd 100644 --- a/build/pkgs/sagemath_repl/dependencies +++ b/build/pkgs/sagemath_repl/dependencies @@ -1 +1 @@ -$(PYTHON) sagemath_objects sagemath_environment ipython ipywidgets | $(PYTHON_TOOLCHAIN) python_build + sagemath_objects sagemath_environment ipython ipywidgets | $(PYTHON_TOOLCHAIN) python_build $(PYTHON) diff --git a/build/pkgs/sagemath_sirocco/dependencies b/build/pkgs/sagemath_sirocco/dependencies index b923f34d7eb..4f47049ec4b 100644 --- a/build/pkgs/sagemath_sirocco/dependencies +++ b/build/pkgs/sagemath_sirocco/dependencies @@ -1 +1 @@ -$(PYTHON) sirocco cypari cysignals mpfr | $(PYTHON_TOOLCHAIN) sage_setup sagemath_environment cython pkgconfig + sirocco cypari cysignals mpfr | $(PYTHON_TOOLCHAIN) sage_setup sagemath_environment cython pkgconfig $(PYTHON) diff --git a/build/pkgs/sagemath_tdlib/dependencies b/build/pkgs/sagemath_tdlib/dependencies index 5c7ecd31f2f..b22ab6c52a7 100644 --- a/build/pkgs/sagemath_tdlib/dependencies +++ b/build/pkgs/sagemath_tdlib/dependencies @@ -1 +1 @@ -$(PYTHON) tdlib cysignals | $(PYTHON_TOOLCHAIN) sage_setup sagemath_environment cython pkgconfig + tdlib cysignals | $(PYTHON_TOOLCHAIN) sage_setup sagemath_environment cython pkgconfig $(PYTHON) diff --git a/build/pkgs/sagenb_export/dependencies b/build/pkgs/sagenb_export/dependencies index 26033350f88..f9a2f2adbb9 100644 --- a/build/pkgs/sagenb_export/dependencies +++ b/build/pkgs/sagenb_export/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) notebook nbconvert ipython six | $(PYTHON_TOOLCHAIN) + notebook nbconvert ipython six | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sagetex/dependencies b/build/pkgs/sagetex/dependencies index 6090d5dc3ac..af9b5f370fb 100644 --- a/build/pkgs/sagetex/dependencies +++ b/build/pkgs/sagetex/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) maxima scipy matplotlib pillow tachyon pyparsing + maxima scipy matplotlib pillow tachyon pyparsing | $(PYTHON) To build SageTeX, you just need Python and pyparsing, but to test (SAGE_CHECK=yes) SageTeX, you actually need to run Sage, produce plots,... diff --git a/build/pkgs/scipy/dependencies b/build/pkgs/scipy/dependencies index 5d42789eb10..82fa8e0c0d7 100644 --- a/build/pkgs/scipy/dependencies +++ b/build/pkgs/scipy/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) $(BLAS) gfortran numpy pybind11 cython pythran | $(PYTHON_TOOLCHAIN) meson_python + $(BLAS) gfortran numpy pybind11 cython pythran | $(PYTHON_TOOLCHAIN) meson_python $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/scs/dependencies b/build/pkgs/scs/dependencies index 56c3c7a111c..a736df74ec5 100644 --- a/build/pkgs/scs/dependencies +++ b/build/pkgs/scs/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) numpy | $(PYTHON_TOOLCHAIN) cmake + numpy | $(PYTHON_TOOLCHAIN) cmake $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/send2trash/dependencies b/build/pkgs/send2trash/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/send2trash/dependencies +++ b/build/pkgs/send2trash/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/setuptools/dependencies b/build/pkgs/setuptools/dependencies index 1700e743d59..d45a397db36 100644 --- a/build/pkgs/setuptools/dependencies +++ b/build/pkgs/setuptools/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) + | $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/setuptools_scm/dependencies b/build/pkgs/setuptools_scm/dependencies index f3662a5c829..7dd3b6e8f6e 100644 --- a/build/pkgs/setuptools_scm/dependencies +++ b/build/pkgs/setuptools_scm/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) typing_extensions | setuptools pip wheel tomli packaging + typing_extensions | setuptools pip wheel tomli packaging $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/setuptools_scm_git_archive/dependencies b/build/pkgs/setuptools_scm_git_archive/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/setuptools_scm_git_archive/dependencies +++ b/build/pkgs/setuptools_scm_git_archive/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/setuptools_wheel/dependencies b/build/pkgs/setuptools_wheel/dependencies index 618d627629a..dac3579f7e3 100644 --- a/build/pkgs/setuptools_wheel/dependencies +++ b/build/pkgs/setuptools_wheel/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) setuptools wheel + setuptools wheel | $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/simplegeneric/dependencies b/build/pkgs/simplegeneric/dependencies index 703d0ec7ba3..1169eb4105f 100644 --- a/build/pkgs/simplegeneric/dependencies +++ b/build/pkgs/simplegeneric/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) # simplegeneric does not strictly require setuptools, but it does try # to use setuptools if it is available. However, there is a problem diff --git a/build/pkgs/singular_jupyter/dependencies b/build/pkgs/singular_jupyter/dependencies index 14dc06f7076..dc15abb82c7 100644 --- a/build/pkgs/singular_jupyter/dependencies +++ b/build/pkgs/singular_jupyter/dependencies @@ -1 +1 @@ -$(PYTHON) jupyter_client | $(PYTHON_TOOLCHAIN) pysingular ipython ipywidgets + jupyter_client | $(PYTHON_TOOLCHAIN) pysingular ipython ipywidgets $(PYTHON) diff --git a/build/pkgs/six/dependencies b/build/pkgs/six/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/six/dependencies +++ b/build/pkgs/six/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/slabbe/dependencies b/build/pkgs/slabbe/dependencies index 05ba0d8954b..126e8ceee06 100644 --- a/build/pkgs/slabbe/dependencies +++ b/build/pkgs/slabbe/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) $(SAGERUNTIME) + | $(PYTHON_TOOLCHAIN) $(SAGERUNTIME) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/snappy/dependencies b/build/pkgs/snappy/dependencies index db96ccc42e0..ceaf757887e 100644 --- a/build/pkgs/snappy/dependencies +++ b/build/pkgs/snappy/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) decorator ipython cypari | $(PYTHON_TOOLCHAIN) sagelib + decorator ipython cypari | $(PYTHON_TOOLCHAIN) sagelib $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/snowballstemmer/dependencies b/build/pkgs/snowballstemmer/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/snowballstemmer/dependencies +++ b/build/pkgs/snowballstemmer/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/soupsieve/dependencies b/build/pkgs/soupsieve/dependencies index 8cd44d06682..cfb7c484697 100644 --- a/build/pkgs/soupsieve/dependencies +++ b/build/pkgs/soupsieve/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) hatchling + | $(PYTHON_TOOLCHAIN) hatchling $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sphinx/dependencies b/build/pkgs/sphinx/dependencies index 75c668d9c23..9b7505c9aec 100644 --- a/build/pkgs/sphinx/dependencies +++ b/build/pkgs/sphinx/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) docutils jinja2 pygments snowballstemmer imagesize babel alabaster requests sphinxcontrib_websupport sphinxcontrib_applehelp sphinxcontrib_devhelp sphinxcontrib_htmlhelp sphinxcontrib_jsmath sphinxcontrib_qthelp sphinxcontrib_serializinghtml packaging importlib_metadata + | $(PYTHON_TOOLCHAIN) docutils jinja2 pygments snowballstemmer imagesize babel alabaster requests sphinxcontrib_websupport sphinxcontrib_applehelp sphinxcontrib_devhelp sphinxcontrib_htmlhelp sphinxcontrib_jsmath sphinxcontrib_qthelp sphinxcontrib_serializinghtml packaging importlib_metadata $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sphinx_basic_ng/dependencies b/build/pkgs/sphinx_basic_ng/dependencies index 175a793ecbc..ac849c62bf6 100644 --- a/build/pkgs/sphinx_basic_ng/dependencies +++ b/build/pkgs/sphinx_basic_ng/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) sphinx | $(PYTHON_TOOLCHAIN) + sphinx | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sphinx_copybutton/dependencies b/build/pkgs/sphinx_copybutton/dependencies index 175a793ecbc..ac849c62bf6 100644 --- a/build/pkgs/sphinx_copybutton/dependencies +++ b/build/pkgs/sphinx_copybutton/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) sphinx | $(PYTHON_TOOLCHAIN) + sphinx | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sphinxcontrib_applehelp/dependencies b/build/pkgs/sphinxcontrib_applehelp/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/sphinxcontrib_applehelp/dependencies +++ b/build/pkgs/sphinxcontrib_applehelp/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sphinxcontrib_devhelp/dependencies b/build/pkgs/sphinxcontrib_devhelp/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/sphinxcontrib_devhelp/dependencies +++ b/build/pkgs/sphinxcontrib_devhelp/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sphinxcontrib_htmlhelp/dependencies b/build/pkgs/sphinxcontrib_htmlhelp/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/sphinxcontrib_htmlhelp/dependencies +++ b/build/pkgs/sphinxcontrib_htmlhelp/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sphinxcontrib_jsmath/dependencies b/build/pkgs/sphinxcontrib_jsmath/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/sphinxcontrib_jsmath/dependencies +++ b/build/pkgs/sphinxcontrib_jsmath/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sphinxcontrib_qthelp/dependencies b/build/pkgs/sphinxcontrib_qthelp/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/sphinxcontrib_qthelp/dependencies +++ b/build/pkgs/sphinxcontrib_qthelp/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sphinxcontrib_serializinghtml/dependencies b/build/pkgs/sphinxcontrib_serializinghtml/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/sphinxcontrib_serializinghtml/dependencies +++ b/build/pkgs/sphinxcontrib_serializinghtml/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sphinxcontrib_websupport/dependencies b/build/pkgs/sphinxcontrib_websupport/dependencies index dabbd0f750d..52be4a5ba53 100644 --- a/build/pkgs/sphinxcontrib_websupport/dependencies +++ b/build/pkgs/sphinxcontrib_websupport/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) sphinxcontrib_serializinghtml | $(PYTHON_TOOLCHAIN) + sphinxcontrib_serializinghtml | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/stack_data/dependencies b/build/pkgs/stack_data/dependencies index cf6aae43990..52b3edda4b5 100644 --- a/build/pkgs/stack_data/dependencies +++ b/build/pkgs/stack_data/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) executing asttokens pure_eval | $(PYTHON_TOOLCHAIN) + executing asttokens pure_eval | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/surface_dynamics/dependencies b/build/pkgs/surface_dynamics/dependencies index 936121d388d..d8bc8524dbb 100644 --- a/build/pkgs/surface_dynamics/dependencies +++ b/build/pkgs/surface_dynamics/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) cysignals pplpy $(SAGE_SRC)/sage/rings/integer.pxd $(SAGE_SRC)/sage/ext/stdsage.pxd | $(PYTHON_TOOLCHAIN) $(SAGERUNTIME) + cysignals pplpy $(SAGE_SRC)/sage/rings/integer.pxd $(SAGE_SRC)/sage/ext/stdsage.pxd | $(PYTHON_TOOLCHAIN) $(SAGERUNTIME) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/symengine_py/dependencies b/build/pkgs/symengine_py/dependencies index 0b94df79ab9..c48bcedf69c 100644 --- a/build/pkgs/symengine_py/dependencies +++ b/build/pkgs/symengine_py/dependencies @@ -1,4 +1,4 @@ -symengine $(PYTHON) | cmake cython $(PYTHON_TOOLCHAIN) +symengine | cmake cython $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sympy/dependencies b/build/pkgs/sympy/dependencies index 24e1585f16e..6480ac46289 100644 --- a/build/pkgs/sympy/dependencies +++ b/build/pkgs/sympy/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) mpmath | $(PYTHON_TOOLCHAIN) + mpmath | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/terminado/dependencies b/build/pkgs/terminado/dependencies index 54ec1c7c229..2138b7ccbe8 100644 --- a/build/pkgs/terminado/dependencies +++ b/build/pkgs/terminado/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) ptyprocess tornado | $(PYTHON_TOOLCHAIN) hatchling + ptyprocess tornado | $(PYTHON_TOOLCHAIN) hatchling $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/texttable/dependencies b/build/pkgs/texttable/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/texttable/dependencies +++ b/build/pkgs/texttable/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/tinycss2/dependencies b/build/pkgs/tinycss2/dependencies index 89200065387..7ebee8487db 100644 --- a/build/pkgs/tinycss2/dependencies +++ b/build/pkgs/tinycss2/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) webencodings | $(PYTHON_TOOLCHAIN) + webencodings | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/toml/dependencies b/build/pkgs/toml/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/toml/dependencies +++ b/build/pkgs/toml/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/tomli/dependencies b/build/pkgs/tomli/dependencies index 7cd1e28759d..992761d1f11 100644 --- a/build/pkgs/tomli/dependencies +++ b/build/pkgs/tomli/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | pip flit_core + | pip flit_core $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/tomlkit/dependencies b/build/pkgs/tomlkit/dependencies index 3eb5a92ef22..e67b4c08948 100644 --- a/build/pkgs/tomlkit/dependencies +++ b/build/pkgs/tomlkit/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) poetry_core + | $(PYTHON_TOOLCHAIN) poetry_core $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/tornado/dependencies b/build/pkgs/tornado/dependencies index 212c6234efb..0d4701f9d71 100644 --- a/build/pkgs/tornado/dependencies +++ b/build/pkgs/tornado/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) certifi | $(PYTHON_TOOLCHAIN) + certifi | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/tox/dependencies b/build/pkgs/tox/dependencies index 5a00a282b7d..d910d42722f 100644 --- a/build/pkgs/tox/dependencies +++ b/build/pkgs/tox/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) packaging six filelock pluggy py toml virtualenv importlib_metadata | $(PYTHON_TOOLCHAIN) + packaging six filelock pluggy py toml virtualenv importlib_metadata | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/traitlets/dependencies b/build/pkgs/traitlets/dependencies index df88de8f64c..e835448bea5 100644 --- a/build/pkgs/traitlets/dependencies +++ b/build/pkgs/traitlets/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) ipython_genutils decorator six hatchling + | $(PYTHON_TOOLCHAIN) ipython_genutils decorator six hatchling $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/typing_extensions/dependencies b/build/pkgs/typing_extensions/dependencies index f8bd1ee040d..e0e94942dba 100644 --- a/build/pkgs/typing_extensions/dependencies +++ b/build/pkgs/typing_extensions/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | flit_core + | flit_core $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/tzdata/dependencies b/build/pkgs/tzdata/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/tzdata/dependencies +++ b/build/pkgs/tzdata/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/tzlocal/dependencies b/build/pkgs/tzlocal/dependencies index 1d3b818d4ac..4e161b299ab 100644 --- a/build/pkgs/tzlocal/dependencies +++ b/build/pkgs/tzlocal/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) pytz_deprecation_shim | $(PYTHON_TOOLCHAIN) + pytz_deprecation_shim | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/urllib3/dependencies b/build/pkgs/urllib3/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/urllib3/dependencies +++ b/build/pkgs/urllib3/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/vcversioner/dependencies b/build/pkgs/vcversioner/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/vcversioner/dependencies +++ b/build/pkgs/vcversioner/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/virtualenv/dependencies b/build/pkgs/virtualenv/dependencies index a8b8def7051..021e0fc1bd7 100644 --- a/build/pkgs/virtualenv/dependencies +++ b/build/pkgs/virtualenv/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) appdirs distlib filelock six importlib_metadata importlib_resources platformdirs | $(PYTHON_TOOLCHAIN) + appdirs distlib filelock six importlib_metadata importlib_resources platformdirs | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/wcwidth/dependencies b/build/pkgs/wcwidth/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/wcwidth/dependencies +++ b/build/pkgs/wcwidth/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/webencodings/dependencies b/build/pkgs/webencodings/dependencies index 0738c2d7777..47296a7bace 100644 --- a/build/pkgs/webencodings/dependencies +++ b/build/pkgs/webencodings/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) + | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/wheel/dependencies b/build/pkgs/wheel/dependencies index 98d3e59447b..a8e327be793 100644 --- a/build/pkgs/wheel/dependencies +++ b/build/pkgs/wheel/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) setuptools + setuptools | $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/widgetsnbextension/dependencies b/build/pkgs/widgetsnbextension/dependencies index f7ff1dca568..301cefdea49 100644 --- a/build/pkgs/widgetsnbextension/dependencies +++ b/build/pkgs/widgetsnbextension/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) jupyter_packaging | $(PYTHON_TOOLCHAIN) jupyter_core + jupyter_packaging | $(PYTHON_TOOLCHAIN) jupyter_core $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/zipp/dependencies b/build/pkgs/zipp/dependencies index 4361e46ddaf..9be6b4aab7c 100644 --- a/build/pkgs/zipp/dependencies +++ b/build/pkgs/zipp/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) vcversioner | $(PYTHON_TOOLCHAIN) + vcversioner | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. From a3246b0498be333fd620a531ac7742c8ddce372e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 31 Aug 2023 12:24:30 -0700 Subject: [PATCH 374/423] build/bin/sage-build-env-config.in: Set PYTHON_MINOR variable --- build/bin/sage-build-env-config.in | 1 + build/make/Makefile.in | 1 + build/pkgs/python3/spkg-configure.m4 | 14 +++++++------- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/build/bin/sage-build-env-config.in b/build/bin/sage-build-env-config.in index b2f59343d25..7d6cd113bf9 100644 --- a/build/bin/sage-build-env-config.in +++ b/build/bin/sage-build-env-config.in @@ -62,3 +62,4 @@ export CONFIGURED_SAGE_EDITABLE="@SAGE_EDITABLE@" export CONFIGURED_SAGE_WHEELS="@SAGE_WHEELS@" export ENABLE_SYSTEM_SITE_PACKAGES="@ENABLE_SYSTEM_SITE_PACKAGES@" +export PYTHON_MINOR="@PYTHON_MINOR@" diff --git a/build/make/Makefile.in b/build/make/Makefile.in index caf86fdeaf8..9bf5a9a823c 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -227,6 +227,7 @@ SAGE_I_TARGETS = sagelib doc python3_venv _clean-broken-gcc PYTHON_FOR_VENV = @PYTHON_FOR_VENV@ +PYTHON_MINOR = @PYTHON_MINOR@ SAGE_VENV_FLAGS = @SAGE_VENV_FLAGS@ ifneq ($(PYTHON_FOR_VENV),) diff --git a/build/pkgs/python3/spkg-configure.m4 b/build/pkgs/python3/spkg-configure.m4 index 5a0aa955633..a6886c0e72c 100644 --- a/build/pkgs/python3/spkg-configure.m4 +++ b/build/pkgs/python3/spkg-configure.m4 @@ -130,17 +130,17 @@ To build Sage with a different system python, use ./configure --with-python=/pat ]) AC_SUBST([PYTHON_FOR_VENV]) + AS_IF([test -n "$PYTHON_FOR_VENV"], + [PYTHON_VERSION=$("$PYTHON_FOR_VENV" -c "import sysconfig; print(sysconfig.get_python_version())")], + [PYTHON_VERSION=$(echo $(cat build/pkgs/python3/package-version.txt))]) + AC_SUBST([PYTHON_MINOR], [$(echo $PYTHON_VERSION | sed -E 's/[[0-9]]*\.([[0-9]]*).*/\1/')]) + export PYTHON_MINOR # for sage-get-system-packages + AS_VAR_IF([SAGE_VENV], [auto], [SAGE_VENV=$SAGE_VENV_AUTO]) AS_CASE([$SAGE_VENV], [no], [SAGE_VENV='${SAGE_LOCAL}'],dnl Quoted so that it is resolved at build time by shell/Makefile - [yes], [AS_IF([test -n "$PYTHON_FOR_VENV"], [ - PYTHON_VERSION=$("$PYTHON_FOR_VENV" -c "import sysconfig; print(sysconfig.get_python_version())") - ], [ - PYTHON_VERSION=$(echo $(cat build/pkgs/python3/package-version.txt)) - ]) - SAGE_VENV='${SAGE_LOCAL}'/var/lib/sage/venv-python$PYTHON_VERSION] + [yes], [SAGE_VENV='${SAGE_LOCAL}'/var/lib/sage/venv-python$PYTHON_VERSION] ) - dnl These temporary directories are created by the check above dnl and need to be cleaned up to prevent the "rm -f conftest*" dnl (that a bunch of other checks do) from emitting warnings about From 51172bd88636657b4461970ff35321298efd487f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 31 Aug 2023 12:45:43 -0700 Subject: [PATCH 375/423] build/make/Makefile.in: Re-create venv when PYTHON_MINOR, PYTHON_FOR_VENV, or SAGE_VENV_FLAGS change --- build/make/Makefile.in | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/build/make/Makefile.in b/build/make/Makefile.in index 9bf5a9a823c..5ec2be00479 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -233,7 +233,7 @@ SAGE_VENV_FLAGS = @SAGE_VENV_FLAGS@ ifneq ($(PYTHON_FOR_VENV),) # Special rule for making the Python virtualenv from the system Python (Python # 3 only). $(PYTHON) is set in Makefile to python3_venv. -# Thus $(inst_python3_venv) will be the dependency of every Python package. +# Thus $(inst_python3_venv) will an (order-only) dependency of every Python package. # # TODO: If we reconfigure to build our own Python after having used the system # Python, files installed to create the virtualenv should be *removed*. That @@ -241,13 +241,15 @@ ifneq ($(PYTHON_FOR_VENV),) ifeq ($(PYTHON),python3) PYTHON = python3_venv endif -inst_python3_venv = $(SAGE_VENV)/$(SPKG_INST_RELDIR)/python3_venv-$(subst /,-,$(PYTHON_FOR_VENV))$(findstring --system-site-packages,$(SAGE_VENV_FLAGS)) +inst_python3_venv = $(SAGE_VENV)/$(SPKG_INST_RELDIR)/python3_venv-3.$(PYTHON_MINOR)-$(subst /,-,$(PYTHON_FOR_VENV))$(findstring --system-site-packages,$(SAGE_VENV_FLAGS)) $(SAGE_VENV)/$(SPKG_INST_RELDIR): - mkdir -p $@ -$(inst_python3_venv): $(SAGE_VENV)/$(SPKG_INST_RELDIR) + mkdir -p "$@" + +$(inst_python3_venv): | $(SAGE_VENV)/$(SPKG_INST_RELDIR) $(PYTHON_FOR_VENV) $(SAGE_ROOT)/build/bin/sage-venv $(SAGE_VENV_FLAGS) "$(SAGE_VENV)" - touch $@ + rm -f "$(SAGE_VENV)/$(SPKG_INST_RELDIR)"/python3_venv-* + touch "$@" endif # Build everything and start Sage. From 8a36757ace5a14fcd01685986687df075cf2883d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 31 Aug 2023 12:55:18 -0700 Subject: [PATCH 376/423] .github/workflows/ci-linux.yml (standard-sitepackages): Only test platforms with usable system python --- .github/workflows/ci-linux.yml | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 8a2ea35cfba..6f598521a37 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -78,7 +78,38 @@ jobs: targets: build doc-html targets_optional: ptest tox_packages_factors: >- - ["standard-sitepackages"] + ["standard-sitepackages"] + # Only test systems with a usable system python (>= 3.9) + tox_system_factors: >- + ["ubuntu-jammy", + "ubuntu-kinetic", + "ubuntu-lunar", + "ubuntu-mantic", + "debian-bullseye", + "debian-bookworm", + "debian-trixie", + "debian-sid", + "linuxmint-21", + "linuxmint-21.1", + "linuxmint-21.2", + "fedora-33", + "fedora-34", + "fedora-35", + "fedora-36", + "fedora-37", + "fedora-38", + "fedora-39", + "centos-stream-8-python3.9", + "centos-stream-9-python3.9", + "almalinux-8-python3.9", + "gentoo-python3.10", + "gentoo-python3.11", + "archlinux-latest", + "opensuse-15.4-gcc_11-python3.10", + "opensuse-15.5-gcc_11-python3.11", + "opensuse-tumbleweed-python3.10", + "opensuse-tumbleweed", + "debian-bullseye-i386"] docker_push_repository: ghcr.io/${{ github.repository }}/ max_parallel: 10 From bc7a92b0709ae6a1d3d542691ed7fdcd09197d0b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 31 Aug 2023 13:25:58 -0700 Subject: [PATCH 377/423] build/pkgs/{jinja2,packaging}: Increase lower bounds --- build/pkgs/jinja2/install-requires.txt | 3 ++- build/pkgs/packaging/install-requires.txt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build/pkgs/jinja2/install-requires.txt b/build/pkgs/jinja2/install-requires.txt index 99d8e6ecd6e..829d4c266d3 100644 --- a/build/pkgs/jinja2/install-requires.txt +++ b/build/pkgs/jinja2/install-requires.txt @@ -1 +1,2 @@ -jinja2 >=2.11.2 +jinja2 >=3.0 +# for sphinx diff --git a/build/pkgs/packaging/install-requires.txt b/build/pkgs/packaging/install-requires.txt index cb98c369e84..637d00eff2f 100644 --- a/build/pkgs/packaging/install-requires.txt +++ b/build/pkgs/packaging/install-requires.txt @@ -1,2 +1,3 @@ -packaging >=18.0 +packaging >=21.0 # Trac #30975: packaging 20.5 is known to work but we have to silence "DeprecationWarning: Creating a LegacyVersion" +# Sphinx needs >= 21 From 0ea6aa30c1c7dad8846f804a2e8106305505af83 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 25 Aug 2023 14:41:33 -0700 Subject: [PATCH 378/423] build/pkgs/jupyter_jsmol: Switch to wheel package --- build/pkgs/jupyter_jsmol/SPKG.rst | 2 +- build/pkgs/jupyter_jsmol/checksums.ini | 10 +++++----- build/pkgs/jupyter_jsmol/dependencies | 2 +- build/pkgs/jupyter_jsmol/install-requires.txt | 2 +- build/pkgs/jupyter_jsmol/spkg-install.in | 3 --- 5 files changed, 8 insertions(+), 11 deletions(-) delete mode 100644 build/pkgs/jupyter_jsmol/spkg-install.in diff --git a/build/pkgs/jupyter_jsmol/SPKG.rst b/build/pkgs/jupyter_jsmol/SPKG.rst index e318a86c7b1..64458e86b2d 100644 --- a/build/pkgs/jupyter_jsmol/SPKG.rst +++ b/build/pkgs/jupyter_jsmol/SPKG.rst @@ -9,7 +9,7 @@ JSmol viewer widget for Jupyter License ------- -BSD +MIT Upstream Contact ---------------- diff --git a/build/pkgs/jupyter_jsmol/checksums.ini b/build/pkgs/jupyter_jsmol/checksums.ini index 0ac16d6e78c..9ac2c41a8e4 100644 --- a/build/pkgs/jupyter_jsmol/checksums.ini +++ b/build/pkgs/jupyter_jsmol/checksums.ini @@ -1,5 +1,5 @@ -tarball=jupyter_jsmol-VERSION.tar.gz -sha1=6ba59de9d1df15b2a09a57f6bdf10f48f13af9ac -md5=90e9490414e7fbecc6013b4b051b06d7 -cksum=917919116 -upstream_url=https://pypi.io/packages/source/j/jupyter-jsmol/jupyter_jsmol-VERSION.tar.gz +tarball=jupyter_jsmol-VERSION-py2.py3-none-any.whl +sha1=b00f1ca76aaa906c7c0a43e36baf608183f3d552 +md5=dd786877513296a36a08518ad64ace47 +cksum=2135042898 +upstream_url=https://pypi.io/packages/py2.py3/j/jupyter_jsmol/jupyter_jsmol-VERSION-py2.py3-none-any.whl diff --git a/build/pkgs/jupyter_jsmol/dependencies b/build/pkgs/jupyter_jsmol/dependencies index 104c23d159f..2c7683a6111 100644 --- a/build/pkgs/jupyter_jsmol/dependencies +++ b/build/pkgs/jupyter_jsmol/dependencies @@ -1,4 +1,4 @@ -ipywidgets jupyter_packaging | $(PYTHON_TOOLCHAIN) $(PYTHON) +ipywidgets | $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/jupyter_jsmol/install-requires.txt b/build/pkgs/jupyter_jsmol/install-requires.txt index 2df501ec9a8..9465bfb8e0c 100644 --- a/build/pkgs/jupyter_jsmol/install-requires.txt +++ b/build/pkgs/jupyter_jsmol/install-requires.txt @@ -1 +1 @@ -jupyter-jsmol >=2022.1.0 +jupyter-jsmol diff --git a/build/pkgs/jupyter_jsmol/spkg-install.in b/build/pkgs/jupyter_jsmol/spkg-install.in deleted file mode 100644 index 72d65dde8d5..00000000000 --- a/build/pkgs/jupyter_jsmol/spkg-install.in +++ /dev/null @@ -1,3 +0,0 @@ -cd src -# Use --no-build-isolation because we have a different version of jupyter_packaging -eval sdh_pip_install --no-build-isolation --config-settings "--global-option=--skip-npm" . From ad5635887b94ff7d686dfa2feae3d26301a53e90 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 31 Aug 2023 14:51:43 -0700 Subject: [PATCH 379/423] src/sage/rings/real_double.pyx: Doctest cosmetics --- src/sage/rings/real_double.pyx | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index f3183dcb050..bfa020f14b8 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -189,7 +189,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): EXAMPLES:: - sage: latex(RDF) # indirect doctest + sage: latex(RDF) # indirect doctest \Bold{R} """ return "\\Bold{R}" @@ -215,7 +215,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): EXAMPLES:: - sage: RealDoubleField() # indirect doctest + sage: RealDoubleField() # indirect doctest Real Double Field sage: RDF Real Double Field @@ -315,7 +315,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): EXAMPLES:: - sage: RDF.coerce(5) # indirect doctest + sage: RDF.coerce(5) # indirect doctest 5.0 sage: RDF.coerce(9499294r) 9499294.0 @@ -389,7 +389,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): Magma handles precision in decimal digits, so we lose a bit:: - sage: magma(RDF) # optional - magma # indirect doctest + sage: magma(RDF) # indirect doctest # optional - magma Real field of precision 15 sage: 10^15 < 2^53 < 10^16 True @@ -397,7 +397,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): When we convert back from Magma, we convert to a generic real field that has 53 bits of precision:: - sage: magma(RDF).sage() # optional - magma + sage: magma(RDF).sage() # optional - magma Real Field with 53 bits of precision """ return "RealField(%s : Bits := true)" % self.prec() @@ -408,7 +408,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): EXAMPLES:: - sage: fricas(RDF) # indirect doctest, optional - fricas + sage: fricas(RDF) # indirect doctest # optional - fricas DoubleFloat """ return "DoubleFloat" @@ -419,7 +419,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): EXAMPLES:: - sage: polymake(RDF) #optional - jupymake # indirect doctest + sage: polymake(RDF) # indirect doctest # optional - jupymake Float """ return '"Float"' @@ -713,7 +713,7 @@ cdef class RealDoubleElement(FieldElement): EXAMPLES:: - sage: RDF(2.3) # indirect doctest + sage: RDF(2.3) # indirect doctest 2.3 """ (self)._parent = _RDF @@ -747,7 +747,7 @@ cdef class RealDoubleElement(FieldElement): sage: RDF(10.5) 10.5 - sage: magma(RDF(10.5)) # optional - magma # indirect doctest + sage: magma(RDF(10.5)) # indirect doctest # optional - magma 10.5000000000000 """ return "%s!%s" % (self.parent()._magma_init_(magma), self) @@ -933,7 +933,7 @@ cdef class RealDoubleElement(FieldElement): EXAMPLES:: - sage: ZZ(RDF(237.0)) # indirect doctest + sage: ZZ(RDF(237.0)) # indirect doctest 237 sage: ZZ(RDF(0.0/0.0)) Traceback (most recent call last): @@ -1136,9 +1136,9 @@ cdef class RealDoubleElement(FieldElement): EXAMPLES:: - sage: latex(RDF(3.4)) # indirect doctest + sage: latex(RDF(3.4)) # indirect doctest 3.4 - sage: latex(RDF(2e-100)) # indirect doctest + sage: latex(RDF(2e-100)) # indirect doctest 2 \times 10^{-100} """ s = self.str() @@ -1339,7 +1339,7 @@ cdef class RealDoubleElement(FieldElement): EXAMPLES:: - sage: RDF('-1.5') + RDF('2.5') # indirect doctest + sage: RDF('-1.5') + RDF('2.5') # indirect doctest 1.0 """ cdef RealDoubleElement x = PY_NEW(RealDoubleElement) @@ -1352,7 +1352,7 @@ cdef class RealDoubleElement(FieldElement): EXAMPLES:: - sage: RDF('-1.5') - RDF('2.5') # indirect doctest + sage: RDF('-1.5') - RDF('2.5') # indirect doctest -4.0 """ cdef RealDoubleElement x = PY_NEW(RealDoubleElement) @@ -1365,7 +1365,7 @@ cdef class RealDoubleElement(FieldElement): EXAMPLES:: - sage: RDF('-1.5') * RDF('2.5') # indirect doctest + sage: RDF('-1.5') * RDF('2.5') # indirect doctest -3.75 """ cdef RealDoubleElement x = PY_NEW(RealDoubleElement) @@ -1378,7 +1378,7 @@ cdef class RealDoubleElement(FieldElement): EXAMPLES:: - sage: RDF('-1.5') / RDF('2.5') # indirect doctest + sage: RDF('-1.5') / RDF('2.5') # indirect doctest -0.6 sage: RDF(1)/RDF(0) +infinity @@ -2029,7 +2029,7 @@ cdef class ToRDF(Morphism): EXAMPLES:: sage: f = RDF.coerce_map_from(float) - sage: f(3.5) # indirect doctest + sage: f(3.5) # indirect doctest 3.5 """ cdef RealDoubleElement r = PY_NEW(RealDoubleElement) From 89e4c05f09351e7b576241d97fb79ef18474aaa8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 31 Aug 2023 15:06:41 -0700 Subject: [PATCH 380/423] src/sage/rings/lazy_series_ring.py: More block tags --- src/sage/rings/lazy_series_ring.py | 63 ++++++++++++++---------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/src/sage/rings/lazy_series_ring.py b/src/sage/rings/lazy_series_ring.py index faff4a5a52a..9670b391073 100644 --- a/src/sage/rings/lazy_series_ring.py +++ b/src/sage/rings/lazy_series_ring.py @@ -2240,13 +2240,12 @@ class LazyCompletionGradedAlgebra(LazySeriesRing): EXAMPLES:: - sage: NCSF = NonCommutativeSymmetricFunctions(QQ) # needs sage.modules - sage: S = NCSF.Complete() # needs sage.modules - sage: L = S.formal_series_ring(); L # needs sage.modules + sage: # needs sage.modules + sage: NCSF = NonCommutativeSymmetricFunctions(QQ) + sage: S = NCSF.Complete() + sage: L = S.formal_series_ring(); L Lazy completion of Non-Commutative Symmetric Functions over the Rational Field in the Complete basis - - sage: # needs sage.modules sage: f = 1 / (1 - L(S[1])); f S[] + S[1] + (S[1,1]) + (S[1,1,1]) + (S[1,1,1,1]) + (S[1,1,1,1,1]) + (S[1,1,1,1,1,1]) + O^7 @@ -2275,23 +2274,23 @@ def __init__(self, basis, sparse=True, category=None): sage: LazySymmetricFunctions.options.halting_precision(6) - sage: s = SymmetricFunctions(QQ).s() # needs sage.modules - sage: L = LazySymmetricFunctions(s) # needs sage.modules - sage: TestSuite(L).run() # needs lrcalc_python sage.modules - - sage: p = SymmetricFunctions(GF(5)).p() # needs sage.modules - sage: L = LazySymmetricFunctions(p) # needs sage.modules - sage: TestSuite(L).run() # needs sage.modules + sage: # needs sage.modules + sage: s = SymmetricFunctions(QQ).s() + sage: L = LazySymmetricFunctions(s) + sage: TestSuite(L).run() # needs lrcalc_python + sage: p = SymmetricFunctions(GF(5)).p() + sage: L = LazySymmetricFunctions(p) + sage: TestSuite(L).run() Reversion will only work when the base ring is a field:: - sage: s = SymmetricFunctions(ZZ).s() # needs sage.modules - sage: L = LazySymmetricFunctions(s) # needs sage.modules - sage: TestSuite(L).run(skip=['_test_revert']) # needs lrcalc_python sage.modules - - sage: s = SymmetricFunctions(QQ["q"]).s() # needs sage.modules - sage: L = LazySymmetricFunctions(s) # needs sage.modules - sage: TestSuite(L).run(skip=['_test_revert']) # needs lrcalc_python sage.modules + sage: # needs sage.modules + sage: s = SymmetricFunctions(ZZ).s() + sage: L = LazySymmetricFunctions(s) + sage: TestSuite(L).run(skip=['_test_revert']) # needs lrcalc_python + sage: s = SymmetricFunctions(QQ["q"]).s() + sage: L = LazySymmetricFunctions(s) + sage: TestSuite(L).run(skip=['_test_revert']) # needs lrcalc_python Options are remembered across doctests:: @@ -2399,7 +2398,7 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No EXAMPLES:: - sage: # needs sage.modules sage.rings.finite_rings + sage: # needs sage.modules sage: m = SymmetricFunctions(GF(2)).m() sage: L = LazySymmetricFunctions(m) sage: L(2) @@ -2407,14 +2406,14 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No sage: L(3) m[] - sage: m = SymmetricFunctions(ZZ).m() # needs sage.modules - sage: L = LazySymmetricFunctions(m) # needs sage.modules - sage: f = L(lambda i: m([i]), valuation=5, degree=10); f # needs sage.modules + sage: # needs sage.modules + sage: m = SymmetricFunctions(ZZ).m() + sage: L = LazySymmetricFunctions(m) + sage: f = L(lambda i: m([i]), valuation=5, degree=10); f m[5] + m[6] + m[7] + m[8] + m[9] - - sage: f.coefficient(6) # needs sage.modules + sage: f.coefficient(6) m[6] - sage: f[20] # needs sage.modules + sage: f[20] 0 Alternatively, ``x`` can be a list of elements of the base ring. @@ -2442,22 +2441,20 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No sage: L(lambda n: 0) O^7 - sage: L(lambda n: tensor([h[n], e([])]) + tensor([h([]), e[n]]), degree=3) # needs sage.modules + sage: # needs sage.modules + sage: L(lambda n: tensor([h[n], e([])]) + tensor([h([]), e[n]]), degree=3) (2*h[]#e[]) + (h[]#e[1]+h[1]#e[]) + (h[]#e[2]+h[2]#e[]) - - sage: L(lambda n: n)[3]; # needs sage.modules + sage: L(lambda n: n)[3]; Traceback (most recent call last): ... ValueError: coefficient 3*h[] # e[] should be an element of homogeneous degree 3 but has degree 0 - - sage: L([1, 2, 3]); # needs sage.modules + sage: L([1, 2, 3]); Traceback (most recent call last): ... ValueError: coefficient 2*h[] # e[] should be an element of homogeneous degree 1 but has degree 0 - - sage: L(lambda n: n, degree=3); # needs sage.modules + sage: L(lambda n: n, degree=3); Traceback (most recent call last): ... ValueError: coefficient h[] # e[] should be an element From a6081be6cf8725de9d2af9e876a255499d7b821b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 31 Aug 2023 15:30:47 -0700 Subject: [PATCH 381/423] build/pkgs/{markupsafe,sphinxcontrib_serializinghtml}: Increase lower bounds --- build/pkgs/markupsafe/install-requires.txt | 2 +- build/pkgs/sphinxcontrib_serializinghtml/install-requires.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/pkgs/markupsafe/install-requires.txt b/build/pkgs/markupsafe/install-requires.txt index 331f488e6a0..7d44bce10e1 100644 --- a/build/pkgs/markupsafe/install-requires.txt +++ b/build/pkgs/markupsafe/install-requires.txt @@ -1 +1 @@ -markupsafe >=1.1.0 +markupsafe >=2.0 diff --git a/build/pkgs/sphinxcontrib_serializinghtml/install-requires.txt b/build/pkgs/sphinxcontrib_serializinghtml/install-requires.txt index 98fc0654928..584fc77c6b2 100644 --- a/build/pkgs/sphinxcontrib_serializinghtml/install-requires.txt +++ b/build/pkgs/sphinxcontrib_serializinghtml/install-requires.txt @@ -1 +1 @@ -sphinxcontrib_serializinghtml >=1.1.4 +sphinxcontrib_serializinghtml >=1.1.5 From 5b11b9b65393281891b431b116fad6f17cd00f0a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 31 Aug 2023 20:23:06 -0700 Subject: [PATCH 382/423] build/pkgs/sagelib/dependencies: Add pythran as an order-only dep --- build/pkgs/sagelib/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/sagelib/dependencies b/build/pkgs/sagelib/dependencies index 9b8c062d3c3..04da0bd14ea 100644 --- a/build/pkgs/sagelib/dependencies +++ b/build/pkgs/sagelib/dependencies @@ -1,4 +1,4 @@ -FORCE $(SCRIPTS) arb boost_cropped $(BLAS) brial cliquer cypari cysignals cython ecl eclib ecm flint libgd gap giac givaro glpk gmpy2 gsl iml importlib_metadata importlib_resources jinja2 jupyter_core lcalc lrcalc_python libbraiding libhomfly libpng linbox m4ri m4rie memory_allocator mpc mpfi mpfr $(MP_LIBRARY) ntl numpy pari pip pkgconfig planarity ppl pplpy primesieve primecount primecountpy pycygwin $(PYTHON) requests rw sage_conf singular symmetrica typing_extensions $(PCFILES) | $(PYTHON_TOOLCHAIN) sage_setup +FORCE $(SCRIPTS) arb boost_cropped $(BLAS) brial cliquer cypari cysignals cython ecl eclib ecm flint libgd gap giac givaro glpk gmpy2 gsl iml importlib_metadata importlib_resources jinja2 jupyter_core lcalc lrcalc_python libbraiding libhomfly libpng linbox m4ri m4rie memory_allocator mpc mpfi mpfr $(MP_LIBRARY) ntl numpy pari pip pkgconfig planarity ppl pplpy primesieve primecount primecountpy pycygwin $(PYTHON) requests rw sage_conf singular symmetrica typing_extensions $(PCFILES) | $(PYTHON_TOOLCHAIN) sage_setup pythran ---------- All lines of this file are ignored except the first. From ecbe4d0142b2fa7961151c1e82d63786c41439f6 Mon Sep 17 00:00:00 2001 From: Travis Scrimshaw Date: Fri, 1 Sep 2023 14:42:23 +0900 Subject: [PATCH 383/423] Fix the ascii art for the Heisenberg Lie algebras. --- src/sage/algebras/lie_algebras/heisenberg.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/sage/algebras/lie_algebras/heisenberg.py b/src/sage/algebras/lie_algebras/heisenberg.py index 629fb0a8306..519b39546b6 100644 --- a/src/sage/algebras/lie_algebras/heisenberg.py +++ b/src/sage/algebras/lie_algebras/heisenberg.py @@ -122,6 +122,21 @@ def _repr_term(self, m): """ return m + def _ascii_art_term(self, m): + r""" + Return a string representation of the term indexed by ``m``. + + EXAMPLES:: + + sage: H = lie_algebras.Heisenberg(QQ, 3) + sage: H._ascii_art_term('p1') + p1 + sage: H._ascii_art_term('z') + z + """ + from sage.typeset.ascii_art import ascii_art + return ascii_art(m) + def _latex_term(self, m): r""" Return a string representation of the term indexed by ``m``. From 098ce29ff0749d7d88cb3c850a439328c4ea4641 Mon Sep 17 00:00:00 2001 From: Travis Scrimshaw Date: Fri, 1 Sep 2023 14:57:08 +0900 Subject: [PATCH 384/423] Adding a doctest calling ascii_art on a Heisenberg Lie algebra element. --- src/sage/algebras/lie_algebras/heisenberg.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sage/algebras/lie_algebras/heisenberg.py b/src/sage/algebras/lie_algebras/heisenberg.py index 519b39546b6..ccb43936416 100644 --- a/src/sage/algebras/lie_algebras/heisenberg.py +++ b/src/sage/algebras/lie_algebras/heisenberg.py @@ -133,6 +133,8 @@ def _ascii_art_term(self, m): p1 sage: H._ascii_art_term('z') z + sage: ascii_art(sum(i * b for i, b in enumerate(H.basis()))) + p2 + 2*p3 + 3*q1 + 4*q2 + 5*q3 + 6*z """ from sage.typeset.ascii_art import ascii_art return ascii_art(m) From 0869d698b6213476792704a70b26aad8a656210f Mon Sep 17 00:00:00 2001 From: Gareth Ma Date: Fri, 1 Sep 2023 12:26:55 +0300 Subject: [PATCH 385/423] Fix quadratic memory of berlekamp_massey --- src/sage/matrix/berlekamp_massey.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/sage/matrix/berlekamp_massey.py b/src/sage/matrix/berlekamp_massey.py index 716ed428745..24fec2742f1 100644 --- a/src/sage/matrix/berlekamp_massey.py +++ b/src/sage/matrix/berlekamp_massey.py @@ -87,12 +87,9 @@ def berlekamp_massey(a): R = K['x'] x = R.gen() - f = {-1: R(a), 0: x**(2 * M)} - s = {-1: 1, 0: 0} - j = 0 - while f[j].degree() >= M: - j += 1 - qj, f[j] = f[j - 2].quo_rem(f[j - 1]) - s[j] = s[j - 2] - qj * s[j - 1] - t = s[j].reverse() - return ~(t[t.degree()]) * t # make monic (~ is inverse in python) + f0, f1 = R(a), x**(2 * M) + s0, s1 = 1, 0 + while f1.degree() >= M: + f0, (qj, f1) = f1, f0.quo_rem(f1) + s0, s1 = s1, s0 - qj * s1 + return s1.reverse().monic() From f79c542419fdeb1ea4ea535501d844ed0e55b7d1 Mon Sep 17 00:00:00 2001 From: Gareth Ma Date: Fri, 1 Sep 2023 15:18:35 +0300 Subject: [PATCH 386/423] Add doctest for issue 36173 --- src/sage/matrix/berlekamp_massey.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sage/matrix/berlekamp_massey.py b/src/sage/matrix/berlekamp_massey.py index 24fec2742f1..1544705ba1f 100644 --- a/src/sage/matrix/berlekamp_massey.py +++ b/src/sage/matrix/berlekamp_massey.py @@ -72,6 +72,12 @@ def berlekamp_massey(a): Traceback (most recent call last): ... ValueError: argument must have an even number of terms + + Check that :issue:`36172` is fixed:: + + sage: p = next_prime(2**64) + sage: ls = [GF(p).random_element() for _ in range(2000)] + sage: _ = berlekamp_massey(ls) """ if not isinstance(a, (list, tuple)): raise TypeError("argument must be a list or tuple") @@ -84,9 +90,8 @@ def berlekamp_massey(a): K = a[0].parent().fraction_field() except AttributeError: K = sage.rings.rational_field.RationalField() - R = K['x'] - x = R.gen() + R, x = K['x'].objgen() f0, f1 = R(a), x**(2 * M) s0, s1 = 1, 0 while f1.degree() >= M: From c2ac36d27a7cf74e0770a9e78be0b89c46c99762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 1 Sep 2023 19:12:16 +0200 Subject: [PATCH 387/423] remove some python2 blocks --- src/sage/symbolic/ginac/numeric.cpp | 102 +--------------------------- 1 file changed, 1 insertion(+), 101 deletions(-) diff --git a/src/sage/symbolic/ginac/numeric.cpp b/src/sage/symbolic/ginac/numeric.cpp index 40f1e3a5115..c4152e092e3 100644 --- a/src/sage/symbolic/ginac/numeric.cpp +++ b/src/sage/symbolic/ginac/numeric.cpp @@ -176,12 +176,7 @@ inline void py_error(const char* errmsg) { "pyerror() called but no error occurred!"); } -#if PY_MAJOR_VERSION < 3 -#define PyNumber_TrueDivide PyNumber_Divide - -#else #define PyString_FromString PyUnicode_FromString -#endif // The following variable gets changed to true once // this library has been imported by the Python @@ -491,15 +486,9 @@ static PyObject* py_tuple_from_numvector(const std::vector& vec) // class numeric /////////////////////////////////////////////////////////////////////////////// -#if PY_MAJOR_VERSION < 3 PyObject* ZERO = PyLong_FromLong(0); // todo: never freed PyObject* ONE = PyLong_FromLong(1); // todo: never freed PyObject* TWO = PyLong_FromLong(2); // todo: never freed -#else -PyObject* ZERO = PyLong_FromLong(0); // todo: never freed -PyObject* ONE = PyLong_FromLong(1); // todo: never freed -PyObject* TWO = PyLong_FromLong(2); // todo: never freed -#endif std::ostream& operator<<(std::ostream& os, const numeric& s) { switch (s.t) { @@ -811,16 +800,6 @@ void set_from(Type& t, Value& v, long& hash, mpq_t bigrat) numeric::numeric(PyObject* o, bool force_py) : basic(&numeric::tinfo_static) { if (o == nullptr) py_error("Error"); if (not force_py) { -#if PY_MAJOR_VERSION < 3 - if (PyLong_Check(o)) { - t = LONG; - v._long = PyLong_AsLong(o); - hash = (v._long==-1) ? -2 : v._long; - setflag(status_flags::evaluated | status_flags::expanded); - Py_DECREF(o); - return; - } -#endif if (PyLong_Check(o)) { t = MPZ; mpz_init(v._bigint); @@ -1533,31 +1512,6 @@ const numeric numeric::div(const numeric &other) const { return bigrat; } case PYOBJECT: -#if PY_MAJOR_VERSION < 3 - if (PyObject_Compare(other.v._pyobject, ONE) == 0 - and py_funcs.py_is_integer(other.v._pyobject) != 0) { - return *this; - } - if (PyLong_Check(v._pyobject)) { - if (PyLong_Check(other.v._pyobject)) { - // This branch happens at startup. - PyObject *o = PyNumber_TrueDivide(Integer(PyLong_AsLong(v._pyobject)), - Integer(PyLong_AsLong(other.v._pyobject))); - // I don't 100% understand why I have to incref this, - // but if I don't, Sage crashes on exit. - Py_INCREF(o); - return o; - } - if (PyLong_Check(other.v._pyobject)) { - PyObject *d = py_funcs. - py_integer_from_python_obj(other.v._pyobject); - PyObject *ans = PyNumber_TrueDivide(v._pyobject, - d); - Py_DECREF(d); - return ans; - } - } -#endif if (PyLong_Check(v._pyobject)) { PyObject *n = py_funcs. py_integer_from_python_obj(v._pyobject); @@ -1866,17 +1820,6 @@ const ex numeric::power(const numeric &exponent) const { // any PyObjects castable to long are casted if (exponent.t == PYOBJECT) { -#if PY_MAJOR_VERSION < 3 - if (PyLong_Check(exponent.v._pyobject)) { - long si = PyLong_AsLong(exponent.v._pyobject); - if (si == -1 and PyErr_Occurred()) - PyErr_Clear(); - else { - expo.t = MPZ; - mpz_set_si(expo.v._bigint, si); - } - } else -#endif if (PyLong_Check(exponent.v._pyobject)) { expo.t = MPZ; _mpz_set_pylong(expo.v._bigint, @@ -2503,49 +2446,6 @@ numeric & operator/=(numeric & lh, const numeric & rh) return lh; case PYOBJECT: { PyObject *p = lh.v._pyobject; -#if PY_MAJOR_VERSION < 3 - { - if (PyLong_Check(p)) { - if (PyLong_Check(rh.v._pyobject)) { - // This branch happens at startup. - lh.v._pyobject = PyNumber_TrueDivide(Integer(PyLong_AsLong(p)), - Integer(PyLong_AsLong(rh.v._pyobject))); - // I don't 100% understand why I have to incref this, - // but if I don't, Sage crashes on exit. - if (lh.v._pyobject == nullptr) { - lh.v._pyobject = p; - py_error("numeric operator/="); - } - lh.hash = PyObject_Hash(lh.v._pyobject); - Py_DECREF(p); - return lh; - } - if (PyLong_Check(rh.v._pyobject)) { - PyObject *d = py_funcs.py_integer_from_python_obj(rh.v._pyobject); - lh.v._pyobject = PyNumber_TrueDivide(p, d); - if (lh.v._pyobject == nullptr) { - lh.v._pyobject = p; - py_error("numeric operator/="); - } - lh.hash = PyObject_Hash(lh.v._pyobject); - Py_DECREF(d); - Py_DECREF(p); - return lh; - } - } else if (PyLong_Check(p)) { - PyObject *n = py_funcs.py_integer_from_python_obj(p); - lh.v._pyobject = PyNumber_TrueDivide(n, rh.v._pyobject); - if (lh.v._pyobject == nullptr) { - lh.v._pyobject = p; - py_error("numeric operator/="); - } - lh.hash = PyObject_Hash(lh.v._pyobject); - Py_DECREF(n); - Py_DECREF(p); - return lh; - } - } -#else { if (PyLong_Check(p)) { PyObject *n = py_funcs.py_integer_from_python_obj(p); @@ -2560,7 +2460,7 @@ numeric & operator/=(numeric & lh, const numeric & rh) return lh; } } -#endif + lh.v._pyobject = PyNumber_TrueDivide(p, rh.v._pyobject); if (lh.v._pyobject == nullptr) { lh.v._pyobject = p; From 4454ce61554af30de35dafd47769c3785b9c565e Mon Sep 17 00:00:00 2001 From: Gareth Ma Date: Fri, 1 Sep 2023 23:04:22 +0300 Subject: [PATCH 388/423] Removed useless doctest for issue 36173 The test has been reflected in the PR on GitHub. --- src/sage/matrix/berlekamp_massey.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/sage/matrix/berlekamp_massey.py b/src/sage/matrix/berlekamp_massey.py index 1544705ba1f..3f2810dbfa0 100644 --- a/src/sage/matrix/berlekamp_massey.py +++ b/src/sage/matrix/berlekamp_massey.py @@ -72,12 +72,6 @@ def berlekamp_massey(a): Traceback (most recent call last): ... ValueError: argument must have an even number of terms - - Check that :issue:`36172` is fixed:: - - sage: p = next_prime(2**64) - sage: ls = [GF(p).random_element() for _ in range(2000)] - sage: _ = berlekamp_massey(ls) """ if not isinstance(a, (list, tuple)): raise TypeError("argument must be a list or tuple") From 0293a38a26fe0a87eeede5dc4f9bb8cf38487d81 Mon Sep 17 00:00:00 2001 From: Gareth Ma Date: Sat, 2 Sep 2023 00:47:36 +0300 Subject: [PATCH 389/423] Apply suggestions from code review --- src/sage/matrix/berlekamp_massey.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/matrix/berlekamp_massey.py b/src/sage/matrix/berlekamp_massey.py index 3f2810dbfa0..ccebc227119 100644 --- a/src/sage/matrix/berlekamp_massey.py +++ b/src/sage/matrix/berlekamp_massey.py @@ -89,6 +89,6 @@ def berlekamp_massey(a): f0, f1 = R(a), x**(2 * M) s0, s1 = 1, 0 while f1.degree() >= M: - f0, (qj, f1) = f1, f0.quo_rem(f1) - s0, s1 = s1, s0 - qj * s1 + f0, (q, f1) = f1, f0.quo_rem(f1) + s0, s1 = s1, s0 - q * s1 return s1.reverse().monic() From 84bf9a3c488ccaa12a468afad4dcdd088995b2ce Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 1 Sep 2023 18:36:58 -0400 Subject: [PATCH 390/423] build/pkgs/python3/spkg-configure.m4: use "cut" for minor component Use the "cut" utility to parse the python minor version component instead of sed -E. Despite what the GNU sed manpage says, the "-E" flag does not actually appear in any version of POSIX, while "cut" does. The cut version is also a bit more readable. --- build/pkgs/python3/spkg-configure.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/python3/spkg-configure.m4 b/build/pkgs/python3/spkg-configure.m4 index a6886c0e72c..d57aa416e3a 100644 --- a/build/pkgs/python3/spkg-configure.m4 +++ b/build/pkgs/python3/spkg-configure.m4 @@ -133,7 +133,7 @@ To build Sage with a different system python, use ./configure --with-python=/pat AS_IF([test -n "$PYTHON_FOR_VENV"], [PYTHON_VERSION=$("$PYTHON_FOR_VENV" -c "import sysconfig; print(sysconfig.get_python_version())")], [PYTHON_VERSION=$(echo $(cat build/pkgs/python3/package-version.txt))]) - AC_SUBST([PYTHON_MINOR], [$(echo $PYTHON_VERSION | sed -E 's/[[0-9]]*\.([[0-9]]*).*/\1/')]) + AC_SUBST([PYTHON_MINOR], [$(echo $PYTHON_VERSION | cut -d. -f2)]) export PYTHON_MINOR # for sage-get-system-packages AS_VAR_IF([SAGE_VENV], [auto], [SAGE_VENV=$SAGE_VENV_AUTO]) From 6b5278d6990171314ac3999571aa23db1aa0a429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 2 Sep 2023 09:46:44 +0200 Subject: [PATCH 391/423] fix and activate pycodestyle E305 in py files --- .vscode/settings.json | 2 +- src/sage/algebras/lie_algebras/examples.py | 1 + src/sage/combinat/designs/bibd.py | 2 ++ src/sage/combinat/designs/database.py | 5 +++++ src/sage/combinat/designs/difference_family.py | 1 + src/sage/combinat/designs/ext_rep.py | 1 + src/sage/geometry/hyperplane_arrangement/library.py | 1 + src/sage/groups/abelian_gps/abelian_group.py | 1 + src/sage/groups/matrix_gps/morphism.py | 1 + src/sage/groups/perm_gps/cubegroup.py | 2 ++ src/sage/groups/perm_gps/permgroup.py | 2 ++ src/sage/libs/pari/__init__.py | 1 + src/sage/matrix/matrix_polynomial_dense.pyx | 4 ++-- src/sage/modular/arithgroup/congroup_gamma0.py | 1 + src/sage/modular/modform/constructor.py | 1 + src/sage/modular/pollack_stevens/distributions.py | 1 + src/sage/modular/pollack_stevens/fund_domain.py | 1 + src/sage/modular/pollack_stevens/sigma0.py | 1 + src/sage/modular/pollack_stevens/space.py | 1 + src/sage/modules/fg_pid/fgp_morphism.py | 1 + src/sage/plot/plot3d/plot3d.py | 1 + src/sage/schemes/elliptic_curves/cm.py | 2 ++ src/sage/schemes/elliptic_curves/ell_curve_isogeny.py | 2 ++ src/sage/schemes/elliptic_curves/ell_finite_field.py | 1 + src/tox.ini | 5 +++-- 25 files changed, 37 insertions(+), 5 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 77dcb2ce188..b3079a7c4ee 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -27,7 +27,7 @@ "python.linting.enabled": true, // The following pycodestyle arguments are the same as the pycodestyle-minimal // tox environnment, see the file SAGE_ROOT/src/tox.ini - "python.linting.pycodestyleArgs": ["--select= E111,E21,E222,E227,E25,E271,E303,E306,E401,E502,E701,E702,E703,E71,E72,W291,W293,W391,W605"], + "python.linting.pycodestyleArgs": ["--select= E111,E21,E222,E227,E25,E271,E303,E305,E306,E401,E502,E701,E702,E703,E71,E72,W291,W293,W391,W605"], "cSpell.words": [ "furo", "Conda", diff --git a/src/sage/algebras/lie_algebras/examples.py b/src/sage/algebras/lie_algebras/examples.py index 89ad4362e5e..2c6c23297f9 100644 --- a/src/sage/algebras/lie_algebras/examples.py +++ b/src/sage/algebras/lie_algebras/examples.py @@ -309,6 +309,7 @@ def regular_vector_fields(R): from sage.algebras.lie_algebras.virasoro import LieAlgebraRegularVectorFields return LieAlgebraRegularVectorFields(R) + witt = regular_vector_fields def pwitt(R, p): diff --git a/src/sage/combinat/designs/bibd.py b/src/sage/combinat/designs/bibd.py index e484070c4e8..ed44883be25 100644 --- a/src/sage/combinat/designs/bibd.py +++ b/src/sage/combinat/designs/bibd.py @@ -1048,6 +1048,7 @@ def _PBD_4_5_8_9_12_closure(B): BB.append(X) return BB + table_7_1 = { 0:{'t':-4,'u':16,'s':2}, 1:{'t':-4,'u':17,'s':2}, @@ -1652,4 +1653,5 @@ def arc(self, s=2, solver=None, verbose=0, *, integrality_tolerance=1e-3): values = p.get_values(b, convert=bool, tolerance=integrality_tolerance) return [self._points[i] for (i,j) in values.items() if j] + BIBD = BalancedIncompleteBlockDesign diff --git a/src/sage/combinat/designs/database.py b/src/sage/combinat/designs/database.py index ebefb6bc669..5302771756c 100644 --- a/src/sage/combinat/designs/database.py +++ b/src/sage/combinat/designs/database.py @@ -296,6 +296,7 @@ def MOLS_18_3(): # # This dictionary is used by designs.mutually_orthogonal_latin_squares(k,n). + MOLS_constructions = { 10 : (2, MOLS_10_2), 12 : (5, MOLS_12_5), @@ -2021,6 +2022,7 @@ def OA_10_1620(): # # This dictionary is used by designs.orthogonal_array(k,n). + OA_constructions = { 18 : (7 , OA_7_18), 40 : (9 , OA_9_40), @@ -2455,6 +2457,7 @@ def QDM_57_9_1_1_8(): # } # } + QDM: dict[tuple[int, int], dict] = {} for ((n,k,lmbda,mu,u),f) in [((19,6,1,1,1), QDM_19_6_1_1_1), ((21,5,1,1,1), QDM_21_5_1_1_1), @@ -4018,6 +4021,7 @@ def DM_993_32_1(): G = AdditiveCyclic(993) return G, M + DM = { (12 ,1) : (6 ,DM_12_6_1), (21 ,1) : (6 ,DM_21_6_1), @@ -4686,6 +4690,7 @@ def BIBD_56_11_2(): D = IncidenceStructure(libgap.Orbit(G, B, libgap.OnSets)) return D._blocks + # Index of the BIBD constructions # # Associates to triple (v,k,lambda) a function that return a diff --git a/src/sage/combinat/designs/difference_family.py b/src/sage/combinat/designs/difference_family.py index 382240627ab..6745985adec 100644 --- a/src/sage/combinat/designs/difference_family.py +++ b/src/sage/combinat/designs/difference_family.py @@ -3606,6 +3606,7 @@ def difference_family(v, k, l=1, existence=False, explain_construction=False, ch return G, D + from sage.misc.rest_index_of_methods import gen_rest_table_index import sys __doc__ = __doc__.format(INDEX_OF_FUNCTIONS=gen_rest_table_index(sys.modules[__name__])) diff --git a/src/sage/combinat/designs/ext_rep.py b/src/sage/combinat/designs/ext_rep.py index cc2f13687a0..0f5bdf339fa 100644 --- a/src/sage/combinat/designs/ext_rep.py +++ b/src/sage/combinat/designs/ext_rep.py @@ -565,6 +565,7 @@ def open_extrep_url(url): else: return f.read() + pattern_integer = re.compile(r'\d+$') pattern_decimal = re.compile(r'-?\d+\.\d+$') pattern_rational = re.compile(r'-?\d+/\d+$') diff --git a/src/sage/geometry/hyperplane_arrangement/library.py b/src/sage/geometry/hyperplane_arrangement/library.py index 83c4f80c325..63a94ce3fb3 100644 --- a/src/sage/geometry/hyperplane_arrangement/library.py +++ b/src/sage/geometry/hyperplane_arrangement/library.py @@ -722,4 +722,5 @@ def Shi(self, data, K=QQ, names=None, m=1): A.characteristic_polynomial.set_cache(charpoly) return A + hyperplane_arrangements = HyperplaneArrangementLibrary() diff --git a/src/sage/groups/abelian_gps/abelian_group.py b/src/sage/groups/abelian_gps/abelian_group.py index efa54bac7d1..f2d088adbf4 100644 --- a/src/sage/groups/abelian_gps/abelian_group.py +++ b/src/sage/groups/abelian_gps/abelian_group.py @@ -1880,5 +1880,6 @@ def gen(self, n): """ return self._gens[n] + # We allow subclasses to override this, analogous to Element AbelianGroup_class.Subgroup = AbelianGroup_subgroup diff --git a/src/sage/groups/matrix_gps/morphism.py b/src/sage/groups/matrix_gps/morphism.py index 9805161d016..e2fc2e0fd59 100644 --- a/src/sage/groups/matrix_gps/morphism.py +++ b/src/sage/groups/matrix_gps/morphism.py @@ -42,6 +42,7 @@ def to_libgap(x): from sage.libs.gap.libgap import libgap return libgap(x) + lazy_import('sage.groups.libgap_morphism', 'GroupMorphism_libgap', 'MatrixGroupMorphism_im_gens', deprecation=25444) diff --git a/src/sage/groups/perm_gps/cubegroup.py b/src/sage/groups/perm_gps/cubegroup.py index e23d072de58..c27ed7521dd 100644 --- a/src/sage/groups/perm_gps/cubegroup.py +++ b/src/sage/groups/perm_gps/cubegroup.py @@ -295,6 +295,7 @@ def create_poly(face, color): #################################################### + singmaster_indices = { 1: "ulb", 2: "ub", @@ -1180,6 +1181,7 @@ def cubie_faces(): return cubies + cubie_face_list = cubie_faces() diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py index 6e59f4f4b84..7dee76ad643 100644 --- a/src/sage/groups/perm_gps/permgroup.py +++ b/src/sage/groups/perm_gps/permgroup.py @@ -5087,6 +5087,7 @@ def is_normal(self, other=None): other = self.ambient_group() return PermutationGroup_generic.is_normal(self, other) + # Allow for subclasses to use a different subgroup class PermutationGroup_generic.Subgroup = PermutationGroup_subgroup @@ -5194,5 +5195,6 @@ def orbits(self): """ return self._orbits + from sage.misc.rest_index_of_methods import gen_rest_table_index __doc__ = __doc__.format(METHODS_OF_PermutationGroup_generic=gen_rest_table_index(PermutationGroup_generic)) diff --git a/src/sage/libs/pari/__init__.py b/src/sage/libs/pari/__init__.py index ba4c5ad0efd..95b93560892 100644 --- a/src/sage/libs/pari/__init__.py +++ b/src/sage/libs/pari/__init__.py @@ -202,4 +202,5 @@ def _get_pari_instance(): return P + pari = _get_pari_instance() diff --git a/src/sage/matrix/matrix_polynomial_dense.pyx b/src/sage/matrix/matrix_polynomial_dense.pyx index e8b4d4d9176..10d9a9248b6 100644 --- a/src/sage/matrix/matrix_polynomial_dense.pyx +++ b/src/sage/matrix/matrix_polynomial_dense.pyx @@ -1670,8 +1670,8 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): # the row-wise case (resp. column-wise case), it will be convenient to # have leading position ncols (resp. nrows) for these zero vectors pos_zero_vec = self.ncols() if row_wise else self.nrows() - leading_positions = [pos if pos>=0 else pos_zero_vec + 1 \ - for pos in leading_positions] + leading_positions = [pos if pos >= 0 else pos_zero_vec + 1 + for pos in leading_positions] # leading positions should not have duplicates, which is equivalent to: # once sorted, it doesn't contain a pair of equal successive entries if not ordered: diff --git a/src/sage/modular/arithgroup/congroup_gamma0.py b/src/sage/modular/arithgroup/congroup_gamma0.py index 5bc0a6e4b3a..e960ce477d3 100644 --- a/src/sage/modular/arithgroup/congroup_gamma0.py +++ b/src/sage/modular/arithgroup/congroup_gamma0.py @@ -39,6 +39,7 @@ def is_Gamma0(x): """ return isinstance(x, Gamma0_class) + _gamma0_cache = {} def Gamma0_constructor(N): """ diff --git a/src/sage/modular/modform/constructor.py b/src/sage/modular/modform/constructor.py index c30a28354ca..023f9a380d2 100644 --- a/src/sage/modular/modform/constructor.py +++ b/src/sage/modular/modform/constructor.py @@ -134,6 +134,7 @@ def canonical_parameters(group, level, weight, base_ring): # forms spaces. return level, group, weight, base_ring + _cache = {} def ModularForms_clear_cache(): diff --git a/src/sage/modular/pollack_stevens/distributions.py b/src/sage/modular/pollack_stevens/distributions.py index 55a5ec72663..274cdfa87a4 100644 --- a/src/sage/modular/pollack_stevens/distributions.py +++ b/src/sage/modular/pollack_stevens/distributions.py @@ -224,6 +224,7 @@ def create_object(self, version, key): """ return Symk_class(*key) + OverconvergentDistributions = OverconvergentDistributions_factory('OverconvergentDistributions') Symk = Symk_factory('Symk') diff --git a/src/sage/modular/pollack_stevens/fund_domain.py b/src/sage/modular/pollack_stevens/fund_domain.py index 3e25c950b30..4bd2638d5a6 100644 --- a/src/sage/modular/pollack_stevens/fund_domain.py +++ b/src/sage/modular/pollack_stevens/fund_domain.py @@ -56,6 +56,7 @@ def M2Z(x): x.set_immutable() return x + Id = M2Z([1, 0, 0, 1]) sig = M2Z([0, 1, -1, 0]) tau = M2Z([0, -1, 1, -1]) diff --git a/src/sage/modular/pollack_stevens/sigma0.py b/src/sage/modular/pollack_stevens/sigma0.py index ab8e24959cd..bd203ec8600 100644 --- a/src/sage/modular/pollack_stevens/sigma0.py +++ b/src/sage/modular/pollack_stevens/sigma0.py @@ -162,6 +162,7 @@ def create_object(self, version, key): """ return Sigma0_class(*key) + Sigma0 = Sigma0_factory('sage.modular.pollack_stevens.sigma0.Sigma0') diff --git a/src/sage/modular/pollack_stevens/space.py b/src/sage/modular/pollack_stevens/space.py index 43e396b03c8..88b7be6d2cd 100644 --- a/src/sage/modular/pollack_stevens/space.py +++ b/src/sage/modular/pollack_stevens/space.py @@ -189,6 +189,7 @@ def create_object(self, version, key): """ return PollackStevensModularSymbolspace(*key) + PollackStevensModularSymbols = PollackStevensModularSymbols_factory('PollackStevensModularSymbols') diff --git a/src/sage/modules/fg_pid/fgp_morphism.py b/src/sage/modules/fg_pid/fgp_morphism.py index 71b43dcdc1a..809bb439f0c 100644 --- a/src/sage/modules/fg_pid/fgp_morphism.py +++ b/src/sage/modules/fg_pid/fgp_morphism.py @@ -453,6 +453,7 @@ def lift(self, x): assert self(y) == x, "bug in phi.lift()" return y + from sage.categories.homset import Homset import sage.misc.weak_dict diff --git a/src/sage/plot/plot3d/plot3d.py b/src/sage/plot/plot3d/plot3d.py index 41a1ad5de53..2d2bfb9e34d 100644 --- a/src/sage/plot/plot3d/plot3d.py +++ b/src/sage/plot/plot3d/plot3d.py @@ -953,6 +953,7 @@ def smooth_triangle(self, a, b, c, da, db, dc, color=None): """ return [a,b,c] + from . import parametric_plot3d def plot3d(f, urange, vrange, adaptive=False, transformation=None, **kwds): """ diff --git a/src/sage/schemes/elliptic_curves/cm.py b/src/sage/schemes/elliptic_curves/cm.py index f70f20a69d7..b8658c5a846 100644 --- a/src/sage/schemes/elliptic_curves/cm.py +++ b/src/sage/schemes/elliptic_curves/cm.py @@ -525,6 +525,7 @@ def cm_orders(h, proof=None): # quadratic field with class number h, and n is the number of such # fields. These are all *unconditional* (not dependent on GRH). + watkins_table = {1: (163, 9), 2: (427, 18), 3: (907, 16), 4: (1555, 54), 5: (2683, 25), 6: (3763, 51), 7: (5923, 31), 8: (6307, 131), 9: (10627, 34), 10: (13843, 87), 11: (15667, 41), 12: (17803, 206), 13: (20563, 37), 14: @@ -707,6 +708,7 @@ class number `h` is also the largest discriminant, but this is not # initialise it with h=1 only; other values will be added by calls to # discriminants_with_bounded_class_number(). + hDf_dict = {ZZ(1): [(ZZ(D), ZZ(h)) for D,h in [(-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)]]} diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index e5e35f2a139..356951d07d7 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -171,6 +171,7 @@ def _isogeny_determine_algorithm(E, kernel): raise ValueError("invalid parameters to EllipticCurveIsogeny constructor") + from sage.misc.superseded import deprecated_function_alias isogeny_determine_algorithm = deprecated_function_alias(33619, _isogeny_determine_algorithm) @@ -3432,6 +3433,7 @@ def compute_isogeny_stark(E1, E2, ell): qn /= qn.leading_coefficient() return qn + from sage.misc.superseded import deprecated_function_alias compute_isogeny_starks = deprecated_function_alias(34871, compute_isogeny_stark) diff --git a/src/sage/schemes/elliptic_curves/ell_finite_field.py b/src/sage/schemes/elliptic_curves/ell_finite_field.py index a46d722fb51..6f714c012b1 100644 --- a/src/sage/schemes/elliptic_curves/ell_finite_field.py +++ b/src/sage/schemes/elliptic_curves/ell_finite_field.py @@ -2071,6 +2071,7 @@ def curves_with_j_0_char3(K): # dict to hold precomputed coefficient vectors of supersingular j values (excluding 0, 1728): + supersingular_j_polynomials = {} def fill_ss_j_dict(): diff --git a/src/tox.ini b/src/tox.ini index 8d2ef29439d..5021d0aa691 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -109,6 +109,7 @@ description = # E111: indentation is not a multiple of four # E211: whitespace before '(' # E271: multiple spaces after keyword + # E305: expected 2 blank lines after class or function definition, found 1 # E306: expected 1 blank line before a nested definition, found 0 # E401: multiple imports on one line # E502 the backslash is redundant between brackets @@ -126,8 +127,8 @@ description = # W605: invalid escape sequence ‘x’ # See https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes deps = pycodestyle -commands = pycodestyle --select E111,E21,E222,E227,E25,E271,E303,E306,E401,E502,E701,E702,E703,E71,E72,W291,W293,W391,W605 {posargs:{toxinidir}/sage/} - pycodestyle --select E111,E271,E301,E306,E401,E703,E712,E713,E714,E72,W29,W391,W605, --filename *.pyx {posargs:{toxinidir}/sage/} +commands = pycodestyle --select E111,E21,E222,E227,E25,E271,E303,E305,E306,E401,E502,E701,E702,E703,E71,E72,W291,W293,W391,W605 {posargs:{toxinidir}/sage/} + pycodestyle --select E111,E271,E301,E306,E401,E502,E703,E712,E713,E714,E72,W29,W391,W605, --filename *.pyx {posargs:{toxinidir}/sage/} [pycodestyle] max-line-length = 160 From 626b764283b5005ab3a64661f7cc74efcd31adb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 2 Sep 2023 09:55:03 +0200 Subject: [PATCH 392/423] fixes E305 in src/ --- src/sage_docbuild/__main__.py | 1 + src/sage_docbuild/conf.py | 3 +++ src/sage_docbuild/ext/sage_autodoc.py | 1 + src/sage_setup/autogen/interpreters/storage.py | 5 +++++ 4 files changed, 10 insertions(+) diff --git a/src/sage_docbuild/__main__.py b/src/sage_docbuild/__main__.py index d7984c7fc0f..77919ec4000 100644 --- a/src/sage_docbuild/__main__.py +++ b/src/sage_docbuild/__main__.py @@ -498,5 +498,6 @@ def excepthook(*exc_info): builder = getattr(get_builder(name), typ) builder() + if __name__ == '__main__': sys.exit(main()) diff --git a/src/sage_docbuild/conf.py b/src/sage_docbuild/conf.py index d488a6a13a4..0df2760c035 100644 --- a/src/sage_docbuild/conf.py +++ b/src/sage_docbuild/conf.py @@ -691,6 +691,7 @@ def add_page_context(app, pagename, templatename, context, doctree): context['reference_root'] = os.path.join(relpath, 'index.html') context['refsub'] = True + dangling_debug = False def debug_inf(app, message): @@ -816,6 +817,7 @@ def find_sage_dangling_links(app, env, node, contnode): newnode.append(contnode) return newnode + # lists of basic Python class which are documented as functions base_class_as_func = [ 'bool', 'complex', 'dict', 'file', 'float', @@ -842,6 +844,7 @@ def nitpick_patch_config(app): app.config.values['nitpicky'] = (False, 'sage') app.config.values['nitpick_ignore'] = ([], 'sage') + skip_picklability_check_modules = [ #'sage.misc.test_nested_class', # for test only 'sage.misc.latex', diff --git a/src/sage_docbuild/ext/sage_autodoc.py b/src/sage_docbuild/ext/sage_autodoc.py index e89b8fc9ba4..5b7db9efbbc 100644 --- a/src/sage_docbuild/ext/sage_autodoc.py +++ b/src/sage_docbuild/ext/sage_autodoc.py @@ -73,6 +73,7 @@ def getdoc(obj, *args, **kwargs): return sage_getdoc_original(obj) # ------------------------------------------------------------------ + if TYPE_CHECKING: from sphinx.ext.autodoc.directive import DocumenterBridge diff --git a/src/sage_setup/autogen/interpreters/storage.py b/src/sage_setup/autogen/interpreters/storage.py index d9e0e60273f..291398fd9d9 100644 --- a/src/sage_setup/autogen/interpreters/storage.py +++ b/src/sage_setup/autogen/interpreters/storage.py @@ -440,6 +440,7 @@ class StorageTypeSimple(StorageTypeAssignable): """ pass + ty_int = StorageTypeSimple('int') ty_double = StorageTypeSimple('double') @@ -461,6 +462,7 @@ def assign_c_from_py(self, c, py): """ return je("{{ c }} = CDE_to_dz({{ py }})", c=c, py=py) + ty_double_complex = StorageTypeDoubleComplex('double_complex') @@ -650,6 +652,7 @@ def cython_clear(self, loc): """ return je("Py_CLEAR({{ loc }})", loc=loc) + ty_python = StorageTypePython() @@ -846,6 +849,7 @@ def assign_c_from_py(self, c, py): mpfr_set({{ c }}, rn.value, MPFR_RNDN)"""), myself=self, c=c, py=py) + ty_mpfr = StorageTypeMPFR() class StorageTypeMPC(StorageTypeAutoReference): @@ -948,4 +952,5 @@ def assign_c_from_py(self, c, py): cn{{ myself.id }} = self.domain({{ py }}) mpc_set_fr_fr({{ c }}, cn.__re, cn.__im, MPC_RNDNN)""", myself=self, c=c, py=py) + ty_mpc = StorageTypeMPC() From 1f5758365664538a1d8ffc4516887061121b817d Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 2 Sep 2023 18:14:49 +0200 Subject: [PATCH 393/423] fix issue #36178 --- src/sage/misc/rest_index_of_methods.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/sage/misc/rest_index_of_methods.py b/src/sage/misc/rest_index_of_methods.py index 82b988deda2..17bad8336d8 100644 --- a/src/sage/misc/rest_index_of_methods.py +++ b/src/sage/misc/rest_index_of_methods.py @@ -14,7 +14,7 @@ from sage.misc.sageinspect import is_function_or_cython_function as _isfunction -def gen_rest_table_index(obj, names=None, sort=True, only_local_functions=True): +def gen_rest_table_index(obj, names=None, sort=True, only_local_functions=True, root=None): r""" Return a ReST table describing a list of functions. @@ -43,6 +43,10 @@ def gen_rest_table_index(obj, names=None, sort=True, only_local_functions=True): will be filtered out. This can be useful to disable for making indexes of e.g. catalog modules such as :mod:`sage.coding.codes_catalog`. + - ``root`` -- (default: ``None``); the module, or class, whose elements are + to be listed. This is needed to recover the class when this method is + called from :meth:`gen_thematic_rest_table_index`. + .. WARNING:: The ReST tables returned by this function use '@' as a delimiter for @@ -169,14 +173,24 @@ def gen_rest_table_index(obj, names=None, sort=True, only_local_functions=True): if sort: list_of_entries.sort(key=fname) + obj_or_root_is_class = False + if inspect.isclass(root): + obj_or_root_is_class = True + class_name = root.__name__ + module_name = root.__module__ + elif inspect.isclass(obj): + obj_or_root_is_class = True + class_name = obj.__name__ + module_name = obj.__module__ + for e in list_of_entries: if inspect.ismethod(e): link = ":meth:`~{module}.{cls}.{func}`".format( module=e.im_class.__module__, cls=e.im_class.__name__, func=fname(e)) - elif _isfunction(e) and inspect.isclass(obj): + elif _isfunction(e) and obj_or_root_is_class: link = ":meth:`~{module}.{cls}.{func}`".format( - module=obj.__module__, cls=obj.__name__, func=fname(e)) + module=module_name, cls=class_name, func=fname(e)) elif _isfunction(e): link = ":func:`~{module}.{func}`".format( module=e.__module__, func=fname(e)) @@ -317,7 +331,7 @@ def gen_thematic_rest_table_index(root,additional_categories=None,only_local_fun except AttributeError: doc_ind = "Unsorted" theme_to_function[doc_ind].append(f) - s = ["**"+theme+"**\n\n"+gen_rest_table_index(list_of_functions,names=names) + s = ["**" + theme + "**\n\n" + gen_rest_table_index(list_of_functions, names=names, root=root) for theme, list_of_functions in sorted(theme_to_function.items())] return "\n\n".join(s) From 6c975ab3999ea26ea31a709d3f529d9f94f2be10 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 2 Sep 2023 18:20:35 +0200 Subject: [PATCH 394/423] fix some links in sage/graphs/isgci.py --- src/sage/graphs/isgci.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/sage/graphs/isgci.py b/src/sage/graphs/isgci.py index 147e2ba2778..2ec23b13afa 100644 --- a/src/sage/graphs/isgci.py +++ b/src/sage/graphs/isgci.py @@ -135,28 +135,28 @@ * - Apex - - :meth:`~Graph.is_apex()`, - :meth:`~Graph.apex_vertices()` + - :meth:`~sage.graphs.graph.Graph.is_apex()`, + :meth:`~sage.graphs.graph.Graph.apex_vertices()` * - AT_free - - :meth:`~Graph.is_asteroidal_triple_free` + - :meth:`~sage.graphs.graph.Graph.is_asteroidal_triple_free` * - Biconnected - - :meth:`~Graph.is_biconnected`, - :meth:`~GenericGraph.blocks_and_cut_vertices`, - :meth:`~GenericGraph.blocks_and_cuts_tree` + - :meth:`~sage.graphs.graph.Graph.is_biconnected`, + :meth:`~sage.graphs.generic_graph.GenericGraph.blocks_and_cut_vertices`, + :meth:`~sage.graphs.generic_graph.GenericGraph.blocks_and_cuts_tree` * - BinaryTrees - :meth:`~sage.graphs.graph_generators.GraphGenerators.BalancedTree`, - :meth:`~Graph.is_tree` + :meth:`~sage.graphs.graph.Graph.is_tree` * - Bipartite - :meth:`~sage.graphs.graph_generators.GraphGenerators.BalancedTree`, - :meth:`~sage.graphs.graph.Graph.is_bipartite` + :meth:`~sage.graphs.generic_graph.GenericGraph.is_bipartite` * - Block @@ -212,7 +212,7 @@ * - Polyhedral - - :meth:`~sage.graphs.generic_graph.Graph.is_polyhedral` + - :meth:`~sage.graphs.graph.Graph.is_polyhedral` * - Split From 42be2e6a812a310789962fc39564954a475f3be2 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 2 Sep 2023 18:40:10 +0200 Subject: [PATCH 395/423] add doctest in sage/misc/rest_index_of_methods.py --- src/sage/misc/rest_index_of_methods.py | 60 +++++++++++++++----------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/src/sage/misc/rest_index_of_methods.py b/src/sage/misc/rest_index_of_methods.py index 17bad8336d8..f425b9bdcf9 100644 --- a/src/sage/misc/rest_index_of_methods.py +++ b/src/sage/misc/rest_index_of_methods.py @@ -35,17 +35,19 @@ def gen_rest_table_index(obj, names=None, sort=True, only_local_functions=True, precedence over the automatically computed name for the functions. Only used when ``list_of_entries`` is a list. - - ``sort`` (boolean; ``True``) -- whether to sort the list of methods - lexicographically. + - ``sort`` -- boolean (default: ``True``); whether to sort the list of + methods lexicographically. - - ``only_local_functions`` (boolean; ``True``) -- if ``list_of_entries`` is - a module, ``only_local_functions = True`` means that imported functions - will be filtered out. This can be useful to disable for making indexes of - e.g. catalog modules such as :mod:`sage.coding.codes_catalog`. + - ``only_local_functions`` -- boolean (default: ``True``); if + ``list_of_entries`` is a module, ``only_local_functions = True`` means + that imported functions will be filtered out. This can be useful to + disable for making indexes of e.g. catalog modules such as + :mod:`sage.coding.codes_catalog`. - - ``root`` -- (default: ``None``); the module, or class, whose elements are - to be listed. This is needed to recover the class when this method is - called from :meth:`gen_thematic_rest_table_index`. + - ``root`` -- module or class (default: ``None``); the module, or class, + whose elements are to be listed. This is needed to recover the class when + this method is called from :meth:`gen_thematic_rest_table_index` (see + :trac:`36178`). .. WARNING:: @@ -75,7 +77,7 @@ def gen_rest_table_index(obj, names=None, sort=True, only_local_functions=True, :func:`~sage.misc.rest_index_of_methods.doc_index` @ Attribute an index name to a function. :func:`~sage.misc.rest_index_of_methods.gen_rest_table_index` @ Return a ReST table describing a list of functions. :func:`~sage.misc.rest_index_of_methods.gen_thematic_rest_table_index` @ Return a ReST string of thematically sorted function (or methods) of a module (or class). - :func:`~sage.misc.rest_index_of_methods.list_of_subfunctions` @ Returns the functions (resp. methods) of a given module (resp. class) with their names. + :func:`~sage.misc.rest_index_of_methods.list_of_subfunctions` @ Return the functions (resp. methods) of a given module (resp. class) with their names. @@ -128,7 +130,7 @@ def gen_rest_table_index(obj, names=None, sort=True, only_local_functions=True, :func:`~sage.misc.rest_index_of_methods.doc_index` @ Attribute an index name to a function. :func:`~sage.misc.rest_index_of_methods.gen_rest_table_index` @ Return a ReST table describing a list of functions. :func:`~sage.misc.rest_index_of_methods.gen_thematic_rest_table_index` @ Return a ReST string of thematically sorted function (or methods) of a module (or class). - :func:`~sage.misc.rest_index_of_methods.list_of_subfunctions` @ Returns the functions (resp. methods) of a given module (resp. class) with their names. + :func:`~sage.misc.rest_index_of_methods.list_of_subfunctions` @ Return the functions (resp. methods) of a given module (resp. class) with their names. sage: print(gen_rest_table_index(sage.misc.rest_index_of_methods, only_local_functions=False)) @@ -139,7 +141,7 @@ def gen_rest_table_index(obj, names=None, sort=True, only_local_functions=True, :func:`~sage.misc.rest_index_of_methods.doc_index` @ Attribute an index name to a function. :func:`~sage.misc.rest_index_of_methods.gen_thematic_rest_table_index` @ Return a ReST string of thematically sorted function (or methods) of a module (or class). - :func:`~sage.misc.rest_index_of_methods.list_of_subfunctions` @ Returns the functions (resp. methods) of a given module (resp. class) with their names. + :func:`~sage.misc.rest_index_of_methods.list_of_subfunctions` @ Return the functions (resp. methods) of a given module (resp. class) with their names. @@ -150,6 +152,13 @@ def gen_rest_table_index(obj, names=None, sort=True, only_local_functions=True, True sage: 'all_max_cliques`' in gen_rest_table_index(Graph) # needs sage.graphs False + + Check that :trac:`36178` is fixed:: + + sage: print(gen_rest_table_index(Graph)) # needs sage.graphs + ... + :meth:`~sage.graphs.graph.Graph.independent_set` @ Return a maximum independent set. + ... """ if names is None: names = {} @@ -218,15 +227,15 @@ def gen_rest_table_index(obj, names=None, sort=True, only_local_functions=True, def list_of_subfunctions(root, only_local_functions=True): r""" - Returns the functions (resp. methods) of a given module (resp. class) with their names. + Return the functions (resp. methods) of a given module (resp. class) with their names. INPUT: - ``root`` -- the module, or class, whose elements are to be listed. - - ``only_local_functions`` (boolean; ``True``) -- if ``root`` is a module, - ``only_local_functions = True`` means that imported functions will be - filtered out. This can be useful to disable for making indexes of + - ``only_local_functions`` -- boolean (default: ``True``); if ``root`` is a + module, ``only_local_functions = True`` means that imported functions will + be filtered out. This can be useful to disable for making indexes of e.g. catalog modules such as :mod:`sage.coding.codes_catalog`. OUTPUT: @@ -290,21 +299,22 @@ def can_import(f): return list(functions.keys()), functions -def gen_thematic_rest_table_index(root,additional_categories=None,only_local_functions=True): +def gen_thematic_rest_table_index(root, additional_categories=None, only_local_functions=True): r""" - Return a ReST string of thematically sorted function (or methods) of a module (or class). + Return a ReST string of thematically sorted function (or methods) of a + module (or class). INPUT: - ``root`` -- the module, or class, whose elements are to be listed. - - ``additional_categories`` -- a dictionary associating a category (given as - a string) to a function's name. Can be used when the decorator - :func:`doc_index` does not work on a function. + - ``additional_categories`` -- dictionary (default: ``None``); a dictionary + associating a category (given as a string) to a function's name. Can be + used when the decorator :func:`doc_index` does not work on a function. - - ``only_local_functions`` (boolean; ``True``) -- if ``root`` is a module, - ``only_local_functions = True`` means that imported functions will be - filtered out. This can be useful to disable for making indexes of + - ``only_local_functions`` -- boolean (default: ``True``); if ``root`` is a + module, ``only_local_functions = True`` means that imported functions will + be filtered out. This can be useful to disable for making indexes of e.g. catalog modules such as :mod:`sage.coding.codes_catalog`. EXAMPLES:: @@ -359,7 +369,7 @@ def doc_index(name): 'Wouhouuuuu' """ def hey(f): - setattr(f,"doc_index",name) + setattr(f, "doc_index", name) return f return hey From 71a55d9edfc840c307f5fc61ce7982a0d52352f5 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 2 Sep 2023 18:41:14 +0200 Subject: [PATCH 396/423] remove a useless link in sage/graphs.digraph.py --- src/sage/graphs/digraph.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sage/graphs/digraph.py b/src/sage/graphs/digraph.py index a8e6e9997b1..d30d5e63efa 100644 --- a/src/sage/graphs/digraph.py +++ b/src/sage/graphs/digraph.py @@ -84,7 +84,6 @@ :meth:`~DiGraph.strongly_connected_components_subgraphs` | Return the strongly connected components as a list of subgraphs. :meth:`~DiGraph.strongly_connected_component_containing_vertex` | Return the strongly connected component containing a given vertex :meth:`~DiGraph.strongly_connected_components` | Return the list of strongly connected components. - :meth:`~DiGraph.immediate_dominators` | Return the immediate dominators of all vertices reachable from `root`. :meth:`~DiGraph.strong_articulation_points` | Return the strong articulation points of this digraph. From f34a9b35f31e39a7794ddfc65eb906c7bc43987c Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 2 Sep 2023 18:45:48 +0200 Subject: [PATCH 397/423] fix some links in sage/graphs/generators/chessboard.py --- src/sage/graphs/generators/chessboard.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sage/graphs/generators/chessboard.py b/src/sage/graphs/generators/chessboard.py index 59517d128bb..dfe5b15b273 100644 --- a/src/sage/graphs/generators/chessboard.py +++ b/src/sage/graphs/generators/chessboard.py @@ -4,11 +4,11 @@ The methods defined here appear in :mod:`sage.graphs.graph_generators`. -- :meth:`BishopGraph ` -- :meth:`KingGraph ` -- :meth:`KnightGraph ` -- :meth:`QueenGraph ` -- :meth:`RookGraph ` +- :meth:`BishopGraph ` +- :meth:`KingGraph ` +- :meth:`KnightGraph ` +- :meth:`QueenGraph ` +- :meth:`RookGraph ` AUTHORS: From 15201fc6162aba86961ae14cdb7226a8357988da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 2 Sep 2023 21:33:44 +0200 Subject: [PATCH 398/423] more fixes in quadatic forms --- src/sage/quadratic_forms/genera/genus.py | 195 +++++++++--------- .../quadratic_form__local_normal_form.py | 71 ++++--- 2 files changed, 132 insertions(+), 134 deletions(-) diff --git a/src/sage/quadratic_forms/genera/genus.py b/src/sage/quadratic_forms/genera/genus.py index 28c66344013..d9c298f5f0a 100644 --- a/src/sage/quadratic_forms/genera/genus.py +++ b/src/sage/quadratic_forms/genera/genus.py @@ -298,13 +298,13 @@ def _blocks(b, even_only=False): if not even_only: for s in [(1, 2), (5, 6), (1, 6), (5, 2), (7, 0), (3, 4)]: b1 = copy(b) - b1[2] = s[0]*(-1)**(rk//2 -1) % 8 + b1[2] = s[0]*(-1)**(rk // 2 - 1) % 8 b1[3] = 1 b1[4] = s[1] blocks.append(b1) for s in [(1, 4), (5, 0)]: b1 = copy(b) - b1[2] = s[0]*(-1)**(rk//2 - 2) % 8 + b1[2] = s[0]*(-1)**(rk // 2 - 2) % 8 b1[3] = 1 b1[4] = s[1] blocks.append(b1) @@ -514,7 +514,7 @@ def is_2_adic_genus(genus_symbol_quintuple_list): if s[2] % 8 in (3, 5): if not s[4] in (2, 4, 6): return False - if (s[1] - s[4])% 2 == 1: + if (s[1] - s[4]) % 2 == 1: return False if s[3] == 0 and s[4] != 0: return False @@ -764,7 +764,7 @@ def canonical_2_adic_reduction(genus_symbol_quintuple_list): for i in compart: genus_symbol_quintuple_list[i][4] = 0 genus_symbol_quintuple_list[compart[0]][4] = oddity - verbose(mesg="End oddity fusion: %s" %canonical_symbol, level=2) + verbose(mesg="End oddity fusion: %s" % canonical_symbol, level=2) # Sign walking: trains = canonical_2_adic_trains(genus_symbol_quintuple_list) for train in trains: @@ -778,7 +778,7 @@ def canonical_2_adic_reduction(genus_symbol_quintuple_list): if t1-1 in compart or t1 in compart: o = canonical_symbol[compart[0]][4] canonical_symbol[compart[0]][4] = (o+4) % 8 - verbose(mesg="End sign walking: %s" %canonical_symbol, level=2) + verbose(mesg="End sign walking: %s" % canonical_symbol, level=2) return canonical_symbol @@ -912,35 +912,35 @@ def p_adic_symbol(A, p, val): m0 = min(c.valuation(p) for c in A.list()) q = p**m0 n = A.nrows() - A = MatrixSpace(ZZ, n, n)([ c // q for c in A.list() ]) + A = MatrixSpace(ZZ, n, n)([c // q for c in A.list()]) A_p = MatrixSpace(FiniteField(p), n, n)(A) B_p = A_p.kernel().echelonized_basis_matrix() if B_p.nrows() == 0: e0 = Integer(A_p.det()).kronecker(p) n0 = A.nrows() - return [ [m0, n0, e0] ] + return [[m0, n0, e0]] else: C_p = basis_complement(B_p) e0 = Integer((C_p * A_p * C_p.transpose()).det()).kronecker(p) n0 = C_p.nrows() - sym = [ [0, n0, e0] ] + sym = [[0, n0, e0]] r = B_p.nrows() B = MatrixSpace(ZZ, r, n)(B_p) C = MatrixSpace(ZZ, n - r, n)(C_p) # Construct the blocks for the Jordan decomposition [F,X;X,A_new] F = MatrixSpace(QQ, n - r, n - r)(C * A * C.transpose()) U = F**-1 - d = LCM([ c.denominator() for c in U.list() ]) + d = LCM([c.denominator() for c in U.list()]) R = ZZ.quotient_ring(Integer(p)**(val + 3)) u = R(d)**-1 - MatR = MatrixSpace(R, n - r , n - r) + MatR = MatrixSpace(R, n - r, n - r) MatZ = MatrixSpace(ZZ, n - r, n - r) U = MatZ(MatR(MatZ(U * d)) * u) # X = C*A*B.transpose() # A = B*A*B.transpose() - X.transpose()*U*X X = C * A - A = B * (A - X.transpose()*U*X) * B.transpose() - return [ [s[0]+m0] + s[1:] for s in sym + p_adic_symbol(A, p, val) ] + A = B * (A - X.transpose() * U * X) * B.transpose() + return [[s[0]+m0] + s[1:] for s in sym + p_adic_symbol(A, p, val)] def is_even_matrix(A): @@ -969,7 +969,7 @@ def is_even_matrix(A): (True, -1) """ for i in range(A.nrows()): - if A[i,i] % 2 == 1: + if A[i, i] % 2: return False, i return True, -1 @@ -1024,35 +1024,35 @@ def split_odd(A): even, i = is_even_matrix(A) R = A.parent().base_ring() C = MatrixSpace(R, n0 - 1, n0)(0) - u = A[i,i] + u = A[i, i] for j in range(n0-1): if j < i: - C[j,j] = 1 - C[j,i] = -A[j,i] * u + C[j, j] = 1 + C[j, i] = -A[j, i] * u else: - C[j,j+1] = 1 - C[j,i] = -A[j+1,i] * u + C[j, j+1] = 1 + C[j, i] = -A[j+1, i] * u B = C*A*C.transpose() even, j = is_even_matrix(B) if even: I = A.parent()(1) # TODO: we could manually (re)construct the kernel here... if i == 0: - I[1,0] = 1 - A[1,0]*u + I[1, 0] = 1 - A[1, 0]*u i = 1 else: - I[0,i] = 1 - A[0,i]*u + I[0, i] = 1 - A[0, i]*u i = 0 A = I*A*I.transpose() - u = A[i,i] - C = MatrixSpace(R,n0-1,n0)(0) + u = A[i, i] + C = MatrixSpace(R, n0-1, n0)(0) for j in range(n0-1): if j < i: - C[j,j] = 1 - C[j,i] = -A[j,i] * u + C[j, j] = 1 + C[j, i] = -A[j, i] * u else: - C[j,j+1] = 1 - C[j,i] = -A[j+1,i] * u + C[j, j+1] = 1 + C[j, i] = -A[j+1, i] * u B = C * A * C.transpose() even, j = is_even_matrix(B) if even: @@ -1141,9 +1141,9 @@ def two_adic_symbol(A, val): # deal with the empty matrix if n == 0: return [[0, 0, 1, 0, 0]] - m0 = min([ c.valuation(2) for c in A.list() ]) + m0 = min([c.valuation(2) for c in A.list()]) q = 2**m0 - A = A.parent()([ c // q for c in A.list() ]) + A = A.parent()([c // q for c in A.list()]) A_2 = MatrixSpace(FiniteField(2), n, n)(A) K_2 = A_2.kernel() R_8 = ZZ.quotient_ring(Integer(8)) @@ -1170,12 +1170,12 @@ def two_adic_symbol(A, val): B_2 = K_2.echelonized_basis_matrix() C_2 = basis_complement(B_2) n0 = C_2.nrows() - C = MatrixSpace(ZZ,n0,n)(C_2) + C = MatrixSpace(ZZ, n0, n)(C_2) A_new = C * A * C.transpose() # compute oddity modulo 8: A_8 = MatrixSpace(R_8, n0, n0)(A_new) # d0 = A_8.det() # no determinant over Z/8Z - d0 = ZZ(R_8(MatrixSpace(ZZ,n0,n0)(A_8).determinant())) + d0 = ZZ(R_8(MatrixSpace(ZZ, n0, n0)(A_8).determinant())) if d0 == 0: print("A:") print(A_new) @@ -1187,11 +1187,11 @@ def two_adic_symbol(A, val): tr8 = trace_diag_mod_8(A_8) sym = [[0, n0, d0, 1, tr8]] r = B_2.nrows() - B = MatrixSpace(ZZ,r,n)(B_2) + B = MatrixSpace(ZZ, r, n)(B_2) C = MatrixSpace(ZZ, n - r, n)(C_2) F = MatrixSpace(QQ, n - r, n - r)(C * A * C.transpose()) U = F**-1 - d = LCM([ c.denominator() for c in U.list() ]) + d = LCM([c.denominator() for c in U.list()]) R = ZZ.quotient_ring(Integer(2)**(val + 3)) u = R(d)**-1 MatR = MatrixSpace(R, n - r, n - r) @@ -1199,7 +1199,7 @@ def two_adic_symbol(A, val): U = MatZ(MatR(MatZ(U * d)) * u) X = C * A A = B * (A - X.transpose()*U*X) * B.transpose() - return [ [s[0]+m0] + s[1:] for s in sym + two_adic_symbol(A, val) ] + return [[s[0]+m0] + s[1:] for s in sym + two_adic_symbol(A, val)] class Genus_Symbol_p_adic_ring(): @@ -1336,14 +1336,14 @@ def __repr__(self): Genus symbol at 2: [1^2]_0 2^2 Genus symbol at 3: 1^2 3^2 """ - p=self._prime + p = self._prime CS_string = "" if p == 2: CS = self.canonical_symbol() for train in self.trains(): - #mark the beginning of a train with a colon + # mark the beginning of a train with a colon CS_string += " :" - #collect the indices where compartments begin and end + # collect the indices where compartments begin and end compartment_begins = [] compartment_ends = [] for comp in self.compartments(): @@ -1352,24 +1352,24 @@ def __repr__(self): for block_index in train: if block_index in compartment_begins: - #mark the beginning of this compartment with [ + # mark the beginning of this compartment with [ CS_string += "[" block = CS[block_index] block_string = "%s^%s " % (p**block[0], block[2] * block[1]) CS_string += block_string if block_index in compartment_ends: - #close this compartment with ] and remove a space + # close this compartment with ] and remove a space CS_string = CS_string[:-1] + "]" # the oddity belongs to the compartment # and is saved in its first block i = compartment_ends.index(block_index) compartment_start = compartment_begins[i] oddity = CS[compartment_start][4] - CS_string +="_%s " % oddity + CS_string += "_%s " % oddity # remove the first colon CS_string = CS_string[2:] # remove some unnecessary whitespace - CS_string = CS_string.replace(" :",":") + CS_string = CS_string.replace(" :", ":") else: for s in self._symbol: @@ -1390,7 +1390,7 @@ def _latex_(self): sage: latex(g) \mbox{Genus symbol at } 2\mbox{: }1^{4} [2^{2} 4^{1}]_{3} :16^{4} [32^{1}]_{1} """ - p=self._prime + p = self._prime CS_string = "" if p == 2: CS = self.canonical_symbol() @@ -1419,14 +1419,14 @@ def _latex_(self): i = compartment_ends.index(block_index) compartment_start = compartment_begins[i] oddity = CS[compartment_start][4] - CS_string +="_{%s}" % oddity - #remove the first colon + CS_string += "_{%s}" % oddity + # remove the first colon CS_string = CS_string[2:] else: for s in self._symbol: CS_string += " {%s}^{%s}" % (p**s[0], s[2]*s[1]) - return r"\mbox{Genus symbol at } %s\mbox{: }%s" % (p,CS_string) + return r"\mbox{Genus symbol at } %s\mbox{: }%s" % (p, CS_string) def __eq__(self, other): r""" @@ -1493,16 +1493,15 @@ def __ne__(self, other): False sage: G3 != G3 False - """ return not self == other # Added these two methods to make this class iterable... - #def __getitem__(self, i): - # return self._symbol[i] + # def __getitem__(self, i): + # return self._symbol[i] # - #def len(self): - # return len(self._symbol) + # def len(self): + # return len(self._symbol) # ------------------------------------------------------ def automorphous_numbers(self): @@ -1612,11 +1611,11 @@ def automorphous_numbers(self): II = [] for block in collect_small_blocks(G): if block.ncols() == 1: - u = block[0,0] + u = block[0, 0] if I.count(u) < 2: - I.append(block[0,0]) - else: # rank2 - q = block[0,1] + I.append(block[0, 0]) + else: # rank2 + q = block[0, 1] II += [2*q, 3*2*q, 5*2*q, 7*2*q] L = I + II @@ -1648,9 +1647,9 @@ def automorphous_numbers(self): v, u = r.val_unit(ZZ(2)) u = u % 8 assert v >= 0 - if v==0 and u==1: + if v == 0 and u == 1: automorphs.append(ZZ(2)) - if v==0 and u==5: + if v == 0 and u == 5: automorphs.append(ZZ(6)) if v in [0, 2, 4]: # this overlaps with the first two cases! automorphs.append(ZZ(5)) @@ -1797,7 +1796,7 @@ def mass(self): p = self.prime() sym = self._symbol ############## - #diagonal product + # diagonal product ############## # diagonal factors @@ -1881,14 +1880,14 @@ def _species_list(self): for k in range(sym[-1][0] + 1): if sym[s][0] == k: symbols.append(sym[s]) - s +=1 + s += 1 else: symbols.append([k, 0, 1, 0, 0]) # avoid a case distinction - sym = [[-2, 0, 1, 0, 0],[-1, 0, 1, 0, 0]] + symbols + [[sym[-1][0]+1, 0, 1, 0, 0],[sym[-1][0] + 2, 0, 1, 0, 0]] + sym = [[-2, 0, 1, 0, 0], [-1, 0, 1, 0, 0]] + symbols + [[sym[-1][0]+1, 0, 1, 0, 0], [sym[-1][0] + 2, 0, 1, 0, 0]] for k in range(1, len(sym)-1): free = True - if sym[k-1][3]==1 or sym[k+1][3]==1: + if sym[k-1][3] == 1 or sym[k+1][3] == 1: free = False n = sym[k][1] o = sym[k][4] @@ -2040,7 +2039,7 @@ def determinant(self): 3 """ p = self._prime - return prod([ p**(s[0]*s[1]) for s in self._symbol ]) + return prod([p**(s[0] * s[1]) for s in self._symbol]) det = determinant @@ -2069,7 +2068,7 @@ def dimension(self): sage: G3.dimension() 4 """ - return sum([ s[1] for s in self._symbol ]) + return sum([s[1] for s in self._symbol]) dim = dimension rank = dimension @@ -2197,13 +2196,13 @@ def excess(self): for s in self._symbol: if s[0] % 2 == 1 and s[2] in (3, 5): k += 1 - return Integer(sum([ s[4] for s in self._symbol ]) + 4*k).mod(8) + return Integer(sum([s[4] for s in self._symbol]) + 4*k).mod(8) else: k = 0 for s in self._symbol: if s[0] % 2 == 1 and s[2] == -1: k += 1 - return Integer(sum([ s[1] * (p**s[0]-1) for s in self._symbol]) + 4*k).mod(8) + return Integer(sum([s[1] * (p**s[0]-1) for s in self._symbol]) + 4*k).mod(8) def scale(self): r""" @@ -2375,7 +2374,7 @@ def __init__(self, signature_pair, local_symbols, representative=None, check=Tru if not all(isinstance(sym, Genus_Symbol_p_adic_ring) for sym in local_symbols): raise TypeError("local symbols must be a list of local genus symbols") n = signature_pair[0] + signature_pair[1] - if not all(sym.dimension()==n for sym in local_symbols): + if not all(sym.dimension() == n for sym in local_symbols): raise TypeError("all local symbols must be of the same dimension") if representative is not None: if not representative.is_symmetric(): @@ -2388,7 +2387,7 @@ def __init__(self, signature_pair, local_symbols, representative=None, check=Tru raise ValueError("the first symbol must be 2-adic") if representative is not None: if representative.base_ring() != ZZ: - representative = matrix(ZZ,representative) + representative = matrix(ZZ, representative) representative.set_immutable() self._representative = representative self._signature = signature_pair @@ -2426,8 +2425,8 @@ def __repr__(self): """ rep = "Genus" if self.dimension() <= 20: - rep += " of\n%s" %self._representative - rep += "\nSignature: %s"%(self._signature,) + rep += " of\n%s" % self._representative + rep += "\nSignature: %s" % (self._signature,) for s in self._local_symbols: rep += "\n" + s.__repr__() return rep @@ -2450,10 +2449,10 @@ def _latex_(self): """ rep = r"\mbox{Genus" if self.dimension() <= 20: - rep += r" of}\\ %s" %self._representative._latex_() + rep += r" of}\\ %s" % self._representative._latex_() else: - rep +=r"}" - rep += r"\\ \mbox{Signature: } %s"%(self._signature,) + rep += r"}" + rep += r"\\ \mbox{Signature: } %s" % (self._signature,) for s in self._local_symbols: rep += r"\\ " + s._latex_() return rep @@ -2686,7 +2685,7 @@ def spinor_generators(self, proper): if p.divides(self.determinant()): continue g = Q(A.delta(p)) - if g.gap() in U.gap(): # containment in sage is broken + if g.gap() in U.gap(): # containment in sage is broken continue else: spinor_gens.append(p) @@ -2729,15 +2728,15 @@ def _proper_is_improper(self): P = [s.prime() for s in self._local_symbols] while True: x = V.random_element() - q = x * G* x + q = x * G * x if q != 0 and all(q.valuation(p) == norm.valuation(p) for p in P): break - Q = [p for p in q.prime_factors() if (norm.valuation(p) + q.valuation(p)) % 2 != 0] + Q = [p for p in q.prime_factors() if (norm.valuation(p) + q.valuation(p)) % 2] r = ZZ.prod(Q) # M = \tau_x(L) # q = [L: L & M] A, K = self._proper_spinor_kernel() - j = A.delta(r) # diagonal embedding of r + j = A.delta(r) # diagonal embedding of r return j in K, j def signature(self): @@ -2894,7 +2893,7 @@ def rational_representative(self): for sym in self._local_symbols: p = sym._prime # it is important to use the definition of Cassels here! - if QuadraticForm(QQ,2*sym.gram_matrix()).hasse_invariant(p) == -1: + if QuadraticForm(QQ, 2*sym.gram_matrix()).hasse_invariant(p) == -1: P.append(p) q = quadratic_form_from_invariants(F=QQ, rk=m, det=det, P=P, sminus=sminus) @@ -2949,7 +2948,7 @@ def _compute_representative(self, LLL=True): m = pari(L) gp.read(SAGE_EXTCODE + "/pari/simon/qfsolve.gp") - m = gp.eval('qflllgram_indefgoon(%s)'%m) + m = gp.eval('qflllgram_indefgoon(%s)' % m) # convert the output string to sage L = pari(m).sage()[0] elif sig[1] != 0: @@ -3089,7 +3088,7 @@ def representatives(self, backend=None, algorithm=None): e = ZZ(2) if self.signature_pair()[0] == 0: e *= ZZ(-1) - Q = QuadraticForm(ZZ,e*self.representative()) + Q = QuadraticForm(ZZ, e * self.representative()) seeds = [Q] for p in self.spinor_generators(proper=False): v = Q.find_primitive_p_divisible_vector__next(p) @@ -3257,22 +3256,22 @@ def mass(self, backend='sage'): if pos * neg != 0: raise ValueError("the genus must be definite.") if pos + neg == 1: - return QQ(1)/QQ(2) + return QQ(1) / QQ(2) if backend == 'sage': mass = self._standard_mass() for sym in self._local_symbols: - mass *= sym.mass()/sym._standard_mass() + mass *= sym.mass() / sym._standard_mass() return QQ(mass.canonicalize_radical()) elif backend == 'magma': - e = 1 # lattices in magma are positive definite - if neg !=0: + e = 1 # lattices in magma are positive definite + if neg != 0: e = -1 # for some reason LatticeWithGram wants a dense matrix - L = magma(e*self.representative().dense_matrix()) + L = magma(e * self.representative().dense_matrix()) L = L.LatticeWithGram() return QQ(L.Mass()) else: - raise ValueError("unknown backend: %s"%backend) + raise ValueError("unknown backend: %s" % backend) def level(self): r""" @@ -3378,18 +3377,18 @@ def _gram_from_jordan_block(p, block, discr_form=False): if p == 2: o = ZZ(block[3]) t = ZZ(block[4]) - U = matrix(QQ, 2, [0,1, 1,0]) - V = matrix(QQ, 2, [2,1, 1,2]) + U = matrix(QQ, 2, [0, 1, 1, 0]) + V = matrix(QQ, 2, [2, 1, 1, 2]) W = matrix(QQ, 1, [1]) if o == 0: if det in [1, 7]: qL = (rk // 2) * [U] else: - qL = (rk//2 - 1)*[U] + [V] + qL = (rk // 2 - 1) * [U] + [V] if o == 1: if rk % 2 == 1: qL = max(0, (rk - 3) // 2) * [U] - if t*det % 8 in [3, 5]: + if t * det % 8 in [3, 5]: qL += [V] elif rk >= 3: qL += [U] @@ -3400,21 +3399,21 @@ def _gram_from_jordan_block(p, block, discr_form=False): else: det = 1 qL = max(0, (rk - 4) // 2) * [U] - if (det , t) == (1, 0): + if (det, t) == (1, 0): qL += [U, 1 * W, 7 * W] - if (det , t) == (1, 2): + if (det, t) == (1, 2): qL += [U, 1 * W, 1 * W] - if (det , t) == (1, 4): + if (det, t) == (1, 4): qL += [V, 1 * W, 3 * W] - if (det , t) == (1, 6): + if (det, t) == (1, 6): qL += [U, 7 * W, 7 * W] - if (det , t) == (-1, 0): + if (det, t) == (-1, 0): qL += [V, 1 * W, 7 * W] - if (det , t) == (-1, 2): + if (det, t) == (-1, 2): qL += [U, 3 * W, 7 * W] - if (det , t) == (-1, 4): + if (det, t) == (-1, 4): qL += [U, 1 * W, 3 * W] - if (det , t) == (-1, 6): + if (det, t) == (-1, 6): qL += [U, 1 * W, 5 * W] # if the rank is 2 there is a U too much if rk == 2: @@ -3508,7 +3507,7 @@ def M_p(species, p): return QQ(1) n = species.abs() s = (n + 1) // ZZ(2) - mp = ZZ(2) * ZZ.prod(ZZ(1) - p**(-2*k) for k in range(1, s)) + mp = ZZ(2) * ZZ.prod(ZZ(1) - p**(-2 * k) for k in range(1, s)) if n % 2 == 0: - mp *= ZZ(1) - species.sign() * p**(-s) - return QQ(1) / mp + mp *= ZZ.one() - species.sign() * p**(-s) + return QQ.one() / mp diff --git a/src/sage/quadratic_forms/quadratic_form__local_normal_form.py b/src/sage/quadratic_forms/quadratic_form__local_normal_form.py index a74dccc3fb3..5770a3c22f0 100644 --- a/src/sage/quadratic_forms/quadratic_form__local_normal_form.py +++ b/src/sage/quadratic_forms/quadratic_form__local_normal_form.py @@ -1,7 +1,6 @@ """ Local Normal Form """ - # **************************************************************************** # Copyright (C) 2007 William Stein and Jonathan Hanke # @@ -18,18 +17,19 @@ # **************************************************************************** import copy + from sage.rings.infinity import Infinity -from sage.rings.integer_ring import IntegerRing, ZZ +from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ -from sage.arith.misc import GCD -from sage.arith.misc import valuation -from sage.arith.misc import is_prime +from sage.arith.misc import GCD, valuation, is_prime def find_entry_with_minimal_scale_at_prime(self, p): r""" - Finds the entry of the quadratic form with minimal scale at the - prime `p`, preferring diagonal entries in case of a tie. (I.e. If + Find the entry of the quadratic form with minimal scale at the + prime `p`, preferring diagonal entries in case of a tie. + + (I.e. If we write the quadratic form as a symmetric matrix `M`, then this entry ``M[i,j]`` has the minimal valuation at the prime `p`.) @@ -56,14 +56,13 @@ def find_entry_with_minimal_scale_at_prime(self, p): (1, 1) sage: Q.find_entry_with_minimal_scale_at_prime(5) (0, 0) - """ n = self.dim() min_val = Infinity ij_index = None val_2 = valuation(2, p) for d in range(n): # d = difference j-i - for e in range(n - d): # e is the length of the diagonal with value d. + for e in range(n - d): # e is the length of the diagonal with value d. # Compute the valuation of the entry if d == 0: @@ -121,9 +120,9 @@ def local_normal_form(self, p): [ * 6 ] """ # Sanity Checks - if (self.base_ring() != IntegerRing()): + if self.base_ring() != ZZ: raise NotImplementedError("this currently only works for quadratic forms defined over ZZ") - if not ((p>=2) and is_prime(p)): + if not (p >= 2 and is_prime(p)): raise TypeError("p is not a positive prime number") # Some useful local variables @@ -145,12 +144,12 @@ def local_normal_form(self, p): min_val = valuation(Q[min_i, min_j], p) # Error if we still haven't seen non-zero coefficients! - if (min_val == Infinity): + if min_val == Infinity: raise RuntimeError("the original matrix is degenerate") # Step 2: Arrange for the upper leftmost entry to have minimal valuation # ---------------------------------------------------------------------- - if (min_i == min_j): + if min_i == min_j: block_size = 1 Q.swap_variables(0, min_i, in_place=True) else: @@ -159,7 +158,7 @@ def local_normal_form(self, p): Q.swap_variables(1, min_j, in_place=True) # 1x1 => make upper left the smallest - if (p != 2): + if p != 2: block_size = 1 Q.add_symmetric(1, 0, 1, in_place=True) # 2x2 => replace it with the appropriate 2x2 matrix @@ -171,8 +170,8 @@ def local_normal_form(self, p): min_scale = p ** min_val # This is the minimal valuation of the Hessian matrix entries. # Perform cancellation over Z by ensuring divisibility - if (block_size == 1): - a = 2 * Q[0,0] + if block_size == 1: + a = 2 * Q[0, 0] for j in range(block_size, n): b = Q[0, j] g = GCD(a, b) @@ -181,16 +180,16 @@ def local_normal_form(self, p): if valuation(g, p) != valuation(a, p): raise RuntimeError("we have a problem with our rescaling not preserving p-integrality") - Q.multiply_variable(ZZ(a/g), j, in_place=True) # Ensures that the new b entry is divisible by a - Q.add_symmetric(ZZ(-b/g), j, 0, in_place=True) # Performs the cancellation + Q.multiply_variable(ZZ(a / g), j, in_place=True) # Ensures that the new b entry is divisible by a + Q.add_symmetric(ZZ(-b / g), j, 0, in_place=True) # Performs the cancellation - elif (block_size == 2): - a1 = 2 * Q[0,0] + elif block_size == 2: + a1 = 2 * Q[0, 0] a2 = Q[0, 1] b1 = Q[1, 0] # This is the same as a2 b2 = 2 * Q[1, 1] - big_det = (a1*b2 - a2*b1) + big_det = a1 * b2 - a2 * b1 small_det = big_det / (min_scale * min_scale) # Cancels out the rows/columns of the 2x2 block @@ -202,18 +201,18 @@ def local_normal_form(self, p): Q.multiply_variable(big_det, j, in_place=True) # Performs the cancellation (by producing -big_det * jth row/column) - Q.add_symmetric(ZZ(-(a*b2 - b*a2)), j, 0, in_place=True) - Q.add_symmetric(ZZ(-(-a*b1 + b*a1)), j, 1, in_place=True) + Q.add_symmetric(ZZ(-(a * b2 - b * a2)), j, 0, in_place=True) + Q.add_symmetric(ZZ(-(-a * b1 + b * a1)), j, 1, in_place=True) # Now remove the extra factor (non p-unit factor) in big_det we introduced above Q.divide_variable(ZZ(min_scale * min_scale), j, in_place=True) # Uses Cassels's proof to replace the remaining 2 x 2 block - if (((1 + small_det) % 8) == 0): + if (1 + small_det) % 8 == 0: Q[0, 0] = 0 Q[1, 1] = 0 Q[0, 1] = min_scale - elif (((5 + small_det) % 8) == 0): + elif (5 + small_det) % 8 == 0: Q[0, 0] = min_scale Q[1, 1] = min_scale Q[0, 1] = min_scale @@ -223,7 +222,7 @@ def local_normal_form(self, p): # Check that the cancellation worked, extract the upper-left block, and trim Q to handle the next block. for i in range(block_size): for j in range(block_size, n): - if Q[i,j] != 0: + if Q[i, j] != 0: raise RuntimeError(f"the cancellation did not work properly at entry ({i},{j})") Q_Jordan = Q_Jordan + Q.extract_variables(range(block_size)) Q = Q.extract_variables(range(block_size, n)) @@ -300,7 +299,7 @@ def jordan_blocks_by_scale_and_unimodular(self, p, safe_flag=True): return copy.deepcopy(self.__jordan_blocks_by_scale_and_unimodular_dict[p]) else: return self.__jordan_blocks_by_scale_and_unimodular_dict[p] - except Exception: + except (KeyError, AttributeError): # Initialize the global dictionary if it doesn't exist if not hasattr(self, '__jordan_blocks_by_scale_and_unimodular_dict'): self.__jordan_blocks_by_scale_and_unimodular_dict = {} @@ -317,28 +316,28 @@ def jordan_blocks_by_scale_and_unimodular(self, p, safe_flag=True): tmp_Jordan_list = [] i = 0 start_ind = 0 - if (n >= 2) and (Q1[0,1] != 0): - start_scale = valuation(Q1[0,1], p) - 1 + if n >= 2 and Q1[0, 1] != 0: + start_scale = valuation(Q1[0, 1], p) - 1 else: - start_scale = valuation(Q1[0,0], p) + start_scale = valuation(Q1[0, 0], p) - while (i < n): + while i < n: # Determine the size of the current block - if (i == n-1) or (Q1[i,i+1] == 0): + if i == n - 1 or Q1[i, i + 1] == 0: block_size = 1 else: block_size = 2 # Determine the valuation of the current block if block_size == 1: - block_scale = valuation(Q1[i,i], p) + block_scale = valuation(Q1[i, i], p) else: - block_scale = valuation(Q1[i,i+1], p) - 1 + block_scale = valuation(Q1[i, i + 1], p) - 1 # Process the previous block if the valuation increased if block_scale > start_scale: - tmp_Jordan_list += [(start_scale, Q1.extract_variables(range(start_ind, i)).scale_by_factor(ZZ(1) / (QQ(p)**(start_scale))))] + tmp_Jordan_list += [(start_scale, Q1.extract_variables(range(start_ind, i)).scale_by_factor(ZZ.one() / QQ(p)**start_scale))] start_ind = i start_scale = block_scale @@ -346,7 +345,7 @@ def jordan_blocks_by_scale_and_unimodular(self, p, safe_flag=True): i += block_size # Add the last block - tmp_Jordan_list += [(start_scale, Q1.extract_variables(range(start_ind, n)).scale_by_factor(ZZ(1) / QQ(p)**(start_scale)))] + tmp_Jordan_list += [(start_scale, Q1.extract_variables(range(start_ind, n)).scale_by_factor(ZZ.one() / QQ(p)**start_scale))] # Cache the result self.__jordan_blocks_by_scale_and_unimodular_dict[p] = tmp_Jordan_list From bd384181fa25410f984635cae74534027f98153d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 3 Sep 2023 09:22:45 +0200 Subject: [PATCH 399/423] fix E228 and E225 in algebras/ --- .../algebras/affine_nil_temperley_lieb.py | 8 ++-- src/sage/algebras/cellular_basis.py | 2 +- src/sage/algebras/down_up_algebra.py | 2 +- src/sage/algebras/free_algebra.py | 2 +- src/sage/algebras/fusion_rings/f_matrix.py | 8 ++-- .../algebras/fusion_rings/fusion_double.py | 2 +- src/sage/algebras/fusion_rings/fusion_ring.py | 2 +- .../hecke_algebras/ariki_koike_algebra.py | 32 ++++++++-------- .../lie_algebras/classical_lie_algebra.py | 4 +- .../algebras/lie_algebras/free_lie_algebra.py | 2 +- src/sage/algebras/lie_algebras/heisenberg.py | 30 +++++++-------- .../free_fermions_lie_conformal_algebra.py | 2 +- .../lie_conformal_algebra.py | 4 +- ..._conformal_algebra_with_structure_coefs.py | 16 ++++---- src/sage/algebras/nil_coxeter_algebra.py | 8 ++-- src/sage/algebras/orlik_solomon.py | 2 +- src/sage/algebras/quantum_clifford.py | 38 +++++++++---------- src/sage/algebras/splitting_algebra.py | 4 +- .../steenrod/steenrod_algebra_bases.py | 18 ++++----- .../steenrod/steenrod_algebra_misc.py | 2 +- src/sage/algebras/yokonuma_hecke_algebra.py | 26 ++++++------- 21 files changed, 107 insertions(+), 107 deletions(-) diff --git a/src/sage/algebras/affine_nil_temperley_lieb.py b/src/sage/algebras/affine_nil_temperley_lieb.py index f7901ae314d..720c5f481cd 100644 --- a/src/sage/algebras/affine_nil_temperley_lieb.py +++ b/src/sage/algebras/affine_nil_temperley_lieb.py @@ -119,7 +119,7 @@ def _repr_(self): sage: A = AffineNilTemperleyLiebTypeA(3); A The affine nilTemperley Lieb algebra A3 over the ring Integer Ring """ - return "The affine nilTemperley Lieb algebra A%s over the ring %s"%(self._n, self._base_ring) + return "The affine nilTemperley Lieb algebra A%s over the ring %s" % (self._n, self._base_ring) def weyl_group(self): """ @@ -234,7 +234,7 @@ def has_no_braid_relation(self, w, i): return False s = w.parent().simple_reflections() wi = w*s[i] - adjacent = [(i-1)%w.parent().n, (i+1)%w.parent().n] + adjacent = [(i-1) % w.parent().n, (i+1) % w.parent().n] for j in adjacent: if j in w.descents(): if j in wi.descents(): @@ -258,6 +258,6 @@ def _repr_term(self, t, short_display=True): if len(redword) == 0: return "1" elif short_display: - return "*".join("%s%d"%(self._prefix, i) for i in redword) + return "*".join("%s%d" % (self._prefix, i) for i in redword) else: - return "*".join("%s[%d]"%(self._prefix, i) for i in redword) + return "*".join("%s[%d]" % (self._prefix, i) for i in redword) diff --git a/src/sage/algebras/cellular_basis.py b/src/sage/algebras/cellular_basis.py index 42ce84307d5..873bd899b3e 100644 --- a/src/sage/algebras/cellular_basis.py +++ b/src/sage/algebras/cellular_basis.py @@ -233,7 +233,7 @@ def _latex_term(self, x): sm = latex(m) if sm.find('\\text{\\textt') != -1: sm = str(m) - return "C^{%s}_{%s}"%(sla, sm) + return "C^{%s}_{%s}" % (sla, sm) def cellular_basis_of(self): """ diff --git a/src/sage/algebras/down_up_algebra.py b/src/sage/algebras/down_up_algebra.py index c5fe5361282..3ee1bcea25f 100644 --- a/src/sage/algebras/down_up_algebra.py +++ b/src/sage/algebras/down_up_algebra.py @@ -237,7 +237,7 @@ def _latex_(self): sage: latex(DU) \mathcal{DU}(a,b,g) """ - return "\\mathcal{DU}(%s,%s,%s)"%(self._alpha, self._beta, self._gamma) + return "\\mathcal{DU}(%s,%s,%s)" % (self._alpha, self._beta, self._gamma) def _repr_term(self, m): r""" diff --git a/src/sage/algebras/free_algebra.py b/src/sage/algebras/free_algebra.py index bcfb0e3a62e..460b623b877 100644 --- a/src/sage/algebras/free_algebra.py +++ b/src/sage/algebras/free_algebra.py @@ -598,7 +598,7 @@ def exp_to_monomial(T): out = [] for i in range(len(T)): if T[i]: - out.append((i%ngens,T[i])) + out.append((i % ngens,T[i])) return M(out) return self.element_class(self, {exp_to_monomial(T):c for T,c in x.letterplace_polynomial().dict().items()}) # ok, not a free algebra element (or should not be viewed as one). diff --git a/src/sage/algebras/fusion_rings/f_matrix.py b/src/sage/algebras/fusion_rings/f_matrix.py index b8ba585b0f4..fe39ebf72b4 100644 --- a/src/sage/algebras/fusion_rings/f_matrix.py +++ b/src/sage/algebras/fusion_rings/f_matrix.py @@ -280,7 +280,7 @@ def __init__(self, fusion_ring, fusion_label="f", var_prefix='fx', inject_variab n_vars = self.findcases() self._poly_ring = PolynomialRing(self._FR.field(), n_vars, var_prefix) if inject_variables: - print("creating variables %s%s..%s%s"%(var_prefix, 1, var_prefix, n_vars)) + print("creating variables %s%s..%s%s" % (var_prefix, 1, var_prefix, n_vars)) self._poly_ring.inject_variables(get_main_globals()) self._idx_to_sextuple, self._fvars = self.findcases(output=True) @@ -309,7 +309,7 @@ def _repr_(self): sage: FusionRing("B2", 1).get_fmatrix() F-Matrix factory for The Fusion Ring of Type B2 and level 1 with Integer Ring coefficients """ - return "F-Matrix factory for %s"%self._FR + return "F-Matrix factory for %s" % self._FR def clear_equations(self): r""" @@ -1600,7 +1600,7 @@ def _triangular_elim(self, eqns=None, verbose=True): n = self.pool._processes chunks = [[] for i in range(n)] for i, eq_tup in enumerate(eqns): - chunks[i%n].append(eq_tup) + chunks[i % n].append(eq_tup) eqns = chunks else: eqns = [eqns] @@ -1680,7 +1680,7 @@ def equations_graph(self, eqns=None): s = [v for v in eq.variables()] for x in s: for y in s: - if y!=x: + if y != x: G.add_edge(x, y) return G diff --git a/src/sage/algebras/fusion_rings/fusion_double.py b/src/sage/algebras/fusion_rings/fusion_double.py index 07c0f55bc97..520ea96ef13 100644 --- a/src/sage/algebras/fusion_rings/fusion_double.py +++ b/src/sage/algebras/fusion_rings/fusion_double.py @@ -198,7 +198,7 @@ def _repr_(self): The Fusion Ring of the Drinfeld Double of Symmetric group of order 3! as a permutation group """ - return "The Fusion Ring of the Drinfeld Double of %s"%self._G + return "The Fusion Ring of the Drinfeld Double of %s" % self._G def inject_variables(self): """ diff --git a/src/sage/algebras/fusion_rings/fusion_ring.py b/src/sage/algebras/fusion_rings/fusion_ring.py index 4cf1e08d0f2..02da0032802 100644 --- a/src/sage/algebras/fusion_rings/fusion_ring.py +++ b/src/sage/algebras/fusion_rings/fusion_ring.py @@ -1180,7 +1180,7 @@ def _get_trees(fr, top_row, root): comp_basis = list() for top in product((a*a).monomials(), repeat=n_strands//2): # If the n_strands is odd, we must extend the top row by a fusing anyon - top_row = list(top)+[a]*(n_strands%2) + top_row = list(top)+[a]*(n_strands % 2) comp_basis.extend(tuple([*top, *levels]) for levels in _get_trees(self, top_row, b)) return comp_basis diff --git a/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py b/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py index 5f21e1049b0..cf1c7a04c39 100644 --- a/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py +++ b/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py @@ -366,7 +366,7 @@ def _latex_(self): sage: latex(H) \mathcal{H}_{5,2}(q) """ - return "\\mathcal{H}_{%s,%s}(%s)"%(self._r, self._n, self._q) + return "\\mathcal{H}_{%s,%s}(%s)" % (self._r, self._n, self._q) def hecke_parameter(self): r""" @@ -479,7 +479,7 @@ def _repr_(self): Ariki-Koike algebra of rank 5 and order 2 with q=q and u=(u0, u1, u2, u3, u4) ... in the LT-basis """ - return "%s in the %s-basis"%(self.realization_of(), self._realization_name()) + return "%s in the %s-basis" % (self.realization_of(), self._realization_name()) def hecke_parameter(self): r""" @@ -602,8 +602,8 @@ def _repr_term(self, m): sage: LT._repr_term( ((1, 0, 2), Permutation([3,2,1])) ) 'L1*L3^2*T[2,1,2]' """ - gen_str = lambda e: '' if e == 1 else '^%s'%e - lhs = '*'.join('L%s'%(j+1) + gen_str(i) + gen_str = lambda e: '' if e == 1 else '^%s' % e + lhs = '*'.join('L%s' % (j+1) + gen_str(i) for j,i in enumerate(m[0]) if i > 0) redword = m[1].reduced_word() if not redword: @@ -625,15 +625,15 @@ def _latex_term(self, m): sage: LT._latex_term( ((1, 0, 2), Permutation([3,2,1])) ) 'L_{1} L_{3}^{2} T_{2} T_{1} T_{2}' """ - gen_str = lambda e: '' if e == 1 else '^{%s}'%e - lhs = ' '.join('L_{%s}'%(j+1) + gen_str(i) + gen_str = lambda e: '' if e == 1 else '^{%s}' % e + lhs = ' '.join('L_{%s}' % (j+1) + gen_str(i) for j,i in enumerate(m[0]) if i > 0) redword = m[1].reduced_word() if not redword: if not lhs: return '1' return lhs - return lhs + ' ' + ' '.join("T_{%d}"%i for i in redword) + return lhs + ' ' + ' '.join("T_{%d}" % i for i in redword) def _from_T_basis(self, t): r""" @@ -698,10 +698,10 @@ def algebra_generators(self): for i in range(self._n): r = list(self._zero_tuple) # Make a copy r[i] = 1 - d['L%s'%(i+1)] = self.monomial( (tuple(r), self._one_perm) ) + d['L%s' % (i+1)] = self.monomial( (tuple(r), self._one_perm) ) G = self._Pn.group_generators() for i in range(1, self._n): - d['T%s'%i] = self.monomial( (self._zero_tuple, G[i]) ) + d['T%s' % i] = self.monomial( (self._zero_tuple, G[i]) ) return Family(sorted(d), lambda i: d[i]) def T(self, i=None): @@ -725,10 +725,10 @@ def T(self, i=None): """ G = self.algebra_generators() if i is None: - return [G['L1']] + [G['T%s'%j] for j in range(1, self._n)] + return [G['L1']] + [G['T%s' % j] for j in range(1, self._n)] if i == 0: return G['L1'] - return G['T%s'%i] + return G['T%s' % i] def L(self, i=None): r""" @@ -759,10 +759,10 @@ def L(self, i=None): if i is None: if self._r == 1: return [self._Li_power(j, 1) for j in range(1, self._n+1)] - return [G['L%s'%j] for j in range(1, self._n+1)] + return [G['L%s' % j] for j in range(1, self._n+1)] if self._r == 1: return self._Li_power(i, 1) - return G['L%s'%i] + return G['L%s' % i] @cached_method def product_on_basis(self, m1, m2): @@ -1179,7 +1179,7 @@ def __init__(self, algebra): sage: TestSuite(T).run() # long time """ _Basis.__init__(self, algebra, prefix='T') - self._assign_names(['T%s'%i for i in range(self._n)]) + self._assign_names(['T%s' % i for i in range(self._n)]) def _repr_term(self, t): r""" @@ -1200,7 +1200,7 @@ def _repr_term(self, t): if len(redword) == 0: return "1" return (self._print_options['prefix'] - + '[%s]'%','.join('%d'%i for i in redword)) + + '[%s]' % ','.join('%d' % i for i in redword)) def _latex_term(self, t): r""" @@ -1220,7 +1220,7 @@ def _latex_term(self, t): redword += t[1].reduced_word() if len(redword) == 0: return "1" - return ''.join("%s_{%d}"%(self._print_options['prefix'], i) + return ''.join("%s_{%d}" % (self._print_options['prefix'], i) for i in redword) def _from_LT_basis(self, m): diff --git a/src/sage/algebras/lie_algebras/classical_lie_algebra.py b/src/sage/algebras/lie_algebras/classical_lie_algebra.py index 26e0153a309..a2bb531abe0 100644 --- a/src/sage/algebras/lie_algebras/classical_lie_algebra.py +++ b/src/sage/algebras/lie_algebras/classical_lie_algebra.py @@ -345,7 +345,7 @@ def set_row(mat, row, val): def build_assoc(row): ret = {} for i, v in row.dict().items(): - ret[i//m, i%m] = v + ret[i//m, i % m] = v return self._assoc(ret) while added: @@ -1124,7 +1124,7 @@ def __init__(self, R, cartan_type): dim = self._classical.dimension() from sage.sets.finite_enumerated_set import FiniteEnumeratedSet index_set = FiniteEnumeratedSet(range(dim)) - names = tuple(['CR%s'%s for s in range(dim)]) + names = tuple(['CR%s' % s for s in range(dim)]) category = LieAlgebras(R).FiniteDimensional().WithBasis() FinitelyGeneratedLieAlgebra.__init__(self, R, names=names, index_set=index_set, diff --git a/src/sage/algebras/lie_algebras/free_lie_algebra.py b/src/sage/algebras/lie_algebras/free_lie_algebra.py index 207f8d63a8c..60d49a174b6 100644 --- a/src/sage/algebras/lie_algebras/free_lie_algebra.py +++ b/src/sage/algebras/lie_algebras/free_lie_algebra.py @@ -713,7 +713,7 @@ def _rewrite_bracket(self, l, r): sage: Lyn([x, [y, [z, x]]]) # indirect doctest [x, [[x, z], y]] """ - assert l < r, "Order mismatch %s > %s"%(l, r) + assert l < r, "Order mismatch %s > %s" % (l, r) if self._is_basis_element(l, r): # Compute the grade of the new element diff --git a/src/sage/algebras/lie_algebras/heisenberg.py b/src/sage/algebras/lie_algebras/heisenberg.py index 629fb0a8306..c75152adb98 100644 --- a/src/sage/algebras/lie_algebras/heisenberg.py +++ b/src/sage/algebras/lie_algebras/heisenberg.py @@ -58,7 +58,7 @@ def p(self, i): sage: L.p(2) p2 """ - return self.element_class(self, {'p%i'%i: self.base_ring().one()}) + return self.element_class(self, {'p%i' % i: self.base_ring().one()}) def q(self, i): """ @@ -70,7 +70,7 @@ def q(self, i): sage: L.q(2) q2 """ - return self.element_class(self, {'q%i'%i: self.base_ring().one()}) + return self.element_class(self, {'q%i' % i: self.base_ring().one()}) def z(self): """ @@ -138,7 +138,7 @@ def _latex_term(self, m): """ if len(m) == 1: return m - return "%s_{%s}"%(m[0], m[1:]) # else it is of length at least 2 + return "%s_{%s}" % (m[0], m[1:]) # else it is of length at least 2 def _unicode_art_term(self, m): r""" @@ -261,12 +261,12 @@ def lie_algebra_generators(self): """ if self._n == 0: return Family(['z'], lambda i: self.z()) - k = ['p%s'%i for i in range(1, self._n+1)] - k += ['q%s'%i for i in range(1, self._n+1)] + k = ['p%s' % i for i in range(1, self._n+1)] + k += ['q%s' % i for i in range(1, self._n+1)] d = {} for i in range(1, self._n+1): - d['p%s'%i] = self.p(i) - d['q%s'%i] = self.q(i) + d['p%s' % i] = self.p(i) + d['q%s' % i] = self.q(i) return Family(k, lambda i: d[i]) @cached_method @@ -282,8 +282,8 @@ def basis(self): """ d = {} for i in range(1, self._n+1): - d['p%s'%i] = self.p(i) - d['q%s'%i] = self.q(i) + d['p%s' % i] = self.p(i) + d['q%s' % i] = self.q(i) d['z'] = self.z() return Family(self._indices, lambda i: d[i]) @@ -385,8 +385,8 @@ def __init__(self, R, n): sage: TestSuite(L).run() """ HeisenbergAlgebra_fd.__init__(self, n) - names = tuple(['p%s'%i for i in range(1,n+1)] - + ['q%s'%i for i in range(1,n+1)] + names = tuple(['p%s' % i for i in range(1,n+1)] + + ['q%s' % i for i in range(1,n+1)] + ['z']) LieAlgebraWithGenerators.__init__(self, R, names=names, index_set=names, category=LieAlgebras(R).Nilpotent().FiniteDimensional().WithBasis()) @@ -687,8 +687,8 @@ def __init__(self, R, n): p = tuple(MS({(0,i): one}) for i in range(1, n+1)) q = tuple(MS({(i,n+1): one}) for i in range(1, n+1)) z = (MS({(0,n+1): one}),) - names = tuple('p%s'%i for i in range(1,n+1)) - names = names + tuple('q%s'%i for i in range(1,n+1)) + ('z',) + names = tuple('p%s' % i for i in range(1,n+1)) + names = names + tuple('q%s' % i for i in range(1,n+1)) + ('z',) cat = LieAlgebras(R).Nilpotent().FiniteDimensional().WithBasis() LieAlgebraFromAssociative.__init__(self, MS, p + q + z, names=names, index_set=names, category=cat) @@ -716,7 +716,7 @@ def p(self, i): [0 0 0] [0 0 0] """ - return self._gens['p%s'%i] + return self._gens['p%s' % i] def q(self, i): r""" @@ -730,7 +730,7 @@ def q(self, i): [0 0 1] [0 0 0] """ - return self._gens['q%s'%i] + return self._gens['q%s' % i] def z(self): """ diff --git a/src/sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py index 31b542cd373..8cc6533b781 100644 --- a/src/sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py @@ -111,7 +111,7 @@ def __init__(self, R, ngens=None, gram_matrix=None, names=None, latex_names = None if (names is None) and (index_set is None): - if ngens==1: + if ngens == 1: names = 'psi' else: names = 'psi_' diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py index 5c14016eab2..1007488e165 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py @@ -328,10 +328,10 @@ def __classcall_private__(cls, R=None, arg0=None, index_set=None, 'string_quotes', 'sorting_key', 'graded', 'super'] for key in kwds: if key not in known_keywords: - raise ValueError("got an unexpected keyword argument '%s'"%key) + raise ValueError("got an unexpected keyword argument '%s'" % key) if isinstance(arg0,dict) and arg0: - graded=kwds.pop("graded", False) + graded = kwds.pop("graded", False) if weights is not None or graded: from .graded_lie_conformal_algebra import \ GradedLieConformalAlgebra 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 a4669506314..e8b7ac2a9c6 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 @@ -152,11 +152,11 @@ def _standardize_s_coeff(s_coeff, index_set, ce, parity=None): #e.g. v = { 0: { (L,2):3, (G,3):1}, 1:{(L,1),2} } v = s_coeff[mypair] key = tuple(mypair) - vals={} + vals = {} for l in v.keys(): lth_product = {k:y for k,y in v[l].items() if y} if lth_product: - vals[l]=lth_product + vals[l] = lth_product myvals = tuple((k, tuple(v.items())) for k, v in vals.items() if v) @@ -175,7 +175,7 @@ def _standardize_s_coeff(s_coeff, index_set, ce, parity=None): else: parsgn = 1 maxpole = max(v.keys()) - vals={} + vals = {} for k in range(maxpole+1): kth_product = {} for j in range(maxpole+1-k): @@ -185,11 +185,11 @@ def _standardize_s_coeff(s_coeff, index_set, ce, parity=None): i[0] in ce and i[1] + j == 0): kth_product[(i[0],i[1]+j)] = \ kth_product.get((i[0], i[1]+j), 0) - kth_product[(i[0],i[1]+j)] += parsgn*\ + kth_product[(i[0],i[1]+j)] += parsgn *\ v[k+j][i]*(-1)**(k+j+1)*binomial(i[1]+j,j) kth_product = {k:v for k,v in kth_product.items() if v} if kth_product: - vals[k]=kth_product + vals[k] = kth_product myvals = tuple((k, tuple(v.items())) for k, v in vals.items() if v) @@ -214,7 +214,7 @@ def __init__(self, R, s_coeff, index_set=None, central_elements=None, """ names, index_set = standardize_names_index_set(names,index_set) if central_elements is None: - central_elements= tuple() + central_elements = tuple() if names is not None and names != tuple(index_set): names2 = names + tuple(central_elements) @@ -266,14 +266,14 @@ def __init__(self, R, s_coeff, index_set=None, central_elements=None, category = default_category.or_subcategory(category) if element_class is None: - element_class=LCAStructureCoefficientsElement + element_class = LCAStructureCoefficientsElement FinitelyFreelyGeneratedLCA.__init__( self, R, index_set=index_set, central_elements=central_elements, category=category, element_class=element_class, prefix=prefix, names=names, latex_names=latex_names, **kwds) - s_coeff=dict(s_coeff) + s_coeff = dict(s_coeff) self._s_coeff = Family({k: tuple((j, sum(c*self.monomial(i) for i,c in v )) for j,v in s_coeff[k]) for k in s_coeff}) self._parity = dict(zip(self.gens(),parity+(0,)*len(central_elements))) diff --git a/src/sage/algebras/nil_coxeter_algebra.py b/src/sage/algebras/nil_coxeter_algebra.py index 5d255b9786d..1c3b76bc450 100644 --- a/src/sage/algebras/nil_coxeter_algebra.py +++ b/src/sage/algebras/nil_coxeter_algebra.py @@ -112,7 +112,7 @@ def homogeneous_generator_noncommutative_variables(self, r): 1 """ - assert (len(self._cartan_type) == 2 and self._cartan_type[0] in ['A','B']) or (len(self._cartan_type) == 3 and self._cartan_type[2] == 1), "Analogue of symmetric functions in noncommutative variables is not defined in type %s"%(self._cartan_type) + assert (len(self._cartan_type) == 2 and self._cartan_type[0] in ['A','B']) or (len(self._cartan_type) == 3 and self._cartan_type[2] == 1), "Analogue of symmetric functions in noncommutative variables is not defined in type %s" % (self._cartan_type) if r >= self._n: return self.zero() return self.sum_of_monomials(w for w in self._W.pieri_factors() if w.length() == r) @@ -182,9 +182,9 @@ def k_schur_noncommutative_variables(self, la): """ - assert self._cartan_type[0] == 'A' and len(self._cartan_type) == 3 and self._cartan_type[2] == 1, "%s is not affine type A."%(self._W) - assert la in Partitions(), "%s is not a partition."%(la) - assert (len(la) == 0 or la[0] < self._W.n), "%s is not a %s-bounded partition."%(la, self._W.n-1) + assert self._cartan_type[0] == 'A' and len(self._cartan_type) == 3 and self._cartan_type[2] == 1, "%s is not affine type A." % (self._W) + assert la in Partitions(), "%s is not a partition." % (la) + assert (len(la) == 0 or la[0] < self._W.n), "%s is not a %s-bounded partition." % (la, self._W.n-1) Sym = SymmetricFunctions(self._base_ring) h = Sym.homogeneous() ks = Sym.kschur(self._n-1,1) diff --git a/src/sage/algebras/orlik_solomon.py b/src/sage/algebras/orlik_solomon.py index 52dae24fee3..920056787c6 100644 --- a/src/sage/algebras/orlik_solomon.py +++ b/src/sage/algebras/orlik_solomon.py @@ -502,7 +502,7 @@ def as_gca(self): for j in indices: if j != i: mon *= A.gen(j) - rel += sign *mon + rel += sign * mon sign = -sign rels.append(rel) I = A.ideal(rels) diff --git a/src/sage/algebras/quantum_clifford.py b/src/sage/algebras/quantum_clifford.py index 5079283e8ec..860b7e14830 100644 --- a/src/sage/algebras/quantum_clifford.py +++ b/src/sage/algebras/quantum_clifford.py @@ -288,14 +288,14 @@ def algebra_generators(self): for i in range(self._n): r = list(zero) # Make a copy r[i] = 1 - d['psi%s'%i] = self.monomial( (self._psi(r), one) ) + d['psi%s' % i] = self.monomial( (self._psi(r), one) ) r[i] = -1 - d['psid%s'%i] = self.monomial( (self._psi(r), one) ) + d['psid%s' % i] = self.monomial( (self._psi(r), one) ) zero = self._psi(zero) for i in range(self._n): temp = list(zero) # Make a copy temp[i] = 1 - d['w%s'%i] = self.monomial( (zero, tuple(temp)) ) + d['w%s' % i] = self.monomial( (zero, tuple(temp)) ) return Family(sorted(d), lambda i: d[i]) @cached_method @@ -397,10 +397,10 @@ def _repr_term(self, m): 5 """ p, v = m - rp = '*'.join('psi%s'%i if p[i] > 0 else 'psid%s'%i + rp = '*'.join('psi%s' % i if p[i] > 0 else 'psid%s' % i for i in range(self._n) if p[i] != 0) - gen_str = lambda e: '' if e == 1 else '^%s'%e - rv = '*'.join('w%s'%i + gen_str(v[i]) for i in range(self._n) if v[i] != 0) + gen_str = lambda e: '' if e == 1 else '^%s' % e + rv = '*'.join('w%s' % i + gen_str(v[i]) for i in range(self._n) if v[i] != 0) if rp: if rv: return rp + '*' + rv @@ -429,10 +429,10 @@ def _latex_term(self, m): 5 """ p, v = m - rp = ''.join('\\psi_{%s}'%i if p[i] > 0 else '\\psi^{\\dagger}_{%s}'%i + rp = ''.join('\\psi_{%s}' % i if p[i] > 0 else '\\psi^{\\dagger}_{%s}' % i for i in range(self._n) if p[i] != 0) - gen_str = lambda e: '' if e == 1 else '^{%s}'%e - rv = ''.join('\\omega_{%s}'%i + gen_str(v[i]) + gen_str = lambda e: '' if e == 1 else '^{%s}' % e + rv = ''.join('\\omega_{%s}' % i + gen_str(v[i]) for i in range(self._n) if v[i] != 0) if not rp and not rv: return '1' @@ -700,15 +700,15 @@ def _repr_term(self, m): def ppr(i): val = p[i] if val == -1: - return 'psid%s'%i + return 'psid%s' % i elif val == 1: - return 'psi%s'%i + return 'psi%s' % i elif val == 2: - return 'psi%s*psid%s'%(i,i) + return 'psi%s*psid%s' % (i,i) rp = '*'.join(ppr(i) for i in range(self._n) if p[i] != 0) - gen_str = lambda e: '' if e == 1 else '^%s'%e - rv = '*'.join('w%s'%i + gen_str(v[i]) for i in range(self._n) if v[i] != 0) + gen_str = lambda e: '' if e == 1 else '^%s' % e + rv = '*'.join('w%s' % i + gen_str(v[i]) for i in range(self._n) if v[i] != 0) if rp: if rv: return rp + '*' + rv @@ -741,15 +741,15 @@ def _latex_term(self, m): def ppr(i): val = p[i] if val == -1: - return '\\psi^{\\dagger}_{%s}'%i + return '\\psi^{\\dagger}_{%s}' % i elif val == 1: - return '\\psi_{%s}'%i + return '\\psi_{%s}' % i elif val == 2: return '\\psi_{%s}\\psi^{\\dagger}_{%s}' % (i, i) rp = ''.join(ppr(i) for i in range(self._n) if p[i] != 0) - gen_str = lambda e: '' if e == 1 else '^{%s}'%e - rv = ''.join('\\omega_{%s}'%i + gen_str(v[i]) + gen_str = lambda e: '' if e == 1 else '^{%s}' % e + rv = ''.join('\\omega_{%s}' % i + gen_str(v[i]) for i in range(self._n) if v[i] != 0) if not rp and not rv: return '1' @@ -875,7 +875,7 @@ def key(X): return (self._psi(p), tuple(e)) q = self._q - ret = {key(X): (-1)**len(X) * sign * q**(q_power+k*(len(pairings)%2)) + ret = {key(X): (-1)**len(X) * sign * q**(q_power+k*(len(pairings) % 2)) for X in powerset(pairings)} return self._from_dict(ret) diff --git a/src/sage/algebras/splitting_algebra.py b/src/sage/algebras/splitting_algebra.py index 08a4992d48a..3b0dfce4586 100644 --- a/src/sage/algebras/splitting_algebra.py +++ b/src/sage/algebras/splitting_algebra.py @@ -332,10 +332,10 @@ def __init__(self, monic_polynomial, names='X', iterate=True, warning=True): try: cf0_inv = ~(cf[0]) cf0_inv = self(cf0_inv) - verbose("invertible coefficient: %s found" %(cf0_inv)) + verbose("invertible coefficient: %s found" % (cf0_inv)) break except NotImplementedError: - verbose("constant coefficient: %s not invertibe" %(cf0)) + verbose("constant coefficient: %s not invertibe" % (cf0)) # ------------------------------------------------------------------ # assuming that cf splits into linear factors over self diff --git a/src/sage/algebras/steenrod/steenrod_algebra_bases.py b/src/sage/algebras/steenrod/steenrod_algebra_bases.py index f028e6d5df5..c289b284fe1 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra_bases.py +++ b/src/sage/algebras/steenrod/steenrod_algebra_bases.py @@ -834,12 +834,12 @@ def degree_dictionary(n, basis): """ dict = {} if basis.find('wood') >= 0: - k=0 - m=0 + k = 0 + m = 0 deg = 2**m * (2**(k+1) - 1) while deg <= n: dict[deg] = (m,k) - if m>0: + if m > 0: m = m - 1 k = k + 1 else: @@ -847,8 +847,8 @@ def degree_dictionary(n, basis): k = 0 deg = 2**m * (2**(k+1) - 1) elif basis.find('wall') >= 0 or basis.find('arnon') >= 0: - k=0 - m=0 + k = 0 + m = 0 deg = 2**k * (2**(m-k+1) - 1) while deg <= n: dict[deg] = (m,k) @@ -859,8 +859,8 @@ def degree_dictionary(n, basis): k = k - 1 deg = 2**k * (2**(m-k+1) - 1) elif basis.find('pst') >= 0 or basis.find('comm') >= 0: - s=0 - t=1 + s = 0 + t = 1 deg = 2**s * (2**t - 1) while deg <= n: if basis.find('pst') >= 0: @@ -1128,7 +1128,7 @@ def steenrod_basis_error_check(dim, p, **kwds): for i in range(dim): if i % 5 == 0: - verbose("up to dimension %s"%i) + verbose("up to dimension %s" % i) milnor_dim = len(steenrod_algebra_basis.f(i,'milnor',p=p,generic=generic)) for B in bases: if milnor_dim != len(steenrod_algebra_basis.f(i,B,p,generic=generic)): @@ -1147,7 +1147,7 @@ def steenrod_basis_error_check(dim, p, **kwds): for i in range(dim): if i % 5 == 0: - verbose("up to dimension %s"%i) + verbose("up to dimension %s" % i) for pro in profiles: milnor_dim = len(steenrod_algebra_basis.f(i,'milnor',p=p,profile=pro,generic=generic)) for B in bases: diff --git a/src/sage/algebras/steenrod/steenrod_algebra_misc.py b/src/sage/algebras/steenrod/steenrod_algebra_misc.py index d8fedad70b8..91ab657a84f 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra_misc.py +++ b/src/sage/algebras/steenrod/steenrod_algebra_misc.py @@ -177,7 +177,7 @@ def get_basis_name(basis, p, generic=None): if basis.find('long') >= 0: result = result + '_long' else: - gencase = " for the generic Steenrod algebra" if p==2 and generic else "" + gencase = " for the generic Steenrod algebra" if p == 2 and generic else "" raise ValueError("%s is not a recognized basis%s at the prime %s" % (basis, gencase, p)) return result diff --git a/src/sage/algebras/yokonuma_hecke_algebra.py b/src/sage/algebras/yokonuma_hecke_algebra.py index 700395a2d84..df474b8d4f7 100644 --- a/src/sage/algebras/yokonuma_hecke_algebra.py +++ b/src/sage/algebras/yokonuma_hecke_algebra.py @@ -183,7 +183,7 @@ def _latex_(self): sage: latex(Y) \mathcal{Y}_{5,2}(q) """ - return "\\mathcal{Y}_{%s,%s}(%s)"%(self._d, self._n, self._q) + return "\\mathcal{Y}_{%s,%s}(%s)" % (self._d, self._n, self._q) def _repr_term(self, m): """ @@ -195,8 +195,8 @@ def _repr_term(self, m): sage: Y._repr_term( ((1, 0, 2), Permutation([3,2,1])) ) 't1*t3^2*g[2,1,2]' """ - gen_str = lambda e: '' if e == 1 else '^%s'%e - lhs = '*'.join('t%s'%(j+1) + gen_str(i) for j,i in enumerate(m[0]) if i > 0) + gen_str = lambda e: '' if e == 1 else '^%s' % e + lhs = '*'.join('t%s' % (j+1) + gen_str(i) for j,i in enumerate(m[0]) if i > 0) redword = m[1].reduced_word() if not redword: if not lhs: @@ -217,14 +217,14 @@ def _latex_term(self, m): sage: Y._latex_term( ((1, 0, 2), Permutation([3,2,1])) ) 't_{1} t_{3}^2 g_{2} g_{1} g_{2}' """ - gen_str = lambda e: '' if e == 1 else '^%s'%e - lhs = ' '.join('t_{%s}'%(j+1) + gen_str(i) for j,i in enumerate(m[0]) if i > 0) + gen_str = lambda e: '' if e == 1 else '^%s' % e + lhs = ' '.join('t_{%s}' % (j+1) + gen_str(i) for j,i in enumerate(m[0]) if i > 0) redword = m[1].reduced_word() if not redword: if not lhs: return '1' return lhs - return lhs + ' ' + ' '.join("g_{%d}"%i for i in redword) + return lhs + ' ' + ' '.join("g_{%d}" % i for i in redword) @cached_method def algebra_generators(self): @@ -243,10 +243,10 @@ def algebra_generators(self): for i in range(self._n): r = list(zero) # Make a copy r[i] = 1 - d['t%s'%(i+1)] = self.monomial( (tuple(r), one) ) + d['t%s' % (i+1)] = self.monomial( (tuple(r), one) ) G = self._Pn.group_generators() for i in range(1, self._n): - d['g%s'%i] = self.monomial( (tuple(zero), G[i]) ) + d['g%s' % i] = self.monomial( (tuple(zero), G[i]) ) return Family(sorted(d), lambda i: d[i]) @cached_method @@ -323,8 +323,8 @@ def g(self, i=None): """ G = self.algebra_generators() if i is None: - return [G['g%s'%i] for i in range(1, self._n)] - return G['g%s'%i] + return [G['g%s' % i] for i in range(1, self._n)] + return G['g%s' % i] def t(self, i=None): """ @@ -345,8 +345,8 @@ def t(self, i=None): """ G = self.algebra_generators() if i is None: - return [G['t%s'%i] for i in range(1, self._n+1)] - return G['t%s'%i] + return [G['t%s' % i] for i in range(1, self._n+1)] + return G['t%s' % i] def product_on_basis(self, m1, m2): """ @@ -488,7 +488,7 @@ def __invert__(self): if not self: raise ZeroDivisionError if len(self) != 1: - raise NotImplementedError("inverse only implemented for basis elements (monomials in the generators)"%self) + raise NotImplementedError("inverse only implemented for basis elements (monomials in the generators)" % self) H = self.parent() t,w = self.support_of_term() c = ~self.coefficients()[0] From a48893b451ba5c40b65bb38349dfb12aaed5cb7f Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sun, 3 Sep 2023 09:44:22 +0200 Subject: [PATCH 400/423] review comments --- src/sage/graphs/isgci.py | 4 ++-- src/sage/misc/rest_index_of_methods.py | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/sage/graphs/isgci.py b/src/sage/graphs/isgci.py index 2ec23b13afa..e19c4a8103e 100644 --- a/src/sage/graphs/isgci.py +++ b/src/sage/graphs/isgci.py @@ -135,8 +135,8 @@ * - Apex - - :meth:`~sage.graphs.graph.Graph.is_apex()`, - :meth:`~sage.graphs.graph.Graph.apex_vertices()` + - :meth:`~sage.graphs.graph.Graph.is_apex`, + :meth:`~sage.graphs.graph.Graph.apex_vertices` * - AT_free diff --git a/src/sage/misc/rest_index_of_methods.py b/src/sage/misc/rest_index_of_methods.py index f425b9bdcf9..d1b102829c9 100644 --- a/src/sage/misc/rest_index_of_methods.py +++ b/src/sage/misc/rest_index_of_methods.py @@ -47,7 +47,7 @@ def gen_rest_table_index(obj, names=None, sort=True, only_local_functions=True, - ``root`` -- module or class (default: ``None``); the module, or class, whose elements are to be listed. This is needed to recover the class when this method is called from :meth:`gen_thematic_rest_table_index` (see - :trac:`36178`). + :issue:`36178`). .. WARNING:: @@ -76,7 +76,7 @@ def gen_rest_table_index(obj, names=None, sort=True, only_local_functions=True, :func:`~sage.misc.rest_index_of_methods.doc_index` @ Attribute an index name to a function. :func:`~sage.misc.rest_index_of_methods.gen_rest_table_index` @ Return a ReST table describing a list of functions. - :func:`~sage.misc.rest_index_of_methods.gen_thematic_rest_table_index` @ Return a ReST string of thematically sorted function (or methods) of a module (or class). + :func:`~sage.misc.rest_index_of_methods.gen_thematic_rest_table_index` @ Return a ReST string of thematically sorted functions (or methods) of a module (or class). :func:`~sage.misc.rest_index_of_methods.list_of_subfunctions` @ Return the functions (resp. methods) of a given module (resp. class) with their names. @@ -129,7 +129,7 @@ def gen_rest_table_index(obj, names=None, sort=True, only_local_functions=True, :func:`~sage.misc.rest_index_of_methods.doc_index` @ Attribute an index name to a function. :func:`~sage.misc.rest_index_of_methods.gen_rest_table_index` @ Return a ReST table describing a list of functions. - :func:`~sage.misc.rest_index_of_methods.gen_thematic_rest_table_index` @ Return a ReST string of thematically sorted function (or methods) of a module (or class). + :func:`~sage.misc.rest_index_of_methods.gen_thematic_rest_table_index` @ Return a ReST string of thematically sorted functions (or methods) of a module (or class). :func:`~sage.misc.rest_index_of_methods.list_of_subfunctions` @ Return the functions (resp. methods) of a given module (resp. class) with their names. @@ -140,7 +140,7 @@ def gen_rest_table_index(obj, names=None, sort=True, only_local_functions=True, :delim: @ :func:`~sage.misc.rest_index_of_methods.doc_index` @ Attribute an index name to a function. - :func:`~sage.misc.rest_index_of_methods.gen_thematic_rest_table_index` @ Return a ReST string of thematically sorted function (or methods) of a module (or class). + :func:`~sage.misc.rest_index_of_methods.gen_thematic_rest_table_index` @ Return a ReST string of thematically sorted functions (or methods) of a module (or class). :func:`~sage.misc.rest_index_of_methods.list_of_subfunctions` @ Return the functions (resp. methods) of a given module (resp. class) with their names. @@ -153,7 +153,7 @@ def gen_rest_table_index(obj, names=None, sort=True, only_local_functions=True, sage: 'all_max_cliques`' in gen_rest_table_index(Graph) # needs sage.graphs False - Check that :trac:`36178` is fixed:: + Check that :issue:`36178` is fixed:: sage: print(gen_rest_table_index(Graph)) # needs sage.graphs ... @@ -301,7 +301,7 @@ def can_import(f): def gen_thematic_rest_table_index(root, additional_categories=None, only_local_functions=True): r""" - Return a ReST string of thematically sorted function (or methods) of a + Return a ReST string of thematically sorted functions (or methods) of a module (or class). INPUT: @@ -374,4 +374,5 @@ def hey(f): return hey -__doc__ = __doc__.format(INDEX_OF_FUNCTIONS=gen_rest_table_index([gen_rest_table_index])) +__doc__ = __doc__.format(INDEX_OF_FUNCTIONS=gen_rest_table_index([gen_rest_table_index, + gen_thematic_rest_table_index])) From bc7e9cf7fe39bbeebd61ad06d863a527762e1579 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sun, 3 Sep 2023 15:13:26 +0200 Subject: [PATCH 401/423] fix doctest warnings in sage/misc/sageinspect.py --- src/sage/misc/sageinspect.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py index ce5e9987027..88ac75ea843 100644 --- a/src/sage/misc/sageinspect.py +++ b/src/sage/misc/sageinspect.py @@ -1614,7 +1614,8 @@ def foo(x, a='\')"', b={not (2+1==3):'bar'}): return The following was fixed in :trac:`16309`:: - sage: cython( # needs sage.misc.cython + sage: # needs sage.misc.cython + sage: cython( ....: ''' ....: class Foo: ....: @staticmethod From bcd71cd3713146b3c13242913aa73fec78e66e76 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 3 Sep 2023 10:14:59 -0400 Subject: [PATCH 402/423] src/sage/tests: fix another "Computational Math..." doctest One doctest for the Computational Math book fails for me, Failed example: limit(f(t * cos(theta), t * sin(theta)) / t, t=0) Expected: cos(theta)^2/sin(theta) Got: -1/2*(sin(3*theta) + sin(theta))/(cos(2*theta) - 1) These results are equivalent, and the ugly one simplifies to the pretty one. We add a full_simplify() to the test to support both outputs. The discrepancy is most likely due to the version of Giac installed on the system. --- .../graphique_doctest.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py b/src/sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py index aa153fd4cd5..492dd659ee6 100644 --- a/src/sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py +++ b/src/sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py @@ -215,11 +215,13 @@ sage: plot3d(h, (u,-1,1), (v,-1,1), aspect_ratio=[1,1,1]) Graphics3d Object -Sage example in ./graphique.tex, line 1833:: +Sage example in ./graphique.tex, line 1833. Sometimes the result +needs to be simplified to obtain a nice short expression:: sage: f(x, y) = x^2 * y / (x^4 + y^2) sage: t, theta = var('t, theta') - sage: limit(f(t * cos(theta), t * sin(theta)) / t, t=0) + sage: result = limit(f(t * cos(theta), t * sin(theta)) / t, t=0) + sage: result.full_simplify() cos(theta)^2/sin(theta) Sage example in ./graphique.tex, line 1847:: From 2e1c2bccc70e7bcc431c6083874a04eae3ed4d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 3 Sep 2023 17:51:58 +0200 Subject: [PATCH 403/423] Update nil_coxeter_algebra.py --- src/sage/algebras/nil_coxeter_algebra.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sage/algebras/nil_coxeter_algebra.py b/src/sage/algebras/nil_coxeter_algebra.py index 1c3b76bc450..862fdc3b97e 100644 --- a/src/sage/algebras/nil_coxeter_algebra.py +++ b/src/sage/algebras/nil_coxeter_algebra.py @@ -110,16 +110,18 @@ def homogeneous_generator_noncommutative_variables(self, r): 0 sage: U.homogeneous_generator_noncommutative_variables(0) 1 - """ - assert (len(self._cartan_type) == 2 and self._cartan_type[0] in ['A','B']) or (len(self._cartan_type) == 3 and self._cartan_type[2] == 1), "Analogue of symmetric functions in noncommutative variables is not defined in type %s" % (self._cartan_type) + ct = self._cartan_type + msg = f"Analogue of symmetric functions in noncommutative variables is not defined in type {ct}" + assert (len(ct) == 2 and ct[0] in ['A', 'B']) or (len(ct) == 3 and ct[2] == 1), msg if r >= self._n: return self.zero() return self.sum_of_monomials(w for w in self._W.pieri_factors() if w.length() == r) - def homogeneous_noncommutative_variables(self,la): + def homogeneous_noncommutative_variables(self, la): r""" Give the homogeneous function indexed by `la`, viewed inside the Nil-Coxeter algebra. + This is only defined in finite type `A`, `B` and affine types `A^{(1)}`, `B^{(1)}`, `C^{(1)}`, `D^{(1)}`. INPUT: From ccf8400fec2e48bdc702ba96e3daf0877c2c4629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 3 Sep 2023 17:55:36 +0200 Subject: [PATCH 404/423] Update quantum_clifford.py --- src/sage/algebras/quantum_clifford.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/algebras/quantum_clifford.py b/src/sage/algebras/quantum_clifford.py index 860b7e14830..2b85615cf20 100644 --- a/src/sage/algebras/quantum_clifford.py +++ b/src/sage/algebras/quantum_clifford.py @@ -288,14 +288,14 @@ def algebra_generators(self): for i in range(self._n): r = list(zero) # Make a copy r[i] = 1 - d['psi%s' % i] = self.monomial( (self._psi(r), one) ) + d['psi%s' % i] = self.monomial((self._psi(r), one)) r[i] = -1 - d['psid%s' % i] = self.monomial( (self._psi(r), one) ) + d['psid%s' % i] = self.monomial((self._psi(r), one)) zero = self._psi(zero) for i in range(self._n): temp = list(zero) # Make a copy temp[i] = 1 - d['w%s' % i] = self.monomial( (zero, tuple(temp)) ) + d['w%s' % i] = self.monomial((zero, tuple(temp))) return Family(sorted(d), lambda i: d[i]) @cached_method From 78b34d28874db6954f54d11198652f7297ea1746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 3 Sep 2023 18:01:23 +0200 Subject: [PATCH 405/423] Update lie_conformal_algebra_with_structure_coefs.py --- ...lie_conformal_algebra_with_structure_coefs.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 e8b7ac2a9c6..7581daf0ddb 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 @@ -160,7 +160,7 @@ def _standardize_s_coeff(s_coeff, index_set, ce, parity=None): 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): + if key in sc and sorted(sc[key]) != sorted(myvals): raise ValueError("two distinct values given for one " "and the same bracket, skew-symmetry" "is not satisfied?") @@ -182,18 +182,18 @@ def _standardize_s_coeff(s_coeff, index_set, ce, parity=None): if k+j in v.keys(): for i in v[k+j]: if (i[0] not in ce) or ( - i[0] in ce and i[1] + j == 0): - kth_product[(i[0],i[1]+j)] = \ - kth_product.get((i[0], i[1]+j), 0) - kth_product[(i[0],i[1]+j)] += parsgn *\ - v[k+j][i]*(-1)**(k+j+1)*binomial(i[1]+j,j) - kth_product = {k:v for k,v in kth_product.items() if v} + i[0] in ce and i[1] + j == 0): + kth_product[(i[0], i[1] + j)] = \ + kth_product.get((i[0], i[1] + j), 0) + kth_product[(i[0], i[1] + j)] += parsgn *\ + v[k+j][i]*(-1)**(k+j+1)*binomial(i[1]+j,j) + kth_product = {k: v for k, v in kth_product.items() if v} if kth_product: vals[k] = kth_product 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): + if key in sc and sorted(sc[key]) != sorted(myvals): raise ValueError("two distinct values given for one " "and the same bracket. " "Skew-symmetry is not satisfied?") From f495b38ef69f97a674249dbac9ce37701d6c80b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 4 Sep 2023 19:47:19 +0200 Subject: [PATCH 406/423] fix E228 and E225 in schemes/ --- .../elliptic_curves/ell_rational_field.py | 8 ++--- src/sage/schemes/elliptic_curves/padics.py | 4 +-- src/sage/schemes/generic/algebraic_scheme.py | 30 ++++++++--------- src/sage/schemes/generic/glue.py | 8 ++--- src/sage/schemes/generic/hypersurface.py | 10 +++--- src/sage/schemes/generic/morphism.py | 30 ++++++++--------- src/sage/schemes/generic/point.py | 8 ++--- .../hyperelliptic_finite_field.py | 32 +++++++++---------- .../hyperelliptic_curves/hyperelliptic_g2.py | 2 +- .../hyperelliptic_generic.py | 10 +++--- .../hyperelliptic_padic_field.py | 18 +++++------ .../hyperelliptic_rational_field.py | 2 +- .../jacobian_endomorphism_utils.py | 2 +- .../hyperelliptic_curves/jacobian_morphism.py | 6 ++-- .../schemes/hyperelliptic_curves/mestre.py | 2 +- .../schemes/jacobians/abstract_jacobian.py | 6 ++-- src/sage/schemes/plane_conics/con_field.py | 2 +- src/sage/schemes/product_projective/homset.py | 4 +-- .../schemes/product_projective/morphism.py | 8 ++--- src/sage/schemes/product_projective/point.py | 2 +- src/sage/schemes/product_projective/space.py | 28 ++++++++-------- .../schemes/product_projective/subscheme.py | 8 ++--- .../schemes/projective/projective_homset.py | 12 +++---- .../schemes/projective/projective_point.py | 8 ++--- .../projective/projective_subscheme.py | 12 +++---- 25 files changed, 131 insertions(+), 131 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py index 765485f0374..c329d757735 100644 --- a/src/sage/schemes/elliptic_curves/ell_rational_field.py +++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py @@ -3055,12 +3055,12 @@ def selmer_rank(self, algorithm="pari"): try: return self.__selmer_rank except AttributeError: - if algorithm=="pari": + if algorithm == "pari": ep = self.pari_curve() lower, upper, s, pts = ep.ellrank() tor = self.two_torsion_rank() return upper + tor + s - elif algorithm=="mwrank": + elif algorithm == "mwrank": C = self.mwrank_curve() self.__selmer_rank = C.selmer_rank() return self.__selmer_rank @@ -3110,11 +3110,11 @@ def rank_bound(self, algorithm="pari"): try: return self.__rank_bound except AttributeError: - if algorithm=="pari": + if algorithm == "pari": ep = self.pari_curve() lower, upper, s, pts = ep.ellrank() return upper - elif algorithm=="mwrank": + elif algorithm == "mwrank": C = self.mwrank_curve() self.__rank_bound = C.rank_bound() return self.__rank_bound diff --git a/src/sage/schemes/elliptic_curves/padics.py b/src/sage/schemes/elliptic_curves/padics.py index 51f7cc3db90..2264d998ef4 100644 --- a/src/sage/schemes/elliptic_curves/padics.py +++ b/src/sage/schemes/elliptic_curves/padics.py @@ -643,7 +643,7 @@ def _multiple_to_make_good_reduction(E): li = [] for p in ps: np = u.valuation(p) - if Emin.discriminant() %p != 0: + if Emin.discriminant() % p != 0: li.append(Emin.Np(p) * p**(np-1)) elif Emin.has_additive_reduction(p): li.append(E.tamagawa_number(p) * p**np) @@ -652,7 +652,7 @@ def _multiple_to_make_good_reduction(E): else: # non split li.append(E.tamagawa_number(p) * (p+1) * p**(np-1)) otherbad = Integer(Emin.discriminant()).prime_divisors() - otherbad = [p for p in otherbad if u%p != 0 ] + otherbad = [p for p in otherbad if u % p != 0 ] li += [E.tamagawa_number(p) for p in otherbad] n2 = LCM(li) return n2 diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index c1434b7c5b4..55699a9b3a0 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -530,7 +530,7 @@ def _repr_(self): sage: S._repr_() 'Subscheme of Projective Space of dimension 3 over Integer Ring' """ - return "Subscheme of %s"%self.__A + return "Subscheme of %s" % self.__A def _homset(self, *args, **kwds): """ @@ -821,11 +821,11 @@ def _check_satisfies_equations(self, v): coords = list(v) for f in self.__X.defining_polynomials(): if f(coords) != 0: - raise TypeError("Coordinates %s do not define a point on %s"%(v,self)) + raise TypeError("Coordinates %s do not define a point on %s" % (v,self)) for f in self.__Y.defining_polynomials(): if f(coords) != 0: return True - raise TypeError("Coordinates %s do not define a point on %s"%(v,self)) + raise TypeError("Coordinates %s do not define a point on %s" % (v,self)) def rational_points(self, **kwds): """ @@ -872,9 +872,9 @@ def rational_points(self, **kwds): if bound == 0: if is_RationalField(F): - raise TypeError("A positive bound (= %s) must be specified."%bound) + raise TypeError("A positive bound (= %s) must be specified." % bound) if not isinstance(F, FiniteField): - raise TypeError("Argument F (= %s) must be a finite field."%F) + raise TypeError("Argument F (= %s) must be a finite field." % F) pts = [] for P in self.ambient_space().rational_points(F): try: @@ -986,11 +986,11 @@ def _check_satisfies_equations(self, v): for f in self.defining_polynomials(): if f(coords) != 0: # it must be "!=0" instead of "if f(v)", e.g., # because of p-adic base rings. - raise TypeError("Coordinates %s do not define a point on %s"%(coords,self)) + raise TypeError("Coordinates %s do not define a point on %s" % (coords,self)) try: return self.ambient_space()._check_satisfies_equations(coords) except TypeError: - raise TypeError("Coordinates %s do not define a point on %s"%(coords,self)) + raise TypeError("Coordinates %s do not define a point on %s" % (coords,self)) def base_extend(self, R): """ @@ -1465,10 +1465,10 @@ def union(self, other): True """ if not isinstance(other, AlgebraicScheme_subscheme): - raise TypeError("other (=%s) must be a closed algebraic subscheme of an ambient space"%other) + raise TypeError("other (=%s) must be a closed algebraic subscheme of an ambient space" % other) A = self.ambient_space() if other.ambient_space() != A: - raise ValueError("other (=%s) must be in the same ambient space as self"%other) + raise ValueError("other (=%s) must be in the same ambient space as self" % other) return A.subscheme(self.defining_ideal().intersection(other.defining_ideal())) def __pow__(self, m): @@ -1649,10 +1649,10 @@ def intersection(self, other): y """ if not isinstance(other, AlgebraicScheme_subscheme): - raise TypeError("other (=%s) must be a closed algebraic subscheme of an ambient space"%other) + raise TypeError("other (=%s) must be a closed algebraic subscheme of an ambient space" % other) A = self.ambient_space() if other.ambient_space() != A: - raise ValueError("other (=%s) must be in the same ambient space as self"%other) + raise ValueError("other (=%s) must be in the same ambient space as self" % other) return A.subscheme(self.defining_ideal() + other.defining_ideal()) def complement(self, other=None): @@ -1708,9 +1708,9 @@ def complement(self, other=None): if other == A: other = A.subscheme([]) else: - raise TypeError("Argument other (=%s) must be a closed algebraic subscheme of an ambient space"%other) + raise TypeError("Argument other (=%s) must be a closed algebraic subscheme of an ambient space" % other) if other.ambient_space() != A: - raise ValueError("other (=%s) must be in the same ambient space as self"%other) + raise ValueError("other (=%s) must be in the same ambient space as self" % other) return AlgebraicScheme_quasi(other, self) def rational_points(self, **kwds): @@ -1831,7 +1831,7 @@ def rational_points(self, **kwds): try: return X.points(**kwds) # checks for proper bound done in points functions except TypeError: - raise TypeError("Unable to enumerate points over %s."%F) + raise TypeError("Unable to enumerate points over %s." % F) elif (self.base_ring() in NumberFields() or self.base_ring() == ZZ)\ and hasattr(F, 'precision'): #we are numerically approximating number field points @@ -1840,7 +1840,7 @@ def rational_points(self, **kwds): X = self.base_extend(F)(F) return X.points() except TypeError: - raise TypeError("Unable to enumerate points over %s."%F) + raise TypeError("Unable to enumerate points over %s." % F) def change_ring(self, R): r""" diff --git a/src/sage/schemes/generic/glue.py b/src/sage/schemes/generic/glue.py index d3169ba0116..76bd9a1ab9e 100644 --- a/src/sage/schemes/generic/glue.py +++ b/src/sage/schemes/generic/glue.py @@ -33,11 +33,11 @@ class GluedScheme(scheme.Scheme): def __init__(self, f, g, check=True): if check: if not morphism.is_SchemeMorphism(f): - raise TypeError("f (=%s) must be a scheme morphism"%f) + raise TypeError("f (=%s) must be a scheme morphism" % f) if not morphism.is_SchemeMorphism(g): - raise TypeError("g (=%s) must be a scheme morphism"%g) + raise TypeError("g (=%s) must be a scheme morphism" % g) if f.domain() != g.domain(): - raise ValueError("f (=%s) and g (=%s) must have the same domain"%(f,g)) + raise ValueError("f (=%s) and g (=%s) must have the same domain" % (f,g)) self.__f = f self.__g = g @@ -45,5 +45,5 @@ def gluing_maps(self): return self.__f, self.__g def _repr_(self): - return "Scheme obtained by gluing X and Y along U, where\n X: %s\n Y: %s\n U: %s"%( + return "Scheme obtained by gluing X and Y along U, where\n X: %s\n Y: %s\n U: %s" % ( self.__f.codomain(), self.__g.codomain(), self.__f.domain()) diff --git a/src/sage/schemes/generic/hypersurface.py b/src/sage/schemes/generic/hypersurface.py index fa2326d43e5..48070686a2d 100644 --- a/src/sage/schemes/generic/hypersurface.py +++ b/src/sage/schemes/generic/hypersurface.py @@ -94,9 +94,9 @@ def __init__(self, poly, ambient=None): True """ if not isinstance(poly, MPolynomial): - raise TypeError("Defining polynomial (=%s) must be a multivariate polynomial."%poly) + raise TypeError("Defining polynomial (=%s) must be a multivariate polynomial." % poly) if not poly.is_homogeneous(): - raise TypeError("Defining polynomial (=%s) must be homogeneous."%poly) + raise TypeError("Defining polynomial (=%s) must be homogeneous." % poly) if ambient is None: R = poly.parent() from sage.schemes.projective.projective_space import ProjectiveSpace @@ -119,7 +119,7 @@ def _repr_(self): sage: H._repr_() 'Projective hypersurface defined by y^2 + x*z in Projective Space of dimension 2 over Integer Ring' """ - return "Projective hypersurface defined by %s in %s"%( + return "Projective hypersurface defined by %s in %s" % ( self.defining_polynomial(), self.ambient_space()) def defining_polynomial(self): @@ -184,7 +184,7 @@ def __init__(self, poly, ambient=None): True """ if not isinstance(poly, MPolynomial): - raise TypeError("Defining polynomial (= %s) must be a multivariate polynomial"%poly) + raise TypeError("Defining polynomial (= %s) must be a multivariate polynomial" % poly) if ambient is None: R = poly.parent() from sage.schemes.affine.affine_space import AffineSpace @@ -207,7 +207,7 @@ def _repr_(self): sage: H._repr_() 'Affine hypersurface defined by y^2 + x*z in Affine Space of dimension 3 over Integer Ring' """ - return "Affine hypersurface defined by %s in %s"%( + return "Affine hypersurface defined by %s in %s" % ( self.defining_polynomial(), self.ambient_space()) def defining_polynomial(self): diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index 086c2960755..800ccee6e2b 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -165,7 +165,7 @@ def __init__(self, parent, codomain=None): if codomain is not None: parent = Hom(parent, codomain) if not isinstance(parent, Homset): - raise TypeError("parent (=%s) must be a Homspace"%parent) + raise TypeError("parent (=%s) must be a Homspace" % parent) Element.__init__(self, parent) self._codomain = parent.codomain() @@ -261,9 +261,9 @@ def __call__(self, x, *args, **kwds): try: x = D(x) except (TypeError, NotImplementedError): - raise TypeError("%s fails to convert into the map's domain %s, but a `pushforward` method is not properly implemented"%(x, self.domain())) - elif self.domain()!=x.codomain(): - raise TypeError("%s fails to convert into the map's domain %s, but a `pushforward` method is not properly implemented"%(x, self.domain())) + raise TypeError("%s fails to convert into the map's domain %s, but a `pushforward` method is not properly implemented" % (x, self.domain())) + elif self.domain() != x.codomain(): + raise TypeError("%s fails to convert into the map's domain %s, but a `pushforward` method is not properly implemented" % (x, self.domain())) else: x = converter(x) if not args and not kwds: @@ -330,14 +330,14 @@ def _repr_(self): NotImplementedError """ if self.is_endomorphism(): - s = "%s endomorphism of %s"%(self._repr_type(), self.domain()) + s = "%s endomorphism of %s" % (self._repr_type(), self.domain()) else: - s = "%s morphism:"%self._repr_type() - s += "\n From: %s"%self.domain() - s += "\n To: %s"%self._codomain + s = "%s morphism:" % self._repr_type() + s += "\n From: %s" % self.domain() + s += "\n To: %s" % self._codomain d = self._repr_defn() if d != '': - s += "\n Defn: %s"%('\n '.join(self._repr_defn().split('\n'))) + s += "\n Defn: %s" % ('\n '.join(self._repr_defn().split('\n'))) return s def __mul__(self, right): @@ -396,7 +396,7 @@ def __mul__(self, right): if not isinstance(right, SchemeMorphism): return coercion_model.bin_op(self, right, operator.mul) if right.codomain() != self.domain(): - raise TypeError("self (=%s) domain must equal right (=%s) codomain"%(self, right)) + raise TypeError("self (=%s) domain must equal right (=%s) codomain" % (self, right)) if isinstance(self, SchemeMorphism_id): return right if isinstance(right, SchemeMorphism_id): @@ -428,7 +428,7 @@ def __pow__(self, n, dummy=None): """ if not self.is_endomorphism(): raise TypeError("self must be an endomorphism.") - if n==0: + if n == 0: return self.domain().identity_morphism() return generic_power(self, n) @@ -995,11 +995,11 @@ def __init__(self, parent, polys, check=True): """ if check: if not isinstance(polys, (list, tuple)): - raise TypeError("polys (=%s) must be a list or tuple"%polys) + raise TypeError("polys (=%s) must be a list or tuple" % polys) source_ring = parent.domain().ambient_space().coordinate_ring() target = parent._codomain.ambient_space() if len(polys) != target.ngens(): - raise ValueError("there must be %s polynomials"%target.ngens()) + raise ValueError("there must be %s polynomials" % target.ngens()) F = [] for poly in polys: try: @@ -1011,7 +1011,7 @@ def __init__(self, parent, polys, check=True): try: p = source_ring(poly.numerator()) / source_ring(poly.denominator()) except (TypeError, AttributeError): - raise TypeError("polys (=%s) must be elements of %s"%(polys, source_ring)) + raise TypeError("polys (=%s) must be elements of %s" % (polys, source_ring)) F.append(p) polys = Sequence(F) @@ -1244,7 +1244,7 @@ def _repr_defn(self): """ i = self.domain().ambient_space()._repr_generic_point() o = self._codomain.ambient_space()._repr_generic_point(self.defining_polynomials()) - return "Defined on coordinates by sending %s to\n%s"%(i,o) + return "Defined on coordinates by sending %s to\n%s" % (i,o) def __getitem__(self, i): """ diff --git a/src/sage/schemes/generic/point.py b/src/sage/schemes/generic/point.py index c3f628159aa..c65963e3eaa 100644 --- a/src/sage/schemes/generic/point.py +++ b/src/sage/schemes/generic/point.py @@ -66,7 +66,7 @@ def _repr_(self): sage: P._repr_() 'Point on Spectrum of Integer Ring' """ - return "Point on %s"%self.__S + return "Point on %s" % self.__S ######################################################## # Topological points on a scheme @@ -179,7 +179,7 @@ def __init__(self, S, P, check=False): # unfortunately is_prime() is only implemented in a small # number of cases if check and not P.is_prime(): - raise ValueError("The argument %s must be a prime ideal of %s"%(P, R)) + raise ValueError("The argument %s must be a prime ideal of %s" % (P, R)) SchemeTopologicalPoint.__init__(self, S) self.__P = P @@ -197,7 +197,7 @@ def _repr_(self): 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' """ - return "Point on %s defined by the %s"%(self.scheme(), + return "Point on %s defined by the %s" % (self.scheme(), self.prime_ideal()) def prime_ideal(self): @@ -247,7 +247,7 @@ def __init__(self, f): self.__f = f def _repr_(self): - return "Point on %s defined by the morphism %s"%(self.scheme(), + return "Point on %s defined by the morphism %s" % (self.scheme(), self.morphism()) def morphism(self): diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py index ddb2cd61479..69e6813a4d4 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py @@ -644,7 +644,7 @@ def _points_fast_sqrt(self): # (0:1:0) is a point on the curve points = [self.point([K(0), K(1), K(0)], check=True)] else: - points=[] + points = [] if P.degree() > 2: # P(1, y, 0) = r*y + s s = P(K(1), K(0), K(0)) @@ -1109,7 +1109,7 @@ def count_points_hypellfrob(self, n=1, N=None, algorithm=None): raise ValueError("Unknown algorithm") if p <= (2*g+1)*(2*N-1): - raise ValueError("p=%d should be greater than (2*g+1)(2*N-1)=%d"%(p,(2*g+1)*(2*N-1))) + raise ValueError("p=%d should be greater than (2*g+1)(2*N-1)=%d" % (p,(2*g+1)*(2*N-1))) if algorithm == 'traces': M = self.frobenius_matrix(N=N, algorithm='hypellfrob') @@ -1535,16 +1535,16 @@ def _Cartier_matrix_cached(self): #retrieve the function f(x) ,where y^2=f(x) f,h = self.hyperelliptic_polynomials() #This implementation only deals with h=0 - if h!=0: + if h != 0: raise ValueError("E must be of the form y^2 = f(x)") d = f.degree() #this implementation is for odd degree only, even degree will be handled later. - if d%2 == 0: + if d % 2 == 0: raise ValueError("In this implementation the degree of f must be odd") #Compute resultant to make sure no repeated roots - df=f.derivative() - R=df.resultant(f) + df = f.derivative() + R = df.resultant(f) if R == 0: raise ValueError("curve is not smooth") @@ -1566,9 +1566,9 @@ def _Cartier_matrix_cached(self): # compute each row of matrix as list and then M=list of lists(rows) - M=[] + M = [] for j in range(1,g+1): - H=[Coeff[i] for i in range((p*j-1), (p*j-g-1),-1)] + H = [Coeff[i] for i in range((p*j-1), (p*j-g-1),-1)] M.append(H) return matrix(Fq,M), Coeff, g, Fq,p, self @@ -1657,10 +1657,10 @@ def Cartier_matrix(self): # Github Issue #11115: Why shall we waste time by studying # the cache manually? We only need to check whether the cached # data belong to self. - M, Coeffs,g, Fq, p, E= self._Cartier_matrix_cached() - if E!=self: + M, Coeffs,g, Fq, p, E = self._Cartier_matrix_cached() + if E != self: self._Cartier_matrix_cached.clear_cache() - M, Coeffs,g, Fq, p, E= self._Cartier_matrix_cached() + M, Coeffs,g, Fq, p, E = self._Cartier_matrix_cached() return M @cached_method @@ -1824,10 +1824,10 @@ def Hasse_Witt(self): # from the cache - but apparently it could be # that the cached value does not belong to self. # So, the easiest is: - N, E= self._Hasse_Witt_cached() - if E!=self: + N, E = self._Hasse_Witt_cached() + if E != self: self._Hasse_Witt_cached.clear_cache() - N, E= self._Hasse_Witt_cached() + N, E = self._Hasse_Witt_cached() return N def a_number(self): @@ -1866,10 +1866,10 @@ def a_number(self): # Since Github Issue #11115, there is a special cache for methods # that don't accept arguments. The easiest is: Call the cached # method, and test whether the last entry is self. - M,Coeffs,g, Fq, p,E= self._Cartier_matrix_cached() + M,Coeffs,g, Fq, p,E = self._Cartier_matrix_cached() if E != self: self._Cartier_matrix_cached.clear_cache() - M,Coeffs,g, Fq, p,E= self._Cartier_matrix_cached() + M,Coeffs,g, Fq, p,E = self._Cartier_matrix_cached() return g - rank(M) def p_rank(self): diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_g2.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_g2.py index 19d767ea2f3..cab0fb1059f 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_g2.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_g2.py @@ -27,7 +27,7 @@ def is_odd_degree(self): f, h = self.hyperelliptic_polynomials() df = f.degree() if h.degree() < 3: - return df%2 == 1 + return df % 2 == 1 elif df < 6: return False else: diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py index a56fee001cf..ea3987a06c7 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py @@ -147,7 +147,7 @@ def change_ring(self, R): f, h = self._hyperelliptic_polynomials y = self._printing_ring.variable_name() x = self._printing_ring.base_ring().variable_name() - return HyperellipticCurve(f.change_ring(R), h.change_ring(R), "%s,%s"%(x,y)) + return HyperellipticCurve(f.change_ring(R), h.change_ring(R), "%s,%s" % (x,y)) base_extend = change_ring @@ -268,7 +268,7 @@ def lift_x(self, x, all=False): if all: return [] else: - raise ValueError("No point with x-coordinate %s on %s"%(x, self)) + raise ValueError("No point with x-coordinate %s on %s" % (x, self)) def genus(self): return self._genus @@ -397,7 +397,7 @@ def _magma_init_(self, magma): 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)) + return 'HyperellipticCurve(%s, %s)' % (f._magma_init_(magma), h._magma_init_(magma)) def monsky_washnitzer_gens(self): import sage.schemes.hyperelliptic_curves.monsky_washnitzer as monsky_washnitzer @@ -462,7 +462,7 @@ def local_coordinates_at_nonweierstrass(self, P, prec=20, name='t'): """ d = P[1] if d == 0: - raise TypeError("P = %s is a Weierstrass point. Use local_coordinates_at_weierstrass instead!"%P) + raise TypeError("P = %s is a Weierstrass point. Use local_coordinates_at_weierstrass instead!" % P) pol = self.hyperelliptic_polynomials()[0] L = PowerSeriesRing(self.base_ring(), name, default_prec=prec) t = L.gen() @@ -514,7 +514,7 @@ def local_coordinates_at_weierstrass(self, P, prec=20, name='t'): - Francis Clarke (2012-08-26) """ if P[1] != 0: - raise TypeError("P = %s is not a finite Weierstrass point. Use local_coordinates_at_nonweierstrass instead!"%P) + raise TypeError("P = %s is not a finite Weierstrass point. Use local_coordinates_at_nonweierstrass instead!" % P) L = PowerSeriesRing(self.base_ring(), name) t = L.gen() pol = self.hyperelliptic_polynomials()[0] diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py index 5111e08faf1..18dbbb59939 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py @@ -123,7 +123,7 @@ def local_analytic_interpolation(self, P, Q): """ prec = self.base_ring().precision_cap() if not self.is_same_disc(P,Q): - raise ValueError("%s and %s are not in the same residue disc"%(P,Q)) + raise ValueError("%s and %s are not in the same residue disc" % (P,Q)) disc = self.residue_disc(P) t = PowerSeriesRing(self.base_ring(), 't', prec).gen(0) if disc == self.change_ring(self.base_ring().residue_field())(0,1,0): # Infinite disc @@ -254,7 +254,7 @@ def find_char_zero_weier_point(self, Q): - Jennifer Balakrishnan """ if not self.is_in_weierstrass_disc(Q): - raise ValueError("%s is not in a Weierstrass disc"%Q) + raise ValueError("%s is not in a Weierstrass disc" % Q) points = self.weierstrass_points() for P in points: if self.is_same_disc(P,Q): @@ -298,7 +298,7 @@ def residue_disc(self, P): return HF(0,0,1) if xPv == 0: return HF(P[0].expansion(0), 0,1) - elif yPv ==0: + elif yPv == 0: if xPv > 0: return HF(0, P[1].expansion(0),1) if xPv == 0: @@ -604,7 +604,7 @@ def coleman_integrals_on_basis(self, P, Q, algorithm=None): offset = (2*g-1)*max(TPv, TQv) if offset == +Infinity: offset = (2*g-1)*min(TPv,TQv) - if (offset > prec and (xTPv <0 or xTQv <0) and (self.residue_disc(P) == self.change_ring(GF(p))(0,1,0) or self.residue_disc(Q) == self.change_ring(GF(p))(0,1,0))): + if (offset > prec and (xTPv < 0 or xTQv < 0) and (self.residue_disc(P) == self.change_ring(GF(p))(0,1,0) or self.residue_disc(Q) == self.change_ring(GF(p))(0,1,0))): newprec = offset + prec K = pAdicField(p,newprec) A = PolynomialRing(RationalField(),'x') @@ -932,10 +932,10 @@ def _frob(P): y0 = P[1] try: uN = (1 + h(x0)/y0**(2*p)).sqrt() - yres=y0**p * uN - xres=x0**p + yres = y0**p * uN + xres = x0**p if (yres-y0).valuation() == 0: - yres=-yres + yres = -yres return self.point([xres,yres, K(1)]) except (TypeError, NotImplementedError): uN2 = 1 + h(x0)/y0**(2*p) @@ -944,7 +944,7 @@ def _frob(P): v = uN2.valuation() a = uN2.parent().gen() uN = self.newton_sqrt(uN2,c.sqrt()*a**(v//2),K.precision_cap()) - yres = y0**p *uN + yres = y0**p * uN xres = x0**p if (yres - y0).valuation() == 0: yres = -yres @@ -1112,7 +1112,7 @@ def P_to_S(self, P, S): """ prec = self.base_ring().precision_cap() deg = (S[0]).parent().defining_polynomial().degree() - prec2= prec*deg + prec2 = prec*deg x,y = self.local_coord(P,prec2) g = self.genus() integrals = [((x**k*x.derivative()/(2*y)).integral()) for k in range(2*g)] diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_rational_field.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_rational_field.py index a55a93dd996..f9337b0fbc0 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_rational_field.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_rational_field.py @@ -27,7 +27,7 @@ def my_chage_ring(self, R): f, h = self._hyperelliptic_polynomials y = self._printing_ring.gen() x = self._printing_ring.base_ring().gen() - return HyperellipticCurve(f.change_ring(R), h, "%s,%s"%(x,y)) + return HyperellipticCurve(f.change_ring(R), h, "%s,%s" % (x,y)) import sage.schemes.hyperelliptic_curves.monsky_washnitzer as monsky_washnitzer if isinstance(p, (sage.rings.abc.pAdicField, sage.rings.abc.pAdicRing)): diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_endomorphism_utils.py b/src/sage/schemes/hyperelliptic_curves/jacobian_endomorphism_utils.py index 5c7c4b22c5c..8d8d89896db 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_endomorphism_utils.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_endomorphism_utils.py @@ -122,7 +122,7 @@ def satisfies_coefficient_condition(g, p): return False if g[3]*p != g[1]: return False - if g[2]%p == 0: + if g[2] % p == 0: return False return True diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py b/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py index da1f8908a7a..970a54d9167 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py @@ -264,7 +264,7 @@ def cantor_composition_simple(D1,D2,f,genus): d, l, h3 = d0.xgcd(b1 + b2) a = (a1*a2) // (d**2) b = ((b2 + l*h2*(b1-b2)*(a2 // d)) + h3*((f - b2**2) // d)) % (a) - a =a.monic() + a = a.monic() return (a, b) def cantor_composition(D1,D2,f,h,genus): @@ -394,8 +394,8 @@ def __init__(self, parent, polys, check=True): C = parent.curve() f, h = C.hyperelliptic_polynomials() a, b = polys - if not (b**2 + h*b - f)%a == 0: - raise ValueError("Argument polys (= %s) must be divisor on curve %s."%( + if not (b**2 + h*b - f) % a == 0: + raise ValueError("Argument polys (= %s) must be divisor on curve %s." % ( polys, C)) genus = C.genus() if a.degree() > genus: diff --git a/src/sage/schemes/hyperelliptic_curves/mestre.py b/src/sage/schemes/hyperelliptic_curves/mestre.py index 166681b32a1..1694f1dfef7 100644 --- a/src/sage/schemes/hyperelliptic_curves/mestre.py +++ b/src/sage/schemes/hyperelliptic_curves/mestre.py @@ -188,7 +188,7 @@ def HyperellipticCurve_from_invariants(i, reduced=True, precision=None, # setting the cijk from Mestre's algorithm c111 = 12*x*y - 2*y/3 - 4*z c112 = -18*x**3 - 12*x*y - 36*y**2 - 2*z - c113 = -9*x**3 - 36*x**2*y -4*x*y - 6*x*z - 18*y**2 + c113 = -9*x**3 - 36*x**2*y - 4*x*y - 6*x*z - 18*y**2 c122 = c113 c123 = -54*x**4 - 36*x**2*y - 36*x*y**2 - 6*x*z - 4*y**2 - 24*y*z c133 = -27*x**4/2 - 72*x**3*y - 6*x**2*y - 9*x**2*z - 39*x*y**2 - \ diff --git a/src/sage/schemes/jacobians/abstract_jacobian.py b/src/sage/schemes/jacobians/abstract_jacobian.py index 08bee459739..31b81bf214b 100644 --- a/src/sage/schemes/jacobians/abstract_jacobian.py +++ b/src/sage/schemes/jacobians/abstract_jacobian.py @@ -122,11 +122,11 @@ def __init__(self, C): defined by x + y + z) must be defined over a field. """ if not is_Scheme(C): - raise TypeError("Argument (=%s) must be a scheme."%C) + raise TypeError("Argument (=%s) must be a scheme." % C) if C.base_ring() not in _Fields: - raise TypeError("C (=%s) must be defined over a field."%C) + raise TypeError("C (=%s) must be defined over a field." % C) if C.dimension() != 1: - raise ValueError("C (=%s) must have dimension 1."%C) + raise ValueError("C (=%s) must have dimension 1." % C) self.__curve = C Scheme.__init__(self, C.base_scheme()) diff --git a/src/sage/schemes/plane_conics/con_field.py b/src/sage/schemes/plane_conics/con_field.py index fa813565f7a..3a3d0aa3a2a 100644 --- a/src/sage/schemes/plane_conics/con_field.py +++ b/src/sage/schemes/plane_conics/con_field.py @@ -284,7 +284,7 @@ def diagonal_matrix(self): B = self.base_ring() basis = [vector(B,{2:0,i:1}) for i in range(3)] for i in range(3): - zerovalue = (basis[i]*A*basis[i].column()== 0) + zerovalue = (basis[i]*A*basis[i].column() == 0) if zerovalue: for j in range(i+1,3): if basis[j]*A*basis[j].column() != 0: diff --git a/src/sage/schemes/product_projective/homset.py b/src/sage/schemes/product_projective/homset.py index 91af8105def..61e23e848ec 100644 --- a/src/sage/schemes/product_projective/homset.py +++ b/src/sage/schemes/product_projective/homset.py @@ -201,7 +201,7 @@ def points(self, **kwds): points = [] if is_RationalField(R): if not B > 0: - raise TypeError("a positive bound B (= %s) must be specified"%B) + raise TypeError("a positive bound B (= %s) must be specified" % B) alg = kwds.pop('algorithm', None) if alg is None: # sieve should only be called for subschemes and if the bound is not very small @@ -222,7 +222,7 @@ def points(self, **kwds): raise ValueError("algorithm must be 'sieve' or 'enumerate'") elif R in NumberFields(): if not B > 0: - raise TypeError("a positive bound B (= %s) must be specified"%B) + raise TypeError("a positive bound B (= %s) must be specified" % B) from sage.schemes.product_projective.rational_point import enum_product_projective_number_field return enum_product_projective_number_field(self, bound=B) elif isinstance(R, FiniteField): diff --git a/src/sage/schemes/product_projective/morphism.py b/src/sage/schemes/product_projective/morphism.py index f28aa84e7ba..5cf9338606b 100644 --- a/src/sage/schemes/product_projective/morphism.py +++ b/src/sage/schemes/product_projective/morphism.py @@ -115,7 +115,7 @@ def __init__(self, parent, polys, check=True): for m in range(len(splitpolys)): d = dom._degree(splitpolys[m][0]) if not all(d == dom._degree(f) for f in splitpolys[m]): - raise TypeError("polys (=%s) must be multi-homogeneous of the same degrees (by component)"%polys) + raise TypeError("polys (=%s) must be multi-homogeneous of the same degrees (by component)" % polys) else: #we are mapping into some other kind of space target._validate(polys) @@ -225,9 +225,9 @@ def __call__(self, P, check=True): try: P = self.domain()(P) except (TypeError, NotImplementedError): - raise TypeError("%s fails to convert into the map's domain %s, but a `pushforward` method is not properly implemented"%(P, self.domain())) - elif self.domain()!= P.codomain(): - raise TypeError("%s fails to convert into the map's domain %s, but a `pushforward` method is not properly implemented"%(P, self.domain())) + raise TypeError("%s fails to convert into the map's domain %s, but a `pushforward` method is not properly implemented" % (P, self.domain())) + elif self.domain() != P.codomain(): + raise TypeError("%s fails to convert into the map's domain %s, but a `pushforward` method is not properly implemented" % (P, self.domain())) A = self.codomain() Q = list(P) diff --git a/src/sage/schemes/product_projective/point.py b/src/sage/schemes/product_projective/point.py index 09cd0225209..1823698c330 100644 --- a/src/sage/schemes/product_projective/point.py +++ b/src/sage/schemes/product_projective/point.py @@ -99,7 +99,7 @@ def __init__(self, parent, polys, check=True): N = parent.codomain().ambient_space().dimension_relative_components() if check: parent.codomain()._check_satisfies_equations(polys) - splitpolys=self.codomain().ambient_space()._factors(polys) + splitpolys = self.codomain().ambient_space()._factors(polys) self._points = [parent.codomain().ambient_space()[i].point(splitpolys[i], check) for i in range(len(N))] def __getitem__(self, i): diff --git a/src/sage/schemes/product_projective/space.py b/src/sage/schemes/product_projective/space.py index c17524ed163..ecdec43b7ca 100644 --- a/src/sage/schemes/product_projective/space.py +++ b/src/sage/schemes/product_projective/space.py @@ -243,7 +243,7 @@ def __init__(self, N, R=QQ, names=None): # Note that the coordinate ring should really be the tensor product of # the component coordinate rings. But we just deal with them as # multihomogeneous polynomial rings. - self._coordinate_ring = PolynomialRing(R,sum(N)+ len(N),names) + self._coordinate_ring = PolynomialRing(R,sum(N) + len(N),names) self._assign_names(names) def _repr_(self): @@ -604,12 +604,12 @@ def _factors(self, v): [[1, 2], [3, 4], [5, 6]] """ if not isinstance(v, (list, tuple, ETuple)): - raise TypeError("%s, must be a list or tuple"%v) + raise TypeError("%s, must be a list or tuple" % v) if len(v) != self.ngens(): - raise ValueError("%s must have %s elements"%(v, self.ngens())) + raise ValueError("%s must have %s elements" % (v, self.ngens())) index = 0 splitv = [] - dims=self._dims + dims = self._dims for i in range(len(dims)): splitv.append(v[index:index+dims[i]+1]) index += dims[i]+1 @@ -731,13 +731,13 @@ def _validate(self, polynomials): Polynomial Ring in x, y, z, w, u over Rational Field """ if not isinstance(polynomials, (list, tuple)): - raise TypeError('the argument polynomials=%s must be a list or tuple'%polynomials) + raise TypeError('the argument polynomials=%s must be a list or tuple' % polynomials) #check in the coordinate ring source_ring = self.coordinate_ring() try: polynomials = [source_ring(poly) for poly in polynomials] except TypeError: - raise TypeError("polynomials (=%s) must be elements of %s"%(polynomials,source_ring)) + raise TypeError("polynomials (=%s) must be elements of %s" % (polynomials,source_ring)) for f in polynomials: self._degree(f) #raises a ValueError if not multi-homogeneous return polynomials @@ -785,15 +785,15 @@ def _check_satisfies_equations(self, v): TypeError: the components of v=[1, 1/2, 1, 0] must be elements of Integer Ring """ if not isinstance(v, (list, tuple)): - raise TypeError('the argument v=%s must be a list or tuple'%v) + raise TypeError('the argument v=%s must be a list or tuple' % v) n = self.ngens() if not len(v) == n: - raise TypeError('the list v=%s must have %s components'%(v, n)) + raise TypeError('the list v=%s must have %s components' % (v, n)) R = self.base_ring() try: n = [R(w) for w in v] except TypeError: - raise TypeError('the components of v=%s must be elements of %s'%(v, R)) + raise TypeError('the components of v=%s must be elements of %s' % (v, R)) #check if any of the component points are 0 N = self._dims start = 0 @@ -921,15 +921,15 @@ def affine_patch(self, I, return_embedding=False): (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) + raise TypeError('the argument I=%s must be a list or tuple of positive integers' % I) PP = self.ambient_space() N = PP._dims if len(I) != len(N): - raise ValueError('the argument I=%s must have %s entries'%(I,len(N))) + raise ValueError('the argument I=%s must have %s entries' % (I,len(N))) I = tuple([int(i) for i in I]) # implicit type checking for i in range(len(I)): if I[i] < 0 or I[i] > N[i]: - raise ValueError("argument i (= %s) must be between 0 and %s."%(I[i], N[i])) + raise ValueError("argument i (= %s) must be between 0 and %s." % (I[i], N[i])) try: if return_embedding: return self.__affine_patches[I][1] @@ -1057,7 +1057,7 @@ def segre_embedding(self, PP=None, var='u'): Y = PS.subscheme(L) else: if PP.dimension_relative() != M: - raise ValueError("projective Space %s must be dimension %s")%(PP, M) + raise ValueError("projective Space %s must be dimension %s") % (PP, M) S = PP.coordinate_ring() psi = R.hom([0]*k + list(S.gens()), S) L = [psi(l) for l in L] @@ -1294,5 +1294,5 @@ def rational_points(self, F=None): if F is None: return list(self) elif not isinstance(F, FiniteField): - raise TypeError("second argument (= %s) must be a finite field"%F) + raise TypeError("second argument (= %s) must be a finite field" % F) return list(self.base_extend(F)) diff --git a/src/sage/schemes/product_projective/subscheme.py b/src/sage/schemes/product_projective/subscheme.py index 1678ab2f472..9d96f0eb2d3 100644 --- a/src/sage/schemes/product_projective/subscheme.py +++ b/src/sage/schemes/product_projective/subscheme.py @@ -161,7 +161,7 @@ def segre_embedding(self, PP=None): Y = PS.subscheme(L) else: if PP.dimension_relative() != M: - raise ValueError("projective space %s must be dimension %s")%(PP, M) + raise ValueError("projective space %s must be dimension %s") % (PP, M) S = PP.coordinate_ring() psi = R.hom([0]*k + list(S.gens()), S) L = [psi(l) for l in L] @@ -300,11 +300,11 @@ def affine_patch(self, I, return_embedding=False): PP = self.ambient_space() N = PP.dimension_relative_components() if len(I) != len(N): - raise ValueError('The argument I=%s must have %s entries'%(I,len(N))) + raise ValueError('The argument I=%s must have %s entries' % (I,len(N))) I = tuple([int(i) for i in I]) # implicit type checking for i in range(len(I)): if I[i] < 0 or I[i] > N[i]: - raise ValueError("Argument i (= %s) must be between 0 and %s."%(I[i], N[i])) + raise ValueError("Argument i (= %s) must be between 0 and %s." % (I[i], N[i])) #see if we've already created this affine patch try: if return_embedding: @@ -388,7 +388,7 @@ def intersection_multiplicity(self, X, P): try: PP(P) except TypeError: - raise TypeError("(=%s) must be a point in the ambient space of this subscheme and (=%s)"%(P,X)) + raise TypeError("(=%s) must be a point in the ambient space of this subscheme and (=%s)" % (P,X)) # find an affine chart of the ambient space of this subscheme that contains P indices = [] aff_pt = [] diff --git a/src/sage/schemes/projective/projective_homset.py b/src/sage/schemes/projective/projective_homset.py index c4aa79b9f7a..0825408195f 100644 --- a/src/sage/schemes/projective/projective_homset.py +++ b/src/sage/schemes/projective/projective_homset.py @@ -274,7 +274,7 @@ def points(self, **kwds): prec = kwds.pop('precision', 53) if is_RationalField(R): if not B > 0: - raise TypeError("a positive bound B (= %s) must be specified"%B) + raise TypeError("a positive bound B (= %s) must be specified" % B) if isinstance(X, AlgebraicScheme_subscheme): # sieve should only be called for subschemes from sage.schemes.projective.projective_rational_point import sieve return sieve(X, B) @@ -283,14 +283,14 @@ def points(self, **kwds): return enum_projective_rational_field(self, B) elif R in NumberFields(): if not B > 0: - raise TypeError("a positive bound B (= %s) must be specified"%B) + raise TypeError("a positive bound B (= %s) must be specified" % B) from sage.schemes.projective.projective_rational_point import enum_projective_number_field return enum_projective_number_field(self, bound=B, tolerance=tol, precision=prec) elif isinstance(R, FiniteField): from sage.schemes.projective.projective_rational_point import enum_projective_finite_field return enum_projective_finite_field(self.extended_codomain()) else: - raise TypeError("unable to enumerate points over %s"%R) + raise TypeError("unable to enumerate points over %s" % R) def numerical_points(self, F=None, **kwds): """ @@ -424,7 +424,7 @@ def numerical_points(self, F=None, **kwds): #of coordinates known so far. This results in a single #variable polynomial (by elimination) L = G[i].substitute(P) - if len(RF(L).variables())==1: + if len(RF(L).variables()) == 1: for pol in L.univariate_polynomial().roots(ring=F, multiplicities=False): r = L.variables()[0] varindex = RF.gens().index(r) @@ -523,11 +523,11 @@ def points(self, B=0): R = self.value_ring() if R == ZZ: if not B > 0: - raise TypeError("a positive bound B (= %s) must be specified"%B) + raise TypeError("a positive bound B (= %s) must be specified" % B) from sage.schemes.projective.projective_rational_point import enum_projective_rational_field return enum_projective_rational_field(self,B) else: - raise TypeError("unable to enumerate points over %s"%R) + raise TypeError("unable to enumerate points over %s" % R) class SchemeHomset_polynomial_projective_space(SchemeHomset_generic): diff --git a/src/sage/schemes/projective/projective_point.py b/src/sage/schemes/projective/projective_point.py index 05675ce2cc6..328754bfb90 100644 --- a/src/sage/schemes/projective/projective_point.py +++ b/src/sage/schemes/projective/projective_point.py @@ -177,9 +177,9 @@ def __init__(self, X, v, check=True): except AttributeError: pass if not isinstance(v, (list, tuple)): - raise TypeError("argument v (= %s) must be a scheme point, list, or tuple"%str(v)) + raise TypeError("argument v (= %s) must be a scheme point, list, or tuple" % str(v)) if len(v) != d and len(v) != d-1: - raise TypeError("v (=%s) must have %s components"%(v, d)) + raise TypeError("v (=%s) must have %s components" % (v, d)) R = X.value_ring() v = Sequence(v, R) @@ -1137,9 +1137,9 @@ def __init__(self, X, v, check=True): except AttributeError: pass if not isinstance(v, (list,tuple)): - raise TypeError("argument v (= %s) must be a scheme point, list, or tuple"%str(v)) + raise TypeError("argument v (= %s) must be a scheme point, list, or tuple" % str(v)) if len(v) != d and len(v) != d-1: - raise TypeError("v (=%s) must have %s components"%(v, d)) + raise TypeError("v (=%s) must have %s components" % (v, d)) R = X.value_ring() v = Sequence(v, R) diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index c247f630ff6..7755897396a 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -113,7 +113,7 @@ def point(self, v, check=True): if v is infinity or\ (isinstance(v, (list,tuple)) and len(v) == 1 and v[0] is infinity): if self.ambient_space().dimension_relative() > 1: - raise ValueError("%s not well defined in dimension > 1"%v) + raise ValueError("%s not well defined in dimension > 1" % v) v = [1, 0] # todo: update elliptic curve stuff to take point_homset as argument from sage.schemes.elliptic_curves.ell_generic import is_EllipticCurve @@ -259,7 +259,7 @@ def affine_patch(self, i, AA=None): PP = self.ambient_space() n = PP.dimension_relative() if i < 0 or i > n: - raise ValueError("Argument i (= %s) must be between 0 and %s."%(i, n)) + raise ValueError("Argument i (= %s) must be between 0 and %s." % (i, n)) try: A = self.__affine_patches[i] #assume that if you've passed in a new ambient affine space @@ -273,7 +273,7 @@ def affine_patch(self, i, AA=None): if AA is None: AA = PP.affine_patch(i) elif AA.dimension_relative() != n: - raise ValueError("Affine Space must be of the dimension %s"%(n)) + raise ValueError("Affine Space must be of the dimension %s" % (n)) phi = AA.projective_embedding(i, PP) polys = self.defining_polynomials() xi = phi.defining_polynomials() @@ -325,7 +325,7 @@ def _best_affine_patch(self, point): i_max = 0 p_max = abs_point[i_max] for i in range(1,len(point)): - if abs_point[i]>p_max: + if abs_point[i] > p_max: i_max = i p_max = abs_point[i_max] return i_max @@ -1098,7 +1098,7 @@ def intersection_multiplicity(self, X, P): try: self.ambient_space()(P) except TypeError: - raise TypeError("(=%s) must be a point in the ambient space of this subscheme and (=%s)"%(P,X)) + raise TypeError("(=%s) must be a point in the ambient space of this subscheme and (=%s)" % (P,X)) # find an affine chart of the ambient space of this curve that contains P n = self.ambient_space().dimension_relative() for i in range(n + 1): @@ -1393,7 +1393,7 @@ def Chow_form(self): # polynomial ring in just the plucker coordinates T2 = PolynomialRing(R.base_ring(), tvars) - alp = T.hom(tvars + (N*(d+1) +N)*[0], T2) + alp = T.hom(tvars + (N*(d+1) + N)*[0], T2) # get the degrees of the reduced generators of CH degs = [u.degree() for u in reduced] mind = max(degs) From 050d0aa9983b4c276bafa38e1ed2b076cb117948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 4 Sep 2023 20:12:51 +0200 Subject: [PATCH 407/423] fix E228 then E225 in rings/ --- ...otics_multivariate_generating_functions.py | 4 +- src/sage/rings/complex_interval_field.py | 2 +- .../rings/finite_rings/conway_polynomials.py | 4 +- .../rings/finite_rings/finite_field_givaro.py | 2 +- .../finite_rings/finite_field_ntl_gf2e.py | 2 +- src/sage/rings/finite_rings/homset.py | 4 +- src/sage/rings/function_field/constructor.py | 8 +- src/sage/rings/function_field/divisor.py | 2 +- .../function_field/function_field_polymod.py | 4 +- .../function_field/function_field_rational.py | 6 +- src/sage/rings/function_field/order.py | 4 +- src/sage/rings/function_field/order_basis.py | 2 +- .../rings/function_field/order_polymod.py | 10 +-- .../rings/function_field/order_rational.py | 2 +- .../rings/function_field/place_polymod.py | 2 +- .../rings/function_field/place_rational.py | 2 +- src/sage/rings/homset.py | 4 +- src/sage/rings/ideal.py | 12 +-- src/sage/rings/invariants/invariant_theory.py | 82 +++++++++---------- src/sage/rings/lazy_series_ring.py | 2 +- src/sage/rings/multi_power_series_ring.py | 4 +- .../rings/multi_power_series_ring_element.py | 6 +- src/sage/rings/number_field/S_unit_solver.py | 12 +-- src/sage/rings/number_field/class_group.py | 10 +-- src/sage/rings/number_field/homset.py | 8 +- .../rings/number_field/number_field_ideal.py | 10 +-- .../number_field/number_field_ideal_rel.py | 18 ++-- .../rings/number_field/number_field_rel.py | 16 ++-- src/sage/rings/number_field/selmer_group.py | 8 +- .../rings/number_field/splitting_field.py | 18 ++-- .../rings/number_field/totallyreal_phc.py | 6 +- .../rings/number_field/totallyreal_rel.py | 4 +- src/sage/rings/number_field/unit_group.py | 18 ++-- src/sage/rings/padics/factory.py | 6 +- src/sage/rings/padics/generic_nodes.py | 2 +- src/sage/rings/padics/lattice_precision.py | 10 +-- src/sage/rings/padics/local_generic.py | 4 +- src/sage/rings/padics/misc.py | 8 +- src/sage/rings/padics/padic_base_generic.py | 8 +- src/sage/rings/padics/padic_base_leaves.py | 2 +- src/sage/rings/padics/padic_generic.py | 2 +- src/sage/rings/padics/padic_valuation.py | 30 +++---- src/sage/rings/polynomial/ideal.py | 2 +- .../polynomial/laurent_polynomial_ring.py | 4 +- .../polynomial/multi_polynomial_element.py | 4 +- .../polynomial/multi_polynomial_ideal.py | 34 ++++---- .../polynomial/multi_polynomial_sequence.py | 10 +-- .../polynomial/polynomial_element_generic.py | 28 +++---- .../polynomial/polynomial_quotient_ring.py | 8 +- .../polynomial_quotient_ring_element.py | 4 +- src/sage/rings/polynomial/polynomial_ring.py | 16 ++-- src/sage/rings/polynomial/symmetric_ideal.py | 30 +++---- src/sage/rings/polynomial/term_order.py | 34 ++++---- src/sage/rings/power_series_ring.py | 6 +- src/sage/rings/quotient_ring.py | 12 +-- src/sage/rings/valuation/valuation.py | 8 +- src/sage/rings/valuation/valuation_space.py | 16 ++-- src/sage/rings/valuation/value_group.py | 6 +- 58 files changed, 296 insertions(+), 296 deletions(-) diff --git a/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py b/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py index a1fe036917e..8a6002af635 100644 --- a/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py +++ b/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py @@ -823,7 +823,7 @@ def univariate_decomposition(self): for a, m in df: am = a**m q, r = denominator.quo_rem(am) - assert r==0 + assert r == 0 numer = p * q.inverse_mod(am) % am # The inverse exists because the product and a**m # are relatively prime. @@ -1930,7 +1930,7 @@ def asymptotics_smooth(self, p, alpha, N, asy_var, coordinate=None, if v.mod(2) == 0: At_derivs = diff_all(At, T, 2 * N - 2, sub=hderivs1, sub_final=[Tstar, atP], rekey=AA) - Phitu_derivs = diff_all(Phitu, T, 2 * N - 2 +v, + Phitu_derivs = diff_all(Phitu, T, 2 * N - 2 + v, sub=hderivs1, sub_final=[Tstar, atP], zero_order=v + 1, rekey=BB) else: diff --git a/src/sage/rings/complex_interval_field.py b/src/sage/rings/complex_interval_field.py index 7cbf5d60929..77364334160 100644 --- a/src/sage/rings/complex_interval_field.py +++ b/src/sage/rings/complex_interval_field.py @@ -558,7 +558,7 @@ def _repr_(self): sage: ComplexIntervalField(100) # indirect doctest Complex Interval Field with 100 bits of precision """ - return "Complex Interval Field with %s bits of precision"%self._prec + return "Complex Interval Field with %s bits of precision" % self._prec def _latex_(self): r""" diff --git a/src/sage/rings/finite_rings/conway_polynomials.py b/src/sage/rings/finite_rings/conway_polynomials.py index 35604cbcd07..02779f49bca 100644 --- a/src/sage/rings/finite_rings/conway_polynomials.py +++ b/src/sage/rings/finite_rings/conway_polynomials.py @@ -471,7 +471,7 @@ def find_leveller(qindex, level, x, xleveled, searched, i): searched[i] = True crt_possibles = [] for j in range(1,len(qlist)): - if i==j: + if i == j: continue if crt[(i,j)][qindex][1] >= level: if xleveled[j]: @@ -487,7 +487,7 @@ def find_leveller(qindex, level, x, xleveled, searched, i): def propagate_levelling(qindex, level, x, xleveled, i): for j in range(1, len(qlist)): - if i==j: + if i == j: continue if not xleveled[j] and crt[(i,j)][qindex][1] >= level: newxj = x[i][0] + crt[(i,j)][qindex][0] diff --git a/src/sage/rings/finite_rings/finite_field_givaro.py b/src/sage/rings/finite_rings/finite_field_givaro.py index 0a0aa9a8d67..2dd96beeb34 100644 --- a/src/sage/rings/finite_rings/finite_field_givaro.py +++ b/src/sage/rings/finite_rings/finite_field_givaro.py @@ -510,7 +510,7 @@ def _pari_modulus(self): Mod(1, 3)*a^4 + Mod(2, 3)*a^3 + Mod(2, 3) """ f = pari(str(self.modulus())) - return f.subst('x', 'a') * pari("Mod(1,%s)"%self.characteristic()) + return f.subst('x', 'a') * pari("Mod(1,%s)" % self.characteristic()) def __iter__(self): """ diff --git a/src/sage/rings/finite_rings/finite_field_ntl_gf2e.py b/src/sage/rings/finite_rings/finite_field_ntl_gf2e.py index 17161467f12..654f7a2b54b 100644 --- a/src/sage/rings/finite_rings/finite_field_ntl_gf2e.py +++ b/src/sage/rings/finite_rings/finite_field_ntl_gf2e.py @@ -305,4 +305,4 @@ def _pari_modulus(self): Mod(1, 2)*a^16 + Mod(1, 2)*a^5 + Mod(1, 2)*a^3 + Mod(1, 2)*a^2 + Mod(1, 2) """ f = pari(str(self.modulus())) - return f.subst('x', 'a') * pari("Mod(1,%s)"%self.characteristic()) + return f.subst('x', 'a') * pari("Mod(1,%s)" % self.characteristic()) diff --git a/src/sage/rings/finite_rings/homset.py b/src/sage/rings/finite_rings/homset.py index dfce6a12f1a..f9d523199ec 100644 --- a/src/sage/rings/finite_rings/homset.py +++ b/src/sage/rings/finite_rings/homset.py @@ -153,9 +153,9 @@ def _repr_(self): D = self.domain() C = self.codomain() if C == D: - return "Automorphism group of %s"%D + return "Automorphism group of %s" % D else: - return "Set of field embeddings from %s to %s"%(D, C) + return "Set of field embeddings from %s to %s" % (D, C) def is_aut(self): """ diff --git a/src/sage/rings/function_field/constructor.py b/src/sage/rings/function_field/constructor.py index 31156bc9c6f..605e842fa6b 100644 --- a/src/sage/rings/function_field/constructor.py +++ b/src/sage/rings/function_field/constructor.py @@ -86,7 +86,7 @@ def create_key(self, F, names): sage: K. = FunctionField(QQ) # indirect doctest """ if not isinstance(names, tuple): - names=(names,) + names = (names,) return (F, names) def create_object(self, version, key,**extra_args): @@ -112,7 +112,7 @@ def create_object(self, version, key,**extra_args): return RationalFunctionField(key[0], names=key[1]) -FunctionField=FunctionFieldFactory("sage.rings.function_field.constructor.FunctionField") +FunctionField = FunctionFieldFactory("sage.rings.function_field.constructor.FunctionField") class FunctionFieldExtensionFactory(UniqueFactory): @@ -170,9 +170,9 @@ def create_key(self,polynomial,names): """ if names is None: - names=polynomial.variable_name() + names = polynomial.variable_name() if not isinstance(names,tuple): - names=(names,) + names = (names,) return (polynomial,names,polynomial.base_ring()) def create_object(self,version,key,**extra_args): diff --git a/src/sage/rings/function_field/divisor.py b/src/sage/rings/function_field/divisor.py index 59f0f7a0cbb..84c837ffb09 100644 --- a/src/sage/rings/function_field/divisor.py +++ b/src/sage/rings/function_field/divisor.py @@ -1023,7 +1023,7 @@ def _repr_(self): sage: F.divisor_group() Divisor group of Function field in y defined by y^2 + 4*x^3 + 4 """ - return "Divisor group of %s"%(self._field,) + return "Divisor group of %s" % (self._field,) def _element_constructor_(self, x): """ diff --git a/src/sage/rings/function_field/function_field_polymod.py b/src/sage/rings/function_field/function_field_polymod.py index cf0dfc439c5..460096c94a1 100644 --- a/src/sage/rings/function_field/function_field_polymod.py +++ b/src/sage/rings/function_field/function_field_polymod.py @@ -280,7 +280,7 @@ def _to_base_field(self, f): K = self.base_field() if f.element().is_constant(): return K(f.element()) - raise ValueError("%r is not an element of the base field"%(f,)) + raise ValueError("%r is not an element of the base field" % (f,)) def _to_constant_base_field(self, f): """ @@ -572,7 +572,7 @@ def _repr_(self): sage: L._repr_() 'Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x' """ - return "Function field in %s defined by %s"%(self.variable_name(), self._polynomial) + return "Function field in %s defined by %s" % (self.variable_name(), self._polynomial) def base_field(self): """ diff --git a/src/sage/rings/function_field/function_field_rational.py b/src/sage/rings/function_field/function_field_rational.py index 0332b9ccfed..1b169275da4 100644 --- a/src/sage/rings/function_field/function_field_rational.py +++ b/src/sage/rings/function_field/function_field_rational.py @@ -220,7 +220,7 @@ def _repr_(self): sage: K._repr_() 'Rational function field in t over Rational Field' """ - return "Rational function field in %s over %s"%( + return "Rational function field in %s over %s" % ( self.variable_name(), self._constant_field) def _element_constructor_(self, x): @@ -304,7 +304,7 @@ def _to_constant_base_field(self, f): # When K is not exact, f.denominator() might not be an exact 1, so # we need to divide explicitly to get the correct precision return K(f.numerator()) / K(f.denominator()) - raise ValueError("only constants can be converted into the constant base field but %r is not a constant"%(f,)) + raise ValueError("only constants can be converted into the constant base field but %r is not a constant" % (f,)) def _to_polynomial(self, f): """ @@ -349,7 +349,7 @@ def _to_bivariate_polynomial(self, f): v = f.list() denom = lcm([a.denominator() for a in v]) S = denom.parent() - x,t = S.base_ring()['%s,%s'%(f.parent().variable_name(),self.variable_name())].gens() + x,t = S.base_ring()['%s,%s' % (f.parent().variable_name(),self.variable_name())].gens() phi = S.hom([t]) return sum([phi((denom * v[i]).numerator()) * x**i for i in range(len(v))]), denom diff --git a/src/sage/rings/function_field/order.py b/src/sage/rings/function_field/order.py index 52732cad62a..615cbab3690 100644 --- a/src/sage/rings/function_field/order.py +++ b/src/sage/rings/function_field/order.py @@ -259,7 +259,7 @@ def _repr_(self): sage: FunctionField(QQ,'y').maximal_order()._repr_() 'Maximal order of Rational function field in y over Rational Field' """ - return "Maximal order of %s"%(self.function_field(),) + return "Maximal order of %s" % (self.function_field(),) class FunctionFieldMaximalOrderInfinite(FunctionFieldMaximalOrder, FunctionFieldOrderInfinite): @@ -278,4 +278,4 @@ def _repr_(self): sage: F.maximal_order_infinite() # needs sage.modules sage.rings.function_field Maximal infinite order of Function field in y defined by y^3 + x^6 + x^4 + x^2 """ - return "Maximal infinite order of %s"%(self.function_field(),) + return "Maximal infinite order of %s" % (self.function_field(),) diff --git a/src/sage/rings/function_field/order_basis.py b/src/sage/rings/function_field/order_basis.py index 3452d961459..eebaeab97d1 100644 --- a/src/sage/rings/function_field/order_basis.py +++ b/src/sage/rings/function_field/order_basis.py @@ -93,7 +93,7 @@ def __init__(self, basis, check=True): R = V.base_field().maximal_order() self._module = V.span([to_V(b) for b in basis], base_ring=R) - self._from_module= from_V + self._from_module = from_V self._to_module = to_V self._basis = tuple(basis) self._ring = field.polynomial_ring() diff --git a/src/sage/rings/function_field/order_polymod.py b/src/sage/rings/function_field/order_polymod.py index e4f7d6eece8..97f5a625819 100644 --- a/src/sage/rings/function_field/order_polymod.py +++ b/src/sage/rings/function_field/order_polymod.py @@ -683,7 +683,7 @@ def decomposition(self, ideal): # occurs by constructing a matrix in k, and finding a non-zero # vector in the kernel of the matrix. - m =[] + m = [] for g in q.basis_matrix(): m.extend(matrix([g * mr for mr in matrices_reduced]).columns()) beta = [c.lift() for c in matrix(m).right_kernel().basis()[0]] @@ -784,7 +784,7 @@ def _element_constructor_(self, f): O = F.base_field().maximal_order_infinite() coordinates = self.coordinate_vector(f) if not all(c in O for c in coordinates): - raise TypeError("%r is not an element of %r"%(f,self)) + raise TypeError("%r is not an element of %r" % (f,self)) return f @@ -1288,7 +1288,7 @@ def decomposition(self, ideal): # p and qgen generates the prime; modulo pO, qgenb generates the prime qgenb = [to(qgen[i]) for i in range(n)] - m =[] + m = [] for i in range(n): m.append(sum(qgenb[j] * mtable[i][j] for j in range(n))) beta = [fr(coeff) for coeff in matrix(m).left_kernel().basis()[0]] @@ -1383,7 +1383,7 @@ def add(Ib,Jb): Kb.append(Lb) # J_1, J_2, ... - Jb =[Kb[0]] + [div(Kb[j],Kb[j-1]) for j in range(1,len(Kb))] + Jb = [Kb[0]] + [div(Kb[j],Kb[j-1]) for j in range(1,len(Kb))] # H_1, H_2, ... Hb = [div(Jb[j],Jb[j+1]) for j in range(len(Jb)-1)] + [Jb[-1]] @@ -1455,7 +1455,7 @@ def split(h): # Compute an element beta in O but not in pO. How to find beta # is explained in Section 4.8.3 of [Coh1993]. We keep beta # as a vector over k[x] with respect to the basis of O. - m =[] + m = [] for i in range(n): r = [] for g in prime._hnf: diff --git a/src/sage/rings/function_field/order_rational.py b/src/sage/rings/function_field/order_rational.py index ff701315f0f..99da2af1ebd 100644 --- a/src/sage/rings/function_field/order_rational.py +++ b/src/sage/rings/function_field/order_rational.py @@ -84,7 +84,7 @@ def _element_constructor_(self, f): raise TypeError("unable to convert to an element of {}".format(F)) if not f.denominator() in self.function_field().constant_base_field(): - raise TypeError("%r is not an element of %r"%(f,self)) + raise TypeError("%r is not an element of %r" % (f,self)) return f diff --git a/src/sage/rings/function_field/place_polymod.py b/src/sage/rings/function_field/place_polymod.py index b1d525152f0..e11a6c86ab7 100644 --- a/src/sage/rings/function_field/place_polymod.py +++ b/src/sage/rings/function_field/place_polymod.py @@ -602,7 +602,7 @@ def candidates(): if deg > 1: if isinstance(k, NumberField): if name is None: - name='s' + name = 's' K = k.extension(min_poly, names=name) def from_W(e): diff --git a/src/sage/rings/function_field/place_rational.py b/src/sage/rings/function_field/place_rational.py index b6fd87f4fc2..1930a1d3f66 100644 --- a/src/sage/rings/function_field/place_rational.py +++ b/src/sage/rings/function_field/place_rational.py @@ -128,7 +128,7 @@ def to_K(f): d = f.denominator() n_deg = n.degree() - d_deg =d.degree() + d_deg = d.degree() if n_deg < d_deg: return K(0) diff --git a/src/sage/rings/homset.py b/src/sage/rings/homset.py index 6013a6ca28b..876e31bc5aa 100644 --- a/src/sage/rings/homset.py +++ b/src/sage/rings/homset.py @@ -91,7 +91,7 @@ def _repr_(self): sage: Hom(ZZ, QQ) # indirect doctest Set of Homomorphisms from Integer Ring to Rational Field """ - return "Set of Homomorphisms from %s to %s"%(self.domain(), self.codomain()) + return "Set of Homomorphisms from %s to %s" % (self.domain(), self.codomain()) def has_coerce_map_from(self, x): """ @@ -212,7 +212,7 @@ def natural_map(self): """ f = self.codomain().coerce_map_from(self.domain()) if f is None: - raise TypeError("natural coercion morphism from %s to %s not defined"%(self.domain(), self.codomain())) + raise TypeError("natural coercion morphism from %s to %s not defined" % (self.domain(), self.codomain())) return f def zero(self): diff --git a/src/sage/rings/ideal.py b/src/sage/rings/ideal.py index 2bb3a47e4d3..53b7140129f 100644 --- a/src/sage/rings/ideal.py +++ b/src/sage/rings/ideal.py @@ -316,8 +316,8 @@ def _repr_short(self): s = s.replace('\n','\n ') L.append(s) if has_return: - return '\n(\n %s\n)\n'%(',\n\n '.join(L)) - return '(%s)'%(', '.join(L)) + return '\n(\n %s\n)\n' % (',\n\n '.join(L)) + return '(%s)' % (', '.join(L)) def __repr__(self): """ @@ -329,7 +329,7 @@ def __repr__(self): sage: P*[a^2,a*b+c,c^3] # indirect doctest Ideal (a^2, a*b + c, c^3) of Multivariate Polynomial Ring in a, b, c over Rational Field """ - return "Ideal %s of %s"%(self._repr_short(), self.ring()) + return "Ideal %s of %s" % (self._repr_short(), self.ring()) def random_element(self, *args, **kwds): """ @@ -1276,7 +1276,7 @@ def __repr__(self): sage: I # indirect doctest Principal ideal (x) of Univariate Polynomial Ring in x over Integer Ring """ - return "Principal ideal (%s) of %s"%(self.gen(), self.ring()) + return "Principal ideal (%s) of %s" % (self.gen(), self.ring()) def is_principal(self): r""" @@ -1687,7 +1687,7 @@ def residue_field(self): TypeError: residue fields only supported for polynomial rings over finite fields. """ if not self.is_prime(): - raise ValueError("The ideal (%s) is not prime"%self) + raise ValueError("The ideal (%s) is not prime" % self) from sage.rings.integer_ring import ZZ if self.ring() is ZZ: return ZZ.residue_field(self, check=False) @@ -1711,7 +1711,7 @@ def __repr__(self): sage: Ideal_fractional(K, [a]) # indirect doctest # optional - sage.rings.number_field Fractional ideal (a) of Number Field in a with defining polynomial x^2 + 1 """ - return "Fractional ideal %s of %s"%(self._repr_short(), self.ring()) + return "Fractional ideal %s of %s" % (self._repr_short(), self.ring()) # constructors for standard (benchmark) ideals, written uppercase as # these are constructors diff --git a/src/sage/rings/invariants/invariant_theory.py b/src/sage/rings/invariants/invariant_theory.py index f9b7f6a561b..14d585d8d8b 100644 --- a/src/sage/rings/invariants/invariant_theory.py +++ b/src/sage/rings/invariants/invariant_theory.py @@ -278,7 +278,7 @@ def transvectant(f, g, h=1, scale='default'): elif scale == 'none': scalar = 1 else: - raise ValueError('unknown scale type: %s' %scale) + raise ValueError('unknown scale type: %s' % scale) def diff(j): df = f.form().derivative(x,j).derivative(y,h-j) @@ -533,7 +533,7 @@ def __init__(self, n, d, polynomial, *args, **kwds): elif len(variables) == n-1: variables = variables + (None,) else: - raise ValueError('need '+str(n)+' or '+ + raise ValueError('need '+str(n)+' or ' + str(n-1)+' variables, got '+str(variables)) ring = polynomial.parent() homogeneous = variables[-1] is not None @@ -562,7 +562,7 @@ def _check(self): deg = sum([ e[R.gens().index(x)] for x in self._variables if x is not None ]) degrees.add(deg) - if self._homogeneous and len(degrees)>1: + if self._homogeneous and len(degrees) > 1: raise ValueError('polynomial is not homogeneous') if degrees == set() or \ (self._homogeneous and degrees == set([self._d])) or \ @@ -1492,7 +1492,7 @@ def EisensteinE(self): """ a = self.scaled_coeffs() assert len(a) == 5 - return a[0]*a[3]**2 +a[1]**2*a[4] -a[0]*a[2]*a[4] -2*a[1]*a[2]*a[3] +a[2]**3 + return a[0]*a[3]**2 + a[1]**2*a[4] - a[0]*a[2]*a[4] - 2*a[1]*a[2]*a[3] + a[2]**3 @cached_method def g_covariant(self): @@ -2442,9 +2442,9 @@ def arithmetic_invariants(self): invariants = {} invariants['I4'] = R(2)**-1*5**4*clebsch['A'] invariants['I8'] = 5**5 * (R(2)**-1*47*clebsch['A']**2 - -2**2*clebsch['B']) + - 2**2*clebsch['B']) invariants['I12'] = 5**10 * (R(2)**-1*3*clebsch['A']**3 - -2**5*R(3)**-1*clebsch['C']) + - 2**5*R(3)**-1*clebsch['C']) invariants['I18'] = 2**8*R(3)**-1*5**15 * clebsch['R'] return invariants @@ -2526,9 +2526,9 @@ def _covariant_conic(A_scaled_coeffs, B_scaled_coeffs, monomials): (b0*c1+c0*b1-2*f0*f1) * monomials[0] + (a0*c1+c0*a1-2*g0*g1) * monomials[1] + (a0*b1+b0*a1-2*h0*h1) * monomials[2] + - 2*(f0*g1+g0*f1 -c0*h1-h0*c1) * monomials[3] + - 2*(h0*f1+f0*h1 -b0*g1-g0*b1) * monomials[4] + - 2*(g0*h1+h0*g1 -a0*f1-f0*a1) * monomials[5] ) + 2*(f0*g1+g0*f1 - c0*h1-h0*c1) * monomials[3] + + 2*(h0*f1+f0*h1 - b0*g1-g0*b1) * monomials[4] + + 2*(g0*h1+h0*g1 - a0*f1-f0*a1) * monomials[5] ) ###################################################################### @@ -2856,12 +2856,12 @@ def S_invariant(self): """ a,b,c,a2,a3,b1,b3,c1,c2,m = self.scaled_coeffs() S = ( a*b*c*m-(b*c*a2*a3+c*a*b1*b3+a*b*c1*c2) - -m*(a*b3*c2+b*c1*a3+c*a2*b1) - +(a*b1*c2**2+a*c1*b3**2+b*a2*c1**2+b*c2*a3**2+c*b3*a2**2+c*a3*b1**2) - -m**4+2*m**2*(b1*c1+c2*a2+a3*b3) - -3*m*(a2*b3*c1+a3*b1*c2) - -(b1**2*c1**2+c2**2*a2**2+a3**2*b3**2) - +(c2*a2*a3*b3+a3*b3*b1*c1+b1*c1*c2*a2) ) + - m*(a*b3*c2+b*c1*a3+c*a2*b1) + + (a*b1*c2**2+a*c1*b3**2+b*a2*c1**2+b*c2*a3**2+c*b3*a2**2+c*a3*b1**2) + - m**4+2*m**2*(b1*c1+c2*a2+a3*b3) + - 3*m*(a2*b3*c1+a3*b1*c2) + - (b1**2*c1**2+c2**2*a2**2+a3**2*b3**2) + + (c2*a2*a3*b3+a3*b3*b1*c1+b1*c1*c2*a2) ) return S def T_invariant(self): @@ -2882,35 +2882,35 @@ def T_invariant(self): """ a,b,c,a2,a3,b1,b3,c1,c2,m = self.scaled_coeffs() T = ( a**2*b**2*c**2-6*a*b*c*(a*b3*c2+b*c1*a3+c*a2*b1) - -20*a*b*c*m**3+12*a*b*c*m*(b1*c1+c2*a2+a3*b3) - +6*a*b*c*(a2*b3*c1+a3*b1*c2)+ - 4*(a**2*b*c2**3+a**2*c*b3**3+b**2*c*a3**3+ + - 20*a*b*c*m**3+12*a*b*c*m*(b1*c1+c2*a2+a3*b3) + + 6*a*b*c*(a2*b3*c1+a3*b1*c2) + + 4*(a**2*b*c2**3+a**2*c*b3**3+b**2*c*a3**3 + b**2*a*c1**3+c**2*a*b1**3+c**2*b*a2**3) - +36*m**2*(b*c*a2*a3+c*a*b1*b3+a*b*c1*c2) - -24*m*(b*c*b1*a3**2+b*c*c1*a2**2+c*a*c2*b1**2+c*a*a2*b3**2+a*b*a3*c2**2+ + + 36*m**2*(b*c*a2*a3+c*a*b1*b3+a*b*c1*c2) + - 24*m*(b*c*b1*a3**2+b*c*c1*a2**2+c*a*c2*b1**2+c*a*a2*b3**2+a*b*a3*c2**2 + a*b*b3*c1**2) - -3*(a**2*b3**2*c2**2+b**2*c1**2*a3**2+c**2*a2**2*b1**2)+ + - 3*(a**2*b3**2*c2**2+b**2*c1**2*a3**2+c**2*a2**2*b1**2) + 18*(b*c*b1*c1*a2*a3+c*a*c2*a2*b3*b1+a*b*a3*b3*c1*c2) - -12*(b*c*c2*a3*a2**2+b*c*b3*a2*a3**2+c*a*c1*b3*b1**2+ + - 12*(b*c*c2*a3*a2**2+b*c*b3*a2*a3**2+c*a*c1*b3*b1**2 + c*a*a3*b1*b3**2+a*b*a2*c1*c2**2+a*b*b1*c2*c1**2) - -12*m**3*(a*b3*c2+b*c1*a3+c*a2*b1) - +12*m**2*(a*b1*c2**2+a*c1*b3**2+b*a2*c1**2+ + - 12*m**3*(a*b3*c2+b*c1*a3+c*a2*b1) + + 12*m**2*(a*b1*c2**2+a*c1*b3**2+b*a2*c1**2 + b*c2*a3**2+c*b3*a2**2+c*a3*b1**2) - -60*m*(a*b1*b3*c1*c2+b*c1*c2*a2*a3+c*a2*a3*b1*b3) - +12*m*(a*a2*b3*c2**2+a*a3*c2*b3**2+b*b3*c1*a3**2+ + - 60*m*(a*b1*b3*c1*c2+b*c1*c2*a2*a3+c*a2*a3*b1*b3) + + 12*m*(a*a2*b3*c2**2+a*a3*c2*b3**2+b*b3*c1*a3**2 + b*b1*a3*c1**2+c*c1*a2*b1**2+c*c2*b1*a2**2) - +6*(a*b3*c2+b*c1*a3+c*a2*b1)*(a2*b3*c1+a3*b1*c2) - +24*(a*b1*b3**2*c1**2+a*c1*c2**2*b1**2+b*c2*c1**2*a2**2 - +b*a2*a3**2*c2**2+c*a3*a2**2*b3**2+c*b3*b1**2*a3**2) - -12*(a*a2*b1*c2**3+a*a3*c1*b3**3+b*b3*c2*a3**3+b*b1*a2*c1**3 - +c*c1*a3*b1**3+c*c2*b3*a2**3) - -8*m**6+24*m**4*(b1*c1+c2*a2+a3*b3)-36*m**3*(a2*b3*c1+a3*b1*c2) - -12*m**2*(b1*c1*c2*a2+c2*a2*a3*b3+a3*b3*b1*c1) - -24*m**2*(b1**2*c1**2+c2**2*a2**2+a3**2*b3**2) - +36*m*(a2*b3*c1+a3*b1*c2)*(b1*c1+c2*a2+a3*b3) - +8*(b1**3*c1**3+c2**3*a2**3+a3**3*b3**3) - -27*(a2**2*b3**2*c1**2+a3**2*b1**2*c2**2)-6*b1*c1*c2*a2*a3*b3 - -12*(b1**2*c1**2*c2*a2+b1**2*c1**2*a3*b3+c2**2*a2**2*a3*b3+ + + 6*(a*b3*c2+b*c1*a3+c*a2*b1)*(a2*b3*c1+a3*b1*c2) + + 24*(a*b1*b3**2*c1**2+a*c1*c2**2*b1**2+b*c2*c1**2*a2**2 + + b*a2*a3**2*c2**2+c*a3*a2**2*b3**2+c*b3*b1**2*a3**2) + - 12*(a*a2*b1*c2**3+a*a3*c1*b3**3+b*b3*c2*a3**3+b*b1*a2*c1**3 + + c*c1*a3*b1**3+c*c2*b3*a2**3) + - 8*m**6+24*m**4*(b1*c1+c2*a2+a3*b3)-36*m**3*(a2*b3*c1+a3*b1*c2) + - 12*m**2*(b1*c1*c2*a2+c2*a2*a3*b3+a3*b3*b1*c1) + - 24*m**2*(b1**2*c1**2+c2**2*a2**2+a3**2*b3**2) + + 36*m*(a2*b3*c1+a3*b1*c2)*(b1*c1+c2*a2+a3*b3) + + 8*(b1**3*c1**3+c2**3*a2**3+a3**3*b3**3) + - 27*(a2**2*b3**2*c1**2+a3**2*b1**2*c2**2)-6*b1*c1*c2*a2*a3*b3 + - 12*(b1**2*c1**2*c2*a2+b1**2*c1**2*a3*b3+c2**2*a2**2*a3*b3 + c2**2*a2**2*b1*c1+a3**2*b3**2*b1*c1+a3**2*b3**2*c2*a2) ) return T @@ -3086,8 +3086,8 @@ def syzygy(self, U, S, T, H, Theta, J): return ( -J**2 + 4*Theta**3 + T*U**2*Theta**2 + Theta*(-4*S**3*U**4 + 2*S*T*U**3*H - 72*S**2*U**2*H**2 - 18*T*U*H**3 + 108*S*H**4) - -16*S**4*U**5*H - 11*S**2*T*U**4*H**2 -4*T**2*U**3*H**3 - +54*S*T*U**2*H**4 -432*S**2*U*H**5 -27*T*H**6 ) + - 16*S**4*U**5*H - 11*S**2*T*U**4*H**2 - 4*T**2*U**3*H**3 + + 54*S*T*U**2*H**4 - 432*S**2*U*H**5 - 27*T*H**6 ) ###################################################################### @@ -3967,7 +3967,7 @@ def syzygy(self, Delta, Theta, Phi, Theta_prime, Delta_prime, U, V, T, T_prime, (Theta*Phi - 3*Theta_prime*Delta)*T**2*T_prime + (Theta*Theta_prime - 4*Delta*Delta_prime)*T*T_prime**2 - (Delta_prime*Theta)*T_prime**3 - )* V + \ + ) * V + \ ( (Delta*Phi*Delta_prime) * T**2 + (3*Delta*Theta_prime*Delta_prime - Theta*Phi*Delta_prime) * T*T_prime + (2*Delta*Delta_prime**2 - 2*Theta*Theta_prime*Delta_prime diff --git a/src/sage/rings/lazy_series_ring.py b/src/sage/rings/lazy_series_ring.py index 32545f65574..84ee160e77a 100644 --- a/src/sage/rings/lazy_series_ring.py +++ b/src/sage/rings/lazy_series_ring.py @@ -1019,7 +1019,7 @@ def _test_revert(self, **options): count += 1 e1 = y(x) e2 = x(y) - tester.assertEqual(e1, e2, "y(x) and x(y) differ for x = %s and y = %s" %(x, y)) + tester.assertEqual(e1, e2, "y(x) and x(y) differ for x = %s and y = %s" % (x, y)) # tester.assertEqual(e1, self.gen()) # we want to test at least 2 elements tester.assertGreater(count, 1, msg="only %s elements in %s.some_elements() have a compositional inverse" % (count, self)) diff --git a/src/sage/rings/multi_power_series_ring.py b/src/sage/rings/multi_power_series_ring.py index 410de0bbff0..5670946492a 100644 --- a/src/sage/rings/multi_power_series_ring.py +++ b/src/sage/rings/multi_power_series_ring.py @@ -402,7 +402,7 @@ def _repr_(self): else: generators_rep = ", ".join(self.variable_names()) - s = "Multivariate Power Series Ring in %s over %s"%(generators_rep, self.base_ring()) + s = "Multivariate Power Series Ring in %s over %s" % (generators_rep, self.base_ring()) if self.is_sparse(): s = 'Sparse ' + s return s @@ -419,7 +419,7 @@ def _latex_(self): '\\Bold{Q}[[v_{0}, v_{1}, v_{2}, v_{3}]]' """ generators_latex = ", ".join(self.latex_variable_names()) - return "%s[[%s]]"%(latex.latex(self.base_ring()), generators_latex) + return "%s[[%s]]" % (latex.latex(self.base_ring()), generators_latex) def is_integral_domain(self, proof=False): """ diff --git a/src/sage/rings/multi_power_series_ring_element.py b/src/sage/rings/multi_power_series_ring_element.py index 9aa3f6ea5a4..8a67ca7c551 100644 --- a/src/sage/rings/multi_power_series_ring_element.py +++ b/src/sage/rings/multi_power_series_ring_element.py @@ -593,7 +593,7 @@ def _repr_(self): if self._prec == infinity: return "%s" % self._value() return "%(val)s + O(%(gens)s)^%(prec)s" \ - %{'val':self._value(), + % {'val':self._value(), 'gens':', '.join(str(g) for g in self.parent().gens()), 'prec':self._prec} @@ -628,7 +628,7 @@ def _latex_(self): if self._prec == infinity: return "%s" % self._value()._latex_() return "%(val)s + O(%(gens)s)^{%(prec)s}" \ - %{'val':self._value()._latex_(), + % {'val':self._value()._latex_(), 'gens':', '.join(g._latex_() for g in self.parent().gens()), 'prec':self._prec} @@ -1220,7 +1220,7 @@ def coefficients(self): tmp = {} for j in self._bg_value.coefficients(): for m in j.monomials(): - tmp[self.parent(m)]=j.monomial_coefficient(self.parent()._poly_ring(m)) + tmp[self.parent(m)] = j.monomial_coefficient(self.parent()._poly_ring(m)) return tmp def constant_coefficient(self): diff --git a/src/sage/rings/number_field/S_unit_solver.py b/src/sage/rings/number_field/S_unit_solver.py index a986e3c513c..92f7af1bf19 100644 --- a/src/sage/rings/number_field/S_unit_solver.py +++ b/src/sage/rings/number_field/S_unit_solver.py @@ -278,7 +278,7 @@ def mus(SUK, v): """ betas = SUK.fundamental_units() beta_and_ns = [[beta,beta.valuation(v)] for beta in betas] - if all(pair[1]==0 for pair in beta_and_ns): + if all(pair[1] == 0 for pair in beta_and_ns): return betas else: good_pair = beta_k(beta_and_ns) @@ -397,7 +397,7 @@ def Yu_a1_kappa1_c1(p, dK, ep): c1 = 1473 else: c1 = 319 - elif p%4 == 1: + elif p % 4 == 1: if ep == 1: c1 = 1473 else: @@ -461,10 +461,10 @@ def Yu_condition_115(K, v): if q == 2: if p**f % 4 == 1: return True - if w%4 == 0: + if w % 4 == 0: return True else: - if w%3 == 0: + if w % 3 == 0: return True return False @@ -1342,7 +1342,7 @@ def log_p_series_part(a, prime, prec): divisor = q.divisors() order = min(d for d in divisor if (a**d - 1).valuation(prime) > 0) - gamma= a**order + gamma = a**order t = 0 while (gamma-1).valuation(prime) <= e: t += 1 @@ -2461,7 +2461,7 @@ def compatible_vectors(a, m0, m1, g): 27 """ # recall that the 0th entry must be an exact match. - ranges = [[a[0]]] + [range(a[i]%g, (a[i]%g) + m1, g) for i in range(1, len(a))] + ranges = [[a[0]]] + [range(a[i] % g, (a[i] % g) + m1, g) for i in range(1, len(a))] return itertools.product(*ranges) diff --git a/src/sage/rings/number_field/class_group.py b/src/sage/rings/number_field/class_group.py index 5be046865f6..2bae4dd2df0 100644 --- a/src/sage/rings/number_field/class_group.py +++ b/src/sage/rings/number_field/class_group.py @@ -102,7 +102,7 @@ def _repr_(self): """ if self.is_principal(): return 'Trivial principal fractional ideal class' - return 'Fractional ideal class %s'%self._value._repr_short() + return 'Fractional ideal class %s' % self._value._repr_short() def _mul_(self, other): r""" @@ -301,7 +301,7 @@ def representative_prime(self, norm_bound=1000): K = Cl.number_field() from sage.rings.real_mpfr import RR for P in K.primes_of_bounded_norm_iter(RR(norm_bound)): - if Cl(P)==c: + if Cl(P) == c: return P raise RuntimeError("No prime of norm less than %s found in class %s" % (norm_bound, c)) @@ -607,10 +607,10 @@ def _repr_(self): sage: C._repr_() 'Class group of order 3 with structure C3 of Number Field in a with defining polynomial x^2 + 23' """ - s = 'Class group of order %s '%self.order() + s = 'Class group of order %s ' % self.order() if self.order() > 1: - s += 'with structure %s '%self._group_notation(self.gens_orders()) - s += 'of %s'%self.number_field() + s += 'with structure %s ' % self._group_notation(self.gens_orders()) + s += 'of %s' % self.number_field() return s def number_field(self): diff --git a/src/sage/rings/number_field/homset.py b/src/sage/rings/number_field/homset.py index a28660ca5d0..0e414e233c6 100644 --- a/src/sage/rings/number_field/homset.py +++ b/src/sage/rings/number_field/homset.py @@ -238,7 +238,7 @@ def list(self): v = [D.hom([r], codomain=C, check=False) for r in roots] else: v = [] - return Sequence(v, universe=self, check=False, immutable=True, cr=v!=[]) + return Sequence(v, universe=self, check=False, immutable=True, cr=v != []) def __getitem__(self, n): r""" @@ -519,7 +519,7 @@ def list(self): C = self.codomain() D_abs = D.absolute_field('a') v = [self(f, check=False) for f in D_abs.Hom(C).list()] - return Sequence(v, universe=self, check=False, immutable=True, cr=v!=[]) + return Sequence(v, universe=self, check=False, immutable=True, cr=v != []) class CyclotomicFieldHomset(NumberFieldHomset): @@ -615,11 +615,11 @@ def list(self): z = D.gen() n = z.multiplicative_order() if not n.divides(C.zeta_order()): - v =[] + v = [] else: if D == C: w = z else: w = C.zeta(n) v = [self([w**k], check=False) for k in Zmod(n) if k.is_unit()] - return Sequence(v, universe=self, check=False, immutable=True, cr=v!=[]) + return Sequence(v, universe=self, check=False, immutable=True, cr=v != []) diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py index b5e724a0ab4..924eaa2177f 100644 --- a/src/sage/rings/number_field/number_field_ideal.py +++ b/src/sage/rings/number_field/number_field_ideal.py @@ -133,7 +133,7 @@ def __init__(self, field, gens, coerce=True): else: # Assume one element of the field gens = [field(gens, check=False)] - if len(gens)==0: + if len(gens) == 0: raise ValueError("gens must have length at least 1 (zero ideal is not a fractional ideal)") Ideal_generic.__init__(self, field, gens, coerce) if field.absolute_degree() == 2: @@ -288,8 +288,8 @@ def _mul_(self, other): if self.ngens() == 1 and other.ngens() == 1: return self.ring().ideal(self.gen(0) * other.gen(0)) - K=self.ring() - K_pari=K.pari_nf() + K = self.ring() + K_pari = K.pari_nf() return K.ideal(K_pari.idealmul(self, other)) def coordinates(self, x): @@ -2472,7 +2472,7 @@ def is_coprime(self, other): N1 = self.numerator() D2 = other.denominator() N2 = other.numerator() - return N1+N2==one and N1+D2==one and D1+N2==one and D1+D2==one + return N1+N2 == one and N1+D2 == one and D1+N2 == one and D1+D2 == one def idealcoprime(self, J): """ @@ -2651,7 +2651,7 @@ def idealstar(self, flag=1): ALGORITHM: Uses Pari function :pari:`idealstar` """ k = self.number_field() - if flag==0 and not hasattr(self, '_bid'): + if flag == 0 and not hasattr(self, '_bid'): G = k.pari_nf().idealstar(self.pari_hnf(), 0) else: G = self._pari_bid_(flag) diff --git a/src/sage/rings/number_field/number_field_ideal_rel.py b/src/sage/rings/number_field/number_field_ideal_rel.py index e19d0df9c1c..5ef403e7e23 100644 --- a/src/sage/rings/number_field/number_field_ideal_rel.py +++ b/src/sage/rings/number_field/number_field_ideal_rel.py @@ -687,7 +687,7 @@ def absolute_ramification_index(self): """ if self.is_prime(): return self.absolute_ideal().ramification_index() - raise ValueError("the fractional ideal (= %s) is not prime"%self) + raise ValueError("the fractional ideal (= %s) is not prime" % self) def relative_ramification_index(self): """ @@ -722,7 +722,7 @@ def relative_ramification_index(self): abs_index = self.absolute_ramification_index() base_ideal = self.ideal_below() return ZZ(abs_index/base_ideal.absolute_ramification_index()) - raise ValueError("the fractional ideal (= %s) is not prime"%self) + raise ValueError("the fractional ideal (= %s) is not prime" % self) def ramification_index(self): r""" @@ -758,7 +758,7 @@ def residue_class_degree(self): """ if self.is_prime(): return self.absolute_ideal().residue_class_degree() - raise ValueError("the ideal (= %s) is not prime"%self) + raise ValueError("the ideal (= %s) is not prime" % self) def residues(self): """ @@ -815,14 +815,14 @@ def element_1_mod(self, other): # Catch invalid inputs by making sure that we can make an ideal out of other. K = self.number_field() if not self.is_integral(): - raise TypeError("%s is not an integral ideal"%self) + raise TypeError("%s is not an integral ideal" % self) other = K.ideal(other) if not other.is_integral(): - raise TypeError("%s is not an integral ideal"%other) + raise TypeError("%s is not an integral ideal" % other) if not self.is_coprime(other): - raise TypeError("%s and %s are not coprime ideals"%(self, other)) + raise TypeError("%s and %s are not coprime ideals" % (self, other)) to_K = K.absolute_field('a').structure()[0] return to_K(self.absolute_ideal().element_1_mod(other.absolute_ideal())) @@ -874,13 +874,13 @@ def valuation(self, p): ValueError: p (= Fractional ideal (5)) must be a prime """ if p == 0: - raise ValueError("p (= %s) must be nonzero"%p) + raise ValueError("p (= %s) must be nonzero" % p) if not isinstance(p, NumberFieldFractionalIdeal): p = self.number_field().ideal(p) if not p.is_prime(): - raise ValueError("p (= %s) must be a prime"%p) + raise ValueError("p (= %s) must be a prime" % p) if p.ring() != self.number_field(): - raise ValueError("p (= %s) must be an ideal in %s"%self.number_field()) + raise ValueError("p (= %s) must be an ideal in %s" % self.number_field()) return self.absolute_ideal().valuation(p.absolute_ideal()) def is_NumberFieldFractionalIdeal_rel(x): diff --git a/src/sage/rings/number_field/number_field_rel.py b/src/sage/rings/number_field/number_field_rel.py index 2e2989d413f..ca42a1b2247 100644 --- a/src/sage/rings/number_field/number_field_rel.py +++ b/src/sage/rings/number_field/number_field_rel.py @@ -281,7 +281,7 @@ def __init__(self, base, polynomial, name, if names is not None: name = names if not isinstance(base, NumberField_base): - raise TypeError("base (=%s) must be a number field"%base) + raise TypeError("base (=%s) must be a number field" % base) if not isinstance(polynomial, polynomial_element.Polynomial): try: polynomial = polynomial.polynomial(base) @@ -313,7 +313,7 @@ def __init__(self, base, polynomial, name, self._element_class = number_field_element.NumberFieldElement_relative if check and not self.pari_relative_polynomial().polisirreducible(): - raise ValueError("defining polynomial (%s) must be irreducible"%polynomial) + raise ValueError("defining polynomial (%s) must be irreducible" % polynomial) names = (name,) + base.variable_names() self._assign_names(tuple(names), normalize=False) @@ -463,7 +463,7 @@ def subfields(self, degree=0, name=None): if to_K is not None: to_K = RelativeNumberFieldHomomorphism_from_abs(self.Hom(K), to_K*to_abs) ans.append((K, from_K, to_K)) - ans = Sequence(ans, immutable=True, cr=ans!=[]) + ans = Sequence(ans, immutable=True, cr=ans != []) return ans def is_absolute(self): @@ -753,7 +753,7 @@ def _repr_(self): Number Field in b with defining polynomial x^7 + 3 """ - return "Number Field in %s with defining polynomial %s over its base field"%(self.variable_name(), self.relative_polynomial()) + return "Number Field in %s with defining polynomial %s over its base field" % (self.variable_name(), self.relative_polynomial()) def _Hom_(self, codomain, category=None): """ @@ -798,7 +798,7 @@ def _latex_(self): '( \\Bold{Q}[a]/(a^{3} - 2) )[b]/(b^{2} + b + a)' """ latex_name = self.latex_variable_names()[0] - return "( %s )[%s]/(%s)"%(latex(self.base_field()), latex_name, + return "( %s )[%s]/(%s)" % (latex(self.base_field()), latex_name, self.relative_polynomial()._latex_(latex_name)) def _coerce_from_other_number_field(self, x): @@ -2077,7 +2077,7 @@ def embeddings(self, K): # then it is most natural, so we put it first. put_natural_embedding_first(v) - self.__embeddings[K] = Sequence(v, cr=v!=[], immutable=True, check=False, universe=self.Hom(K)) + self.__embeddings[K] = Sequence(v, cr=v != [], immutable=True, check=False, universe=self.Hom(K)) return self.__embeddings[K] def automorphisms(self): @@ -2576,7 +2576,7 @@ def lift_to_base(self, element): # Now we should have a polynomial in the variable y. # Otherwise we're not in the base field. if r.type() != "t_POL" or str(r.variable()) != 'y': - raise ValueError("The element %s is not in the base field"%element) + raise ValueError("The element %s is not in the base field" % element) return self.base_field()(r, check=False) def relativize(self, alpha, names): @@ -2711,7 +2711,7 @@ def uniformizer(self, P, others="positive"): if not is_NumberFieldIdeal(P): P = self.ideal(P) if not P.is_maximal(): - raise ValueError("P (=%s) must be a nonzero prime."%P) + raise ValueError("P (=%s) must be a nonzero prime." % P) abs = self.absolute_field('a') from_abs = abs.structure()[0] return from_abs(abs.uniformizer(P.absolute_ideal(), others=others)) diff --git a/src/sage/rings/number_field/selmer_group.py b/src/sage/rings/number_field/selmer_group.py index 77e1f4a84d8..37abe43101e 100644 --- a/src/sage/rings/number_field/selmer_group.py +++ b/src/sage/rings/number_field/selmer_group.py @@ -286,7 +286,7 @@ def coords_in_U_mod_p(u, U, p): """ coords = U.log(u) start = 1 - int(p.divides(U.zeta_order())) # 0 or 1 - return [c%p for c in coords[start:]] + return [c % p for c in coords[start:]] def basis_for_p_cokernel(S, C, p): r""" @@ -548,7 +548,7 @@ def pSelmerGroup(K, S, p, proof=None, debug=False): hK = 1 if K == QQ else K.class_number(proof=proof) C = K.class_group() if K == QQ else K.class_group(proof=proof) - hKp = (hK%p == 0) # flag whether the class number is divisible by p + hKp = (hK % p == 0) # flag whether the class number is divisible by p if K == QQ: if p == 2: @@ -684,7 +684,7 @@ def to_KSp(a): if debug: print("B={}".format(B)) - a3 = B if K==QQ else _ideal_generator(B) + a3 = B if K == QQ else _ideal_generator(B) if debug: print("a3={}".format(a3)) a /= a3 ** p @@ -699,7 +699,7 @@ def to_KSp(a): if debug: if K == QQ: - assert a.abs()==1 + assert a.abs() == 1 else: assert K.ideal(a).is_one() diff --git a/src/sage/rings/number_field/splitting_field.py b/src/sage/rings/number_field/splitting_field.py index 448adc6b529..927ecb3b5fb 100644 --- a/src/sage/rings/number_field/splitting_field.py +++ b/src/sage/rings/number_field/splitting_field.py @@ -109,7 +109,7 @@ def __repr__(self): sage: print(SplittingData(pari("polcyclo(24)"), 2)) SplittingData(x^8 - x^4 + 1, 2) """ - return "SplittingData(%s, %s)"%(self.pol, self.dm) + return "SplittingData(%s, %s)" % (self.pol, self.dm) def _repr_tuple(self): """ @@ -391,7 +391,7 @@ def splitting_field(poly, name, map=False, degree_multiple=None, abort_degree=No # (only needed if map=True) if map: Fgen = F.gen().__pari__() - verbose("Starting field: %s"%Kpol) + verbose("Starting field: %s" % Kpol) # L and Lred are lists of SplittingData. # L contains polynomials which are irreducible over K, @@ -415,7 +415,7 @@ def splitting_field(poly, name, map=False, degree_multiple=None, abort_degree=No raise SplittingFieldAbort(absolute_degree * rel_degree_divisor, degree_multiple) # First, factor polynomials in Lred and store the result in L - verbose("SplittingData to factor: %s"%[s._repr_tuple() for s in Lred]) + verbose("SplittingData to factor: %s" % [s._repr_tuple() for s in Lred]) t = cputime() for splitting in Lred: m = splitting.dm.gcd(degree_multiple).gcd(factorial(splitting.poldegree())) @@ -455,7 +455,7 @@ def splitting_field(poly, name, map=False, degree_multiple=None, abort_degree=No # Compute cubic resolvent a0, a1, a2, a3, a4 = (q/q.pollead()).Vecrev() assert a4 == 1 - cubicpol = pari([4*a0*a2 - a1*a1 -a0*a3*a3, a1*a3 - 4*a0, -a2, 1]).Polrev() + cubicpol = pari([4*a0*a2 - a1*a1 - a0*a3*a3, a1*a3 - 4*a0, -a2, 1]).Polrev() cubicfactors = Kpol.nffactor(cubicpol)[0] if len(cubicfactors) == 1: # A4 or S4 # After adding a root of the cubic resolvent, @@ -505,8 +505,8 @@ def splitting_field(poly, name, map=False, degree_multiple=None, abort_degree=No # Sort according to degree to handle low degrees first L.sort(key=lambda x: x.key()) - verbose("SplittingData to handle: %s"%[s._repr_tuple() for s in L]) - verbose("Bounds for absolute degree: [%s, %s]"%(degree_divisor,degree_multiple)) + verbose("SplittingData to handle: %s" % [s._repr_tuple() for s in L]) + verbose("Bounds for absolute degree: [%s, %s]" % (degree_divisor,degree_multiple)) # Check consistency if degree_multiple % degree_divisor != 0: @@ -525,7 +525,7 @@ def splitting_field(poly, name, map=False, degree_multiple=None, abort_degree=No # Add a root of f = L[0] to construct the field N = K[x]/f(x) splitting = L[0] f = splitting.pol - verbose("Handling polynomial %s"%(f.lift()), level=2) + verbose("Handling polynomial %s" % (f.lift()), level=2) t = cputime() Npol, KtoN, k = Kpol.rnfequation(f, flag=1) @@ -547,7 +547,7 @@ def splitting_field(poly, name, map=False, degree_multiple=None, abort_degree=No if simplify_all or (simplify and not finished): # Find a simpler defining polynomial Lpol for Mpol - verbose("New field before simplifying: %s"%Mpol, t) + verbose("New field before simplifying: %s" % Mpol, t) t = cputime() M = Mpol.polred(flag=3) n = len(M[0])-1 @@ -562,7 +562,7 @@ def splitting_field(poly, name, map=False, degree_multiple=None, abort_degree=No NtoL = MtoL/Mdiv KtoL = KtoN.lift().subst("x", NtoL).Mod(Lpol) Kpol = Lpol # New Kpol (for next iteration) - verbose("New field: %s"%Kpol, t) + verbose("New field: %s" % Kpol, t) if map: t = cputime() Fgen = Fgen.lift().subst("y", KtoL) diff --git a/src/sage/rings/number_field/totallyreal_phc.py b/src/sage/rings/number_field/totallyreal_phc.py index 890a0a2f469..4143feb67b3 100644 --- a/src/sage/rings/number_field/totallyreal_phc.py +++ b/src/sage/rings/number_field/totallyreal_phc.py @@ -126,12 +126,12 @@ def __lagrange_bounds_phc(n, m, a, tmpfile=None): for P in sage.combinat.partition.Partitions(n-1,length=m-1): f = open(tmpfile, 'w') # First line: number of variables/equations - f.write('%d'%m + '\n') + f.write('%d' % m + '\n') # In the next m-1 lines, write the equation S_j(x) = S[j] for j in range(1,m+1): for i in range(m-1): - f.write('%d'%P[i] + '*x%d'%i + '**%d'%j + ' + ') - f.write('xn**%d'%j + ' - (%d'%S[j] + ');\n') + f.write('%d' % P[i] + '*x%d' % i + '**%d' % j + ' + ') + f.write('xn**%d' % j + ' - (%d' % S[j] + ');\n') f.close() os.remove(tmpfile + '.phc') diff --git a/src/sage/rings/number_field/totallyreal_rel.py b/src/sage/rings/number_field/totallyreal_rel.py index 65026b38885..d7039c26c86 100644 --- a/src/sage/rings/number_field/totallyreal_rel.py +++ b/src/sage/rings/number_field/totallyreal_rel.py @@ -300,7 +300,7 @@ def __init__(self, F, m, B, a=None): import numpy for i in range(len(anm1s)): Q = [[v(m*x) for v in self.Foo] + [0] for x in Z_Fbasis] + [[v(anm1s[i]) for v in self.Foo] + [10**6]] - pari_string = '['+';'.join([','.join(["%s"%ii for ii in row]) for row in zip(*Q)])+']' + pari_string = '['+';'.join([','.join(["%s" % ii for ii in row]) for row in zip(*Q)])+']' adj = pari(pari_string).qflll()[self.d] anm1s[i] += sum([m*Z_Fbasis[ii]*int(adj[ii])//int(adj[self.d]) for ii in range(self.d)]) @@ -322,7 +322,7 @@ def __init__(self, F, m, B, a=None): # currently unknown; e.g., if k == -1, then we can iterate # over polynomials, and if k == n-1, then we have finished iterating. if a[len(a)-1] != 1: - raise ValueError("a[len(a)-1](=%s) must be 1 so polynomial is monic"%a[len(a)-1]) + raise ValueError("a[len(a)-1](=%s) must be 1 so polynomial is monic" % a[len(a)-1]) raise NotImplementedError("These have not been checked.") diff --git a/src/sage/rings/number_field/unit_group.py b/src/sage/rings/number_field/unit_group.py index 42c3933219b..5f9d5c0654c 100644 --- a/src/sage/rings/number_field/unit_group.py +++ b/src/sage/rings/number_field/unit_group.py @@ -321,12 +321,12 @@ def __init__(self, number_field, proof=True, S=None): try: S = tuple(K.ideal(S).prime_factors()) except (NameError, TypeError, ValueError): - raise ValueError("Cannot make a set of primes from %s"%(S,)) + raise ValueError("Cannot make a set of primes from %s" % (S,)) else: try: S = tuple(K.ideal(P) for P in S) except (NameError, TypeError, ValueError): - raise ValueError("Cannot make a set of primes from %s"%(S,)) + raise ValueError("Cannot make a set of primes from %s" % (S,)) if not all(P.is_prime() for P in S): raise ValueError("Not all elements of %s are prime ideals" % (S,)) self.__S = S @@ -398,14 +398,14 @@ def _element_constructor_(self, u): try: u = K(u) except TypeError: - raise ValueError("%s is not an element of %s"%(u,K)) + raise ValueError("%s is not an element of %s" % (u,K)) if self.__S: m = pK.bnfisunit(pari(u), self.__S_unit_data).mattranspose() if m.ncols() == 0: - raise ValueError("%s is not an S-unit"%u) + raise ValueError("%s is not an S-unit" % u) else: if not u.is_integral() or u.norm().abs() != 1: - raise ValueError("%s is not a unit"%u) + raise ValueError("%s is not a unit" % u) m = pK.bnfisunit(pari(u)).mattranspose() # convert column matrix to a list: @@ -448,11 +448,11 @@ def _repr_(self): with S = (Fractional ideal (a),) """ if self.__S: - return 'S-unit group with structure %s of %s with S = %s'%( + return 'S-unit group with structure %s of %s with S = %s' % ( self._group_notation(self.gens_orders()), self.number_field(), self.primes()) - return 'Unit group with structure %s of %s'%( + return 'Unit group with structure %s of %s' % ( self._group_notation(self.gens_orders()), self.number_field()) @@ -561,7 +561,7 @@ def zeta(self, n=2, all=False): K = self.number_field() n = ZZ(n) if n <= 0: - raise ValueError("n (=%s) must be positive"%n) + raise ValueError("n (=%s) must be positive" % n) if n == 1: if all: return [K(1)] @@ -582,7 +582,7 @@ def zeta(self, n=2, all=False): if all: return [] else: - raise ValueError("n (=%s) does not divide order of generator"%n) + raise ValueError("n (=%s) does not divide order of generator" % n) def number_field(self): """ diff --git a/src/sage/rings/padics/factory.py b/src/sage/rings/padics/factory.py index e001b9e5086..d8d7c7e3c3b 100644 --- a/src/sage/rings/padics/factory.py +++ b/src/sage/rings/padics/factory.py @@ -301,7 +301,7 @@ def get_key_base(p, prec, type, print_mode, names, ram_name, print_pos, print_se if not isinstance(print_ram_name, str): print_ram_name = str(print_ram_name) if names != print_ram_name: - raise ValueError("If both names (%s) and print_ram_name (%s) are specified, they must agree"%(names, print_ram_name)) + raise ValueError("If both names (%s) and print_ram_name (%s) are specified, they must agree" % (names, print_ram_name)) name = names else: if names is None: @@ -311,7 +311,7 @@ def get_key_base(p, prec, type, print_mode, names, ram_name, print_pos, print_se else: name = str(names) if type not in valid_types: - raise ValueError("type must be %s"%(", ".join(valid_types))) + raise ValueError("type must be %s" % (", ".join(valid_types))) show_prec = _canonicalize_show_prec(type, print_mode, show_prec) key = (p, prec, type, print_mode, name, print_pos, print_sep, tuple(print_alphabet), print_max_terms, show_prec, label) return key @@ -1343,7 +1343,7 @@ def Qq(q, prec=None, type='capped-rel', modulus=None, names=None, k = Integer(k) if check: - if not p.is_prime() or k <=0: + if not p.is_prime() or k <= 0: raise ValueError("q must be a prime power") if prec is not None and not isinstance(prec, Integer): diff --git a/src/sage/rings/padics/generic_nodes.py b/src/sage/rings/padics/generic_nodes.py index c3d9dce2ded..0832f317b4d 100644 --- a/src/sage/rings/padics/generic_nodes.py +++ b/src/sage/rings/padics/generic_nodes.py @@ -1471,7 +1471,7 @@ def random_element(self, algorithm='default'): else: return self(ZZ.random_element(self.prime_pow.pow_Integer_Integer(self.precision_cap()))) else: - raise NotImplementedError("Don't know %s algorithm"%algorithm) + raise NotImplementedError("Don't know %s algorithm" % algorithm) #def unit_group(self): # raise NotImplementedError diff --git a/src/sage/rings/padics/lattice_precision.py b/src/sage/rings/padics/lattice_precision.py index d2ad57b869d..9c76ff88362 100644 --- a/src/sage/rings/padics/lattice_precision.py +++ b/src/sage/rings/padics/lattice_precision.py @@ -676,9 +676,9 @@ def _repr_(self): sage: R.precision() Precision lattice on 0 objects (label: mylabel) """ - label = "" if self._label is None else " (label: %s)"%(self._label,) - count = "1 object" if len(self._elements) == 1 else "%s objects"%len(self._elements) - return "%s on %s%s"%(self._repr_type, count, label) + label = "" if self._label is None else " (label: %s)" % (self._label,) + count = "1 object" if len(self._elements) == 1 else "%s objects" % len(self._elements) + return "%s on %s%s" % (self._repr_type, count, label) def threshold_deletion(self, threshold=None): r""" @@ -2786,7 +2786,7 @@ def __init__(self, element, callback=None): """ if not hasattr(element, '_proxy_id'): element._proxy_id = pAdicLatticeElementWeakProxy._next_id - pAdicLatticeElementWeakProxy._next_id +=1 + pAdicLatticeElementWeakProxy._next_id += 1 self._id = element._proxy_id from weakref import ref proxy_callback = callback @@ -2856,7 +2856,7 @@ def __repr__(self): [WeakProxy#...] """ - return "WeakProxy#%s"%(self._id,) + return "WeakProxy#%s" % (self._id,) def list_of_padics(elements): r""" diff --git a/src/sage/rings/padics/local_generic.py b/src/sage/rings/padics/local_generic.py index 6dbebfb5347..5726055d2be 100644 --- a/src/sage/rings/padics/local_generic.py +++ b/src/sage/rings/padics/local_generic.py @@ -452,7 +452,7 @@ def get_unramified_modulus(q, res_name): functor.extras = copy(functor.extras) functor.extras['print_mode'] = copy(functor.extras['print_mode']) if 'type' in kwds and kwds['type'] not in functor._dvr_types: - raise ValueError("completion type must be one of %s"%(", ".join(functor._dvr_types[1:]))) + raise ValueError("completion type must be one of %s" % (", ".join(functor._dvr_types[1:]))) if 'field' in kwds: field = kwds.pop('field') if field: @@ -493,7 +493,7 @@ def get_unramified_modulus(q, res_name): if atr in kwds: functor.extras['print_mode'][atr] = kwds.pop(atr) if kwds: - raise ValueError("Extra arguments received: %s"%(", ".join(kwds.keys()))) + raise ValueError("Extra arguments received: %s" % (", ".join(kwds.keys()))) if q is not None: # Create an unramified extension base = functor(ring) diff --git a/src/sage/rings/padics/misc.py b/src/sage/rings/padics/misc.py index 46b261c95dc..b535dbb07c5 100644 --- a/src/sage/rings/padics/misc.py +++ b/src/sage/rings/padics/misc.py @@ -201,10 +201,10 @@ def precprint(prec_type, prec_cap, p): sage: precprint('fixed-mod', 1, 17) 'of fixed modulus 17^1' """ - precD = {'capped-rel':'with capped relative precision %s'%prec_cap, - 'capped-abs':'with capped absolute precision %s'%prec_cap, - 'floating-point':'with floating precision %s'%prec_cap, - 'fixed-mod':'of fixed modulus %s^%s'%(p, prec_cap), + precD = {'capped-rel':'with capped relative precision %s' % prec_cap, + 'capped-abs':'with capped absolute precision %s' % prec_cap, + 'floating-point':'with floating precision %s' % prec_cap, + 'fixed-mod':'of fixed modulus %s^%s' % (p, prec_cap), 'lattice-cap':'with lattice-cap precision', 'lattice-float':'with lattice-float precision', 'relaxed':'handled with relaxed arithmetics'} diff --git a/src/sage/rings/padics/padic_base_generic.py b/src/sage/rings/padics/padic_base_generic.py index 56f241fd777..6fb5f464a7f 100644 --- a/src/sage/rings/padics/padic_base_generic.py +++ b/src/sage/rings/padics/padic_base_generic.py @@ -133,12 +133,12 @@ def _repr_(self, do_latex=False): else: s = r"\Bold{Z}_{%s}" % self.prime() if hasattr(self, '_label') and self._label: - s = r"\verb'%s' (\simeq %s)"%(self._label, s) + s = r"\verb'%s' (\simeq %s)" % (self._label, s) else: s = "Field " if self.is_field() else "Ring " - s = "%s-adic "%self.prime() + s + precprint(self._prec_type(), self.precision_cap(), self.prime()) + s = "%s-adic " % self.prime() + s + precprint(self._prec_type(), self.precision_cap(), self.prime()) if hasattr(self, '_label') and self._label: - s+= " (label: %s)"%self._label + s += " (label: %s)" % self._label return s def exact_field(self): @@ -387,7 +387,7 @@ def zeta(self, n=None): if n == 1: return self(1) else: - raise ValueError("No, %sth root of unity in self"%n) + raise ValueError("No, %sth root of unity in self" % n) else: from sage.rings.finite_rings.finite_field_constructor import GF return self.teichmuller(GF(self.prime()).zeta(n).lift()) diff --git a/src/sage/rings/padics/padic_base_leaves.py b/src/sage/rings/padics/padic_base_leaves.py index 8c4636e2904..1c47b0083c2 100644 --- a/src/sage/rings/padics/padic_base_leaves.py +++ b/src/sage/rings/padics/padic_base_leaves.py @@ -731,7 +731,7 @@ def random_element(self, algorithm='default'): a = ZZ.random_element(self.prime()**self.precision_cap()) return self(self.prime()**k * a, absprec=k + self.precision_cap()) else: - raise NotImplementedError("Don't know %s algorithm"%algorithm) + raise NotImplementedError("Don't know %s algorithm" % algorithm) class pAdicFieldFloatingPoint(pAdicFieldBaseGeneric, pAdicFloatingPointFieldGeneric): r""" diff --git a/src/sage/rings/padics/padic_generic.py b/src/sage/rings/padics/padic_generic.py index 769b8500c7d..a929ee60a75 100644 --- a/src/sage/rings/padics/padic_generic.py +++ b/src/sage/rings/padics/padic_generic.py @@ -1045,7 +1045,7 @@ def _test_teichmuller(self, **options): try: y = self.teichmuller(x) except ValueError: - tester.assertTrue(x.valuation() < 0 or x.precision_absolute()==0) + tester.assertTrue(x.valuation() < 0 or x.precision_absolute() == 0) else: try: tester.assertEqual(x.residue(), y.residue()) diff --git a/src/sage/rings/padics/padic_valuation.py b/src/sage/rings/padics/padic_valuation.py index dbd8830a4d4..b6ea2ea75ee 100644 --- a/src/sage/rings/padics/padic_valuation.py +++ b/src/sage/rings/padics/padic_valuation.py @@ -136,7 +136,7 @@ def create_key_and_extra_args(self, R, prime=None, approximants=None): elif isinstance(R.fraction_field(), NumberField) or is_PolynomialQuotientRing(R): return self.create_key_and_extra_args_for_number_field(R, prime, approximants=approximants) else: - raise NotImplementedError("p-adic valuations not implemented for %r"%(R,)) + raise NotImplementedError("p-adic valuations not implemented for %r" % (R,)) def create_key_for_integers(self, R, prime): r""" @@ -156,7 +156,7 @@ def create_key_for_integers(self, R, prime): if isinstance(prime, DiscretePseudoValuation): prime = prime.uniformizer() if prime not in ZZ or not ZZ(prime).is_prime(): - raise ValueError("prime must be a prime in the integers but %s is not"%(prime,)) + raise ValueError("prime must be a prime in the integers but %s is not" % (prime,)) return R, prime def create_key_for_local_ring(self, R, prime): @@ -254,7 +254,7 @@ def create_key_and_extra_args_for_number_field_from_valuation(self, R, v, prime, # v is defined on a ring whose field of fractions is L v = v._base_valuation._initial_approximation.change_domain(G.parent()) else: - raise NotImplementedError("cannot rewrite %r which is defined on %r as a pseudo-valuation on %r"%(v, v.domain(), G.parent())) + raise NotImplementedError("cannot rewrite %r which is defined on %r as a pseudo-valuation on %r" % (v, v.domain(), G.parent())) assert(v.domain() is G.parent()) @@ -315,7 +315,7 @@ def create_key_and_extra_args_for_number_field_from_ideal(self, R, I, prime): p = I.relative_norm() F = p.factor() if len(F) != 1: - raise ValueError("%r does not lie over a single prime of %r"%(I, K)) + raise ValueError("%r does not lie over a single prime of %r" % (I, K)) vK = K.valuation(F[0][0]) approximants = vK.mac_lane_approximants(G, require_incomparability=True) @@ -336,7 +336,7 @@ def create_key_and_extra_args_for_number_field_from_ideal(self, R, I, prime): match = [i for (i, v) in enumerate(candidates) if v and all(v(g) > 0 for g in gens)] if len(match) > 1: - raise ValueError("%s does not single out a unique extension of %s to %s"%(prime, vK, L)) + raise ValueError("%s does not single out a unique extension of %s to %s" % (prime, vK, L)) if len(match) == 1: return (R, approximants[match[0]]), {'approximants': approximants} @@ -369,7 +369,7 @@ def _normalize_number_field_data(self, R): elif is_PolynomialQuotientRing(R): from sage.categories.number_fields import NumberFields if R.base_ring().fraction_field() not in NumberFields(): - raise NotImplementedError("cannot normalize quotients over %r"%(R.base_ring(),)) + raise NotImplementedError("cannot normalize quotients over %r" % (R.base_ring(),)) L = R.fraction_field() K = R.base_ring().fraction_field() G = R.modulus().change_ring(K) @@ -397,11 +397,11 @@ def create_object(self, version, key, **extra_args): R = key[0] parent = DiscretePseudoValuationSpace(R) if isinstance(R, pAdicGeneric): - assert(len(key)==1) + assert(len(key) == 1) return parent.__make_element_class__(pAdicValuation_padic)(parent) elif R is ZZ or R is QQ: prime = key[1] - assert(len(key)==2) + assert(len(key) == 2) return parent.__make_element_class__(pAdicValuation_int)(parent, prime) else: v = key[1] @@ -592,7 +592,7 @@ def is_unramified(self, G, include_steps=False, assume_squarefree=False): break next = v.mac_lane_step(G, assume_squarefree=True) - if len(next)>1: + if len(next) > 1: ret = False break steps.append(next[0]) @@ -689,7 +689,7 @@ def is_totally_ramified(self, G, include_steps=False, assume_squarefree=False): break next = v.mac_lane_step(G, assume_squarefree=True) - if len(next)>1: + if len(next) > 1: ret = False break steps.append(next[0]) @@ -828,7 +828,7 @@ def restriction(self, ring): return self if not ring.is_subring(self.domain()): - raise ValueError("ring must be a subring of the domain of this valuation but %r is not a subring of %r"%(ring, self.domain())) + raise ValueError("ring must be a subring of the domain of this valuation but %r is not a subring of %r" % (ring, self.domain())) return pAdicValuation(ring, self.p()) @@ -963,7 +963,7 @@ def element_with_valuation(self, v): from sage.rings.rational_field import QQ v = QQ(v) if v not in self.value_semigroup(): - raise ValueError("%r is not in the value semigroup of %r"%(v, self)) + raise ValueError("%r is not in the value semigroup of %r" % (v, self)) v = ZZ(v * self.domain().absolute_e()) return self.domain().one() << v @@ -977,7 +977,7 @@ def _repr_(self): '3-adic valuation' """ - return "%s-adic valuation"%(self.p()) + return "%s-adic valuation" % (self.p()) def _call_(self, x): r""" @@ -1102,7 +1102,7 @@ def _repr_(self): '3-adic valuation' """ - return "%s-adic valuation"%(self.p()) + return "%s-adic valuation" % (self.p()) def _call_(self, x): """ @@ -1281,7 +1281,7 @@ def simplify(self, x, error=None, force=False, size_heuristic_bound=32): if self._relative_size(rational) < self._relative_size(best): best = rational - assert(self(x-best)>error) + assert(self(x-best) > error) return best diff --git a/src/sage/rings/polynomial/ideal.py b/src/sage/rings/polynomial/ideal.py index a117c7bd663..1ab86736d5b 100644 --- a/src/sage/rings/polynomial/ideal.py +++ b/src/sage/rings/polynomial/ideal.py @@ -54,7 +54,7 @@ def residue_field(self, names=None, check=True): if not self.ring().base_ring().is_finite(): raise TypeError("residue fields only supported for polynomial rings over finite fields.") if not self.is_prime(): - raise ValueError("%s is not a prime ideal"%self) + raise ValueError("%s is not a prime ideal" % self) from sage.rings.finite_rings.residue_field import ResidueField return ResidueField(self, names, check=False) diff --git a/src/sage/rings/polynomial/laurent_polynomial_ring.py b/src/sage/rings/polynomial/laurent_polynomial_ring.py index d922a1a57fc..ac40e815724 100644 --- a/src/sage/rings/polynomial/laurent_polynomial_ring.py +++ b/src/sage/rings/polynomial/laurent_polynomial_ring.py @@ -459,7 +459,7 @@ def _repr_(self): sage: LaurentPolynomialRing(QQ,'x') # indirect doctest Univariate Laurent Polynomial Ring in x over Rational Field """ - return "Univariate Laurent Polynomial Ring in %s over %s"%(self._R.variable_name(), self._R.base_ring()) + return "Univariate Laurent Polynomial Ring in %s over %s" % (self._R.variable_name(), self._R.base_ring()) def _element_constructor_(self, x): """ @@ -607,7 +607,7 @@ def _repr_(self): sage: LaurentPolynomialRing(QQ,1,'x').__repr__() # needs sage.modules 'Multivariate Laurent Polynomial Ring in x over Rational Field' """ - return "Multivariate Laurent Polynomial Ring in %s over %s"%(", ".join(self._R.variable_names()), self._R.base_ring()) + return "Multivariate Laurent Polynomial Ring in %s over %s" % (", ".join(self._R.variable_names()), self._R.base_ring()) def monomial(self, *args): r""" diff --git a/src/sage/rings/polynomial/multi_polynomial_element.py b/src/sage/rings/polynomial/multi_polynomial_element.py index 27b6f577f16..450ba530c92 100644 --- a/src/sage/rings/polynomial/multi_polynomial_element.py +++ b/src/sage/rings/polynomial/multi_polynomial_element.py @@ -114,7 +114,7 @@ def _repr_(self): sage: x + QQbar(sqrt(2) - 1/2*I) # indirect doctest # needs sage.rings.number_field sage.symbolic x + 1.414213562373095? - 0.50000000000000000?*I """ - return "%s"%self.__element + return "%s" % self.__element #################### @@ -1455,7 +1455,7 @@ def subs(self, fixed=None, **kw): variables = list(self.parent().gens()) for i in range(0,len(variables)): if str(variables[i]) in kw: - variables[i]=kw[str(variables[i])] + variables[i] = kw[str(variables[i])] elif fixed and variables[i] in fixed: variables[i] = fixed[variables[i]] return self(tuple(variables)) diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal.py b/src/sage/rings/polynomial/multi_polynomial_ideal.py index 28d93c1aa6c..66dd4a6db3d 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ideal.py +++ b/src/sage/rings/polynomial/multi_polynomial_ideal.py @@ -300,7 +300,7 @@ def __call__(self, *args, **kwds): """ R = self._instance.ring() if not R.base_ring().is_field(): - raise ValueError("Coefficient ring must be a field for function '%s'."%(self.f.__name__)) + raise ValueError("Coefficient ring must be a field for function '%s'." % (self.f.__name__)) return self.f(self._instance, *args, **kwds) @@ -367,7 +367,7 @@ def _magma_init_(self, magma): """ P = magma(self.ring()) G = magma(self.gens()) - return 'ideal<%s|%s>'%(P.name(), G._ref()) + return 'ideal<%s|%s>' % (P.name(), G._ref()) @magma_gb_standard_options def _groebner_basis_magma(self, deg_bound=None, prot=False, magma=magma_default): @@ -416,7 +416,7 @@ def _groebner_basis_magma(self, deg_bound=None, prot=False, magma=magma_default) from sage.interfaces.magma import MagmaGBLogPrettyPrinter if prot: - log_parser = MagmaGBLogPrettyPrinter(verbosity=get_verbose()+ 1, style="sage" if prot=="sage" else "magma") + log_parser = MagmaGBLogPrettyPrinter(verbosity=get_verbose() + 1, style="sage" if prot == "sage" else "magma") else: log_parser = None @@ -538,7 +538,7 @@ def _groebner_basis_libsingular(self, algorithm="groebner", *args, **kwds): from sage.libs.singular.function_factory import ff groebner = ff.groebner - if get_verbose()>=2: + if get_verbose() >= 2: opt['prot'] = True for name, value in kwds.items(): if value is not None: @@ -555,7 +555,7 @@ def _groebner_basis_libsingular(self, algorithm="groebner", *args, **kwds): fnc = singular_function(algorithm) S = fnc(self) except NameError: - raise NameError("Algorithm '%s' unknown"%algorithm) + raise NameError("Algorithm '%s' unknown" % algorithm) return S @libsingular_gb_standard_options @@ -1154,7 +1154,7 @@ def triangular_decomposition(self, algorithm=None, singular=singular_default): f = singular_function(algorithm[9:]) Tbar = f(I, attributes={I:{'isSB':1}}) else: - raise TypeError("algorithm '%s' unknown"%algorithm) + raise TypeError("algorithm '%s' unknown" % algorithm) T = Sequence([ MPolynomialIdeal(Q,t) for t in Tbar]) return sorted(T, key=lambda x: x.gens()) @@ -1393,7 +1393,7 @@ def _groebner_basis_ginv(self, algorithm="TQ", criteria='CritPartially', divisio try: im = ginv.MonomInterface(term_order_map[T.name()], st, list(P.variable_names())) except KeyError: - raise NotImplementedError("Term order '%s' not supported by Sage's GINV interface or GINV"%T.term_order()) + raise NotImplementedError("Term order '%s' not supported by Sage's GINV interface or GINV" % T.term_order()) from sage.rings.rational_field import QQ if K is QQ: @@ -1401,7 +1401,7 @@ def _groebner_basis_ginv(self, algorithm="TQ", criteria='CritPartially', divisio elif K.order() <= 2**16 and K.order().is_prime(): ic = ginv.CoeffInterface("ModularShort", st, modularShort=K.order()) else: - raise NotImplementedError("GINV interface for base ring '%s' is not implemented."%K) + raise NotImplementedError("GINV interface for base ring '%s' is not implemented." % K) ip = ginv.PolyInterface("PolyList", st, im, ic) iw = ginv.WrapInterface(criteria, ip) @@ -1519,7 +1519,7 @@ def _groebner_basis_singular_raw(self, algorithm="groebner", singular=singular_d o = _options_py_to_singular.get(o,o) if v: if o in ['degBound','multBound']: - singular.eval(o+'=%d'%v) + singular.eval(o+'=%d' % v) else: singular.option(o) else: @@ -1554,7 +1554,7 @@ def _groebner_basis_singular_raw(self, algorithm="groebner", singular=singular_d elif algorithm == "stdfglm": S = obj.stdfglm() else: - raise TypeError("algorithm '%s' unknown"%algorithm) + raise TypeError("algorithm '%s' unknown" % algorithm) self.__gb_singular = S if prot == "sage": print("") @@ -2140,7 +2140,7 @@ def basis_is_groebner(self, singular=singular_default): M = (F * LTF.syz()).reduce(self._singular_()) for i in range(M.ncols()): - if int(singular.eval("%s[1,%s+1]!=0"%(M.name(),i))): + if int(singular.eval("%s[1,%s+1]!=0" % (M.name(),i))): return False self._singular_().attrib('isSB',1) return True @@ -2821,7 +2821,7 @@ def _variety(T, V, v=None): d = self.dimension() if d > 0: - raise ValueError("The dimension of the ideal is %s, but it should be 0"%d) + raise ValueError("The dimension of the ideal is %s, but it should be 0" % d) if d == -1: return [] @@ -3458,7 +3458,7 @@ def _reduce_using_macaulay2(self, f): """ I = self._macaulay2_() M2 = I.parent() - k = M2('(%r) %% %s'%(f, I.name())) + k = M2('(%r) %% %s' % (f, I.name())) R = self.ring() return R(k) @@ -4716,7 +4716,7 @@ def groebner_basis(self, algorithm='', deg_bound=None, mult_bound=None, prot=Fal ginv,alg = algorithm.split(":") gb = self._groebner_basis_ginv(algorithm=alg,*args, **kwds) else: - raise NameError("Algorithm '%s' unknown."%algorithm) + raise NameError("Algorithm '%s' unknown." % algorithm) elif algorithm == 'giac:gbasis': from sage.libs.giac import groebner_basis as groebner_basis_libgiac gb = groebner_basis_libgiac(self, prot=prot, *args, **kwds) @@ -4729,7 +4729,7 @@ def groebner_basis(self, algorithm='', deg_bound=None, mult_bound=None, prot=Fal from . import msolve return msolve.groebner_basis_degrevlex(self, *args, **kwds) else: - raise NameError("Algorithm '%s' unknown."%algorithm) + raise NameError("Algorithm '%s' unknown." % algorithm) gb = sorted(gb, reverse=True) if self.ring().base_ring().is_field(): @@ -5139,7 +5139,7 @@ def degree_of_semi_regularity(self): semi-regular sequences. For more details about semi-regular sequences see [BFS2004]_. """ - degs = [f.degree() for f in self.gens() if f!=0] # we ignore zeroes + degs = [f.degree() for f in self.gens() if f != 0] # we ignore zeroes m, n = self.ngens(), len(set(sum([f.variables() for f in self.gens()],()))) if m <= n: raise ValueError("This function requires an overdefined system of polynomials.") @@ -5238,7 +5238,7 @@ def plot(self, *args, **kwds): V = [(variables[0], None, None), (variables[1], None, None)] if len(args) > 2: - raise TypeError("Expected up to 2 optional parameters but got %d."%len(args)) + raise TypeError("Expected up to 2 optional parameters but got %d." % len(args)) # first check whether user supplied boundaries for e in args: diff --git a/src/sage/rings/polynomial/multi_polynomial_sequence.py b/src/sage/rings/polynomial/multi_polynomial_sequence.py index 1cfabbeda6e..03feaa90ca4 100644 --- a/src/sage/rings/polynomial/multi_polynomial_sequence.py +++ b/src/sage/rings/polynomial/multi_polynomial_sequence.py @@ -316,7 +316,7 @@ def PolynomialSequence(arg1, arg2=None, immutable=False, cr=False, cr_str=None): if arg2: ring = arg2 if not is_ring(ring): - raise TypeError("Ring '%s' not supported."%ring) + raise TypeError("Ring '%s' not supported." % ring) else: try: e = next(iter(gens)) @@ -842,7 +842,7 @@ def _magma_init_(self, magma): """ P = magma(self.ring()).name() v = [x._magma_init_(magma) for x in list(self)] - return 'ideal<%s|%s>'%(P, ','.join(v)) + return 'ideal<%s|%s>' % (P, ','.join(v)) def _repr_(self): """ @@ -870,7 +870,7 @@ def _repr_(self): if len(self) < 20: return Sequence_generic._repr_(self) else: - return "Polynomial Sequence with %d Polynomials in %d Variables"%(len(self),self.nvariables()) + return "Polynomial Sequence with %d Polynomials in %d Variables" % (len(self),self.nvariables()) def __add__(self, right): """ @@ -1417,7 +1417,7 @@ def _groebner_strategy(self): g = GroebnerStrategy(R) for p in self: g.add_as_you_wish(p) - g.reduction_strategy.opt_red_tail=True + g.reduction_strategy.opt_red_tail = True return g def solve(self, algorithm='polybori', n=1, eliminate_linear_variables=True, verbose=False, **kwds): @@ -1620,7 +1620,7 @@ def reduced(self): if isinstance(R, BooleanPolynomialRing_base): from sage.rings.polynomial.pbori.interred import interred as inter_red - l = [p for p in self if not p==0] + l = [p for p in self if not p == 0] l = sorted(inter_red(l, completely=True), reverse=True) return PolynomialSequence(l, R, immutable=True) else: diff --git a/src/sage/rings/polynomial/polynomial_element_generic.py b/src/sage/rings/polynomial/polynomial_element_generic.py index f7b4ba226b9..1f447fc1287 100644 --- a/src/sage/rings/polynomial/polynomial_element_generic.py +++ b/src/sage/rings/polynomial/polynomial_element_generic.py @@ -395,18 +395,18 @@ def _repr(self, name=None): if y.find("-") == 0: y = y[1:] if not atomic_repr and n > 0 and (y.find("+") != -1 or y.find("-") != -1): - x = "(%s)"%x + x = "(%s)" % x if n > 1: - var = "*%s^%s"%(name,n) - elif n==1: - var = "*%s"%name + var = "*%s^%s" % (name,n) + elif n == 1: + var = "*%s" % name else: var = "" - s += "%s%s"%(x,var) + s += "%s%s" % (x,var) s = s.replace(" + -", " - ") s = s.replace(" 1*"," ") s = s.replace(" -1*", " -") - if s==" ": + if s == " ": return "0" return s[1:] @@ -962,22 +962,22 @@ def gcd(self,other,algorithm=None): algorithm = "dense" else: algorithm = "generic" - if algorithm=="dense": + if algorithm == "dense": S = self.parent() # FLINT is faster but a bug makes the conversion extremely slow, # so NTL is used in those cases where the conversion is too slow. Cf # sd = self.degree() od = other.degree() - if max(sd,od)<100 or \ - min(len(self.__coeffs)/sd, len(other.__coeffs)/od)>.06: - implementation="FLINT" + if max(sd,od) < 100 or \ + min(len(self.__coeffs)/sd, len(other.__coeffs)/od) > .06: + implementation = "FLINT" else: - implementation="NTL" + implementation = "NTL" D = PolynomialRing(S.base_ring(),'x',implementation=implementation) g = D(self).gcd(D(other)) return S(g) - elif algorithm=="generic": + elif algorithm == "generic": return Polynomial.gcd(self,other) else: raise ValueError("Unknown algorithm '%s'" % algorithm) @@ -1002,7 +1002,7 @@ def reverse(self, degree=None): if degree is None: degree = self.degree() if not isinstance(degree, (int,Integer)): - raise ValueError("degree argument must be a nonnegative integer, got %s"%degree) + raise ValueError("degree argument must be a nonnegative integer, got %s" % degree) d = {degree-k: v for k,v in self.__coeffs.items() if degree >= k} return self.parent()(d, check=False) @@ -1098,7 +1098,7 @@ def quo_rem(self, other): Q = P.zero() while R.degree() >= B.degree(): aaa = R.leading_coefficient()/B.leading_coefficient() - diff_deg=R.degree()-B.degree() + diff_deg = R.degree()-B.degree() Q += P(aaa).shift(diff_deg) # We know that S*B exactly cancels the leading coefficient of R. # Thus, we skip the computation of this leading coefficient. diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py index 2a6a155b5ae..dcc4d376ffe 100644 --- a/src/sage/rings/polynomial/polynomial_quotient_ring.py +++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py @@ -548,7 +548,7 @@ def _element_constructor_(self, x): try: return self.element_class(self, self.__ring(x), check=False) except TypeError: - raise TypeError("unable to convert %r to an element of %s"%(x, self)) + raise TypeError("unable to convert %r to an element of %s" % (x, self)) def _coerce_map_from_(self, R): r""" @@ -770,11 +770,11 @@ def _singular_init_(self, S=None): modulus = S(self.modulus()) # should live in Rpoly Rtmp = S(self.polynomial_ring().change_var(self.variable_name())) Rtmp.set_ring() - self.__singular = S("ideal(fetch(%s,%s))"%(Rpoly.name(),modulus.name()),"qring") + self.__singular = S("ideal(fetch(%s,%s))" % (Rpoly.name(),modulus.name()),"qring") return self.__singular def _repr_(self): - return "Univariate Quotient Polynomial Ring in %s over %s with modulus %s"%( + return "Univariate Quotient Polynomial Ring in %s over %s with modulus %s" % ( self.variable_name(), self.base_ring(), self.modulus()) def construction(self): @@ -2127,7 +2127,7 @@ def _isomorphic_ring(self): to_isomorphic_ring = self.hom([isomorphic_ring.gen()]) return from_isomorphic_ring, to_isomorphic_ring, isomorphic_ring - raise NotImplementedError("cannot rewrite %r as an isomorphic ring"%(self,)) + raise NotImplementedError("cannot rewrite %r as an isomorphic ring" % (self,)) def _test_isomorphic_ring(self, **options): r""" diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring_element.py b/src/sage/rings/polynomial/polynomial_quotient_ring_element.py index 2f7d825dbf8..4185f0d1455 100644 --- a/src/sage/rings/polynomial/polynomial_quotient_ring_element.py +++ b/src/sage/rings/polynomial/polynomial_quotient_ring_element.py @@ -424,7 +424,7 @@ def __invert__(self): 11 """ if self._polynomial.is_zero(): - raise ZeroDivisionError("element %s of quotient polynomial ring not invertible"%self) + raise ZeroDivisionError("element %s of quotient polynomial ring not invertible" % self) if self._polynomial.is_one(): return self @@ -442,7 +442,7 @@ def __invert__(self): raise NotImplementedError("The base ring (=%s) is not a field" % base) g, _, a = parent.modulus().xgcd(self._polynomial) if g.degree() != 0: - raise ZeroDivisionError("element %s of quotient polynomial ring not invertible"%self) + raise ZeroDivisionError("element %s of quotient polynomial ring not invertible" % self) c = g[0] return self.__class__(self.parent(), (~c)*a, check=False) diff --git a/src/sage/rings/polynomial/polynomial_ring.py b/src/sage/rings/polynomial/polynomial_ring.py index 968330c9288..af37b6d9fd7 100644 --- a/src/sage/rings/polynomial/polynomial_ring.py +++ b/src/sage/rings/polynomial/polynomial_ring.py @@ -840,7 +840,7 @@ def _coerce_map_from_(self, P): from sage.rings.polynomial.multi_polynomial_ring import is_MPolynomialRing if is_MPolynomialRing(P) and self.variable_name() in P.variable_names(): P_ = P.remove_var(self.variable_name()) - return self.base_ring()!=P_ and self.base_ring().has_coerce_map_from(P_) + return self.base_ring() != P_ and self.base_ring().has_coerce_map_from(P_) def _magma_init_(self, magma): """ @@ -889,7 +889,7 @@ def _magma_init_(self, magma): """ B = magma(self.base_ring()) Bref = B._ref() - s = 'PolynomialRing(%s)'%(Bref) + s = 'PolynomialRing(%s)' % (Bref) return magma._with_names(s, self.variable_names()) def _gap_init_(self, gap=None): @@ -927,7 +927,7 @@ def _gap_init_(self, gap=None): base_ring = gap(self.base_ring()).name() else: base_ring = self.base_ring()._gap_init_() - return 'PolynomialRing(%s, ["%s"])'%(base_ring, self.variable_name()) + return 'PolynomialRing(%s, ["%s"])' % (base_ring, self.variable_name()) def _sage_input_(self, sib, coerced): r""" @@ -1009,7 +1009,7 @@ def _repr_(self): return self._cached_repr except AttributeError: pass - s = "Univariate Polynomial Ring in %s over %s"%( + s = "Univariate Polynomial Ring in %s over %s" % ( self.variable_name(), self.base_ring()) if self.is_sparse(): s = "Sparse " + s @@ -1024,7 +1024,7 @@ def _latex_(self): sage: latex(S) \Bold{Z}[\alpha_{12}] """ - return "%s[%s]"%(latex.latex(self.base_ring()), self.latex_variable_names()[0]) + return "%s[%s]" % (latex.latex(self.base_ring()), self.latex_variable_names()[0]) def base_extend(self, R): """ @@ -1202,7 +1202,7 @@ def cyclotomic_polynomial(self, n): x - 1 """ if n <= 0: - raise ArithmeticError("n=%s must be positive"%n) + raise ArithmeticError("n=%s must be positive" % n) elif n == 1: return self.gen() - 1 else: @@ -1712,7 +1712,7 @@ class PolynomialRing_commutative(PolynomialRing_general, ring.CommutativeAlgebra def __init__(self, base_ring, name=None, sparse=False, implementation=None, element_class=None, category=None): if base_ring not in _CommutativeRings: - raise TypeError("Base ring %s must be a commutative ring."%repr(base_ring)) + raise TypeError("Base ring %s must be a commutative ring." % repr(base_ring)) # We trust that, if a category is given, that it is useful. if category is None: if base_ring.is_zero(): @@ -2799,7 +2799,7 @@ def alekh_rec(p, k, degree_bound, lvl): - ``degree_bound`` -- the current degree bound - ``lvl`` -- the level in the recursion tree """ - if k<=0: + if k <= 0: return [ (self.zero(),0) ] elif degree_bound < 0: # The only possible root of (current) p, if any, is y = 0 diff --git a/src/sage/rings/polynomial/symmetric_ideal.py b/src/sage/rings/polynomial/symmetric_ideal.py index 84138cd8975..3347cf06f2b 100644 --- a/src/sage/rings/polynomial/symmetric_ideal.py +++ b/src/sage/rings/polynomial/symmetric_ideal.py @@ -210,7 +210,7 @@ def __repr__(self): Symmetric Ideal (x_1^2 + y_2^2, x_2*x_1*y_3 + x_1*y_4) of Infinite polynomial ring in x, y over Rational Field """ - return "Symmetric Ideal %s of %s"%(self._repr_short(), self.ring()) + return "Symmetric Ideal %s of %s" % (self._repr_short(), self.ring()) def _latex_(self): r""" @@ -269,7 +269,7 @@ def __mul__(self, other): """ # determine maximal generator index PARENT = self.ring() - if (not isinstance(other, self.__class__)) or self.ring()!=other.ring(): + if (not isinstance(other, self.__class__)) or self.ring() != other.ring(): if hasattr(other,'gens'): other = SymmetricIdeal(PARENT, other.gens(), coerce=True) other = other.symmetrisation() @@ -355,7 +355,7 @@ def is_maximal(self): if self.is_trivial() and not self.is_zero(): return True V = [p.variables() for p in self.gens()] - V = [x for x in V if len(x)==1] + V = [x for x in V if len(x) == 1] V = [str(x[0]).split('_')[0] for x in V] return set(V) == set(self.ring().variable_names()) @@ -555,11 +555,11 @@ def interreduction(self, tailreduce=True, sorted=False, report=None, RStrat=None if DONE == TODO: break else: - if len(TODO)==len(DONE): + if len(TODO) == len(DONE): import copy bla = copy.copy(TODO) bla.sort() - if bla==DONE: + if bla == DONE: break TODO = DONE return SymmetricIdeal(self.ring(),DONE, coerce=False) @@ -640,7 +640,7 @@ def symmetrisation(self, N=None, tailreduce=False, report=None, use_full_group=F N = max([Y.max_index() for Y in newOUT.gens()]+[1]) else: N = Integer(N) - if hasattr(R,'_max') and R._max %d"%(t.macaulay2_str(), len(t))) + singular_str.append("%s(%d)" % (t.singular_str(), len(t))) + macaulay2_str.append("%s => %d" % (t.macaulay2_str(), len(t))) length += len(t) self._singular_moreblocks += t.singular_moreblocks() @@ -809,8 +809,8 @@ def __init__(self, name='lex', n=0, force=False): block_length = int(block_length) if block_length > 0: # ignore blocks with length 0 blocks.append( TermOrder(block_name, block_length, force=force) ) - singular_str.append("%s(%d)"%(singular_name_mapping.get(block_name, block_name), block_length)) - macaulay2_str.append("%s => %d"%(macaulay2_name_mapping.get(block_name, block_name), block_length)) + singular_str.append("%s(%d)" % (singular_name_mapping.get(block_name, block_name), block_length)) + macaulay2_str.append("%s => %d" % (macaulay2_name_mapping.get(block_name, block_name), block_length)) length += block_length except ValueError: block_name = block.strip() @@ -847,7 +847,7 @@ def __init__(self, name='lex', n=0, force=False): self._name = "matrix" self._singular_str = "M(%s)" % (int_str,) self._macaulay2_str = "" # Macaulay2 does not support matrix term order directly - self._magma_str = '"weight",[%s]'%(int_str,) + self._magma_str = '"weight",[%s]' % (int_str,) from sage.matrix.constructor import matrix self._matrix = matrix(n,name) # defined only for matrix term order @@ -857,7 +857,7 @@ def __init__(self, name='lex', n=0, force=False): raise ValueError("{!r} is not a valid term order".format(name)) if self._length != 0: - self._singular_str = self._singular_str%dict(ngens=self._length) + self._singular_str = self._singular_str % dict(ngens=self._length) if self._name == 'degneglex': self._singular_moreblocks += 1 @@ -1633,19 +1633,19 @@ def _repr_(self): Lexicographic term order """ if self._name == 'matrix': - return 'Matrix term order with matrix\n%s'%(self._matrix,) + return 'Matrix term order with matrix\n%s' % (self._matrix,) elif self._name == 'block': s = [] for t in self._blocks: if not t.is_weighted_degree_order(): - s.append('%s of length %d'%(t,len(t))) + s.append('%s of length %d' % (t,len(t))) else: # includes matrix order - s.append('%s'%(t,)) - return 'Block term order with blocks:\n(%s)'%(',\n '.join(s),) + s.append('%s' % (t,)) + return 'Block term order with blocks:\n(%s)' % (',\n '.join(s),) else: s = print_name_mapping.get(self._name,self._name) + ' term order' if self.is_weighted_degree_order(): - s = s + ' with weights %s'%(self._weights,) + s = s + ' with weights %s' % (self._weights,) return s def singular_str(self): @@ -2244,7 +2244,7 @@ def termorder_from_singular(S): ringorder_column = None weights_one_block = False for idx, block in enumerate(T): - blocktype = singular.eval('%s[1]'%block.name()) + blocktype = singular.eval('%s[1]' % block.name()) if blocktype in ['a']: weights = list(block[2].sage()) weights_one_block = all(w == 1 for w in weights) @@ -2266,7 +2266,7 @@ def termorder_from_singular(S): elif blocktype[0] in ['w','W']: order.append(TermOrder(inv_singular_name_mapping[blocktype], list(block[2].sage()))) else: - order.append(TermOrder(inv_singular_name_mapping[blocktype], ZZ(singular.eval("size(%s[2])"%block.name())))) + order.append(TermOrder(inv_singular_name_mapping[blocktype], ZZ(singular.eval("size(%s[2])" % block.name())))) weights_one_block = False if not order: diff --git a/src/sage/rings/power_series_ring.py b/src/sage/rings/power_series_ring.py index e023867b67e..9b07bfd7594 100644 --- a/src/sage/rings/power_series_ring.py +++ b/src/sage/rings/power_series_ring.py @@ -624,7 +624,7 @@ def _repr_(self): sage: R # optional - sage.rings.finite_rings my power series ring """ - s = "Power Series Ring in %s over %s"%(self.variable_name(), self.base_ring()) + s = "Power Series Ring in %s over %s" % (self.variable_name(), self.base_ring()) if self.is_sparse(): s = 'Sparse ' + s return s @@ -668,7 +668,7 @@ def _latex_(self): sage: latex(R) # optional - sage.rings.finite_rings \Bold{F}_{17}[[y_{12}]] """ - return "%s[[%s]]"%(latex.latex(self.base_ring()), self.latex_variable_names()[0]) + return "%s[[%s]]" % (latex.latex(self.base_ring()), self.latex_variable_names()[0]) def _coerce_map_from_(self, S): """ @@ -693,7 +693,7 @@ def _coerce_map_from_(self, S): if self.base_ring().has_coerce_map_from(S): return True if (is_PolynomialRing(S) or is_PowerSeriesRing(S)) and self.base_ring().has_coerce_map_from(S.base_ring()) \ - and self.variable_names()==S.variable_names(): + and self.variable_names() == S.variable_names(): return True def _element_constructor_(self, f, prec=infinity, check=True): diff --git a/src/sage/rings/quotient_ring.py b/src/sage/rings/quotient_ring.py index 178cae67a22..370759357ba 100644 --- a/src/sage/rings/quotient_ring.py +++ b/src/sage/rings/quotient_ring.py @@ -462,7 +462,7 @@ def __init__(self, R, I, names, category=None): """ if R not in _Rings: - raise TypeError("The first argument must be a ring, but %s is not"%R) + raise TypeError("The first argument must be a ring, but %s is not" % R) # workaround to silence warning from #34806 from sage.rings.number_field.order import Order if isinstance(R, Order): @@ -470,7 +470,7 @@ def __init__(self, R, I, names, category=None): else: M = R.ideal_monoid() if I not in M: - raise TypeError("The second argument must be an ideal of the given ring, but %s is not"%I) + raise TypeError("The second argument must be an ideal of the given ring, but %s is not" % I) self.__R = R self.__I = I #sage.structure.parent_gens.ParentWithGens.__init__(self, R.base_ring(), names) @@ -549,7 +549,7 @@ def _repr_(self): sage: R.quotient_ring(I)._repr_() 'Quotient of Univariate Polynomial Ring in x over Integer Ring by the ideal (x^2 + 3*x + 4, x^2 + 1)' """ - return "Quotient of %s by the ideal %s"%(self.cover_ring(), self.defining_ideal()._repr_short()) + return "Quotient of %s by the ideal %s" % (self.cover_ring(), self.defining_ideal()._repr_short()) def _latex_(self): """ @@ -562,7 +562,7 @@ def _latex_(self): sage: R.quotient_ring(I)._latex_() '\\Bold{Z}[x]/\\left(x^{2} + 3x + 4, x^{2} + 1\\right)\\Bold{Z}[x]' """ - return "%s/%s"%(latex.latex(self.cover_ring()), latex.latex(self.defining_ideal())) + return "%s/%s" % (latex.latex(self.cover_ring()), latex.latex(self.defining_ideal())) def is_commutative(self): """ @@ -1276,7 +1276,7 @@ def _singular_init_(self, singular=None): if singular is None: from sage.interfaces.singular import singular self.__R._singular_().set_ring() - self.__singular = singular("%s"%self.__I._singular_().name(),"qring") + self.__singular = singular("%s" % self.__I._singular_().name(),"qring") return self.__singular def _magma_init_(self, magma): @@ -1304,7 +1304,7 @@ def _magma_init_(self, magma): """ R = magma(self.__R) I = magma(self.__I.gens()) - return "quo<%s|%s>"%(R.name(), I._ref()) + return "quo<%s|%s>" % (R.name(), I._ref()) def term_order(self): """ diff --git a/src/sage/rings/valuation/valuation.py b/src/sage/rings/valuation/valuation.py index c0e78efaf95..ec39b0d98ea 100644 --- a/src/sage/rings/valuation/valuation.py +++ b/src/sage/rings/valuation/valuation.py @@ -911,7 +911,7 @@ def mac_lane_approximant(self, G, valuation, approximants=None): v = valuation while not v.is_gauss_valuation(): if v(G) <= v._base_valuation(G): - raise ValueError("The valuation %r is not an approximant for a valuation which extends %r with respect to %r since the valuation of %r does not increase in every step"%(valuation, self, G, G)) + raise ValueError("The valuation %r is not an approximant for a valuation which extends %r with respect to %r since the valuation of %r does not increase in every step" % (valuation, self, G, G)) v = v._base_valuation if approximants is None: @@ -921,15 +921,15 @@ def mac_lane_approximant(self, G, valuation, approximants=None): greater_approximants = [w for w in approximants if w >= valuation] if len(greater_approximants) > 1: - raise ValueError("The valuation %r does not approximate a unique extension of %r with respect to %r"%(valuation, self, G)) + raise ValueError("The valuation %r does not approximate a unique extension of %r with respect to %r" % (valuation, self, G)) if len(greater_approximants) == 1: return greater_approximants[0] smaller_approximants = [w for w in approximants if w <= valuation] if len(smaller_approximants) > 1: - raise ValueError("The valuation %r is not approximated by a unique extension of %r with respect to %r"%(valuation, self, G)) + raise ValueError("The valuation %r is not approximated by a unique extension of %r with respect to %r" % (valuation, self, G)) if len(smaller_approximants) == 0: - raise ValueError("The valuation %r is not related to an extension of %r with respect to %r"%(valuation, self, G)) + raise ValueError("The valuation %r is not related to an extension of %r with respect to %r" % (valuation, self, G)) return smaller_approximants[0] def montes_factorization(self, G, assume_squarefree=False, required_precision=None): diff --git a/src/sage/rings/valuation/valuation_space.py b/src/sage/rings/valuation/valuation_space.py index 415a1197ed9..be0e9192c7c 100644 --- a/src/sage/rings/valuation/valuation_space.py +++ b/src/sage/rings/valuation/valuation_space.py @@ -486,7 +486,7 @@ def element_with_valuation(self, s): return self.domain().one() exp = s / self.value_group().gen() if exp not in ZZ: - raise NotImplementedError("s must be a multiple of %r but %r is not"%(self.value_group().gen(), s)) + raise NotImplementedError("s must be a multiple of %r but %r is not" % (self.value_group().gen(), s)) ret = self.domain()(self.uniformizer() ** ZZ(exp)) return self.simplify(ret, error=s) @@ -594,7 +594,7 @@ def extension(self, ring): extensions = self.extensions(ring) assert(extensions) if len(extensions) > 1: - raise ValueError("there is no unique extension of %r from %r to %r"%(self, self.domain(), ring)) + raise ValueError("there is no unique extension of %r from %r to %r" % (self, self.domain(), ring)) return extensions[0] def extensions(self, ring): @@ -610,7 +610,7 @@ def extensions(self, ring): """ if ring is self.domain(): return [self] - raise NotImplementedError("extending %r from %r to %r not implemented"%(self, self.domain(), ring)) + raise NotImplementedError("extending %r from %r to %r not implemented" % (self, self.domain(), ring)) def restriction(self, ring): r""" @@ -626,7 +626,7 @@ def restriction(self, ring): """ if ring is self.domain(): return self - raise NotImplementedError("restricting %r from %r to %r not implemented"%(self, self.domain(), ring)) + raise NotImplementedError("restricting %r from %r to %r not implemented" % (self, self.domain(), ring)) def change_domain(self, ring): r""" @@ -649,7 +649,7 @@ def change_domain(self, ring): return self.extension(ring) if ring.is_subring(self.domain()): return self.restriction(ring) - raise NotImplementedError("changing %r from %r to %r not implemented"%(self, self.domain(), ring)) + raise NotImplementedError("changing %r from %r to %r not implemented" % (self, self.domain(), ring)) def scale(self, scalar): r""" @@ -732,11 +732,11 @@ def separating_element(self, others): for other in others + [self]: if other.parent() is not self.parent(): - raise ValueError("all valuations must be valuations on %r but %r is a valuation on %r"%(self.domain(), other, other.domain())) + raise ValueError("all valuations must be valuations on %r but %r is a valuation on %r" % (self.domain(), other, other.domain())) if not other.is_discrete_valuation(): raise ValueError("all valuations must be discrete valuations but %r is not" % (other,)) if other.is_trivial(): - raise ValueError("all valuations must be non-trivial but %r is not"%(other,)) + raise ValueError("all valuations must be non-trivial but %r is not" % (other,)) if len(others) == 0: return self.uniformizer() @@ -882,7 +882,7 @@ def _weakly_separating_element(self, other): ret = self.uniformizer() if self(ret) > other(ret): return ret - raise NotImplementedError("weakly separating element for %r and %r"%(self, other)) + raise NotImplementedError("weakly separating element for %r and %r" % (self, other)) def shift(self, x, s): r""" diff --git a/src/sage/rings/valuation/value_group.py b/src/sage/rings/valuation/value_group.py index 816f142e0c7..57a6c1b2719 100644 --- a/src/sage/rings/valuation/value_group.py +++ b/src/sage/rings/valuation/value_group.py @@ -399,11 +399,11 @@ def _element_with_valuation(self, subgroup, s): """ if s not in self: - raise ValueError("s must be in the value group but %r is not in %r."%(s, self)) + raise ValueError("s must be in the value group but %r is not in %r." % (s, self)) i = self.index(subgroup) x = s/self.gen() - a = x%i + a = x % i if abs(a-i) < a: a -= i b = (x-a)/i @@ -593,7 +593,7 @@ def _repr_(self): """ if self.is_trivial(): return "Trivial Additive Abelian Semigroup" - return "Additive Abelian Semigroup generated by %s"%(', '.join([repr(g) for g in self._generators]),) + return "Additive Abelian Semigroup generated by %s" % (', '.join([repr(g) for g in self._generators]),) def __add__(self, other): r""" From 39dfddd80c96a32f297cdc96b41a38ff1872218a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Tue, 5 Sep 2023 10:30:10 +0200 Subject: [PATCH 408/423] fix suggested details --- src/sage/rings/number_field/homset.py | 12 ++++++------ src/sage/rings/number_field/number_field_rel.py | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/sage/rings/number_field/homset.py b/src/sage/rings/number_field/homset.py index 0e414e233c6..cb61df73344 100644 --- a/src/sage/rings/number_field/homset.py +++ b/src/sage/rings/number_field/homset.py @@ -143,7 +143,7 @@ def _an_element_(self): else: from sage.categories.sets_cat import EmptySetError raise EmptySetError("There is no morphism from {} to {}".format( - self.domain(), self.codomain())) + self.domain(), self.codomain())) def _repr_(self): r""" @@ -238,7 +238,7 @@ def list(self): v = [D.hom([r], codomain=C, check=False) for r in roots] else: v = [] - return Sequence(v, universe=self, check=False, immutable=True, cr=v != []) + return Sequence(v, universe=self, check=False, immutable=True, cr=bool(v)) def __getitem__(self, n): r""" @@ -389,7 +389,7 @@ def _element_constructor_(self, x, base_map=None, base_hom=None, check=True): raise ValueError("codomain of absolute homomorphism must be codomain of this homset.") return self.element_class(self, x) if (isinstance(x, RelativeNumberFieldHomomorphism_from_abs) - and x.parent() == self): + and x.parent() == self): return self.element_class(self, x.abs_hom()) if base_map is None: base_map = self.default_base_hom() @@ -519,7 +519,7 @@ def list(self): C = self.codomain() D_abs = D.absolute_field('a') v = [self(f, check=False) for f in D_abs.Hom(C).list()] - return Sequence(v, universe=self, check=False, immutable=True, cr=v != []) + return Sequence(v, universe=self, check=False, immutable=True, cr=bool(v)) class CyclotomicFieldHomset(NumberFieldHomset): @@ -579,7 +579,7 @@ def _element_constructor_(self, x, check=True): x^2 + b """ if (isinstance(x, CyclotomicFieldHomomorphism_im_gens) - and x.parent() == self): + and x.parent() == self): return self.element_class(self, x.im_gens()) return self.element_class(self, x, check=check) @@ -622,4 +622,4 @@ def list(self): else: w = C.zeta(n) v = [self([w**k], check=False) for k in Zmod(n) if k.is_unit()] - return Sequence(v, universe=self, check=False, immutable=True, cr=v != []) + return Sequence(v, universe=self, check=False, immutable=True, cr=bool(v)) diff --git a/src/sage/rings/number_field/number_field_rel.py b/src/sage/rings/number_field/number_field_rel.py index ca42a1b2247..1e8a6a17fe1 100644 --- a/src/sage/rings/number_field/number_field_rel.py +++ b/src/sage/rings/number_field/number_field_rel.py @@ -463,7 +463,7 @@ def subfields(self, degree=0, name=None): if to_K is not None: to_K = RelativeNumberFieldHomomorphism_from_abs(self.Hom(K), to_K*to_abs) ans.append((K, from_K, to_K)) - ans = Sequence(ans, immutable=True, cr=ans != []) + ans = Sequence(ans, immutable=True, cr=bool(ans)) return ans def is_absolute(self): @@ -2077,7 +2077,7 @@ def embeddings(self, K): # then it is most natural, so we put it first. put_natural_embedding_first(v) - self.__embeddings[K] = Sequence(v, cr=v != [], immutable=True, check=False, universe=self.Hom(K)) + self.__embeddings[K] = Sequence(v, cr=bool(v), immutable=True, check=False, universe=self.Hom(K)) return self.__embeddings[K] def automorphisms(self): @@ -2152,13 +2152,14 @@ def automorphisms(self): L = self.absolute_field('a') L_into_self, self_into_L = L.structure() - aas = L.automorphisms() # absolute automorphisms + aas = L.automorphisms() # absolute automorphisms a = self_into_L(self.gen()) abs_base_gens = [self_into_L(_) for _ in self.base_field().gens()] - v = sorted([ self.hom([ L_into_self(aa(a)) ]) for aa in aas if all(aa(g) == g for g in abs_base_gens) ]) + v = sorted([self.hom([L_into_self(aa(a))]) for aa in aas + if all(aa(g) == g for g in abs_base_gens)]) put_natural_embedding_first(v) - self.__automorphisms = Sequence(v, cr=(v != []), immutable=True, + self.__automorphisms = Sequence(v, cr=bool(v), immutable=True, check=False, universe=self.Hom(self)) return self.__automorphisms From 52b8d0ae36d5ebd55689fa40589158b6db36b62b Mon Sep 17 00:00:00 2001 From: Enrique Artal Date: Tue, 5 Sep 2023 13:09:43 +0200 Subject: [PATCH 409/423] review changes --- src/sage/groups/artin.py | 3 --- src/sage/groups/braid.py | 21 ++++----------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/sage/groups/artin.py b/src/sage/groups/artin.py index 9f3bccaf0a0..617852bacc6 100644 --- a/src/sage/groups/artin.py +++ b/src/sage/groups/artin.py @@ -47,7 +47,6 @@ class ArtinGroupElement(FinitelyPresentedGroupElement): sage: A((1, 2, -3, -2)) s1*s2*s3^-1*s2^-1 """ - def _latex_(self): r""" Return a LaTeX representation of ``self``. @@ -158,7 +157,6 @@ class FiniteTypeArtinGroupElement(ArtinGroupElement): """ An element of a finite-type Artin group. """ - def _richcmp_(self, other, op): """ Compare ``self`` and ``other``. @@ -727,7 +725,6 @@ class FiniteTypeArtinGroup(ArtinGroup): sage: GF = F.cayley_graph(elements=ball(F, 4), generators=F.gens()); GF Digraph on 40 vertices """ - def delta(self): r""" Return the `\Delta` element of ``self``. diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index e08ba9e7f91..a5e702bc06f 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -117,7 +117,6 @@ class Braid(FiniteTypeArtinGroupElement): sage: B((1, 2, -3, -2)) s0*s1*s2^-1*s1^-1 """ - def _richcmp_(self, other, op): """ Compare ``self`` and ``other`` @@ -459,7 +458,9 @@ def permutation(self, W=None): sage: c1 == b.permutation() True - From a permutation it is also possible to recover the permutation braid:: + The canonical section from the symmetric group to the braid group + (sending a permutation to its associated permutation braid) + can be recovered.:: sage: B(c0) s0*s1*s2*s1 @@ -2763,20 +2764,6 @@ def _standard_lift_Tietze(self, p): G = SymmetricGroup(self.strands()) pl = G(p) return tuple(pl.reduced_word()) - # if not p.length(): - # return () - # pl = p - # l = [] - # while pl.length(): - # i = 1 - # while i < max(pl): - # if pl(i) > pl(i+1): - # l.append(i) - # pl = self._coxeter_group.simple_reflection(i) * pl - # i = 1 - # else: - # i += 1 - # return tuple(l) @cached_method def _links_gould_representation(self, symbolics=False): @@ -3427,7 +3414,7 @@ def presentation_two_generators(self, isomorphisms=False): - ``isomorphism`` -- boolean (default ``False``); if ``True``, then an isomorphism from ``self`` and the isomorphic group and its inverse is also returned - EXAMPLES: + EXAMPLES:: sage: B = BraidGroup(3) sage: B.presentation_two_generators() From 902d91c76c79ae1274e5ddbc8da49e1bd9027865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Tue, 5 Sep 2023 09:34:00 -0300 Subject: [PATCH 410/423] schemes/elliptic_curves: disable a test that takes too long --- src/sage/schemes/elliptic_curves/ell_rational_field.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py index 765485f0374..431d94e855f 100644 --- a/src/sage/schemes/elliptic_curves/ell_rational_field.py +++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py @@ -2306,7 +2306,7 @@ def gens(self, proof=None, **kwds): sage: E.gens(algorithm="pari") # random output [(5/4 : 5/8 : 1), (0 : 0 : 1)] sage: E = EllipticCurve([0,2429469980725060,0,275130703388172136833647756388,0]) - sage: len(E.gens(algorithm="pari")) + sage: len(E.gens(algorithm="pari")) # not tested (takes too long) 14 A non-integral example:: From eed72b2ffdd76fc8709da1a68c3f559cace70a49 Mon Sep 17 00:00:00 2001 From: Travis Scrimshaw Date: Thu, 7 Sep 2023 13:28:53 +0900 Subject: [PATCH 411/423] Fixing the iterator of SemistandardMultiSkewTableaux. --- src/sage/combinat/ribbon_tableau.py | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/sage/combinat/ribbon_tableau.py b/src/sage/combinat/ribbon_tableau.py index 65b9b7079cd..843626c4752 100644 --- a/src/sage/combinat/ribbon_tableau.py +++ b/src/sage/combinat/ribbon_tableau.py @@ -1083,7 +1083,9 @@ def __contains__(self, x): return all(xi.is_semistandard() for xi in x) def __iter__(self): - """ + r""" + Iterate over ``self``. + EXAMPLES:: sage: sp = SkewPartitions(3).list() @@ -1098,6 +1100,21 @@ def __iter__(self): 34 sage: RibbonTableaux(a,weight,k).cardinality() 34 + + TESTS: + + Check that :issue:`36196` is fixed:: + + sage: shapes = [[[1], [0]], [[1], [0]], [[1], [0]]] + sage: weight = [1, 1, 1] + sage: SMST = SemistandardMultiSkewTableaux(shapes, weight) + sage: list(SMST) + [[[[1]], [[2]], [[3]]], + [[[2]], [[1]], [[3]]], + [[[1]], [[3]], [[2]]], + [[[2]], [[3]], [[1]]], + [[[3]], [[1]], [[2]]], + [[[3]], [[2]], [[1]]]] """ parts = self._shape mu = self._weight @@ -1122,9 +1139,12 @@ def __iter__(self): S = SkewTableaux() for lk in l: pos = 0 # Double check this - restmp = [S.from_shape_and_word(parts[0], [lk[j] for j in range(s[0])])] + lk = list(lk) + w = lk[:s[0]] + restmp = [S.from_shape_and_word(parts[0], w)] for i in range(1, len(parts)): - w = [lk[j] for j in range(pos + s[i - 1], pos + s[i - 1] + s[i])] + pos += s[i-1] + w = lk[pos: pos + s[i]] restmp.append(S.from_shape_and_word(parts[i], w)) yield self.element_class(self, restmp) From 29ca7a7ff014ec34b0e26a5f5721aadfa5952e09 Mon Sep 17 00:00:00 2001 From: Enrique Manuel Artal Bartolo Date: Thu, 7 Sep 2023 14:13:49 +0200 Subject: [PATCH 412/423] Update src/sage/groups/braid.py Erase the period Co-authored-by: Travis Scrimshaw --- src/sage/groups/braid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index a5e702bc06f..acc89d5a5e5 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -460,7 +460,7 @@ def permutation(self, W=None): The canonical section from the symmetric group to the braid group (sending a permutation to its associated permutation braid) - can be recovered.:: + can be recovered:: sage: B(c0) s0*s1*s2*s1 From 700333dfa69dba7067404cd991eaf03861b4f4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Thu, 7 Sep 2023 16:10:54 +0200 Subject: [PATCH 413/423] some micro-details in Dyck words and Parking functions --- src/sage/combinat/dyck_word.py | 27 ++++++++++++++++---------- src/sage/combinat/parking_functions.py | 12 +++++++++--- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/sage/combinat/dyck_word.py b/src/sage/combinat/dyck_word.py index a6620735321..80911865d49 100644 --- a/src/sage/combinat/dyck_word.py +++ b/src/sage/combinat/dyck_word.py @@ -539,7 +539,7 @@ def _repr_lattice(self, type=None, labelling=None, underpath=True) -> str: final_fall = " " else: final_fall = " _" + "__" * (length_of_final_fall - 1) - row = " "*(n - alst[-1] - 1) + final_fall + "\n" + row = " " * (n - alst[-1] - 1) + final_fall + "\n" for i in range(n - 1): c = 0 row = row + " "*(n-i-2-alst[-i-2]) @@ -1982,23 +1982,30 @@ def number_of_parking_functions(self) -> int: from sage.arith.misc import multinomial return multinomial(self.rise_composition()) - def list_parking_functions(self): + def list_parking_functions(self) -> list: r""" Return all parking functions whose supporting Dyck path is ``self``. EXAMPLES:: sage: DyckWord([1,1,0,0,1,0]).list_parking_functions() - Permutations of the multi-set [1, 1, 3] - sage: DyckWord([1,1,1,0,0,0]).list_parking_functions() - Permutations of the multi-set [1, 1, 1] - sage: DyckWord([1,0,1,0,1,0]).list_parking_functions() - Standard permutations of 3 + [[1, 1, 3], [1, 3, 1], [3, 1, 1]] """ + return list(self.parking_functions()) + + def parking_functions(self): + r""" + Iterate over parking functions whose supporting Dyck path is ``self``. + + EXAMPLES:: + + sage: list(DyckWord([1,1,0,1,0,0]).parking_functions()) + [[1, 1, 2], [1, 2, 1], [2, 1, 1]] + """ + from sage.combinat.parking_functions import ParkingFunction alist = self._area_sequence_iter() - return Permutations([i - ai + 1 for i, ai in enumerate(alist)]) - # TODO: upon implementation of ParkingFunction class - # map(ParkingFunction, Permutations([i - alist[i]+1 for i in range(len(alist))])) + for pi in Permutations([i - ai + 1 for i, ai in enumerate(alist)]): + yield ParkingFunction(pi) def reading_permutation(self) -> Permutation: r""" diff --git a/src/sage/combinat/parking_functions.py b/src/sage/combinat/parking_functions.py index bd67b573238..d356cedb2b7 100644 --- a/src/sage/combinat/parking_functions.py +++ b/src/sage/combinat/parking_functions.py @@ -222,11 +222,17 @@ def __init__(self, parent, lst): sage: type(b) + + Some checks for more general inputs:: + + sage: PF = ParkingFunction((1, 1, 2, 2, 5, 6)) + sage: PF = ParkingFunction(Permutation([4,2,3,1])) """ - if isinstance(lst, ParkingFunction): - lst = list(lst) if not isinstance(lst, list): - raise TypeError('input must be a list') + try: + lst = list(lst) + except TypeError: + raise TypeError('input must be convertible to a list') if parent is None: parent = ParkingFunctions_n(len(lst)) ClonableArray.__init__(self, parent, lst) From ad1846df564cad16a95b2d0b967a2ae19e88ce2f Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 7 Sep 2023 15:40:31 -0400 Subject: [PATCH 414/423] configure.ac: disable tzlocal with --disable-r The tzlocal package is a dependency of rpy2 and is used nowhere else in sage. When the user disables R with --disable-r, we can safely disable tzlocal too. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4a255967fc6..4ed44e024c4 100644 --- a/configure.ac +++ b/configure.ac @@ -487,7 +487,7 @@ AS_IF([test "$SAGE_ENABLE_notebook" = no -a "$SAGE_ENABLE_sagelib" = no], [ AC_ARG_ENABLE([r], AS_HELP_STRING([--disable-r], [disable build of the R package and related packages]), [ - for pkg in r rpy2 r_jupyter; do + for pkg in r rpy2 r_jupyter tzlocal; do AS_VAR_SET([SAGE_ENABLE_$pkg], [$enableval]) done ]) From 3878e5154a7941cae1f06c6c7389f1049c72d5c0 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 6 Sep 2023 22:16:45 -0700 Subject: [PATCH 415/423] Clean up cimports --- .../quatalg/quaternion_algebra_element.pyx | 1 - src/sage/libs/flint/fmpz_poly.pyx | 2 +- src/sage/matrix/matrix_modn_sparse.pyx | 38 +++++++++++-------- src/sage/modules/vector_modn_sparse.pyx | 2 - src/sage/rings/complex_mpc.pyx | 1 - src/sage/rings/ring_extension.pxd | 1 - src/sage/symbolic/constants_c_impl.pxi | 3 -- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/sage/algebras/quatalg/quaternion_algebra_element.pyx b/src/sage/algebras/quatalg/quaternion_algebra_element.pyx index 8cb7e848fd0..723c284989e 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra_element.pyx +++ b/src/sage/algebras/quatalg/quaternion_algebra_element.pyx @@ -34,7 +34,6 @@ Check that :trac:`20829` is fixed:: from sage.structure.element cimport AlgebraElement, Element from sage.structure.richcmp cimport rich_to_bool, rich_to_bool_sgn, richcmp_item -from sage.algebras.quatalg.quaternion_algebra_element cimport QuaternionAlgebraElement_abstract from sage.rings.rational cimport Rational from sage.rings.integer cimport Integer from sage.rings.number_field.number_field_element cimport NumberFieldElement diff --git a/src/sage/libs/flint/fmpz_poly.pyx b/src/sage/libs/flint/fmpz_poly.pyx index 8811ccf3a51..74915b37612 100644 --- a/src/sage/libs/flint/fmpz_poly.pyx +++ b/src/sage/libs/flint/fmpz_poly.pyx @@ -27,7 +27,7 @@ from sage.arith.long cimport pyobject_to_long from sage.cpython.string cimport char_to_str, str_to_bytes from sage.structure.sage_object cimport SageObject from sage.rings.integer cimport Integer -from sage.libs.flint.fmpz_poly cimport * + cdef class Fmpz_poly(SageObject): diff --git a/src/sage/matrix/matrix_modn_sparse.pyx b/src/sage/matrix/matrix_modn_sparse.pyx index dd908a4c91b..aaf9035b306 100644 --- a/src/sage/matrix/matrix_modn_sparse.pyx +++ b/src/sage/matrix/matrix_modn_sparse.pyx @@ -90,18 +90,26 @@ from sage.ext.stdsage cimport PY_NEW from sage.libs.flint.fmpz cimport fmpz_get_mpz, fmpz_set_mpz from sage.libs.flint.fmpz_mat cimport fmpz_mat_entry +from sage.libs.gmp.mpz cimport mpz_set from sage.modules.vector_modn_sparse cimport * cimport sage.libs.linbox.givaro as givaro cimport sage.libs.linbox.linbox as linbox -from sage.libs.linbox.conversion cimport * - -from .matrix2 cimport Matrix -cimport sage.matrix.matrix as matrix -cimport sage.matrix.matrix_sparse as matrix_sparse -cimport sage.matrix.matrix_dense as matrix_dense +from sage.libs.linbox.conversion cimport (get_method, + METHOD_DEFAULT, + METHOD_DENSE_ELIMINATION, + METHOD_SPARSE_ELIMINATION, + METHOD_BLACKBOX, + METHOD_WIEDEMANN, + new_linbox_matrix_modn_sparse, + new_linbox_matrix_integer_sparse, + new_linbox_vector_integer_dense, + new_sage_vector_integer_dense) + +from sage.matrix.matrix_sparse cimport Matrix_sparse +from sage.matrix.matrix_dense cimport Matrix_dense from sage.rings.finite_rings.integer_mod cimport IntegerMod_int, IntegerMod_abstract from sage.rings.integer cimport Integer from sage.rings.rational_field import QQ @@ -113,14 +121,14 @@ from sage.matrix.matrix2 import Matrix as Matrix2 from .args cimport SparseEntry, MatrixArgs_init from sage.arith.misc import is_prime -cimport sage.structure.element - from sage.data_structures.binary_search cimport * from sage.modules.vector_integer_sparse cimport * from .matrix_integer_dense cimport Matrix_integer_dense from sage.modules.vector_integer_dense cimport Vector_integer_dense +from sage.structure.element cimport Matrix + ################ # TODO: change this to use extern cdef's methods. from sage.rings.fast_arith cimport arith_int @@ -133,7 +141,7 @@ ai = arith_int() # Github Issue #12679. MAX_MODULUS = 46341 -cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse): +cdef class Matrix_modn_sparse(Matrix_sparse): def __cinit__(self): nr = self._nrows nc = self._ncols @@ -257,7 +265,7 @@ cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse): else: raise ValueError("unknown matrix format") - cdef sage.structure.element.Matrix _matrix_times_matrix_(self, sage.structure.element.Matrix _right): + cdef Matrix _matrix_times_matrix_(self, Matrix _right): """ This code is implicitly called for multiplying self by another sparse matrix. @@ -336,7 +344,7 @@ cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse): set_entry(&ans.rows[i], j, s) return ans - def _matrix_times_matrix_dense(self, sage.structure.element.Matrix _right): + def _matrix_times_matrix_dense(self, Matrix _right): """ Multiply self by the sparse matrix _right, and return the result as a dense matrix. @@ -361,7 +369,7 @@ cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse): """ cdef Matrix_modn_sparse right - cdef matrix_dense.Matrix_dense ans + cdef Matrix_dense ans right = _right cdef c_vector_modint* v @@ -871,7 +879,7 @@ cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse): self.cache('det', d) return d elif algorithm == 'generic': - d = matrix_sparse.Matrix_sparse.determinant(self) + d = Matrix_sparse.determinant(self) self.cache('det', d) return d else: @@ -949,7 +957,7 @@ cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse): if algorithm == "generic": return Matrix_sparse.solve_right(self, B) else: - if isinstance(B, sage.structure.element.Matrix): + if isinstance(B, Matrix): from sage.matrix.special import diagonal_matrix m, d = self._solve_matrix_linbox(B, algorithm) return m * diagonal_matrix([QQ((1,x)) for x in d]) @@ -1121,7 +1129,7 @@ cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse): from sage.modules.free_module_element import vector cdef Matrix_integer_dense B - if not isinstance(mat, Matrix): + if not isinstance(mat, Matrix2): B = matrix(ZZ, mat, sparse=False) else: B = mat.change_ring(ZZ).dense_matrix() diff --git a/src/sage/modules/vector_modn_sparse.pyx b/src/sage/modules/vector_modn_sparse.pyx index 746f9897db2..e2dd1d7c1a6 100644 --- a/src/sage/modules/vector_modn_sparse.pyx +++ b/src/sage/modules/vector_modn_sparse.pyx @@ -7,8 +7,6 @@ from cysignals.memory cimport sig_malloc, sig_free -from sage.modules.vector_modn_sparse cimport c_vector_modint - cdef int allocate_c_vector_modint(c_vector_modint* v, Py_ssize_t num_nonzero) except -1: """ diff --git a/src/sage/rings/complex_mpc.pyx b/src/sage/rings/complex_mpc.pyx index c847a9302b5..bed1102d4c9 100644 --- a/src/sage/rings/complex_mpc.pyx +++ b/src/sage/rings/complex_mpc.pyx @@ -2557,4 +2557,3 @@ cdef class CCtoMPC(Map): # Support Python's numbers abstract base class # import numbers -from sage.rings.complex_mpc import MPComplexNumber diff --git a/src/sage/rings/ring_extension.pxd b/src/sage/rings/ring_extension.pxd index 1607dd6fc2e..9115f8d26f8 100644 --- a/src/sage/rings/ring_extension.pxd +++ b/src/sage/rings/ring_extension.pxd @@ -1,6 +1,5 @@ from sage.categories.map cimport Map from sage.rings.ring cimport CommutativeRing, CommutativeAlgebra -from sage.rings.ring_extension cimport RingExtension_generic cdef class RingExtension_generic(CommutativeAlgebra): diff --git a/src/sage/symbolic/constants_c_impl.pxi b/src/sage/symbolic/constants_c_impl.pxi index b92b14318aa..3818926a9a2 100644 --- a/src/sage/symbolic/constants_c_impl.pxi +++ b/src/sage/symbolic/constants_c_impl.pxi @@ -16,9 +16,6 @@ The constant `e` # http://www.gnu.org/licenses/ #***************************************************************************** -from sage.symbolic.expression cimport Expression - - # keep exp(1) for fast access # this is initialized in the constructor of the class E below to prevent # circular imports while loading the library From 2716f62591ba58de1f004c6320225f38fc82f0a6 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Sep 2023 13:04:54 -0700 Subject: [PATCH 416/423] src/sage/matrix/matrix_modn_sparse.pyx: Sort imports --- src/sage/matrix/matrix_modn_sparse.pxd | 2 +- src/sage/matrix/matrix_modn_sparse.pyx | 38 ++++++++++---------------- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/src/sage/matrix/matrix_modn_sparse.pxd b/src/sage/matrix/matrix_modn_sparse.pxd index 5c471a7082f..dded069b3d8 100644 --- a/src/sage/matrix/matrix_modn_sparse.pxd +++ b/src/sage/matrix/matrix_modn_sparse.pxd @@ -1,4 +1,4 @@ -from .matrix_sparse cimport Matrix_sparse +from sage.matrix.matrix_sparse cimport Matrix_sparse from sage.modules.vector_modn_sparse cimport * cdef class Matrix_modn_sparse(Matrix_sparse): diff --git a/src/sage/matrix/matrix_modn_sparse.pyx b/src/sage/matrix/matrix_modn_sparse.pyx index aaf9035b306..84cfbedb226 100644 --- a/src/sage/matrix/matrix_modn_sparse.pyx +++ b/src/sage/matrix/matrix_modn_sparse.pyx @@ -86,17 +86,15 @@ from libc.limits cimport UINT_MAX from cysignals.memory cimport check_calloc, sig_free from cysignals.signals cimport sig_on, sig_off -from sage.ext.stdsage cimport PY_NEW +cimport sage.libs.linbox.givaro as givaro +cimport sage.libs.linbox.linbox as linbox +from sage.arith.misc import is_prime +from sage.data_structures.binary_search cimport * +from sage.ext.stdsage cimport PY_NEW from sage.libs.flint.fmpz cimport fmpz_get_mpz, fmpz_set_mpz from sage.libs.flint.fmpz_mat cimport fmpz_mat_entry from sage.libs.gmp.mpz cimport mpz_set - -from sage.modules.vector_modn_sparse cimport * - -cimport sage.libs.linbox.givaro as givaro -cimport sage.libs.linbox.linbox as linbox - from sage.libs.linbox.conversion cimport (get_method, METHOD_DEFAULT, METHOD_DENSE_ELIMINATION, @@ -107,31 +105,23 @@ from sage.libs.linbox.conversion cimport (get_method, new_linbox_matrix_integer_sparse, new_linbox_vector_integer_dense, new_sage_vector_integer_dense) - -from sage.matrix.matrix_sparse cimport Matrix_sparse +from sage.matrix.args cimport SparseEntry, MatrixArgs_init +from sage.matrix.matrix2 import Matrix as Matrix2 from sage.matrix.matrix_dense cimport Matrix_dense +from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense +from sage.misc.verbose import verbose, get_verbose +from sage.modules.vector_integer_dense cimport Vector_integer_dense +from sage.modules.vector_integer_sparse cimport * +from sage.modules.vector_modn_sparse cimport * +from sage.rings.fast_arith cimport arith_int from sage.rings.finite_rings.integer_mod cimport IntegerMod_int, IntegerMod_abstract from sage.rings.integer cimport Integer -from sage.rings.rational_field import QQ from sage.rings.integer_ring import ZZ - -from sage.misc.verbose import verbose, get_verbose - -from sage.matrix.matrix2 import Matrix as Matrix2 -from .args cimport SparseEntry, MatrixArgs_init -from sage.arith.misc import is_prime - -from sage.data_structures.binary_search cimport * -from sage.modules.vector_integer_sparse cimport * - -from .matrix_integer_dense cimport Matrix_integer_dense -from sage.modules.vector_integer_dense cimport Vector_integer_dense - +from sage.rings.rational_field import QQ from sage.structure.element cimport Matrix ################ # TODO: change this to use extern cdef's methods. -from sage.rings.fast_arith cimport arith_int cdef arith_int ai ai = arith_int() ################ From 978d3185658dfd84e434f63787fc30628f4442e7 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Sep 2023 13:26:15 -0700 Subject: [PATCH 417/423] src/sage/libs/flint/qsieve.pyx: Remove self-cimport --- src/sage/libs/flint/qsieve.pyx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sage/libs/flint/qsieve.pyx b/src/sage/libs/flint/qsieve.pyx index 780d6f5c150..7d93d41f4cc 100644 --- a/src/sage/libs/flint/qsieve.pyx +++ b/src/sage/libs/flint/qsieve.pyx @@ -7,7 +7,6 @@ been absorbed into flint. from cysignals.signals cimport sig_on, sig_off from sage.libs.flint.fmpz cimport fmpz_t, fmpz_init, fmpz_set_mpz from sage.libs.flint.fmpz_factor cimport * -from sage.libs.flint.qsieve cimport * from sage.rings.integer cimport Integer From 711835fcbf821d73964f7c7c378629f06d1e3e55 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Sep 2023 13:26:35 -0700 Subject: [PATCH 418/423] src/sage/graphs/base/boost_graph.pyx: Add missing doctest prompts --- src/sage/graphs/base/boost_graph.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/graphs/base/boost_graph.pyx b/src/sage/graphs/base/boost_graph.pyx index ff222837117..72e1353339e 100644 --- a/src/sage/graphs/base/boost_graph.pyx +++ b/src/sage/graphs/base/boost_graph.pyx @@ -561,7 +561,7 @@ cpdef bandwidth_heuristics(g, algorithm='cuthill_mckee'): Given a wrong algorithm:: - from sage.graphs.base.boost_graph import bandwidth_heuristics + sage: from sage.graphs.base.boost_graph import bandwidth_heuristics sage: bandwidth_heuristics(graphs.PathGraph(3), algorithm='tip top') Traceback (most recent call last): ... @@ -569,7 +569,7 @@ cpdef bandwidth_heuristics(g, algorithm='cuthill_mckee'): Given a graph with no edges:: - from sage.graphs.base.boost_graph import bandwidth_heuristics + sage: from sage.graphs.base.boost_graph import bandwidth_heuristics sage: bandwidth_heuristics(Graph()) (0, []) sage: bandwidth_heuristics(graphs.RandomGNM(10,0)) # needs networkx From c9d555d99a6f67c52c8afdaa6882c9b0df40c9cb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Sep 2023 13:27:41 -0700 Subject: [PATCH 419/423] src/sage/graphs/comparability.pyx: Remove self-import --- src/sage/graphs/comparability.pyx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sage/graphs/comparability.pyx b/src/sage/graphs/comparability.pyx index 119cd892265..405b4ace2ff 100644 --- a/src/sage/graphs/comparability.pyx +++ b/src/sage/graphs/comparability.pyx @@ -677,7 +677,6 @@ def is_permutation(g, algorithm="greedy", certificate=False, check=True, ....: break """ - from sage.graphs.comparability import is_comparability if certificate: # First poset, we stop if it fails From f75277a4305553f8ca1d7442a18062e5a656b11e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Sep 2023 13:28:41 -0700 Subject: [PATCH 420/423] src/sage/symbolic/expression.pyx: Remove self-import --- src/sage/symbolic/expression.pyx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index 2300c10d125..0f251ac4e5c 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -6396,7 +6396,6 @@ cdef class Expression(Expression_abc): sage: type(u._unpack_operands()[0]) <... 'tuple'> """ - from sage.symbolic.expression import unpack_operands return unpack_operands(self) def operands(self): From 1ba481b127156383c475f9f32248b38167cbbeb9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Sep 2023 13:30:05 -0700 Subject: [PATCH 421/423] src/sage/graphs/strongly_regular_db.pyx: Remove self-import --- src/sage/graphs/strongly_regular_db.pyx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sage/graphs/strongly_regular_db.pyx b/src/sage/graphs/strongly_regular_db.pyx index ae7eee6f4ea..8f9f37d196f 100644 --- a/src/sage/graphs/strongly_regular_db.pyx +++ b/src/sage/graphs/strongly_regular_db.pyx @@ -2649,7 +2649,6 @@ def SRG_126_50_13_24(): sage: G.is_strongly_regular(parameters=True) (126, 50, 13, 24) """ - from sage.graphs.strongly_regular_db import SRG_175_72_20_36 from sage.graphs.generators.smallgraphs import HoffmanSingletonGraph hs = HoffmanSingletonGraph() s = set(hs.vertices(sort=False)).difference(hs.neighbors(0) + [0]) From 933707f83286d078cdf2dc517339d7e73d11f688 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 9 Sep 2023 10:55:03 +0200 Subject: [PATCH 422/423] PR #36021: small tweak --- src/sage/graphs/generic_graph.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 574ddd8b5ab..1a205d6de34 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -5413,12 +5413,12 @@ def is_planar(self, on_embedding=None, kuratowski=False, set_embedding=False, se Traceback (most recent call last): ... NotImplementedError: cannot compute with embeddings of - multiple-edged or looped graphs + multiple-edged or looped graphs sage: G.is_planar(set_embedding=True) Traceback (most recent call last): ... NotImplementedError: cannot compute with embeddings of - multiple-edged or looped graphs + multiple-edged or looped graphs sage: G.is_planar(kuratowski=True) (True, None) sage: G.is_planar(set_pos=True) @@ -5440,12 +5440,12 @@ def is_planar(self, on_embedding=None, kuratowski=False, set_embedding=False, se Traceback (most recent call last): ... NotImplementedError: cannot compute with embeddings of - digraphs with pairs of opposite arcs + digraphs with pairs of opposite arcs sage: D.is_planar(set_embedding=True) Traceback (most recent call last): ... NotImplementedError: cannot compute with embeddings of - digraphs with pairs of opposite arcs + digraphs with pairs of opposite arcs sage: D.is_planar(kuratowski=True) (True, None) sage: D.allow_multiple_edges(True) @@ -5462,12 +5462,12 @@ def is_planar(self, on_embedding=None, kuratowski=False, set_embedding=False, se Traceback (most recent call last): ... NotImplementedError: cannot compute with embeddings of - multiple-edged or looped graphs + multiple-edged or looped graphs sage: D.is_planar(on_embedding={}) Traceback (most recent call last): ... NotImplementedError: cannot compute with embeddings of - multiple-edged or looped graphs + multiple-edged or looped graphs :: From 41031292ff1ae518cd5b5a29ce277aa1ff8ced9e Mon Sep 17 00:00:00 2001 From: Release Manager Date: Mon, 11 Sep 2023 00:26:52 +0200 Subject: [PATCH 423/423] Updated SageMath version to 10.2.beta2 --- CITATION.cff | 4 ++-- 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_bliss/install-requires.txt | 2 +- build/pkgs/sagemath_categories/install-requires.txt | 2 +- build/pkgs/sagemath_coxeter3/install-requires.txt | 2 +- build/pkgs/sagemath_environment/install-requires.txt | 2 +- build/pkgs/sagemath_mcqd/install-requires.txt | 2 +- build/pkgs/sagemath_meataxe/install-requires.txt | 2 +- build/pkgs/sagemath_objects/install-requires.txt | 2 +- build/pkgs/sagemath_repl/install-requires.txt | 2 +- build/pkgs/sagemath_sirocco/install-requires.txt | 2 +- build/pkgs/sagemath_tdlib/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-bliss/VERSION.txt | 2 +- pkgs/sagemath-categories/VERSION.txt | 2 +- pkgs/sagemath-coxeter3/VERSION.txt | 2 +- pkgs/sagemath-environment/VERSION.txt | 2 +- pkgs/sagemath-mcqd/VERSION.txt | 2 +- pkgs/sagemath-meataxe/VERSION.txt | 2 +- pkgs/sagemath-objects/VERSION.txt | 2 +- pkgs/sagemath-repl/VERSION.txt | 2 +- pkgs/sagemath-sirocco/VERSION.txt | 2 +- pkgs/sagemath-tdlib/VERSION.txt | 2 +- src/VERSION.txt | 2 +- src/bin/sage-version.sh | 6 +++--- src/sage/version.py | 6 +++--- 37 files changed, 44 insertions(+), 44 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 33f35797f06..1559f9ee0c1 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -4,8 +4,8 @@ title: SageMath abstract: SageMath is a free open-source mathematics software system. authors: - name: "The SageMath Developers" -version: 10.2.beta1 +version: 10.2.beta2 doi: 10.5281/zenodo.593563 -date-released: 2023-09-01 +date-released: 2023-09-10 repository-code: "https://github.com/sagemath/sage" url: "https://www.sagemath.org/" diff --git a/VERSION.txt b/VERSION.txt index b3bbedfc466..a97d473cd7f 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -SageMath version 10.2.beta1, Release Date: 2023-09-01 +SageMath version 10.2.beta2, Release Date: 2023-09-10 diff --git a/build/pkgs/configure/checksums.ini b/build/pkgs/configure/checksums.ini index 1f3c1bba6ca..657a407ed04 100644 --- a/build/pkgs/configure/checksums.ini +++ b/build/pkgs/configure/checksums.ini @@ -1,4 +1,4 @@ tarball=configure-VERSION.tar.gz -sha1=d392fbfb62e75f5d2ea57c39bcf8d6281960790c -md5=6bc99c5b5382bf6bb2f626a19a1bdb9f -cksum=3742648740 +sha1=0842a677c09b550b0c091037c63d141cf709595b +md5=615976ca4d2fcbf9b0559b809e5bf645 +cksum=792467397 diff --git a/build/pkgs/configure/package-version.txt b/build/pkgs/configure/package-version.txt index c6650e7e097..731312f1e86 100644 --- a/build/pkgs/configure/package-version.txt +++ b/build/pkgs/configure/package-version.txt @@ -1 +1 @@ -4ac944772d896e33b8666a71509a00877969a79f +f9609a075a93ad4c6d270f129c6c33f4945e4bdc diff --git a/build/pkgs/sage_conf/install-requires.txt b/build/pkgs/sage_conf/install-requires.txt index 22f995d5ba6..06f170ad9c5 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.2b1 +sage-conf ~= 10.2b2 diff --git a/build/pkgs/sage_docbuild/install-requires.txt b/build/pkgs/sage_docbuild/install-requires.txt index eddd7bf2c86..7b518e173dd 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.2b1 +sage-docbuild ~= 10.2b2 diff --git a/build/pkgs/sage_setup/install-requires.txt b/build/pkgs/sage_setup/install-requires.txt index bd2318c8a43..8db908c6944 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.2b1 +sage-setup ~= 10.2b2 diff --git a/build/pkgs/sage_sws2rst/install-requires.txt b/build/pkgs/sage_sws2rst/install-requires.txt index 919f61d9a57..1ca0ff7a241 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.2b1 +sage-sws2rst ~= 10.2b2 diff --git a/build/pkgs/sagelib/install-requires.txt b/build/pkgs/sagelib/install-requires.txt index 2e2ccc4f6b8..aef7517b907 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 -sagemath-standard ~= 10.2b1 +sagemath-standard ~= 10.2b2 diff --git a/build/pkgs/sagemath_bliss/install-requires.txt b/build/pkgs/sagemath_bliss/install-requires.txt index 381f802e2dd..31f2105dc48 100644 --- a/build/pkgs/sagemath_bliss/install-requires.txt +++ b/build/pkgs/sagemath_bliss/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-bliss ~= 10.2b1 +sagemath-bliss ~= 10.2b2 diff --git a/build/pkgs/sagemath_categories/install-requires.txt b/build/pkgs/sagemath_categories/install-requires.txt index 9b709a38980..7165a331015 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.2b1 +sagemath-categories ~= 10.2b2 diff --git a/build/pkgs/sagemath_coxeter3/install-requires.txt b/build/pkgs/sagemath_coxeter3/install-requires.txt index a8c94946f02..b83f60f73f9 100644 --- a/build/pkgs/sagemath_coxeter3/install-requires.txt +++ b/build/pkgs/sagemath_coxeter3/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-coxeter3 ~= 10.2b1 +sagemath-coxeter3 ~= 10.2b2 diff --git a/build/pkgs/sagemath_environment/install-requires.txt b/build/pkgs/sagemath_environment/install-requires.txt index b4cd1a51029..8ff3d48b4e8 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.2b1 +sagemath-environment ~= 10.2b2 diff --git a/build/pkgs/sagemath_mcqd/install-requires.txt b/build/pkgs/sagemath_mcqd/install-requires.txt index 126c44af66e..04b2463b7c2 100644 --- a/build/pkgs/sagemath_mcqd/install-requires.txt +++ b/build/pkgs/sagemath_mcqd/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-mcqd ~= 10.2b1 +sagemath-mcqd ~= 10.2b2 diff --git a/build/pkgs/sagemath_meataxe/install-requires.txt b/build/pkgs/sagemath_meataxe/install-requires.txt index 2bb80c9af82..124bbb008a7 100644 --- a/build/pkgs/sagemath_meataxe/install-requires.txt +++ b/build/pkgs/sagemath_meataxe/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-meataxe ~= 10.2b1 +sagemath-meataxe ~= 10.2b2 diff --git a/build/pkgs/sagemath_objects/install-requires.txt b/build/pkgs/sagemath_objects/install-requires.txt index 5f66e9fdf39..c99a73ae10a 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.2b1 +sagemath-objects ~= 10.2b2 diff --git a/build/pkgs/sagemath_repl/install-requires.txt b/build/pkgs/sagemath_repl/install-requires.txt index a84a407a137..92d2e7260fc 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.2b1 +sagemath-repl ~= 10.2b2 diff --git a/build/pkgs/sagemath_sirocco/install-requires.txt b/build/pkgs/sagemath_sirocco/install-requires.txt index 2a4dc502cd2..8ced9ae5f03 100644 --- a/build/pkgs/sagemath_sirocco/install-requires.txt +++ b/build/pkgs/sagemath_sirocco/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-sirocco ~= 10.2b1 +sagemath-sirocco ~= 10.2b2 diff --git a/build/pkgs/sagemath_tdlib/install-requires.txt b/build/pkgs/sagemath_tdlib/install-requires.txt index e76350bceef..192e1609862 100644 --- a/build/pkgs/sagemath_tdlib/install-requires.txt +++ b/build/pkgs/sagemath_tdlib/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-tdlib ~= 10.2b1 +sagemath-tdlib ~= 10.2b2 diff --git a/pkgs/sage-conf/VERSION.txt b/pkgs/sage-conf/VERSION.txt index 11692eaae58..ed84bdcdf51 100644 --- a/pkgs/sage-conf/VERSION.txt +++ b/pkgs/sage-conf/VERSION.txt @@ -1 +1 @@ -10.2.beta1 +10.2.beta2 diff --git a/pkgs/sage-conf_pypi/VERSION.txt b/pkgs/sage-conf_pypi/VERSION.txt index 11692eaae58..ed84bdcdf51 100644 --- a/pkgs/sage-conf_pypi/VERSION.txt +++ b/pkgs/sage-conf_pypi/VERSION.txt @@ -1 +1 @@ -10.2.beta1 +10.2.beta2 diff --git a/pkgs/sage-docbuild/VERSION.txt b/pkgs/sage-docbuild/VERSION.txt index 11692eaae58..ed84bdcdf51 100644 --- a/pkgs/sage-docbuild/VERSION.txt +++ b/pkgs/sage-docbuild/VERSION.txt @@ -1 +1 @@ -10.2.beta1 +10.2.beta2 diff --git a/pkgs/sage-setup/VERSION.txt b/pkgs/sage-setup/VERSION.txt index 11692eaae58..ed84bdcdf51 100644 --- a/pkgs/sage-setup/VERSION.txt +++ b/pkgs/sage-setup/VERSION.txt @@ -1 +1 @@ -10.2.beta1 +10.2.beta2 diff --git a/pkgs/sage-sws2rst/VERSION.txt b/pkgs/sage-sws2rst/VERSION.txt index 11692eaae58..ed84bdcdf51 100644 --- a/pkgs/sage-sws2rst/VERSION.txt +++ b/pkgs/sage-sws2rst/VERSION.txt @@ -1 +1 @@ -10.2.beta1 +10.2.beta2 diff --git a/pkgs/sagemath-bliss/VERSION.txt b/pkgs/sagemath-bliss/VERSION.txt index 11692eaae58..ed84bdcdf51 100644 --- a/pkgs/sagemath-bliss/VERSION.txt +++ b/pkgs/sagemath-bliss/VERSION.txt @@ -1 +1 @@ -10.2.beta1 +10.2.beta2 diff --git a/pkgs/sagemath-categories/VERSION.txt b/pkgs/sagemath-categories/VERSION.txt index 11692eaae58..ed84bdcdf51 100644 --- a/pkgs/sagemath-categories/VERSION.txt +++ b/pkgs/sagemath-categories/VERSION.txt @@ -1 +1 @@ -10.2.beta1 +10.2.beta2 diff --git a/pkgs/sagemath-coxeter3/VERSION.txt b/pkgs/sagemath-coxeter3/VERSION.txt index 11692eaae58..ed84bdcdf51 100644 --- a/pkgs/sagemath-coxeter3/VERSION.txt +++ b/pkgs/sagemath-coxeter3/VERSION.txt @@ -1 +1 @@ -10.2.beta1 +10.2.beta2 diff --git a/pkgs/sagemath-environment/VERSION.txt b/pkgs/sagemath-environment/VERSION.txt index 11692eaae58..ed84bdcdf51 100644 --- a/pkgs/sagemath-environment/VERSION.txt +++ b/pkgs/sagemath-environment/VERSION.txt @@ -1 +1 @@ -10.2.beta1 +10.2.beta2 diff --git a/pkgs/sagemath-mcqd/VERSION.txt b/pkgs/sagemath-mcqd/VERSION.txt index 11692eaae58..ed84bdcdf51 100644 --- a/pkgs/sagemath-mcqd/VERSION.txt +++ b/pkgs/sagemath-mcqd/VERSION.txt @@ -1 +1 @@ -10.2.beta1 +10.2.beta2 diff --git a/pkgs/sagemath-meataxe/VERSION.txt b/pkgs/sagemath-meataxe/VERSION.txt index 11692eaae58..ed84bdcdf51 100644 --- a/pkgs/sagemath-meataxe/VERSION.txt +++ b/pkgs/sagemath-meataxe/VERSION.txt @@ -1 +1 @@ -10.2.beta1 +10.2.beta2 diff --git a/pkgs/sagemath-objects/VERSION.txt b/pkgs/sagemath-objects/VERSION.txt index 11692eaae58..ed84bdcdf51 100644 --- a/pkgs/sagemath-objects/VERSION.txt +++ b/pkgs/sagemath-objects/VERSION.txt @@ -1 +1 @@ -10.2.beta1 +10.2.beta2 diff --git a/pkgs/sagemath-repl/VERSION.txt b/pkgs/sagemath-repl/VERSION.txt index 11692eaae58..ed84bdcdf51 100644 --- a/pkgs/sagemath-repl/VERSION.txt +++ b/pkgs/sagemath-repl/VERSION.txt @@ -1 +1 @@ -10.2.beta1 +10.2.beta2 diff --git a/pkgs/sagemath-sirocco/VERSION.txt b/pkgs/sagemath-sirocco/VERSION.txt index 11692eaae58..ed84bdcdf51 100644 --- a/pkgs/sagemath-sirocco/VERSION.txt +++ b/pkgs/sagemath-sirocco/VERSION.txt @@ -1 +1 @@ -10.2.beta1 +10.2.beta2 diff --git a/pkgs/sagemath-tdlib/VERSION.txt b/pkgs/sagemath-tdlib/VERSION.txt index 11692eaae58..ed84bdcdf51 100644 --- a/pkgs/sagemath-tdlib/VERSION.txt +++ b/pkgs/sagemath-tdlib/VERSION.txt @@ -1 +1 @@ -10.2.beta1 +10.2.beta2 diff --git a/src/VERSION.txt b/src/VERSION.txt index 11692eaae58..ed84bdcdf51 100644 --- a/src/VERSION.txt +++ b/src/VERSION.txt @@ -1 +1 @@ -10.2.beta1 +10.2.beta2 diff --git a/src/bin/sage-version.sh b/src/bin/sage-version.sh index 6f192dbbc5c..a4f2cf54b18 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.2.beta1' -SAGE_RELEASE_DATE='2023-09-01' -SAGE_VERSION_BANNER='SageMath version 10.2.beta1, Release Date: 2023-09-01' +SAGE_VERSION='10.2.beta2' +SAGE_RELEASE_DATE='2023-09-10' +SAGE_VERSION_BANNER='SageMath version 10.2.beta2, Release Date: 2023-09-10' diff --git a/src/sage/version.py b/src/sage/version.py index dfe0f7baf9c..f0733402150 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.2.beta1' -date = '2023-09-01' -banner = 'SageMath version 10.2.beta1, Release Date: 2023-09-01' +version = '10.2.beta2' +date = '2023-09-10' +banner = 'SageMath version 10.2.beta2, Release Date: 2023-09-10'