From 5257002cb51479e19bd9d41b838f01427d8d8519 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 3 Sep 2023 12:49:08 -0700 Subject: [PATCH 01/32] sage.schemes: Update # needs --- src/sage/schemes/projective/projective_point.py | 1 + src/sage/schemes/projective/projective_subscheme.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/sage/schemes/projective/projective_point.py b/src/sage/schemes/projective/projective_point.py index 53038b21efe..9769b7237c6 100644 --- a/src/sage/schemes/projective/projective_point.py +++ b/src/sage/schemes/projective/projective_point.py @@ -1074,6 +1074,7 @@ class SchemeMorphism_point_projective_field(SchemeMorphism_point_projective_ring EXAMPLES:: + sage: # needs sage.rings.real_mpfr sage: P = ProjectiveSpace(3, RR) sage: P(2, 3, 4, 5) (0.400000000000000 : 0.600000000000000 : 0.800000000000000 : 1.00000000000000) diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index 8970637882d..9a465b36ea4 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -1432,6 +1432,7 @@ def global_height(self, prec=None): EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: NF. = NumberField(x^2 - 5) sage: P. = ProjectiveSpace(NF, 2) @@ -1443,7 +1444,7 @@ def global_height(self, prec=None): sage: P. = ProjectiveSpace(QQ, 2) sage: X = P.subscheme([z^2 - 101*y^2 - 3*x*z]) - sage: X.global_height() # long time + sage: X.global_height() # long time 4.61512051684126 """ return self.Chow_form().global_height(prec) @@ -1465,19 +1466,20 @@ def local_height(self, v, prec=None): EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: NF. = NumberField(x^2 - 5) sage: I = NF.ideal(3) sage: P. = ProjectiveSpace(NF, 2) sage: X = P.subscheme([3*x*y - 5*x*z, y^2]) - sage: X.local_height(I) + sage: X.local_height(I) # needs sage.libs.singular 0.000000000000000 :: sage: P. = ProjectiveSpace(QQ, 2) sage: X = P.subscheme([z^2 - 101*y^2 - 3*x*z]) - sage: X.local_height(2) + sage: X.local_height(2) # needs sage.libs.singular 0.000000000000000 """ return self.Chow_form().local_height(v, prec) @@ -1499,18 +1501,19 @@ def local_height_arch(self, i, prec=None): EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: NF. = NumberField(x^2 - 5) sage: P. = ProjectiveSpace(NF, 2) sage: X = P.subscheme([x^2 + y*z, 3*x*y]) - sage: X.local_height_arch(1) + sage: X.local_height_arch(1) # needs sage.libs.singular 0.0000000000000000000000000000000 :: sage: P. = ProjectiveSpace(QQ, 2) sage: X = P.subscheme([z^2 - 101*y^2 - 3*x*z]) - sage: X.local_height_arch(1) + sage: X.local_height_arch(1) # needs sage.libs.singular 4.61512051684126 """ return self.Chow_form().local_height_arch(i, prec) \ No newline at end of file From 26bda85794341ee6de5916709f33c69f11aff22d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 3 Sep 2023 15:31:22 -0700 Subject: [PATCH 02/32] Fix # needs for sagemath-pari --- src/sage/schemes/projective/projective_morphism.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 5ba47f00afa..4396f4c7765 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -2082,18 +2082,18 @@ def reduce_base_field(self): sage: H2 = Hom(P, P2) sage: H3 = Hom(P2, P) sage: f = H([x^2 + (2*t^3 + 2*t^2 + 1)*y^2, y^2]) - sage: f.reduce_base_field() + sage: f.reduce_base_field() # needs sage.modules Scheme endomorphism of Projective Space of dimension 1 over Finite Field in t2 of size 3^2 Defn: Defined on coordinates by sending (x : y) to (x^2 + t2*y^2 : y^2) sage: f2 = H2([x^2 + 5*y^2, y^2, 2*x*y]) - sage: f2.reduce_base_field() + sage: f2.reduce_base_field() # needs sage.modules Scheme morphism: From: Projective Space of dimension 1 over Finite Field of size 3 To: Projective Space of dimension 2 over Finite Field of size 3 Defn: Defined on coordinates by sending (x : y) to (x^2 - y^2 : y^2 : -x*y) sage: f3 = H3([a^2 + t*b^2, c^2]) - sage: f3.reduce_base_field() + sage: f3.reduce_base_field() # needs sage.modules 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 From 796265f2509acc932ba067fabc3d67a7df931fca Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 3 Sep 2023 19:55:20 -0700 Subject: [PATCH 03/32] sage.schemes: Update # needs --- src/sage/schemes/affine/affine_space.py | 2 +- src/sage/schemes/generic/algebraic_scheme.py | 2 +- src/sage/schemes/generic/morphism.py | 2 +- src/sage/schemes/generic/scheme.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/schemes/affine/affine_space.py b/src/sage/schemes/affine/affine_space.py index 927a065cf60..2680982c232 100644 --- a/src/sage/schemes/affine/affine_space.py +++ b/src/sage/schemes/affine/affine_space.py @@ -1149,7 +1149,7 @@ def curve(self, F): EXAMPLES:: sage: A. = AffineSpace(QQ, 3) - sage: A.curve([y - x^4, z - y^5]) # needs sage.libs.pari + sage: A.curve([y - x^4, z - y^5]) # needs sage.schemes Affine Curve over Rational Field defined by -x^4 + y, -y^5 + z """ from sage.schemes.curves.constructor import Curve diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index 5d071f2bd49..01b7229f846 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -1296,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() # needs sage.rings.finite_rings + sage: X.is_irreducible() # needs sage.libs.singular False """ return self.defining_ideal().is_prime() diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index f42e8f4a680..7597d385b40 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: # 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() diff --git a/src/sage/schemes/generic/scheme.py b/src/sage/schemes/generic/scheme.py index fe55bca9117..da188ac63b3 100644 --- a/src/sage/schemes/generic/scheme.py +++ b/src/sage/schemes/generic/scheme.py @@ -684,7 +684,7 @@ def count_points(self, n): 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 + sage: X.count_points(2) # needs sage.libs.singular sage.rings.finite_rings [5, 17] """ F = self.base_ring() From 75b8262a338b9c13cf94542b9289be382bafcda3 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 3 Sep 2023 23:48:50 -0700 Subject: [PATCH 04/32] src/sage/dynamics/complex_dynamics/mandel_julia.py: Use lazy_import --- src/sage/dynamics/complex_dynamics/mandel_julia.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/dynamics/complex_dynamics/mandel_julia.py b/src/sage/dynamics/complex_dynamics/mandel_julia.py index f387c84ccec..f3d6fbfa5a0 100644 --- a/src/sage/dynamics/complex_dynamics/mandel_julia.py +++ b/src/sage/dynamics/complex_dynamics/mandel_julia.py @@ -31,7 +31,6 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -from sage.dynamics.arithmetic_dynamics.generic_ds import DynamicalSystem from sage.dynamics.complex_dynamics.mandel_julia_helper import (fast_mandelbrot_plot, fast_external_ray, convert_to_pixels, @@ -56,6 +55,8 @@ from sage.rings.fraction_field import is_FractionField from sage.categories.function_fields import FunctionFields +lazy_import('sage.dynamics.arithmetic_dynamics.generic_ds', 'DynamicalSystem') + EPS = 0.00001 def mandelbrot_plot(f=None, **kwds): From 0284add97c3c9cf7af2c13577df1720498b6ccec Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 4 Sep 2023 17:15:36 -0700 Subject: [PATCH 05/32] sage.schemes: Doctest cosmetics, update # needs --- .../hyperelliptic_curves/monsky_washnitzer.py | 317 ++++++++++-------- src/sage/schemes/plane_conics/con_field.py | 67 ++-- .../plane_conics/con_rational_field.py | 16 +- .../con_rational_function_field.py | 26 +- src/sage/schemes/product_projective/point.py | 2 +- .../schemes/projective/projective_morphism.py | 9 +- .../schemes/projective/projective_space.py | 2 +- .../projective/projective_subscheme.py | 4 +- 8 files changed, 238 insertions(+), 205 deletions(-) diff --git a/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py b/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py index 321928f1464..c8683230212 100644 --- a/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py +++ b/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py @@ -84,7 +84,7 @@ class SpecialCubicQuotientRingElement(CommutativeAlgebraElement): """ - An element of a SpecialCubicQuotientRing. + An element of a :class:`SpecialCubicQuotientRing`. """ def __init__(self, parent, p0, p1, p2, check=True): """ @@ -93,7 +93,7 @@ def __init__(self, parent, p0, p1, p2, check=True): INPUT: - - ``parent`` -- a SpecialCubicQuotientRing + - ``parent`` -- a :class:`SpecialCubicQuotientRing` - ``p0, p1, p2`` -- coefficients; must be coercible into parent.poly_ring() @@ -306,7 +306,9 @@ def square(self): sage: f = R.create_element(1 + 2*t + 3*t^2, 4 + 7*t + 9*t^2, 3 + 5*t + 11*t^2) sage: f.square() - (73*T^5 + 16*T^4 + 38*T^3 + 39*T^2 + 70*T + 120) + (121*T^5 + 113*T^4 + 73*T^3 + 8*T^2 + 51*T + 61)*x + (18*T^4 + 60*T^3 + 22*T^2 + 108*T + 31)*x^2 + (73*T^5 + 16*T^4 + 38*T^3 + 39*T^2 + 70*T + 120) + + (121*T^5 + 113*T^4 + 73*T^3 + 8*T^2 + 51*T + 61)*x + + (18*T^4 + 60*T^3 + 22*T^2 + 108*T + 31)*x^2 """ return self * self @@ -323,7 +325,9 @@ def _mul_(self, other): sage: f = R.create_element(1 + 2*t + 3*t^2, 4 + 7*t + 9*t^2, 3 + 5*t + 11*t^2) sage: g = R.create_element(4 + 3*t + 7*t^2, 2 + 3*t + t^2, 8 + 4*t + 6*t^2) sage: f * g - (65*T^5 + 27*T^4 + 33*T^3 + 75*T^2 + 120*T + 57) + (66*T^5 + T^4 + 123*T^3 + 95*T^2 + 24*T + 50)*x + (45*T^4 + 75*T^3 + 37*T^2 + 2*T + 52)*x^2 + (65*T^5 + 27*T^4 + 33*T^3 + 75*T^2 + 120*T + 57) + + (66*T^5 + T^4 + 123*T^3 + 95*T^2 + 24*T + 50)*x + + (45*T^4 + 75*T^3 + 37*T^2 + 2*T + 52)*x^2 """ # Here we do Toom-Cook three-way multiplication, which reduces # the naive 9 polynomial multiplications to only 5 polynomial @@ -470,8 +474,8 @@ def __init__(self, Q, laurent_series=False): `Q(x) = x^3 + ax + b`, where `a`, `b` belong to a ring in which 2, 3 are invertible. - - ``laurent_series`` -- whether or not to allow - negative powers of `T` (default=False) + - ``laurent_series`` -- boolean (default: ``False``); whether or not to allow + negative powers of `T` EXAMPLES:: @@ -494,7 +498,8 @@ def __init__(self, Q, laurent_series=False): sage: R = monsky_washnitzer.SpecialCubicQuotientRing(t^3 - t + 1) Traceback (most recent call last): ... - ArithmeticError: 2 and 3 must be invertible in the coefficient ring (=Ring of integers modulo 10) of Q + ArithmeticError: 2 and 3 must be invertible in the coefficient ring + (=Ring of integers modulo 10) of Q """ if not isinstance(Q, Polynomial): raise TypeError("Q (=%s) must be a polynomial" % Q) @@ -717,10 +722,10 @@ def helper_matrix(Q): def lift(x): r""" - Try to call x.lift(), presumably from the `p`-adics to ZZ. + Try to call ``x.lift()``, presumably from the `p`-adics to ``ZZ``. If this fails, it assumes the input is a power series, and tries to - lift it to a power series over QQ. + lift it to a power series over ``QQ``. This function is just a very kludgy solution to the problem of trying to make the reduction code (below) work over both Zp and @@ -728,14 +733,14 @@ def lift(x): EXAMPLES:: + sage: # needs sage.rings.padics sage: from sage.schemes.hyperelliptic_curves.monsky_washnitzer import lift sage: l = lift(Qp(13)(131)); l 131 sage: l.parent() Integer Ring - - sage: x=PowerSeriesRing(Qp(17),'x').gen() - sage: l = lift(4+5*x+17*x**6); l + sage: x = PowerSeriesRing(Qp(17),'x').gen() + sage: l = lift(4 + 5*x + 17*x**6); l 4 + 5*t + 17*t^6 sage: l.parent() Power Series Ring in t over Rational Field @@ -1298,7 +1303,7 @@ def frobenius_expansion_by_series(Q, p, M): sage: from sage.schemes.hyperelliptic_curves.monsky_washnitzer import frobenius_expansion_by_series sage: R. = Integers(5^3)['x'] sage: Q = x^3 - x + R(1/4) - sage: frobenius_expansion_by_series(Q,5,3) + sage: frobenius_expansion_by_series(Q,5,3) # needs sage.libs.pari ((25*T^5 + 75*T^3 + 100*T^2 + 100*T + 100) + (5*T^6 + 80*T^5 + 100*T^3 + 25*T + 50)*x + (55*T^5 + 50*T^4 + 75*T^3 + 25*T^2 + 25*T + 25)*x^2, (5*T^8 + 15*T^7 + 95*T^6 + 10*T^5 + 25*T^4 + 25*T^3 + 100*T^2 + 50) @@ -1494,6 +1499,7 @@ def matrix_of_frobenius(Q, p, M, trace=None, compute_exact_forms=False): Here is an example that is particularly badly conditioned for using the trace trick:: + sage: # needs sage.libs.pari sage: p = 11 sage: prec = 3 sage: M = monsky_washnitzer.adjusted_prec(p, prec) @@ -1521,56 +1527,55 @@ def matrix_of_frobenius(Q, p, M, trace=None, compute_exact_forms=False): factors), so it is feasible to run on fairly large primes, or precision (or both?!?!):: + sage: # long time, needs sage.libs.pari sage: p = 10007 sage: prec = 2 sage: M = monsky_washnitzer.adjusted_prec(p, prec) sage: R. = PolynomialRing(Integers(p**M)) - sage: A = monsky_washnitzer.matrix_of_frobenius( # long time - ....: x^3 - x + R(1/4), p, M) - sage: B = A.change_ring(Integers(p**prec)); B # long time + sage: A = monsky_washnitzer.matrix_of_frobenius(x^3 - x + R(1/4), p, M) + sage: B = A.change_ring(Integers(p**prec)); B [74311982 57996908] [95877067 25828133] - sage: B.det() # long time + sage: B.det() 10007 - sage: B.trace() # long time + sage: B.trace() 66 - sage: EllipticCurve([-1, 1/4]).ap(10007) # long time + sage: EllipticCurve([-1, 1/4]).ap(10007) 66 :: + sage: # long time, needs sage.libs.pari sage: p = 5 sage: prec = 300 sage: M = monsky_washnitzer.adjusted_prec(p, prec) sage: R. = PolynomialRing(Integers(p**M)) - sage: A = monsky_washnitzer.matrix_of_frobenius( # long time - ....: x^3 - x + R(1/4), p, M) - sage: B = A.change_ring(Integers(p**prec)) # long time - sage: B.det() # long time + sage: A = monsky_washnitzer.matrix_of_frobenius(x^3 - x + R(1/4), p, M) + sage: B = A.change_ring(Integers(p**prec)) + sage: B.det() 5 - sage: -B.trace() # long time + sage: -B.trace() 2 - sage: EllipticCurve([-1, 1/4]).ap(5) # long time + sage: EllipticCurve([-1, 1/4]).ap(5) -2 Let us check consistency of the results for a range of precisions:: + sage: # long time, needs sage.libs.pari sage: p = 5 sage: max_prec = 60 sage: M = monsky_washnitzer.adjusted_prec(p, max_prec) sage: R. = PolynomialRing(Integers(p**M)) - sage: A = monsky_washnitzer.matrix_of_frobenius(x^3 - x + R(1/4), p, M) # long time - sage: A = A.change_ring(Integers(p**max_prec)) # long time - sage: result = [] # long time - sage: for prec in range(1, max_prec): # long time + sage: A = monsky_washnitzer.matrix_of_frobenius(x^3 - x + R(1/4), p, M) + sage: A = A.change_ring(Integers(p**max_prec)) + sage: result = [] + sage: for prec in range(1, max_prec): ....: M = monsky_washnitzer.adjusted_prec(p, prec) ....: R. = PolynomialRing(Integers(p^M),'x') - ....: B = monsky_washnitzer.matrix_of_frobenius( - ....: x^3 - x + R(1/4), p, M) + ....: B = monsky_washnitzer.matrix_of_frobenius(x^3 - x + R(1/4), p, M) ....: B = B.change_ring(Integers(p**prec)) - ....: result.append(B == A.change_ring( - ....: Integers(p**prec))) - sage: result == [True] * (max_prec - 1) # long time + ....: result.append(B == A.change_ring(Integers(p**prec))) + sage: result == [True] * (max_prec - 1) True The remaining examples discuss what happens when you take the @@ -1581,6 +1586,7 @@ def matrix_of_frobenius(Q, p, M, trace=None, compute_exact_forms=False): :: + sage: # needs sage.libs.pari sage: p = 11 sage: prec = 3 sage: M = monsky_washnitzer.adjusted_prec(p, prec) @@ -1589,9 +1595,9 @@ def matrix_of_frobenius(Q, p, M, trace=None, compute_exact_forms=False): sage: b = 8 - 6*t + 17*t^2 sage: R. = PolynomialRing(S) sage: Q = x**3 + a*x + b - sage: A = monsky_washnitzer.matrix_of_frobenius(Q, p, M) # long time - sage: B = A.change_ring(PowerSeriesRing(Integers(p**prec), 't', default_prec=4)) # long time - sage: B # long time + sage: A = monsky_washnitzer.matrix_of_frobenius(Q, p, M) # long time + sage: B = A.change_ring(PowerSeriesRing(Integers(p**prec), 't', # long time + ....: default_prec=4)); B [1144 + 264*t + 841*t^2 + 1025*t^3 + O(t^4) 176 + 1052*t + 216*t^2 + 523*t^3 + O(t^4)] [ 847 + 668*t + 81*t^2 + 424*t^3 + O(t^4) 185 + 341*t + 171*t^2 + 642*t^3 + O(t^4)] @@ -1786,6 +1792,7 @@ def matrix_of_frobenius_hyperelliptic(Q, p=None, prec=None, M=None): EXAMPLES:: + sage: # needs sage.rings.padics sage: p = 5 sage: prec = 3 sage: R. = QQ['x'] @@ -1854,10 +1861,10 @@ class SpecialHyperellipticQuotientElement(CommutativeAlgebraElement): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-36*x+1) + sage: E = HyperellipticCurve(x^5 - 36*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: MW = x.parent() - sage: MW(x+x**2+y-77) + sage: MW(x + x**2 + y - 77) -(77-y)*1 + x + x^2 """ def __init__(self, parent, val=0, offset=0, check=True): @@ -1867,10 +1874,10 @@ def __init__(self, parent, val=0, offset=0, check=True): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-36*x+1) + sage: E = HyperellipticCurve(x^5 - 36*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: MW = x.parent() - sage: elt = MW(x+x**2+y-77) + sage: elt = MW(x + x**2 + y - 77) sage: TestSuite(elt).run() """ CommutativeAlgebraElement.__init__(self, parent) @@ -1896,7 +1903,7 @@ def _richcmp_(self, other, op): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-36*x+1) + sage: E = HyperellipticCurve(x^5 - 36*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x == x True @@ -1912,12 +1919,13 @@ def change_ring(self, R): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-36*x+1) + sage: E = HyperellipticCurve(x^5 - 36*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: MW = x.parent() - sage: z = MW(x+x**2+y-77) - sage: z.change_ring(AA).parent() - SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = x^5 - 36*x + 1) over Algebraic Real Field + sage: z = MW(x + x**2 + y - 77) + sage: z.change_ring(AA).parent() # needs sage.rings.number_field + SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = x^5 - 36*x + 1) + over Algebraic Real Field """ return self.parent().change_ring(R)(self) @@ -1928,10 +1936,10 @@ def __call__(self, *x): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-36*x+1) + sage: E = HyperellipticCurve(x^5 - 36*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: MW = x.parent() - sage: z = MW(x+x**2+y-77); z + sage: z = MW(x + x**2 + y - 77); z -(77-y)*1 + x + x^2 sage: z(66) 4345 + y @@ -1950,14 +1958,15 @@ def __invert__(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-36*x+1) + sage: E = HyperellipticCurve(x^5 - 36*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: MW = x.parent() - sage: z = y**(-1) # indirect doctest + sage: z = y**(-1) # indirect doctest sage: z.parent() - SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = x^5 - 36*x + 1) over Rational Field + SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = x^5 - 36*x + 1) + over Rational Field - sage: z = (x+y)**(-1) # indirect doctest + sage: z = (x+y)**(-1) # indirect doctest Traceback (most recent call last): ... ZeroDivisionError: element not invertible @@ -1975,7 +1984,7 @@ def __bool__(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: bool(x) True @@ -1989,7 +1998,7 @@ def __eq__(self, other): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x == y # indirect doctest False @@ -2005,9 +2014,9 @@ def _add_(self, other): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-36*x+1) + sage: E = HyperellipticCurve(x^5 - 36*x + 1) sage: x,y = E.monsky_washnitzer_gens() - sage: x+y + sage: x + y y*1 + x """ P = self.parent() @@ -2020,9 +2029,9 @@ def _sub_(self, other): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-36*x+1) + sage: E = HyperellipticCurve(x^5 - 36*x + 1) sage: x,y = E.monsky_washnitzer_gens() - sage: y-x + sage: y - x y*1 - x """ P = self.parent() @@ -2035,7 +2044,7 @@ def _mul_(self, other): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-36*x+1) + sage: E = HyperellipticCurve(x^5 - 36*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: y*x y*x @@ -2066,9 +2075,9 @@ def _rmul_(self, c): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() - sage: x._rmul_(y) + sage: x._rmul_(y) # needs sage.rings.real_interval_field y*1*x """ P = self.parent() @@ -2088,7 +2097,7 @@ def _lmul_(self, c): sage: R. = QQ['x'] sage: E = HyperellipticCurve(x^5-3*x+1) sage: x,y = E.monsky_washnitzer_gens() - sage: x._lmul_(y) + sage: x._lmul_(y) # needs sage.rings.real_interval_field y*1*x """ P = self.parent() @@ -2106,7 +2115,7 @@ def __lshift__(self, k): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.__lshift__(3) y^3*x @@ -2122,7 +2131,7 @@ def __rshift__(self, k): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: y.__rshift__(3) (y^-2)*1 @@ -2138,9 +2147,9 @@ def truncate_neg(self, n): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() - sage: (x+3*y+7*x*2*y**4).truncate_neg(1) + sage: (x + 3*y + 7*x*2*y**4).truncate_neg(1) 3*y*1 + 14*y^4*x """ coeffs = self._f.list(copy=False) @@ -2154,9 +2163,9 @@ def _repr_(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() - sage: (x+3*y)._repr_() + sage: (x + 3*y)._repr_() '3*y*1 + x' """ x = PolynomialRing(QQ, 'x').gen(0) @@ -2170,9 +2179,9 @@ def _latex_(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() - sage: (x+3*y)._latex_() + sage: (x + 3*y)._latex_() '3y 1 + x' """ x = PolynomialRing(QQ, 'x').gen(0) @@ -2186,9 +2195,9 @@ def diff(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() - sage: (x+3*y).diff() + sage: (x + 3*y).diff() (-(9-2*y)*1 + 15*x^4) dx/2y """ # try: @@ -2216,9 +2225,9 @@ def extract_pow_y(self, k): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() - sage: (x+3*y+9*x*y).extract_pow_y(1) + sage: (x + 3*y + 9*x*y).extract_pow_y(1) [3, 9, 0, 0, 0] """ v = [a[k] for a in self._f.list()] @@ -2232,9 +2241,9 @@ def min_pow_y(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() - sage: (x+3*y).min_pow_y() + sage: (x + 3*y).min_pow_y() 0 """ if self._f.degree() == -1: @@ -2248,9 +2257,9 @@ def max_pow_y(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() - sage: (x+3*y).max_pow_y() + sage: (x + 3*y).max_pow_y() 1 """ if self._f.degree() == -1: @@ -2276,7 +2285,7 @@ def coeffs(self, R=None): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.coeffs() ([(0, 1, 0, 0, 0)], 0) @@ -2287,7 +2296,7 @@ def coeffs(self, R=None): x + 2*x^2 + 3*x^3 + 4*x^4 sage: a.coeffs() ([(0, 1, 2, 3, 4)], 0) - sage: a.coeffs(Qp(7)) + sage: a.coeffs(Qp(7)) # needs sage.rings.padics ([(0, 1 + O(7^20), 2 + O(7^20), 3 + O(7^20), 4 + O(7^20))], 0) sage: (a*y).coeffs() ([(0, 0, 0, 0, 0), (0, 1, 2, 3, 4)], 0) @@ -2304,7 +2313,8 @@ def coeffs(self, R=None): sage: a = x^20*y^-3 - x^11*y^2; a (y^-3-4*y^-1+6*y-4*y^3+y^5)*1 - (12*y^-3-36*y^-1+36*y+y^2-12*y^3-2*y^4+y^6)*x - + (54*y^-3-108*y^-1+54*y+6*y^2-6*y^4)*x^2 - (108*y^-3-108*y^-1+9*y^2)*x^3 + (81*y^-3)*x^4 + + (54*y^-3-108*y^-1+54*y+6*y^2-6*y^4)*x^2 - (108*y^-3-108*y^-1+9*y^2)*x^3 + + (81*y^-3)*x^4 sage: raw, offset = a.coeffs() sage: a.min_pow_y() -3 @@ -2321,7 +2331,8 @@ def coeffs(self, R=None): (0, 2, -6, 0, 0), (1, 0, 0, 0, 0), (0, -1, 0, 0, 0)] - sage: sum(c * x^i * y^(j+offset) for j, L in enumerate(raw) for i, c in enumerate(L)) == a + sage: sum(c * x^i * y^(j+offset) + ....: for j, L in enumerate(raw) for i, c in enumerate(L)) == a True Can also be used to construct elements:: @@ -2360,10 +2371,10 @@ def __init__(self, Q, R=None, invert_y=True): TESTS:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: from sage.schemes.hyperelliptic_curves.monsky_washnitzer import SpecialHyperellipticQuotientRing sage: HQR = SpecialHyperellipticQuotientRing(E) - sage: TestSuite(HQR).run() + sage: TestSuite(HQR).run() # needs sage.rings.real_interval_field Check that caching works:: @@ -2441,7 +2452,7 @@ def _repr_(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.parent() # indirect doctest SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = x^5 - 3*x + 1) over Rational Field @@ -2456,10 +2467,11 @@ def base_extend(self, R): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() - sage: x.parent().base_extend(UniversalCyclotomicField()) - SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = x^5 - 3*x + 1) over Universal Cyclotomic Field + sage: x.parent().base_extend(UniversalCyclotomicField()) # needs sage.libs.gap + SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = x^5 - 3*x + 1) + over Universal Cyclotomic Field sage: x.parent().base_extend(ZZ) Traceback (most recent call last): ... @@ -2476,10 +2488,11 @@ def change_ring(self, R): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.parent().change_ring(ZZ) - SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = x^5 - 3*x + 1) over Integer Ring + SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = x^5 - 3*x + 1) + over Integer Ring """ return SpecialHyperellipticQuotientRing(self._Q.change_ring(R), R, is_LaurentSeriesRing(self._series_ring)) @@ -2491,7 +2504,7 @@ def _element_constructor_(self, val, offset=0, check=True): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.parent()(x^6) -(1-y^2)*x + 3*x^2 @@ -2513,7 +2526,7 @@ def one(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.parent().one() 1 @@ -2528,7 +2541,7 @@ def zero(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.parent().zero() 0 @@ -2542,7 +2555,7 @@ def gens(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.parent().gens() (x, y*1) @@ -2556,7 +2569,7 @@ def x(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.parent().x() x @@ -2570,7 +2583,7 @@ def y(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.parent().y() y*1 @@ -2584,7 +2597,7 @@ def monomial(self, i, j, b=None): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.parent().monomial(4,5) y^5*x^4 @@ -2623,7 +2636,7 @@ def monomial_diff_coeffs(self, i, j): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.parent().monomial_diff_coeffs(2,3) ((0, -15, 36, 0, 0), (0, 19, 0, 0, 0)) @@ -2656,7 +2669,7 @@ def monomial_diff_coeffs_matrices(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.parent().monomial_diff_coeffs_matrices() ( @@ -2684,7 +2697,7 @@ def _precompute_monomial_diffs(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.parent()._precompute_monomial_diffs() [((-3, 0, 0, 0, 5), (0, 0, 0, 0, 0), (0, 0, 0, 0, 0)), @@ -2725,7 +2738,7 @@ def curve(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.parent().curve() Hyperelliptic Curve over Rational Field defined by y^2 = x^5 - 3*x + 1 @@ -2739,7 +2752,7 @@ def degree(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.parent().degree() 5 @@ -2753,7 +2766,7 @@ def prime(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.parent().prime() is None True @@ -2767,7 +2780,7 @@ def monsky_washnitzer(self): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: type(x.parent().monsky_washnitzer()) @@ -2781,7 +2794,7 @@ def is_field(self, proof=True): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = E.monsky_washnitzer_gens() sage: x.parent().is_field() False @@ -2846,7 +2859,7 @@ def _add_(self, other): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x + 4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: x,y = C.monsky_washnitzer_gens() sage: w = C.invariant_differential() sage: w + w @@ -2867,7 +2880,7 @@ def _sub_(self, other): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: x,y = C.monsky_washnitzer_gens() sage: w = C.invariant_differential() sage: w-w @@ -2887,7 +2900,7 @@ def __neg__(self): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: x,y = C.monsky_washnitzer_gens() sage: w = C.invariant_differential() sage: -w @@ -2905,7 +2918,7 @@ def _lmul_(self, a): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: x,y = C.monsky_washnitzer_gens() sage: w = C.invariant_differential() sage: w*x @@ -2927,7 +2940,7 @@ def _rmul_(self, a): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: x,y = C.monsky_washnitzer_gens() sage: w = C.invariant_differential() sage: x*w @@ -2949,7 +2962,7 @@ def coeff(self): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: x,y = C.monsky_washnitzer_gens() sage: w = C.invariant_differential() sage: w @@ -2966,7 +2979,7 @@ def __bool__(self): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: x,y = C.monsky_washnitzer_gens() sage: w = C.invariant_differential() sage: not w @@ -2983,7 +2996,7 @@ def _repr_(self): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: x,y = C.monsky_washnitzer_gens() sage: w = C.invariant_differential() sage: w @@ -3003,7 +3016,7 @@ def _latex_(self): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: x,y = C.monsky_washnitzer_gens() sage: w = C.invariant_differential() sage: latex(w) @@ -3030,7 +3043,7 @@ def _richcmp_(self, other, op): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-3*x+1) + sage: C = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = C.monsky_washnitzer_gens() sage: (y^-1).diff() == (y^-1).diff() True @@ -3053,7 +3066,7 @@ def extract_pow_y(self, k): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-3*x+1) + sage: C = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = C.monsky_washnitzer_gens() sage: A = y^5 - x*y^3 sage: A.extract_pow_y(5) @@ -3070,7 +3083,7 @@ def min_pow_y(self): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-3*x+1) + sage: C = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = C.monsky_washnitzer_gens() sage: w = y^5 * C.invariant_differential() sage: w.min_pow_y() @@ -3088,7 +3101,7 @@ def max_pow_y(self): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-3*x+1) + sage: C = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = C.monsky_washnitzer_gens() sage: w = y^5 * C.invariant_differential() sage: w.max_pow_y() @@ -3106,7 +3119,7 @@ def reduce_neg_y(self): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-3*x+1) + sage: C = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = C.monsky_washnitzer_gens() sage: (y^-1).diff().reduce_neg_y() ((y^-1)*1, 0 dx/2y) @@ -3142,7 +3155,7 @@ def reduce_neg_y_fast(self, even_degree_only=False): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: x, y = E.monsky_washnitzer_gens() sage: (y^-1).diff().reduce_neg_y_fast() ((y^-1)*1, 0 dx/2y) @@ -3206,7 +3219,7 @@ def reduce_neg_y_faster(self, even_degree_only=False): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-3*x+1) + sage: C = HyperellipticCurve(x^5 - 3*x + 1) sage: x,y = C.monsky_washnitzer_gens() sage: (y^-1).diff().reduce_neg_y() ((y^-1)*1, 0 dx/2y) @@ -3301,7 +3314,7 @@ def reduce_pos_y_fast(self, even_degree_only=False): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^3-4*x+4) + sage: E = HyperellipticCurve(x^3 - 4*x + 4) sage: x, y = E.monsky_washnitzer_gens() sage: y.diff().reduce_pos_y_fast() (y*1, 0 dx/2y) @@ -3370,7 +3383,7 @@ def reduce(self): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: x,y = C.monsky_washnitzer_gens() sage: w = (y*x).diff() sage: w.reduce() @@ -3380,7 +3393,8 @@ def reduce(self): sage: w.reduce() (1/5*y*1, 4/5*1 dx/2y) - sage: w = sum(QQ.random_element() * x^i * y^j for i in [0..4] for j in [-3..3]) * C.invariant_differential() + sage: w = sum(QQ.random_element() * x^i * y^j + ....: for i in [0..4] for j in [-3..3]) * C.invariant_differential() sage: f, a = w.reduce() sage: f.diff() + a - w 0 dx/2y @@ -3409,7 +3423,7 @@ def reduce_fast(self, even_degree_only=False): EXAMPLES:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^3-4*x+4) + sage: E = HyperellipticCurve(x^3 - 4*x + 4) sage: x, y = E.monsky_washnitzer_gens() sage: x.diff().reduce_fast() (x, (0, 0)) @@ -3447,7 +3461,7 @@ def coeffs(self, R=None): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: x,y = C.monsky_washnitzer_gens() sage: w = C.invariant_differential() sage: w.coeffs() @@ -3506,11 +3520,11 @@ def __init__(self, base_ring): TESTS:: sage: R. = QQ['x'] - sage: E = HyperellipticCurve(x^5-3*x+1) + sage: E = HyperellipticCurve(x^5 - 3*x + 1) sage: from sage.schemes.hyperelliptic_curves.monsky_washnitzer import SpecialHyperellipticQuotientRing, MonskyWashnitzerDifferentialRing sage: S = SpecialHyperellipticQuotientRing(E) sage: DR = MonskyWashnitzerDifferentialRing(S) - sage: TestSuite(DR).run() + sage: TestSuite(DR).run() # needs sage.rings.real_interval_field Check that caching works:: @@ -3526,7 +3540,7 @@ def invariant_differential(self): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: MW = C.invariant_differential().parent() sage: MW.invariant_differential() 1 dx/2y @@ -3548,12 +3562,14 @@ def base_extend(self, R): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: MW = C.invariant_differential().parent() sage: MW.base_ring() - SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = x^5 - 4*x + 4) over Rational Field - sage: MW.base_extend(Qp(5,5)).base_ring() - SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = (1 + O(5^5))*x^5 + (1 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + O(5^5))*x + 4 + O(5^5)) + SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = x^5 - 4*x + 4) + over Rational Field + sage: MW.base_extend(Qp(5,5)).base_ring() # needs sage.rings.padics + SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = (1 + O(5^5))*x^5 + + (1 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + O(5^5))*x + 4 + O(5^5)) over 5-adic Field with capped relative precision 5 """ return MonskyWashnitzerDifferentialRing(self.base_ring().base_extend(R)) @@ -3574,12 +3590,14 @@ def change_ring(self, R): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: MW = C.invariant_differential().parent() sage: MW.base_ring() - SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = x^5 - 4*x + 4) over Rational Field - sage: MW.change_ring(Qp(5,5)).base_ring() - SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = (1 + O(5^5))*x^5 + (1 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + O(5^5))*x + 4 + O(5^5)) + SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = x^5 - 4*x + 4) + over Rational Field + sage: MW.change_ring(Qp(5,5)).base_ring() # needs sage.rings.padics + SpecialHyperellipticQuotientRing K[x,y,y^-1] / (y^2 = (1 + O(5^5))*x^5 + + (1 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + O(5^5))*x + 4 + O(5^5)) over 5-adic Field with capped relative precision 5 """ return MonskyWashnitzerDifferentialRing(self.base_ring().change_ring(R)) @@ -3592,7 +3610,7 @@ def degree(self): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: MW = C.invariant_differential().parent() sage: MW.Q() x^5 - 4*x + 4 @@ -3607,8 +3625,9 @@ def dimension(self): EXAMPLES:: + sage: # needs sage.rings.padics sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: K = Qp(7,5) sage: CK = C.change_ring(K) sage: MW = CK.invariant_differential().parent() @@ -3625,7 +3644,7 @@ def Q(self): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: MW = C.invariant_differential().parent() sage: MW.Q() x^5 - 4*x + 4 @@ -3641,7 +3660,7 @@ def x_to_p(self, p): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: MW = C.invariant_differential().parent() sage: MW.x_to_p(3) x^3 @@ -3661,11 +3680,11 @@ def frob_Q(self, p): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: MW = C.invariant_differential().parent() sage: MW.frob_Q(3) -(60-48*y^2+12*y^4-y^6)*1 + (192-96*y^2+12*y^4)*x - (192-48*y^2)*x^2 + 60*x^3 - sage: MW.Q()(MW.x_to_p(3)) + sage: MW.Q()(MW.x_to_p(3)) # needs sage.rings.real_interval_field -(60-48*y^2+12*y^4-y^6)*1 + (192-96*y^2+12*y^4)*x - (192-48*y^2)*x^2 + 60*x^3 sage: MW.frob_Q(11) is MW.frob_Q(11) True @@ -3696,11 +3715,11 @@ def frob_invariant_differential(self, prec, p): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: prec = 2 sage: p = 7 sage: MW = C.invariant_differential().parent() - sage: MW.frob_invariant_differential(prec,p) + sage: MW.frob_invariant_differential(prec, p) ((67894400*y^-20-81198880*y^-18+40140800*y^-16-10035200*y^-14+1254400*y^-12-62720*y^-10)*1 - (119503944*y^-20-116064242*y^-18+43753472*y^-16-7426048*y^-14+514304*y^-12-12544*y^-10+1568*y^-8-70*y^-6-7*y^-4)*x + (78905288*y^-20-61014016*y^-18+16859136*y^-16-2207744*y^-14+250880*y^-12-37632*y^-10+3136*y^-8-70*y^-6)*x^2 @@ -3766,11 +3785,11 @@ def frob_basis_elements(self, prec, p): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: prec = 1 sage: p = 5 sage: MW = C.invariant_differential().parent() - sage: MW.frob_basis_elements(prec,p) + sage: MW.frob_basis_elements(prec, p) [((92000*y^-14-74200*y^-12+32000*y^-10-8000*y^-8+1000*y^-6-50*y^-4)*1 - (194400*y^-14-153600*y^-12+57600*y^-10-9600*y^-8+600*y^-6)*x + (204800*y^-14-153600*y^-12+38400*y^-10-3200*y^-8)*x^2 @@ -3808,7 +3827,7 @@ def helper_matrix(self): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: MW = C.invariant_differential().parent() sage: MW.helper_matrix() [ 256/2101 320/2101 400/2101 500/2101 625/2101] @@ -3850,7 +3869,7 @@ def _element_constructor_(self, val=0, offset=0): EXAMPLES:: sage: R. = QQ['x'] - sage: C = HyperellipticCurve(x^5-4*x+4) + sage: C = HyperellipticCurve(x^5 - 4*x + 4) sage: MW = C.invariant_differential().parent() sage: MW(3) 3*1 dx/2y diff --git a/src/sage/schemes/plane_conics/con_field.py b/src/sage/schemes/plane_conics/con_field.py index 9794790e1ae..97bd54408ac 100644 --- a/src/sage/schemes/plane_conics/con_field.py +++ b/src/sage/schemes/plane_conics/con_field.py @@ -103,7 +103,7 @@ def base_extend(self, S): sage: c = Conic([1, 1, 1]); c Projective Conic Curve over Rational Field defined by x^2 + y^2 + z^2 - sage: c.has_rational_point() + sage: c.has_rational_point() # needs sage.libs.pari False sage: d = c.base_extend(QuadraticField(-1, 'i')); d # needs sage.rings.number_field Projective Conic Curve over Number Field in i @@ -142,7 +142,9 @@ def cache_point(self, p): (15/8 : 17/8 : 1) sage: c.rational_point() (15/8 : 17/8 : 1) - sage: c.cache_point(c.rational_point(read_cache = False)) + + sage: # needs sage.libs.pari + sage: c.cache_point(c.rational_point(read_cache=False)) sage: c.rational_point() (-1 : 1 : 0) """ @@ -270,10 +272,11 @@ def diagonal_matrix(self): :: - 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 + sage: # needs sage.rings.finite_rings + sage: c = Conic(GF(4, 'a'), [0, 1, 1, 1, 1, 1]) + sage: c.is_smooth() True - sage: c.diagonal_matrix() # needs sage.rings.finite_rings + sage: c.diagonal_matrix() Traceback (most recent call last): ... ValueError: The conic self (= Projective Conic Curve over Finite Field @@ -385,17 +388,16 @@ def gens(self): sage: P. = QQ[] sage: c = Conic(x^2 + y^2 + z^2) - sage: c.gens() + sage: c.gens() # needs sage.libs.singular (xbar, ybar, zbar) - sage: c.defining_polynomial()(c.gens()) + sage: c.defining_polynomial()(c.gens()) # needs sage.libs.singular 0 The function ``gens()`` is required for the following construction: :: - sage: C. = Conic(GF(3), [1, 1, 1]) - sage: C + sage: C. = Conic(GF(3), [1, 1, 1]); C # needs sage.libs.singular Projective Conic Curve over Finite Field of size 3 defined by a^2 + b^2 + c^2 @@ -439,8 +441,8 @@ def has_rational_point(self, point=False, Conics over polynomial rings can be solved internally:: sage: R. = QQ[] - sage: C = Conic([-2,t^2+1,t^2-1]) - sage: C.has_rational_point() + sage: C = Conic([-2, t^2 + 1, t^2 - 1]) + sage: C.has_rational_point() # needs sage.libs.pari True And they can also be solved with Magma:: @@ -450,7 +452,7 @@ def has_rational_point(self, point=False, sage: C.has_rational_point(algorithm='magma', point=True) # optional - magma (True, (-t : 1 : 1)) - sage: D = Conic([t,1,t^2]) + sage: D = Conic([t, 1, t^2]) sage: D.has_rational_point(algorithm='magma') # optional - magma False @@ -603,10 +605,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: C = Conic(P, [t,t,1]); C Projective Conic Curve over Fraction Field of Univariate Polynomial Ring - in t over Finite Field of size 2 (using GF2X) defined by t*x^2 + t*y^2 + z^2 - sage: C.has_singular_point(point=False) # needs sage.libs.ntl + in t over Finite Field of size 2... defined by t*x^2 + t*y^2 + z^2 + sage: C.has_singular_point(point=False) Traceback (most recent call last): ... NotImplementedError: Sorry, find singular point on conics not implemented @@ -656,7 +658,7 @@ def hom(self, x, Y=None): From: Projective Conic Curve over Rational Field defined by -x^2 + y^2 + z^2 To: Projective Conic Curve over Rational Field defined by -x^2 + 2*x*y + z^2 Defn: Defined on coordinates by sending (x : y : z) to (x + y : y : z) - sage: h([-1, 1, 0]) + sage: h([-1, 1, 0]) # needs sage.libs.singular (0 : 1 : 0) sage: c = Conic([-1, 1, 1]) @@ -667,7 +669,7 @@ def hom(self, x, Y=None): To: Projective Conic Curve over Rational Field defined by 4*x^2 + y^2 - z^2 Defn: Defined on coordinates by sending (x : y : z) to (1/2*z : y : x) - ``ValueError`` is raised if the wrong codomain ``Y`` is specified: + :class:`ValueError` is raised if the wrong codomain ``Y`` is specified: :: @@ -853,6 +855,7 @@ def parametrization(self, point=None, morphism=True): An example over a finite field :: + sage: # needs sage.libs.pari sage: c = Conic(GF(2), [1,1,1,1,1,0]) sage: f, g = c.parametrization(); f, g (Scheme morphism: @@ -870,7 +873,7 @@ def parametrization(self, point=None, morphism=True): Verfication of the example :: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.pari sage: h = g*f; h Scheme endomorphism of Projective Space of dimension 1 over Finite Field of size 2 @@ -892,7 +895,7 @@ def parametrization(self, point=None, morphism=True): The morphisms are mathematically defined in all points, but don't work completely in SageMath (see :trac:`31892`) :: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.pari sage: f, g = c.parametrization([0,0,1]) sage: g([0,1,1]) (1 : 0) @@ -905,6 +908,7 @@ def parametrization(self, point=None, morphism=True): An example with ``morphism = False`` :: + sage: # needs sage.libs.pari sage: R. = QQ[] sage: C = Curve(7*x^2 + 2*y*z + z^2) sage: (p, i) = C.parametrization(morphism=False); (p, i) @@ -914,8 +918,9 @@ def parametrization(self, point=None, morphism=True): sage: i[0](p) / i[1](p) x/y - A ``ValueError`` is raised if ``self`` has no rational point :: + A :class:`ValueError` is raised if ``self`` has no rational point :: + sage: # needs sage.libs.pari sage: C = Conic(x^2 + y^2 + 7*z^2) sage: C.parametrization() Traceback (most recent call last): @@ -923,8 +928,9 @@ def parametrization(self, point=None, morphism=True): ValueError: Conic Projective Conic Curve over Rational Field defined by x^2 + y^2 + 7*z^2 has no rational points over Rational Field! - A ``ValueError`` is raised if ``self`` is not smooth :: + A :class:`ValueError` is raised if ``self`` is not smooth :: + sage: # needs sage.libs.pari sage: C = Conic(x^2 + y^2) sage: C.parametrization() Traceback (most recent call last): @@ -983,7 +989,7 @@ def point(self, v, check=True): sage: c.rational_point() (15/8 : 17/8 : 1) sage: d = Conic([1, -1, 1]) - sage: d.rational_point() + sage: d.rational_point() # needs sage.libs.pari (-1 : 1 : 0) """ if is_Vector(v): @@ -1009,19 +1015,18 @@ def random_rational_point(self, *args1, **args2): are passed to ``random_element``. If the base field is a finite field, then the - output is uniformly distributed over the points of self. + output is uniformly distributed over the points of ``self``. EXAMPLES:: + sage: # needs sage.libs.pari sage: c = Conic(GF(2), [1,1,1,1,1,0]) 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)] - sage: d = Conic(QQ, [1, 1, -1]) sage: d.random_rational_point(den_bound=1, num_bound=5) # random (-24/25 : 7/25 : 1) - sage: Conic(QQ, [1, 1, 1]).random_rational_point() Traceback (most recent call last): ... @@ -1055,10 +1060,11 @@ def rational_point(self, algorithm='default', read_cache=True): Examples over `\QQ` :: sage: R. = QQ[] + + sage: # needs sage.libs.pari sage: C = Conic(7*x^2 + 2*y*z + z^2) sage: C.rational_point() (0 : 1 : 0) - sage: C = Conic(x^2 + 2*y^2 + z^2) sage: C.rational_point() Traceback (most recent call last): @@ -1090,7 +1096,7 @@ def rational_point(self, algorithm='default', read_cache=True): sage: D.rational_point(algorithm='rnfisnorm') # output is random # needs sage.rings.number_field (-3 : 4*i : 1) - sage: # needs sage.rings.number_field + sage: # needs sage.libs.pari sage.rings.number_field sage: L. = QuadraticField(2) sage: Conic(QQ, [1, 1, -3]).has_rational_point() False @@ -1117,7 +1123,7 @@ def rational_point(self, algorithm='default', read_cache=True): ....: read_cache=False) (-s : 1 : 1) - sage: # needs sage.rings.number_field + sage: # needs sage.libs.pari 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 @@ -1132,7 +1138,7 @@ def rational_point(self, algorithm='default', read_cache=True): 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) + sage: G.has_rational_point(read_cache=False) # needs sage.libs.pari False sage: G.has_rational_point(algorithm='local', ....: read_cache=False) @@ -1286,8 +1292,7 @@ def variable_names(self): :: - sage: C. = Conic(QQ, [1, 1, 1]) - sage: C + sage: C. = Conic(QQ, [1, 1, 1]); C # needs sage.libs.singular Projective Conic Curve over Rational Field defined by p^2 + q^2 + r^2 """ diff --git a/src/sage/schemes/plane_conics/con_rational_field.py b/src/sage/schemes/plane_conics/con_rational_field.py index 46de65132b5..6ecfb988562 100644 --- a/src/sage/schemes/plane_conics/con_rational_field.py +++ b/src/sage/schemes/plane_conics/con_rational_field.py @@ -115,6 +115,7 @@ def has_rational_point(self, point=False, obstruction=False, EXAMPLES:: + sage: # needs sage.libs.pari sage: C = Conic(QQ, [1, 2, -3]) sage: C.has_rational_point(point=True) (True, (1 : 1 : 1)) @@ -131,7 +132,7 @@ def has_rational_point(self, point=False, obstruction=False, ``algorithm = 'rnfisnorm'`` :: sage: C = Conic(QQ, [1, 113922743, -310146482690273725409]) - sage: C.has_rational_point(point=True) + sage: C.has_rational_point(point=True) # needs sage.libs.pari (True, (-76842858034579/5424 : -5316144401/5424 : 1)) sage: C.has_rational_point(algorithm='local', read_cache=False) True @@ -144,10 +145,11 @@ def has_rational_point(self, point=False, obstruction=False, Create a bunch of conics over `\QQ`, check if ``has_rational_point`` runs without errors and returns consistent answers for all algorithms. Check if all points returned are valid. :: + sage: # needs sage.libs.pari sage: l = Sequence(cartesian_product_iterator([[-1, 0, 1] for i in range(6)])) sage: c = [Conic(QQ, a) for a in l if a != [0,0,0] and a != (0,0,0,0,0,0)] sage: d = [] - sage: d = [[C] + [C.has_rational_point(algorithm=algorithm, read_cache=False, # long time: 7 seconds + sage: d = [[C] + [C.has_rational_point(algorithm=algorithm, read_cache=False, # long time (7 s) ....: obstruction=(algorithm != 'rnfisnorm'), ....: point=(algorithm != 'local')) ....: for algorithm in ['local', 'qfsolve', 'rnfisnorm']] @@ -214,6 +216,7 @@ def is_locally_solvable(self, p) -> bool: EXAMPLES:: + sage: # needs sage.libs.pari sage: C = Conic(QQ, [1,2,3]) sage: C.is_locally_solvable(-1) False @@ -272,6 +275,7 @@ def local_obstructions(self, finite=True, infinite=True, read_cache=True): EXAMPLES:: + sage: # needs sage.libs.pari sage: Conic(QQ, [1, 1, 1]).local_obstructions() [2, -1] sage: Conic(QQ, [1, 2, -3]).local_obstructions() @@ -330,6 +334,7 @@ def parametrization(self, point=None, morphism=True): EXAMPLES:: + sage: # needs sage.libs.pari sage: c = Conic([1,1,-1]) sage: c.parametrization() (Scheme morphism: @@ -345,6 +350,7 @@ def parametrization(self, point=None, morphism=True): An example with ``morphism = False`` :: + sage: # needs sage.libs.pari sage: R. = QQ[] sage: C = Curve(7*x^2 + 2*y*z + z^2) sage: (p, i) = C.parametrization(morphism=False); (p, i) @@ -354,8 +360,9 @@ def parametrization(self, point=None, morphism=True): sage: i[0](p) / i[1](p) x/y - A ``ValueError`` is raised if ``self`` has no rational point :: + A :class:`ValueError` is raised if ``self`` has no rational point :: + sage: # needs sage.libs.pari sage: C = Conic(x^2 + 2*y^2 + z^2) sage: C.parametrization() Traceback (most recent call last): @@ -363,8 +370,9 @@ def parametrization(self, point=None, morphism=True): ValueError: Conic Projective Conic Curve over Rational Field defined by x^2 + 2*y^2 + z^2 has no rational points over Rational Field! - A ``ValueError`` is raised if ``self`` is not smooth :: + A :class:`ValueError` is raised if ``self`` is not smooth :: + sage: # needs sage.libs.pari sage: C = Conic(x^2 + y^2) sage: C.parametrization() Traceback (most recent call last): 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 1b3f0ac412a..05d24e78a85 100644 --- a/src/sage/schemes/plane_conics/con_rational_function_field.py +++ b/src/sage/schemes/plane_conics/con_rational_function_field.py @@ -25,7 +25,7 @@ sage: K. = FractionField(QQ['t']) sage: C = Conic([1, -t, t]) - sage: C.has_rational_point(point=True) + sage: C.has_rational_point(point=True) # needs sage.libs.singular (True, (0 : 1 : 1)) """ @@ -128,37 +128,37 @@ def has_rational_point(self, point=False, algorithm='default', sage: K. = FractionField(PolynomialRing(QQ, 't')) sage: C = Conic(K, [t^2 - 2, 2*t^3, -2*t^3 - 13*t^2 - 2*t + 18]) - sage: C.has_rational_point(point=True) + sage: C.has_rational_point(point=True) # needs sage.libs.singular (True, (-3 : (t + 1)/t : 1)) sage: R. = FiniteField(23)[] sage: C = Conic([2, t^2 + 1, t^2 + 5]) - sage: C.has_rational_point() + sage: C.has_rational_point() # needs sage.libs.singular True - sage: C.has_rational_point(point=True) + sage: C.has_rational_point(point=True) # needs sage.libs.singular (True, (5*t : 8 : 1)) 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) + sage: C.has_rational_point(point=True) # needs sage.libs.singular (True, (-t - 2*i : -2*i : 1)) It works on non-diagonal conics as well:: sage: K. = QQ[] sage: C = Conic([4, -4, 8, 1, -4, t + 4]) - sage: C.has_rational_point(point=True) + sage: C.has_rational_point(point=True) # needs sage.libs.singular (True, (1/2 : 1 : 0)) If no point exists output still depends on the argument ``point``:: sage: K. = QQ[] sage: C = Conic(K, [t^2, (t-1), -2*(t-1)]) - sage: C.has_rational_point() + sage: C.has_rational_point() # needs sage.libs.singular False - sage: C.has_rational_point(point=True) + sage: C.has_rational_point(point=True) # needs sage.libs.singular (False, None) Due to limitations in Sage of algorithms we depend on, it is not @@ -171,7 +171,7 @@ def has_rational_point(self, point=False, algorithm='default', sage: b = 2*t2^2 + 2*t1*t2 - t1^2 sage: c = -3*t2^4 - 4*t1*t2^3 + 8*t1^2*t2^2 + 16*t1^3 - t2 - 48*t1^4 sage: C = Conic([a,b,c]) - sage: C.has_rational_point() + sage: C.has_rational_point() # needs sage.libs.singular Traceback (most recent call last): ... NotImplementedError: is_square() not implemented for elements of @@ -204,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() + sage: C.has_rational_point() # needs sage.libs.singular Traceback (most recent call last): ... TypeError: self (=Scheme morphism: @@ -237,7 +237,7 @@ def has_rational_point(self, point=False, algorithm='default', sage: b = (1/2*t^2 + 1/3)/(-73*t^2 - 2*t + 11/4) sage: c = (6934/3*t^6 + 8798/3*t^5 - 947/18*t^4 + 3949/9*t^3 + 20983/18*t^2 + 28/3*t - 131/3)/(-2701/3*t^4 - 293/3*t^3 + 301/6*t^2 + 13/4*t - 11/16) sage: C = Conic([a,b,c]) - sage: C.has_rational_point(point=True) + sage: C.has_rational_point(point=True) # needs sage.libs.singular (True, (4*t + 4 : 2*t + 2 : 1)) A long time test:: @@ -247,7 +247,7 @@ def has_rational_point(self, point=False, algorithm='default', sage: b = (-3*t^3 + 8*t + 1/2)/(-1/3*t^3 + 3/2*t^2 + 1/12*t + 1/2) sage: c = (1232009/225*t^25 - 1015925057/8100*t^24 + 1035477411553/1458000*t^23 + 7901338091/30375*t^22 - 1421379260447/729000*t^21 + 266121260843/972000*t^20 + 80808723191/486000*t^19 - 516656082523/972000*t^18 + 21521589529/40500*t^17 + 4654758997/21600*t^16 - 20064038625227/9720000*t^15 - 173054270347/324000*t^14 + 536200870559/540000*t^13 - 12710739349/50625*t^12 - 197968226971/135000*t^11 - 134122025657/810000*t^10 + 22685316301/120000*t^9 - 2230847689/21600*t^8 - 70624099679/270000*t^7 - 4298763061/270000*t^6 - 41239/216000*t^5 - 13523/36000*t^4 + 493/36000*t^3 + 83/2400*t^2 + 1/300*t + 1/200)/(-27378/125*t^17 + 504387/500*t^16 - 97911/2000*t^15 + 1023531/4000*t^14 + 1874841/8000*t^13 + 865381/12000*t^12 + 15287/375*t^11 + 6039821/6000*t^10 + 599437/1500*t^9 + 18659/250*t^8 + 1218059/6000*t^7 + 2025127/3000*t^6 + 1222759/6000*t^5 + 38573/200*t^4 + 8323/125*t^3 + 15453/125*t^2 + 17031/500*t + 441/10) sage: C = Conic([a,b,c]) - sage: C.has_rational_point(point = True) # long time (4 seconds) + sage: C.has_rational_point(point=True) # long time (4 seconds) # needs sage.libs.singular (True, ((-2/117*t^8 + 304/1053*t^7 + 40/117*t^6 - 1/27*t^5 - 110/351*t^4 - 2/195*t^3 + 11/351*t^2 + 1/117)/(t^4 + 2/39*t^3 + 4/117*t^2 + 2/39*t + 14/39) : -5/3*t^4 + 19*t^3 : 1)) """ @@ -475,7 +475,7 @@ def find_point(self, supports, roots, case, solution=0): sage: K. = FractionField(QQ['t']) sage: C = Conic(K, [t^2 - 2, 2*t^3, -2*t^3 - 13*t^2 - 2*t + 18]) - sage: C.has_rational_point(point=True) # indirect test + sage: C.has_rational_point(point=True) # indirect test # needs sage.libs.singular (True, (-3 : (t + 1)/t : 1)) Different solubility certificates give different points:: diff --git a/src/sage/schemes/product_projective/point.py b/src/sage/schemes/product_projective/point.py index d51d5d369bf..b9430804695 100644 --- a/src/sage/schemes/product_projective/point.py +++ b/src/sage/schemes/product_projective/point.py @@ -339,7 +339,7 @@ def dehomogenize(self, L): :: - sage: # needs sage.rings.real_mpfr + sage: # needs sage.rings.real_mpfr sage.symbolic 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]) diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 4396f4c7765..b3fd2aae646 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -2310,7 +2310,7 @@ def __call__(self, x): TESTS:: - sage: # needs sage.schemes + sage: # needs sage.libs.pari sage.schemes sage: R. = QQ[] sage: C = Curve(7*x^2 + 2*y*z + z^2) sage: f, g = C.parametrization() @@ -2340,10 +2340,11 @@ def __eq__(self, other): """ EXAMPLES:: + sage: # needs sage.libs.pari sage.schemes sage: R. = QQ[] - 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 + sage: C = Curve(7*x^2 + 2*y*z + z^2) # conic + sage: f, g = C.parametrization() + sage: f*g == C.identity_morphism() True sage: # needs sage.schemes diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index ecb34f8230a..79377dfcada 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -2247,7 +2247,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) # needs sage.schemes + sage: P3.line_through(p1, p2) # needs sage.libs.singular 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 diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index 9a465b36ea4..b571d25e932 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -548,7 +548,7 @@ def nth_iterate(self, f, n): sage: P. = ProjectiveSpace(QQ, 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 + sage: f.nth_iterate(P.subscheme([x - w, y - z]), 3) # needs sage.libs.singular sage.schemes Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: y - z, @@ -559,7 +559,7 @@ def nth_iterate(self, f, n): sage: PS. = ProjectiveSpace(ZZ, 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) # needs sage.schemes + sage: X.nth_iterate(f, -2) # needs sage.libs.singular sage.schemes Traceback (most recent call last): ... TypeError: must be a forward orbit From d962ea518d4f60f7e38f716defcaa907172cb5bb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 5 Sep 2023 17:06:17 -0700 Subject: [PATCH 06/32] src/sage/schemes/hyperelliptic_curves/hypellfrob.pyx: Docstring cosmetics, add # needs --- .../schemes/hyperelliptic_curves/hypellfrob.pyx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/sage/schemes/hyperelliptic_curves/hypellfrob.pyx b/src/sage/schemes/hyperelliptic_curves/hypellfrob.pyx index 50730d1081f..b4144780c1d 100644 --- a/src/sage/schemes/hyperelliptic_curves/hypellfrob.pyx +++ b/src/sage/schemes/hyperelliptic_curves/hypellfrob.pyx @@ -6,6 +6,7 @@ # distutils: extra_compile_args = NTL_CFLAGS # distutils: library_dirs = NTL_LIBDIR # distutils: extra_link_args = NTL_LIBEXTRA +# sage.doctest: needs sage.libs.ntl sage.modules sage.rings.padics r""" Frobenius on Monsky-Washnitzer cohomology of a hyperelliptic curve over a @@ -75,8 +76,8 @@ def interval_products(M0, M1, target): INPUT: - - M0, M1 -- matrices over `\ZZ/N\ZZ`, so that `M = M0 + M1*x` - - target -- a list of integers + - ``M0``, ``M1`` -- matrices over `\ZZ/N\ZZ`, so that `M = M0 + M1*x` + - ``target`` -- a list of integers ALGORITHM: @@ -173,10 +174,10 @@ def hypellfrob(p, N, Q): INPUT: - - p -- a prime - - Q -- a monic polynomial in `\ZZ[x]` of odd degree. - Must have no multiple roots mod p. - - N -- precision parameter; the output matrix will be correct modulo `p^N`. + - ``p`` -- a prime + - ``Q`` -- a monic polynomial in `\ZZ[x]` of odd degree. + Must have no multiple roots mod `p`. + - ``N`` -- precision parameter; the output matrix will be correct modulo `p^N`. PRECONDITIONS: From 420ca2b3b48ff4adf14afc5c77d1733ae173fe0e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 8 Sep 2023 22:55:40 -0700 Subject: [PATCH 07/32] sage.schemes.projective: Add # needs --- .../schemes/projective/projective_morphism.py | 3 ++- .../schemes/projective/projective_subscheme.py | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index b3fd2aae646..bd110b059ed 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -2340,8 +2340,9 @@ def __eq__(self, other): """ EXAMPLES:: - sage: # needs sage.libs.pari sage.schemes sage: R. = QQ[] + + sage: # needs sage.libs.pari sage.schemes sage: C = Curve(7*x^2 + 2*y*z + z^2) # conic sage: f, g = C.parametrization() sage: f*g == C.identity_morphism() diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index b571d25e932..6370bef6ad2 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -469,10 +469,11 @@ def orbit(self, f, N): EXAMPLES:: + sage: # needs sage.libs.singular sage.schemes sage: P. = ProjectiveSpace(QQ, 3) - sage: f = DynamicalSystem_projective([(x-2*y)^2, (x-2*z)^2, # needs sage.schemes + 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) # needs sage.schemes + sage: f.orbit(P.subscheme([x]), 5) [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 @@ -1039,9 +1040,10 @@ def degree(self): sage: X.degree() # needs sage.libs.singular 3 + sage: # needs sage.libs.singular sage.schemes 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]) # needs sage.schemes - sage: C.degree() # needs sage.libs.singular sage.schemes + 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() 63 """ P = self.defining_ideal().hilbert_polynomial() @@ -1157,10 +1159,11 @@ def multiplicity(self, P): :: + sage: # needs sage.libs.singular sage.schemes sage: P. = ProjectiveSpace(GF(29), 3) - sage: C = Curve([y^17 - x^5*w^4*z^8, x*y - z^2], P) # needs sage.schemes + sage: C = Curve([y^17 - x^5*w^4*z^8, x*y - z^2], P) sage: Q = P([3,0,0,1]) - sage: C.multiplicity(Q) # needs sage.libs.singular sage.schemes + sage: C.multiplicity(Q) 8 """ if self.base_ring() not in Fields(): From 1391f9163fdd5181932be200c5b3add0e1da5f63 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 14 May 2023 10:51:37 -0700 Subject: [PATCH 08/32] sage.dynamics: Doctest cosmetics --- .../arithmetic_dynamics/berkovich_ds.py | 90 +++++----- .../endPN_automorphism_group.py | 96 +++++------ .../endPN_minimal_model.py | 35 ++-- .../arithmetic_dynamics/generic_ds.py | 80 ++++----- .../product_projective_ds.py | 33 ++-- .../arithmetic_dynamics/projective_ds.py | 8 +- .../dynamics/arithmetic_dynamics/wehlerK3.py | 162 ++++++++++-------- 7 files changed, 263 insertions(+), 241 deletions(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py index de956719603..19bc1fbc5e6 100644 --- a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py @@ -71,15 +71,18 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet sage: P. = ProjectiveSpace(Qp(3), 1) sage: f = DynamicalSystem_projective([2*x^2 + 4*y^2, 3*x^2 + 9*y^2]) sage: DynamicalSystem_Berkovich(f) - Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map + Dynamical system of Projective Berkovich line over Cp(3) of precision 20 + induced by the map Defn: Defined on coordinates by sending (x : y) to - ((2 + O(3^20))*x^2 + (1 + 3 + O(3^20))*y^2 : (3 + O(3^21))*x^2 + (3^2 + O(3^22))*y^2) + ((2 + O(3^20))*x^2 + (1 + 3 + O(3^20))*y^2 + : (3 + O(3^21))*x^2 + (3^2 + O(3^22))*y^2) Or directly from polynomials:: sage: P. = ProjectiveSpace(Qp(3),1) sage: DynamicalSystem_Berkovich([x^2 + y^2, y^2]) - Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map + Dynamical system of Projective Berkovich line over Cp(3) of precision 20 + induced by the map Defn: Defined on coordinates by sending (x : y) to (x^2 + y^2 : y^2) @@ -87,7 +90,8 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet sage: R. = Qp(3)[] sage: DynamicalSystem_Berkovich([x^2, y^2]) - Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map + Dynamical system of Projective Berkovich line over Cp(3) of precision 20 + induced by the map Defn: Defined on coordinates by sending (x : y) to (x^2 : y^2) @@ -358,9 +362,9 @@ def as_scheme_dynamical_system(self): sage: P. = ProjectiveSpace(Qp(3), 1) sage: f = DynamicalSystem_Berkovich([x^2 + y^2, x*y]) sage: f.as_scheme_dynamical_system() - Dynamical System of Projective Space of dimension 1 over 3-adic Field with capped relative precision 20 - Defn: Defined on coordinates by sending (x : y) to - (x^2 + y^2 : x*y) + Dynamical System of Projective Space of dimension 1 over + 3-adic Field with capped relative precision 20 + Defn: Defined on coordinates by sending (x : y) to (x^2 + y^2 : x*y) """ return self._system @@ -399,7 +403,7 @@ def defining_polynomials(self): sage: g = DynamicalSystem_Berkovich(f) sage: g.defining_polynomials() ((2 + O(3^20))*x^2 + (1 + 3 + O(3^20))*y^2, - (3 + O(3^21))*x^2 + (3^2 + O(3^22))*y^2) + (3 + O(3^21))*x^2 + (3^2 + O(3^22))*y^2) """ return self._system._polys @@ -488,18 +492,16 @@ class DynamicalSystem_Berkovich_projective(DynamicalSystem_Berkovich): sage: H = End(P1) sage: DynamicalSystem_Berkovich(H([y, x])) Dynamical system of Projective Berkovich line over Cp(3) of precision 20 - induced by the map - Defn: Defined on coordinates by sending (x : y) to - (y : x) + induced by the map + Defn: Defined on coordinates by sending (x : y) to (y : x) Or from polynomials:: sage: P. = ProjectiveSpace(Qp(3), 1) sage: DynamicalSystem_Berkovich([x^2+y^2, y^2]) Dynamical system of Projective Berkovich line over Cp(3) of precision 20 - induced by the map - Defn: Defined on coordinates by sending (x : y) to - (x^2 + y^2 : y^2) + induced by the map + Defn: Defined on coordinates by sending (x : y) to (x^2 + y^2 : y^2) """ @staticmethod def __classcall_private__(cls, dynamical_system, domain=None): @@ -512,9 +514,8 @@ def __classcall_private__(cls, dynamical_system, domain=None): sage: from sage.dynamics.arithmetic_dynamics.berkovich_ds import DynamicalSystem_Berkovich_projective sage: DynamicalSystem_Berkovich_projective([y, x]) Dynamical system of Projective Berkovich line over Cp(3) of precision 20 - induced by the map - Defn: Defined on coordinates by sending (x : y) to - (y : x) + induced by the map + Defn: Defined on coordinates by sending (x : y) to (y : x) """ if not isinstance(dynamical_system, DynamicalSystem): if not isinstance(dynamical_system, DynamicalSystem_projective): @@ -549,7 +550,8 @@ def __init__(self, dynamical_system, domain=None): sage: P. = ProjectiveSpace(Qp(3), 1) sage: DynamicalSystem_Berkovich([x^2 + x*y + 2*y^2, 2*x*y]) - Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map + Dynamical system of Projective Berkovich line over Cp(3) of precision 20 + induced by the map Defn: Defined on coordinates by sending (x : y) to (x^2 + x*y + (2 + O(3^20))*y^2 : (2 + O(3^20))*x*y) """ @@ -570,9 +572,9 @@ def scale_by(self, t): sage: P. = ProjectiveSpace(Qp(3), 1) sage: f = DynamicalSystem_Berkovich([x^2, y^2]) sage: f.scale_by(x); f - Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map - Defn: Defined on coordinates by sending (x : y) to - (x^3 : x*y^2) + Dynamical system of Projective Berkovich line over Cp(3) of precision 20 + induced by the map + Defn: Defined on coordinates by sending (x : y) to (x^3 : x*y^2) :: @@ -601,9 +603,9 @@ def normalize_coordinates(self): sage: P. = ProjectiveSpace(Qp(3), 1) sage: f = DynamicalSystem_Berkovich([2*x^2, 2*y^2]) sage: f.normalize_coordinates(); f - Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map - Defn: Defined on coordinates by sending (x : y) to - (x^2 : y^2) + Dynamical system of Projective Berkovich line over Cp(3) of precision 20 + induced by the map + Defn: Defined on coordinates by sending (x : y) to (x^2 : y^2) Normalize_coordinates may sometimes fail over p-adic fields:: @@ -621,9 +623,9 @@ def normalize_coordinates(self): sage: B = Berkovich_Cp_Projective(P, 3) sage: g = DynamicalSystem_Berkovich([2*x^2, x*y], B) sage: g.normalize_coordinates(); g - Dynamical system of Projective Berkovich line over Cp(3), with base Rational Field induced by the map - Defn: Defined on coordinates by sending (x : y) to - (2*x : y) + Dynamical system of Projective Berkovich line over Cp(3), with base Rational Field + induced by the map + Defn: Defined on coordinates by sending (x : y) to (2*x : y) """ self._system.normalize_coordinates() @@ -655,7 +657,8 @@ def conjugate(self, M, adjugate=False, new_ideal=None): sage: f = DynamicalSystem_projective([x^2 + y^2, 2*y^2]) sage: g = DynamicalSystem_Berkovich(f) sage: g.conjugate(Matrix([[1, 1], [0, 1]])) - Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map + Dynamical system of Projective Berkovich line over Cp(3) of precision 20 + induced by the map Defn: Defined on coordinates by sending (x : y) to (x^2 + (2 + O(3^20))*x*y : (2 + O(3^20))*y^2) @@ -748,7 +751,8 @@ def dehomogenize(self, n): sage: f = DynamicalSystem_projective([x^2 + y^2, x*y + y^2]) sage: g = DynamicalSystem_Berkovich(f) sage: g.dehomogenize(1) - Dynamical system of Affine Berkovich line over Cp(3) of precision 20 induced by the map + Dynamical system of Affine Berkovich line over Cp(3) of precision 20 + induced by the map Defn: Defined on coordinates by sending (x) to ((x^2 + 1 + O(3^20))/(x + 1 + O(3^20))) """ @@ -766,8 +770,8 @@ def __call__(self, x, type_3_pole_check=True): - ``x`` -- a point of projective Berkovich space over ``Cp``. - - type_3_pole_check -- (default ``True``) A bool. WARNING: - changing the value of type_3_pole_check can lead to mathematically + - ``type_3_pole_check`` -- (default ``True``) A bool. WARNING: + changing the value of ``type_3_pole_check`` can lead to mathematically incorrect answers. Only set to ``False`` if there are NO poles of the dynamical system in the disk corresponding to the type III point ``x``. See Examples. @@ -969,8 +973,7 @@ class DynamicalSystem_Berkovich_affine(DynamicalSystem_Berkovich): sage: f = DynamicalSystem_affine([(x^2 + 1)/x]) sage: DynamicalSystem_Berkovich(f) Dynamical system of Affine Berkovich line over Cp(5) of precision 20 induced by the map - Defn: Defined on coordinates by sending (x) to - ((x^2 + 1 + O(5^20))/x) + Defn: Defined on coordinates by sending (x) to ((x^2 + 1 + O(5^20))/x) Dynamical system can be created from a morphism:: @@ -978,8 +981,7 @@ class DynamicalSystem_Berkovich_affine(DynamicalSystem_Berkovich): sage: phi = H([x + 3]) sage: DynamicalSystem_Berkovich(phi) Dynamical system of Affine Berkovich line over Cp(5) of precision 20 induced by the map - Defn: Defined on coordinates by sending (x) to - (x + 3 + O(5^20)) + Defn: Defined on coordinates by sending (x) to (x + 3 + O(5^20)) """ @staticmethod def __classcall_private__(cls, dynamical_system, domain=None): @@ -991,9 +993,9 @@ def __classcall_private__(cls, dynamical_system, domain=None): sage: A. = AffineSpace(Qp(3), 1) sage: from sage.dynamics.arithmetic_dynamics.berkovich_ds import DynamicalSystem_Berkovich_affine sage: DynamicalSystem_Berkovich_affine(DynamicalSystem_affine(x^2)) - Dynamical system of Affine Berkovich line over Cp(3) of precision 20 induced by the map - Defn: Defined on coordinates by sending (x) to - (x^2) + Dynamical system of Affine Berkovich line over Cp(3) of precision 20 + induced by the map + Defn: Defined on coordinates by sending (x) to (x^2) """ if not isinstance(dynamical_system, DynamicalSystem): if not isinstance(dynamical_system, DynamicalSystem_affine): @@ -1025,9 +1027,9 @@ def __init__(self, dynamical_system, domain): sage: A. = AffineSpace(Qp(3), 1) sage: from sage.dynamics.arithmetic_dynamics.berkovich_ds import DynamicalSystem_Berkovich_affine sage: DynamicalSystem_Berkovich_affine(DynamicalSystem_affine(x^3)) - Dynamical system of Affine Berkovich line over Cp(3) of precision 20 induced by the map - Defn: Defined on coordinates by sending (x) to - (x^3) + Dynamical system of Affine Berkovich line over Cp(3) of precision 20 + induced by the map + Defn: Defined on coordinates by sending (x) to (x^3) """ DynamicalSystem_Berkovich.__init__(self, dynamical_system, domain) @@ -1052,9 +1054,9 @@ def homogenize(self, n): sage: f = DynamicalSystem_affine(1/x) sage: f = DynamicalSystem_Berkovich(f) sage: f.homogenize(1) - Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map - Defn: Defined on coordinates by sending (x0 : x1) to - (x1 : x0) + Dynamical system of Projective Berkovich line over Cp(3) of precision 20 + induced by the map + Defn: Defined on coordinates by sending (x0 : x1) to (x1 : x0) """ new_system = self._system.homogenize(n) ideal = self.domain().ideal() diff --git a/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py b/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py index e8e5ddba1c4..32ccb2a9a7b 100644 --- a/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py +++ b/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py @@ -43,24 +43,23 @@ def automorphism_group_QQ_fixedpoints(rational_function, return_functions=False, iso_type=False): r""" - - This function will compute the automorphism group for ``rational_function`` via the method of fixed points + Compute the automorphism group for ``rational_function`` via the method of fixed points ALGORITHM: - See Algorithm 3 in Faber-Manes-Viray [FMV]_. + See Algorithm 3 in Faber-Manes-Viray [FMV]_. INPUT: - - ``rational_function`` - Rational Function defined over `\ZZ` or `\QQ` + - ``rational_function`` -- Rational Function defined over `\ZZ` or `\QQ` - - ``return_functions`` - Boolean Value, True will return elements in the automorphism group - as linear fractional transformations. False will return elements as `PGL2` matrices + - ``return_functions`` -- Boolean value; ``True`` will return elements in the automorphism group + as linear fractional transformations. ``False`` will return elements as `PGL_2` matrices - - ``iso_type`` - Boolean - True will cause the classification of the finite automorphism + - ``iso_type`` -- Boolean; ``True`` will cause the classification of the finite automorphism group to also be returned - OUTPUT: a list of automorphisms that make up the Automorphism Group + OUTPUT: a list of automorphisms that make up the automorphism group of ``rational_function`` EXAMPLES:: @@ -69,7 +68,7 @@ def automorphism_group_QQ_fixedpoints(rational_function, return_functions=False, sage: rational_function = (z^2 - 2*z - 2)/(-2*z^2 - 2*z + 1) sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import automorphism_group_QQ_fixedpoints sage: automorphism_group_QQ_fixedpoints(rational_function, True) - [z, 1/z, -z - 1, -z/(z + 1), (-z - 1)/z, -1/(z + 1)] + [z, 1/z, -z - 1, -z/(z + 1), (-z - 1)/z, -1/(z + 1)] :: @@ -77,18 +76,18 @@ def automorphism_group_QQ_fixedpoints(rational_function, return_functions=False, sage: rational_function = (z^2 + 2*z)/(-2*z - 1) sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import automorphism_group_QQ_fixedpoints sage: automorphism_group_QQ_fixedpoints(rational_function) - [ + [ [1 0] [-1 -1] [-2 0] [0 2] [-1 -1] [ 0 -1] [0 1], [ 0 1], [ 2 2], [2 0], [ 1 0], [ 1 1] - ] + ] :: sage: F. = PolynomialRing(QQ) - sage: rational_function = (z^2 - 4*z -3)/(-3*z^2 - 2*z + 2) + sage: rational_function = (z^2 - 4*z - 3)/(-3*z^2 - 2*z + 2) sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import automorphism_group_QQ_fixedpoints sage: automorphism_group_QQ_fixedpoints(rational_function, True, True) - ([z, (-z - 1)/z, -1/(z + 1)], 'Cyclic of order 3') + ([z, (-z - 1)/z, -1/(z + 1)], 'Cyclic of order 3') """ if rational_function.parent().is_field(): @@ -304,7 +303,7 @@ def height_bound(polynomial): EXAMPLES:: sage: R. = PolynomialRing(QQ) - sage: f = (z^3+2*z+6) + sage: f = z^3 + 2*z + 6 sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import height_bound sage: height_bound(f) 413526 @@ -345,7 +344,7 @@ def PGL_repn(rational_function): EXAMPLES:: sage: R. = PolynomialRing(QQ) - sage: f = ((2*z-1)/(3-z)) + sage: f = (2*z-1)/(3-z) sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import PGL_repn sage: PGL_repn(f) [-2 1] @@ -377,7 +376,7 @@ def PGL_order(A): EXAMPLES:: - sage: M = matrix([[0,2],[2,0]]) + sage: M = matrix([[0,2], [2,0]]) sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import PGL_order sage: PGL_order(M) 2 @@ -418,7 +417,7 @@ def CRT_helper(automorphisms, moduli): EXAMPLES:: sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import CRT_helper - sage: CRT_helper([[matrix([[4,0],[0,1]]), matrix([[0,1],[1,0]])]],[5]) + sage: CRT_helper([[matrix([[4,0], [0,1]]), matrix([[0,1], [1,0]])]], [5]) ([ [4 0] [0 1] [0 1], [1 0] @@ -452,7 +451,7 @@ def CRT_automorphisms(automorphisms, order_elts, degree, moduli): Given a list of automorphisms over various `Zmod(p^k)`, a list of the elements orders, an integer degree, and a list of the `p^k` values compute - a maximal list of automorphisms over `Zmod(M)`, such that for every `j` in `len(moduli)`, + a maximal list of automorphisms over `Zmod(M)`, such that for every `j` in ``len(moduli)``, each element reduces mod ``moduli[j]`` to one of the elements in ``automorphisms[j]`` that has order = ``degree`` @@ -462,7 +461,7 @@ def CRT_automorphisms(automorphisms, order_elts, degree, moduli): - ``order_elts`` -- a list of lists of the orders of the elements of ``automorphisms`` - - ``degree`` - a positive integer + - ``degree`` -- a positive integer - ``moduli`` -- list of prime powers, i.e., `p^k` @@ -470,7 +469,7 @@ def CRT_automorphisms(automorphisms, order_elts, degree, moduli): EXAMPLES:: - sage: aut = [[matrix([[1,0],[0,1]]), matrix([[0,1],[1,0]])]] + sage: aut = [[matrix([[1,0], [0,1]]), matrix([[0,1], [1,0]])]] sage: ords = [[1,2]] sage: degree = 2 sage: mods = [5] @@ -506,7 +505,7 @@ def valid_automorphisms(automorphisms_CRT, rational_function, ht_bound, M, - ``rational_function`` -- A one variable rational function - - ``ht_bound`` - a positive integer + - ``ht_bound`` -- a positive integer - ``M`` -- a positive integer, a product of prime powers @@ -519,7 +518,7 @@ def valid_automorphisms(automorphisms_CRT, rational_function, ht_bound, M, sage: R. = PolynomialRing(QQ) sage: F = z^2 sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import valid_automorphisms - sage: valid_automorphisms([matrix(GF(5),[[0,1],[1,0]])], F, 48, 5, True) + sage: valid_automorphisms([matrix(GF(5), [[0,1],[1,0]])], F, 48, 5, True) [1/z] """ z = rational_function.parent().gen(0) @@ -570,8 +569,8 @@ def remove_redundant_automorphisms(automorphisms, order_elts, moduli, integral_a EXAMPLES:: sage: auts = [[matrix([[1,0],[0,1]]), matrix([[6,0],[0,1]]), matrix([[0,1],[1,0]]), - ....: matrix([[6,1],[1,1]]), matrix([[1,1],[1,6]]), matrix([[0,6],[1,0]]), - ....: matrix([[1,6],[1,1]]), matrix([[6,6],[1,6]])]] + ....: matrix([[6,1],[1,1]]), matrix([[1,1],[1,6]]), matrix([[0,6],[1,0]]), + ....: matrix([[1,6],[1,1]]), matrix([[6,6],[1,6]])]] sage: ord_elts = [[1, 2, 2, 2, 2, 2, 4, 4]] sage: mods = [7] sage: R. = PolynomialRing(QQ) @@ -625,15 +624,15 @@ def automorphism_group_QQ_CRT(rational_function, prime_lower_bound=4, return_fun INPUT: - - ``rational_function`` - a rational function of a univariate polynomial ring over `\QQ` + - ``rational_function`` -- a rational function of a univariate polynomial ring over `\QQ` - - ``prime_lower_bound`` -- (default: 4) a positive integer - a lower bound for the primes to use for + - ``prime_lower_bound`` -- (default: 4) a positive integer; a lower bound for the primes to use for the Chinese Remainder Theorem step - - ``return_functions`` -- (default: True) boolean - True returns linear fractional transformations + - ``return_functions`` -- (default: ``True``) boolean; ``True`` returns linear fractional transformations False returns elements of `PGL(2,\QQ)` - - ``iso_type`` -- (default: False) boolean - True returns the isomorphism type of the automorphism group + - ``iso_type`` -- (default: ``False``) boolean; ``True`` returns the isomorphism type of the automorphism group OUTPUT: a complete list of automorphisms of ``rational_function`` @@ -839,11 +838,11 @@ def automorphism_group_FF(rational_function, absolute=False, iso_type=False, ret - ``rational_function`` -- a rational function defined over the fraction field of a polynomial ring in one variable with finite field coefficients - - ``absolute``-- (default: False) boolean - True returns the absolute automorphism group and a field of definition + - ``absolute``-- (default: ``False``) boolean; ``True`` returns the absolute automorphism group and a field of definition - - ``iso_type`` -- (default: False) boolean - True returns the isomorphism type of the automorphism group + - ``iso_type`` -- (default: ``False``) boolean; ``True`` returns the isomorphism type of the automorphism group - - ``return_functions`` -- (default: False) boolean, True returns linear fractional transformations + - ``return_functions`` -- (default: ``False``) boolean; ``True`` returns linear fractional transformations False returns elements of `PGL(2)` OUTPUT: a list of automorphisms of ``rational_function`` @@ -899,9 +898,9 @@ def automorphism_group_FF(rational_function, absolute=False, iso_type=False, ret def field_descent(sigma, y): r""" - Function for descending an element in a field E to a subfield F. + Function for descending an element in a field `E` to a subfield `F`. - Here F, E must be finite fields or number fields. This function determines + Here `F`, `E` must be finite fields or number fields. This function determines the unique image of subfield which is ``y`` by the embedding ``sigma`` if it exists. Otherwise returns ``None``. This functionality is necessary because Sage does not keep track of subfields. @@ -961,7 +960,7 @@ def rational_function_coefficient_descent(rational_function, sigma, poly_ring): Here `F`, `E` must be finite fields or number fields. It determines the unique rational function in fraction field of - ``poly_ring`` which is the image of ``rational_function`` by ``ssigma``, + ``poly_ring`` which is the image of ``rational_function`` by ``sigma``, if it exists, and otherwise returns ``None``. INPUT: @@ -1061,7 +1060,7 @@ def rational_function_reduce(rational_function): - ``rational_function`` -- rational function `= F/G` in univariate polynomial ring - OUTPUT: rational function -- `(F/gcd(F,G) ) / (G/gcd(F,G))` + OUTPUT: rational function -- `(F/\gcd(F,G)) / (G/\gcd(F,G))` EXAMPLES:: @@ -1157,7 +1156,7 @@ def automorphism_group_FF_alg2(rational_function): INPUT: - - ``rational_function``--a rational function defined over a finite field + - ``rational_function`` -- a rational function defined over a finite field OUTPUT: absolute automorphism group of ``rational_function`` and a ring of definition @@ -1272,9 +1271,9 @@ def order_p_automorphisms(rational_function, pre_image): INPUT: - - ``rational_function``--rational function defined over finite field `F` + - ``rational_function`` -- rational function defined over finite field `F` - - ``pre_image``--set of triples `[x, L, f]`, where `x` is an `F`-rational + - ``pre_image`` -- set of triples `[x, L, f]`, where `x` is an `F`-rational fixed point of ``rational_function``, `L` is the list of `F`-rational pre-images of `x` (excluding `x`), and `f` is the polynomial defining the full set of pre-images of `x` (again excluding `x` itself) @@ -1455,11 +1454,11 @@ def automorphisms_fixing_pair(rational_function, pair, quad): INPUT: - - ``rational_function``-- rational function defined over finite field `E` + - ``rational_function`` -- rational function defined over finite field `E` - - ``pair``-- a pair of points of `\mathbb{P}^1(E)` + - ``pair`` -- a pair of points of `\mathbb{P}^1(E)` - - ``quad``-- Boolean: an indicator if this is a quadratic pair of points + - ``quad`` -- Boolean: an indicator if this is a quadratic pair of points OUTPUT: set of automorphisms with order prime to characteristic defined over `E` that fix the pair, excluding the identity @@ -1535,14 +1534,14 @@ def automorphism_group_FF_alg3(rational_function): INPUT: - - ``rational_function``--a rational function defined over a finite field `F` + - ``rational_function`` -- a rational function defined over a finite field `F` OUTPUT: list of `F`-rational automorphisms of ``rational_function`` EXAMPLES:: sage: R. = PolynomialRing(GF(5^3,'t')) - sage: f = (3456*z^4) + sage: f = 3456*z^4 sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import automorphism_group_FF_alg3 sage: automorphism_group_FF_alg3(f) [z, 1/z] @@ -1694,14 +1693,14 @@ def automorphism_group_FF_alg3(rational_function): def which_group(list_of_elements): r""" - Given a finite subgroup of `PGL2` determine its isomorphism class. + Given a finite subgroup of `PGL_2` determine its isomorphism class. This function makes heavy use of the classification of finite subgroups of `PGL(2,K)`. INPUT: - ``list_of_elements``-- a finite list of elements of `PGL(2,K)` - that we know a priori form a group + that we know a priori form a group OUTPUT: a string -- the isomorphism type of the group @@ -1844,9 +1843,10 @@ def conjugating_set_initializer(f, g): ``possible_targets`` tracks multiplier information:: sage: P. = ProjectiveSpace(QQ, 2) - sage: f = DynamicalSystem([(8*x^7 - 35*x^4*y^3 - 35*x^4*z^3 - 7*x*y^6 - 140*x*y^3*z^3 \ - - 7*x*z^6), (-7*x^6*y - 35*x^3*y^4 - 140*x^3*y*z^3 + 8*y^7 - 35*y^4*z^3 \ - - 7*y*z^6), -7*x^6*z - 140*x^3*y^3*z - 35*x^3*z^4 - 7*y^6*z - 35*y^3*z^4 + 8*z^7]) + sage: f = DynamicalSystem([ + ....: 8*x^7 - 35*x^4*y^3 - 35*x^4*z^3 - 7*x*y^6 - 140*x*y^3*z^3 - 7*x*z^6, + ....: -7*x^6*y - 35*x^3*y^4 - 140*x^3*y*z^3 + 8*y^7 - 35*y^4*z^3 - 7*y*z^6, + ....: -7*x^6*z - 140*x^3*y^3*z - 35*x^3*z^4 - 7*y^6*z - 35*y^3*z^4 + 8*z^7]) sage: from sage.dynamics.arithmetic_dynamics.endPN_automorphism_group import conjugating_set_initializer sage: source, possible_targets = conjugating_set_initializer(f, f) sage: P.is_linearly_independent(source, 3) diff --git a/src/sage/dynamics/arithmetic_dynamics/endPN_minimal_model.py b/src/sage/dynamics/arithmetic_dynamics/endPN_minimal_model.py index 735e0800a6f..0a33b460a01 100644 --- a/src/sage/dynamics/arithmetic_dynamics/endPN_minimal_model.py +++ b/src/sage/dynamics/arithmetic_dynamics/endPN_minimal_model.py @@ -22,6 +22,9 @@ # https://www.gnu.org/licenses/ # **************************************************************************** +from copy import copy + +from sage.arith.misc import gcd from sage.functions.hyperbolic import cosh from sage.matrix.constructor import matrix from sage.matrix.matrix_space import MatrixSpace @@ -33,9 +36,7 @@ from sage.rings.polynomial.binary_form_reduce import covariant_z0, epsinv from sage.rings.rational_field import QQ from sage.schemes.affine.affine_space import AffineSpace -from sage.symbolic.constants import e -from sage.arith.misc import gcd -from copy import copy + def bCheck(c, v, p, b): r""" @@ -89,7 +90,7 @@ def scale(c, v, p): - ``c`` -- an integer polynomial - - ``v`` -- an integer - the bound on the exponent from blift + - ``v`` -- an integer; the bound on the exponent from :func:`blift` - ``p`` -- a prime @@ -151,8 +152,8 @@ def blift(LF, Li, p, k, S=None, all_orbits=False): sage: R. = PolynomialRing(QQ) sage: from sage.dynamics.arithmetic_dynamics.endPN_minimal_model import blift - sage: blift([8*b^3 + 12*b^2 + 6*b + 1, 48*b^2 + 483*b + 117, 72*b + 1341,\ - ....: -24*b^2 + 411*b + 99, -144*b + 1233, -216*b], 2, 3, 2) + sage: blift([8*b^3 + 12*b^2 + 6*b + 1, 48*b^2 + 483*b + 117, 72*b + 1341, + ....: -24*b^2 + 411*b + 99, -144*b + 1233, -216*b], 2, 3, 2) [[True, 4]] """ @@ -244,8 +245,7 @@ def affine_minimal(vp, return_transformation=False, D=None, quick=False): sage: affine_minimal(vp, True) ( Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (X : Y) to - (X^2 + Y^2 : X*Y) + Defn: Defined on coordinates by sending (X : Y) to (X^2 + Y^2 : X*Y) , [3 0] [0 1] @@ -330,16 +330,16 @@ def affine_minimal(vp, return_transformation=False, D=None, quick=False): def Min(Fun, p, ubRes, conj, all_orbits=False): r""" - Local loop for Affine_minimal, where we check minimality at the prime p. + Local loop for :func:`affine_minimal`, where we check minimality at the prime `p`. - First we bound the possible k in our transformations A = zp^k + b. + First we bound the possible `k` in our transformations `A = zp^k + b`. See Theorems 3.3.2 and 3.3.3 in [Molnar]_. INPUT: - ``Fun`` -- a dynamical system on projective space - - ``p`` - a prime + - ``p`` -- a prime - ``ubRes`` -- integer, the upper bound needed for Th. 3.3.3 in [Molnar]_ @@ -357,7 +357,8 @@ def Min(Fun, p, ubRes, conj, all_orbits=False): EXAMPLES:: sage: P. = ProjectiveSpace(QQ, 1) - sage: f = DynamicalSystem_projective([149*x^2 + 39*x*y + y^2, -8*x^2 + 137*x*y + 33*y^2]) + sage: f = DynamicalSystem_projective([149*x^2 + 39*x*y + y^2, + ....: -8*x^2 + 137*x*y + 33*y^2]) sage: from sage.dynamics.arithmetic_dynamics.endPN_minimal_model import Min sage: Min(f, 3, -27000000, matrix(QQ,[[1, 0],[0, 1]])) [ @@ -941,6 +942,8 @@ def get_bound_dynamical(F, f, m=1, dynatomic=True, prec=53, emb=None): sage: get_bound_dynamical(f.dynatomic_polynomial(1), f) 35.5546923182219 """ + from sage.symbolic.constants import e + def coshdelta(z): #The cosh of the hyperbolic distance from z = t+uj to j return (z.norm() + 1)/(2*z.imag()) @@ -998,7 +1001,7 @@ def smallest_dynamical(f, dynatomic=True, start_n=1, prec=53, emb=None, algorith - ``dynatomic`` -- boolean. whether ``F`` is the periodic points or the formal periodic points of period ``m`` for ``f`` - - ``start_n`` - positive integer. the period used to start trying to + - ``start_n`` -- positive integer. the period used to start trying to create associate binary form ``F`` - ``prec``-- positive integer. precision to use in CC @@ -1010,7 +1013,7 @@ def smallest_dynamical(f, dynatomic=True, start_n=1, prec=53, emb=None, algorith properties of the map are utilized to choose how to compute minimal orbit representatives - - ``check_minimal`` -- (default: True), boolean, whether to check + - ``check_minimal`` -- (default: ``True``), boolean, whether to check if this map is a minimal model OUTPUT: pair [dynamical system, matrix] @@ -1020,7 +1023,7 @@ def smallest_dynamical(f, dynatomic=True, start_n=1, prec=53, emb=None, algorith sage: from sage.dynamics.arithmetic_dynamics.endPN_minimal_model import smallest_dynamical sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem([50*x^2 + 795*x*y + 2120*y^2, 265*x^2 + 106*y^2]) - sage: smallest_dynamical(f) #long time + sage: smallest_dynamical(f) # long time [ Dynamical System of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y) to @@ -1030,6 +1033,8 @@ def smallest_dynamical(f, dynatomic=True, start_n=1, prec=53, emb=None, algorith [0 1] ] """ + from sage.symbolic.constants import e + def insert_item(pts, item, index): # binary insertion to maintain list of points left to consider N = len(pts) diff --git a/src/sage/dynamics/arithmetic_dynamics/generic_ds.py b/src/sage/dynamics/arithmetic_dynamics/generic_ds.py index 25d8645ae86..9533e983ba6 100644 --- a/src/sage/dynamics/arithmetic_dynamics/generic_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/generic_ds.py @@ -78,14 +78,14 @@ class DynamicalSystem(SchemeMorphism_polynomial, EXAMPLES:: sage: A. = AffineSpace(QQ,1) - sage: f = DynamicalSystem_affine([x^2+1]) + sage: f = DynamicalSystem_affine([x^2 + 1]) sage: type(f) :: sage: P. = ProjectiveSpace(QQ,1) - sage: f = DynamicalSystem_projective([x^2+y^2, y^2]) + sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) sage: type(f) @@ -96,8 +96,7 @@ class DynamicalSystem(SchemeMorphism_polynomial, sage: DynamicalSystem(H([y, x])) Dynamical System of Projective Space of dimension 1 over Complex Field with 53 bits of precision - Defn: Defined on coordinates by sending (x : y) to - (y : x) + Defn: Defined on coordinates by sending (x : y) to (y : x) :class:`DynamicalSystem` defaults to projective:: @@ -109,16 +108,14 @@ class DynamicalSystem(SchemeMorphism_polynomial, :: - sage: A. = AffineSpace(QQ, 2) - sage: DynamicalSystem([y, x], domain=A) - Dynamical System of Affine Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - (y, x) - sage: H = End(A) - sage: DynamicalSystem(H([y, x])) - Dynamical System of Affine Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - (y, x) + sage: A. = AffineSpace(QQ, 2) + sage: DynamicalSystem([y, x], domain=A) + Dynamical System of Affine Space of dimension 2 over Rational Field + Defn: Defined on coordinates by sending (x, y) to (y, x) + sage: H = End(A) + sage: DynamicalSystem(H([y, x])) + Dynamical System of Affine Space of dimension 2 over Rational Field + Defn: Defined on coordinates by sending (x, y) to (y, x) Note that ``domain`` is ignored if an endomorphism is passed in:: @@ -134,7 +131,8 @@ class DynamicalSystem(SchemeMorphism_polynomial, sage: P. = ProjectiveSpace(ZZ, 1) sage: DynamicalSystem([CC.0*x^2, 4/5*y^2]) - Dynamical System of Projective Space of dimension 1 over Complex Field with 53 bits of precision + Dynamical System of + Projective Space of dimension 1 over Complex Field with 53 bits of precision Defn: Defined on coordinates by sending (x : y) to (1.00000000000000*I*x^2 : 0.800000000000000*y^2) sage: P. = ProjectiveSpace(GF(5), 1) @@ -179,7 +177,7 @@ def __init__(self, polys_or_rat_fncts, domain): sage: from sage.dynamics.arithmetic_dynamics.generic_ds import DynamicalSystem sage: P. = ProjectiveSpace(QQ,1) - sage: f = DynamicalSystem_projective([x^2+y^2, y^2]) + sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) sage: isinstance(f, DynamicalSystem) True """ @@ -239,7 +237,7 @@ def as_scheme_morphism(self): :: sage: P. = ProjectiveSpace(QQ, 1) - sage: f = DynamicalSystem_projective([x^2-y^2, y^2]) + sage: f = DynamicalSystem_projective([x^2 - y^2, y^2]) sage: type(f.as_scheme_morphism()) @@ -253,21 +251,21 @@ def as_scheme_morphism(self): :: sage: A. = AffineSpace(ZZ, 2) - sage: f = DynamicalSystem_affine([x^2-2, y^2]) + sage: f = DynamicalSystem_affine([x^2 - 2, y^2]) sage: type(f.as_scheme_morphism()) :: sage: A. = AffineSpace(QQ, 2) - sage: f = DynamicalSystem_affine([x^2-2, y^2]) + sage: f = DynamicalSystem_affine([x^2 - 2, y^2]) sage: type(f.as_scheme_morphism()) :: sage: A. = AffineSpace(GF(3), 2) - sage: f = DynamicalSystem_affine([x^2-2, y^2]) + sage: f = DynamicalSystem_affine([x^2 - 2, y^2]) sage: type(f.as_scheme_morphism()) """ @@ -295,8 +293,7 @@ def change_ring(self, R, check=True): sage: f = DynamicalSystem_projective([3*x^2, y^2]) sage: f.change_ring(GF(5)) Dynamical System of Projective Space of dimension 1 over Finite Field of size 5 - Defn: Defined on coordinates by sending (x : y) to - (-2*x^2 : y^2) + Defn: Defined on coordinates by sending (x : y) to (-2*x^2 : y^2) """ f = self.as_scheme_morphism() F = f.change_ring(R) @@ -325,11 +322,10 @@ def specialization(self, D=None, phi=None, homset=None): sage: R. = PolynomialRing(QQ) sage: P. = ProjectiveSpace(R, 1) - sage: f = DynamicalSystem_projective([x^2 + c*y^2,y^2], domain=P) + sage: f = DynamicalSystem_projective([x^2 + c*y^2, y^2], domain=P) sage: f.specialization({c:1}) Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x^2 + y^2 : y^2) + Defn: Defined on coordinates by sending (x : y) to (x^2 + y^2 : y^2) """ F = self.as_scheme_morphism().specialization(D, phi, homset) return F.as_dynamical_system() @@ -362,7 +358,7 @@ def field_of_definition_critical(self, return_embedding=False, simplify_all=Fals EXAMPLES: - Note that the number of critical points is 2d-2, but (1:0) has multiplicity 2 in this case:: + Note that the number of critical points is `2d-2`, but `(1:0)` has multiplicity 2 in this case:: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([1/3*x^3 + x*y^2, y^3], domain=P) @@ -392,10 +388,11 @@ def field_of_definition_critical(self, return_embedding=False, simplify_all=Fals sage: f[0].derivative(x).univariate_polynomial().is_irreducible() True sage: f.field_of_definition_critical(return_embedding=True, names='b') - (Finite Field in b of size 3^6, Ring morphism: - From: Finite Field in a of size 3^2 - To: Finite Field in b of size 3^6 - Defn: a |--> 2*b^5 + 2*b^3 + b^2 + 2*b + 2) + (Finite Field in b of size 3^6, + Ring morphism: + From: Finite Field in a of size 3^2 + To: Finite Field in b of size 3^6 + Defn: a |--> 2*b^5 + 2*b^3 + b^2 + 2*b + 2) """ ds = copy(self) space = ds.domain().ambient_space() @@ -475,7 +472,7 @@ def field_of_definition_periodic(self, n, formal=False, return_embedding=False, [(0 : 1), (1 : 0), (1 : 1)] sage: N. = f.field_of_definition_periodic(3); N Number Field in a with defining polynomial x^6 + x^5 + x^4 + x^3 + x^2 + x + 1 - sage: sorted(f.periodic_points(3,minimal=False, R=N), key=str) + sage: sorted(f.periodic_points(3, minimal=False, R=N), key=str) [(-a^5 - a^4 - a^3 - a^2 - a - 1 : 1), (0 : 1), (1 : 0), @@ -504,10 +501,11 @@ def field_of_definition_periodic(self, n, formal=False, return_embedding=False, sage: (g-x).univariate_polynomial().factor() (x + 1) * (x + a + 1) * (x^2 + a*x + 1) sage: f.field_of_definition_periodic(2, return_embedding=True, names='b') - (Finite Field in b of size 2^4, Ring morphism: - From: Finite Field in a of size 2^2 - To: Finite Field in b of size 2^4 - Defn: a |--> b^2 + b) + (Finite Field in b of size 2^4, + Ring morphism: + From: Finite Field in a of size 2^2 + To: Finite Field in b of size 2^4 + Defn: a |--> b^2 + b) """ ds = copy(self) n = int(n) @@ -588,7 +586,8 @@ def field_of_definition_preimage(self, point, n, return_embedding=False, simplif sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([1/3*x^2 + 2/3*x*y, x^2 - 2*y^2], domain=P) sage: N. = f.field_of_definition_preimage(P(1,1), 2, simplify_all=True); N - Number Field in a with defining polynomial x^8 - 4*x^7 - 128*x^6 + 398*x^5 + 3913*x^4 - 8494*x^3 - 26250*x^2 + 30564*x - 2916 + Number Field in a with defining polynomial + x^8 - 4*x^7 - 128*x^6 + 398*x^5 + 3913*x^4 - 8494*x^3 - 26250*x^2 + 30564*x - 2916 :: @@ -603,10 +602,11 @@ def field_of_definition_preimage(self, point, n, return_embedding=False, simplif sage: P. = ProjectiveSpace(G, 1) sage: f = DynamicalSystem([x^2 + 2*y^2, y^2], domain=P) sage: f.field_of_definition_preimage(P(2,1), 2, return_embedding=True, names='a') - (Finite Field in a of size 5^2, Ring morphism: - From: Finite Field of size 5 - To: Finite Field in a of size 5^2 - Defn: 1 |--> 1) + (Finite Field in a of size 5^2, + Ring morphism: + From: Finite Field of size 5 + To: Finite Field in a of size 5^2 + Defn: 1 |--> 1) """ ds = copy(self) n = int(n) diff --git a/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py index caf82a3b00d..c1f3a41c15e 100644 --- a/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py @@ -1,7 +1,7 @@ r""" Dynamical systems for products of projective spaces -This class builds on the prouct projective space class. +This class builds on the product projective space class. The main constructor functions are given by ``DynamicalSystem`` and ``DynamicalSystem_projective``. The constructors function can take either polynomials or a morphism from which to construct a dynamical system. @@ -47,19 +47,18 @@ class DynamicalSystem_product_projective(DynamicalSystem, INPUT: - - ``polys`` -- a list of ``n_1 + \cdots + n_r`` multi-homogeneous polynomials, all + - ``polys`` -- a list of `n_1 + \cdots + n_r` multi-homogeneous polynomials, all of which should have the same parent - ``domain`` -- a projective scheme embedded in - ``P^{n_1-1} \times \cdots \times P^{n_r-1}`` + `P^{n_1-1} \times \cdots \times P^{n_r-1}` EXAMPLES:: sage: T. = ProductProjectiveSpaces([2, 1], QQ) sage: DynamicalSystem_projective([x^2, y^2, z^2, w^2, u^2], domain=T) Dynamical System of Product of projective spaces P^2 x P^1 over Rational Field - Defn: Defined by sending (x : y : z , w : u) to - (x^2 : y^2 : z^2 , w^2 : u^2). + Defn: Defined by sending (x : y : z , w : u) to (x^2 : y^2 : z^2 , w^2 : u^2). """ def __init__(self, polys, domain): @@ -86,7 +85,7 @@ def _call_with_args(self, P, check=True): - ``P`` -- a point in the domain - - ``check`` -- Boolean - whether or not to perform the input checks + - ``check`` -- Boolean; whether or not to perform the input checks on the image point (Default: ``True``) OUTPUT: The image point in the codomain @@ -135,7 +134,8 @@ def nth_iterate(self, P, n, normalize=False): EXAMPLES:: sage: Z. = ProductProjectiveSpaces([1, 2], QQ) - sage: f = DynamicalSystem_projective([a^3, b^3 + a*b^2, x^2, y^2 - z^2, z*y], domain=Z) + sage: f = DynamicalSystem_projective([a^3, b^3 + a*b^2, x^2, y^2 - z^2, z*y], + ....: domain=Z) sage: P = Z([1, 1, 1, 1, 1]) sage: f.nth_iterate(P, 3) (1/1872 : 1 , 1 : 1 : 0) @@ -145,7 +145,7 @@ def nth_iterate(self, P, n, normalize=False): sage: Z. = ProductProjectiveSpaces([1, 1], ZZ) sage: f = DynamicalSystem_projective([a*b, b^2, x^3 - y^3, y^2*x], domain=Z) sage: P = Z([2, 6, 2, 4]) - sage: f.nth_iterate(P, 2, normalize = True) + sage: f.nth_iterate(P, 2, normalize=True) (1 : 3 , 407 : 112) """ if P.codomain() != self.domain(): @@ -194,10 +194,12 @@ def orbit(self, P, N, **kwds): EXAMPLES:: sage: Z. = ProductProjectiveSpaces([1, 2], QQ) - sage: f = DynamicalSystem_projective([a^3, b^3 + a*b^2, x^2, y^2 - z^2, z*y], domain=Z) + sage: f = DynamicalSystem_projective([a^3, b^3 + a*b^2, x^2, y^2 - z^2, z*y], + ....: domain=Z) sage: P = Z([1, 1, 1, 1, 1]) sage: f.orbit(P, 3) - [(1 : 1 , 1 : 1 : 1), (1/2 : 1 , 1 : 0 : 1), (1/12 : 1 , -1 : 1 : 0), (1/1872 : 1 , 1 : 1 : 0)] + [(1 : 1 , 1 : 1 : 1), (1/2 : 1 , 1 : 0 : 1), + (1/12 : 1 , -1 : 1 : 0), (1/1872 : 1 , 1 : 1 : 0)] :: @@ -205,7 +207,8 @@ def orbit(self, P, N, **kwds): sage: f = DynamicalSystem_projective([a*b, b^2, x^3 - y^3, y^2*x], domain=Z) sage: P = Z([2, 6, 2, 4]) sage: f.orbit(P, 3, normalize=True) - [(1 : 3 , 1 : 2), (1 : 3 , -7 : 4), (1 : 3 , 407 : 112), (1 : 3 , 66014215 : 5105408)] + [(1 : 3 , 1 : 2), (1 : 3 , -7 : 4), + (1 : 3 , 407 : 112), (1 : 3 , 66014215 : 5105408)] """ if P.codomain() != self.domain(): raise TypeError("point is not defined over domain of function") @@ -241,7 +244,7 @@ def orbit(self, P, N, **kwds): def nth_iterate_map(self, n): r""" - Return the nth iterate of this dynamical system. + Return the ``n``-th iterate of this dynamical system. ALGORITHM: @@ -301,21 +304,21 @@ def cyclegraph(self): EXAMPLES:: sage: P. = ProductProjectiveSpaces(GF(3), [1,1]) - sage: f = DynamicalSystem_projective([a^2,b^2,c^2,d^2], domain=P) + sage: f = DynamicalSystem_projective([a^2, b^2, c^2, d^2], domain=P) sage: f.cyclegraph() Looped digraph on 16 vertices :: sage: P. = ProductProjectiveSpaces(GF(5), [1,1]) - sage: f = DynamicalSystem_projective([a^2,b^2,c,d], domain=P) + sage: f = DynamicalSystem_projective([a^2, b^2, c, d], domain=P) sage: f.cyclegraph() Looped digraph on 36 vertices :: sage: P. = ProductProjectiveSpaces(GF(2), [1,2]) - sage: f = DynamicalSystem_projective([a^2,b^2,c,d,e], domain=P) + sage: f = DynamicalSystem_projective([a^2, b^2, c, d, e], domain=P) sage: f.cyclegraph() Looped digraph on 21 vertices diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index 6520177f4a7..f4a67e5fdf9 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -58,7 +58,7 @@ class initialization directly. import sage.rings.abc from sage.arith.functions import lcm -from sage.arith.misc import binomial, gcd, is_prime, moebius, next_prime, primes +from sage.arith.misc import binomial, gcd, integer_ceil as ceil, is_prime, moebius, next_prime, primes from sage.calculus.functions import jacobian from sage.categories.fields import Fields from sage.categories.finite_fields import FiniteFields @@ -76,7 +76,6 @@ class initialization directly. from sage.dynamics.arithmetic_dynamics.projective_ds_helper import ( _fast_possible_periods, _all_periodic_points) -from sage.functions.other import ceil from sage.libs.pari.all import PariError from sage.matrix.constructor import matrix, identity_matrix from sage.misc.cachefunc import cached_method @@ -116,7 +115,6 @@ class initialization directly. from sage.schemes.projective.projective_space import ProjectiveSpace, is_ProjectiveSpace from sage.schemes.projective.projective_subscheme import AlgebraicScheme_subscheme_projective from sage.structure.element import get_coercion_model -from sage.symbolic.constants import e class DynamicalSystem_projective(SchemeMorphism_polynomial_projective_space, @@ -6854,6 +6852,7 @@ def lift_to_rational_periodic(self, points_modp, B=None): return [] if B is None: + from sage.symbolic.constants import e B = e ** self.height_difference_bound() p = points_modp[0][0].codomain().base_ring().characteristic() @@ -7250,6 +7249,9 @@ def all_periodic_points(self, **kwds): return list(periodic) while p in badprimes: p = next_prime(p + 1) + + from sage.symbolic.constants import e + B = e ** DS.height_difference_bound() f = DS.change_ring(GF(p)) all_points = f.possible_periods(True) # return the list of points and their periods. diff --git a/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py b/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py index cc4078c017a..0d1672e15d0 100644 --- a/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py +++ b/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py @@ -61,7 +61,7 @@ def WehlerK3Surface(polys): EXAMPLES:: - sage: PP. = ProductProjectiveSpaces([2, 2],QQ) + sage: PP. = ProductProjectiveSpaces([2, 2], QQ) sage: L = x0*y0 + x1*y1 - x2*y2 sage: Q = x0*x1*y1^2 + x2^2*y0*y2 sage: WehlerK3Surface([L, Q]) @@ -159,7 +159,7 @@ def change_ring(self, R): r""" Changes the base ring on which the Wehler K3 Surface is defined. - INPUT: ``R`` - ring + INPUT: ``R`` -- ring OUTPUT: K3 Surface defined over input ring @@ -184,7 +184,7 @@ def _check_satisfies_equations(self, P): r""" Function checks to see if point ``P`` lies on the K3 Surface. - INPUT: ``P`` - point in `\mathbb{P}^2 \times \mathbb{P}^2` + INPUT: ``P`` -- point in `\mathbb{P}^2 \times \mathbb{P}^2` OUTPUT: AttributeError True if the point is not on the surface @@ -330,17 +330,17 @@ def Gpoly(self, component, k): Return the G polynomials `G^*_k`. They are defined as: - `G^*_k = \left(L^*_j\right)^2Q^*_{ii}-L^*_iL^*_jQ^*_{ij}+\left(L^*_i\right)^2Q^*_{jj}`\ + `G^*_k = \left(L^*_j\right)^2Q^*_{ii}-L^*_iL^*_jQ^*_{ij}+\left(L^*_i\right)^2Q^*_{jj}` where {i, j, k} is some permutation of (0, 1, 2) and * is either - x (Component = 1) or y (Component = 0). + x (``component=1``) or y (``component=0``). INPUT: - - ``component`` - Integer: 0 or 1 + - ``component`` -- Integer: 0 or 1 - - ``k`` - Integer: 0, 1 or 2 + - ``k`` -- Integer: 0, 1 or 2 - OUTPUT: polynomial in terms of either y (Component = 0) or x (Component = 1) + OUTPUT: polynomial in terms of either y (``component=0``) or x (``component=1``) EXAMPLES:: @@ -376,17 +376,17 @@ def Hpoly(self, component, i, j): This polynomial is defined by: `H^*_{ij} = 2L^*_iL^*_jQ^*_{kk}-L^*_iL^*_kQ^*_{jk} - L^*_jL^*_kQ^*_{ik}+\left(L^*_k\right)^2Q^*_{ij}` - where {i, j, k} is some permutation of (0, 1, 2) and * is either y (Component = 0) or x (Component = 1). + where {i, j, k} is some permutation of (0, 1, 2) and * is either y (``component=0``) or x (``component=1``). INPUT: - - ``component`` - Integer: 0 or 1 + - ``component`` -- Integer: 0 or 1 - - ``i`` - Integer: 0, 1 or 2 + - ``i`` -- Integer: 0, 1 or 2 - - ``j`` - Integer: 0, 1 or 2 + - ``j`` -- Integer: 0, 1 or 2 - OUTPUT: polynomial in terms of either y (Component = 0) or x (Component = 1) + OUTPUT: polynomial in terms of either y (``component=0``) or x (``component=1``) EXAMPLES:: @@ -464,7 +464,7 @@ def Qxa(self, a): Notation and definition from: [CS1996]_ - INPUT: ``a`` - Point in `\mathbb{P}^2` + INPUT: ``a`` -- Point in `\mathbb{P}^2` OUTPUT: A polynomial representing the fiber @@ -518,9 +518,9 @@ def Sxa(self, a): sage: X = WehlerK3Surface([Z, Y]) sage: T = PP(1, 1, 0, 1, 0, 0) sage: X.Sxa(T[0]) - Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - y0 + y1, - 5*y0^2 + 7*y0*y1 + y1^2 + 11*y1*y2 + y2^2 + Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: + y0 + y1, + 5*y0^2 + 7*y0*y1 + y1^2 + 11*y1*y2 + y2^2 """ if a not in self.ambient_space()[0]: raise TypeError("point must be in projective space of dimension 2") @@ -537,7 +537,7 @@ def Lyb(self, b): Notation and definition from: [CS1996]_ - INPUT: ``b`` - Point in projective space + INPUT: ``b`` -- Point in projective space OUTPUT: A polynomial representing the fiber @@ -554,7 +554,7 @@ def Lyb(self, b): sage: X = WehlerK3Surface([Z, Y]) sage: T = PP(1, 1, 0, 1, 0, 0) sage: X.Lyb(T[1]) - x0 + x0 """ if b not in self.ambient_space()[1]: raise TypeError("point must be in projective space of dimension 2") @@ -627,9 +627,9 @@ def Syb(self, b): sage: X = WehlerK3Surface([Z, Y]) sage: T = PP(1, 1, 0, 1, 0, 0) sage: X.Syb(T[1]) - Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x0, - x0^2 + 3*x0*x1 + x1^2 + Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: + x0, + x0^2 + 3*x0*x1 + x1^2 """ if b not in self.ambient_space()[1]: @@ -649,23 +649,25 @@ def Ramification_poly(self, i): The roots of this polynomial will either be degenerate fibers or fixed points of the involutions `\sigma_x` or `\sigma_y` for more information, see [CS1996]_. - INPUT: ``i`` - Integer, either 0 (polynomial in y) or 1 (polynomial in x) + INPUT: ``i`` -- Integer, either 0 (polynomial in y) or 1 (polynomial in x) OUTPUT: Polynomial in the coordinate ring of the ambient space EXAMPLES:: sage: PP. = ProductProjectiveSpaces([2, 2], QQ) - sage: Z = x0^2*y0^2 + 3*x0*x1*y0^2 + x1^2*y0^2 + 4*x0^2*y0*y1 + 3*x0*x1*y0*y1\ - - 2*x2^2*y0*y1 - x0^2*y1^2 + 2*x1^2*y1^2 - x0*x2*y1^2 - 4*x1*x2*y1^2 + 5*x0*x2*y0*y2\ - - 4*x1*x2*y0*y2 + 7*x0^2*y1*y2 + 4*x1^2*y1*y2 + x0*x1*y2^2 + 3*x2^2*y2^2 + sage: Z = (x0^2*y0^2 + 3*x0*x1*y0^2 + x1^2*y0^2 + 4*x0^2*y0*y1 + 3*x0*x1*y0*y1 + ....: - 2*x2^2*y0*y1 - x0^2*y1^2 + 2*x1^2*y1^2 - x0*x2*y1^2 - 4*x1*x2*y1^2 + ....: + 5*x0*x2*y0*y2 - 4*x1*x2*y0*y2 + 7*x0^2*y1*y2 + 4*x1^2*y1*y2 + ....: + x0*x1*y2^2 + 3*x2^2*y2^2) sage: Y = x0*y0 + x1*y1 + x2*y2 sage: X = WehlerK3Surface([Z, Y]) sage: X.Ramification_poly(0) 8*y0^5*y1 - 24*y0^4*y1^2 + 48*y0^2*y1^4 - 16*y0*y1^5 + y1^6 + 84*y0^3*y1^2*y2 + 46*y0^2*y1^3*y2 - 20*y0*y1^4*y2 + 16*y1^5*y2 + 53*y0^4*y2^2 + 56*y0^3*y1*y2^2 - 32*y0^2*y1^2*y2^2 - 80*y0*y1^3*y2^2 - 92*y1^4*y2^2 - 12*y0^2*y1*y2^3 - - 168*y0*y1^2*y2^3 - 122*y1^3*y2^3 + 14*y0^2*y2^4 + 8*y0*y1*y2^4 - 112*y1^2*y2^4 + y2^6 + - 168*y0*y1^2*y2^3 - 122*y1^3*y2^3 + 14*y0^2*y2^4 + 8*y0*y1*y2^4 - 112*y1^2*y2^4 + + y2^6 """ return ((self._Lcoeff(i, 0))**2)*(self._Qcoeff(i, 1, 2))**2 + \ ((self._Lcoeff(i, 1))**2)*(self._Qcoeff(i, 0, 2)**2)+ \ @@ -755,7 +757,7 @@ def degenerate_fibers(self): The criteria for degeneracy by the common vanishing of the polynomials ``self.Gpoly(1, 0)``, ``self.Gpoly(1, 1)``, ``self.Gpoly(1, 2)``, - ``self.Hpoly(1, 0, 1)``,``self.Hpoly(1, 0, 2)``, + ``self.Hpoly(1, 0, 1)``, ``self.Hpoly(1, 0, 2)``, ``self.Hpoly(1, 1, 2)`` (for the first component), is from Proposition 1.4 in the following article: [CS1996]_. @@ -781,9 +783,10 @@ def degenerate_fibers(self): :: sage: PP. = ProductProjectiveSpaces([2, 2], QQ) - sage: Z = x0^2*y0^2 + 3*x0*x1*y0^2 + x1^2*y0^2 + 4*x0^2*y0*y1 + 3*x0*x1*y0*y1\ - - 2*x2^2*y0*y1 - x0^2*y1^2 + 2*x1^2*y1^2 - x0*x2*y1^2 - 4*x1*x2*y1^2 + 5*x0*x2*y0*y2\ - - 4*x1*x2*y0*y2 + 7*x0^2*y1*y2 + 4*x1^2*y1*y2 + x0*x1*y2^2 + 3*x2^2*y2^2 + sage: Z = (x0^2*y0^2 + 3*x0*x1*y0^2 + x1^2*y0^2 + 4*x0^2*y0*y1 + 3*x0*x1*y0*y1 + ....: - 2*x2^2*y0*y1 - x0^2*y1^2 + 2*x1^2*y1^2 - x0*x2*y1^2 - 4*x1*x2*y1^2 + ....: + 5*x0*x2*y0*y2 - 4*x1*x2*y0*y2 + 7*x0^2*y1*y2 + 4*x1^2*y1*y2 + ....: + x0*x1*y2^2 + 3*x2^2*y2^2) sage: Y = x0*y0 + x1*y1 + x2*y2 sage: X = WehlerK3Surface([Z, Y]) sage: X.degenerate_fibers() @@ -875,7 +878,7 @@ def degenerate_primes(self,check=True): Raises an error if the surface is degenerate. Works only for ``ZZ`` or ``QQ``. - INPUT: ``check`` -- (default: True) boolean, whether the primes are verified + INPUT: ``check`` -- (default: ``True``) boolean, whether the primes are verified ALGORITHM: @@ -1038,11 +1041,11 @@ def sigmaX(self, P, **kwds): INPUT: - - ``P`` - a point in `\mathbb{P}^2 \times \mathbb{P}^2` + - ``P`` -- a point in `\mathbb{P}^2 \times \mathbb{P}^2` kwds: - - ``check`` - (default: ``True``) boolean checks to see if point is on the surface + - ``check`` -- (default: ``True``) boolean checks to see if point is on the surface - ``normalize`` -- (default: ``True``) boolean normalizes the point @@ -1083,12 +1086,14 @@ def sigmaX(self, P, **kwds): sage: PP.=ProductProjectiveSpaces([2, 2], GF(3)) sage: l = x0*y0 + x1*y1 + x2*y2 - sage: q=-3*x0^2*y0^2 + 4*x0*x1*y0^2 - 3*x0*x2*y0^2 - 5*x0^2*y0*y1 - \ - 190*x0*x1*y0*y1- 5*x1^2*y0*y1 + 5*x0*x2*y0*y1 + 14*x1*x2*y0*y1 + \ - 5*x2^2*y0*y1 - x0^2*y1^2 - 6*x0*x1*y1^2- 2*x1^2*y1^2 + 2*x0*x2*y1^2 - \ - 4*x2^2*y1^2 + 4*x0^2*y0*y2 - x1^2*y0*y2 + 3*x0*x2*y0*y2+ 6*x1*x2*y0*y2 - \ - 6*x0^2*y1*y2 - 4*x0*x1*y1*y2 - x1^2*y1*y2 + 51*x0*x2*y1*y2 - 7*x1*x2*y1*y2 - \ - 9*x2^2*y1*y2 - x0^2*y2^2 - 4*x0*x1*y2^2 + 4*x1^2*y2^2 - x0*x2*y2^2 + 13*x1*x2*y2^2 - x2^2*y2^2 + sage: q = (-3*x0^2*y0^2 + 4*x0*x1*y0^2 - 3*x0*x2*y0^2 - 5*x0^2*y0*y1 + ....: - 190*x0*x1*y0*y1 - 5*x1^2*y0*y1 + 5*x0*x2*y0*y1 + 14*x1*x2*y0*y1 + ....: + 5*x2^2*y0*y1 - x0^2*y1^2 - 6*x0*x1*y1^2 - 2*x1^2*y1^2 + ....: + 2*x0*x2*y1^2 - 4*x2^2*y1^2 + 4*x0^2*y0*y2 - x1^2*y0*y2 + ....: + 3*x0*x2*y0*y2 + 6*x1*x2*y0*y2 - 6*x0^2*y1*y2 - 4*x0*x1*y1*y2 + ....: - x1^2*y1*y2 + 51*x0*x2*y1*y2 - 7*x1*x2*y1*y2 - 9*x2^2*y1*y2 + ....: - x0^2*y2^2 - 4*x0*x1*y2^2 + 4*x1^2*y2^2 - x0*x2*y2^2 + ....: + 13*x1*x2*y2^2 - x2^2*y2^2) sage: X = WehlerK3Surface([l, q]) sage: P = X([1, 0, 0, 0, 1, 1]) sage: X.sigmaX(X.sigmaX(P)) @@ -1268,12 +1273,12 @@ def sigmaX(self, P, **kwds): def sigmaY(self,P, **kwds): r""" - Function returns the involution on the Wehler K3 surfaces induced by the double covers. + Return the involution on the Wehler K3 surfaces induced by the double covers. - In particular,it fixes the projection to the second coordinate and swaps + In particular, it fixes the projection to the second coordinate and swaps the two points in the fiber, i.e. `(x,y) \to (x',y)`. Note that in the degenerate case, while we can split the fiber into two points, - it is not always possibleto distinguish them, using this algorithm. + it is not always possible to distinguish them, using this algorithm. ALGORITHM: @@ -1283,11 +1288,11 @@ def sigmaY(self,P, **kwds): INPUT: - - ``P`` - a point in `\mathbb{P}^2 \times \mathbb{P}^2` + - ``P`` -- a point in `\mathbb{P}^2 \times \mathbb{P}^2` kwds: - - ``check`` - (default: ``True``) boolean checks to see if point is on the surface + - ``check`` -- (default: ``True``) boolean checks to see if point is on the surface - ``normalize`` -- (default: ``True``) boolean normalizes the point @@ -1326,11 +1331,13 @@ def sigmaY(self,P, **kwds): sage: PP.=ProductProjectiveSpaces([2, 2], GF(3)) sage: l = x0*y0 + x1*y1 + x2*y2 - sage: q=-3*x0^2*y0^2 + 4*x0*x1*y0^2 - 3*x0*x2*y0^2 - 5*x0^2*y0*y1 - 190*x0*x1*y0*y1 \ - - 5*x1^2*y0*y1 + 5*x0*x2*y0*y1 + 14*x1*x2*y0*y1 + 5*x2^2*y0*y1 - x0^2*y1^2 - 6*x0*x1*y1^2 \ - - 2*x1^2*y1^2 + 2*x0*x2*y1^2 - 4*x2^2*y1^2 + 4*x0^2*y0*y2 - x1^2*y0*y2 + 3*x0*x2*y0*y2 \ - + 6*x1*x2*y0*y2 - 6*x0^2*y1*y2 - 4*x0*x1*y1*y2 - x1^2*y1*y2 + 51*x0*x2*y1*y2 - 7*x1*x2*y1*y2 \ - - 9*x2^2*y1*y2 - x0^2*y2^2 - 4*x0*x1*y2^2 + 4*x1^2*y2^2 - x0*x2*y2^2 + 13*x1*x2*y2^2 - x2^2*y2^2 + sage: q = (-3*x0^2*y0^2 + 4*x0*x1*y0^2 - 3*x0*x2*y0^2 - 5*x0^2*y0*y1 + ....: - 190*x0*x1*y0*y1 - 5*x1^2*y0*y1 + 5*x0*x2*y0*y1 + 14*x1*x2*y0*y1 + ....: + 5*x2^2*y0*y1 - x0^2*y1^2 - 6*x0*x1*y1^2 - 2*x1^2*y1^2 + 2*x0*x2*y1^2 + ....: - 4*x2^2*y1^2 + 4*x0^2*y0*y2 - x1^2*y0*y2 + 3*x0*x2*y0*y2 + ....: + 6*x1*x2*y0*y2 - 6*x0^2*y1*y2 - 4*x0*x1*y1*y2 - x1^2*y1*y2 + ....: + 51*x0*x2*y1*y2 - 7*x1*x2*y1*y2 - 9*x2^2*y1*y2 - x0^2*y2^2 + ....: - 4*x0*x1*y2^2 + 4*x1^2*y2^2 - x0*x2*y2^2 + 13*x1*x2*y2^2 - x2^2*y2^2) sage: X = WehlerK3Surface([l ,q]) sage: P = X([0, 1, 1, 1, 0, 0]) sage: X.sigmaY(X.sigmaY(P)) @@ -1521,7 +1528,7 @@ def phi(self, a, **kwds): kwds: - - ``check`` - (default: ``True``) boolean checks to see if point is on the surface + - ``check`` -- (default: ``True``) boolean checks to see if point is on the surface - ``normalize`` -- (default: ``True``) boolean normalizes the point @@ -1561,7 +1568,7 @@ def psi(self,a, **kwds): kwds: - - ``check`` - (default: ``True``) boolean checks to see if point is on the surface + - ``check`` -- (default: ``True``) boolean checks to see if point is on the surface - ``normalize`` -- (default: ``True``) boolean normalizes the point @@ -1604,8 +1611,8 @@ def lambda_plus(self, P, v, N, m, n, prec=100): - ``v`` -- non-negative integer. a place, use v = 0 for the Archimedean place - - ``m,n`` -- positive integers, We compute the local height for the divisor `E_{mn}^{+}`. - These must be indices of non-zero coordinates of the point ``P``. + - ``m``, ``n`` -- positive integers; we compute the local height for the divisor `E_{mn}^{+}`. + These must be indices of non-zero coordinates of the point ``P``. - ``prec`` -- (default: 100) float point or p-adic precision @@ -2004,9 +2011,12 @@ def fiber(self, p, component): sage: PP. = ProductProjectiveSpaces([2, 2], GF(7)) sage: L = x0*y0 + x1*y1 - 1*x2*y2 - sage: Q=(2*x0^2 + x2*x0 + (2*x1^2 + x2^2))*y0^2 + ((x0^2 + x1*x0 +(x1^2 + 2*x2*x1 + x2^2))*y1 + \ - (2*x1^2 + x2*x1 + x2^2)*y2)*y0 + ((2*x0^2+ (x1 + 2*x2)*x0 + (2*x1^2 + x2*x1))*y1^2 + ((2*x1 + 2*x2)*x0 + \ - (x1^2 +x2*x1 + 2*x2^2))*y2*y1 + (2*x0^2 + x1*x0 + (2*x1^2 + x2^2))*y2^2) + sage: Q = ((2*x0^2 + x2*x0 + (2*x1^2 + x2^2))*y0^2 + ....: + ((x0^2 + x1*x0 +(x1^2 + 2*x2*x1 + x2^2))*y1 + ....: + (2*x1^2 + x2*x1 + x2^2)*y2)*y0 + ....: + ((2*x0^2 + (x1 + 2*x2)*x0 + (2*x1^2 + x2*x1))*y1^2 + ....: + ((2*x1 + 2*x2)*x0 + (x1^2 + x2*x1 + 2*x2^2))*y2*y1 + ....: + (2*x0^2 + x1*x0 + (2*x1^2 + x2^2))*y2^2)) sage: W = WehlerK3Surface([L, Q]) sage: W.fiber([4, 0, 1], 0) [(0 : 1 : 0 , 4 : 0 : 1), (4 : 0 : 2 , 4 : 0 : 1)] @@ -2136,7 +2146,7 @@ def fiber(self, p, component): def nth_iterate_phi(self, P, n, **kwds): r""" - Computes the nth iterate for the phi function. + Computes the ``n``-th iterate for the phi function. INPUT: @@ -2158,7 +2168,7 @@ def nth_iterate_phi(self, P, n, **kwds): sage: PP. = ProductProjectiveSpaces([2, 2], QQ) sage: L = x0*y0 + x1*y1 + x2*y2 sage: Q = x1^2*y0^2 + 2*x2^2*y0*y1 + x0^2*y1^2 - x0*x1*y2^2 - sage: W = WehlerK3Surface([L ,Q]) + sage: W = WehlerK3Surface([L, Q]) sage: T = W([-1, -1, 1, 1, 0, 1]) sage: W.nth_iterate_phi(T, 7) (-1 : 0 : 1 , 1 : -2 : 1) @@ -2201,7 +2211,7 @@ def nth_iterate_phi(self, P, n, **kwds): def nth_iterate_psi(self, P, n, **kwds): r""" - Computes the nth iterate for the psi function. + Computes the ``n``-th iterate for the psi function. INPUT: @@ -2262,9 +2272,9 @@ def orbit_phi(self, P, N, **kwds): INPUT: - - ``P`` - Point on the K3 surface + - ``P`` -- Point on the K3 surface - - ``N`` - a non-negative integer or list or tuple of two non-negative integers + - ``N`` -- a non-negative integer or list or tuple of two non-negative integers kwds: @@ -2321,13 +2331,13 @@ def orbit_psi(self, P, N, **kwds): INPUT: - - ``P`` - a point on the K3 surface + - ``P`` -- a point on the K3 surface - - ``N`` - a non-negative integer or list or tuple of two non-negative integers + - ``N`` -- a non-negative integer or list or tuple of two non-negative integers kwds: - - ``check`` - (default: ``True``) boolean, checks to see if point is on the surface + - ``check`` -- (default: ``True``) boolean, checks to see if point is on the surface - ``normalize`` -- (default: ``False``) boolean, normalizes the point @@ -2343,9 +2353,9 @@ def orbit_psi(self, P, N, **kwds): sage: Y = x0*y0 + x1*y1 + x2*y2 sage: X = WehlerK3Surface([Z, Y]) sage: T = X(0, 0, 1, 1, 0, 0) - sage: X.orbit_psi(T, 2, normalize = True) + sage: X.orbit_psi(T, 2, normalize=True) [(0 : 0 : 1 , 1 : 0 : 0), (0 : 0 : 1 , 0 : 1 : 0), (-1 : 0 : 1 , 1 : 1/9 : 1)] - sage: X.orbit_psi(T,[2,3], normalize = True) + sage: X.orbit_psi(T,[2,3], normalize=True) [(-1 : 0 : 1 , 1 : 1/9 : 1), (-12816/6659 : 55413/6659 : 1 , -117756062505511/54767410965117 : -23134047983794359/37466994368025041 : 1)] """ @@ -2371,11 +2381,11 @@ def orbit_psi(self, P, N, **kwds): def is_isomorphic(self, right): r""" - Checks to see if two K3 surfaces have the same defining ideal. + Check to see if two K3 surfaces have the same defining ideal. INPUT: - - ``right`` - the K3 surface to compare to the original + - ``right`` -- the K3 surface to compare to the original OUTPUT: Boolean @@ -2395,12 +2405,12 @@ def is_isomorphic(self, right): :: sage: R. = PolynomialRing(QQ, 6) - sage: L = x*u-y*v + sage: L = x*u - y*v sage: Q = x*y*v^2 + z^2*u*w sage: W1 = WehlerK3Surface([L, Q]) sage: PP. = ProductProjectiveSpaces([2, 2], QQ) sage: L = x0*y0 + x1*y1 + x2*y2 - sage: Q = x1^2*y0^2 + 2*x2^2*y0*y1 + x0^2*y1^2 -x0*x1*y2^2 + sage: Q = x1^2*y0^2 + 2*x2^2*y0*y1 + x0^2*y1^2 - x0*x1*y2^2 sage: W2 = WehlerK3Surface([L, Q]) sage: W1.is_isomorphic(W2) False @@ -2409,12 +2419,12 @@ def is_isomorphic(self, right): def is_symmetric_orbit(self,orbit): r""" - Checks to see if the orbit is symmetric (i.e. if one of the points on the + Check to see if the orbit is symmetric (i.e. if one of the points on the orbit is fixed by '\sigma_x' or '\sigma_y'). INPUT: - - ``orbit``- a periodic cycle of either psi or phi + - ``orbit`` -- a periodic cycle of either psi or phi OUTPUT: Boolean @@ -2463,20 +2473,20 @@ class WehlerK3Surface_field( WehlerK3Surface_ring): class WehlerK3Surface_finite_field( WehlerK3Surface_field): def cardinality( self): r""" - Counts the total number of points on the K3 surface. + Count the total number of points on the K3 surface. ALGORITHM: Enumerate points over `\mathbb{P}^2`, and then count the points on the fiber of each of those points. - OUTPUT: Integer - total number of points on the surface + OUTPUT: Integer -- total number of points on the surface EXAMPLES:: sage: PP. = ProductProjectiveSpaces([2, 2], GF(7)) sage: Z = x0^2*y0^2 + 3*x0*x1*y0^2 + x1^2*y0^2 + 4*x0^2*y0*y1 + \ - 3*x0*x1*y0*y1 -2*x2^2*y0*y1 - x0^2*y1^2 + 2*x1^2*y1^2 - x0*x2*y1^2 \ + 3*x0*x1*y0*y1 - 2*x2^2*y0*y1 - x0^2*y1^2 + 2*x1^2*y1^2 - x0*x2*y1^2 \ - 4*x1*x2*y1^2 + 5*x0*x2*y0*y2 -4*x1*x2*y0*y2 + 7*x0^2*y1*y2 + 4*x1^2*y1*y2 \ + x0*x1*y2^2 + 3*x2^2*y2^2 sage: Y = x0*y0 + x1*y1 + x2*y2 From 6e08d6f888ad58d54875d1722fde4d8ffd5b651e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 17 May 2023 13:20:30 -0700 Subject: [PATCH 09/32] Massive modularization fixes --- .../dynamics/arithmetic_dynamics/affine_ds.py | 35 ++++++++++--------- .../arithmetic_dynamics/projective_ds.py | 34 +++++++++--------- .../dynamics/cellular_automata/elementary.py | 6 ++-- src/sage/dynamics/cellular_automata/glca.py | 4 +-- 4 files changed, 41 insertions(+), 38 deletions(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/affine_ds.py b/src/sage/dynamics/arithmetic_dynamics/affine_ds.py index e672314a9c0..68db00928eb 100644 --- a/src/sage/dynamics/arithmetic_dynamics/affine_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/affine_ds.py @@ -188,8 +188,8 @@ class DynamicalSystem_affine(SchemeMorphism_polynomial_affine_space, :: - sage: x = var('x') - sage: DynamicalSystem_affine(x^2+1) + sage: x = var('x') # optional - sage.symbolic + sage: DynamicalSystem_affine(x^2 + 1) # optional - sage.symbolic Traceback (most recent call last): ... TypeError: symbolic ring cannot be the base ring @@ -397,10 +397,10 @@ def homogenize(self, n): :: - sage: R. = PolynomialRing(QQbar) - sage: A. = AffineSpace(R, 2) - sage: f = DynamicalSystem_affine([QQbar(sqrt(2))*x*y, a*x^2]) - sage: f.homogenize(2) + sage: R. = PolynomialRing(QQbar) # optional - sage.rings.number_field + sage: A. = AffineSpace(R, 2) # optional - sage.rings.number_field + sage: f = DynamicalSystem_affine([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 Dynamical System 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 @@ -507,8 +507,8 @@ def dynatomic_polynomial(self, period): :: sage: A. = AffineSpace(CC,1) - sage: F = DynamicalSystem_affine([1/2*x^2 + CC(sqrt(3))]) - sage: F.dynatomic_polynomial([1,1]) + sage: F = DynamicalSystem_affine([1/2*x^2 + CC(sqrt(3))]) # optional - sage.symbolic + sage: F.dynatomic_polynomial([1,1]) # optional - sage.symbolic (0.125000000000000*x^4 + 0.366025403784439*x^2 + 1.50000000000000)/(0.500000000000000*x^2 - x + 1.73205080756888) TESTS:: @@ -957,19 +957,22 @@ def reduce_base_field(self): :: - sage: A. = AffineSpace(QQbar, 2) - sage: f = DynamicalSystem_affine([x^2 + QQbar(sqrt(3))*y^2, QQbar(sqrt(-1))*y^2]) - sage: f.reduce_base_field() - Dynamical System of Affine Space of dimension 2 over Number Field in a with defining polynomial y^4 - y^2 + 1 with a = -0.866025403784439? + 0.50000000000000000?*I + sage: A. = AffineSpace(QQbar, 2) # optional - sage.rings.number_field + sage: f = DynamicalSystem_affine([x^2 + QQbar(sqrt(3))*y^2, # optional - sage.rings.number_field sage.symbolic + ....: QQbar(sqrt(-1))*y^2]) + sage: f.reduce_base_field() # optional - sage.rings.number_field sage.symbolic + Dynamical System of Affine Space of dimension 2 over Number Field in a + with defining polynomial y^4 - y^2 + 1 + with a = -0.866025403784439? + 0.50000000000000000?*I Defn: Defined on coordinates by sending (x, y) to (x^2 + (a^3 - 2*a)*y^2, (a^3)*y^2) :: - sage: K. = CyclotomicField(5) - sage: A. = AffineSpace(K, 2) - sage: f = DynamicalSystem_affine([(3*x^2 + y) / (5*x), (y^2+1) / (x+y)]) - sage: f.reduce_base_field() + sage: K. = CyclotomicField(5) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: f = DynamicalSystem_affine([(3*x^2 + y) / (5*x), (y^2+1) / (x+y)]) # optional - sage.rings.number_field + sage: f.reduce_base_field() # optional - sage.rings.number_field Dynamical System of Affine Space of dimension 2 over Rational Field Defn: Defined on coordinates by sending (x, y) to ((3*x^2 + y)/(5*x), (5*y^2 + 5)/(5*x + 5*y)) diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index f4a67e5fdf9..f7af65ec347 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -193,8 +193,8 @@ class DynamicalSystem_projective(SchemeMorphism_polynomial_projective_space, Symbolic Ring elements are not allowed:: - sage: x,y = var('x,y') - sage: DynamicalSystem_projective([x^2, y^2]) + sage: x,y = var('x,y') # optional - sage.symbolic + sage: DynamicalSystem_projective([x^2, y^2]) # optional - sage.symbolic Traceback (most recent call last): ... ValueError: [x^2, y^2] must be elements of a polynomial ring @@ -294,7 +294,7 @@ def __classcall_private__(cls, morphism_or_polys, domain=None, names=None): :: - sage: DynamicalSystem_projective([exp(x), exp(y)]) + sage: DynamicalSystem_projective([exp(x), exp(y)]) # optional - sage.symbolic Traceback (most recent call last): ... ValueError: [e^x, e^y] must be elements of a polynomial ring @@ -501,8 +501,8 @@ def _number_field_from_algebraics(self): EXAMPLES:: sage: P. = ProjectiveSpace(QQbar,1) - sage: f = DynamicalSystem_projective([x^2 + QQbar(sqrt(2)) * y^2, y^2]) - sage: f._number_field_from_algebraics() + sage: f = DynamicalSystem_projective([x^2 + QQbar(sqrt(2)) * y^2, y^2]) # optional - sage.symbolic + sage: f._number_field_from_algebraics() # optional - sage.symbolic Dynamical System of Projective Space of dimension 1 over Number Field in a with defining polynomial y^2 - 2 with a = 1.414213562373095? Defn: Defined on coordinates by sending (x : y) to @@ -2763,7 +2763,7 @@ def nth_preimage_tree(self, Q, n, **kwds): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) sage: Q = P(0,1) - sage: f.nth_preimage_tree(Q, 2) + sage: f.nth_preimage_tree(Q, 2) # optional - sage.plot GraphPlot object for Digraph on 7 vertices :: @@ -2771,7 +2771,7 @@ def nth_preimage_tree(self, Q, n, **kwds): sage: P. = ProjectiveSpace(GF(3), 1) sage: f = DynamicalSystem_projective([x^2 + x*y + y^2, y^2]) sage: Q = P(0,1) - sage: f.nth_preimage_tree(Q, 2, return_points=True) + sage: f.nth_preimage_tree(Q, 2, return_points=True) # optional - sage.plot (GraphPlot object for Digraph on 4 vertices, [[(0 : 1)], [(1 : 1)], [(0 : 1), (2 : 1)]]) """ @@ -6076,20 +6076,20 @@ def reduced_form(self, **kwds): :: sage: P. = ProjectiveSpace(RR, 1) - sage: f = DynamicalSystem_projective([x^4, RR(sqrt(2))*y^4]) + sage: f = DynamicalSystem_projective([x^4, RR(sqrt(2))*y^4]) # optional - sage.symbolic sage: m = matrix(RR, 2, 2, [1,12,0,1]) - sage: f = f.conjugate(m) - sage: g, m = f.reduced_form(smallest_coeffs=False); m + sage: f = f.conjugate(m) # optional - sage.symbolic + sage: g, m = f.reduced_form(smallest_coeffs=False); m # optional - sage.symbolic [ 1 -12] [ 0 1] :: sage: P. = ProjectiveSpace(CC, 1) - sage: f = DynamicalSystem_projective([x^4, CC(sqrt(-2))*y^4]) + sage: f = DynamicalSystem_projective([x^4, CC(sqrt(-2))*y^4]) # optional - sage.symbolic sage: m = matrix(CC, 2, 2, [1,12,0,1]) - sage: f = f.conjugate(m) - sage: g, m = f.reduced_form(smallest_coeffs=False); m + sage: f = f.conjugate(m) # optional - sage.symbolic + sage: g, m = f.reduced_form(smallest_coeffs=False); m # optional - sage.symbolic [ 1 -12] [ 0 1] @@ -8710,11 +8710,11 @@ def reduce_base_field(self): :: sage: P. = ProjectiveSpace(QQbar, 2) - sage: f = DynamicalSystem_projective([x^2 + QQbar(sqrt(3))*y^2, + sage: f = DynamicalSystem_projective([x^2 + QQbar(sqrt(3))*y^2, # optional - sage.symbolic ....: y^2, QQbar(sqrt(2))*z^2]) - sage: f.reduce_base_field() - Dynamical System of Projective Space of dimension 2 over Number Field in a with - defining polynomial y^4 - 4*y^2 + 1 with a = -0.5176380902050415? + sage: f.reduce_base_field() # optional - sage.symbolic + Dynamical System of Projective Space of dimension 2 over Number Field in a + with defining polynomial y^4 - 4*y^2 + 1 with a = -0.5176380902050415? Defn: Defined on coordinates by sending (x : y : z) to (x^2 + (-a^2 + 2)*y^2 : y^2 : (a^3 - 3*a)*z^2) diff --git a/src/sage/dynamics/cellular_automata/elementary.py b/src/sage/dynamics/cellular_automata/elementary.py index cd0915cdde7..3cf0cd19560 100644 --- a/src/sage/dynamics/cellular_automata/elementary.py +++ b/src/sage/dynamics/cellular_automata/elementary.py @@ -225,7 +225,7 @@ class ElementaryCellularAutomata(SageObject): sage: ECA = cellular_automata.Elementary(60, width=200) sage: ECA.evolve(200) - sage: ECA.plot() + sage: ECA.plot() # optional - sage.plot Graphics object consisting of 1 graphics primitive .. PLOT:: @@ -239,7 +239,7 @@ class ElementaryCellularAutomata(SageObject): sage: ECA = cellular_automata.Elementary(90, initial_state=[1]+[0]*254+[1], boundary=None) sage: ECA.evolve(256) - sage: ECA.plot() + sage: ECA.plot() # optional - sage.plot Graphics object consisting of 1 graphics primitive .. PLOT:: @@ -598,7 +598,7 @@ def plot(self, number=None): sage: ECA = cellular_automata.Elementary(110, width=256) sage: ECA.evolve(256) - sage: ECA.plot() + sage: ECA.plot() # optional - sage.plot Graphics object consisting of 1 graphics primitive """ if number is None: diff --git a/src/sage/dynamics/cellular_automata/glca.py b/src/sage/dynamics/cellular_automata/glca.py index 46b24619ac2..90b7a770548 100644 --- a/src/sage/dynamics/cellular_automata/glca.py +++ b/src/sage/dynamics/cellular_automata/glca.py @@ -67,7 +67,7 @@ class GraftalLaceCellularAutomata(SageObject): sage: G = cellular_automata.GraftalLace([2,0,3,3,6,0,2,7]) sage: G.evolve(20) - sage: G.plot() + sage: G.plot() # optional - sage.plot Graphics object consisting of 842 graphics primitives .. PLOT:: @@ -398,7 +398,7 @@ def plot(self, number=None): sage: G = cellular_automata.GraftalLace([5,1,2,5,4,5,5,0]) sage: G.evolve(20) - sage: G.plot() + sage: G.plot() # optional - sage.plot Graphics object consisting of 865 graphics primitives """ if number is None: From 230b7343dcfd1dcb4a6590f88625b31ecf174213 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 2 Jul 2023 19:24:56 -0700 Subject: [PATCH 10/32] sage.dynamics.arithmetic_dynamics: Modularization fixes for imports --- .../arithmetic_dynamics/berkovich_ds.py | 25 +++++++++++-------- .../endPN_automorphism_group.py | 4 ++- .../arithmetic_dynamics/generic_ds.py | 16 +++++++----- .../arithmetic_dynamics/projective_ds.py | 12 +++++---- 4 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py index 19bc1fbc5e6..539a27ea7b5 100644 --- a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py @@ -22,23 +22,26 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -from sage.structure.element import Element +from sage.categories.number_fields import NumberFields +from sage.dynamics.arithmetic_dynamics.affine_ds import DynamicalSystem_affine from sage.dynamics.arithmetic_dynamics.generic_ds import DynamicalSystem -from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass +from sage.dynamics.arithmetic_dynamics.projective_ds import DynamicalSystem_projective +from sage.matrix.constructor import Matrix from sage.misc.classcall_metaclass import typecall +from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass +from sage.misc.lazy_import import lazy_import +from sage.rings.infinity import Infinity +from sage.rings.integer_ring import ZZ +from sage.rings.rational_field import QQ +from sage.schemes.affine.affine_space import is_AffineSpace from sage.schemes.berkovich.berkovich_space import (Berkovich_Cp_Affine, Berkovich_Cp_Projective, is_Berkovich_Cp, Berkovich_Element_Cp_Affine) from sage.schemes.projective.projective_space import is_ProjectiveSpace -from sage.schemes.affine.affine_space import is_AffineSpace -from sage.rings.padics.padic_base_generic import pAdicBaseGeneric -from sage.dynamics.arithmetic_dynamics.projective_ds import DynamicalSystem_projective -from sage.dynamics.arithmetic_dynamics.affine_ds import DynamicalSystem_affine -from sage.categories.number_fields import NumberFields -from sage.rings.integer_ring import ZZ -from sage.rings.rational_field import QQ -from sage.rings.infinity import Infinity -from sage.matrix.constructor import Matrix +from sage.structure.element import Element + +lazy_import('sage.rings.padics.padic_base_generic', 'pAdicBaseGeneric') + class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMetaclass): r""" diff --git a/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py b/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py index 32ccb2a9a7b..421ce1b433d 100644 --- a/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py +++ b/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py @@ -28,18 +28,20 @@ from sage.combinat.subset import Subsets from sage.matrix.constructor import matrix from sage.misc.functional import sqrt +from sage.misc.lazy_import import lazy_import from sage.misc.misc_c import prod from sage.parallel.use_fork import p_iter_fork from sage.rings.finite_rings.finite_field_constructor import GF from sage.rings.finite_rings.integer_mod_ring import Integers from sage.rings.integer_ring import ZZ -from sage.rings.number_field.number_field import NumberField from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.rational_field import QQ from sage.sets.primes import Primes from sage.sets.set import Set from sage.structure.element import is_Matrix +lazy_import('sage.rings.number_field.number_field', 'NumberField') + def automorphism_group_QQ_fixedpoints(rational_function, return_functions=False, iso_type=False): r""" diff --git a/src/sage/dynamics/arithmetic_dynamics/generic_ds.py b/src/sage/dynamics/arithmetic_dynamics/generic_ds.py index 9533e983ba6..a9a945124fd 100644 --- a/src/sage/dynamics/arithmetic_dynamics/generic_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/generic_ds.py @@ -27,17 +27,21 @@ class initialization directly. # http://www.gnu.org/licenses/ #***************************************************************************** +from copy import copy + from sage.categories.homset import End from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass -from sage.schemes.generic.morphism import SchemeMorphism_polynomial +from sage.misc.lazy_import import lazy_import +from sage.rings.finite_rings.finite_field_base import FiniteField +from sage.rings.rational_field import QQ from sage.schemes.affine.affine_space import is_AffineSpace from sage.schemes.affine.affine_subscheme import AlgebraicScheme_subscheme_affine -from sage.rings.algebraic_closure_finite_field import AlgebraicClosureFiniteField_generic -from sage.rings.finite_rings.finite_field_base import FiniteField -from sage.rings.qqbar import AlgebraicField_common from sage.schemes.berkovich.berkovich_space import is_Berkovich_Cp -from sage.rings.rational_field import QQ -from copy import copy +from sage.schemes.generic.morphism import SchemeMorphism_polynomial + +lazy_import('sage.rings.algebraic_closure_finite_field', 'AlgebraicClosureFiniteField_generic') +lazy_import('sage.rings.qqbar', 'AlgebraicField_common') + class DynamicalSystem(SchemeMorphism_polynomial, metaclass=InheritComparisonClasscallMetaclass): diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index f7af65ec347..797c33f1a03 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -76,16 +76,15 @@ class initialization directly. from sage.dynamics.arithmetic_dynamics.projective_ds_helper import ( _fast_possible_periods, _all_periodic_points) -from sage.libs.pari.all import PariError from sage.matrix.constructor import matrix, identity_matrix from sage.misc.cachefunc import cached_method from sage.misc.classcall_metaclass import typecall from sage.misc.functional import sqrt +from sage.misc.lazy_import import lazy_import from sage.misc.mrange import xmrange from sage.modules.free_module_element import vector from sage.parallel.ncpus import ncpus from sage.parallel.use_fork import p_iter_fork -from sage.rings.algebraic_closure_finite_field import AlgebraicClosureFiniteField_generic from sage.rings.complex_mpfr import ComplexField from sage.rings.finite_rings.finite_field_base import FiniteField from sage.rings.finite_rings.finite_field_constructor import GF @@ -97,12 +96,9 @@ class initialization directly. from sage.rings.integer_ring import ZZ from sage.rings.polynomial.flatten import FlatteningMorphism, UnflatteningMorphism from sage.rings.morphism import RingHomomorphism_im_gens -from sage.rings.number_field.number_field_ideal import NumberFieldFractionalIdeal -from sage.rings.padics.factory import Qp from sage.rings.polynomial.multi_polynomial_ring_base import is_MPolynomialRing from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.polynomial.polynomial_ring import is_PolynomialRing -from sage.rings.qqbar import QQbar, number_field_elements_from_algebraics from sage.rings.quotient_ring import QuotientRing_generic from sage.rings.rational_field import QQ from sage.rings.real_mpfr import RealField @@ -116,6 +112,12 @@ class initialization directly. from sage.schemes.projective.projective_subscheme import AlgebraicScheme_subscheme_projective from sage.structure.element import get_coercion_model +lazy_import('sage.libs.pari.all', 'PariError') +lazy_import('sage.rings.algebraic_closure_finite_field', 'AlgebraicClosureFiniteField_generic') +lazy_import('sage.rings.number_field.number_field_ideal', 'NumberFieldFractionalIdeal') +lazy_import('sage.rings.padics.factory', 'Qp') +lazy_import('sage.rings.qqbar', ['QQbar', 'number_field_elements_from_algebraics']) + class DynamicalSystem_projective(SchemeMorphism_polynomial_projective_space, DynamicalSystem): From 0d6869a0e2258fb5e15079a61450370cf78677b4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 2 Jul 2023 21:59:51 -0700 Subject: [PATCH 11/32] Update # optional / # needs --- .../arithmetic_dynamics/berkovich_ds.py | 324 ++--- .../product_projective_ds.py | 6 +- .../arithmetic_dynamics/projective_ds.py | 1144 ++++++++--------- 3 files changed, 737 insertions(+), 737 deletions(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py index 539a27ea7b5..eab3bcdac91 100644 --- a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py @@ -71,9 +71,9 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet We can easily create a dynamical system on Berkovich space using a dynamical system on projective space over `\QQ_p`:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_projective([2*x^2 + 4*y^2, 3*x^2 + 9*y^2]) - sage: DynamicalSystem_Berkovich(f) + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_projective([2*x^2 + 4*y^2, 3*x^2 + 9*y^2]) # needs sage.rings.padics + sage: DynamicalSystem_Berkovich(f) # needs sage.rings.padics Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -82,8 +82,8 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet Or directly from polynomials:: - sage: P. = ProjectiveSpace(Qp(3),1) - sage: DynamicalSystem_Berkovich([x^2 + y^2, y^2]) + sage: P. = ProjectiveSpace(Qp(3),1) # needs sage.rings.padics + sage: DynamicalSystem_Berkovich([x^2 + y^2, y^2]) # needs sage.rings.padics Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -91,8 +91,8 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet :class:`DynamicalSystem_Berkovich` defaults to projective:: - sage: R. = Qp(3)[] - sage: DynamicalSystem_Berkovich([x^2, y^2]) + sage: R. = Qp(3)[] # needs sage.rings.padics + sage: DynamicalSystem_Berkovich([x^2, y^2]) # needs sage.rings.padics Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -101,18 +101,18 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet To create an affine dynamical system on Berkovich space, pass an affine dynamical system to :class:`DynamicalSystem_Berkovich`:: - sage: A. = AffineSpace(Qp(3), 1) - sage: f = DynamicalSystem_affine(z^2 + 1) - sage: DynamicalSystem_Berkovich(f) + sage: A. = AffineSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_affine(z^2 + 1) # needs sage.rings.padics + sage: DynamicalSystem_Berkovich(f) # needs sage.rings.padics Dynamical system of Affine Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (z) to (z^2 + 1 + O(3^20)) ``domain`` can be used to specify the type of dynamical system:: - sage: A. = AffineSpace(Qp(3), 1) - sage: C = Berkovich_Cp_Affine(3) - sage: DynamicalSystem_Berkovich([z^2 + 1], C) + sage: A. = AffineSpace(Qp(3), 1) # needs sage.rings.padics + sage: C = Berkovich_Cp_Affine(3) # needs sage.rings.padics + sage: DynamicalSystem_Berkovich([z^2 + 1], C) # needs sage.rings.padics Dynamical system of Affine Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (z) to (z^2 + 1 + O(3^20)) @@ -120,11 +120,11 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet We can create dynamical systems which act on Berkovich spaces backed by number fields:: sage: R. = QQ[] - sage: A. = NumberField(z^2 + 1) - sage: ideal = A.prime_above(2) - sage: P. = ProjectiveSpace(A, 1) - sage: B = Berkovich_Cp_Projective(P, ideal) - sage: DynamicalSystem_Berkovich([x^2 + y^2, 2*a*x*y], B) + sage: A. = NumberField(z^2 + 1) # needs sage.rings.number_field + sage: ideal = A.prime_above(2) # needs sage.rings.padics + sage: P. = ProjectiveSpace(A, 1) # needs sage.rings.padics + sage: B = Berkovich_Cp_Projective(P, ideal) # needs sage.rings.padics + sage: DynamicalSystem_Berkovich([x^2 + y^2, 2*a*x*y], B) # needs sage.rings.number_field sage.rings.padics Dynamical system of Projective Berkovich line over Cp(2), with base Number Field in a with defining polynomial z^2 + 1 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -134,10 +134,10 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet same dynamical system more efficiently:: sage: R. = QQ[] - sage: A. = NumberField(z^2 + 1) - sage: prime_ideal = A.prime_above(2) - sage: P. = ProjectiveSpace(A, 1) - sage: DynamicalSystem_Berkovich([x^2 + y^2, 2*a*x*y], ideal=prime_ideal) + sage: A. = NumberField(z^2 + 1) # needs sage.rings.number_field + sage: prime_ideal = A.prime_above(2) # needs sage.rings.padics + sage: P. = ProjectiveSpace(A, 1) # needs sage.rings.padics + sage: DynamicalSystem_Berkovich([x^2 + y^2, 2*a*x*y], ideal=prime_ideal) # needs sage.rings.number_field sage.rings.padics Dynamical system of Projective Berkovich line over Cp(2), with base Number Field in a with defining polynomial z^2 + 1 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -146,49 +146,49 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet Creating a map on Berkovich space creates the Berkovich space it acts on:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_projective([x^2, y^2]) - sage: g = DynamicalSystem_Berkovich(f) - sage: B = g.domain(); B + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_projective([x^2, y^2]) # needs sage.rings.padics + sage: g = DynamicalSystem_Berkovich(f) # needs sage.rings.padics + sage: B = g.domain(); B # needs sage.rings.padics Projective Berkovich line over Cp(3) of precision 20 The image of type I point is the image of the center:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: F = DynamicalSystem_Berkovich([x^2, y^2]) - sage: B = F.domain() - sage: Q1 = B(2) - sage: F(Q1) + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: F = DynamicalSystem_Berkovich([x^2, y^2]) # needs sage.rings.padics + sage: B = F.domain() # needs sage.rings.padics + sage: Q1 = B(2) # needs sage.rings.padics + sage: F(Q1) # needs sage.rings.padics Type I point centered at (1 + 3 + O(3^20) : 1 + O(3^20)) For type II/III points with no poles in the corresponding disk, the image is the type II/III point corresponding to the image of the disk:: - sage: Q2 = B(0, 3) - sage: F(Q2) + sage: Q2 = B(0, 3) # needs sage.rings.padics + sage: F(Q2) # needs sage.rings.padics Type II point centered at (0 : 1 + O(3^20)) of radius 3^2 The image of any type II point can be computed:: - sage: g = DynamicalSystem_projective([x^2 + y^2, x*y]) - sage: G = DynamicalSystem_Berkovich(g) - sage: Q3 = B(0, 1) - sage: G(Q3) + sage: g = DynamicalSystem_projective([x^2 + y^2, x*y]) # needs sage.rings.padics + sage: G = DynamicalSystem_Berkovich(g) # needs sage.rings.padics + sage: Q3 = B(0, 1) # needs sage.rings.padics + sage: G(Q3) # needs sage.rings.padics Type II point centered at (0 : 1 + O(3^20)) of radius 3^0 The image of type III points can be computed has long as the corresponding disk contains no poles of the dynamical system:: - sage: Q4 = B(1/9, 1.5) - sage: G(Q4) + sage: Q4 = B(1/9, 1.5) # needs sage.rings.padics + sage: G(Q4) # needs sage.rings.padics Type III point centered at (3^-2 + 3^2 + O(3^18) : 1 + O(3^20)) of radius 1.50000000000000 Sometimes, however, the poles are contained in an extension of `\QQ_p` that Sage does not support:: - sage: H = DynamicalSystem_Berkovich([x*y^2, x^3 + 20*y^3]) + sage: H = DynamicalSystem_Berkovich([x*y^2, x^3 + 20*y^3]) # needs sage.rings.padics sage: H(Q4) # not tested Traceback (most recent call last): ... @@ -203,13 +203,13 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet sage: B = Berkovich_Cp_Projective(P, 3) sage: H = DynamicalSystem_Berkovich([x*y^2, x^3 + 20*y^3], B) sage: Q4 = B(1/9, 1.5) - sage: H(Q4) + sage: H(Q4) # needs sage.rings.number_field Type III point centered at (81/14581 : 1) of radius 0.00205761316872428 Alternatively, if checking for poles in the disk has been done already, ``type_3_pole_check`` can be set to ``False``:: - sage: P. = ProjectiveSpace(Qp(3), 1) + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics sage: H = DynamicalSystem_Berkovich([x*y^2, x^3 + 20*y^3]) sage: B = H.domain() sage: Q4 = B(1/9, 1.5) @@ -229,9 +229,9 @@ def __classcall_private__(cls, dynamical_system, domain=None, ideal=None): EXAMPLES:: - sage: R. = Qp(3)[] - sage: f = DynamicalSystem_affine(t^2 - 3) - sage: DynamicalSystem_Berkovich(f) + sage: R. = Qp(3)[] # needs sage.rings.padics + sage: f = DynamicalSystem_affine(t^2 - 3) # needs sage.rings.padics + sage: DynamicalSystem_Berkovich(f) # needs sage.rings.padics Dynamical system of Affine Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending ((1 + O(3^20))*t) to ((1 + O(3^20))*t^2 + 2*3 + 2*3^2 + 2*3^3 + 2*3^4 + 2*3^5 + 2*3^6 + @@ -289,10 +289,10 @@ def __init__(self, dynamical_system, domain): TESTS:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_projective([2*x^2 + 4*y^2, 3*x^2 + 9*y^2]) - sage: g = DynamicalSystem_Berkovich(f) - sage: isinstance(g, DynamicalSystem_Berkovich) + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_projective([2*x^2 + 4*y^2, 3*x^2 + 9*y^2]) # needs sage.rings.padics + sage: g = DynamicalSystem_Berkovich(f) # needs sage.rings.padics + sage: isinstance(g, DynamicalSystem_Berkovich) # needs sage.rings.padics True """ self._system = dynamical_system @@ -304,15 +304,15 @@ def __eq__(self, other): EXAMPLES:: - sage: R. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_Berkovich([x^2, y^2]) - sage: f == f + sage: R. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_Berkovich([x^2, y^2]) # needs sage.rings.padics + sage: f == f # needs sage.rings.padics True :: - sage: g = DynamicalSystem_Berkovich([x^3, x*y^2]) - sage: f == g + sage: g = DynamicalSystem_Berkovich([x^3, x*y^2]) # needs sage.rings.padics + sage: f == g # needs sage.rings.padics True """ if not isinstance(other, type(self)): @@ -325,15 +325,15 @@ def __neq__(self, other): EXAMPLES:: - sage: R. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_Berkovich([x^2, y^2]) - sage: f != f + sage: R. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_Berkovich([x^2, y^2]) # needs sage.rings.padics + sage: f != f # needs sage.rings.padics False :: - sage: g = DynamicalSystem_Berkovich([x^2 + y^2, y^2]) - sage: f != g + sage: g = DynamicalSystem_Berkovich([x^2 + y^2, y^2]) # needs sage.rings.padics + sage: f != g # needs sage.rings.padics True """ return not (self == other) @@ -346,10 +346,10 @@ def domain(self): EXAMPLES:: - sage: Q. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_projective([3*x^2, 2*y^2]) - sage: g = DynamicalSystem_Berkovich(f) - sage: g.domain() + sage: Q. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_projective([3*x^2, 2*y^2]) # needs sage.rings.padics + sage: g = DynamicalSystem_Berkovich(f) # needs sage.rings.padics + sage: g.domain() # needs sage.rings.padics Projective Berkovich line over Cp(3) of precision 20 """ return self._domain @@ -362,9 +362,9 @@ def as_scheme_dynamical_system(self): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_Berkovich([x^2 + y^2, x*y]) - sage: f.as_scheme_dynamical_system() + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_Berkovich([x^2 + y^2, x*y]) # needs sage.rings.padics + sage: f.as_scheme_dynamical_system() # 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 (x^2 + y^2 : x*y) @@ -384,10 +384,10 @@ def __getitem__(self, i): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_projective([x^2 + y^2, 2*y^2]) - sage: g = DynamicalSystem_Berkovich(f) - sage: g[0] + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_projective([x^2 + y^2, 2*y^2]) # needs sage.rings.padics + sage: g = DynamicalSystem_Berkovich(f) # needs sage.rings.padics + sage: g[0] # needs sage.rings.padics x^2 + y^2 """ return self._system._polys[i] @@ -401,10 +401,10 @@ def defining_polynomials(self): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_projective([2*x^2 + 4*y^2, 3*x^2 + 9*y^2]) - sage: g = DynamicalSystem_Berkovich(f) - sage: g.defining_polynomials() + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_projective([2*x^2 + 4*y^2, 3*x^2 + 9*y^2]) # needs sage.rings.padics + sage: g = DynamicalSystem_Berkovich(f) # needs sage.rings.padics + sage: g.defining_polynomials() # needs sage.rings.padics ((2 + O(3^20))*x^2 + (1 + 3 + O(3^20))*y^2, (3 + O(3^21))*x^2 + (3^2 + O(3^22))*y^2) """ @@ -418,18 +418,18 @@ def base_ring(self): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_Berkovich([x^2 + y^2, y^2]) - sage: f.base_ring() + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_Berkovich([x^2 + y^2, y^2]) # needs sage.rings.padics + sage: f.base_ring() # needs sage.rings.padics 3-adic Field with capped relative precision 20 :: sage: R. = QQ[] - sage: A. = NumberField(z^3 + 20) - sage: P. = ProjectiveSpace(A, 1) - sage: f = DynamicalSystem_Berkovich([x^2, x^2 + y^2], ideal=A.prime_above(2)) - sage: f.base_ring() + sage: A. = NumberField(z^3 + 20) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(A, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_Berkovich([x^2, x^2 + y^2], ideal=A.prime_above(2)) # needs sage.rings.number_field + sage: f.base_ring() # needs sage.rings.padics Number Field in a with defining polynomial z^3 + 20 """ return self.domain().base_ring() @@ -442,10 +442,10 @@ def _repr_(self): EXAMPLES:: - sage: Q. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_projective([3*x^2, 2*y^2]) - sage: f = DynamicalSystem_Berkovich(f) - sage: f._repr_() + sage: Q. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_projective([3*x^2, 2*y^2]) # needs sage.rings.padics + sage: f = DynamicalSystem_Berkovich(f) # needs sage.rings.padics + sage: f._repr_() # needs sage.rings.padics 'Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map\n Defn: Defined on coordinates by sending (x : y) to\n ((3 + O(3^21))*x^2 : (2 + O(3^20))*y^2)' """ @@ -479,9 +479,9 @@ class DynamicalSystem_Berkovich_projective(DynamicalSystem_Berkovich): We can easily create a dynamical system on Berkovich space using a dynamical system on projective space over `\QQ_p`:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_projective([1/2*x^2 + x*y + 3*y^2, 3*x^2 + 9*y^2]) - sage: DynamicalSystem_Berkovich(f) + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_projective([1/2*x^2 + x*y + 3*y^2, 3*x^2 + 9*y^2]) # needs sage.rings.padics + sage: DynamicalSystem_Berkovich(f) # needs sage.rings.padics Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -491,17 +491,17 @@ class DynamicalSystem_Berkovich_projective(DynamicalSystem_Berkovich): Or from a morphism:: - sage: P1. = ProjectiveSpace(Qp(3), 1) - sage: H = End(P1) - sage: DynamicalSystem_Berkovich(H([y, x])) + sage: P1. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: H = End(P1) # needs sage.rings.padics + sage: DynamicalSystem_Berkovich(H([y, x])) # needs sage.rings.padics Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to (y : x) Or from polynomials:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: DynamicalSystem_Berkovich([x^2+y^2, y^2]) + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: DynamicalSystem_Berkovich([x^2+y^2, y^2]) # needs sage.rings.padics Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to (x^2 + y^2 : y^2) @@ -513,9 +513,9 @@ def __classcall_private__(cls, dynamical_system, domain=None): EXAMPLES:: - sage: P1. = ProjectiveSpace(Qp(3), 1) + sage: P1. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics sage: from sage.dynamics.arithmetic_dynamics.berkovich_ds import DynamicalSystem_Berkovich_projective - sage: DynamicalSystem_Berkovich_projective([y, x]) + sage: DynamicalSystem_Berkovich_projective([y, x]) # needs sage.rings.padics Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to (y : x) @@ -551,8 +551,8 @@ def __init__(self, dynamical_system, domain=None): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: DynamicalSystem_Berkovich([x^2 + x*y + 2*y^2, 2*x*y]) + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: DynamicalSystem_Berkovich([x^2 + x*y + 2*y^2, 2*x*y]) # needs sage.rings.padics Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -572,9 +572,9 @@ def scale_by(self, t): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_Berkovich([x^2, y^2]) - sage: f.scale_by(x); f + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_Berkovich([x^2, y^2]) # needs sage.rings.padics + sage: f.scale_by(x); f # needs sage.rings.padics Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to (x^3 : x*y^2) @@ -582,12 +582,12 @@ def scale_by(self, t): :: sage: Q. = QQ[] - sage: A. = NumberField(z^3 + 20) - sage: ideal = A.prime_above(3) - sage: P. = ProjectiveSpace(A, 1) - sage: B = Berkovich_Cp_Projective(P, ideal) - sage: f = DynamicalSystem_Berkovich([x^2 + y^2, 2*x*y], B) - sage: f.scale_by(2); f + sage: A. = NumberField(z^3 + 20) # needs sage.rings.number_field + sage: ideal = A.prime_above(3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(A, 1) # needs sage.rings.number_field + sage: B = Berkovich_Cp_Projective(P, ideal) # needs sage.rings.number_field sage.rings.padics + sage: f = DynamicalSystem_Berkovich([x^2 + y^2, 2*x*y], B) # needs sage.rings.number_field sage.rings.padics + sage: f.scale_by(2); f # needs sage.rings.padics Dynamical system of Projective Berkovich line over Cp(3), with base Number Field in a with defining polynomial z^3 + 20 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -603,9 +603,9 @@ def normalize_coordinates(self): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_Berkovich([2*x^2, 2*y^2]) - sage: f.normalize_coordinates(); f + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_Berkovich([2*x^2, 2*y^2]) # needs sage.rings.padics + sage: f.normalize_coordinates(); f # needs sage.rings.padics Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to (x^2 : y^2) @@ -613,7 +613,7 @@ def normalize_coordinates(self): Normalize_coordinates may sometimes fail over p-adic fields:: - sage: g = DynamicalSystem_Berkovich([2*x^2, x*y]) + sage: g = DynamicalSystem_Berkovich([2*x^2, x*y]) # needs sage.rings.padics sage: g.normalize_coordinates() #not tested Traceback (most recent call last): ... @@ -656,10 +656,10 @@ def conjugate(self, M, adjugate=False, new_ideal=None): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_projective([x^2 + y^2, 2*y^2]) - sage: g = DynamicalSystem_Berkovich(f) - sage: g.conjugate(Matrix([[1, 1], [0, 1]])) + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_projective([x^2 + y^2, 2*y^2]) # needs sage.rings.padics + sage: g = DynamicalSystem_Berkovich(f) # needs sage.rings.padics + sage: g.conjugate(Matrix([[1, 1], [0, 1]])) # needs sage.rings.padics Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -670,9 +670,9 @@ def conjugate(self, M, adjugate=False, new_ideal=None): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_Berkovich([x^2 + y^2, y^2], ideal=5) sage: R. = QQ[] - sage: A. = NumberField(z^2 + 1) - sage: conj = Matrix([[1, a], [0, 1]]) - sage: f.conjugate(conj) + sage: A. = NumberField(z^2 + 1) # needs sage.rings.number_field + sage: conj = Matrix([[1, a], [0, 1]]) # needs sage.rings.number_field + sage: f.conjugate(conj) # needs sage.rings.number_field Dynamical system of Projective Berkovich line over Cp(5), with base Number Field in a with defining polynomial z^2 + 1 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -682,10 +682,10 @@ def conjugate(self, M, adjugate=False, new_ideal=None): the base ring of ``M`` and of this dynamical system are not the same:: - sage: ideal = A.ideal(5).factor()[1][0]; ideal + sage: ideal = A.ideal(5).factor()[1][0]; ideal # needs sage.rings.number_field Fractional ideal (2*a + 1) - sage: g = f.conjugate(conj, new_ideal=ideal) - sage: g.domain().ideal() + sage: g = f.conjugate(conj, new_ideal=ideal) # needs sage.rings.number_field + sage: g.domain().ideal() # needs sage.rings.padics Fractional ideal (2*a + 1) """ if self.domain().is_padic_base(): @@ -718,18 +718,18 @@ def resultant(self, normalize=False): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_Berkovich([x^2 + y^2, y^2]) - sage: f.resultant() + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_Berkovich([x^2 + y^2, y^2]) # needs sage.rings.padics + sage: f.resultant() # needs sage.rings.padics 1 + O(3^20) :: sage: R. = QQ[] - sage: A. = NumberField(z^3 + 20) - sage: P. = ProjectiveSpace(A, 1) - sage: f = DynamicalSystem_Berkovich([2*x^2, x^2 + y^2], ideal=A.prime_above(2)) - sage: f.resultant() + sage: A. = NumberField(z^3 + 20) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(A, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_Berkovich([2*x^2, x^2 + y^2], ideal=A.prime_above(2)) # needs sage.rings.number_field + sage: f.resultant() # needs sage.rings.padics 4 """ return self._system.resultant(normalize=normalize) @@ -750,10 +750,10 @@ def dehomogenize(self, n): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_projective([x^2 + y^2, x*y + y^2]) - sage: g = DynamicalSystem_Berkovich(f) - sage: g.dehomogenize(1) + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_projective([x^2 + y^2, x*y + y^2]) # needs sage.rings.padics + sage: g = DynamicalSystem_Berkovich(f) # needs sage.rings.padics + sage: g.dehomogenize(1) # needs sage.rings.padics Dynamical system of Affine Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x) to @@ -783,21 +783,21 @@ def __call__(self, x, type_3_pole_check=True): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: g = DynamicalSystem_projective([x^2 + y^2, x*y]) - sage: G = DynamicalSystem_Berkovich(g) - sage: B = G.domain() - sage: Q3 = B(0, 1) - sage: G(Q3) + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: g = DynamicalSystem_projective([x^2 + y^2, x*y]) # needs sage.rings.padics + sage: G = DynamicalSystem_Berkovich(g) # needs sage.rings.padics + sage: B = G.domain() # needs sage.rings.padics + sage: Q3 = B(0, 1) # needs sage.rings.padics + sage: G(Q3) # needs sage.rings.padics Type II point centered at (0 : 1 + O(3^20)) of radius 3^0 :: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: H = DynamicalSystem_Berkovich([x*y^2, x^3 + 20*y^3]) - sage: B = H.domain() - sage: Q4 = B(1/9, 1.5) - sage: H(Q4, False) + sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: H = DynamicalSystem_Berkovich([x*y^2, x^3 + 20*y^3]) # needs sage.rings.padics + sage: B = H.domain() # needs sage.rings.padics + sage: Q4 = B(1/9, 1.5) # needs sage.rings.padics + sage: H(Q4, False) # needs sage.rings.padics Type III point centered at (3^4 + 3^10 + 2*3^11 + 2*3^13 + 2*3^14 + 2*3^15 + 3^17 + 2*3^18 + 2*3^19 + 3^20 + 3^21 + 3^22 + O(3^24) : 1 + O(3^20)) of radius 0.00205761316872428 @@ -972,17 +972,17 @@ class DynamicalSystem_Berkovich_affine(DynamicalSystem_Berkovich): induced by a dynamical system on `\QQ_p` or an extension of `\QQ_p`:: - sage: A. = AffineSpace(Qp(5), 1) - sage: f = DynamicalSystem_affine([(x^2 + 1)/x]) - sage: DynamicalSystem_Berkovich(f) + sage: A. = AffineSpace(Qp(5), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_affine([(x^2 + 1)/x]) # needs sage.rings.padics + sage: DynamicalSystem_Berkovich(f) # needs sage.rings.padics Dynamical system of Affine Berkovich line over Cp(5) of precision 20 induced by the map Defn: Defined on coordinates by sending (x) to ((x^2 + 1 + O(5^20))/x) Dynamical system can be created from a morphism:: - sage: H = End(A) - sage: phi = H([x + 3]) - sage: DynamicalSystem_Berkovich(phi) + sage: H = End(A) # needs sage.rings.padics + sage: phi = H([x + 3]) # needs sage.rings.padics + sage: DynamicalSystem_Berkovich(phi) # needs sage.rings.padics Dynamical system of Affine Berkovich line over Cp(5) of precision 20 induced by the map Defn: Defined on coordinates by sending (x) to (x + 3 + O(5^20)) """ @@ -993,9 +993,9 @@ def __classcall_private__(cls, dynamical_system, domain=None): EXAMPLES:: - sage: A. = AffineSpace(Qp(3), 1) + sage: A. = AffineSpace(Qp(3), 1) # needs sage.rings.padics sage: from sage.dynamics.arithmetic_dynamics.berkovich_ds import DynamicalSystem_Berkovich_affine - sage: DynamicalSystem_Berkovich_affine(DynamicalSystem_affine(x^2)) + sage: DynamicalSystem_Berkovich_affine(DynamicalSystem_affine(x^2)) # needs sage.rings.padics Dynamical system of Affine Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x) to (x^2) @@ -1027,9 +1027,9 @@ def __init__(self, dynamical_system, domain): EXAMPLES:: - sage: A. = AffineSpace(Qp(3), 1) + sage: A. = AffineSpace(Qp(3), 1) # needs sage.rings.padics sage: from sage.dynamics.arithmetic_dynamics.berkovich_ds import DynamicalSystem_Berkovich_affine - sage: DynamicalSystem_Berkovich_affine(DynamicalSystem_affine(x^3)) + sage: DynamicalSystem_Berkovich_affine(DynamicalSystem_affine(x^3)) # needs sage.rings.padics Dynamical system of Affine Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x) to (x^3) @@ -1053,10 +1053,10 @@ def homogenize(self, n): EXAMPLES:: - sage: A. = AffineSpace(Qp(3), 1) - sage: f = DynamicalSystem_affine(1/x) - sage: f = DynamicalSystem_Berkovich(f) - sage: f.homogenize(1) + sage: A. = AffineSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_affine(1/x) # needs sage.rings.padics + sage: f = DynamicalSystem_Berkovich(f) # needs sage.rings.padics + sage: f.homogenize(1) # needs sage.rings.padics Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x0 : x1) to (x1 : x0) @@ -1073,12 +1073,12 @@ def __call__(self, x): EXAMPLES:: - sage: P. = AffineSpace(Qp(3), 1) - sage: f = DynamicalSystem_affine(x^2) - sage: g = DynamicalSystem_Berkovich(f) - sage: B = g.domain() - sage: Q1 = B(2) - sage: g(Q1) + sage: P. = AffineSpace(Qp(3), 1) # needs sage.rings.padics + sage: f = DynamicalSystem_affine(x^2) # needs sage.rings.padics + sage: g = DynamicalSystem_Berkovich(f) # needs sage.rings.padics + sage: B = g.domain() # needs sage.rings.padics + sage: Q1 = B(2) # needs sage.rings.padics + sage: g(Q1) # needs sage.rings.padics Type I point centered at 1 + 3 + O(3^20) """ if not isinstance(x, Berkovich_Element_Cp_Affine): diff --git a/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py index c1f3a41c15e..25b9f3704d7 100644 --- a/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py @@ -305,21 +305,21 @@ def cyclegraph(self): sage: P. = ProductProjectiveSpaces(GF(3), [1,1]) sage: f = DynamicalSystem_projective([a^2, b^2, c^2, d^2], domain=P) - sage: f.cyclegraph() + sage: f.cyclegraph() # needs sage.graphs Looped digraph on 16 vertices :: sage: P. = ProductProjectiveSpaces(GF(5), [1,1]) sage: f = DynamicalSystem_projective([a^2, b^2, c, d], domain=P) - sage: f.cyclegraph() + sage: f.cyclegraph() # needs sage.graphs Looped digraph on 36 vertices :: sage: P. = ProductProjectiveSpaces(GF(2), [1,2]) sage: f = DynamicalSystem_projective([a^2, b^2, c, d, e], domain=P) - sage: f.cyclegraph() + sage: f.cyclegraph() # needs sage.graphs Looped digraph on 21 vertices .. TODO:: Dynamical systems for subschemes of product projective spaces needs work. diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index 797c33f1a03..624463f5bfa 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -195,8 +195,8 @@ class DynamicalSystem_projective(SchemeMorphism_polynomial_projective_space, Symbolic Ring elements are not allowed:: - sage: x,y = var('x,y') # optional - sage.symbolic - sage: DynamicalSystem_projective([x^2, y^2]) # optional - sage.symbolic + sage: x,y = var('x,y') # needs sage.symbolic + sage: DynamicalSystem_projective([x^2, y^2]) # needs sage.symbolic Traceback (most recent call last): ... ValueError: [x^2, y^2] must be elements of a polynomial ring @@ -225,8 +225,8 @@ class DynamicalSystem_projective(SchemeMorphism_polynomial_projective_space, sage: P. = ProjectiveSpace(CC, 2) sage: X = P.subscheme([x - y]) - sage: u,v,w = X.coordinate_ring().gens() - sage: DynamicalSystem_projective([u^2, v^2, w*u], domain=X) + sage: u,v,w = X.coordinate_ring().gens() # needs sage.rings.function_field + sage: DynamicalSystem_projective([u^2, v^2, w*u], domain=X) # needs sage.rings.function_field Dynamical System of Closed subscheme of Projective Space of dimension 2 over Complex Field with 53 bits of precision defined by: x - y @@ -242,7 +242,7 @@ class DynamicalSystem_projective(SchemeMorphism_polynomial_projective_space, sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([(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.rings.function_field Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: y - z @@ -251,7 +251,7 @@ class DynamicalSystem_projective(SchemeMorphism_polynomial_projective_space, 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(P.subscheme([x, y, z])) + sage: f(P.subscheme([x, y, z])) # needs sage.rings.function_field Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: w, @@ -268,11 +268,11 @@ class DynamicalSystem_projective(SchemeMorphism_polynomial_projective_space, :: - sage: K. = QuadraticField(-7) - sage: P. = ProjectiveSpace(K, 1) - sage: f = DynamicalSystem([x^3 + v*x*y^2, y^3]) - sage: fbar = f.change_ring(QQbar) - sage: fbar.is_postcritically_finite() + sage: K. = QuadraticField(-7) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem([x^3 + v*x*y^2, y^3]) # needs sage.rings.number_field + sage: fbar = f.change_ring(QQbar) # needs sage.rings.number_field + sage: fbar.is_postcritically_finite() # needs sage.rings.number_field False """ @@ -296,7 +296,7 @@ def __classcall_private__(cls, morphism_or_polys, domain=None, names=None): :: - sage: DynamicalSystem_projective([exp(x), exp(y)]) # optional - sage.symbolic + sage: DynamicalSystem_projective([exp(x), exp(y)]) # needs sage.symbolic Traceback (most recent call last): ... ValueError: [e^x, e^y] must be elements of a polynomial ring @@ -502,9 +502,9 @@ def _number_field_from_algebraics(self): EXAMPLES:: - sage: P. = ProjectiveSpace(QQbar,1) - sage: f = DynamicalSystem_projective([x^2 + QQbar(sqrt(2)) * y^2, y^2]) # optional - sage.symbolic - sage: f._number_field_from_algebraics() # optional - sage.symbolic + sage: P. = ProjectiveSpace(QQbar,1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([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 Dynamical System of Projective Space of dimension 1 over Number Field in a with defining polynomial y^2 - 2 with a = 1.414213562373095? Defn: Defined on coordinates by sending (x : y) to @@ -615,21 +615,21 @@ def dynatomic_polynomial(self, period): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) - sage: f.dynatomic_polynomial(2) + sage: f.dynatomic_polynomial(2) # needs sage.libs.pari x^2 + x*y + 2*y^2 :: sage: P. = ProjectiveSpace(ZZ,1) sage: f = DynamicalSystem_projective([x^2 + y^2, x*y]) - sage: f.dynatomic_polynomial(4) + sage: f.dynatomic_polynomial(4) # needs sage.libs.pari 2*x^12 + 18*x^10*y^2 + 57*x^8*y^4 + 79*x^6*y^6 + 48*x^4*y^8 + 12*x^2*y^10 + y^12 :: sage: P. = ProjectiveSpace(CC,1) sage: f = DynamicalSystem_projective([x^2 + y^2, 3*x*y]) - sage: f.dynatomic_polynomial(3) + sage: f.dynatomic_polynomial(3) # needs sage.libs.pari 13.0000000000000*x^6 + 117.000000000000*x^4*y^2 + 78.0000000000000*x^2*y^4 + y^6 @@ -644,7 +644,7 @@ def dynatomic_polynomial(self, period): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2 - 29/16*y^2, y^2]) - sage: f.dynatomic_polynomial([2,3]) + sage: f.dynatomic_polynomial([2,3]) # needs sage.libs.pari x^12 - 95/8*x^10*y^2 + 13799/256*x^8*y^4 - 119953/1024*x^6*y^6 + 8198847/65536*x^4*y^8 - 31492431/524288*x^2*y^10 + 172692729/16777216*y^12 @@ -653,14 +653,14 @@ def dynatomic_polynomial(self, period): sage: P. = ProjectiveSpace(ZZ,1) sage: f = DynamicalSystem_projective([x^2 - y^2, y^2]) - sage: f.dynatomic_polynomial([1,2]) + sage: f.dynatomic_polynomial([1,2]) # needs sage.libs.pari x^2 - x*y :: sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^3 - y^3, 3*x*y^2]) - sage: f.dynatomic_polynomial([0,4])==f.dynatomic_polynomial(4) + sage: f.dynatomic_polynomial([0,4])==f.dynatomic_polynomial(4) # needs sage.libs.pari True :: @@ -674,9 +674,9 @@ def dynatomic_polynomial(self, period): :: - sage: P. = ProjectiveSpace(Qp(5),1) - sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) - sage: f.dynatomic_polynomial(2) + sage: P. = ProjectiveSpace(Qp(5),1) # needs sage.rings.padics + sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) # needs sage.rings.padics + sage: f.dynatomic_polynomial(2) # needs sage.rings.padics (x^4*y + (2 + O(5^20))*x^2*y^3 - x*y^4 + (2 + O(5^20))*y^5)/(x^2*y - x*y^2 + y^3) :: @@ -684,7 +684,7 @@ def dynatomic_polynomial(self, period): sage: L. = PolynomialRing(QQ) sage: P. = ProjectiveSpace(L,1) sage: f = DynamicalSystem_projective([x^2 + t*y^2, y^2]) - sage: f.dynatomic_polynomial(2) + sage: f.dynatomic_polynomial(2) # needs sage.libs.pari x^2 + x*y + (t + 1)*y^2 :: @@ -692,17 +692,17 @@ def dynatomic_polynomial(self, period): sage: K. = PolynomialRing(ZZ) sage: P. = ProjectiveSpace(K,1) sage: f = DynamicalSystem_projective([x^2 + c*y^2, y^2]) - sage: f.dynatomic_polynomial([1, 2]) + sage: f.dynatomic_polynomial([1, 2]) # needs sage.libs.pari x^2 - x*y + (c + 1)*y^2 :: sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) - sage: f.dynatomic_polynomial(2) + sage: f.dynatomic_polynomial(2) # needs sage.libs.pari x^2 + x*y + 2*y^2 sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(X^2 + X + 2) + sage: K. = NumberField(X^2 + X + 2) # needs sage.rings.number_field sage: PP = P.change_ring(K) sage: ff = f.change_ring(K) sage: p = PP((c, 1)) @@ -713,21 +713,21 @@ def dynatomic_polynomial(self, period): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2 + y^2, x*y]) - sage: f.dynatomic_polynomial([2, 2]) + sage: f.dynatomic_polynomial([2, 2]) # needs sage.libs.pari x^4 + 4*x^2*y^2 + y^4 sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(X^4 + 4*X^2 + 1) + sage: K. = NumberField(X^4 + 4*X^2 + 1) # needs sage.rings.number_field sage: PP = P.change_ring(K) sage: ff = f.change_ring(K) sage: p = PP((c, 1)) - sage: ff.nth_iterate(p, 4) == ff.nth_iterate(p, 2) + sage: ff.nth_iterate(p, 4) == ff.nth_iterate(p, 2) # needs sage.rings.number_field True :: sage: P. = ProjectiveSpace(CC, 1) sage: f = DynamicalSystem_projective([x^2 - CC.0/3*y^2, y^2]) - sage: f.dynatomic_polynomial(2) + sage: f.dynatomic_polynomial(2) # needs sage.libs.pari (x^4*y + (-0.666666666666667*I)*x^2*y^3 - x*y^4 + (-0.111111111111111 - 0.333333333333333*I)*y^5)/(x^2*y - x*y^2 + (-0.333333333333333*I)*y^3) @@ -736,15 +736,15 @@ def dynatomic_polynomial(self, period): sage: P. = ProjectiveSpace(CC, 1) sage: f = DynamicalSystem_projective([x^2 - CC.0/5*y^2, y^2]) - sage: f.dynatomic_polynomial(2) + sage: f.dynatomic_polynomial(2) # needs sage.libs.pari x^2 + x*y + (1.00000000000000 - 0.200000000000000*I)*y^2 :: - sage: L. = PolynomialRing(QuadraticField(2).maximal_order()) + sage: L. = PolynomialRing(QuadraticField(2).maximal_order()) # needs sage.rings.number_field sage: P. = ProjectiveSpace(L.fraction_field(), 1) sage: f = DynamicalSystem_projective([x^2 + (t^2 + 1)*y^2, y^2]) - sage: f.dynatomic_polynomial(2) + sage: f.dynatomic_polynomial(2) # needs sage.libs.pari sage.rings.number_field x^2 + x*y + (t^2 + 2)*y^2 :: @@ -759,18 +759,18 @@ def dynatomic_polynomial(self, period): We check that the dynatomic polynomial has the right parent (see :trac:`18409`):: - sage: P. = ProjectiveSpace(QQbar,1) + sage: P. = ProjectiveSpace(QQbar,1) # needs sage.rings.number_field sage: f = DynamicalSystem_projective([x^2 - 1/3*y^2, y^2]) - sage: f.dynatomic_polynomial(2).parent() + sage: f.dynatomic_polynomial(2).parent() # needs sage.libs.pari Multivariate Polynomial Ring in x, y over Algebraic Field :: - sage: T. = QuadraticField(33) + sage: T. = QuadraticField(33) # needs sage.rings.number_field sage: S. = PolynomialRing(T) sage: P. = ProjectiveSpace(FractionField(S),1) sage: f = DynamicalSystem_projective([t*x^2 - 1/t*y^2, y^2]) - sage: f.dynatomic_polynomial([1, 2]).parent() + sage: f.dynatomic_polynomial([1, 2]).parent() # needs sage.libs.pari Multivariate Polynomial Ring in x, y over Fraction Field of Univariate Polynomial Ring in t over Number Field in v with defining polynomial x^2 - 33 with v = 5.744562646538029? @@ -786,7 +786,7 @@ def dynatomic_polynomial(self, period): sage: R. = QQ[] sage: P. = ProjectiveSpace(R,1) sage: f = DynamicalSystem_projective([x^2 + c*y^2, y^2]) - sage: f.dynatomic_polynomial([1,2]).parent() + sage: f.dynatomic_polynomial([1,2]).parent() # needs sage.libs.pari Multivariate Polynomial Ring in x, y over Univariate Polynomial Ring in c over Rational Field @@ -795,7 +795,7 @@ def dynatomic_polynomial(self, period): sage: R. = QQ[] sage: P. = ProjectiveSpace(ZZ,1) sage: f = DynamicalSystem_projective([x^2 + y^2, (1)*y^2 + (1)*x*y]) - sage: f.dynatomic_polynomial([1,2]).parent() + sage: f.dynatomic_polynomial([1,2]).parent() # needs sage.libs.pari Multivariate Polynomial Ring in x, y over Integer Ring :: @@ -816,7 +816,7 @@ def dynatomic_polynomial(self, period): sage: R. = QQ[] sage: P. = ProjectiveSpace(R,1) sage: f = DynamicalSystem_projective([x^2 + c*y^2, y^2]) - sage: f.dynatomic_polynomial([1,2]).parent() + sage: f.dynatomic_polynomial([1,2]).parent() # needs sage.libs.pari Multivariate Polynomial Ring in x, y over Univariate Polynomial Ring in c over Rational Field @@ -825,13 +825,13 @@ def dynatomic_polynomial(self, period): sage: S. = FunctionField(CC) sage: P. = ProjectiveSpace(S,1) sage: f = DynamicalSystem_projective([t*x^2-1*y^2, t*y^2]) - sage: f.dynatomic_polynomial([1, 2]).parent() + sage: f.dynatomic_polynomial([1, 2]).parent() # needs sage.libs.pari Symbolic Ring :: sage: R. = PolynomialRing(QQ) - sage: S = R.quo(R.ideal(y^2-x+1)) + sage: S = R.quo(R.ideal(y^2 - x + 1)) sage: P. = ProjectiveSpace(FractionField(S),1) sage: f = DynamicalSystem_projective([u^2 + S(x^2)*v^2, v^2]) sage: dyn = f.dynatomic_polynomial([1,1]); dyn @@ -936,7 +936,7 @@ def nth_iterate_map(self, n, normalize=False): :: sage: P. = ProjectiveSpace(ZZ,2) - sage: f = DynamicalSystem_projective([x^2-y^2, x*y, z^2+x^2]) + sage: f = DynamicalSystem_projective([x^2 - y^2, x*y, z^2 + x^2]) sage: f.nth_iterate_map(2) Dynamical System of Projective Space of dimension 2 over Integer Ring Defn: Defined on coordinates by sending (x : y : z) to @@ -948,7 +948,7 @@ def nth_iterate_map(self, n, normalize=False): sage: P. = ProjectiveSpace(QQ,2) sage: X = P.subscheme(x*z-y^2) sage: f = DynamicalSystem_projective([x^2, x*z, z^2], domain=X) - sage: f.nth_iterate_map(2) + sage: f.nth_iterate_map(2) # needs sage.rings.function_field Dynamical System of Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: -y^2 + x*z @@ -1179,11 +1179,11 @@ def arakelov_zhang_pairing(self, g, **kwds): EXAMPLES:: - sage: K. = CyclotomicField(3) - sage: P. = ProjectiveSpace(K, 1) - sage: f = DynamicalSystem_projective([x^2 + (2*k + 2)*y^2, y^2]) - sage: g = DynamicalSystem_projective([x^2, y^2]) - sage: pairingval = f.arakelov_zhang_pairing(g, n=5); pairingval + sage: K. = CyclotomicField(3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 + (2*k + 2)*y^2, y^2]) # needs sage.rings.number_field + sage: g = DynamicalSystem_projective([x^2, y^2]) # needs sage.rings.number_field + sage: pairingval = f.arakelov_zhang_pairing(g, n=5); pairingval # needs sage.rings.number_field 0.409598197761958 :: @@ -1191,12 +1191,12 @@ def arakelov_zhang_pairing(self, g, **kwds): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 + 4*y^2, y^2]) sage: g = DynamicalSystem_projective([x^2, y^2]) - sage: pairingval = f.arakelov_zhang_pairing(g, n=6); pairingval + sage: pairingval = f.arakelov_zhang_pairing(g, n=6); pairingval # needs sage.rings.function_field 0.750178391443644 sage: # Compare to the exact value: - sage: dynheight = f.canonical_height(P(0, 1)); dynheight + sage: dynheight = f.canonical_height(P(0, 1)); dynheight # needs sage.libs.pari 0.75017839144364417318023000563 - sage: dynheight - pairingval + sage: dynheight - pairingval # needs sage.libs.pari sage.rings.function_field 0.000000000000000 Notice that if we set the noise_multiplier to 0, the accuracy is diminished:: @@ -1204,12 +1204,12 @@ def arakelov_zhang_pairing(self, g, **kwds): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 + 4*y^2, y^2]) sage: g = DynamicalSystem_projective([x^2, y^2]) - sage: pairingval = f.arakelov_zhang_pairing(g, n=6, noise_multiplier=0) + sage: pairingval = f.arakelov_zhang_pairing(g, n=6, noise_multiplier=0) # needs sage.rings.function_field sage: pairingval 0.650660018921632 - sage: dynheight = f.canonical_height(P(0, 1)); dynheight + sage: dynheight = f.canonical_height(P(0, 1)); dynheight # needs sage.libs.pari 0.75017839144364417318023000563 - sage: pairingval - dynheight + sage: pairingval - dynheight # needs sage.libs.pari sage.rings.function_field -0.0995183725220122 We compute the example of Prop. 18(d) from Petsche, Szpiro and Tucker:: @@ -1217,29 +1217,29 @@ def arakelov_zhang_pairing(self, g, **kwds): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([y^2 - (y - x)^2, y^2]) sage: g = DynamicalSystem_projective([x^2, y^2]) - sage: f.arakelov_zhang_pairing(g) + sage: f.arakelov_zhang_pairing(g) # needs sage.rings.function_field 0.326954667248466 sage: # Correct value should be = 0.323067... - sage: f.arakelov_zhang_pairing(g, n=9) # long time + sage: f.arakelov_zhang_pairing(g, n=9) # long time # needs sage.rings.function_field 0.323091061918965 - sage: _ - 0.323067 # long time + sage: _ - 0.323067 # long time # needs sage.rings.function_field 0.0000240619189654789 Also from Prop. 18 of Petsche, Szpiro and Tucker, includes places of bad reduction:: sage: R. = PolynomialRing(ZZ) - sage: K. = NumberField(z^3 - 11) - sage: P. = ProjectiveSpace(K,1) - sage: a = 7/(b - 1) - sage: f = DynamicalSystem_projective([a*y^2 - (a*y - x)^2, y^2]) + sage: K. = NumberField(z^3 - 11) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field + sage: a = 7/(b - 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: g = DynamicalSystem_projective([x^2, y^2]) If all archimedean absolute values of a have modulus > 2, then the pairing should be h(a).:: - sage: f.arakelov_zhang_pairing(g, n=6) # long time + sage: f.arakelov_zhang_pairing(g, n=6) # long time # needs sage.rings.number_field 1.93846423207664 - sage: _ - a.global_height() # long time + sage: _ - a.global_height() # long time # needs sage.rings.number_field -0.00744591697867292 """ n = kwds.pop('n', 5) @@ -1421,7 +1421,7 @@ def degree_sequence(self, iterates=2): sage: P2. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([Z^2, X*Y, Y^2]) - sage: f.degree_sequence(15) + sage: f.degree_sequence(15) # needs sage.rings.function_field [2, 3, 5, 8, 11, 17, 24, 31, 45, 56, 68, 91, 93, 184, 275] :: @@ -1429,21 +1429,21 @@ def degree_sequence(self, iterates=2): sage: F. = PolynomialRing(QQ) sage: P2. = ProjectiveSpace(F, 2) sage: f = DynamicalSystem_projective([Y*Z, X*Y, Y^2 + t*X*Z]) - sage: f.degree_sequence(5) + sage: f.degree_sequence(5) # needs sage.rings.function_field [2, 3, 5, 8, 13] :: sage: P2. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([X^2, Y^2, Z^2]) - sage: f.degree_sequence(10) + sage: f.degree_sequence(10) # needs sage.rings.function_field [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024] :: sage: P2. = ProjectiveSpace(ZZ, 2) sage: f = DynamicalSystem_projective([X*Y, Y*Z+Z^2, Z^2]) - sage: f.degree_sequence(10) + sage: f.degree_sequence(10) # needs sage.rings.function_field [2, 3, 4, 5, 6, 7, 8, 9, 10, 11] """ if int(iterates) < 1: @@ -1482,14 +1482,14 @@ def dynamical_degree(self, N=3, prec=53): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 + x*y, y^2]) - sage: f.dynamical_degree() + sage: f.dynamical_degree() # needs sage.rings.function_field 2.00000000000000 :: sage: P2. = ProjectiveSpace(ZZ, 2) sage: f = DynamicalSystem_projective([X*Y, Y*Z + Z^2, Z^2]) - sage: f.dynamical_degree(N=5, prec=100) + sage: f.dynamical_degree(N=5, prec=100) # needs sage.rings.function_field 1.4309690811052555010452244131 """ if int(N) < 1: @@ -1674,7 +1674,7 @@ def resultant(self, normalize=False): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2 + y^2, 6*y^2]) - sage: f.resultant() + sage: f.resultant() # needs sage.libs.pari 36 :: @@ -1682,7 +1682,7 @@ def resultant(self, normalize=False): sage: R. = PolynomialRing(GF(17)) sage: P. = ProjectiveSpace(R,1) sage: f = DynamicalSystem_projective([t*x^2 + t*y^2, 6*y^2]) - sage: f.resultant() + sage: f.resultant() # needs sage.libs.pari 2*t^2 :: @@ -1703,10 +1703,10 @@ def resultant(self, normalize=False): :: sage: R. = PolynomialRing(QQ) - sage: s = (t^3 + t + 1).roots(QQbar)[0][0] - sage: P. = ProjectiveSpace(QQbar, 1) - sage: f = DynamicalSystem_projective([s*x^3 - 13*y^3, y^3 - 15*y^3]) - sage: f.resultant() + 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: f = DynamicalSystem_projective([s*x^3 - 13*y^3, y^3 - 15*y^3]) # needs sage.rings.number_field + sage: f.resultant() # needs sage.rings.number_field 871.6925062959149? """ if normalize: @@ -1767,7 +1767,7 @@ def primes_of_bad_reduction(self, check=True): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([1/3*x^2 + 1/2*y^2, y^2]) - sage: f.primes_of_bad_reduction() + sage: f.primes_of_bad_reduction() # needs sage.rings.function_field [2, 3] :: @@ -1775,16 +1775,16 @@ def primes_of_bad_reduction(self, check=True): sage: P. = ProjectiveSpace(QQ,3) sage: f = DynamicalSystem_projective([12*x*z - 7*y^2, 31*x^2 - y^2, ....: 26*z^2, 3*w^2 - z*w]) - sage: f.primes_of_bad_reduction() + sage: f.primes_of_bad_reduction() # needs sage.rings.function_field [2, 3, 7, 13, 31] A number field example:: sage: R. = QQ[] - sage: K. = NumberField(z^2 - 2) - sage: P. = ProjectiveSpace(K,1) - sage: f = DynamicalSystem_projective([1/3*x^2+1/a*y^2, y^2]) - sage: f.primes_of_bad_reduction() + sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([1/3*x^2+1/a*y^2, y^2]) # needs sage.rings.number_field + sage: f.primes_of_bad_reduction() # needs sage.rings.function_field sage.rings.number_field [Fractional ideal (a), Fractional ideal (3)] This is an example where ``check=False`` returns extra primes:: @@ -1793,9 +1793,9 @@ def primes_of_bad_reduction(self, check=True): sage: f = DynamicalSystem_projective([3*x*y^2 + 7*y^3 - 4*y^2*z + 5*z^3, ....: -5*x^3 + x^2*y + y^3 + 2*x^2*z, ....: -2*x^2*y + x*y^2 + y^3 - 4*y^2*z + x*z^2]) - sage: f.primes_of_bad_reduction(False) + sage: f.primes_of_bad_reduction(False) # needs sage.rings.function_field [2, 5, 37, 2239, 304432717] - sage: f.primes_of_bad_reduction() + sage: f.primes_of_bad_reduction() # needs sage.rings.function_field [5, 37, 2239, 304432717] """ if (not is_ProjectiveSpace(self.domain())) or (not is_ProjectiveSpace(self.codomain())): @@ -1891,10 +1891,10 @@ def conjugate(self, M, adjugate=False, normalize=False): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2 + 1) + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field sage: P. = ProjectiveSpace(ZZ,1) sage: f = DynamicalSystem_projective([x^3 + y^3, y^3]) - sage: f.conjugate(matrix([[i,0], [0,-i]])) + sage: f.conjugate(matrix([[i,0], [0,-i]])) # needs sage.rings.number_field Dynamical System of Projective Space of dimension 1 over Integer Ring Defn: Defined on coordinates by sending (x : y) to (-x^3 + y^3 : -y^3) @@ -1920,10 +1920,10 @@ def conjugate(self, M, adjugate=False, normalize=False): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2 + 1) + sage: K. = NumberField(x^2 + 1) # needs sage.rings.number_field sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([1/3*x^2 + 1/2*y^2, y^2]) - sage: f.conjugate(matrix([[i,0], [0,-i]])) + sage: f.conjugate(matrix([[i,0], [0,-i]])) # needs sage.rings.number_field Dynamical System 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 @@ -2028,14 +2028,14 @@ def green_function(self, P, v, **kwds): :: - sage: K. = QuadraticField(3) - sage: P. = ProjectiveSpace(K,1) - sage: f = DynamicalSystem_projective([17*x^2 + 1/7*y^2, 17*w*x*y]) - sage: f.green_function(P.point([w, 2], False), K.places()[1]) + sage: K. = QuadraticField(3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([17*x^2 + 1/7*y^2, 17*w*x*y]) # needs sage.rings.number_field + sage: f.green_function(P.point([w, 2], False), K.places()[1]) # needs sage.rings.number_field 1.7236334013785676107373093775 - sage: f.green_function(P([2, 1]), K.ideal(7), N=7) + sage: f.green_function(P([2, 1]), K.ideal(7), N=7) # needs sage.rings.number_field 0.48647753726382832627633818586 - sage: f.green_function(P([w, 1]), K.ideal(17), error_bound=0.001) + sage: f.green_function(P([w, 1]), K.ideal(17), error_bound=0.001) # needs sage.rings.number_field -0.70813041039490996737374178059 :: @@ -2205,21 +2205,21 @@ def canonical_height(self, P, **kwds): sage: P. = ProjectiveSpace(ZZ,1) sage: f = DynamicalSystem_projective([x^2 + y^2, 2*x*y]); - sage: f.canonical_height(P.point([5,4]), error_bound=0.001) + sage: f.canonical_height(P.point([5,4]), error_bound=0.001) # needs sage.libs.pari 2.1970553519503404898926835324 - sage: f.canonical_height(P.point([2,1]), error_bound=0.001) + sage: f.canonical_height(P.point([2,1]), error_bound=0.001) # needs sage.libs.pari 1.0984430632822307984974382955 Notice that preperiodic points may not return exactly 0:: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(X^2 + X - 1) - sage: P. = ProjectiveSpace(K,1) + sage: K. = NumberField(X^2 + X - 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field sage: f = DynamicalSystem_projective([x^2 - 2*y^2, y^2]) - sage: Q = P.point([a,1]) - sage: f.canonical_height(Q, error_bound=0.000001) # Answer only within error_bound of 0 + sage: Q = P.point([a,1]) # needs sage.rings.number_field + sage: f.canonical_height(Q, error_bound=0.000001) # Answer only within error_bound of 0 # needs sage.rings.number_field 5.7364919788790160119266380480e-8 - sage: f.nth_iterate(Q, 2) == Q # but it is indeed preperiodic + sage: f.nth_iterate(Q, 2) == Q # but it is indeed preperiodic # needs sage.rings.number_field True :: @@ -2228,7 +2228,7 @@ def canonical_height(self, P, **kwds): sage: X = P.subscheme(x^2 - y^2); sage: f = DynamicalSystem_projective([x^2, y^2, 4*z^2], domain=X); sage: Q = X([4,4,1]) - sage: f.canonical_height(Q, badprimes=[2]) + sage: f.canonical_height(Q, badprimes=[2]) # needs sage.rings.function_field 0.0013538030870311431824555314882 :: @@ -2237,7 +2237,7 @@ def canonical_height(self, P, **kwds): sage: X = P.subscheme(x^2 - y^2); sage: f = DynamicalSystem_projective([x^2, y^2, 30*z^2], domain=X) sage: Q = X([4, 4, 1]) - sage: f.canonical_height(Q, badprimes=[2,3,5], prec=200) + sage: f.canonical_height(Q, badprimes=[2,3,5], prec=200) # needs sage.rings.function_field 2.7054056208276961889784303469356774912979228770208655455481 :: @@ -2245,7 +2245,7 @@ def canonical_height(self, P, **kwds): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([1000*x^2 - 29*y^2, 1000*y^2]) sage: Q = P(-1/4, 1) - sage: f.canonical_height(Q, error_bound=0.01) + sage: f.canonical_height(Q, error_bound=0.01) # needs sage.libs.pari 3.7996079979254623065837411853 :: @@ -2257,14 +2257,14 @@ def canonical_height(self, P, **kwds): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([RSA768*x^2 + y^2, x*y]) sage: Q = P(RSA768,1) - sage: f.canonical_height(Q, error_bound=0.00000000000000001) + sage: f.canonical_height(Q, error_bound=0.00000000000000001) # needs sage.libs.pari 931.18256422718241278672729195 :: - sage: P.=ProjectiveSpace(QQ, 1) + sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([2*(-2*x^3 + 3*(x^2*y)) + 3*y^3, 3*y^3]) - sage: f.canonical_height(P(1,0)) + sage: f.canonical_height(P(1,0)) # needs sage.libs.pari 0.00000000000000000000000000000 """ bad_primes = kwds.get("badprimes", None) @@ -2418,36 +2418,36 @@ def height_difference_bound(self, prec=None): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 + y^2, x*y]) - sage: f.height_difference_bound() + sage: f.height_difference_bound() # needs sage.symbolic 1.38629436111989 sage: P. = ProjectiveSpace(ZZ, 2) sage: f = DynamicalSystem_projective([4*x^2 + 100*y^2, 210*x*y, 10000*z^2]) - sage: f.height_difference_bound() + sage: f.height_difference_bound() # needs sage.symbolic 10.3089526606443 A number field example:: sage: R. = QQ[] - sage: K. = NumberField(x^3 - 2) - sage: P. = ProjectiveSpace(K, 2) - sage: f = DynamicalSystem_projective([1/(c+1)*x^2 + c*y^2, 210*x*y, 10000*z^2]) - sage: f.height_difference_bound() + sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([1/(c+1)*x^2 + c*y^2, 210*x*y, 10000*z^2]) # needs sage.rings.number_field + sage: f.height_difference_bound() # needs sage.rings.number_field sage.symbolic 11.3683039374269 :: - sage: P. = ProjectiveSpace(QQbar, 2) - sage: f = DynamicalSystem_projective([x^2, QQbar(sqrt(-1))*y^2, + sage: P. = ProjectiveSpace(QQbar, 2) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2, QQbar(sqrt(-1))*y^2, # needs sage.rings.number_field sage.symbolic ....: QQbar(sqrt(3))*z^2]) - sage: f.height_difference_bound() + sage: f.height_difference_bound() # needs sage.rings.number_field sage.symbolic 2.89037175789616 :: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([5*x^2 + 3*x*y , y^2 + 3*x^2]) - sage: f.height_difference_bound(prec=100) + sage: f.height_difference_bound(prec=100) # needs sage.symbolic 5.3375380797013179737224159274 """ FF = FractionField(self.domain().base_ring()) #lift will only work over fields, so coercing into FF @@ -2532,9 +2532,9 @@ def multiplier(self, P, n, check=True): :: - sage: P. = ProjectiveSpace(Qp(13),1) + sage: P. = ProjectiveSpace(Qp(13),1) # needs sage.rings.padics sage: f = DynamicalSystem_projective([x^2 - 29/16*y^2, y^2]) - sage: f.multiplier(P(5,4), 3) + sage: f.multiplier(P(5,4), 3) # needs sage.rings.padics [6 + 8*13 + 13^2 + 8*13^3 + 13^4 + 8*13^5 + 13^6 + 8*13^7 + 13^8 + 8*13^9 + 13^10 + 8*13^11 + 13^12 + 8*13^13 + 13^14 + 8*13^15 + 13^16 + 8*13^17 + 13^18 + 8*13^19 + O(13^20)] @@ -2765,7 +2765,7 @@ def nth_preimage_tree(self, Q, n, **kwds): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) sage: Q = P(0,1) - sage: f.nth_preimage_tree(Q, 2) # optional - sage.plot + sage: f.nth_preimage_tree(Q, 2) # needs sage.plot GraphPlot object for Digraph on 7 vertices :: @@ -2773,7 +2773,7 @@ def nth_preimage_tree(self, Q, n, **kwds): sage: P. = ProjectiveSpace(GF(3), 1) sage: f = DynamicalSystem_projective([x^2 + x*y + y^2, y^2]) sage: Q = P(0,1) - sage: f.nth_preimage_tree(Q, 2, return_points=True) # optional - sage.plot + sage: f.nth_preimage_tree(Q, 2, return_points=True) # needs sage.plot (GraphPlot object for Digraph on 4 vertices, [[(0 : 1)], [(1 : 1)], [(0 : 1), (2 : 1)]]) """ @@ -2874,20 +2874,20 @@ def possible_periods(self, **kwds): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2 - 29/16*y^2, y^2]) - sage: f.possible_periods(ncpus=1) + sage: f.possible_periods(ncpus=1) # needs sage.rings.function_field [1, 3] :: sage: PS. = ProjectiveSpace(1,QQ) sage: f = DynamicalSystem_projective([5*x^3 - 53*x*y^2 + 24*y^3, 24*y^3]) - sage: f.possible_periods(prime_bound=[1,5]) + sage: f.possible_periods(prime_bound=[1,5]) # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: no primes of good reduction in that range - sage: f.possible_periods(prime_bound=[1,10]) + sage: f.possible_periods(prime_bound=[1,10]) # needs sage.rings.function_field [1, 4, 12] - sage: f.possible_periods(prime_bound=[1,20]) + sage: f.possible_periods(prime_bound=[1,20]) # needs sage.rings.function_field [1, 4] :: @@ -2895,7 +2895,7 @@ def possible_periods(self, **kwds): sage: P. = ProjectiveSpace(ZZ,2) sage: f = DynamicalSystem_projective([2*x^3 - 50*x*z^2 + 24*z^3, ....: 5*y^3 - 53*y*z^2 + 24*z^3, 24*z^3]) - sage: f.possible_periods(prime_bound=10) + sage: f.possible_periods(prime_bound=10) # needs sage.rings.function_field [1, 2, 6, 20, 42, 60, 140, 420] sage: f.possible_periods(prime_bound=20) # long time [1, 20] @@ -2974,7 +2974,7 @@ def _preperiodic_points_to_cyclegraph(self, preper): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2 - 2*y^2, y^2]) sage: preper = [P(-2, 1), P(1, 0), P(0, 1), P(1, 1), P(2, 1), P(-1, 1)] - sage: f._preperiodic_points_to_cyclegraph(preper) + sage: f._preperiodic_points_to_cyclegraph(preper) # needs sage.graphs Looped digraph on 6 vertices """ V = [] @@ -3018,21 +3018,21 @@ def is_PGL_minimal(self, prime_list=None): sage: PS. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([X^2 + 3*Y^2, X*Y]) - sage: f.is_PGL_minimal() + sage: f.is_PGL_minimal() # needs sage.rings.function_field True :: sage: PS. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([6*x^2 + 12*x*y + 7*y^2, 12*x*y]) - sage: f.is_PGL_minimal() + sage: f.is_PGL_minimal() # needs sage.rings.function_field False :: sage: PS. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([6*x^2 + 12*x*y + 7*y^2, y^2]) - sage: f.is_PGL_minimal() + sage: f.is_PGL_minimal() # needs sage.rings.function_field False """ if self.base_ring() != QQ and self.base_ring() != ZZ: @@ -3093,7 +3093,7 @@ def minimal_model(self, return_transformation=False, prime_list=None, algorithm= sage: PS. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([X^2 + 3*Y^2, X*Y]) - sage: f.minimal_model(return_transformation=True) + sage: f.minimal_model(return_transformation=True) # needs sage.rings.function_field ( Dynamical System of Projective Space of dimension 1 over Rational Field @@ -3111,7 +3111,7 @@ def minimal_model(self, return_transformation=False, prime_list=None, algorithm= ....: + 1146*X*Y^3 + 245/2*Y^4, ....: -12329/2*X^4 - 10506*X^3*Y - 6723*X^2*Y^2 ....: - 1914*X*Y^3 - 409/2*Y^4]) - sage: f.minimal_model(return_transformation=True) + sage: f.minimal_model(return_transformation=True) # needs sage.rings.function_field ( Dynamical System of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (X : Y) to @@ -3126,7 +3126,7 @@ def minimal_model(self, return_transformation=False, prime_list=None, algorithm= sage: PS. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([6*x^2 + 12*x*y + 7*y^2, 12*x*y]) - sage: f.minimal_model() + sage: f.minimal_model() # needs sage.rings.function_field Dynamical System of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y) to (x^2 + 12*x*y + 42*y^2 : 2*x*y) @@ -3135,7 +3135,7 @@ def minimal_model(self, return_transformation=False, prime_list=None, algorithm= sage: PS. = ProjectiveSpace(ZZ,1) sage: f = DynamicalSystem_projective([6*x^2 + 12*x*y + 7*y^2, 12*x*y + 42*y^2]) - sage: g,M = f.minimal_model(return_transformation=True, algorithm='BM') + sage: g,M = f.minimal_model(return_transformation=True, algorithm='BM') # needs sage.rings.function_field sage: f.conjugate(M) == g True @@ -3143,7 +3143,7 @@ def minimal_model(self, return_transformation=False, prime_list=None, algorithm= sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([2*x^2, y^2]) - sage: f.minimal_model(return_transformation=True) + sage: f.minimal_model(return_transformation=True) # needs sage.rings.function_field ( Dynamical System of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y) to @@ -3151,7 +3151,7 @@ def minimal_model(self, return_transformation=False, prime_list=None, algorithm= [1 0] [0 2] ) - sage: f.minimal_model(prime_list=[3]) + sage: f.minimal_model(prime_list=[3]) # needs sage.rings.function_field Dynamical System of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y) to (2*x^2 : y^2) @@ -3160,7 +3160,7 @@ def minimal_model(self, return_transformation=False, prime_list=None, algorithm= sage: PS. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([X + Y, X - 3*Y]) - sage: f.minimal_model() + sage: f.minimal_model() # needs sage.rings.function_field Traceback (most recent call last): ... NotImplementedError: minimality is only for degree 2 or higher @@ -3169,7 +3169,7 @@ def minimal_model(self, return_transformation=False, prime_list=None, algorithm= sage: PS. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([X^2 - Y^2, X^2 + X*Y]) - sage: f.minimal_model() + sage: f.minimal_model() # needs sage.rings.function_field Traceback (most recent call last): ... TypeError: the function is not a morphism @@ -3178,7 +3178,7 @@ def minimal_model(self, return_transformation=False, prime_list=None, algorithm= sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem([2*x^2, y^2]) - sage: f.minimal_model(algorithm='BM') + sage: f.minimal_model(algorithm='BM') # needs sage.rings.function_field Traceback (most recent call last): ... TypeError: affine minimality is only considered for @@ -3188,7 +3188,7 @@ def minimal_model(self, return_transformation=False, prime_list=None, algorithm= sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem([2*x^2, y^2]) - sage: f.minimal_model(prime_list=[0]) + sage: f.minimal_model(prime_list=[0]) # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: prime_list contains 0 which is not prime @@ -3279,7 +3279,7 @@ def all_minimal_models(self, return_transformation=False, prime_list=None, sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([2*x^2, 3*y^2]) - sage: f.all_minimal_models() + sage: f.all_minimal_models() # needs sage.rings.function_field [Dynamical System of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y) to (x^2 : y^2)] @@ -3289,9 +3289,9 @@ def all_minimal_models(self, return_transformation=False, prime_list=None, sage: P. = ProjectiveSpace(QQ, 1) sage: c = 2*3^6 sage: f = DynamicalSystem([x^3 - c^2*y^3, x*y^2]) - sage: len(f.all_minimal_models(algorithm='HS')) + sage: len(f.all_minimal_models(algorithm='HS')) # needs sage.rings.function_field 14 - sage: len(f.all_minimal_models(prime_list=[2], algorithm='HS')) + sage: len(f.all_minimal_models(prime_list=[2], algorithm='HS')) # needs sage.rings.function_field 2 :: @@ -3300,7 +3300,7 @@ def all_minimal_models(self, return_transformation=False, prime_list=None, sage: f = DynamicalSystem([237568*x^3 + 1204224*x^2*y + 2032560*x*y^2 ....: + 1142289*y^3, -131072*x^3 - 663552*x^2*y - 1118464*x*y^2 ....: - 627664*y^3]) - sage: len(f.all_minimal_models(algorithm='BM')) + sage: len(f.all_minimal_models(algorithm='BM')) # needs sage.rings.function_field 2 TESTS:: @@ -3308,10 +3308,10 @@ def all_minimal_models(self, return_transformation=False, prime_list=None, sage: P. = ProjectiveSpace(QQ, 1) sage: c = 2^2*5^2*11^3 sage: f = DynamicalSystem([x^3 - c^2*y^3, x*y^2]) - sage: MM = f.all_minimal_models(return_transformation=True, algorithm='BM') + sage: MM = f.all_minimal_models(return_transformation=True, algorithm='BM') # needs sage.rings.function_field sage: all(f.conjugate(m) == F for F, m in MM) True - sage: MM = f.all_minimal_models(return_transformation=True, algorithm='HS') + sage: MM = f.all_minimal_models(return_transformation=True, algorithm='HS') # needs sage.rings.function_field sage: all(f.conjugate(m) == F for F,m in MM) True @@ -3392,7 +3392,7 @@ def affine_preperiodic_model(self, m, n, return_conjugation=False): sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) - sage: g = f.affine_preperiodic_model(0, 1); g + sage: g = f.affine_preperiodic_model(0, 1); g # needs sage.rings.function_field Dynamical System of Projective Space of dimension 2 over Rational Field Defn: Defined on coordinates by sending (x : y : z) to (-x^2 : -2*x^2 + 2*x*y - y^2 : 2*x^2 - 2*x*y + 2*y^2 + 2*y*z + z^2) @@ -3410,9 +3410,9 @@ def affine_preperiodic_model(self, m, n, return_conjugation=False): :: - sage: P. = ProjectiveSpace(GF(9), 2) + sage: P. = ProjectiveSpace(GF(9), 2) # needs sage.rings.finite_rings sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) - sage: f.affine_preperiodic_model(0, 1) + sage: f.affine_preperiodic_model(0, 1) # needs sage.rings.finite_rings sage.rings.function_field Dynamical System of Projective Space of dimension 2 over Finite Field in z2 of size 3^2 Defn: Defined on coordinates by sending (x : y : z) to @@ -3433,10 +3433,10 @@ def affine_preperiodic_model(self, m, n, return_conjugation=False): :: - sage: K. = CyclotomicField(3) - sage: P. = ProjectiveSpace(K, 2) - sage: f = DynamicalSystem_projective([x^2 + k*x*y + y^2, z^2, y^2]) - sage: f.affine_preperiodic_model(1, 1) + sage: K. = CyclotomicField(3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 + k*x*y + y^2, z^2, y^2]) # needs sage.rings.number_field + sage: f.affine_preperiodic_model(1, 1) # needs sage.rings.function_field sage.rings.number_field Dynamical System of Projective Space of dimension 2 over Cyclotomic Field of order 3 and degree 2 Defn: Defined on coordinates by sending (x : y : z) to @@ -3446,7 +3446,7 @@ def affine_preperiodic_model(self, m, n, return_conjugation=False): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) - sage: g, mat = f.affine_preperiodic_model(0, 1, return_conjugation=True) + sage: g, mat = f.affine_preperiodic_model(0, 1, return_conjugation=True) # needs sage.rings.function_field sage: g == f.conjugate(mat) True @@ -3455,7 +3455,7 @@ def affine_preperiodic_model(self, m, n, return_conjugation=False): sage: P. = ProjectiveSpace(QQ, 2) sage: X = P.subscheme(2*y - z) sage: f = DynamicalSystem_projective([x^2 + y^2, z^2 + y^2, z^2], domain=X) - sage: f.affine_preperiodic_model(0, 1) + sage: f.affine_preperiodic_model(0, 1) # needs sage.rings.function_field Dynamical System of Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: 2*y - z Defn: Defined on coordinates by sending (x : y : z) to @@ -3465,7 +3465,7 @@ def affine_preperiodic_model(self, m, n, return_conjugation=False): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 + 2*y^2, x^2]) - sage: g, mat = f.affine_preperiodic_model(0, 1, return_conjugation=True) + sage: g, mat = f.affine_preperiodic_model(0, 1, return_conjugation=True) # needs sage.rings.function_field sage: f.conjugate(mat) == g True """ @@ -3604,14 +3604,14 @@ def automorphism_group(self, **kwds): sage: R. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 - y^2, x*y]) - sage: f.automorphism_group(return_functions=True) + sage: f.automorphism_group(return_functions=True) # needs sage.libs.pari [x, -x] :: sage: R. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 + 5*x*y + 5*y^2, 5*x^2 + 5*x*y + y^2]) - sage: f.automorphism_group() + sage: f.automorphism_group() # needs sage.libs.pari [ [1 0] [0 2] [0 1], [2 0] @@ -3621,21 +3621,21 @@ def automorphism_group(self, **kwds): sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem([x^3, y^3, z^3]) - sage: len(f.automorphism_group()) + sage: len(f.automorphism_group()) # needs sage.rings.function_field 24 :: sage: R. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 - 2*x*y - 2*y^2, -2*x^2 - 2*x*y + y^2]) - sage: f.automorphism_group(return_functions=True) + sage: f.automorphism_group(return_functions=True) # needs sage.libs.pari [x, 1/x, -x - 1, -x/(x + 1), (-x - 1)/x, -1/(x + 1)] :: sage: R. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([3*x^2*y - y^3, x^3 - 3*x*y^2]) - sage: lst, label = f.automorphism_group(algorithm='CRT', return_functions=True, + sage: lst, label = f.automorphism_group(algorithm='CRT', return_functions=True, # needs sage.libs.pari ....: iso_type=True) sage: sorted(lst), label ([-1/x, 1/x, (-x - 1)/(x - 1), (-x + 1)/(x + 1), (x - 1)/(x + 1), @@ -3647,7 +3647,7 @@ def automorphism_group(self, **kwds): sage: A. = AffineSpace(QQ, 1) sage: f = DynamicalSystem_affine([1/z^3]) sage: F = f.homogenize(1) - sage: F.automorphism_group() + sage: F.automorphism_group() # needs sage.libs.pari [ [1 0] [0 2] [-1 0] [ 0 -2] [0 1], [2 0], [ 0 1], [ 2 0] @@ -3657,7 +3657,7 @@ def automorphism_group(self, **kwds): sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x**2 + x*z, y**2, z**2]) - sage: f.automorphism_group() + sage: f.automorphism_group() # needs sage.rings.function_field [ [1 0 0] [0 1 0] @@ -3666,10 +3666,10 @@ def automorphism_group(self, **kwds): :: - sage: K. = CyclotomicField(3) - sage: P. = ProjectiveSpace(K, 1) - sage: D6 = DynamicalSystem_projective([y^2, x^2]) - sage: sorted(D6.automorphism_group()) + sage: K. = CyclotomicField(3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: D6 = DynamicalSystem_projective([y^2, x^2]) # needs sage.rings.number_field + sage: sorted(D6.automorphism_group()) # needs sage.rings.number_field [ [-w - 1 0] [ 0 -w - 1] [w 0] [0 w] [0 1] [1 0] [ 0 1], [ 1 0], [0 1], [1 0], [1 0], [0 1] @@ -3712,7 +3712,7 @@ def critical_subscheme(self): sage: set_verbose(None) sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^3 - 2*x*y^2 + 2*y^3, y^3]) - sage: f.critical_subscheme() + sage: f.critical_subscheme() # needs sage.rings.function_field Closed subscheme of Projective Space of dimension 1 over Rational Field defined by: 9*x^2*y^2 - 6*y^4 @@ -3722,7 +3722,7 @@ def critical_subscheme(self): sage: set_verbose(None) sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([2*x^2 - y^2, x*y]) - sage: f.critical_subscheme() + sage: f.critical_subscheme() # needs sage.rings.function_field Closed subscheme of Projective Space of dimension 1 over Rational Field defined by: 4*x^2 + 2*y^2 @@ -3731,16 +3731,16 @@ def critical_subscheme(self): sage: P. = ProjectiveSpace(QQ,2) sage: f = DynamicalSystem_projective([2*x^2 - y^2, x*y, z^2]) - sage: f.critical_subscheme() + sage: f.critical_subscheme() # needs sage.rings.function_field Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: 8*x^2*z + 4*y^2*z :: - sage: P. = ProjectiveSpace(GF(81), 3) - sage: g = DynamicalSystem_projective([x^3 + y^3, y^3 + z^3, z^3 + x^3, w^3]) - sage: g.critical_subscheme() + sage: P. = ProjectiveSpace(GF(81), 3) # needs sage.rings.finite_rings + sage: g = DynamicalSystem_projective([x^3 + y^3, y^3 + z^3, z^3 + x^3, w^3]) # needs sage.rings.finite_rings + sage: g.critical_subscheme() # needs sage.rings.finite_rings Closed subscheme of Projective Space of dimension 3 over Finite Field in z4 of size 3^4 defined by: 0 @@ -3749,7 +3749,7 @@ def critical_subscheme(self): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2, x*y]) - sage: f.critical_subscheme() + sage: f.critical_subscheme() # needs sage.rings.function_field Traceback (most recent call last): ... TypeError: the function is not a morphism @@ -3781,9 +3781,9 @@ def critical_points(self, R=None): sage: set_verbose(None) sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^3 - 2*x*y^2 + 2*y^3, y^3]) - sage: f.critical_points() + sage: f.critical_points() # needs sage.rings.function_field [(1 : 0)] - sage: K. = QuadraticField(6) + sage: K. = QuadraticField(6) # needs sage.rings.number_field sage: f.critical_points(K) [(-1/3*w : 1), (1/3*w : 1), (1 : 0)] @@ -3792,7 +3792,7 @@ def critical_points(self, R=None): sage: set_verbose(None) sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([2*x^2 - y^2, x*y]) - sage: f.critical_points(QQbar) + sage: f.critical_points(QQbar) # needs sage.rings.number_field [(-0.7071067811865475?*I : 1), (0.7071067811865475?*I : 1)] """ PS = self.domain() @@ -3838,28 +3838,28 @@ def ramification_type(self, R=None, stable=True): sage: P. = ProjectiveSpace(QQ, 1) sage: F = DynamicalSystem_projective([x^4, y^4]) - sage: F.ramification_type() + sage: F.ramification_type() # needs sage.rings.number_field [[4], [4]] sage: P. = ProjectiveSpace(QQ, 1) sage: F = DynamicalSystem_projective([x^3, 4*y^3 - 3*x^2*y]) - sage: F.ramification_type() + sage: F.ramification_type() # needs sage.rings.number_field [[2], [2], [3]] sage: P. = ProjectiveSpace(QQ, 1) sage: F = DynamicalSystem_projective([(x + y)^4, 16*x*y*(x-y)^2]) - sage: F.ramification_type() + sage: F.ramification_type() # needs sage.rings.number_field [[2], [2, 2], [4]] sage: P. = ProjectiveSpace(QQ, 1) sage: F = DynamicalSystem_projective([(x + y)*(x - y)^3, y*(2*x+y)^3]) - sage: F.ramification_type() + sage: F.ramification_type() # needs sage.rings.number_field [[3], [3], [3]] sage: F = DynamicalSystem_projective([x^3 - 2*x*y^2 + 2*y^3, y^3]) - sage: F.ramification_type() + sage: F.ramification_type() # needs sage.rings.number_field [[2], [2], [3]] - sage: F.ramification_type(R=F.base_ring()) + sage: F.ramification_type(R=F.base_ring()) # needs sage.rings.function_field [[2], [3]] """ @@ -3910,20 +3910,20 @@ def is_postcritically_finite(self, err=0.01, use_algebraic_closure=True): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2 - y^2, y^2]) - sage: f.is_postcritically_finite() + sage: f.is_postcritically_finite() # needs sage.rings.number_field True :: sage: P. = ProjectiveSpace(QQ,1) - sage: f = DynamicalSystem_projective([x^3- y^3, y^3]) - sage: f.is_postcritically_finite() + sage: f = DynamicalSystem_projective([x^3 - y^3, y^3]) + sage: f.is_postcritically_finite() # needs sage.rings.number_field False :: sage: R. = QQ[] - sage: K. = NumberField(z^8 + 3*z^6 + 3*z^4 + z^2 + 1) + sage: K. = NumberField(z^8 + 3*z^6 + 3*z^4 + z^2 + 1) # needs sage.rings.number_field sage: PS. = ProjectiveSpace(K,1) sage: f = DynamicalSystem_projective([x^3 + v*y^3, y^3]) sage: f.is_postcritically_finite() # long time @@ -3934,15 +3934,15 @@ def is_postcritically_finite(self, err=0.01, use_algebraic_closure=True): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([6*x^2 + 16*x*y + 16*y^2, ....: -3*x^2 - 4*x*y - 4*y^2]) - sage: f.is_postcritically_finite() + sage: f.is_postcritically_finite() # needs sage.rings.number_field True :: - sage: K = UniversalCyclotomicField() - sage: P. = ProjectiveSpace(K,1) + sage: K = UniversalCyclotomicField() # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field sage: F = DynamicalSystem_projective([x^2 - y^2, y^2], domain=P) - sage: F.is_postcritically_finite() + sage: F.is_postcritically_finite() # needs sage.rings.number_field True :: @@ -3956,14 +3956,14 @@ def is_postcritically_finite(self, err=0.01, use_algebraic_closure=True): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^4 - x^2*y^2 + y^4, y^4]) - sage: f.is_postcritically_finite(use_algebraic_closure=False) + sage: f.is_postcritically_finite(use_algebraic_closure=False) # needs sage.rings.number_field False :: - sage: P. = ProjectiveSpace(QQbar,1) + sage: P. = ProjectiveSpace(QQbar,1) # needs sage.rings.number_field sage: f = DynamicalSystem_projective([x^4 - x^2*y^2, y^4]) - sage: f.is_postcritically_finite() + sage: f.is_postcritically_finite() # needs sage.rings.number_field False """ #iteration of subschemes not yet implemented @@ -4009,52 +4009,52 @@ def is_dynamical_belyi_map(self): sage: P.=ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([-2*x^3 - 9*x^2*y - 12*x*y^2 - 6*y^3, y^3]) - sage: f.is_dynamical_belyi_map() + sage: f.is_dynamical_belyi_map() # needs sage.rings.number_field True :: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([5*x^7 - 7*x^6*y, -7*x*y^6 + 5*y^7]) - sage: f.is_dynamical_belyi_map() + sage: f.is_dynamical_belyi_map() # needs sage.rings.number_field True :: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) - sage: f.is_dynamical_belyi_map() + sage: f.is_dynamical_belyi_map() # needs sage.rings.number_field False :: - sage: F = QuadraticField(-7) - sage: P. = ProjectiveSpace(F, 1) + sage: F = QuadraticField(-7) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(F, 1) # needs sage.rings.number_field sage: f = DynamicalSystem_projective([5*x^7 - 7*x^6*y, -7*x*y^6 + 5*y^7]) - sage: f.is_dynamical_belyi_map() + sage: f.is_dynamical_belyi_map() # needs sage.rings.number_field True :: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([2*x^3 + 3*x^2*y - 3*x*y^2 + 2*y^3, x^3 + y^3]) - sage: f.is_dynamical_belyi_map() + sage: f.is_dynamical_belyi_map() # needs sage.rings.number_field False :: sage: R. = PolynomialRing(QQ) - sage: N. = NumberField(t^3 - 2) - sage: P. = ProjectiveSpace(N, 1) - sage: f=DynamicalSystem_projective([x^2 + c*y^2, x*y]) - sage: f.is_dynamical_belyi_map() + sage: N. = NumberField(t^3 - 2) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(N, 1) # needs sage.rings.number_field + sage: f=DynamicalSystem_projective([x^2 + c*y^2, x*y]) # needs sage.rings.number_field + sage: f.is_dynamical_belyi_map() # needs sage.rings.number_field False :: sage: P. = ProjectiveSpace(GF(7), 1) sage: f = DynamicalSystem_projective([x^3 + 6*y^3, y^3]) - sage: f.is_dynamical_belyi_map() + sage: f.is_dynamical_belyi_map() # needs sage.libs.pari False """ P = self.codomain() @@ -4098,24 +4098,24 @@ def critical_point_portrait(self, check=True, use_algebraic_closure=True): EXAMPLES:: sage: R. = QQ[] - sage: K. = NumberField(z^6 + 2*z^5 + 2*z^4 + 2*z^3 + z^2 + 1) - sage: PS. = ProjectiveSpace(K,1) - sage: f = DynamicalSystem_projective([x^2 + v*y^2, y^2]) - sage: f.critical_point_portrait(check=False) # long time + sage: K. = NumberField(z^6 + 2*z^5 + 2*z^4 + 2*z^3 + z^2 + 1) # needs sage.rings.number_field + sage: PS. = ProjectiveSpace(K,1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 + v*y^2, y^2]) # needs sage.rings.number_field + sage: f.critical_point_portrait(check=False) # long time # needs sage.graphs sage.rings.number_field Looped digraph on 6 vertices :: sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^5 + 5/4*x*y^4, y^5]) - sage: f.critical_point_portrait(check=False) + sage: f.critical_point_portrait(check=False) # needs sage.graphs sage.rings.number_field Looped digraph on 5 vertices :: sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2 + 2*y^2, y^2]) - sage: f.critical_point_portrait() + sage: f.critical_point_portrait() # needs sage.rings.number_field Traceback (most recent call last): ... TypeError: map must be post-critically finite @@ -4123,11 +4123,11 @@ def critical_point_portrait(self, check=True, use_algebraic_closure=True): :: sage: R. = QQ[] - sage: K. = NumberField(t^3 + 2*t^2 + t + 1) - sage: phi = K.embeddings(QQbar)[0] - sage: P. = ProjectiveSpace(K, 1) - sage: f = DynamicalSystem_projective([x^2 + v*y^2, y^2]) - sage: f.change_ring(phi).critical_point_portrait() + sage: K. = NumberField(t^3 + 2*t^2 + t + 1) # needs sage.rings.number_field + sage: phi = K.embeddings(QQbar)[0] # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 + v*y^2, y^2]) # needs sage.rings.number_field + sage: f.change_ring(phi).critical_point_portrait() # needs sage.graphs sage.rings.number_field Looped digraph on 4 vertices :: @@ -4139,16 +4139,16 @@ def critical_point_portrait(self, check=True, use_algebraic_closure=True): :: - sage: P. = ProjectiveSpace(QQbar,1) + sage: P. = ProjectiveSpace(QQbar,1) # needs sage.rings.number_field sage: f = DynamicalSystem_projective([8*x^4 - 8*x^2*y^2 + y^4, y^4]) - sage: f.critical_point_portrait() #long time + sage: f.critical_point_portrait() # long time # needs sage.graphs sage.rings.number_field Looped digraph on 6 vertices :: sage: P. = ProjectiveSpace(GF(3),1) sage: f = DynamicalSystem_projective([x^2 + x*y - y^2, x*y]) - sage: f.critical_point_portrait(use_algebraic_closure=False) + sage: f.critical_point_portrait(use_algebraic_closure=False) # needs sage.libs.pari Looped digraph on 6 vertices sage: f.critical_point_portrait() #long time Looped digraph on 6 vertices @@ -4222,31 +4222,31 @@ def critical_height(self, **kwds): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^3 + 7*y^3, 11*y^3]) - sage: f.critical_height() + sage: f.critical_height() # needs sage.rings.number_field 1.1989273321156851418802151128 :: - sage: K. = QuadraticField(2) - sage: P. = ProjectiveSpace(K,1) - sage: f = DynamicalSystem_projective([x^2 + w*y^2, y^2]) - sage: f.critical_height() + sage: K. = QuadraticField(2) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 + w*y^2, y^2]) # needs sage.rings.number_field + sage: f.critical_height() # needs sage.rings.number_field 0.16090842452312941163719755472 Postcritically finite maps have critical height 0:: sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^3 - 3/4*x*y^2 + 3/4*y^3, y^3]) - sage: f.critical_height(error_bound=0.0001) + sage: f.critical_height(error_bound=0.0001) # needs sage.rings.number_field 0.00000000000000000000000000000 :: sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^3 + 3*x*y^2, y^3]) - sage: f.critical_height(use_algebraic_closure=False) + sage: f.critical_height(use_algebraic_closure=False) # needs sage.rings.number_field 0.000023477016733897112886491967991 - sage: f.critical_height() + sage: f.critical_height() # needs sage.rings.number_field 0.000023477016733897112886491967991 """ PS = self.codomain() @@ -4321,30 +4321,30 @@ def preperiodic_points(self, m, n, **kwds): EXAMPLES:: - sage: P. = ProjectiveSpace(QQbar, 1) - sage: f = DynamicalSystem_projective([x^2 - y^2, y^2]) - sage: f.preperiodic_points(0, 1) + sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 - y^2, y^2]) # needs sage.rings.number_field + sage: f.preperiodic_points(0, 1) # needs sage.rings.number_field [(-0.618033988749895? : 1), (1 : 0), (1.618033988749895? : 1)] :: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 - 29/16*y^2, y^2]) - sage: f.preperiodic_points(1, 3) + sage: f.preperiodic_points(1, 3) # needs sage.rings.function_field [(-5/4 : 1), (1/4 : 1), (7/4 : 1)] :: sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2 - 3/4*y^2, y^2 , z^2]) - sage: f.preperiodic_points(0, 2, formal=True) + sage: f.preperiodic_points(0, 2, formal=True) # needs sage.rings.function_field [(-1/2 : 1 : 0), (-1/2 : 1 : 1)] :: - sage: P. = ProjectiveSpace(QQbar, 1) - sage: f = DynamicalSystem_projective([x^2 - x*y + 2*y^2, x^2 - y^2]) - sage: f.preperiodic_points(1, 2, minimal=False) + sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 - x*y + 2*y^2, x^2 - y^2]) # needs sage.rings.number_field + sage: f.preperiodic_points(1, 2, minimal=False) # needs sage.rings.function_field sage.rings.number_field [(-3.133185666641252? : 1), (-1 : 1), (-0.3478103847799310? - 1.028852254136693?*I : 1), @@ -4359,10 +4359,10 @@ def preperiodic_points(self, m, n, **kwds): :: sage: R. = QQ[] - sage: K. = NumberField(w^6 - 3*w^5 + 5*w^4 - 5*w^3 + 5*w^2 - 3*w + 1) - sage: P. = ProjectiveSpace(K, 2) + sage: K. = NumberField(w^6 - 3*w^5 + 5*w^4 - 5*w^3 + 5*w^2 - 3*w + 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field sage: f = DynamicalSystem_projective([x^2 + z^2, y^2 + x^2, z^2 + y^2]) - sage: sorted(f.preperiodic_points(0, 1), key=str) + sage: sorted(f.preperiodic_points(0, 1), key=str) # needs sage.rings.function_field sage.rings.number_field [(-2*s^5 + 4*s^4 - 5*s^3 + 3*s^2 - 4*s : -2*s^5 + 5*s^4 - 7*s^3 + 6*s^2 - 7*s + 3 : 1), (-s^5 + 3*s^4 - 4*s^3 + 4*s^2 - 4*s + 2 : -s^5 + 2*s^4 - 2*s^3 + s^2 - s : 1), (-s^5 + 3*s^4 - 5*s^3 + 4*s^2 - 3*s + 1 : s^5 - 2*s^4 + 3*s^3 - 3*s^2 + 4*s - 1 : 1), @@ -4382,13 +4382,13 @@ def preperiodic_points(self, m, n, **kwds): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 - 3/4*y^2, y^2]) - sage: f.preperiodic_points(0, 2, formal=True) + sage: f.preperiodic_points(0, 2, formal=True) # needs sage.libs.pari [(-1/2 : 1)] :: sage: P. = ProjectiveSpace(QQ, 1) - sage: K. = QuadraticField(5) + sage: K. = QuadraticField(5) # needs sage.rings.number_field sage: phi = QQ.embeddings(K)[0] sage: f = DynamicalSystem_projective([x^2 - y^2, y^2]) sage: f.preperiodic_points(1, 1, R=phi) @@ -4400,14 +4400,14 @@ def preperiodic_points(self, m, n, **kwds): sage: X = P.subscheme(2*x - y) sage: f = DynamicalSystem_projective([x^2 - y^2, 2*(x^2 - y^2), y^2 - z^2], ....: domain=X) - sage: f.preperiodic_points(1, 1) + sage: f.preperiodic_points(1, 1) # needs sage.rings.function_field [(-1/4 : -1/2 : 1), (1 : 2 : 1)] :: sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2 - 3/4*y^2, z^2, y^2]) - sage: f.preperiodic_points(1, 1) + sage: f.preperiodic_points(1, 1) # needs sage.rings.function_field [(-3/2 : -1 : 1), (-3/2 : 1 : 1), (-1/2 : -1 : 1), (1/2 : -1 : 1), (1/2 : 1 : 1), (3/2 : -1 : 1)] @@ -4415,7 +4415,7 @@ def preperiodic_points(self, m, n, **kwds): sage: P. = ProjectiveSpace(GF(5), 2) sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) - sage: sorted(f.preperiodic_points(2, 1)) + sage: sorted(f.preperiodic_points(2, 1)) # needs sage.rings.function_field [(0 : 2 : 1), (0 : 3 : 1), (1 : 2 : 1), (1 : 3 : 1), (2 : 0 : 1), (2 : 1 : 0), (2 : 1 : 1), (2 : 2 : 1), (2 : 3 : 1), (2 : 4 : 1), (3 : 0 : 1), (3 : 1 : 0), (3 : 1 : 1), (3 : 2 : 1), (3 : 3 : 1), (3 : 4 : 1), (4 : 2 : 1), (4 : 3 : 1)] @@ -4437,7 +4437,7 @@ def preperiodic_points(self, m, n, **kwds): sage: P. = ProjectiveSpace(QQ, 1) sage: R. = QQ[] - sage: K. = NumberField(z^4 - z^2 - 1) + sage: K. = NumberField(z^4 - z^2 - 1) # needs sage.rings.number_field sage: f = DynamicalSystem_projective([x^2 - y^2, y^2]) sage: sorted(f.preperiodic_points(2, 1, R=K), key=str) [(-v : 1), (v : 1)] @@ -4446,7 +4446,7 @@ def preperiodic_points(self, m, n, **kwds): sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2 - 3/4*y^2, y^2, z^2]) - sage: f.preperiodic_points(0, 2, formal=True) + sage: f.preperiodic_points(0, 2, formal=True) # needs sage.rings.function_field [(-1/2 : 1 : 0), (-1/2 : 1 : 1)] :: @@ -4455,7 +4455,7 @@ def preperiodic_points(self, m, n, **kwds): sage: R. = PolynomialRing(S, 2) sage: P = ProjectiveSpace(R) sage: f = DynamicalSystem_projective([x^2 + c*y^2, y^2]) - sage: f.preperiodic_points(1, 2, return_scheme=True) + sage: f.preperiodic_points(1, 2, return_scheme=True) # needs sage.rings.function_field Closed subscheme of Projective Space of dimension 1 over Univariate Polynomial Ring in c over Rational Field defined by: x^2 - x*y + (c + 1)*y^2 @@ -4464,7 +4464,7 @@ def preperiodic_points(self, m, n, **kwds): sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2, x*y, z^2]) - sage: f.preperiodic_points(2, 1, minimal=False) + sage: f.preperiodic_points(2, 1, minimal=False) # needs sage.rings.function_field Traceback (most recent call last): ... TypeError: use return_scheme=True @@ -4486,14 +4486,14 @@ def preperiodic_points(self, m, n, **kwds): sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem([x^2 - z^2, y^2 - 21/16*z^2, z^2]) - sage: len(f.preperiodic_points(1, 2, minimal=True, formal=False)) == 16 + sage: len(f.preperiodic_points(1, 2, minimal=True, formal=False)) == 16 # needs sage.rings.function_field True :: sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2 - y^2, 2*(x^2 - y^2), y^2 - z^2]) - sage: f.preperiodic_points(2, 2) + sage: f.preperiodic_points(2, 2) # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: dynamical system is not a morphism, @@ -4662,18 +4662,18 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari EXAMPLES:: sage: set_verbose(None) - sage: P. = ProjectiveSpace(QQbar, 1) - sage: f = DynamicalSystem_projective([x^2 - x*y + y^2, x^2 - y^2 + x*y]) - sage: f.periodic_points(1) + sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 - x*y + y^2, x^2 - y^2 + x*y]) # needs sage.rings.number_field + sage: f.periodic_points(1) # needs sage.rings.number_field [(-0.50000000000000000? - 0.866025403784439?*I : 1), (-0.50000000000000000? + 0.866025403784439?*I : 1), (1 : 1)] :: - sage: P. = ProjectiveSpace(QuadraticField(5,'t'), 2) - sage: f = DynamicalSystem_projective([x^2 - 21/16*z^2, y^2 - z^2, z^2]) - sage: f.periodic_points(2) + sage: P. = ProjectiveSpace(QuadraticField(5,'t'), 2) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 - 21/16*z^2, y^2 - z^2, z^2]) # needs sage.rings.number_field + sage: f.periodic_points(2) # needs sage.rings.number_field [(-5/4 : -1 : 1), (-5/4 : -1/2*t + 1/2 : 1), (-5/4 : 0 : 1), (-5/4 : 1/2*t + 1/2 : 1), (-3/4 : -1 : 1), (-3/4 : 0 : 1), (1/4 : -1 : 1), (1/4 : -1/2*t + 1/2 : 1), (1/4 : 0 : 1), @@ -4683,16 +4683,16 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2 - 3/4*y^2, y^2 , z^2]) - sage: f.periodic_points(2, formal=True) + sage: f.periodic_points(2, formal=True) # needs sage.rings.function_field [(-1/2 : 1 : 0), (-1/2 : 1 : 1)] :: sage: w = QQ['w'].0 - sage: K = NumberField(w^6 - 3*w^5 + 5*w^4 - 5*w^3 + 5*w^2 - 3*w + 1,'s') - sage: P. = ProjectiveSpace(K, 2) + sage: K = NumberField(w^6 - 3*w^5 + 5*w^4 - 5*w^3 + 5*w^2 - 3*w + 1,'s') # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field sage: f = DynamicalSystem_projective([x^2 + z^2, y^2 + x^2, z^2 + y^2]) - sage: sorted(f.periodic_points(1), key=str) + sage: sorted(f.periodic_points(1), key=str) # needs sage.rings.function_field sage.rings.number_field [(-2*s^5 + 4*s^4 - 5*s^3 + 3*s^2 - 4*s : -2*s^5 + 5*s^4 - 7*s^3 + 6*s^2 - 7*s + 3 : 1), (-s^5 + 3*s^4 - 4*s^3 + 4*s^2 - 4*s + 2 : -s^5 + 2*s^4 - 2*s^3 + s^2 - s : 1), (-s^5 + 3*s^4 - 5*s^3 + 4*s^2 - 3*s + 1 : s^5 - 2*s^4 + 3*s^3 - 3*s^2 + 4*s - 1 : 1), @@ -4705,7 +4705,7 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2 - 21/16*z^2, y^2 - 2*z^2, z^2]) - sage: f.periodic_points(2, False) + sage: f.periodic_points(2, False) # needs sage.rings.function_field [(-5/4 : -1 : 1), (-5/4 : 2 : 1), (-3/4 : -1 : 1), (-3/4 : 2 : 1), (0 : 1 : 0), (1/4 : -1 : 1), (1/4 : 2 : 1), (1 : 0 : 0), (1 : 1 : 0), (7/4 : -1 : 1), (7/4 : 2 : 1)] @@ -4714,7 +4714,7 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2 - 21/16*z^2, y^2 - 2*z^2, z^2]) - sage: f.periodic_points(2) + sage: f.periodic_points(2) # needs sage.rings.function_field [(-5/4 : -1 : 1), (-5/4 : 2 : 1), (1/4 : -1 : 1), (1/4 : 2 : 1)] :: @@ -4722,7 +4722,7 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari sage: set_verbose(None) sage: P. = ProjectiveSpace(ZZ, 1) sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) - sage: f.periodic_points(2, R=QQbar, minimal=False) + sage: f.periodic_points(2, R=QQbar, minimal=False) # needs sage.rings.number_field [(-0.50000000000000000? - 1.322875655532296?*I : 1), (-0.50000000000000000? + 1.322875655532296?*I : 1), (0.50000000000000000? - 0.866025403784439?*I : 1), @@ -4733,23 +4733,23 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2 - 3/4*z^2, y^2 - 3/4*z^2, z^2]) - sage: f.periodic_points(2, formal=True) + sage: f.periodic_points(2, formal=True) # needs sage.rings.function_field [(-1/2 : -1/2 : 1), (-1/2 : 3/2 : 1), (3/2 : -1/2 : 1)] :: sage: P. = ProjectiveSpace(GF(307), 1) sage: f = DynamicalSystem_projective([x^10 + y^10, y^10]) - sage: f.periodic_points(16, minimal=True, algorithm='cyclegraph') + sage: f.periodic_points(16, minimal=True, algorithm='cyclegraph') # needs sage.graphs [(69 : 1), (185 : 1), (120 : 1), (136 : 1), (97 : 1), (183 : 1), (170 : 1), (105 : 1), (274 : 1), (275 : 1), (154 : 1), (156 : 1), (87 : 1), (95 : 1), (161 : 1), (128 : 1)] :: - sage: P. = ProjectiveSpace(GF(13^2, 't'), 1) + sage: P. = ProjectiveSpace(GF(13^2, 't'), 1) # needs sage.rings.finite_rings sage: f = DynamicalSystem_projective([x^3 + 3*y^3, x^2*y]) - sage: f.periodic_points(30, minimal=True, algorithm='cyclegraph') + sage: f.periodic_points(30, minimal=True, algorithm='cyclegraph') # needs sage.graphs sage.rings.finite_rings [(t + 3 : 1), (6*t + 6 : 1), (7*t + 1 : 1), (2*t + 8 : 1), (3*t + 4 : 1), (10*t + 12 : 1), (8*t + 10 : 1), (5*t + 11 : 1), (7*t + 4 : 1), (4*t + 8 : 1), (9*t + 1 : 1), (2*t + 2 : 1), @@ -4763,16 +4763,16 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([3*x^2 + 5*y^2, y^2]) - sage: f.periodic_points(2, R=GF(3), minimal=False) + sage: f.periodic_points(2, R=GF(3), minimal=False) # needs sage.rings.function_field [(2 : 1)] - sage: f.periodic_points(2, R=GF(7)) + sage: f.periodic_points(2, R=GF(7)) # needs sage.rings.function_field [] :: sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2, x*y, z^2]) - sage: f.periodic_points(1) + sage: f.periodic_points(1) # needs sage.rings.function_field Traceback (most recent call last): ... TypeError: use return_scheme=True @@ -4780,19 +4780,19 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari :: sage: R. = QQ[] - sage: K. = NumberField(x^2 - x + 3) - sage: P. = ProjectiveSpace(K, 2) + sage: K. = NumberField(x^2 - x + 3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field sage: X = P.subscheme(2*x - y) sage: f = DynamicalSystem_projective([x^2 - y^2, 2*(x^2 - y^2), y^2 - z^2], ....: domain=X) - sage: f.periodic_points(2) + sage: f.periodic_points(2) # needs sage.rings.function_field sage.rings.number_field [(-1/5*u - 1/5 : -2/5*u - 2/5 : 1), (1/5*u - 2/5 : 2/5*u - 4/5 : 1)] :: sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2 - y^2, x^2 - z^2, y^2 - z^2]) - sage: f.periodic_points(1) + sage: f.periodic_points(1) # needs sage.rings.function_field [(-1 : 0 : 1)] sage: f.periodic_points(1, return_scheme=True) Closed subscheme of Projective Space of dimension 2 over Rational Field @@ -4805,7 +4805,7 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari sage: P.=ProjectiveSpace(GF(3), 1) sage: f = DynamicalSystem_projective([x^2 - 2*y^2, y^2]) - sage: f.periodic_points(2, R=GF(3^2,'t')) + sage: f.periodic_points(2, R=GF(3^2,'t')) # needs sage.rings.finite_rings [(t + 2 : 1), (2*t : 1)] :: @@ -4814,7 +4814,7 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari sage: R. = PolynomialRing(S, 2) sage: P = ProjectiveSpace(R) sage: f = DynamicalSystem_projective([x^2 + c*y^2, y^2]) - sage: f.periodic_points(2, return_scheme=True) + sage: f.periodic_points(2, return_scheme=True) # needs sage.rings.function_field Closed subscheme of Projective Space of dimension 1 over Univariate Polynomial Ring in c over Rational Field defined by: x^2 + x*y + (c + 1)*y^2 @@ -4831,7 +4831,7 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2 - y^2, 2*(x^2 - y^2), y^2 - z^2]) - sage: f.periodic_points(2, minimal=True) + sage: f.periodic_points(2, minimal=True) # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: dynamical system is not a morphism, cannot calculate minimal or formal periodic points @@ -5012,16 +5012,16 @@ def multiplier_spectra(self, n, formal=False, type='point', use_algebraic_closur sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 - 3/4*y^2, y^2]) - sage: sorted(f.multiplier_spectra(2, type='point')) + sage: sorted(f.multiplier_spectra(2, type='point')) # needs sage.rings.number_field [0, 1, 1, 1, 9] - sage: sorted(f.multiplier_spectra(2, type='cycle')) + sage: sorted(f.multiplier_spectra(2, type='cycle')) # needs sage.rings.number_field [0, 1, 1, 9] :: sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2, z^2, y^2]) - sage: f.multiplier_spectra(1) + sage: f.multiplier_spectra(1) # needs sage.rings.number_field [ [ 2 1 - 1.732050807568878?*I] [ 0 -2], @@ -5047,10 +5047,10 @@ def multiplier_spectra(self, n, formal=False, type='point', use_algebraic_closur sage: set_verbose(None) sage: z = QQ['z'].0 - sage: K. = NumberField(z^4 - 4*z^2 + 1,'z') - sage: P. = ProjectiveSpace(K, 1) - sage: f = DynamicalSystem_projective([x^2 - w/4*y^2, y^2]) - sage: sorted(f.multiplier_spectra(2, formal=False, type='cycle')) + sage: K. = NumberField(z^4 - 4*z^2 + 1,'z') # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 - w/4*y^2, y^2]) # needs sage.rings.number_field + sage: sorted(f.multiplier_spectra(2, formal=False, type='cycle')) # needs sage.rings.number_field [0, 0.0681483474218635? - 1.930649271699173?*I, 0.0681483474218635? + 1.930649271699173?*I, @@ -5064,7 +5064,7 @@ def multiplier_spectra(self, n, formal=False, type='point', use_algebraic_closur ....: + 2317935971590902*x^4*y^6 - 15344764859590852*x^3*y^7 ....: + 2561851642765275*x^2*y^8 + 113578270285012470*x*y^9 ....: - 150049940203963800*y^10, 4608*y^10]) - sage: sorted(f.multiplier_spectra(1)) + sage: sorted(f.multiplier_spectra(1)) # needs sage.rings.number_field [-119820502365680843999, -7198147681176255644585/256, -3086380435599991/9, @@ -5081,22 +5081,22 @@ def multiplier_spectra(self, n, formal=False, type='point', use_algebraic_closur sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 - 7/4*y^2, y^2]) - sage: f.multiplier_spectra(3, formal=True, type='cycle') + sage: f.multiplier_spectra(3, formal=True, type='cycle') # needs sage.rings.number_field [1, 1] - sage: f.multiplier_spectra(3, formal=True, type='point') + sage: f.multiplier_spectra(3, formal=True, type='point') # needs sage.rings.number_field [1, 1, 1, 1, 1, 1] :: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^4 + 3*y^4, 4*x^2*y^2]) - sage: f.multiplier_spectra(1, use_algebraic_closure=False) + sage: f.multiplier_spectra(1, use_algebraic_closure=False) # needs sage.rings.number_field [0, -1, 1/128*a^5 - 13/384*a^4 + 5/96*a^3 + 1/16*a^2 + 43/128*a + 303/128, -1/288*a^5 + 1/96*a^4 + 1/24*a^3 - 1/3*a^2 + 5/32*a - 115/32, -5/1152*a^5 + 3/128*a^4 - 3/32*a^3 + 13/48*a^2 - 63/128*a - 227/128] - sage: f.multiplier_spectra(1) + sage: f.multiplier_spectra(1) # needs sage.rings.number_field [0, -1, 1.951373035591442?, @@ -5107,16 +5107,16 @@ def multiplier_spectra(self, n, formal=False, type='point', use_algebraic_closur sage: P. = ProjectiveSpace(GF(5), 1) sage: f = DynamicalSystem_projective([x^4 + 2*y^4, 4*x^2*y^2]) - sage: f.multiplier_spectra(1, use_algebraic_closure=False) + sage: f.multiplier_spectra(1, use_algebraic_closure=False) # needs sage.rings.finite_rings [0, 3*a + 3, 2*a + 1, 1, 1] sage: f.multiplier_spectra(1) [0, 2*z2 + 1, 3*z2 + 3, 1, 1] :: - sage: P. = ProjectiveSpace(QQbar, 1) + sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field sage: f = DynamicalSystem_projective([x^5 + 3*y^5, 4*x^3*y^2]) - sage: f.multiplier_spectra(1) + sage: f.multiplier_spectra(1) # needs sage.rings.number_field [0, -4.106544657178796?, -7/4, @@ -5136,7 +5136,7 @@ def multiplier_spectra(self, n, formal=False, type='point', use_algebraic_closur sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 + y^2, x*y]) - sage: f.multiplier_spectra(1) + sage: f.multiplier_spectra(1) # needs sage.rings.number_field [1, 1, 1] :: @@ -5144,7 +5144,7 @@ def multiplier_spectra(self, n, formal=False, type='point', use_algebraic_closur sage: K = GF(3).algebraic_closure() sage: P. = ProjectiveSpace(K, 2) sage: f = DynamicalSystem_projective([x^2 + 2*y^2, 4*x*y, z^2]) - sage: f.multiplier_spectra(1) + sage: f.multiplier_spectra(1) # needs sage.rings.number_field [ [0 0] [1 0] [1 0] [1 0] [2 0] [2 0] [2 0] [0 0], [0 0], [0 0], [0 0], [0 1], [0 1], [0 1] @@ -5153,7 +5153,7 @@ def multiplier_spectra(self, n, formal=False, type='point', use_algebraic_closur :: sage: F. = GF(7) - sage: P.=ProjectiveSpace(F, 1) + sage: P. = ProjectiveSpace(F, 1) sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) sage: sorted(f.multiplier_spectra(1)) [0, 3, 6] @@ -5162,16 +5162,16 @@ def multiplier_spectra(self, n, formal=False, type='point', use_algebraic_closur sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2, z^2, y^2]) - sage: g = f.change_ring(QQbar) - sage: f.multiplier_spectra(1) == g.multiplier_spectra(1) # long time + sage: g = f.change_ring(QQbar) # needs sage.rings.number_field + sage: f.multiplier_spectra(1) == g.multiplier_spectra(1) # long time, needs sage.rings.number_field True :: - sage: K. = QuadraticField(5) - sage: P. = ProjectiveSpace(K, 2) - sage: f = DynamicalSystem_projective([x^2 + w*x*y + y^2, y^2, z^2]) - sage: f.multiplier_spectra(1) # long time + sage: K. = QuadraticField(5) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 + w*x*y + y^2, y^2, z^2]) # needs sage.rings.number_field + sage: f.multiplier_spectra(1) # long time, needs sage.rings.number_field [ [1.000000000000000? - 1.572302755514847?*I 0] [1.000000000000000? - 1.572302755514847?*I 0.618033988749895? - 1.757887921270715?*I] @@ -5189,7 +5189,7 @@ def multiplier_spectra(self, n, formal=False, type='point', use_algebraic_closur sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2, z^2, y^2]) - sage: f.multiplier_spectra(1, use_algebraic_closure=False) + sage: f.multiplier_spectra(1, use_algebraic_closure=False) # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: failed to compute the full multiplier spectra. Try use_algebraic_closure=True @@ -5496,7 +5496,7 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 + x*y + y^2, y^2 + x*y]) - sage: f.sigma_invariants(1) + sage: f.sigma_invariants(1) # needs sage.rings.number_field [3, 3, 1] If ``return_polynomial`` is ``True``, then following [Hutz2019]_ @@ -5513,7 +5513,7 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', sage: w, t = poly.variables() sage: poly.specialization({w:0}).monic() t^3 - 2*t^2 + 8*t - sage: f.sigma_invariants(1) + sage: f.sigma_invariants(1) # needs sage.rings.number_field [2, 8, 0] For dynamical systems on `\mathbb{P}^N`, where `N > 1`, the full polynomial @@ -5556,35 +5556,35 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', sage: set_verbose(None) sage: z = QQ['z'].0 - sage: K = NumberField(z^4 - 4*z^2 + 1, 'z') - sage: P. = ProjectiveSpace(K, 1) - sage: f = DynamicalSystem_projective([x^2 - 5/4*y^2, y^2]) - sage: f.sigma_invariants(2, formal=False, type='cycle') + sage: K = NumberField(z^4 - 4*z^2 + 1, 'z') # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 - 5/4*y^2, y^2]) # needs sage.rings.number_field + sage: f.sigma_invariants(2, formal=False, type='cycle') # needs sage.rings.number_field [13, 11, -25, 0] - sage: f.sigma_invariants(2, formal=False, type='point') + sage: f.sigma_invariants(2, formal=False, type='point') # needs sage.rings.number_field [12, -2, -36, 25, 0] check that infinity as part of a longer cycle is handled correctly:: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([y^2, x^2]) - sage: f.sigma_invariants(2, type='cycle') + sage: f.sigma_invariants(2, type='cycle') # needs sage.rings.number_field [12, 48, 64, 0] - sage: f.sigma_invariants(2, type='point') + sage: f.sigma_invariants(2, type='point') # needs sage.rings.number_field [12, 48, 64, 0, 0] - sage: f.sigma_invariants(2, type='cycle', formal=True) + sage: f.sigma_invariants(2, type='cycle', formal=True) # needs sage.rings.number_field [0] - sage: f.sigma_invariants(2, type='point', formal=True) + sage: f.sigma_invariants(2, type='point', formal=True) # needs sage.rings.number_field [0, 0] :: - sage: K. = QuadraticField(3) - sage: P. = ProjectiveSpace(K, 1) - sage: f = DynamicalSystem_projective([x^2 - w*y^2, (1-w)*x*y]) - sage: f.sigma_invariants(2, formal=False, type='cycle') + sage: K. = QuadraticField(3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 - w*y^2, (1-w)*x*y]) # needs sage.rings.number_field + sage: f.sigma_invariants(2, formal=False, type='cycle') # needs sage.rings.number_field [6*w + 21, 78*w + 159, 210*w + 367, 90*w + 156] - sage: f.sigma_invariants(2, formal=False, type='point') + sage: f.sigma_invariants(2, formal=False, type='point') # needs sage.rings.number_field [6*w + 24, 96*w + 222, 444*w + 844, 720*w + 1257, 270*w + 468] :: @@ -5592,7 +5592,7 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([512*x^5 - 378128*x^4*y + 76594292*x^3*y^2 ....: - 4570550136*x^2*y^3 - 2630045017*x*y^4 + 28193217129*y^5, 512*y^5]) - sage: f.sigma_invariants(1) + sage: f.sigma_invariants(1) # needs sage.rings.number_field [19575526074450617/1048576, -9078122048145044298567432325/2147483648, -2622661114909099878224381377917540931367/1099511627776, -2622661107937102104196133701280271632423/549755813888, @@ -5612,11 +5612,11 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', sage: R. = QQ[] sage: Pc. = ProjectiveSpace(R, 1) sage: f = DynamicalSystem_projective([x^2 + c*y^2, y^2]) - sage: f.sigma_invariants(1) + sage: f.sigma_invariants(1) # needs sage.rings.number_field [2, 4*c, 0] - sage: f.sigma_invariants(2, formal=True, type='point') + sage: f.sigma_invariants(2, formal=True, type='point') # needs sage.rings.number_field [8*c + 8, 16*c^2 + 32*c + 16] - sage: f.sigma_invariants(2, formal=True, type='cycle') + sage: f.sigma_invariants(2, formal=True, type='cycle') # needs sage.rings.number_field [4*c + 4] :: @@ -5626,7 +5626,7 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', sage: f = DynamicalSystem([x^2 + c*y^2, y^2]) sage: f.sigma_invariants(1, return_polynomial=True) w^3 + (-3)*w^2*t + 2*w^2 + 3*w*t^2 + (-4)*w*t + 4*c*w - t^3 + 2*t^2 + (-4*c)*t - sage: f.sigma_invariants(2, chow=True, formal=True, return_polynomial=True) + sage: f.sigma_invariants(2, chow=True, formal=True, return_polynomial=True) # needs sage.libs.pari w^2 + (-2)*w*t + (8*c + 8)*w + t^2 + (-8*c - 8)*t + 16*c^2 + 32*c + 16 :: @@ -5641,21 +5641,21 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([x^2 + 3*y^2, x*y]) - sage: f.sigma_invariants(1, deform = True, return_polynomial=True) + sage: f.sigma_invariants(1, deform=True, return_polynomial=True) # needs sage.rings.function_field w^3 - 3*w^2*t + 3*w^2 + 3*w*t^2 - 6*w*t + 3*w - t^3 + 3*t^2 - 3*t + 1 doubled fixed point:: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 - 3/4*y^2, y^2]) - sage: f.sigma_invariants(2, formal=True) + sage: f.sigma_invariants(2, formal=True) # needs sage.rings.number_field [2, 1] doubled 2 cycle:: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 - 5/4*y^2, y^2]) - sage: f.sigma_invariants(4, formal=False, type='cycle') + sage: f.sigma_invariants(4, formal=False, type='cycle') # needs sage.rings.number_field [170, 5195, 172700, 968615, 1439066, 638125, 0] TESTS:: @@ -5663,16 +5663,16 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', sage: F. = FunctionField(GF(5)) sage: P. = ProjectiveSpace(F,1) sage: f = DynamicalSystem_projective([x^2 + (t/(t^2+1))*y^2, y^2], P) - sage: f.sigma_invariants(1) + sage: f.sigma_invariants(1) # needs sage.rings.number_field [2, 4*t/(t^2 + 1), 0] :: sage: R. = QQ[] - sage: N. = NumberField(w^2 + 1) - sage: P. = ProjectiveSpace(N, 2) - sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) - sage: f.sigma_invariants(1, chow=True) == f.change_ring(QQ).sigma_invariants(1, chow=True) + sage: N. = NumberField(w^2 + 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(N, 2) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) # needs sage.rings.number_field + sage: f.sigma_invariants(1, chow=True) == f.change_ring(QQ).sigma_invariants(1, chow=True) # needs sage.rings.number_field True :: @@ -6078,31 +6078,31 @@ def reduced_form(self, **kwds): :: sage: P. = ProjectiveSpace(RR, 1) - sage: f = DynamicalSystem_projective([x^4, RR(sqrt(2))*y^4]) # optional - sage.symbolic + sage: f = DynamicalSystem_projective([x^4, RR(sqrt(2))*y^4]) # needs sage.symbolic sage: m = matrix(RR, 2, 2, [1,12,0,1]) - sage: f = f.conjugate(m) # optional - sage.symbolic - sage: g, m = f.reduced_form(smallest_coeffs=False); m # optional - sage.symbolic + sage: f = f.conjugate(m) # needs sage.symbolic + sage: g, m = f.reduced_form(smallest_coeffs=False); m # needs sage.symbolic [ 1 -12] [ 0 1] :: sage: P. = ProjectiveSpace(CC, 1) - sage: f = DynamicalSystem_projective([x^4, CC(sqrt(-2))*y^4]) # optional - sage.symbolic + sage: f = DynamicalSystem_projective([x^4, CC(sqrt(-2))*y^4]) # needs sage.symbolic sage: m = matrix(CC, 2, 2, [1,12,0,1]) - sage: f = f.conjugate(m) # optional - sage.symbolic - sage: g, m = f.reduced_form(smallest_coeffs=False); m # optional - sage.symbolic + sage: f = f.conjugate(m) + sage: g, m = f.reduced_form(smallest_coeffs=False); m # needs sage.symbolic [ 1 -12] [ 0 1] :: - sage: K. = QuadraticField(2) - sage: P. = ProjectiveSpace(K, 1) - sage: f = DynamicalSystem_projective([x^3, w*y^3]) - sage: m = matrix(K, 2, 2, [1,12,0,1]) + sage: K. = QuadraticField(2) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^3, w*y^3]) # needs sage.rings.number_field + sage: m = matrix(K, 2, 2, [1,12,0,1]) # needs sage.rings.number_field sage: f = f.conjugate(m) - sage: f.reduced_form(smallest_coeffs=False) + sage: f.reduced_form(smallest_coeffs=False) # needs sage.rings.number_field ( Dynamical System of Projective Space of dimension 1 over Number Field in w with defining polynomial x^2 - 2 with w = 1.414213562373095? @@ -6115,13 +6115,13 @@ def reduced_form(self, **kwds): :: sage: R. = QQ[] - sage: K. = NumberField(x^5 + x - 3, + sage: K. = NumberField(x^5 + x - 3, # needs sage.rings.number_field ....: embedding=(x^5 + x - 3).roots(ring=CC)[0][0]) - sage: P. = ProjectiveSpace(K, 1) - sage: f = DynamicalSystem_projective([12*x^3, 2334*w*y^3]) - sage: m = matrix(K, 2, 2, [-12,1,1,0]) + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([12*x^3, 2334*w*y^3]) # needs sage.rings.number_field + sage: m = matrix(K, 2, 2, [-12,1,1,0]) # needs sage.rings.number_field sage: f = f.conjugate(m) - sage: f.reduced_form(smallest_coeffs=False) + sage: f.reduced_form(smallest_coeffs=False) # needs sage.rings.number_field ( Dynamical System of Projective Space of dimension 1 over Number Field in w with defining polynomial x^5 + x - 3 with w = 1.132997565885066? @@ -6303,17 +6303,17 @@ def _is_preperiodic(self, P, 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) sage: Q = P(-1, 1) - sage: f._is_preperiodic(Q) + sage: f._is_preperiodic(Q) # needs sage.rings.function_field True Check that :trac:`23814` is fixed (works even if domain is not specified):: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(X^2 + X - 1) - sage: P. = ProjectiveSpace(K,1) + sage: K. = NumberField(X^2 + X - 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field sage: f = DynamicalSystem_projective([x^2 - 2*y^2, y^2]) - sage: Q = P.point([a,1]) - sage: Q.is_preperiodic(f) + sage: Q = P.point([a,1]) # needs sage.rings.number_field + sage: Q.is_preperiodic(f) # needs sage.rings.function_field sage.rings.number_field True :: @@ -6322,7 +6322,7 @@ def _is_preperiodic(self, P, err=0.1, return_period=False): sage: X = P.subscheme(z) sage: f = DynamicalSystem([x^2 - y^2, y^2, z^2], domain=X) sage: p = X((-1, 1, 0)) - sage: f._is_preperiodic(p, return_period=True) + sage: f._is_preperiodic(p, return_period=True) # needs sage.rings.function_field (0, 2) :: @@ -6331,7 +6331,7 @@ def _is_preperiodic(self, P, err=0.1, return_period=False): sage: X = P.subscheme(x) sage: f = DynamicalSystem([x^2 - y^2, y^2, z^2], domain=X) sage: p = X((0, 1, 0)) - sage: f._is_preperiodic(p, return_period=True) + sage: f._is_preperiodic(p, return_period=True) # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: orbit of point leaves domain @@ -6339,12 +6339,12 @@ def _is_preperiodic(self, P, err=0.1, return_period=False): :: sage: R. = QQ[] - sage: K. = NumberField(t^2 - t - 1) - sage: P. = ProjectiveSpace(K, 2) + sage: K. = NumberField(t^2 - t - 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field sage: X = P.subscheme(z) sage: f = DynamicalSystem([x^2 - y^2, y^2, z^2], domain=X) - sage: p = X((-a + 1, 1, 0)) - sage: f._is_preperiodic(p) + sage: p = X((-a + 1, 1, 0)) # needs sage.rings.number_field + sage: f._is_preperiodic(p) # needs sage.rings.function_field sage.rings.number_field True """ codomain = self.codomain() @@ -6428,41 +6428,41 @@ def postcritical_set(self, check=True): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([x^3 - 3/2* x*y^2, y^3]) - sage: f.postcritical_set() + sage: f.postcritical_set() # needs sage.rings.number_field [(1/2*a : 1), (-1/2*a : 1), (1 : 0)] :: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([3*x^3 - 9/2* x^2*y+y^3, y^3]) - sage: f.postcritical_set(check=False) + sage: f.postcritical_set(check=False) # needs sage.rings.number_field [(1 : 1), (-1/2 : 1), (1 : 0)] :: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([-4*y^2, 9*x^2 - 12*x*y]) - sage: f.postcritical_set() + sage: f.postcritical_set() # needs sage.rings.number_field [(1 : 1), (4/3 : 1), (1 : 0), (0 : 1)] :: - sage: K. = QuadraticField(2) - sage: P. = ProjectiveSpace(K,1) + sage: K. = QuadraticField(2) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field sage: f = DynamicalSystem([x^2 + (-2)*y^2, y^2]) - sage: m = matrix(K, 2, 2, [v, 1, 0, 1]) - sage: g = f.conjugate(m) - sage: g.postcritical_set() + sage: m = matrix(K, 2, 2, [v, 1, 0, 1]) # needs sage.rings.number_field + sage: g = f.conjugate(m) # needs sage.rings.number_field + sage: g.postcritical_set() # needs sage.rings.number_field [(-3/2*a : 1), (1/2*a : 1), (1 : 0)] :: - sage: F. = FiniteField(9) - sage: P. = ProjectiveSpace(F, 1) + sage: F. = FiniteField(9) # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(F, 1) # needs sage.rings.finite_rings sage: f = DynamicalSystem([x^2 + (-2)*y^2, y^2]) - sage: m = matrix(F, 2, 2, [z, 1, 0, 1]) - sage: g = f.conjugate(m) - sage: g.postcritical_set() + sage: m = matrix(F, 2, 2, [z, 1, 0, 1]) # needs sage.rings.finite_rings + sage: g = f.conjugate(m) # needs sage.rings.finite_rings + sage: g.postcritical_set() # needs sage.rings.finite_rings [(1 : 0), (0 : 1), (a + 2 : 1)] """ if not is_ProjectiveSpace(self.domain()): @@ -6822,7 +6822,7 @@ def lift_to_rational_periodic(self, points_modp, B=None): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2 - y^2, y^2]) - sage: f.lift_to_rational_periodic([[P(0,1).change_ring(GF(7)), 4]]) + sage: f.lift_to_rational_periodic([[P(0,1).change_ring(GF(7)), 4]]) # needs sage.symbolic [[(0 : 1), 2]] :: @@ -6837,7 +6837,7 @@ def lift_to_rational_periodic(self, points_modp, B=None): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([16*x^2 - 29*y^2, 16*y^2]) - sage: f.lift_to_rational_periodic([[P(3,1).change_ring(GF(13)), 3]]) + sage: f.lift_to_rational_periodic([[P(3,1).change_ring(GF(13)), 3]]) # needs sage.symbolic [[(-1/4 : 1), 3]] :: @@ -7087,19 +7087,19 @@ def all_periodic_points(self, **kwds): :: sage: R. = QQ[] - sage: K. = NumberField(x^2 - x + 1) - sage: P. = ProjectiveSpace(K,1) - sage: f = DynamicalSystem_projective([u^2 + v^2, v^2]) - sage: sorted(f.all_periodic_points()) + sage: K. = NumberField(x^2 - x + 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([u^2 + v^2, v^2]) # needs sage.rings.number_field + sage: sorted(f.all_periodic_points()) # needs sage.rings.function_field sage.rings.number_field [(-w + 1 : 1), (w : 1), (1 : 0)] :: sage: R. = QQ[] - sage: K. = NumberField(x^2 - x + 1) - sage: P. = ProjectiveSpace(K,1) - sage: f = DynamicalSystem_projective([u^2 + v^2, u*v]) - sage: f.all_periodic_points() + sage: K. = NumberField(x^2 - x + 1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([u^2 + v^2, u*v]) # needs sage.rings.number_field + sage: f.all_periodic_points() # needs sage.rings.function_field sage.rings.number_field Traceback (most recent call last): ... NotImplementedError: rational periodic points for number fields @@ -7108,10 +7108,10 @@ def all_periodic_points(self, **kwds): :: sage: P. = ProjectiveSpace(QQ, 1) - sage: K. = QuadraticField(5) - sage: phi = QQ.embeddings(K)[0] + sage: K. = QuadraticField(5) # needs sage.rings.number_field + sage: phi = QQ.embeddings(K)[0] # needs sage.rings.number_field sage: f = DynamicalSystem_projective([x^2 - y^2, y^2]) - sage: sorted(f.all_periodic_points(R=phi)) + sage: sorted(f.all_periodic_points(R=phi)) # needs sage.rings.number_field [(-1 : 1), (-1/2*v + 1/2 : 1), (0 : 1), (1 : 0), (1/2*v + 1/2 : 1)] :: @@ -7119,7 +7119,7 @@ def all_periodic_points(self, **kwds): sage: P. = ProjectiveSpace(QQ, 3) sage: f = DynamicalSystem_projective([x^2 - (3/4)*w^2, y^2 - 3/4*w^2, ....: z^2 - 3/4*w^2, w^2]) - sage: sorted(f.all_periodic_points(algorithm="dynatomic")) + sage: sorted(f.all_periodic_points(algorithm="dynatomic")) # needs sage.rings.function_field [(-1/2 : -1/2 : -1/2 : 1), (-1/2 : -1/2 : 3/2 : 1), (-1/2 : 3/2 : -1/2 : 1), @@ -7140,7 +7140,7 @@ def all_periodic_points(self, **kwds): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 - 3/4*y^2, y^2]) - sage: sorted(f.all_periodic_points(period_degree_bounds=[2,2])) + sage: sorted(f.all_periodic_points(period_degree_bounds=[2,2])) # needs sage.rings.function_field [(-1/2 : 1), (1 : 0), (3/2 : 1)] TESTS:: @@ -7293,7 +7293,7 @@ def all_rational_preimages(self, points): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([16*x^2 - 29*y^2, 16*y^2]) - sage: sorted(f.all_rational_preimages([P(-1,4)])) + sage: sorted(f.all_rational_preimages([P(-1,4)])) # needs sage.rings.function_field [(-7/4 : 1), (-5/4 : 1), (-3/4 : 1), (-1/4 : 1), (1/4 : 1), (3/4 : 1), (5/4 : 1), (7/4 : 1)] @@ -7304,7 +7304,7 @@ def all_rational_preimages(self, points): ....: + 45*y*z - 90*z^2, ....: 67*x^2 - 180*x*y - 157*x*z + 90*y*z, ....: -90*z^2]) - sage: sorted(f.all_rational_preimages([P(-9,-4,1)])) + sage: sorted(f.all_rational_preimages([P(-9,-4,1)])) # needs sage.rings.function_field [(-9 : -4 : 1), (0 : -1 : 1), (0 : 0 : 1), (0 : 1 : 1), (0 : 4 : 1), (1 : 0 : 1), (1 : 1 : 1), (1 : 2 : 1), (1 : 3 : 1)] @@ -7312,16 +7312,16 @@ def all_rational_preimages(self, points): sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2 + y^2, 2*x*y]) - sage: sorted(f.all_rational_preimages([P(17,15)])) + sage: sorted(f.all_rational_preimages([P(17,15)])) # needs sage.rings.function_field [(1/3 : 1), (3/5 : 1), (5/3 : 1), (3 : 1)] A number field example:: sage: z = QQ['z'].0 - sage: K. = NumberField(z^3 + (z^2)/4 - (41/16)*z + 23/64) - sage: P. = ProjectiveSpace(K,1) + sage: K. = NumberField(z^3 + (z^2)/4 - (41/16)*z + 23/64) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field sage: f = DynamicalSystem_projective([16*x^2 - 29*y^2, 16*y^2]) - sage: sorted(f.all_rational_preimages([P(16*w^2 - 29, 16)]), key=str) + sage: sorted(f.all_rational_preimages([P(16*w^2 - 29, 16)]), key=str) # needs sage.rings.number_field [(-w - 1/2 : 1), (-w : 1), (-w^2 + 21/16 : 1), @@ -7337,10 +7337,10 @@ def all_rational_preimages(self, points): :: - sage: K. = QuadraticField(3) - sage: P. = ProjectiveSpace(K,1) - sage: f = DynamicalSystem_projective([u^2 + v^2, v^2]) - sage: f.all_rational_preimages(P(4)) + sage: K. = QuadraticField(3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([u^2 + v^2, v^2]) # needs sage.rings.number_field + sage: f.all_rational_preimages(P(4)) # needs sage.rings.function_field sage.rings.number_field [(-w : 1), (w : 1)] """ if self.domain().base_ring() not in NumberFields(): @@ -7419,14 +7419,14 @@ def all_preperiodic_points(self, **kwds): sage: PS. = ProjectiveSpace(1,QQ) sage: f = DynamicalSystem_projective([x^2 - y^2, 3*x*y]) - sage: sorted(f.all_preperiodic_points()) + sage: sorted(f.all_preperiodic_points()) # needs sage.rings.function_field [(-2 : 1), (-1 : 1), (-1/2 : 1), (0 : 1), (1/2 : 1), (1 : 0), (1 : 1), (2 : 1)] :: sage: PS. = ProjectiveSpace(1,QQ) sage: f = DynamicalSystem_projective([5*x^3 - 53*x*y^2 + 24*y^3, 24*y^3]) - sage: sorted(f.all_preperiodic_points(prime_bound=10)) + sage: sorted(f.all_preperiodic_points(prime_bound=10)) # needs sage.rings.function_field [(-1 : 1), (0 : 1), (1 : 0), (1 : 1), (3 : 1)] :: @@ -7442,10 +7442,10 @@ def all_preperiodic_points(self, **kwds): :: - sage: K. = QuadraticField(33) - sage: PS. = ProjectiveSpace(K,1) - sage: f = DynamicalSystem_projective([x^2 - 71/48*y^2, y^2]) - sage: sorted(f.all_preperiodic_points()) # long time + sage: K. = QuadraticField(33) # needs sage.rings.number_field + sage: PS. = ProjectiveSpace(K,1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 - 71/48*y^2, y^2]) # needs sage.rings.number_field + sage: sorted(f.all_preperiodic_points()) # long time # needs sage.rings.number_field [(-1/12*w - 1 : 1), (-1/6*w - 1/4 : 1), (-1/12*w - 1/2 : 1), @@ -7580,14 +7580,14 @@ def rational_preperiodic_graph(self, **kwds): sage: PS. = ProjectiveSpace(1,QQ) sage: f = DynamicalSystem_projective([7*x^2 - 28*y^2, 24*x*y]) - sage: f.rational_preperiodic_graph() + sage: f.rational_preperiodic_graph() # needs sage.rings.function_field Looped digraph on 12 vertices :: sage: PS. = ProjectiveSpace(1,QQ) sage: f = DynamicalSystem_projective([-3/2*x^3 + 19/6*x*y^2, y^3]) - sage: f.rational_preperiodic_graph(prime_bound=[1,8]) + sage: f.rational_preperiodic_graph(prime_bound=[1,8]) # needs sage.rings.function_field Looped digraph on 12 vertices :: @@ -7601,10 +7601,10 @@ def rational_preperiodic_graph(self, **kwds): :: - sage: K. = QuadraticField(-3) - sage: P. = ProjectiveSpace(K,1) - sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) - sage: f.rational_preperiodic_graph() # long time + sage: K. = QuadraticField(-3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) # needs sage.rings.number_field + sage: f.rational_preperiodic_graph() # long time # needs sage.rings.number_field Looped digraph on 5 vertices """ #input checking done in .rational_preperiodic_points() @@ -7634,11 +7634,11 @@ def connected_rational_component(self, P, n=0): EXAMPLES:: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^3 + 1/4*x^2 - 41/16*x + 23/64) - sage: PS. = ProjectiveSpace(1,K) - sage: f = DynamicalSystem_projective([x^2 - 29/16*y^2, y^2]) - sage: P = PS([w,1]) - sage: sorted(f.connected_rational_component(P), key=str) + sage: K. = NumberField(x^3 + 1/4*x^2 - 41/16*x + 23/64) # needs sage.rings.number_field + sage: PS. = ProjectiveSpace(1,K) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 - 29/16*y^2, y^2]) # needs sage.rings.number_field + sage: P = PS([w,1]) # needs sage.rings.number_field + sage: sorted(f.connected_rational_component(P), key=str) # needs sage.rings.number_field [(-w - 1/2 : 1), (-w : 1), (-w^2 + 21/16 : 1), @@ -7657,7 +7657,7 @@ def connected_rational_component(self, P, n=0): sage: PS. = ProjectiveSpace(2,QQ) sage: f = DynamicalSystem_projective([x^2 - 21/16*z^2, y^2 - 2*z^2, z^2]) sage: P = PS([17/16, 7/4, 1]) - sage: f.connected_rational_component(P, 3) + sage: f.connected_rational_component(P, 3) # needs sage.rings.function_field [(17/16 : 7/4 : 1), (-47/256 : 17/16 : 1), (-83807/65536 : -223/256 : 1), @@ -7765,9 +7765,9 @@ def conjugating_set(self, other, R=None, num_cpus=2): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 - 2*y^2, y^2]) - sage: m = matrix(QQbar, 2, 2, [-1, 3, 2, 1]) - sage: g = f.conjugate(m) - sage: f.conjugating_set(g) + sage: m = matrix(QQbar, 2, 2, [-1, 3, 2, 1]) # needs sage.rings.number_field + sage: g = f.conjugate(m) # needs sage.rings.number_field + sage: f.conjugating_set(g) # needs sage.rings.number_field [ [-1 3] [ 2 1] @@ -7777,17 +7777,17 @@ def conjugating_set(self, other, R=None, num_cpus=2): sage: P. = ProjectiveSpace(QQ, 3) sage: f = DynamicalSystem_projective([x^2, y^2, z^2, w^2]) - sage: len(f.conjugating_set(f, num_cpus=3)) + sage: len(f.conjugating_set(f, num_cpus=3)) # needs sage.rings.function_field 24 :: - sage: K. = QuadraticField(-1) - sage: P. = ProjectiveSpace(K, 1) - sage: f = DynamicalSystem_projective([x^2 + y^2, x*y]) - sage: m = matrix(K, 2, 2, [1, 1, 2, 1]) - sage: g = f.conjugate(m) - sage: sorted(f.conjugating_set(g)) + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 + y^2, x*y]) # needs sage.rings.number_field + sage: m = matrix(K, 2, 2, [1, 1, 2, 1]) # needs sage.rings.number_field + sage: g = f.conjugate(m) # needs sage.rings.number_field + sage: sorted(f.conjugating_set(g)) # needs sage.rings.number_field [ [-1 -1] [1 1] [ 2 1], [2 1] @@ -7795,10 +7795,10 @@ def conjugating_set(self, other, R=None, num_cpus=2): :: - sage: K. = QuadraticField(-1) - sage: P. = ProjectiveSpace(K, 1) - sage: D8 = DynamicalSystem_projective([y^3, x^3]) - sage: sorted(D8.conjugating_set(D8)) + sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: D8 = DynamicalSystem_projective([y^3, x^3]) # needs sage.rings.number_field + sage: sorted(D8.conjugating_set(D8)) # needs sage.rings.number_field [ [-1 0] [-i 0] [ 0 -1] [ 0 -i] [0 i] [0 1] [i 0] [1 0] [ 0 1], [ 0 1], [ 1 0], [ 1 0], [1 0], [1 0], [0 1], [0 1] @@ -7808,7 +7808,7 @@ def conjugating_set(self, other, R=None, num_cpus=2): sage: P. = ProjectiveSpace(QQ, 1) sage: D8 = DynamicalSystem_projective([y^2, x^2]) - sage: D8.conjugating_set(D8) + sage: D8.conjugating_set(D8) # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: no more rational preimages; @@ -7818,7 +7818,7 @@ def conjugating_set(self, other, R=None, num_cpus=2): sage: P. = ProjectiveSpace(GF(7), 1) sage: D6 = DynamicalSystem_projective([y^2, x^2]) - sage: sorted(D6.conjugating_set(D6)) + sage: sorted(D6.conjugating_set(D6)) # needs sage.rings.function_field [ [0 1] [0 2] [0 4] [1 0] [2 0] [4 0] [1 0], [1 0], [1 0], [0 1], [0 1], [0 1] @@ -7828,7 +7828,7 @@ def conjugating_set(self, other, R=None, num_cpus=2): sage: P. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2 + x*z, y^2, z^2]) - sage: f.conjugating_set(f) + sage: f.conjugating_set(f) # needs sage.rings.function_field [ [1 0 0] [0 1 0] @@ -7847,11 +7847,11 @@ def conjugating_set(self, other, R=None, num_cpus=2): :: - sage: P. = ProjectiveSpace(QQbar, 1) + sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field sage: f = DynamicalSystem_projective([7*x + 12*y, 8*x]) sage: g = DynamicalSystem_projective([1645*x - 318*y, 8473*x - 1638*y]) - sage: m = f.conjugating_set(g)[0] - sage: f.conjugate(m) == g + sage: m = f.conjugating_set(g)[0] # needs sage.rings.number_field + sage: f.conjugate(m) == g # needs sage.rings.number_field True note that only one possible conjugation is returned:: @@ -7869,32 +7869,32 @@ def conjugating_set(self, other, R=None, num_cpus=2): :: - sage: L. = CyclotomicField(8) - sage: P. = ProjectiveSpace(L, 2) + sage: L. = CyclotomicField(8) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(L, 2) # needs sage.rings.number_field sage: f = DynamicalSystem_projective([2*x + 12*y, 11*y + 2*z, x + z]) - sage: m1 = matrix(L, 3, 3, [1,4,v^2,0,2,1,1,1,1]) + sage: m1 = matrix(L, 3, 3, [1,4,v^2,0,2,1,1,1,1]) # needs sage.rings.number_field sage: g = f.conjugate(m1) - sage: m = f.conjugating_set(g)[0] # long time - sage: f.conjugate(m) == g # long time + sage: m = f.conjugating_set(g)[0] # long time, needs sage.rings.number_field + sage: f.conjugate(m) == g # long time, needs sage.rings.number_field True TESTS: Make sure the caching problem is fixed, see #28070 :: - sage: K. = QuadraticField(-1) + sage: K. = QuadraticField(-1) # needs sage.rings.number_field sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 - 2*y^2, y^2]) sage: m = matrix(QQ, 2, 2, [-1, 3, 2, 1]) sage: g = f.conjugate(m) - sage: f.conjugating_set(g) + sage: f.conjugating_set(g) # needs sage.rings.function_field sage.rings.number_field [ [-1 3] [ 2 1] ] - sage: f = f.change_ring(K) - sage: g = g.change_ring(K) - sage: f.conjugating_set(g) + sage: f = f.change_ring(K) # needs sage.rings.number_field + sage: g = g.change_ring(K) # needs sage.rings.number_field + sage: f.conjugating_set(g) # needs sage.rings.function_field sage.rings.number_field [ [-1 3] [ 2 1] @@ -8010,27 +8010,27 @@ def is_conjugate(self, other, R=None, num_cpus=2): EXAMPLES:: - sage: K. = CyclotomicField(3) - sage: P. = ProjectiveSpace(K, 1) - sage: D8 = DynamicalSystem_projective([y^2, x^2]) - sage: D8.is_conjugate(D8) + sage: K. = CyclotomicField(3) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: D8 = DynamicalSystem_projective([y^2, x^2]) # needs sage.rings.number_field + sage: D8.is_conjugate(D8) # needs sage.rings.number_field True We can speed up computation by increasing ``num_cpus``:: sage: P. = ProjectiveSpace(QQ,3) sage: f = DynamicalSystem_projective([x^2, y^2, z^2, w^2]) - sage: f.is_conjugate(f, num_cpus=2) + sage: f.is_conjugate(f, num_cpus=2) # needs sage.rings.function_field True :: sage: set_verbose(None) - sage: P. = ProjectiveSpace(QQbar, 1) - sage: f = DynamicalSystem_projective([x^2 + x*y, y^2]) - sage: m = matrix(QQbar, 2, 2, [1, 1, 2, 1]) - sage: g = f.conjugate(m) - sage: f.is_conjugate(g) + sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 + x*y, y^2]) # needs sage.rings.number_field + sage: m = matrix(QQbar, 2, 2, [1, 1, 2, 1]) # needs sage.rings.number_field + sage: g = f.conjugate(m) # needs sage.rings.number_field + sage: f.is_conjugate(g) # needs sage.rings.number_field True :: @@ -8039,7 +8039,7 @@ def is_conjugate(self, other, R=None, num_cpus=2): sage: f = DynamicalSystem_projective([x^3 + x*y^2, y^3]) sage: m = matrix(GF(5), 2, 2, [1, 3, 2, 9]) sage: g = f.conjugate(m) - sage: f.is_conjugate(g) + sage: f.is_conjugate(g) # needs sage.rings.number_field True :: @@ -8055,15 +8055,15 @@ def is_conjugate(self, other, R=None, num_cpus=2): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 + x*y, y^2]) sage: g = DynamicalSystem_projective([x^2 - 2*y^2, y^2]) - sage: f.is_conjugate(g) + sage: f.is_conjugate(g) # needs sage.rings.number_field False :: - sage: P. = ProjectiveSpace(QQbar, 1) + sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field sage: f = DynamicalSystem_projective([7*x + 12*y, 8*x]) sage: g = DynamicalSystem_projective([1645*x - 318*y, 8473*x - 1638*y]) - sage: f.is_conjugate(g) + sage: f.is_conjugate(g) # needs sage.rings.number_field True Conjugation is only checked over the base field by default:: @@ -8071,7 +8071,7 @@ def is_conjugate(self, other, R=None, num_cpus=2): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([-3*y^2, 3*x^2]) sage: g = DynamicalSystem_projective([-x^2 - 2*x*y, 2*x*y + y^2]) - sage: f.is_conjugate(g), f.is_conjugate(g, R=QQbar) + sage: f.is_conjugate(g), f.is_conjugate(g, R=QQbar) # needs sage.rings.number_field (False, True) :: @@ -8105,16 +8105,16 @@ def is_conjugate(self, other, R=None, num_cpus=2): Make sure the caching problem is fixed, see #28070 :: - sage: K. = QuadraticField(5) + sage: K. = QuadraticField(5) # needs sage.rings.number_field sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2 - 2*y^2, y^2]) sage: m = matrix(QQ, 2, 2, [-1, 3, 2, 1]) sage: g = f.conjugate(m) - sage: f.is_conjugate(g) + sage: f.is_conjugate(g) # needs sage.rings.number_field True - sage: f = f.change_ring(K) - sage: g = g.change_ring(K) - sage: f.is_conjugate(g) + sage: f = f.change_ring(K) # needs sage.rings.number_field + sage: g = g.change_ring(K) # needs sage.rings.number_field + sage: f.is_conjugate(g) # needs sage.rings.number_field True """ f = copy(self) @@ -8176,37 +8176,37 @@ def is_polynomial(self): EXAMPLES:: sage: R. = QQ[] - sage: K. = QuadraticField(7) - sage: P. = ProjectiveSpace(K, 1) - sage: f = DynamicalSystem_projective([x**2 + 2*x*y - 5*y**2, 2*x*y]) - sage: f.is_polynomial() + sage: K. = QuadraticField(7) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x**2 + 2*x*y - 5*y**2, 2*x*y]) # needs sage.rings.number_field + sage: f.is_polynomial() # needs sage.rings.number_field False :: sage: R. = QQ[] - sage: K. = QuadraticField(7) - sage: P. = ProjectiveSpace(K, 1) - sage: f = DynamicalSystem_projective([x**2 - 7*x*y, 2*y**2]) - sage: m = matrix(K, 2, 2, [w, 1, 0, 1]) - sage: f = f.conjugate(m) - sage: f.is_polynomial() + sage: K. = QuadraticField(7) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x**2 - 7*x*y, 2*y**2]) # needs sage.rings.number_field + sage: m = matrix(K, 2, 2, [w, 1, 0, 1]) # needs sage.rings.number_field + sage: f = f.conjugate(m) # needs sage.rings.number_field + sage: f.is_polynomial() # needs sage.rings.number_field True :: - sage: K. = QuadraticField(4/27) - sage: P. = ProjectiveSpace(K,1) - sage: f = DynamicalSystem_projective([x**3 + w*y^3, x*y**2]) - sage: f.is_polynomial() + sage: K. = QuadraticField(4/27) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x**3 + w*y^3, x*y**2]) # needs sage.rings.number_field + sage: f.is_polynomial() # needs sage.rings.number_field False :: - sage: K = GF(3**2, prefix='w') - sage: P. = ProjectiveSpace(K,1) - sage: f = DynamicalSystem_projective([x**2 + K.gen()*y**2, x*y]) - sage: f.is_polynomial() + sage: K = GF(3**2, prefix='w') # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.finite_rings + sage: f = DynamicalSystem_projective([x**2 + K.gen()*y**2, x*y]) # needs sage.rings.finite_rings + sage: f.is_polynomial() # needs sage.rings.finite_rings False :: @@ -8223,7 +8223,7 @@ def is_polynomial(self): sage: P. = ProjectiveSpace(QQ, 1) sage: F = DynamicalSystem([x^2 + y^2, x*y]) sage: F2 = F.conjugate(matrix(QQ,2,2, [1,2,3,5])) - sage: F2.is_polynomial() + sage: F2.is_polynomial() # needs sage.libs.pari False """ if self.codomain().dimension_relative() != 1: @@ -8325,30 +8325,30 @@ def normal_form(self, return_conjugation=False): :: sage: R. = QQ[] - sage: K. = NumberField(x^2 - 5) - sage: P. = ProjectiveSpace(K,1) - sage: f = DynamicalSystem_projective([x^2 + w*x*y, y^2]) - sage: g,m,psi = f.normal_form(return_conjugation = True);m + sage: K. = NumberField(x^2 - 5) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 + w*x*y, y^2]) # needs sage.rings.number_field + sage: g,m,psi = f.normal_form(return_conjugation=True); m # needs sage.rings.number_field [ 1 -1/2*w] [ 0 1] - sage: f.change_ring(psi).conjugate(m) == g + sage: f.change_ring(psi).conjugate(m) == g # needs sage.rings.number_field True :: sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([13*x^2 + 4*x*y + 3*y^2, 5*y^2]) - sage: f.normal_form() + sage: f.normal_form() # needs sage.libs.pari Dynamical System of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y) to (5*x^2 + 9*y^2 : 5*y^2) :: - sage: K = GF(3^3, prefix='w') - sage: P. = ProjectiveSpace(K,1) - sage: f = DynamicalSystem_projective([x^3 + 2*x^2*y + 2*x*y^2 + K.gen()*y^3, y^3]) - sage: f.normal_form() + sage: K = GF(3^3, prefix='w') # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(K,1) # needs sage.rings.finite_rings + sage: f = DynamicalSystem_projective([x^3 + 2*x^2*y + 2*x*y^2 + K.gen()*y^3, y^3]) # needs sage.rings.finite_rings + sage: f.normal_form() # needs sage.rings.finite_rings Dynamical System of Projective Space of dimension 1 over Finite Field in w3 of size 3^3 Defn: Defined on coordinates by sending (x : y) to @@ -8358,7 +8358,7 @@ def normal_form(self, return_conjugation=False): sage: P. = ProjectiveSpace(GF(3),1) sage: f = DynamicalSystem_projective([2*x**3 + x**2*y, y**3]) - sage: g,m,psi = f.normal_form(return_conjugation=True); psi + sage: g,m,psi = f.normal_form(return_conjugation=True); psi # needs sage.rings.finite_rings Ring morphism: From: Finite Field of size 3 To: Finite Field in z2 of size 3^2 @@ -8530,9 +8530,9 @@ def potential_good_reduction(self, prime, return_conjugation=False): sage: P. = ProjectiveSpace(QQ, 1) sage: system = DynamicalSystem_projective([x^2 - y^2, 2*x*y]) - sage: prime = system.field_of_definition_periodic(1).prime_above(2) - sage: new_system = system.potential_good_reduction(prime)[1] - sage: new_system + sage: prime = system.field_of_definition_periodic(1).prime_above(2) # needs sage.rings.number_field + sage: new_system = system.potential_good_reduction(prime)[1] # needs sage.rings.number_field + sage: new_system # needs sage.rings.number_field Dynamical System of Projective Space of dimension 1 over Number Field in a with defining polynomial x^2 + 1 Defn: Defined on coordinates by sending (x : y) to @@ -8540,44 +8540,44 @@ def potential_good_reduction(self, prime, return_conjugation=False): Note that this map has good reduction at 2:: - sage: new_system.resultant() + sage: new_system.resultant() # needs sage.rings.number_field 1 Using ``return_conjugation``, we can get the conjugation that achieves good reduction:: - sage: conj = system.potential_good_reduction(prime, True)[2]; conj + sage: conj = system.potential_good_reduction(prime, True)[2]; conj # needs sage.rings.number_field [-1/2*a 1/2] [ 0 1] We can check that this conjugation achieves good reduction:: - sage: system.conjugate(conj).resultant() + sage: system.conjugate(conj).resultant() # needs sage.rings.number_field 1 :: sage: P. = ProjectiveSpace(QQ, 1) sage: system = DynamicalSystem_projective([3^4*x^3 + 3*x*y^2 + y^3, 3^6*y^3]) - sage: prime = system.field_of_definition_periodic(1).prime_above(3) - sage: system.potential_good_reduction(prime) + sage: prime = system.field_of_definition_periodic(1).prime_above(3) # needs sage.rings.number_field + sage: system.potential_good_reduction(prime) # needs sage.rings.number_field (False, None) :: sage: P. = ProjectiveSpace(QQ, 1) sage: system = DynamicalSystem_projective([x^5 - x*y^4, 5*y^5]) - sage: prime = system.field_of_definition_periodic(1).prime_above(5) - sage: system.potential_good_reduction(prime) + sage: prime = system.field_of_definition_periodic(1).prime_above(5) # needs sage.rings.number_field + sage: system.potential_good_reduction(prime) # needs sage.rings.number_field (False, None) TESTS:: sage: P. = ProjectiveSpace(QQ, 1) sage: R. = QQ[] - sage: A. = NumberField(z^2 + 1) - sage: prime = A.prime_above(2) + sage: A. = NumberField(z^2 + 1) # needs sage.rings.number_field + sage: prime = A.prime_above(2) # needs sage.rings.number_field sage: system = DynamicalSystem_projective([x^2 - y^2, 2*x*y]) - sage: system.potential_good_reduction(prime) + sage: system.potential_good_reduction(prime) # needs sage.rings.number_field (True, Dynamical System of Projective Space of dimension 1 over Number Field in a with defining polynomial x^2 + 1 @@ -8596,18 +8596,18 @@ def potential_good_reduction(self, prime, return_conjugation=False): sage: P. = ProjectiveSpace(QQ, 1) sage: system = DynamicalSystem_projective([x**5 - 11*y**5, x**4*y]) - sage: B, new_sys, conj = system.potential_good_reduction(11, True) - sage: system.conjugate(conj).resultant() == 1 + sage: B, new_sys, conj = system.potential_good_reduction(11, True) # needs sage.rings.number_field + sage: system.conjugate(conj).resultant() == 1 # needs sage.rings.number_field True - sage: system.conjugate(conj) == new_sys + sage: system.conjugate(conj) == new_sys # needs sage.rings.number_field True :: sage: P. = ProjectiveSpace(QQ, 1) sage: system = DynamicalSystem_projective([3*x^2 + x*y + y^2, 9*y^2]) - sage: prime = system.field_of_definition_periodic(1).prime_above(3) - sage: system.potential_good_reduction(prime) + sage: prime = system.field_of_definition_periodic(1).prime_above(3) # needs sage.rings.number_field + sage: system.potential_good_reduction(prime) # needs sage.rings.number_field (False, None) """ @@ -8701,20 +8701,20 @@ def reduce_base_field(self): EXAMPLES:: - sage: K. = GF(2^3) - sage: P. = ProjectiveSpace(K, 2) - sage: f = DynamicalSystem_projective([x^2 + y^2, y^2, z^2+z*y]) - sage: f.reduce_base_field() + sage: K. = GF(2^3) # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.finite_rings + sage: f = DynamicalSystem_projective([x^2 + y^2, y^2, z^2+z*y]) # needs sage.rings.finite_rings + sage: f.reduce_base_field() # needs sage.rings.finite_rings Dynamical System of Projective Space of dimension 2 over Finite Field of size 2 Defn: Defined on coordinates by sending (x : y : z) to (x^2 + y^2 : y^2 : y*z + z^2) :: - sage: P. = ProjectiveSpace(QQbar, 2) - sage: f = DynamicalSystem_projective([x^2 + QQbar(sqrt(3))*y^2, # optional - sage.symbolic + sage: P. = ProjectiveSpace(QQbar, 2) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 + QQbar(sqrt(3))*y^2, # needs sage.rings.number_field sage.symbolic ....: y^2, QQbar(sqrt(2))*z^2]) - sage: f.reduce_base_field() # optional - sage.symbolic + sage: f.reduce_base_field() # needs sage.rings.number_field sage.symbolic Dynamical System of Projective Space of dimension 2 over Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a = -0.5176380902050415? Defn: Defined on coordinates by sending (x : y : z) to @@ -8723,22 +8723,22 @@ def reduce_base_field(self): :: sage: R. = QQ[] - sage: K. = NumberField(x^3 - 2, embedding=(x^3 - 2).roots(ring=CC)[0][0]) + sage: K. = NumberField(x^3 - 2, embedding=(x^3 - 2).roots(ring=CC)[0][0]) # needs sage.rings.number_field sage: R. = QQ[] - sage: L. = NumberField(x^6 + 9*x^4 - 4*x^3 + 27*x^2 + 36*x + 31, + sage: L. = NumberField(x^6 + 9*x^4 - 4*x^3 + 27*x^2 + 36*x + 31, # needs sage.rings.number_field ....: embedding=(x^6 + 9*x^4 - 4*x^3 ....: + 27*x^2 + 36*x + 31).roots(ring=CC)[0][0]) - sage: P. = ProjectiveSpace(L,1) - sage: f = DynamicalSystem([L(v)*x^2 + y^2, x*y]) - sage: f.reduce_base_field().base_ring().is_isomorphic(K) + sage: P. = ProjectiveSpace(L,1) # needs sage.rings.number_field + sage: f = DynamicalSystem([L(v)*x^2 + y^2, x*y]) # needs sage.rings.number_field + sage: f.reduce_base_field().base_ring().is_isomorphic(K) # needs sage.rings.number_field True :: - sage: K. = CyclotomicField(5) - sage: A. = ProjectiveSpace(K, 1) - sage: f = DynamicalSystem_projective([3*x^2 + y^2, x*y]) - sage: f.reduce_base_field() + sage: K. = CyclotomicField(5) # needs sage.rings.number_field + sage: A. = ProjectiveSpace(K, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([3*x^2 + y^2, x*y]) # needs sage.rings.number_field + sage: f.reduce_base_field() # needs sage.rings.number_field Dynamical System of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y) to (3*x^2 + y^2 : x*y) @@ -8773,7 +8773,7 @@ def is_newton(self, return_conjugation=False): sage: A. = AffineSpace(QQ, 1) sage: f = DynamicalSystem_affine([z - (z^2 + 1)/(2*z)]) sage: F = f.homogenize(1) - sage: F.is_newton(return_conjugation=True) + sage: F.is_newton(return_conjugation=True) # needs sage.rings.number_field ( [1 0] True, [0 1] @@ -8784,26 +8784,26 @@ def is_newton(self, return_conjugation=False): sage: A. = AffineSpace(QQ, 1) sage: f = DynamicalSystem_affine([z^2 + 1]) sage: F = f.homogenize(1) - sage: F.is_newton() + sage: F.is_newton() # needs sage.rings.number_field False - sage: F.is_newton(return_conjugation=True) + sage: F.is_newton(return_conjugation=True) # needs sage.rings.number_field (False, None) :: sage: PP. = ProjectiveSpace(QQ, 1) sage: F = DynamicalSystem_projective([-4*x^3 - 3*x*y^2, -2*y^3]) - sage: F.is_newton(return_conjugation=True)[1] + sage: F.is_newton(return_conjugation=True)[1] # needs sage.rings.number_field [ 0 1] [-4*a 2*a] :: - sage: K. = CyclotomicField(2*4) - sage: A. = AffineSpace(K, 1) - sage: f = DynamicalSystem_affine(z-(z^3+zeta*z)/(3*z^2+zeta)) + sage: K. = CyclotomicField(2*4) # needs sage.rings.number_field + sage: A. = AffineSpace(K, 1) # needs sage.rings.number_field + sage: f = DynamicalSystem_affine(z-(z^3+zeta*z)/(3*z^2+zeta)) # needs sage.rings.number_field sage: F = f.homogenize(1) - sage: F.is_newton() + sage: F.is_newton() # needs sage.rings.number_field True """ if self.degree() == 1: @@ -8939,7 +8939,7 @@ def orbit_structure(self, P): sage: P. = ProjectiveSpace(GF(7),2) sage: X = P.subscheme(x^2 - y^2) sage: f = DynamicalSystem_projective([x^2, y^2, z^2], domain=X) - sage: f.orbit_structure(X(1,1,2)) + sage: f.orbit_structure(X(1,1,2)) # needs sage.rings.function_field (0, 2) :: @@ -8951,10 +8951,10 @@ def orbit_structure(self, P): :: - sage: R. = GF(13^3) - sage: P. = ProjectiveSpace(R,1) + sage: R. = GF(13^3) # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(R,1) # needs sage.rings.finite_rings sage: f = DynamicalSystem_projective([x^2 - y^2, y^2], domain=P) - sage: f.orbit_structure(P(t, 4)) + sage: f.orbit_structure(P(t, 4)) # needs sage.rings.finite_rings (11, 6) """ orbit = [] @@ -8984,14 +8984,14 @@ def cyclegraph(self): sage: P. = ProjectiveSpace(GF(13),1) sage: f = DynamicalSystem_projective([x^2 - y^2, y^2]) - sage: f.cyclegraph() + sage: f.cyclegraph() # needs sage.graphs Looped digraph on 14 vertices :: - sage: P. = ProjectiveSpace(GF(3^2,'t'),2) - sage: f = DynamicalSystem_projective([x^2 + y^2, y^2, z^2 + y*z]) - sage: f.cyclegraph() + sage: P. = ProjectiveSpace(GF(3^2,'t'),2) # needs sage.rings.finite_rings + sage: f = DynamicalSystem_projective([x^2 + y^2, y^2, z^2 + y*z]) # needs sage.rings.finite_rings + sage: f.cyclegraph() # needs sage.graphs sage.rings.finite_rings Looped digraph on 91 vertices :: @@ -8999,14 +8999,14 @@ def cyclegraph(self): sage: P. = ProjectiveSpace(GF(7),2) sage: X = P.subscheme(x^2 - y^2) sage: f = DynamicalSystem_projective([x^2, y^2, z^2], domain=X) - sage: f.cyclegraph() + sage: f.cyclegraph() # needs sage.graphs Looped digraph on 15 vertices :: sage: P. = ProjectiveSpace(GF(3),2) sage: f = DynamicalSystem_projective([x*z - y^2, x^2 - y^2, y^2 - z^2]) - sage: f.cyclegraph() + sage: f.cyclegraph() # needs sage.graphs Looped digraph on 13 vertices :: @@ -9014,7 +9014,7 @@ def cyclegraph(self): sage: P. = ProjectiveSpace(GF(3),2) sage: X = P.subscheme([x - y]) sage: f = DynamicalSystem_projective([x^2 - y^2, x^2 - y^2, y^2 - z^2], domain=X) - sage: f.cyclegraph() + sage: f.cyclegraph() # needs sage.graphs Looped digraph on 4 vertices """ V = [] @@ -9068,15 +9068,15 @@ def possible_periods(self, return_points=False): EXAMPLES:: sage: P. = ProjectiveSpace(GF(23),1) - sage: f = DynamicalSystem_projective([x^2-2*y^2, y^2]) - sage: f.possible_periods() + sage: f = DynamicalSystem_projective([x^2 - 2*y^2, y^2]) + sage: f.possible_periods() # needs sage.libs.pari [1, 5, 11, 22, 110] :: sage: P. = ProjectiveSpace(GF(13),1) sage: f = DynamicalSystem_projective([x^2 - y^2, y^2]) - sage: sorted(f.possible_periods(True)) + sage: sorted(f.possible_periods(True)) # needs sage.libs.pari [[(0 : 1), 2], [(1 : 0), 1], [(3 : 1), 3], [(3 : 1), 36]] :: @@ -9084,7 +9084,7 @@ def possible_periods(self, return_points=False): sage: PS. = ProjectiveSpace(2,GF(7)) sage: f = DynamicalSystem_projective([-360*x^3 + 760*x*z^2, ....: y^3 - 604*y*z^2 + 240*z^3, 240*z^3]) - sage: f.possible_periods() + sage: f.possible_periods() # needs sage.libs.pari [1, 2, 4, 6, 12, 14, 28, 42, 84] .. TODO:: @@ -9138,9 +9138,9 @@ def automorphism_group(self, **kwds): EXAMPLES:: - sage: R. = ProjectiveSpace(GF(7^3,'t'),1) - sage: f = DynamicalSystem_projective([x^2 - y^2, x*y]) - sage: f.automorphism_group() + sage: R. = ProjectiveSpace(GF(7^3,'t'),1) # needs sage.rings.finite_rings + sage: f = DynamicalSystem_projective([x^2 - y^2, x*y]) # needs sage.rings.finite_rings + sage: f.automorphism_group() # needs sage.rings.finite_rings [ [1 0] [6 0] [0 1], [0 1] @@ -9148,11 +9148,11 @@ def automorphism_group(self, **kwds): :: - sage: R. = ProjectiveSpace(GF(3^2,'t'),1) - sage: f = DynamicalSystem_projective([x^3, y^3]) - sage: lst, label = f.automorphism_group(return_functions=True, # long time + sage: R. = ProjectiveSpace(GF(3^2,'t'),1) # needs sage.rings.finite_rings + sage: f = DynamicalSystem_projective([x^3, y^3]) # needs sage.rings.finite_rings + sage: lst, label = f.automorphism_group(return_functions=True, # long time, needs sage.rings.finite_rings ....: iso_type=True) - sage: sorted(lst, key=str), label # long time + sage: sorted(lst, key=str), label # long time # needs sage.rings.finite_rings ([(2*x + 1)/(x + 1), (2*x + 1)/x, (2*x + 2)/(x + 2), @@ -9181,16 +9181,16 @@ def automorphism_group(self, **kwds): :: - sage: R. = ProjectiveSpace(GF(2^5,'t'),1) - sage: f = DynamicalSystem_projective([x^5, y^5]) - sage: f.automorphism_group(return_functions=True, iso_type=True) + sage: R. = ProjectiveSpace(GF(2^5,'t'),1) # needs sage.rings.finite_rings + sage: f = DynamicalSystem_projective([x^5, y^5]) # needs sage.rings.finite_rings + sage: f.automorphism_group(return_functions=True, iso_type=True) # needs sage.rings.finite_rings ([x, 1/x], 'Cyclic of order 2') :: - sage: R. = ProjectiveSpace(GF(3^4,'t'),1) - sage: f = DynamicalSystem_projective([x^2 + 25*x*y + y^2, x*y + 3*y^2]) - sage: f.automorphism_group(absolute=True) + sage: R. = ProjectiveSpace(GF(3^4,'t'),1) # needs sage.rings.finite_rings + sage: f = DynamicalSystem_projective([x^2 + 25*x*y + y^2, x*y + 3*y^2]) # needs sage.rings.finite_rings + sage: f.automorphism_group(absolute=True) # needs sage.rings.finite_rings [Univariate Polynomial Ring in w over Finite Field in b of size 3^4, [ [1 0] @@ -9201,7 +9201,7 @@ def automorphism_group(self, **kwds): sage: R. = ProjectiveSpace(GF(5), 2) sage: f = DynamicalSystem_projective([x^3 + x*z^2, y^3 + y*z^2, z^3]) - sage: all([f.conjugate(m) == f for m in f.automorphism_group()]) + sage: all([f.conjugate(m) == f for m in f.automorphism_group()]) # needs sage.rings.function_field True """ absolute = kwds.get('absolute', False) @@ -9237,9 +9237,9 @@ def all_periodic_points(self, **kwds): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(5^2),1) - sage: f = DynamicalSystem_projective([x^2 + y^2, x*y]) - sage: f.all_periodic_points() + sage: P. = ProjectiveSpace(GF(5^2),1) # needs sage.rings.finite_rings + sage: f = DynamicalSystem_projective([x^2 + y^2, x*y]) # needs sage.rings.finite_rings + sage: f.all_periodic_points() # needs sage.rings.finite_rings [(1 : 0), (z2 + 2 : 1), (4*z2 + 3 : 1)] :: @@ -9257,9 +9257,9 @@ def all_periodic_points(self, **kwds): :: - sage: P.=ProjectiveSpace(GF(3), 1) + sage: P. = ProjectiveSpace(GF(3), 1) sage: f = DynamicalSystem_projective([x^2 - y^2, y^2]) - sage: f.all_periodic_points(R=GF(3^2, 't')) + sage: f.all_periodic_points(R=GF(3^2, 't')) # needs sage.rings.finite_rings [(1 : 0), (0 : 1), (2 : 1), (t : 1), (2*t + 1 : 1)] """ R = kwds.pop("R", None) From 565663ecd421239b1381bcfa3a546a53f8ac4f11 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 3 Jul 2023 22:17:43 -0700 Subject: [PATCH 12/32] Fix up imports --- src/sage/dynamics/arithmetic_dynamics/projective_ds.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index 624463f5bfa..a8ca6fad6c1 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -112,12 +112,16 @@ class initialization directly. from sage.schemes.projective.projective_subscheme import AlgebraicScheme_subscheme_projective from sage.structure.element import get_coercion_model -lazy_import('sage.libs.pari.all', 'PariError') lazy_import('sage.rings.algebraic_closure_finite_field', 'AlgebraicClosureFiniteField_generic') lazy_import('sage.rings.number_field.number_field_ideal', 'NumberFieldFractionalIdeal') lazy_import('sage.rings.padics.factory', 'Qp') lazy_import('sage.rings.qqbar', ['QQbar', 'number_field_elements_from_algebraics']) +try: + from sage.libs.pari.all import PariError +except ImportError: + PariError = () + class DynamicalSystem_projective(SchemeMorphism_polynomial_projective_space, DynamicalSystem): From 53e8a0037529aa67d800a1bd2fe8b4fa783b04e5 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 7 Aug 2023 22:44:12 -0700 Subject: [PATCH 13/32] src/sage/dynamics: sage -fixdoctests --only-tags --- .../dynamics/arithmetic_dynamics/affine_ds.py | 32 +-- .../arithmetic_dynamics/berkovich_ds.py | 138 ++++++----- .../arithmetic_dynamics/projective_ds.py | 226 ++++++++++-------- .../dynamics/cellular_automata/elementary.py | 6 +- src/sage/dynamics/cellular_automata/glca.py | 4 +- 5 files changed, 221 insertions(+), 185 deletions(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/affine_ds.py b/src/sage/dynamics/arithmetic_dynamics/affine_ds.py index 68db00928eb..23cdb1a9b51 100644 --- a/src/sage/dynamics/arithmetic_dynamics/affine_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/affine_ds.py @@ -188,8 +188,8 @@ class DynamicalSystem_affine(SchemeMorphism_polynomial_affine_space, :: - sage: x = var('x') # optional - sage.symbolic - sage: DynamicalSystem_affine(x^2 + 1) # optional - sage.symbolic + sage: x = var('x') # needs sage.symbolic + sage: DynamicalSystem_affine(x^2 + 1) # needs sage.symbolic Traceback (most recent call last): ... TypeError: symbolic ring cannot be the base ring @@ -397,10 +397,11 @@ def homogenize(self, n): :: - sage: R. = PolynomialRing(QQbar) # optional - sage.rings.number_field - sage: A. = AffineSpace(R, 2) # optional - sage.rings.number_field - sage: f = DynamicalSystem_affine([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: f = DynamicalSystem_affine([QQbar(sqrt(2))*x*y, a*x^2]) # needs sage.symbolic + sage: f.homogenize(2) # needs sage.symbolic Dynamical System 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 @@ -507,8 +508,8 @@ def dynatomic_polynomial(self, period): :: sage: A. = AffineSpace(CC,1) - sage: F = DynamicalSystem_affine([1/2*x^2 + CC(sqrt(3))]) # optional - sage.symbolic - sage: F.dynatomic_polynomial([1,1]) # optional - sage.symbolic + sage: F = DynamicalSystem_affine([1/2*x^2 + CC(sqrt(3))]) # needs sage.symbolic + sage: F.dynatomic_polynomial([1,1]) # needs sage.symbolic (0.125000000000000*x^4 + 0.366025403784439*x^2 + 1.50000000000000)/(0.500000000000000*x^2 - x + 1.73205080756888) TESTS:: @@ -957,10 +958,10 @@ def reduce_base_field(self): :: - sage: A. = AffineSpace(QQbar, 2) # optional - sage.rings.number_field - sage: f = DynamicalSystem_affine([x^2 + QQbar(sqrt(3))*y^2, # optional - sage.rings.number_field sage.symbolic + sage: A. = AffineSpace(QQbar, 2) # needs sage.rings.number_field + sage: f = DynamicalSystem_affine([x^2 + QQbar(sqrt(3))*y^2, # needs sage.rings.number_field sage.symbolic ....: QQbar(sqrt(-1))*y^2]) - sage: f.reduce_base_field() # optional - sage.rings.number_field sage.symbolic + sage: f.reduce_base_field() # needs sage.rings.number_field sage.symbolic Dynamical System of Affine Space of dimension 2 over Number Field in a with defining polynomial y^4 - y^2 + 1 with a = -0.866025403784439? + 0.50000000000000000?*I @@ -969,10 +970,11 @@ def reduce_base_field(self): :: - sage: K. = CyclotomicField(5) # optional - sage.rings.number_field - sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field - sage: f = DynamicalSystem_affine([(3*x^2 + y) / (5*x), (y^2+1) / (x+y)]) # optional - sage.rings.number_field - sage: f.reduce_base_field() # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = CyclotomicField(5) + sage: A. = AffineSpace(K, 2) + sage: f = DynamicalSystem_affine([(3*x^2 + y) / (5*x), (y^2+1) / (x+y)]) + sage: f.reduce_base_field() Dynamical System of Affine Space of dimension 2 over Rational Field Defn: Defined on coordinates by sending (x, y) to ((3*x^2 + y)/(5*x), (5*y^2 + 5)/(5*x + 5*y)) diff --git a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py index eab3bcdac91..5bb5e01d488 100644 --- a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py @@ -146,19 +146,21 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet Creating a map on Berkovich space creates the Berkovich space it acts on:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_projective([x^2, y^2]) # needs sage.rings.padics - sage: g = DynamicalSystem_Berkovich(f) # needs sage.rings.padics - sage: B = g.domain(); B # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_projective([x^2, y^2]) + sage: g = DynamicalSystem_Berkovich(f) + sage: B = g.domain(); B Projective Berkovich line over Cp(3) of precision 20 The image of type I point is the image of the center:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: F = DynamicalSystem_Berkovich([x^2, y^2]) # needs sage.rings.padics - sage: B = F.domain() # needs sage.rings.padics - sage: Q1 = B(2) # needs sage.rings.padics - sage: F(Q1) # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: F = DynamicalSystem_Berkovich([x^2, y^2]) + sage: B = F.domain() + sage: Q1 = B(2) + sage: F(Q1) Type I point centered at (1 + 3 + O(3^20) : 1 + O(3^20)) For type II/III points with no poles in the corresponding disk, @@ -171,10 +173,11 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet The image of any type II point can be computed:: - sage: g = DynamicalSystem_projective([x^2 + y^2, x*y]) # needs sage.rings.padics - sage: G = DynamicalSystem_Berkovich(g) # needs sage.rings.padics - sage: Q3 = B(0, 1) # needs sage.rings.padics - sage: G(Q3) # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: g = DynamicalSystem_projective([x^2 + y^2, x*y]) + sage: G = DynamicalSystem_Berkovich(g) + sage: Q3 = B(0, 1) + sage: G(Q3) Type II point centered at (0 : 1 + O(3^20)) of radius 3^0 The image of type III points can be computed has long as the @@ -289,10 +292,11 @@ def __init__(self, dynamical_system, domain): TESTS:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_projective([2*x^2 + 4*y^2, 3*x^2 + 9*y^2]) # needs sage.rings.padics - sage: g = DynamicalSystem_Berkovich(f) # needs sage.rings.padics - sage: isinstance(g, DynamicalSystem_Berkovich) # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_projective([2*x^2 + 4*y^2, 3*x^2 + 9*y^2]) + sage: g = DynamicalSystem_Berkovich(f) + sage: isinstance(g, DynamicalSystem_Berkovich) True """ self._system = dynamical_system @@ -346,10 +350,11 @@ def domain(self): EXAMPLES:: - sage: Q. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_projective([3*x^2, 2*y^2]) # needs sage.rings.padics - sage: g = DynamicalSystem_Berkovich(f) # needs sage.rings.padics - sage: g.domain() # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: Q. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_projective([3*x^2, 2*y^2]) + sage: g = DynamicalSystem_Berkovich(f) + sage: g.domain() Projective Berkovich line over Cp(3) of precision 20 """ return self._domain @@ -384,10 +389,11 @@ def __getitem__(self, i): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_projective([x^2 + y^2, 2*y^2]) # needs sage.rings.padics - sage: g = DynamicalSystem_Berkovich(f) # needs sage.rings.padics - sage: g[0] # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_projective([x^2 + y^2, 2*y^2]) + sage: g = DynamicalSystem_Berkovich(f) + sage: g[0] x^2 + y^2 """ return self._system._polys[i] @@ -401,10 +407,11 @@ def defining_polynomials(self): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_projective([2*x^2 + 4*y^2, 3*x^2 + 9*y^2]) # needs sage.rings.padics - sage: g = DynamicalSystem_Berkovich(f) # needs sage.rings.padics - sage: g.defining_polynomials() # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_projective([2*x^2 + 4*y^2, 3*x^2 + 9*y^2]) + sage: g = DynamicalSystem_Berkovich(f) + sage: g.defining_polynomials() ((2 + O(3^20))*x^2 + (1 + 3 + O(3^20))*y^2, (3 + O(3^21))*x^2 + (3^2 + O(3^22))*y^2) """ @@ -442,10 +449,11 @@ def _repr_(self): EXAMPLES:: - sage: Q. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_projective([3*x^2, 2*y^2]) # needs sage.rings.padics - sage: f = DynamicalSystem_Berkovich(f) # needs sage.rings.padics - sage: f._repr_() # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: Q. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_projective([3*x^2, 2*y^2]) + sage: f = DynamicalSystem_Berkovich(f) + sage: f._repr_() 'Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map\n Defn: Defined on coordinates by sending (x : y) to\n ((3 + O(3^21))*x^2 : (2 + O(3^20))*y^2)' """ @@ -656,10 +664,11 @@ def conjugate(self, M, adjugate=False, new_ideal=None): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_projective([x^2 + y^2, 2*y^2]) # needs sage.rings.padics - sage: g = DynamicalSystem_Berkovich(f) # needs sage.rings.padics - sage: g.conjugate(Matrix([[1, 1], [0, 1]])) # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_projective([x^2 + y^2, 2*y^2]) + sage: g = DynamicalSystem_Berkovich(f) + sage: g.conjugate(Matrix([[1, 1], [0, 1]])) Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -750,10 +759,11 @@ def dehomogenize(self, n): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_projective([x^2 + y^2, x*y + y^2]) # needs sage.rings.padics - sage: g = DynamicalSystem_Berkovich(f) # needs sage.rings.padics - sage: g.dehomogenize(1) # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_projective([x^2 + y^2, x*y + y^2]) + sage: g = DynamicalSystem_Berkovich(f) + sage: g.dehomogenize(1) Dynamical system of Affine Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x) to @@ -783,21 +793,23 @@ def __call__(self, x, type_3_pole_check=True): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: g = DynamicalSystem_projective([x^2 + y^2, x*y]) # needs sage.rings.padics - sage: G = DynamicalSystem_Berkovich(g) # needs sage.rings.padics - sage: B = G.domain() # needs sage.rings.padics - sage: Q3 = B(0, 1) # needs sage.rings.padics - sage: G(Q3) # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: g = DynamicalSystem_projective([x^2 + y^2, x*y]) + sage: G = DynamicalSystem_Berkovich(g) + sage: B = G.domain() + sage: Q3 = B(0, 1) + sage: G(Q3) Type II point centered at (0 : 1 + O(3^20)) of radius 3^0 :: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: H = DynamicalSystem_Berkovich([x*y^2, x^3 + 20*y^3]) # needs sage.rings.padics - sage: B = H.domain() # needs sage.rings.padics - sage: Q4 = B(1/9, 1.5) # needs sage.rings.padics - sage: H(Q4, False) # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: H = DynamicalSystem_Berkovich([x*y^2, x^3 + 20*y^3]) + sage: B = H.domain() + sage: Q4 = B(1/9, 1.5) + sage: H(Q4, False) Type III point centered at (3^4 + 3^10 + 2*3^11 + 2*3^13 + 2*3^14 + 2*3^15 + 3^17 + 2*3^18 + 2*3^19 + 3^20 + 3^21 + 3^22 + O(3^24) : 1 + O(3^20)) of radius 0.00205761316872428 @@ -1053,10 +1065,11 @@ def homogenize(self, n): EXAMPLES:: - sage: A. = AffineSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_affine(1/x) # needs sage.rings.padics - sage: f = DynamicalSystem_Berkovich(f) # needs sage.rings.padics - sage: f.homogenize(1) # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: A. = AffineSpace(Qp(3), 1) + sage: f = DynamicalSystem_affine(1/x) + sage: f = DynamicalSystem_Berkovich(f) + sage: f.homogenize(1) Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x0 : x1) to (x1 : x0) @@ -1073,12 +1086,13 @@ def __call__(self, x): EXAMPLES:: - sage: P. = AffineSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_affine(x^2) # needs sage.rings.padics - sage: g = DynamicalSystem_Berkovich(f) # needs sage.rings.padics - sage: B = g.domain() # needs sage.rings.padics - sage: Q1 = B(2) # needs sage.rings.padics - sage: g(Q1) # needs sage.rings.padics + sage: # needs sage.rings.padics + sage: P. = AffineSpace(Qp(3), 1) + sage: f = DynamicalSystem_affine(x^2) + sage: g = DynamicalSystem_Berkovich(f) + sage: B = g.domain() + sage: Q1 = B(2) + sage: g(Q1) Type I point centered at 1 + 3 + O(3^20) """ if not isinstance(x, Berkovich_Element_Cp_Affine): diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index a8ca6fad6c1..30d7b3c229f 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -272,11 +272,12 @@ class DynamicalSystem_projective(SchemeMorphism_polynomial_projective_space, :: - sage: K. = QuadraticField(-7) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem([x^3 + v*x*y^2, y^3]) # needs sage.rings.number_field - sage: fbar = f.change_ring(QQbar) # needs sage.rings.number_field - sage: fbar.is_postcritically_finite() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(-7) + sage: P. = ProjectiveSpace(K, 1) + sage: f = DynamicalSystem([x^3 + v*x*y^2, y^3]) + sage: fbar = f.change_ring(QQbar) + sage: fbar.is_postcritically_finite() False """ @@ -771,7 +772,7 @@ def dynatomic_polynomial(self, period): :: sage: T. = QuadraticField(33) # needs sage.rings.number_field - sage: S. = PolynomialRing(T) + sage: S. = PolynomialRing(T) # needs sage.rings.number_field sage: P. = ProjectiveSpace(FractionField(S),1) sage: f = DynamicalSystem_projective([t*x^2 - 1/t*y^2, y^2]) sage: f.dynatomic_polynomial([1, 2]).parent() # needs sage.libs.pari @@ -1183,11 +1184,12 @@ def arakelov_zhang_pairing(self, g, **kwds): EXAMPLES:: - sage: K. = CyclotomicField(3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 + (2*k + 2)*y^2, y^2]) # needs sage.rings.number_field - sage: g = DynamicalSystem_projective([x^2, y^2]) # needs sage.rings.number_field - sage: pairingval = f.arakelov_zhang_pairing(g, n=5); pairingval # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = CyclotomicField(3) + sage: P. = ProjectiveSpace(K, 1) + sage: f = DynamicalSystem_projective([x^2 + (2*k + 2)*y^2, y^2]) + sage: g = DynamicalSystem_projective([x^2, y^2]) + sage: pairingval = f.arakelov_zhang_pairing(g, n=5); pairingval 0.409598197761958 :: @@ -1209,7 +1211,7 @@ def arakelov_zhang_pairing(self, g, **kwds): sage: f = DynamicalSystem_projective([x^2 + 4*y^2, y^2]) sage: g = DynamicalSystem_projective([x^2, y^2]) sage: pairingval = f.arakelov_zhang_pairing(g, n=6, noise_multiplier=0) # needs sage.rings.function_field - sage: pairingval + sage: pairingval # needs sage.rings.number_field 0.650660018921632 sage: dynheight = f.canonical_height(P(0, 1)); dynheight # needs sage.libs.pari 0.75017839144364417318023000563 @@ -2032,14 +2034,15 @@ def green_function(self, P, v, **kwds): :: - sage: K. = QuadraticField(3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([17*x^2 + 1/7*y^2, 17*w*x*y]) # needs sage.rings.number_field - sage: f.green_function(P.point([w, 2], False), K.places()[1]) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(3) + sage: P. = ProjectiveSpace(K,1) + sage: f = DynamicalSystem_projective([17*x^2 + 1/7*y^2, 17*w*x*y]) + sage: f.green_function(P.point([w, 2], False), K.places()[1]) 1.7236334013785676107373093775 - sage: f.green_function(P([2, 1]), K.ideal(7), N=7) # needs sage.rings.number_field + sage: f.green_function(P([2, 1]), K.ideal(7), N=7) 0.48647753726382832627633818586 - sage: f.green_function(P([w, 1]), K.ideal(17), error_bound=0.001) # needs sage.rings.number_field + sage: f.green_function(P([w, 1]), K.ideal(17), error_bound=0.001) -0.70813041039490996737374178059 :: @@ -3140,7 +3143,7 @@ def minimal_model(self, return_transformation=False, prime_list=None, algorithm= sage: PS. = ProjectiveSpace(ZZ,1) sage: f = DynamicalSystem_projective([6*x^2 + 12*x*y + 7*y^2, 12*x*y + 42*y^2]) sage: g,M = f.minimal_model(return_transformation=True, algorithm='BM') # needs sage.rings.function_field - sage: f.conjugate(M) == g + sage: f.conjugate(M) == g # needs sage.rings.function_field True :: @@ -3313,10 +3316,10 @@ def all_minimal_models(self, return_transformation=False, prime_list=None, sage: c = 2^2*5^2*11^3 sage: f = DynamicalSystem([x^3 - c^2*y^3, x*y^2]) sage: MM = f.all_minimal_models(return_transformation=True, algorithm='BM') # needs sage.rings.function_field - sage: all(f.conjugate(m) == F for F, m in MM) + sage: all(f.conjugate(m) == F for F, m in MM) # needs sage.rings.function_field True sage: MM = f.all_minimal_models(return_transformation=True, algorithm='HS') # needs sage.rings.function_field - sage: all(f.conjugate(m) == F for F,m in MM) + sage: all(f.conjugate(m) == F for F,m in MM) # needs sage.rings.function_field True REFERENCES: @@ -3403,7 +3406,7 @@ def affine_preperiodic_model(self, m, n, return_conjugation=False): We can check that ``g`` has affine fixed points:: - sage: g.periodic_points(1) + sage: g.periodic_points(1) # needs sage.rings.function_field [(-1 : -1 : 1), (-1/2 : -1 : 1), (-1/2 : -1/2 : 1), @@ -3437,10 +3440,11 @@ def affine_preperiodic_model(self, m, n, return_conjugation=False): :: - sage: K. = CyclotomicField(3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 + k*x*y + y^2, z^2, y^2]) # needs sage.rings.number_field - sage: f.affine_preperiodic_model(1, 1) # needs sage.rings.function_field sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = CyclotomicField(3) + sage: P. = ProjectiveSpace(K, 2) + sage: f = DynamicalSystem_projective([x^2 + k*x*y + y^2, z^2, y^2]) + sage: f.affine_preperiodic_model(1, 1) # needs sage.rings.function_field Dynamical System of Projective Space of dimension 2 over Cyclotomic Field of order 3 and degree 2 Defn: Defined on coordinates by sending (x : y : z) to @@ -3451,7 +3455,7 @@ def affine_preperiodic_model(self, m, n, return_conjugation=False): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) sage: g, mat = f.affine_preperiodic_model(0, 1, return_conjugation=True) # needs sage.rings.function_field - sage: g == f.conjugate(mat) + sage: g == f.conjugate(mat) # needs sage.rings.function_field True :: @@ -3470,7 +3474,7 @@ def affine_preperiodic_model(self, m, n, return_conjugation=False): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 + 2*y^2, x^2]) sage: g, mat = f.affine_preperiodic_model(0, 1, return_conjugation=True) # needs sage.rings.function_field - sage: f.conjugate(mat) == g + sage: f.conjugate(mat) == g # needs sage.rings.function_field True """ n = ZZ(n) @@ -3641,7 +3645,7 @@ def automorphism_group(self, **kwds): sage: f = DynamicalSystem_projective([3*x^2*y - y^3, x^3 - 3*x*y^2]) sage: lst, label = f.automorphism_group(algorithm='CRT', return_functions=True, # needs sage.libs.pari ....: iso_type=True) - sage: sorted(lst), label + sage: sorted(lst), label # needs sage.libs.pari ([-1/x, 1/x, (-x - 1)/(x - 1), (-x + 1)/(x + 1), (x - 1)/(x + 1), (x + 1)/(x - 1), -x, x], 'Dihedral of order 8') @@ -3670,10 +3674,11 @@ def automorphism_group(self, **kwds): :: - sage: K. = CyclotomicField(3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: D6 = DynamicalSystem_projective([y^2, x^2]) # needs sage.rings.number_field - sage: sorted(D6.automorphism_group()) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = CyclotomicField(3) + sage: P. = ProjectiveSpace(K, 1) + sage: D6 = DynamicalSystem_projective([y^2, x^2]) + sage: sorted(D6.automorphism_group()) [ [-w - 1 0] [ 0 -w - 1] [w 0] [0 w] [0 1] [1 0] [ 0 1], [ 1 0], [0 1], [1 0], [1 0], [0 1] @@ -3788,7 +3793,7 @@ def critical_points(self, R=None): sage: f.critical_points() # needs sage.rings.function_field [(1 : 0)] sage: K. = QuadraticField(6) # needs sage.rings.number_field - sage: f.critical_points(K) + sage: f.critical_points(K) # needs sage.rings.number_field [(-1/3*w : 1), (1/3*w : 1), (1 : 0)] :: @@ -3928,8 +3933,8 @@ def is_postcritically_finite(self, err=0.01, use_algebraic_closure=True): sage: R. = QQ[] sage: K. = NumberField(z^8 + 3*z^6 + 3*z^4 + z^2 + 1) # needs sage.rings.number_field - sage: PS. = ProjectiveSpace(K,1) - sage: f = DynamicalSystem_projective([x^3 + v*y^3, y^3]) + sage: PS. = ProjectiveSpace(K,1) # needs sage.rings.number_field + sage: f = DynamicalSystem_projective([x^3 + v*y^3, y^3]) # needs sage.rings.number_field sage: f.is_postcritically_finite() # long time True @@ -4231,10 +4236,11 @@ def critical_height(self, **kwds): :: - sage: K. = QuadraticField(2) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 + w*y^2, y^2]) # needs sage.rings.number_field - sage: f.critical_height() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(2) + sage: P. = ProjectiveSpace(K,1) + sage: f = DynamicalSystem_projective([x^2 + w*y^2, y^2]) + sage: f.critical_height() 0.16090842452312941163719755472 Postcritically finite maps have critical height 0:: @@ -4393,7 +4399,7 @@ def preperiodic_points(self, m, n, **kwds): sage: P. = ProjectiveSpace(QQ, 1) sage: K. = QuadraticField(5) # needs sage.rings.number_field - sage: phi = QQ.embeddings(K)[0] + sage: phi = QQ.embeddings(K)[0] # needs sage.rings.number_field sage: f = DynamicalSystem_projective([x^2 - y^2, y^2]) sage: f.preperiodic_points(1, 1, R=phi) [(-1/2*v - 1/2 : 1), (1/2*v - 1/2 : 1)] @@ -4443,7 +4449,7 @@ def preperiodic_points(self, m, n, **kwds): sage: R. = QQ[] sage: K. = NumberField(z^4 - z^2 - 1) # needs sage.rings.number_field sage: f = DynamicalSystem_projective([x^2 - y^2, y^2]) - sage: sorted(f.preperiodic_points(2, 1, R=K), key=str) + sage: sorted(f.preperiodic_points(2, 1, R=K), key=str) # needs sage.rings.number_field [(-v : 1), (v : 1)] :: @@ -5172,10 +5178,11 @@ def multiplier_spectra(self, n, formal=False, type='point', use_algebraic_closur :: - sage: K. = QuadraticField(5) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 + w*x*y + y^2, y^2, z^2]) # needs sage.rings.number_field - sage: f.multiplier_spectra(1) # long time, needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(5) + sage: P. = ProjectiveSpace(K, 2) + sage: f = DynamicalSystem_projective([x^2 + w*x*y + y^2, y^2, z^2]) + sage: f.multiplier_spectra(1) # long time [ [1.000000000000000? - 1.572302755514847?*I 0] [1.000000000000000? - 1.572302755514847?*I 0.618033988749895? - 1.757887921270715?*I] @@ -5583,12 +5590,13 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', :: - sage: K. = QuadraticField(3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 - w*y^2, (1-w)*x*y]) # needs sage.rings.number_field - sage: f.sigma_invariants(2, formal=False, type='cycle') # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(3) + sage: P. = ProjectiveSpace(K, 1) + sage: f = DynamicalSystem_projective([x^2 - w*y^2, (1-w)*x*y]) + sage: f.sigma_invariants(2, formal=False, type='cycle') [6*w + 21, 78*w + 159, 210*w + 367, 90*w + 156] - sage: f.sigma_invariants(2, formal=False, type='point') # needs sage.rings.number_field + sage: f.sigma_invariants(2, formal=False, type='point') [6*w + 24, 96*w + 222, 444*w + 844, 720*w + 1257, 270*w + 468] :: @@ -7341,10 +7349,11 @@ def all_rational_preimages(self, points): :: - sage: K. = QuadraticField(3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([u^2 + v^2, v^2]) # needs sage.rings.number_field - sage: f.all_rational_preimages(P(4)) # needs sage.rings.function_field sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(3) + sage: P. = ProjectiveSpace(K,1) + sage: f = DynamicalSystem_projective([u^2 + v^2, v^2]) + sage: f.all_rational_preimages(P(4)) # needs sage.rings.function_field [(-w : 1), (w : 1)] """ if self.domain().base_ring() not in NumberFields(): @@ -7446,10 +7455,11 @@ def all_preperiodic_points(self, **kwds): :: - sage: K. = QuadraticField(33) # needs sage.rings.number_field - sage: PS. = ProjectiveSpace(K,1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 - 71/48*y^2, y^2]) # needs sage.rings.number_field - sage: sorted(f.all_preperiodic_points()) # long time # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(33) + sage: PS. = ProjectiveSpace(K,1) + sage: f = DynamicalSystem_projective([x^2 - 71/48*y^2, y^2]) + sage: sorted(f.all_preperiodic_points()) # long time [(-1/12*w - 1 : 1), (-1/6*w - 1/4 : 1), (-1/12*w - 1/2 : 1), @@ -7605,10 +7615,11 @@ def rational_preperiodic_graph(self, **kwds): :: - sage: K. = QuadraticField(-3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) # needs sage.rings.number_field - sage: f.rational_preperiodic_graph() # long time # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(-3) + sage: P. = ProjectiveSpace(K,1) + sage: f = DynamicalSystem_projective([x^2 + y^2, y^2]) + sage: f.rational_preperiodic_graph() # long time Looped digraph on 5 vertices """ #input checking done in .rational_preperiodic_points() @@ -7786,12 +7797,13 @@ def conjugating_set(self, other, R=None, num_cpus=2): :: - sage: K. = QuadraticField(-1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 + y^2, x*y]) # needs sage.rings.number_field - sage: m = matrix(K, 2, 2, [1, 1, 2, 1]) # needs sage.rings.number_field - sage: g = f.conjugate(m) # needs sage.rings.number_field - sage: sorted(f.conjugating_set(g)) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(-1) + sage: P. = ProjectiveSpace(K, 1) + sage: f = DynamicalSystem_projective([x^2 + y^2, x*y]) + sage: m = matrix(K, 2, 2, [1, 1, 2, 1]) + sage: g = f.conjugate(m) + sage: sorted(f.conjugating_set(g)) [ [-1 -1] [1 1] [ 2 1], [2 1] @@ -7799,10 +7811,11 @@ def conjugating_set(self, other, R=None, num_cpus=2): :: - sage: K. = QuadraticField(-1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: D8 = DynamicalSystem_projective([y^3, x^3]) # needs sage.rings.number_field - sage: sorted(D8.conjugating_set(D8)) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(-1) + sage: P. = ProjectiveSpace(K, 1) + sage: D8 = DynamicalSystem_projective([y^3, x^3]) + sage: sorted(D8.conjugating_set(D8)) [ [-1 0] [-i 0] [ 0 -1] [ 0 -i] [0 i] [0 1] [i 0] [1 0] [ 0 1], [ 0 1], [ 1 0], [ 1 0], [1 0], [1 0], [0 1], [0 1] @@ -7878,8 +7891,8 @@ def conjugating_set(self, other, R=None, num_cpus=2): sage: f = DynamicalSystem_projective([2*x + 12*y, 11*y + 2*z, x + z]) sage: m1 = matrix(L, 3, 3, [1,4,v^2,0,2,1,1,1,1]) # needs sage.rings.number_field sage: g = f.conjugate(m1) - sage: m = f.conjugating_set(g)[0] # long time, needs sage.rings.number_field - sage: f.conjugate(m) == g # long time, needs sage.rings.number_field + sage: m = f.conjugating_set(g)[0] # long time # needs sage.rings.number_field + sage: f.conjugate(m) == g # long time # needs sage.rings.number_field True TESTS: @@ -8014,10 +8027,11 @@ def is_conjugate(self, other, R=None, num_cpus=2): EXAMPLES:: - sage: K. = CyclotomicField(3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: D8 = DynamicalSystem_projective([y^2, x^2]) # needs sage.rings.number_field - sage: D8.is_conjugate(D8) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = CyclotomicField(3) + sage: P. = ProjectiveSpace(K, 1) + sage: D8 = DynamicalSystem_projective([y^2, x^2]) + sage: D8.is_conjugate(D8) True We can speed up computation by increasing ``num_cpus``:: @@ -8199,18 +8213,20 @@ def is_polynomial(self): :: - sage: K. = QuadraticField(4/27) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x**3 + w*y^3, x*y**2]) # needs sage.rings.number_field - sage: f.is_polynomial() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(4/27) + sage: P. = ProjectiveSpace(K,1) + sage: f = DynamicalSystem_projective([x**3 + w*y^3, x*y**2]) + sage: f.is_polynomial() False :: - sage: K = GF(3**2, prefix='w') # needs sage.rings.finite_rings - sage: P. = ProjectiveSpace(K,1) # needs sage.rings.finite_rings - sage: f = DynamicalSystem_projective([x**2 + K.gen()*y**2, x*y]) # needs sage.rings.finite_rings - sage: f.is_polynomial() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(3**2, prefix='w') + sage: P. = ProjectiveSpace(K,1) + sage: f = DynamicalSystem_projective([x**2 + K.gen()*y**2, x*y]) + sage: f.is_polynomial() False :: @@ -8349,10 +8365,11 @@ def normal_form(self, return_conjugation=False): :: - sage: K = GF(3^3, prefix='w') # needs sage.rings.finite_rings - sage: P. = ProjectiveSpace(K,1) # needs sage.rings.finite_rings - sage: f = DynamicalSystem_projective([x^3 + 2*x^2*y + 2*x*y^2 + K.gen()*y^3, y^3]) # needs sage.rings.finite_rings - sage: f.normal_form() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K = GF(3^3, prefix='w') + sage: P. = ProjectiveSpace(K,1) + sage: f = DynamicalSystem_projective([x^3 + 2*x^2*y + 2*x*y^2 + K.gen()*y^3, y^3]) + sage: f.normal_form() Dynamical System of Projective Space of dimension 1 over Finite Field in w3 of size 3^3 Defn: Defined on coordinates by sending (x : y) to @@ -8705,10 +8722,11 @@ def reduce_base_field(self): EXAMPLES:: - sage: K. = GF(2^3) # needs sage.rings.finite_rings - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.finite_rings - sage: f = DynamicalSystem_projective([x^2 + y^2, y^2, z^2+z*y]) # needs sage.rings.finite_rings - sage: f.reduce_base_field() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(2^3) + sage: P. = ProjectiveSpace(K, 2) + sage: f = DynamicalSystem_projective([x^2 + y^2, y^2, z^2+z*y]) + sage: f.reduce_base_field() Dynamical System of Projective Space of dimension 2 over Finite Field of size 2 Defn: Defined on coordinates by sending (x : y : z) to (x^2 + y^2 : y^2 : y*z + z^2) @@ -8739,10 +8757,11 @@ def reduce_base_field(self): :: - sage: K. = CyclotomicField(5) # needs sage.rings.number_field - sage: A. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([3*x^2 + y^2, x*y]) # needs sage.rings.number_field - sage: f.reduce_base_field() # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = CyclotomicField(5) + sage: A. = ProjectiveSpace(K, 1) + sage: f = DynamicalSystem_projective([3*x^2 + y^2, x*y]) + sage: f.reduce_base_field() Dynamical System of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y) to (3*x^2 + y^2 : x*y) @@ -9152,11 +9171,12 @@ def automorphism_group(self, **kwds): :: - sage: R. = ProjectiveSpace(GF(3^2,'t'),1) # needs sage.rings.finite_rings - sage: f = DynamicalSystem_projective([x^3, y^3]) # needs sage.rings.finite_rings - sage: lst, label = f.automorphism_group(return_functions=True, # long time, needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = ProjectiveSpace(GF(3^2,'t'),1) + sage: f = DynamicalSystem_projective([x^3, y^3]) + sage: lst, label = f.automorphism_group(return_functions=True, # long time ....: iso_type=True) - sage: sorted(lst, key=str), label # long time # needs sage.rings.finite_rings + sage: sorted(lst, key=str), label # long time ([(2*x + 1)/(x + 1), (2*x + 1)/x, (2*x + 2)/(x + 2), diff --git a/src/sage/dynamics/cellular_automata/elementary.py b/src/sage/dynamics/cellular_automata/elementary.py index 3cf0cd19560..26e68c37b01 100644 --- a/src/sage/dynamics/cellular_automata/elementary.py +++ b/src/sage/dynamics/cellular_automata/elementary.py @@ -225,7 +225,7 @@ class ElementaryCellularAutomata(SageObject): sage: ECA = cellular_automata.Elementary(60, width=200) sage: ECA.evolve(200) - sage: ECA.plot() # optional - sage.plot + sage: ECA.plot() # needs sage.plot Graphics object consisting of 1 graphics primitive .. PLOT:: @@ -239,7 +239,7 @@ class ElementaryCellularAutomata(SageObject): sage: ECA = cellular_automata.Elementary(90, initial_state=[1]+[0]*254+[1], boundary=None) sage: ECA.evolve(256) - sage: ECA.plot() # optional - sage.plot + sage: ECA.plot() # needs sage.plot Graphics object consisting of 1 graphics primitive .. PLOT:: @@ -598,7 +598,7 @@ def plot(self, number=None): sage: ECA = cellular_automata.Elementary(110, width=256) sage: ECA.evolve(256) - sage: ECA.plot() # optional - sage.plot + sage: ECA.plot() # needs sage.plot Graphics object consisting of 1 graphics primitive """ if number is None: diff --git a/src/sage/dynamics/cellular_automata/glca.py b/src/sage/dynamics/cellular_automata/glca.py index 90b7a770548..6b062f2a441 100644 --- a/src/sage/dynamics/cellular_automata/glca.py +++ b/src/sage/dynamics/cellular_automata/glca.py @@ -67,7 +67,7 @@ class GraftalLaceCellularAutomata(SageObject): sage: G = cellular_automata.GraftalLace([2,0,3,3,6,0,2,7]) sage: G.evolve(20) - sage: G.plot() # optional - sage.plot + sage: G.plot() # needs sage.plot Graphics object consisting of 842 graphics primitives .. PLOT:: @@ -398,7 +398,7 @@ def plot(self, number=None): sage: G = cellular_automata.GraftalLace([5,1,2,5,4,5,5,0]) sage: G.evolve(20) - sage: G.plot() # optional - sage.plot + sage: G.plot() # needs sage.plot Graphics object consisting of 865 graphics primitives """ if number is None: From d41ca2a675ebf7d7829bfc864c20fda864512431 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 18 Aug 2023 13:55:19 -0700 Subject: [PATCH 14/32] src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx: Add # needs --- src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx b/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx index 9ee71e4f4bf..43ce0effd58 100644 --- a/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx +++ b/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx @@ -1,4 +1,5 @@ # cython: binding=True +# sage.doctest: needs sage.plot r""" Mandelbrot and Julia sets (Cython helper) From a7ad632d90e49a3bd6af15cd20e0b11c7a451676 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 8 Sep 2023 22:56:22 -0700 Subject: [PATCH 15/32] sage.dynamics: Add # needs --- .../dynamics/arithmetic_dynamics/affine_ds.py | 53 +- .../dynamical_semigroup.py | 454 +++++++++--------- .../arithmetic_dynamics/generic_ds.py | 16 +- .../dynamics/arithmetic_dynamics/wehlerK3.py | 27 +- 4 files changed, 288 insertions(+), 262 deletions(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/affine_ds.py b/src/sage/dynamics/arithmetic_dynamics/affine_ds.py index 23cdb1a9b51..6938068bbc6 100644 --- a/src/sage/dynamics/arithmetic_dynamics/affine_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/affine_ds.py @@ -162,8 +162,9 @@ class DynamicalSystem_affine(SchemeMorphism_polynomial_affine_space, If you pass in quotient ring elements, they are reduced:: + sage: # needs sage.libs.singular sage: A. = AffineSpace(QQ, 3) - sage: X = A.subscheme([x-y]) + sage: X = A.subscheme([x - y]) sage: u,v,w = X.coordinate_ring().gens() sage: DynamicalSystem_affine([u, v, u+v], domain=X) Dynamical System of Closed subscheme of Affine Space of dimension 3 @@ -174,9 +175,10 @@ class DynamicalSystem_affine(SchemeMorphism_polynomial_affine_space, :: + sage: # needs sage.libs.singular sage: R. = PolynomialRing(QQ) sage: A. = AffineSpace(R, 3) - sage: X = A.subscheme(x^2-y^2) + sage: X = A.subscheme(x^2 - y^2) sage: H = End(X) sage: f = H([x^2/(t*y), t*y^2, x*z]) sage: DynamicalSystem_affine(f) @@ -454,7 +456,7 @@ def dynatomic_polynomial(self, period): sage: A. = AffineSpace(ZZ, 1) sage: f = DynamicalSystem_affine([(x^2+1)/x]) - sage: f.dynatomic_polynomial(4) + sage: f.dynatomic_polynomial(4) # needs sage.libs.pari 2*x^12 + 18*x^10 + 57*x^8 + 79*x^6 + 48*x^4 + 12*x^2 + 1 :: @@ -771,7 +773,7 @@ def multiplier(self, P, n, check=True): sage: P. = AffineSpace(CC, 1) sage: f = DynamicalSystem_affine([x^2 + 1/2]) - sage: f.multiplier(P([0.5 + 0.5*I]), 1) + sage: f.multiplier(P([0.5 + 0.5*I]), 1) # needs sage.symbolic [1.00000000000000 + 1.00000000000000*I] :: @@ -785,7 +787,7 @@ def multiplier(self, P, n, check=True): :: sage: P. = AffineSpace(QQ, 2) - sage: X = P.subscheme([x^2-y^2]) + sage: X = P.subscheme([x^2 - y^2]) sage: f = DynamicalSystem_affine([x^2, y^2], domain=X) sage: f.multiplier(X([1, 1]), 1) [2 0] @@ -824,7 +826,7 @@ def conjugate(self, M): EXAMPLES:: sage: A. = AffineSpace(QQ, 1) - sage: f = DynamicalSystem_affine([t^2+1]) + sage: f = DynamicalSystem_affine([t^2 + 1]) sage: f.conjugate(matrix([[1,2], [0,1]])) Dynamical System of Affine Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (t) to @@ -833,18 +835,20 @@ def conjugate(self, M): :: sage: A. = AffineSpace(ZZ,2) - sage: f = DynamicalSystem_affine([x^3+y^3,y^2]) + sage: f = DynamicalSystem_affine([x^3 + y^3, y^2]) sage: f.conjugate(matrix([[1,2,3], [0,1,2], [0,0,1]])) Dynamical System of Affine Space of dimension 2 over Integer Ring Defn: Defined on coordinates by sending (x, y) to - (x^3 + 6*x^2*y + 12*x*y^2 + 9*y^3 + 9*x^2 + 36*x*y + 40*y^2 + 27*x + 58*y + 28, y^2 + 4*y + 2) + (x^3 + 6*x^2*y + 12*x*y^2 + 9*y^3 + + 9*x^2 + 36*x*y + 40*y^2 + 27*x + 58*y + 28, y^2 + 4*y + 2) :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2+1) + sage: K. = NumberField(x^2 + 1) sage: A. = AffineSpace(ZZ,1) - sage: f = DynamicalSystem_affine([x^3+2*x^2+3]) + sage: f = DynamicalSystem_affine([x^3 + 2*x^2 + 3]) sage: f.conjugate(matrix([[i,i], [0,-i]])) Dynamical System of Affine Space of dimension 1 over Integer Ring Defn: Defined on coordinates by sending (x) to @@ -861,6 +865,7 @@ def degree(self): EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = QuadraticField(7) sage: A. = AffineSpace(R, 3) sage: f = DynamicalSystem_affine([x^2 + y^5 + c, x^11, z^19]) @@ -912,9 +917,10 @@ def weil_restriction(self): EXAMPLES:: + sage: # needs sage.rings.number_field sage: K. = QuadraticField(5) sage: A. = AffineSpace(K, 2) - sage: f = DynamicalSystem_affine([x^2-y^2, y^2]) + sage: f = DynamicalSystem_affine([x^2 - y^2, y^2]) sage: f.weil_restriction() Dynamical System of Affine Space of dimension 4 over Rational Field Defn: Defined on coordinates by sending (z0, z1, z2, z3) to @@ -922,6 +928,7 @@ def weil_restriction(self): :: + sage: # needs sage.rings.number_field sage: K. = QuadraticField(5) sage: PS. = AffineSpace(K, 2) sage: f = DynamicalSystem_affine([x, y]) @@ -941,13 +948,14 @@ def reduce_base_field(self): The base field of the map could be strictly larger than the field where all of the coefficients are defined. This function reduces the base field to the minimal possible. This can be done when - the base ring is a number field, QQbar, a finite field, or algebraic + the base ring is a number field, ``QQbar``, a finite field, or algebraic closure of a finite field. OUTPUT: A dynamical system EXAMPLES:: + sage: # needs sage.rings.finite_rings sage: K. = GF(5^2) sage: A. = AffineSpace(K, 2) sage: f = DynamicalSystem_affine([x^2 + 3*y^2, 3*y^2]) @@ -958,10 +966,11 @@ def reduce_base_field(self): :: - sage: A. = AffineSpace(QQbar, 2) # needs sage.rings.number_field - sage: f = DynamicalSystem_affine([x^2 + QQbar(sqrt(3))*y^2, # needs sage.rings.number_field sage.symbolic + sage: # needs sage.rings.number_field sage.symbolic + sage: A. = AffineSpace(QQbar, 2) + sage: f = DynamicalSystem_affine([x^2 + QQbar(sqrt(3))*y^2, ....: QQbar(sqrt(-1))*y^2]) - sage: f.reduce_base_field() # needs sage.rings.number_field sage.symbolic + sage: f.reduce_base_field() Dynamical System of Affine Space of dimension 2 over Number Field in a with defining polynomial y^4 - y^2 + 1 with a = -0.866025403784439? + 0.50000000000000000?*I @@ -1006,6 +1015,7 @@ def orbit_structure(self, P): :: + sage: # needs sage.rings.finite_rings sage: A. = AffineSpace(GF(49, 't'), 3) sage: f = DynamicalSystem_affine([x^2 - z, x - y + z, y^2 - x^2]) sage: f.orbit_structure(A(1, 1, 2)) @@ -1033,23 +1043,24 @@ def cyclegraph(self): EXAMPLES:: sage: P. = AffineSpace(GF(5), 2) - sage: f = DynamicalSystem_affine([x^2-y, x*y+1]) - sage: f.cyclegraph() + sage: f = DynamicalSystem_affine([x^2 - y, x*y + 1]) + sage: f.cyclegraph() # needs sage.graphs Looped digraph on 25 vertices :: + sage: # needs sage.rings.finite_rings sage: P. = AffineSpace(GF(3^3, 't'), 1) - sage: f = DynamicalSystem_affine([x^2-1]) - sage: f.cyclegraph() + sage: f = DynamicalSystem_affine([x^2 - 1]) + sage: f.cyclegraph() # needs sage.graphs Looped digraph on 27 vertices :: sage: P. = AffineSpace(GF(7), 2) - sage: X = P.subscheme(x-y) + sage: X = P.subscheme(x - y) sage: f = DynamicalSystem_affine([x^2, y^2], domain=X) - sage: f.cyclegraph() + sage: f.cyclegraph() # needs sage.graphs Looped digraph on 7 vertices """ V = [] diff --git a/src/sage/dynamics/arithmetic_dynamics/dynamical_semigroup.py b/src/sage/dynamics/arithmetic_dynamics/dynamical_semigroup.py index 5b324ddbd9a..ebb8702a7db 100644 --- a/src/sage/dynamics/arithmetic_dynamics/dynamical_semigroup.py +++ b/src/sage/dynamics/arithmetic_dynamics/dynamical_semigroup.py @@ -51,13 +51,12 @@ class DynamicalSemigroup(Parent, metaclass=InheritComparisonClasscallMetaclass): sage: P. = ProjectiveSpace(QQ, 1) sage: DynamicalSemigroup(([x, y], [x^2, y^2])) - Dynamical semigroup over Projective Space of dimension 1 over Rational Field defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x : y) - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x^2 : y^2) + Dynamical semigroup over Projective Space of dimension 1 over Rational Field + defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x : y) to (x : y) + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x : y) to (x^2 : y^2) :: @@ -65,23 +64,22 @@ class DynamicalSemigroup(Parent, metaclass=InheritComparisonClasscallMetaclass): sage: f = DynamicalSystem([x, y], P) sage: g = DynamicalSystem([x^2, y^2], P) sage: DynamicalSemigroup((f, g)) - Dynamical semigroup over Projective Space of dimension 1 over Rational Field defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x : y) - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x^2 : y^2) + Dynamical semigroup over Projective Space of dimension 1 over Rational Field + defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x : y) to (x : y) + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x : y) to (x^2 : y^2) :: sage: A. = AffineSpace(QQ, 1) sage: f = DynamicalSystem_affine(x, A) sage: DynamicalSemigroup(f) - Dynamical semigroup over Affine Space of dimension 1 over Rational Field defined by 1 dynamical system: - Dynamical System of Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x) to - (x) + Dynamical semigroup over Affine Space of dimension 1 over Rational Field + defined by 1 dynamical system: + Dynamical System of Affine Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x) to (x) :: @@ -89,13 +87,12 @@ class DynamicalSemigroup(Parent, metaclass=InheritComparisonClasscallMetaclass): sage: f = DynamicalSystem(x, A) sage: g = DynamicalSystem(x^2, A) sage: DynamicalSemigroup((f, g)) - Dynamical semigroup over Affine Space of dimension 1 over Rational Field defined by 2 dynamical systems: - Dynamical System of Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x) to - (x) - Dynamical System of Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x) to - (x^2) + Dynamical semigroup over Affine Space of dimension 1 over Rational Field + defined by 2 dynamical systems: + Dynamical System of Affine Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x) to (x) + Dynamical System of Affine Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x) to (x^2) :: @@ -104,32 +101,32 @@ class DynamicalSemigroup(Parent, metaclass=InheritComparisonClasscallMetaclass): sage: f = DynamicalSystem_projective([x, y], X) sage: g = DynamicalSystem_projective([x^2, y^2], X) sage: DynamicalSemigroup_projective([f, g]) - Dynamical semigroup over Closed subscheme of Projective Space of dimension 1 over Rational Field defined by: - x - y defined by 2 dynamical systems: - Dynamical System of Closed subscheme of Projective Space of dimension 1 over Rational Field defined by: - x - y - Defn: Defined on coordinates by sending (x : y) to - (x : y) - Dynamical System of Closed subscheme of Projective Space of dimension 1 over Rational Field defined by: - x - y - Defn: Defined on coordinates by sending (x : y) to - (x^2 : y^2) - - If a dynamical semigroup is built from dynamical systems with different base rings, all systems will be coerced - to the largest base ring:: + Dynamical semigroup over Closed subscheme of Projective Space of dimension 1 + over Rational Field defined by: x - y + defined by 2 dynamical systems: + Dynamical System of Closed subscheme of Projective Space of dimension 1 + over Rational Field defined by: x - y + Defn: Defined on coordinates by sending (x : y) to (x : y) + Dynamical System of Closed subscheme of Projective Space of dimension 1 + over Rational Field defined by: x - y + Defn: Defined on coordinates by sending (x : y) to (x^2 : y^2) + + If a dynamical semigroup is built from dynamical systems with different base rings, + all systems will be coerced to the largest base ring:: sage: P. = ProjectiveSpace(QQ, 1) sage: Q. = ProjectiveSpace(RR, 1) sage: f = DynamicalSystem([x, y], P) sage: g = DynamicalSystem([z^2, w^2], Q) sage: DynamicalSemigroup((f, g)) - Dynamical semigroup over Projective Space of dimension 1 over Real Field with 53 bits of precision defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Real Field with 53 bits of precision - Defn: Defined on coordinates by sending (x : y) to - (x : y) - Dynamical System of Projective Space of dimension 1 over Real Field with 53 bits of precision - Defn: Defined on coordinates by sending (x : y) to - (x^2 : y^2) + Dynamical semigroup over Projective Space of dimension 1 over + Real Field with 53 bits of precision defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 + over Real Field with 53 bits of precision + Defn: Defined on coordinates by sending (x : y) to (x : y) + Dynamical System of Projective Space of dimension 1 + over Real Field with 53 bits of precision + Defn: Defined on coordinates by sending (x : y) to (x^2 : y^2) :: @@ -138,17 +135,19 @@ class DynamicalSemigroup(Parent, metaclass=InheritComparisonClasscallMetaclass): sage: f = DynamicalSystem(x, A) sage: g = DynamicalSystem(y^2, B) sage: DynamicalSemigroup((f, g)) - Dynamical semigroup over Affine Space of dimension 1 over Real Field with 53 bits of precision defined by 2 dynamical systems: - Dynamical System of Affine Space of dimension 1 over Real Field with 53 bits of precision - Defn: Defined on coordinates by sending (x) to - (x) - Dynamical System of Affine Space of dimension 1 over Real Field with 53 bits of precision - Defn: Defined on coordinates by sending (x) to - (x^2) + Dynamical semigroup over Affine Space of dimension 1 over + Real Field with 53 bits of precision defined by 2 dynamical systems: + Dynamical System of Affine Space of dimension 1 over + Real Field with 53 bits of precision + Defn: Defined on coordinates by sending (x) to (x) + Dynamical System of Affine Space of dimension 1 over + Real Field with 53 bits of precision + Defn: Defined on coordinates by sending (x) to (x^2) If a dynamical semigroup is built from dynamical systems over number fields, a composite number field is created and all systems will be coerced to it. This composite number field contains all of the initial number fields:: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: K. = NumberField(r^2 - 2) sage: P. = ProjectiveSpace(QQ, 1) @@ -156,16 +155,18 @@ class DynamicalSemigroup(Parent, metaclass=InheritComparisonClasscallMetaclass): sage: f = DynamicalSystem([x, y], P) sage: g = DynamicalSystem([z^2, w^2], Q) sage: DynamicalSemigroup((f, g)) - Dynamical semigroup over Projective Space of dimension 1 over Number Field in k with defining polynomial r^2 - 2 defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Number Field in k with defining polynomial r^2 - 2 - Defn: Defined on coordinates by sending (x : y) to - (x : y) - Dynamical System of Projective Space of dimension 1 over Number Field in k with defining polynomial r^2 - 2 - Defn: Defined on coordinates by sending (x : y) to - (x^2 : y^2) + Dynamical semigroup over Projective Space of dimension 1 over + Number Field in k with defining polynomial r^2 - 2 defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over + Number Field in k with defining polynomial r^2 - 2 + Defn: Defined on coordinates by sending (x : y) to (x : y) + Dynamical System of Projective Space of dimension 1 over + Number Field in k with defining polynomial r^2 - 2 + Defn: Defined on coordinates by sending (x : y) to (x^2 : y^2) :: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: K. = NumberField(r^2 - 2) sage: L. = NumberField(r^2 - 3) @@ -174,16 +175,19 @@ class DynamicalSemigroup(Parent, metaclass=InheritComparisonClasscallMetaclass): sage: f = DynamicalSystem([x, y], P) sage: g = DynamicalSystem([z^2, w^2], Q) sage: DynamicalSemigroup((f, g)) - Dynamical semigroup over Projective Space of dimension 1 over Number Field in kl with defining polynomial r^4 - 10*r^2 + 1 defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Number Field in kl with defining polynomial r^4 - 10*r^2 + 1 - Defn: Defined on coordinates by sending (x : y) to - (x : y) - Dynamical System of Projective Space of dimension 1 over Number Field in kl with defining polynomial r^4 - 10*r^2 + 1 - Defn: Defined on coordinates by sending (x : y) to - (x^2 : y^2) + Dynamical semigroup over Projective Space of dimension 1 over + Number Field in kl with defining polynomial r^4 - 10*r^2 + 1 + defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over + Number Field in kl with defining polynomial r^4 - 10*r^2 + 1 + Defn: Defined on coordinates by sending (x : y) to (x : y) + Dynamical System of Projective Space of dimension 1 over + Number Field in kl with defining polynomial r^4 - 10*r^2 + 1 + Defn: Defined on coordinates by sending (x : y) to (x^2 : y^2) :: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: K. = NumberField(r^2 - 2) sage: L. = NumberField(r^2 - 3) @@ -192,102 +196,107 @@ class DynamicalSemigroup(Parent, metaclass=InheritComparisonClasscallMetaclass): sage: f = DynamicalSystem(x, P) sage: g = DynamicalSystem(y^2, Q) sage: DynamicalSemigroup((f, g)) - Dynamical semigroup over Affine Space of dimension 1 over Number Field in kl with defining polynomial r^4 - 10*r^2 + 1 defined by 2 dynamical systems: - Dynamical System of Affine Space of dimension 1 over Number Field in kl with defining polynomial r^4 - 10*r^2 + 1 - Defn: Defined on coordinates by sending (x) to - (x) - Dynamical System of Affine Space of dimension 1 over Number Field in kl with defining polynomial r^4 - 10*r^2 + 1 - Defn: Defined on coordinates by sending (x) to - (x^2) + Dynamical semigroup over Affine Space of dimension 1 over + Number Field in kl with defining polynomial r^4 - 10*r^2 + 1 + defined by 2 dynamical systems: + Dynamical System of Affine Space of dimension 1 over + Number Field in kl with defining polynomial r^4 - 10*r^2 + 1 + Defn: Defined on coordinates by sending (x) to (x) + Dynamical System of Affine Space of dimension 1 over + Number Field in kl with defining polynomial r^4 - 10*r^2 + 1 + Defn: Defined on coordinates by sending (x) to (x^2) A dynamical semigroup may contain dynamical systems over function fields:: - sage: R. = QQ[] - sage: P. = ProjectiveSpace(R, 1) - sage: f = DynamicalSystem([r * x, y], P) - sage: g = DynamicalSystem([x, r * y], P) - sage: DynamicalSemigroup((f, g)) - Dynamical semigroup over Projective Space of dimension 1 over Univariate Polynomial Ring in r over Rational Field defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Univariate Polynomial Ring in r over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (r*x : y) - Dynamical System of Projective Space of dimension 1 over Univariate Polynomial Ring in r over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x : r*y) + sage: R. = QQ[] + sage: P. = ProjectiveSpace(R, 1) + sage: f = DynamicalSystem([r * x, y], P) + sage: g = DynamicalSystem([x, r * y], P) + sage: DynamicalSemigroup((f, g)) + Dynamical semigroup over Projective Space of dimension 1 over Univariate + Polynomial Ring in r over Rational Field defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over + Univariate Polynomial Ring in r over Rational Field + Defn: Defined on coordinates by sending (x : y) to (r*x : y) + Dynamical System of Projective Space of dimension 1 over + Univariate Polynomial Ring in r over Rational Field + Defn: Defined on coordinates by sending (x : y) to (x : r*y) - :: + :: - sage: R. = QQ[] - sage: P. = ProjectiveSpace(R, 1) - sage: f = DynamicalSystem([r * x, y], P) - sage: g = DynamicalSystem([x, y], P) - sage: DynamicalSemigroup((f, g)) - Dynamical semigroup over Projective Space of dimension 1 over Univariate Polynomial Ring in r over Rational Field defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Univariate Polynomial Ring in r over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (r*x : y) - Dynamical System of Projective Space of dimension 1 over Univariate Polynomial Ring in r over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x : y) + sage: R. = QQ[] + sage: P. = ProjectiveSpace(R, 1) + sage: f = DynamicalSystem([r * x, y], P) + sage: g = DynamicalSystem([x, y], P) + sage: DynamicalSemigroup((f, g)) + Dynamical semigroup over Projective Space of dimension 1 over Univariate + Polynomial Ring in r over Rational Field defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over + Univariate Polynomial Ring in r over Rational Field + Defn: Defined on coordinates by sending (x : y) to (r*x : y) + Dynamical System of Projective Space of dimension 1 over + Univariate Polynomial Ring in r over Rational Field + Defn: Defined on coordinates by sending (x : y) to (x : y) - :: + :: - sage: R. = QQ[] - sage: P. = ProjectiveSpace(R, 1) - sage: f = DynamicalSystem([r * x, y], P) - sage: g = DynamicalSystem([s * x, y], P) - sage: DynamicalSemigroup((f, g)) - Dynamical semigroup over Projective Space of dimension 1 over Multivariate Polynomial Ring in r, s over Rational Field defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Multivariate Polynomial Ring in r, s over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (r*x : y) - Dynamical System of Projective Space of dimension 1 over Multivariate Polynomial Ring in r, s over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (s*x : y) + sage: R. = QQ[] + sage: P. = ProjectiveSpace(R, 1) + sage: f = DynamicalSystem([r * x, y], P) + sage: g = DynamicalSystem([s * x, y], P) + sage: DynamicalSemigroup((f, g)) + Dynamical semigroup over Projective Space of dimension 1 over Multivariate + Polynomial Ring in r, s over Rational Field defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over + Multivariate Polynomial Ring in r, s over Rational Field + Defn: Defined on coordinates by sending (x : y) to (r*x : y) + Dynamical System of Projective Space of dimension 1 over + Multivariate Polynomial Ring in r, s over Rational Field + Defn: Defined on coordinates by sending (x : y) to (s*x : y) - :: + :: - sage: R. = QQ[] - sage: P. = ProjectiveSpace(R, 1) - sage: f = DynamicalSystem([r * x, s * y], P) - sage: g = DynamicalSystem([s * x, r * y], P) - sage: DynamicalSemigroup((f, g)) - Dynamical semigroup over Projective Space of dimension 1 over Multivariate Polynomial Ring in r, s over Rational Field defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Multivariate Polynomial Ring in r, s over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (r*x : s*y) - Dynamical System of Projective Space of dimension 1 over Multivariate Polynomial Ring in r, s over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (s*x : r*y) + sage: R. = QQ[] + sage: P. = ProjectiveSpace(R, 1) + sage: f = DynamicalSystem([r * x, s * y], P) + sage: g = DynamicalSystem([s * x, r * y], P) + sage: DynamicalSemigroup((f, g)) + Dynamical semigroup over Projective Space of dimension 1 over + Multivariate Polynomial Ring in r, s over Rational Field + defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over + Multivariate Polynomial Ring in r, s over Rational Field + Defn: Defined on coordinates by sending (x : y) to (r*x : s*y) + Dynamical System of Projective Space of dimension 1 over + Multivariate Polynomial Ring in r, s over Rational Field + Defn: Defined on coordinates by sending (x : y) to (s*x : r*y) A dynamical semigroup may contain dynamical systems over finite fields:: sage: F = FiniteField(5) sage: P. = ProjectiveSpace(F, 1) sage: DynamicalSemigroup(([x, y], [x^2, y^2])) - Dynamical semigroup over Projective Space of dimension 1 over Finite Field of size 5 defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Finite Field of size 5 - Defn: Defined on coordinates by sending (x : y) to - (x : y) - Dynamical System of Projective Space of dimension 1 over Finite Field of size 5 - Defn: Defined on coordinates by sending (x : y) to - (x^2 : y^2) + Dynamical semigroup over Projective Space of dimension 1 over + Finite Field of size 5 defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over Finite Field of size 5 + Defn: Defined on coordinates by sending (x : y) to (x : y) + Dynamical System of Projective Space of dimension 1 over Finite Field of size 5 + Defn: Defined on coordinates by sending (x : y) to (x^2 : y^2) - If a dynamical semigroup is built from dynamical systems over both projective and affine spaces, all systems - will be homogenized to dynamical systems over projective space:: + If a dynamical semigroup is built from dynamical systems over both projective and + affine spaces, all systems will be homogenized to dynamical systems over projective space:: sage: P. = ProjectiveSpace(QQ, 1) sage: A. = AffineSpace(QQ, 1) sage: f = DynamicalSystem([x, y], P) sage: g = DynamicalSystem(z^2, A) sage: DynamicalSemigroup((f, g)) - Dynamical semigroup over Projective Space of dimension 1 over Rational Field defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x : y) - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x^2 : y^2) + Dynamical semigroup over Projective Space of dimension 1 over Rational Field + defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x : y) to (x : y) + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x : y) to (x^2 : y^2) TESTS:: @@ -299,6 +308,7 @@ class DynamicalSemigroup(Parent, metaclass=InheritComparisonClasscallMetaclass): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: K. = NumberField(r^2 - 2) sage: P. = ProjectiveSpace(RR, 1) @@ -443,13 +453,14 @@ def change_ring(self, new_ring): sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSemigroup(([x, y], [x^2, y^2])) sage: f.change_ring(RR) - Dynamical semigroup over Projective Space of dimension 1 over Real Field with 53 bits of precision defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Real Field with 53 bits of precision - Defn: Defined on coordinates by sending (x : y) to - (x : y) - Dynamical System of Projective Space of dimension 1 over Real Field with 53 bits of precision - Defn: Defined on coordinates by sending (x : y) to - (x^2 : y^2) + Dynamical semigroup over Projective Space of dimension 1 over + Real Field with 53 bits of precision defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over + Real Field with 53 bits of precision + Defn: Defined on coordinates by sending (x : y) to (x : y) + Dynamical System of Projective Space of dimension 1 over + Real Field with 53 bits of precision + Defn: Defined on coordinates by sending (x : y) to (x^2 : y^2) """ new_systems = [] for ds in self.defining_systems(): @@ -516,11 +527,9 @@ def defining_systems(self): sage: f = DynamicalSemigroup(([x, y], [x^2, y^2])) sage: f.defining_systems() (Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x : y), + Defn: Defined on coordinates by sending (x : y) to (x : y), Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x^2 : y^2)) + Defn: Defined on coordinates by sending (x : y) to (x^2 : y^2)) """ return tuple(self._dynamical_systems) @@ -760,13 +769,12 @@ def specialization(self, assignments): sage: g = DynamicalSystem([x, r * y], P) sage: d = DynamicalSemigroup((f, g)) sage: d.specialization({r:2}) - Dynamical semigroup over Projective Space of dimension 1 over Rational Field defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (2*x : y) - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x : 2*y) + Dynamical semigroup over Projective Space of dimension 1 over Rational Field + defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x : y) to (2*x : y) + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x : y) to (x : 2*y) :: @@ -776,13 +784,12 @@ def specialization(self, assignments): sage: g = DynamicalSystem([x, y], P) sage: d = DynamicalSemigroup((f, g)) sage: d.specialization({r:2}) - Dynamical semigroup over Projective Space of dimension 1 over Rational Field defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (2*x : y) - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x : y) + Dynamical semigroup over Projective Space of dimension 1 over Rational Field + defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x : y) to (2*x : y) + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x : y) to (x : y) :: @@ -792,13 +799,12 @@ def specialization(self, assignments): sage: g = DynamicalSystem([s * x, y], P) sage: d = DynamicalSemigroup((f, g)) sage: d.specialization({r:2, s:3}) - Dynamical semigroup over Projective Space of dimension 1 over Rational Field defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (2*x : y) - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (3*x : y) + Dynamical semigroup over Projective Space of dimension 1 over Rational Field + defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x : y) to (2*x : y) + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x : y) to (3*x : y) :: @@ -808,13 +814,15 @@ def specialization(self, assignments): sage: g = DynamicalSystem([s * x, r * y], P) sage: d = DynamicalSemigroup((f, g)) sage: d.specialization({s:3}) - Dynamical semigroup over Projective Space of dimension 1 over Univariate Polynomial Ring in r over Rational Field defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Univariate Polynomial Ring in r over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (r*x : 3*y) - Dynamical System of Projective Space of dimension 1 over Univariate Polynomial Ring in r over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (3*x : r*y) + Dynamical semigroup over Projective Space of dimension 1 over + Univariate Polynomial Ring in r over Rational Field + defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over + Univariate Polynomial Ring in r over Rational Field + Defn: Defined on coordinates by sending (x : y) to (r*x : 3*y) + Dynamical System of Projective Space of dimension 1 over + Univariate Polynomial Ring in r over Rational Field + Defn: Defined on coordinates by sending (x : y) to (3*x : r*y) """ specialized_systems = [] for ds in self.defining_systems(): @@ -1222,13 +1230,12 @@ class DynamicalSemigroup_projective(DynamicalSemigroup): sage: P. = ProjectiveSpace(QQ, 1) sage: DynamicalSemigroup_projective(([x, y], [x^2, y^2])) - Dynamical semigroup over Projective Space of dimension 1 over Rational Field defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x : y) - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x^2 : y^2) + Dynamical semigroup over Projective Space of dimension 1 over + Rational Field defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x : y) to (x : y) + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x : y) to (x^2 : y^2) """ @staticmethod @@ -1282,13 +1289,12 @@ def dehomogenize(self, n): sage: g = DynamicalSystem([x^2, y^2], P) sage: d = DynamicalSemigroup((f, g)) sage: d.dehomogenize(0) - Dynamical semigroup over Affine Space of dimension 1 over Rational Field defined by 2 dynamical systems: - Dynamical System of Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (y) to - (y) - Dynamical System of Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (y) to - (y^2) + Dynamical semigroup over Affine Space of dimension 1 over + Rational Field defined by 2 dynamical systems: + Dynamical System of Affine Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (y) to (y) + Dynamical System of Affine Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (y) to (y^2) :: @@ -1297,13 +1303,12 @@ def dehomogenize(self, n): sage: g = DynamicalSystem([x^2, y^2], P) sage: d = DynamicalSemigroup((f, g)) sage: d.dehomogenize(1) - Dynamical semigroup over Affine Space of dimension 1 over Rational Field defined by 2 dynamical systems: - Dynamical System of Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x) to - (x) - Dynamical System of Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x) to - (x^2) + Dynamical semigroup over Affine Space of dimension 1 over + Rational Field defined by 2 dynamical systems: + Dynamical System of Affine Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x) to (x) + Dynamical System of Affine Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x) to (x^2) TESTS:: @@ -1317,8 +1322,8 @@ def dehomogenize(self, n): ValueError: Scheme morphism: From: Affine Space of dimension 1 over Rational Field To: Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x) to - (1/x) is not a `DynamicalSystem_affine` object + Defn: Defined on coordinates by sending (x) to (1/x) + is not a `DynamicalSystem_affine` object """ new_systems = [] for ds in self.defining_systems(): @@ -1354,13 +1359,12 @@ class DynamicalSemigroup_affine(DynamicalSemigroup): sage: f = DynamicalSystem(x, A) sage: g = DynamicalSystem(x^2, A) sage: DynamicalSemigroup_affine((f, g)) - Dynamical semigroup over Affine Space of dimension 1 over Rational Field defined by 2 dynamical systems: - Dynamical System of Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x) to - (x) - Dynamical System of Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x) to - (x^2) + Dynamical semigroup over Affine Space of dimension 1 over + Rational Field defined by 2 dynamical systems: + Dynamical System of Affine Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x) to (x) + Dynamical System of Affine Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x) to (x^2) """ @staticmethod @@ -1411,13 +1415,12 @@ def homogenize(self, n): sage: g = DynamicalSystem(x^2, A) sage: d = DynamicalSemigroup((f, g)) sage: d.homogenize(1) - Dynamical semigroup over Projective Space of dimension 1 over Rational Field defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x0 : x1) to - (x0 + x1 : x1) - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x0 : x1) to - (x0^2 : x1^2) + Dynamical semigroup over Projective Space of dimension 1 over Rational Field + defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x0 : x1) to (x0 + x1 : x1) + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x0 : x1) to (x0^2 : x1^2) :: @@ -1426,13 +1429,12 @@ def homogenize(self, n): sage: g = DynamicalSystem(x^2, A) sage: d = DynamicalSemigroup((f, g)) sage: d.homogenize((1, 0)) - Dynamical semigroup over Projective Space of dimension 1 over Rational Field defined by 2 dynamical systems: - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x0 : x1) to - (x1 : x0 + x1) - Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x0 : x1) to - (x1^2 : x0^2) + Dynamical semigroup over Projective Space of dimension 1 over Rational Field + defined by 2 dynamical systems: + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x0 : x1) to (x1 : x0 + x1) + Dynamical System of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x0 : x1) to (x1^2 : x0^2) """ new_systems = [] for ds in self.defining_systems(): @@ -1466,11 +1468,9 @@ def _standardize_domains_of_(systems): sage: g = DynamicalSystem(x^2, B) sage: sage.dynamics.arithmetic_dynamics.dynamical_semigroup._standardize_domains_of_([f, g]) [Dynamical System of Affine Space of dimension 1 over Real Field with 53 bits of precision - Defn: Defined on coordinates by sending (x) to - (x), + Defn: Defined on coordinates by sending (x) to (x), Dynamical System of Affine Space of dimension 1 over Real Field with 53 bits of precision - Defn: Defined on coordinates by sending (x) to - (x^2)] + Defn: Defined on coordinates by sending (x) to (x^2)] """ identical_domains = True for ds in systems: diff --git a/src/sage/dynamics/arithmetic_dynamics/generic_ds.py b/src/sage/dynamics/arithmetic_dynamics/generic_ds.py index a9a945124fd..9d6e877d424 100644 --- a/src/sage/dynamics/arithmetic_dynamics/generic_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/generic_ds.py @@ -139,6 +139,8 @@ class DynamicalSystem(SchemeMorphism_polynomial, Projective Space of dimension 1 over Complex Field with 53 bits of precision Defn: Defined on coordinates by sending (x : y) to (1.00000000000000*I*x^2 : 0.800000000000000*y^2) + + sage: # needs sage.rings.finite_rings sage: P. = ProjectiveSpace(GF(5), 1) sage: K. = GF(25) sage: DynamicalSystem([GF(5)(3)*x^2, K(t)*y^2]) @@ -364,6 +366,7 @@ def field_of_definition_critical(self, return_embedding=False, simplify_all=Fals Note that the number of critical points is `2d-2`, but `(1:0)` has multiplicity 2 in this case:: + sage: # needs sage.libs.singular sage.rings.number_field sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([1/3*x^3 + x*y^2, y^3], domain=P) sage: f.critical_points() @@ -376,6 +379,7 @@ def field_of_definition_critical(self, return_embedding=False, simplify_all=Fals :: + sage: # needs sage.libs.singular sage.rings.number_field sage: A. = AffineSpace(QQ, 1) sage: f = DynamicalSystem([z^4 + 2*z^2 + 2], domain=A) sage: K. = f.field_of_definition_critical(); K @@ -383,6 +387,7 @@ def field_of_definition_critical(self, return_embedding=False, simplify_all=Fals :: + sage: # needs sage.libs.singular sage.rings.finite_rings sage: G. = GF(9) sage: R. = G[] sage: R.irreducible_element(3, algorithm='first_lexicographic') @@ -470,6 +475,7 @@ def field_of_definition_periodic(self, n, formal=False, return_embedding=False, EXAMPLES:: + sage: # needs sage.libs.singular sage.rings.number_field sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([x^2, y^2], domain=P) sage: f.periodic_points(3, minimal=False) @@ -489,6 +495,7 @@ def field_of_definition_periodic(self, n, formal=False, return_embedding=False, :: + sage: # needs sage.libs.singular sage.rings.number_field sage: A. = AffineSpace(QQ, 1) sage: f = DynamicalSystem([(z^2 + 1)/(2*z + 1)], domain=A) sage: K. = f.field_of_definition_periodic(2); K @@ -498,6 +505,7 @@ def field_of_definition_periodic(self, n, formal=False, return_embedding=False, :: + sage: # needs sage.rings.finite_rings sage: G. = GF(4) sage: A. = AffineSpace(G, 1) sage: f = DynamicalSystem([x^2 + (a+1)*x + 1], domain=A) @@ -589,7 +597,8 @@ def field_of_definition_preimage(self, point, n, return_embedding=False, simplif sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([1/3*x^2 + 2/3*x*y, x^2 - 2*y^2], domain=P) - sage: N. = f.field_of_definition_preimage(P(1,1), 2, simplify_all=True); N + sage: N. = f.field_of_definition_preimage(P(1,1), 2, # needs sage.rings.number_field + ....: simplify_all=True); N Number Field in a with defining polynomial x^8 - 4*x^7 - 128*x^6 + 398*x^5 + 3913*x^4 - 8494*x^3 - 26250*x^2 + 30564*x - 2916 @@ -597,7 +606,7 @@ def field_of_definition_preimage(self, point, n, return_embedding=False, simplif sage: A. = AffineSpace(QQ, 1) sage: f = DynamicalSystem([z^2], domain=A) - sage: K. = f.field_of_definition_preimage(A(1), 3); K + sage: K. = f.field_of_definition_preimage(A(1), 3); K # needs sage.rings.number_field Number Field in a with defining polynomial z^4 + 1 :: @@ -605,7 +614,8 @@ def field_of_definition_preimage(self, point, n, return_embedding=False, simplif sage: G = GF(5) sage: P. = ProjectiveSpace(G, 1) sage: f = DynamicalSystem([x^2 + 2*y^2, y^2], domain=P) - sage: f.field_of_definition_preimage(P(2,1), 2, return_embedding=True, names='a') + sage: f.field_of_definition_preimage(P(2,1), 2, return_embedding=True, # needs sage.rings.number_field + ....: names='a') (Finite Field in a of size 5^2, Ring morphism: From: Finite Field of size 5 diff --git a/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py b/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py index 0d1672e15d0..72676c1ad2a 100644 --- a/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py +++ b/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py @@ -25,25 +25,30 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.calculus.functions import jacobian -from sage.categories.fields import Fields +from copy import copy + +import sage.rings.abc + from sage.categories.commutative_rings import CommutativeRings +from sage.categories.fields import Fields from sage.categories.number_fields import NumberFields -from sage.misc.functional import sqrt from sage.misc.cachefunc import cached_method +from sage.misc.functional import sqrt +from sage.misc.lazy_import import lazy_import from sage.misc.mrange import xmrange from sage.rings.finite_rings.finite_field_constructor import GF from sage.rings.fraction_field import FractionField from sage.rings.integer_ring import ZZ -from sage.rings.number_field.order import is_NumberFieldOrder -from sage.rings.padics.factory import Qp from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.rational_field import QQ from sage.rings.real_mpfr import RealField from sage.schemes.generic.algebraic_scheme import AlgebraicScheme_subscheme -from sage.schemes.product_projective.subscheme import AlgebraicScheme_subscheme_product_projective from sage.schemes.product_projective.space import ProductProjectiveSpaces -from copy import copy +from sage.schemes.product_projective.subscheme import AlgebraicScheme_subscheme_product_projective + +lazy_import("sage.calculus.functions", "jacobian") +lazy_import('sage.rings.padics.factory', 'Qp') + _NumberFields = NumberFields() _Fields = Fields() @@ -908,11 +913,11 @@ def degenerate_primes(self,check=True): [2, 3, 5, 11, 23, 47, 48747691, 111301831] """ PP = self.ambient_space() - if PP.base_ring() in _NumberFields or is_NumberFieldOrder(PP.base_ring()): - if PP.base_ring() != ZZ and PP.base_ring() != QQ: + if PP.base_ring() != ZZ and PP.base_ring() != QQ: + if PP.base_ring() in _NumberFields or isinstance(PP.base_ring(), sage.rings.abc.Order): raise NotImplementedError("must be ZZ or QQ") - else: - raise TypeError("must be over a number field") + else: + raise TypeError("must be over a number field") if self.is_degenerate(): raise TypeError("surface is degenerate at all primes") RR = PP.coordinate_ring() From a0379b53a069bfcdb5debf8e39c9ecf31c21ce37 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 9 Sep 2023 12:35:52 -0700 Subject: [PATCH 16/32] sage.schemes: Update # needs --- src/sage/schemes/generic/algebraic_scheme.py | 30 +++++++++++-------- .../schemes/projective/projective_morphism.py | 16 +++++----- .../projective/projective_rational_point.py | 2 +- src/sage/schemes/toric/chow_group.py | 8 ++--- src/sage/schemes/toric/divisor.py | 8 ++--- src/sage/schemes/toric/toric_subscheme.py | 20 +++++++++---- src/sage/schemes/toric/variety.py | 12 ++++---- 7 files changed, 56 insertions(+), 40 deletions(-) diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index 01b7229f846..b5eb3d4ed32 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -278,9 +278,10 @@ def is_projective(self): projective spaces. This is why this method returns ``False`` for toric varieties:: - sage: PP. = toric_varieties.P(3) # needs sage.geometry.polyhedron + sage: # needs sage.geometry.polyhedron sage.graphs + sage: PP. = toric_varieties.P(3) sage: V = PP.subscheme(x^3 + y^3 + z^3 + w^3) - sage: V.is_projective() # needs sage.geometry.polyhedron + sage: V.is_projective() False """ return self.ambient_space().is_projective() @@ -386,9 +387,11 @@ def embedding_morphism(self): 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() # 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 + +i sage: # needs sage.graphs sage.geometry.polyhedron sage.libs.singular + sage: P1xP1. = toric_varieties.P1xP1() + sage: P1 = P1xP1.subscheme(x - y) + sage: P1.embedding_morphism() Scheme morphism: From: Closed subscheme of 2-d CPR-Fano toric variety covered by 4 affine patches defined by: x - y @@ -427,18 +430,18 @@ def embedding_morphism(self): A couple more examples:: - sage: # needs sage.geometry.polyhedron + sage: # needs sage.geometry.polyhedron sage.graphs sage.libs.singular sage: patch1 = P1xP1.affine_patch(1); patch1 2-d affine toric variety - sage: patch1.embedding_morphism() # needs sage.libs.singular + sage: patch1.embedding_morphism() Scheme morphism: From: 2-d affine toric variety To: 2-d CPR-Fano toric variety covered by 4 affine patches Defn: Defined on coordinates by sending [y : u] to [1 : y : u : 1] - sage: subpatch = P1.affine_patch(1); subpatch # needs sage.libs.singular + sage: subpatch = P1.affine_patch(1); subpatch Closed subscheme of 2-d affine toric variety defined by: -y + 1 - sage: subpatch.embedding_morphism() # needs sage.libs.singular + sage: subpatch.embedding_morphism() 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 @@ -543,7 +546,7 @@ def _homset(self, *args, **kwds): EXAMPLES:: - sage: # needs sage.geometry.polyhedron + sage: # needs sage.geometry.polyhedron sage.graphs sage: P1. = toric_varieties.P1() sage: type(P1.Hom(P1)) @@ -553,9 +556,10 @@ def _homset(self, *args, **kwds): :: - 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 + sage: # needs sage.geometry.polyhedron sage.graphs + sage: P1xP1 = toric_varieties.P1xP1() + sage: P1 = toric_varieties.P1() + sage: P1xP1._homset(P1xP1, P1) Set of morphisms From: 2-d CPR-Fano toric variety covered by 4 affine patches To: 1-d CPR-Fano toric variety covered by 2 affine patches diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index bd110b059ed..d4bd02eba78 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -1366,7 +1366,7 @@ def global_height(self, prec=None): :: - sage: # needs sage.rings.number_field + sage: # needs sage.rings.number_field sage.symbolic sage: P. = ProjectiveSpace(QQbar, 1) sage: P2. = ProjectiveSpace(QQbar, 2) sage: H = Hom(P, P2) @@ -2082,18 +2082,18 @@ def reduce_base_field(self): 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() # needs sage.modules + sage: f.reduce_base_field() # needs sage.libs.singular sage.modules Scheme endomorphism of Projective Space of dimension 1 over Finite Field in t2 of size 3^2 Defn: Defined on coordinates by sending (x : y) to (x^2 + t2*y^2 : y^2) sage: f2 = H2([x^2 + 5*y^2, y^2, 2*x*y]) - sage: f2.reduce_base_field() # needs sage.modules + sage: f2.reduce_base_field() # needs sage.libs.singular sage.modules Scheme morphism: From: Projective Space of dimension 1 over Finite Field of size 3 To: Projective Space of dimension 2 over Finite Field of size 3 Defn: Defined on coordinates by sending (x : y) to (x^2 - y^2 : y^2 : -x*y) sage: f3 = H3([a^2 + t*b^2, c^2]) - sage: f3.reduce_base_field() # needs sage.modules + sage: f3.reduce_base_field() # needs sage.libs.singular sage.modules 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 @@ -2106,7 +2106,7 @@ def reduce_base_field(self): sage: P. = ProjectiveSpace(K, 1) sage: H = End(P) sage: f = H([x^2 + 2*y^2, y^2]) - sage: f.reduce_base_field() + sage: f.reduce_base_field() # needs sage.libs.singular 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) @@ -2118,13 +2118,13 @@ def reduce_base_field(self): 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() + sage: f.reduce_base_field() # needs sage.libs.singular Scheme endomorphism of Projective Space of dimension 1 over Finite Field in z4 of size 5^4 Defn: Defined on coordinates by sending (x : y) to ((z4^3 + z4^2 + z4 - 2)*x^2 + z4*y^2 : x*y) sage: f = DynamicalSystem_projective([L.gen(3)*x^2 + L.gen(2)*y^2, x*y]) - sage: f.reduce_base_field() + sage: f.reduce_base_field() # needs sage.libs.singular 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 @@ -2138,7 +2138,7 @@ def reduce_base_field(self): sage: P. = ProjectiveSpace(F, 1) sage: H = Hom(P, P) sage: f = H([x^2 + y^2, y^2]) - sage: f.reduce_base_field() + sage: f.reduce_base_field() # needs sage.libs.singular 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) diff --git a/src/sage/schemes/projective/projective_rational_point.py b/src/sage/schemes/projective/projective_rational_point.py index 31dc0703b5a..bd66a798cce 100644 --- a/src/sage/schemes/projective/projective_rational_point.py +++ b/src/sage/schemes/projective/projective_rational_point.py @@ -191,7 +191,7 @@ def enum_projective_number_field(X, **kwds): sage: K = NumberField(u^3 - 5, 'v') sage: P. = ProjectiveSpace(K, 2) sage: X = P.subscheme([x - y]) - sage: enum_projective_number_field(X(K), bound=RR(5^(1/3)), prec=2^10) + sage: enum_projective_number_field(X(K), bound=RR(5^(1/3)), prec=2^10) # needs sage.symbolic [(0 : 0 : 1), (1 : 1 : 0), (-1 : -1 : 1), (1 : 1 : 1)] :: diff --git a/src/sage/schemes/toric/chow_group.py b/src/sage/schemes/toric/chow_group.py index ae3d245c744..dac091a4f6f 100644 --- a/src/sage/schemes/toric/chow_group.py +++ b/src/sage/schemes/toric/chow_group.py @@ -317,7 +317,7 @@ def count_points(self): sage: aD = a.intersection_with_divisor(D) sage: aD.count_points() 1 - sage: P2.integrate( aD.cohomology_class() ) + sage: P2.integrate(aD.cohomology_class()) # needs sage.libs.singular 1 For toric varieties with at most orbifold singularities, the @@ -333,7 +333,7 @@ def count_points(self): V(y) sage: Dt.Chow_cycle(QQ).intersection_with_divisor(Dy).count_points() 1/2 - sage: P1xP1_Z2.integrate( Dt.cohomology_class() * Dy.cohomology_class() ) + sage: P1xP1_Z2.integrate(Dt.cohomology_class() * Dy.cohomology_class()) # needs sage.libs.singular 1/2 """ return sum(self.project_to_degree(0).lift()) @@ -476,6 +476,7 @@ def cohomology_class(self): EXAMPLES:: + sage: # needs sage.libs.singular sage: dP6 = toric_varieties.dP6() sage: cone = dP6.fan().cone_containing(2,3) sage: HH = dP6.cohomology_ring() @@ -491,6 +492,7 @@ def cohomology_class(self): singularities, where we can also use the isomorphism with the rational cohomology ring:: + sage: # needs sage.libs.singular sage: WP4 = toric_varieties.P4_11169() sage: A = WP4.Chow_group() sage: HH = WP4.cohomology_ring() @@ -499,13 +501,11 @@ def cohomology_class(self): ( 0 | -1 | 0 | 0 | 0 ) sage: HH(cone3d) [3*z4^3] - sage: D = -WP4.K() # the anticanonical divisor sage: A(D) ( 0 | 0 | 0 | -18 | 0 ) sage: HH(D) [18*z4] - sage: WP4.integrate( A(cone3d).cohomology_class() * D.cohomology_class() ) 1 sage: WP4.integrate( HH(cone3d) * D.cohomology_class() ) diff --git a/src/sage/schemes/toric/divisor.py b/src/sage/schemes/toric/divisor.py index 3fbdae4cdb5..fb0bdbbfd17 100644 --- a/src/sage/schemes/toric/divisor.py +++ b/src/sage/schemes/toric/divisor.py @@ -818,7 +818,7 @@ def cohomology_class(self): sage: dP6 = toric_varieties.dP6() sage: D = dP6.divisor(dP6.fan().ray(0)) - sage: D.cohomology_class() + sage: D.cohomology_class() # needs sage.libs.singular [y + v - w] """ divisor = vector(self) @@ -841,9 +841,9 @@ def Chern_character(self): sage: D5 = dP6.divisor(dP6.fan().cone_containing( N(-1,-1) )) sage: D6 = dP6.divisor(dP6.fan().cone_containing( N(0,-1) )) sage: D = -D3 + 2*D5 - D6 - sage: D.Chern_character() + sage: D.Chern_character() # needs sage.libs.singular [5*w^2 + y - 2*v + w + 1] - sage: dP6.integrate( D.ch() * dP6.Td() ) + sage: dP6.integrate(D.ch() * dP6.Td()) # needs sage.libs.singular -4 """ return self.cohomology_class().exp() @@ -1531,7 +1531,7 @@ def cohomology(self, weight=None, deg=None, dim=False): 2: Vector space of dimension 0 over Rational Field} sage: D.cohomology( weight=M(0,0), deg=1 ) Vector space of dimension 1 over Rational Field - sage: dP6.integrate( D.ch() * dP6.Td() ) + sage: dP6.integrate(D.ch() * dP6.Td()) # needs sage.libs.singular -4 Note the different output options:: diff --git a/src/sage/schemes/toric/toric_subscheme.py b/src/sage/schemes/toric/toric_subscheme.py index acdfd05d0d1..cc5b0e3158a 100644 --- a/src/sage/schemes/toric/toric_subscheme.py +++ b/src/sage/schemes/toric/toric_subscheme.py @@ -123,8 +123,8 @@ def _morphism(self, *args, **kwds): Defn: Defined on coordinates by sending [s : t : x : y] to [s : s : x : y] - sage: sbar, tbar, xbar, ybar = P1.coordinate_ring().gens() - sage: P1._morphism(H, [sbar, sbar, xbar, ybar]) + sage: sbar, tbar, xbar, ybar = P1.coordinate_ring().gens() # needs sage.libs.singular + sage: P1._morphism(H, [sbar, sbar, xbar, ybar]) # needs sage.libs.singular Scheme morphism: From: Closed subscheme of 2-d CPR-Fano toric variety covered by 4 affine patches defined by: @@ -425,6 +425,7 @@ def neighborhood(self, point): EXAMPLES:: + sage: # needs sage.libs.singular sage: P. = toric_varieties.P2() sage: S = P.subscheme(x + 2*y + 3*z) sage: s = S.point([0,-3,2]); s @@ -445,6 +446,7 @@ def neighborhood(self, point): A more complicated example:: + sage: # needs sage.libs.singular sage: dP6. = toric_varieties.dP6() sage: twoP1 = dP6.subscheme(x0*x3) sage: patch = twoP1.neighborhood([0,1,2, 3,4,5]); patch @@ -496,6 +498,7 @@ def dimension(self): EXAMPLES:: + sage: # needs sage.libs.singular sage: P1xP1 = toric_varieties.P1xP1() sage: P1xP1.inject_variables() Defining s, t, x, y @@ -531,6 +534,7 @@ def is_smooth(self, point=None): EXAMPLES:: + sage: # needs sage.libs.singular sage: P2. = toric_varieties.P2() sage: cuspidal_curve = P2.subscheme([y^2*z - x^3]) sage: cuspidal_curve @@ -545,11 +549,12 @@ def is_smooth(self, point=None): Any sufficiently generic cubic hypersurface is smooth:: - 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 A more complicated example:: + sage: # needs sage.libs.singular sage: dP6. = toric_varieties.dP6() sage: disjointP1s = dP6.subscheme(x0*x3) sage: disjointP1s.is_smooth() @@ -560,6 +565,7 @@ def is_smooth(self, point=None): A smooth hypersurface in a compact singular toric variety:: + sage: # needs sage.libs.singular sage: lp = LatticePolytope([(1,0,0), (1,1,0), (1,1,1), (1,0,1), (-2,-1,-1)], ....: lattice=ToricLattice(3)) sage: X. = CPRFanoToricVariety(Delta_polar=lp) @@ -703,6 +709,7 @@ def is_schon(self): EXAMPLES:: + sage: # needs sage.libs.singular sage: P2. = toric_varieties.P2() sage: X = P2.subscheme([(x-y)^2*(x+y) + x*y*z + z^3]) sage: X.is_smooth() @@ -791,6 +798,7 @@ def dimension(self): EXAMPLES:: + sage: # needs sage.libs.singular sage: P1xP1. = toric_varieties.P1xP1() sage: P1 = P1xP1.subscheme(s0 - s1) sage: P1.dimension() @@ -799,11 +807,11 @@ def dimension(self): A more complicated example where the ambient toric variety is not smooth:: + sage: # needs sage.libs.singular sage: X. = toric_varieties.A2_Z2() sage: X.is_smooth() False - sage: Y = X.subscheme([x*y, x^2]) - sage: Y + sage: Y = X.subscheme([x*y, x^2]); Y Closed subscheme of 2-d affine toric variety defined by: x*y, x^2 @@ -836,6 +844,7 @@ def is_smooth(self, point=None): EXAMPLES:: + sage: # needs sage.libs.singular sage: A2. = toric_varieties.A2() sage: cuspidal_curve = A2.subscheme([y^2 - x^3]) sage: cuspidal_curve @@ -856,6 +865,7 @@ def is_smooth(self, point=None): A more complicated example where the ambient toric variety is not smooth:: + sage: # needs sage.libs.singular sage: X. = toric_varieties.A2_Z2() # 2-d affine space mod Z/2 sage: X.is_smooth() False diff --git a/src/sage/schemes/toric/variety.py b/src/sage/schemes/toric/variety.py index 82d2ec7769a..558900f5119 100644 --- a/src/sage/schemes/toric/variety.py +++ b/src/sage/schemes/toric/variety.py @@ -852,6 +852,7 @@ def _homset(self, *args, **kwds): Defn: Defined on coordinates by sending [s : t : x : y] to [s : s : x : y] + sage: # needs sage.libs.singular sage: hom_set = P1.Hom(P1) sage: sbar, tbar, xbar, ybar = P1.coordinate_ring().gens() sage: hom_set([sbar,sbar,xbar,ybar]) @@ -1921,7 +1922,7 @@ def cohomology_ring(self): Multivariate Polynomial Ring in x, u, y, v, z, w over Rational Field sage: X.variable_names() ('x', 'u', 'y', 'v', 'z', 'w') - sage: X.cohomology_ring().gens() + sage: X.cohomology_ring().gens() # needs sage.libs.singular ([y + v - w], [-y + z + w], [y], [v], [z], [w]) TESTS: @@ -1960,6 +1961,7 @@ def cohomology_basis(self, d=None): EXAMPLES:: + sage: # needs sage.libs.singular sage: X = toric_varieties.dP8() sage: X.cohomology_basis() (([1],), ([z], [y]), ([y*z],)) @@ -2004,11 +2006,11 @@ def volume_class(self): EXAMPLES:: sage: P2 = toric_varieties.P2() - sage: P2.volume_class() + sage: P2.volume_class() # needs sage.libs.singular [z^2] sage: A2_Z2 = toric_varieties.A2_Z2() - sage: A2_Z2.volume_class() + sage: A2_Z2.volume_class() # needs sage.libs.singular Traceback (most recent call last): ... ValueError: volume class does not exist @@ -2032,11 +2034,11 @@ def volume_class(self): V(t) sage: Dy = P1xP1_Z2.divisor(3); Dy V(y) - sage: P1xP1_Z2.volume_class() + sage: P1xP1_Z2.volume_class() # needs sage.libs.singular [2*t*y] sage: HH = P1xP1_Z2.cohomology_ring() - sage: HH(Dt) * HH(Dy) == 1/2 * P1xP1_Z2.volume_class() + sage: HH(Dt) * HH(Dy) == 1/2 * P1xP1_Z2.volume_class() # needs sage.libs.singular True The fractional coefficients are also necessary to match the From 92489a44198e99ffba44100b741060476010fb1c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 10 Sep 2023 16:40:55 -0700 Subject: [PATCH 17/32] sage.schemes: Update # needs --- src/sage/schemes/generic/homset.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sage/schemes/generic/homset.py b/src/sage/schemes/generic/homset.py index 5db57860f7d..904a30d4e59 100644 --- a/src/sage/schemes/generic/homset.py +++ b/src/sage/schemes/generic/homset.py @@ -737,11 +737,11 @@ def cardinality(self): EXAMPLES:: - sage: toric_varieties.P2().point_set().cardinality() # needs sage.geometry.polyhedron + sage: toric_varieties.P2().point_set().cardinality() # needs sage.geometry.polyhedron sage.graphs +Infinity - sage: P2 = toric_varieties.P2(base_ring=GF(3)) # needs sage.geometry.polyhedron - sage: P2.point_set().cardinality() # needs sage.geometry.polyhedron + sage: P2 = toric_varieties.P2(base_ring=GF(3)) # needs sage.geometry.polyhedron sage.graphs + sage: P2.point_set().cardinality() # needs sage.geometry.polyhedron sage.graphs 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: P1.point_set().list() # needs sage.geometry.polyhedron + sage: P1 = toric_varieties.P1(base_ring=GF(3)) # needs sage.geometry.polyhedron sage.graphs + sage: P1.point_set().list() # needs sage.geometry.polyhedron sage.graphs ([0 : 1], [1 : 0], [1 : 1], [1 : 2]) """ return tuple(self) From c3b7079814764031361de34744ce521f4b1dd4cd Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 12 Sep 2023 00:09:33 -0700 Subject: [PATCH 18/32] sage.schemes: Update # needs --- src/sage/schemes/generic/algebraic_scheme.py | 2 +- src/sage/schemes/projective/projective_morphism.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index b5eb3d4ed32..b84d5626584 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -388,7 +388,7 @@ def embedding_morphism(self): To: Affine Space of dimension 2 over Rational Field Defn: Defined on coordinates by sending (x, y) to (x, y) -i sage: # needs sage.graphs sage.geometry.polyhedron sage.libs.singular + sage: # needs sage.graphs sage.geometry.polyhedron sage.libs.singular sage: P1xP1. = toric_varieties.P1xP1() sage: P1 = P1xP1.subscheme(x - y) sage: P1.embedding_morphism() diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index d4bd02eba78..c4c3c96299c 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -2123,8 +2123,8 @@ def reduce_base_field(self): over Finite Field in z4 of size 5^4 Defn: Defined on coordinates by sending (x : y) to ((z4^3 + z4^2 + z4 - 2)*x^2 + z4*y^2 : x*y) - sage: f = DynamicalSystem_projective([L.gen(3)*x^2 + L.gen(2)*y^2, x*y]) - sage: f.reduce_base_field() # needs sage.libs.singular + sage: f = DynamicalSystem_projective([L.gen(3)*x^2 + L.gen(2)*y^2, x*y]) # needs sage.schemes + sage: f.reduce_base_field() # needs sage.libs.singular sage.schemes 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 From d8141b23c17a2efa9507baec615a574fab8d2a4f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 12 Sep 2023 13:28:19 -0700 Subject: [PATCH 19/32] sage.schemes: Update # needs --- src/sage/schemes/toric/divisor.py | 6 +-- src/sage/schemes/toric/fano_variety.py | 2 +- src/sage/schemes/toric/homset.py | 2 + src/sage/schemes/toric/points.py | 6 +-- src/sage/schemes/toric/toric_subscheme.py | 1 + src/sage/schemes/toric/variety.py | 54 ++++++++++++------- .../schemes/toric/weierstrass_covering.py | 10 ++-- 7 files changed, 49 insertions(+), 32 deletions(-) diff --git a/src/sage/schemes/toric/divisor.py b/src/sage/schemes/toric/divisor.py index fb0bdbbfd17..c928cec4a7a 100644 --- a/src/sage/schemes/toric/divisor.py +++ b/src/sage/schemes/toric/divisor.py @@ -1063,7 +1063,7 @@ def polyhedron(self): (A vertex at (0, 0),) sage: D.is_nef() False - sage: dP7.integrate( D.ch() * dP7.Td() ) + sage: dP7.integrate(D.ch() * dP7.Td()) # needs sage.libs.singular 1 sage: P_antiK = (-dP7.K()).polyhedron(); P_antiK A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 5 vertices @@ -1267,7 +1267,7 @@ def Kodaira_map(self, names='z'): sage: P1. = toric_varieties.P1() sage: D = -P1.K() - sage: D.Kodaira_map() + sage: D.Kodaira_map() # needs fpylll Scheme morphism: From: 1-d CPR-Fano toric variety covered by 2 affine patches To: Closed subscheme of Projective Space of dimension 2 @@ -1276,7 +1276,7 @@ def Kodaira_map(self, names='z'): sage: dP6 = toric_varieties.dP6() sage: D = -dP6.K() - sage: D.Kodaira_map(names='x') + sage: D.Kodaira_map(names='x') # needs fpylll Scheme morphism: From: 2-d CPR-Fano toric variety covered by 6 affine patches To: Closed subscheme of Projective Space of dimension 6 diff --git a/src/sage/schemes/toric/fano_variety.py b/src/sage/schemes/toric/fano_variety.py index a1405c966ec..b7f2c2ab6ac 100644 --- a/src/sage/schemes/toric/fano_variety.py +++ b/src/sage/schemes/toric/fano_variety.py @@ -1518,7 +1518,7 @@ def cohomology_class(self): covered by 8 affine patches defined by: a2*z0^2*z1 + a5*z0*z1*z3 + a1*z1*z3^2 + a3*z0^2*z4 + a4*z0*z3*z4 + a0*z3^2*z4, b1*z1*z2^2 + b2*z2^2*z4 + b5*z1*z2*z5 + b4*z2*z4*z5 + b3*z1*z5^2 + b0*z4*z5^2 - sage: CI.cohomology_class() + sage: CI.cohomology_class() # needs sage.libs.singular [2*z3*z4 + 4*z3*z5 + 2*z4*z5] """ X = self.ambient_space() diff --git a/src/sage/schemes/toric/homset.py b/src/sage/schemes/toric/homset.py index bd535edf932..e02d0b92078 100644 --- a/src/sage/schemes/toric/homset.py +++ b/src/sage/schemes/toric/homset.py @@ -621,6 +621,7 @@ def __iter__(self): EXAMPLES:: + sage: # needs sage.libs.singular sage: P2. = toric_varieties.P2(base_ring=GF(5)) sage: cubic = P2.subscheme([x^3 + y^3 + z^3]) sage: list(cubic.point_set()) @@ -641,6 +642,7 @@ def cardinality(self): EXAMPLES:: + sage: # needs sage.libs.singular 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/points.py b/src/sage/schemes/toric/points.py index f9563bd0acc..4a40aa82ef7 100644 --- a/src/sage/schemes/toric/points.py +++ b/src/sage/schemes/toric/points.py @@ -1007,7 +1007,7 @@ def cardinality(self): sage: X. = ToricVariety(fan, base_ring=GF(7)) sage: Y = X.subscheme(u^3 + v^3 + w^3 + u*v*w) sage: point_set = Y.point_set() - sage: list(point_set) + sage: list(point_set) # needs fpylll [[0 : 1 : 3], [1 : 0 : 3], [1 : 3 : 0], @@ -1015,8 +1015,8 @@ def cardinality(self): [1 : 1 : 4], [1 : 3 : 2], [1 : 3 : 5]] - sage: ffe = point_set._enumerator() - sage: ffe.cardinality() + sage: ffe = point_set._enumerator() # needs fpylll + sage: ffe.cardinality() # needs fpylll 7 """ n = 0 diff --git a/src/sage/schemes/toric/toric_subscheme.py b/src/sage/schemes/toric/toric_subscheme.py index cc5b0e3158a..770e459335e 100644 --- a/src/sage/schemes/toric/toric_subscheme.py +++ b/src/sage/schemes/toric/toric_subscheme.py @@ -270,6 +270,7 @@ def affine_algebraic_patch(self, cone=None, names=None): Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: z0^3 + z1^3 + 1 + sage: # needs fpylll sage: cone = Cone([(0,1), (2,1)]) sage: A2Z2. = AffineToricVariety(cone) sage: A2Z2.affine_algebraic_patch() diff --git a/src/sage/schemes/toric/variety.py b/src/sage/schemes/toric/variety.py index 558900f5119..01064ffbc95 100644 --- a/src/sage/schemes/toric/variety.py +++ b/src/sage/schemes/toric/variety.py @@ -66,7 +66,7 @@ sage: C2 = AffineToricVariety(quadrant, base_field=CC) sage: C2.base_ring() Complex Field with 53 bits of precision - sage: C2(1,2+i) + sage: C2(1, 2+i) # needs sage.symbolic [1.00000000000000 : 2.00000000000000 + 1.00000000000000*I] or even :: @@ -1083,7 +1083,7 @@ def coordinate_ring(self): sage: R = toric_varieties.A1().coordinate_ring(); R Multivariate Polynomial Ring in z over Rational Field - sage: type(R) + sage: type(R) # needs sage.libs.singular <... 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomialRing_libsingular'> """ if "_coordinate_ring" not in self.__dict__: @@ -1931,6 +1931,7 @@ def cohomology_ring(self): potentially troublesome on unpickling, see :trac:`15050` and :trac:`15149` :: + sage: # needs sage.libs.singular sage: variety = toric_varieties.P(1) sage: a = [variety.cohomology_ring(), variety.cohomology_basis(), variety.volume_class()] sage: b = [variety.Todd_class(), variety.Chern_class(), variety.Chern_character(), variety.Kaehler_cone(), variety.Mori_cone()] @@ -2077,6 +2078,7 @@ def integrate(self, cohomology_class): EXAMPLES:: + sage: # needs sage.libs.singular sage: dP6 = toric_varieties.dP6() sage: HH = dP6.cohomology_ring() sage: D = [ HH(c) for c in dP6.fan(dim=1) ] @@ -2098,6 +2100,7 @@ def integrate(self, cohomology_class): If the toric variety is an orbifold, the intersection numbers are usually fractional:: + sage: # needs sage.libs.singular sage: P2_123 = toric_varieties.P2_123() sage: HH = P2_123.cohomology_ring() sage: D = [ HH(c) for c in P2_123.fan(dim=1) ] @@ -2159,6 +2162,7 @@ def Chern_class(self, deg=None): EXAMPLES:: + sage: # needs sage.libs.singular sage: X = toric_varieties.dP6() sage: X.Chern_class() [-6*w^2 + y + 2*v + 2*z + w + 1] @@ -2204,6 +2208,7 @@ def Chern_character(self, deg=None): EXAMPLES:: + sage: # needs sage.libs.singular sage: dP6 = toric_varieties.dP6() sage: dP6.Chern_character() [3*w^2 + y + 2*v + 2*z + w + 2] @@ -2243,6 +2248,7 @@ def Todd_class(self, deg=None): EXAMPLES:: + sage: # needs sage.libs.singular sage: dP6 = toric_varieties.dP6() sage: dP6.Todd_class() [-w^2 + 1/2*y + v + z + 1/2*w + 1] @@ -2289,6 +2295,7 @@ def Euler_number(self): EXAMPLES:: + sage: # needs sage.libs.singular sage: P1xP1 = toric_varieties.P1xP1() sage: P1xP1.Euler_number() 4 @@ -2320,7 +2327,7 @@ def K(self): sage: HH = dP6.cohomology_ring() sage: dP6.K() -V(x) - V(u) - V(y) - V(v) - V(z) - V(w) - sage: dP6.integrate( HH(dP6.K())^2 ) + sage: dP6.integrate( HH(dP6.K())^2 ) # needs sage.libs.singular 6 """ from sage.schemes.toric.divisor import ToricDivisor @@ -2479,18 +2486,18 @@ def _semigroup_ring(self, cone=None, names=None): EXAMPLES:: sage: A2Z2 = Cone([(0,1), (2,1)]) - sage: AffineToricVariety(A2Z2)._semigroup_ring() + sage: AffineToricVariety(A2Z2)._semigroup_ring() # needs fpylll (Multivariate Polynomial Ring in z0, z1, z2 over Rational Field, Ideal (-z0*z1 + z2^2) of Multivariate Polynomial Ring in z0, z1, z2 over Rational Field, 2-d cone in 2-d lattice M) sage: P2 = toric_varieties.P2() sage: cone = P2.fan().generating_cone(0) - sage: P2._semigroup_ring(cone) + sage: P2._semigroup_ring(cone) # needs fpylll (Multivariate Polynomial Ring in z0, z1 over Rational Field, Ideal (0) of Multivariate Polynomial Ring in z0, z1 over Rational Field, 2-d cone in 2-d lattice M) - sage: P2.change_ring(GF(101))._semigroup_ring(cone) + sage: P2.change_ring(GF(101))._semigroup_ring(cone) # needs fpylll (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) @@ -2560,7 +2567,7 @@ def Spec(self, cone=None, names=None): A more interesting example:: sage: A2Z2 = Cone([(0,1), (2,1)]) - sage: AffineToricVariety(A2Z2).Spec(names='u,v,t') + sage: AffineToricVariety(A2Z2).Spec(names='u,v,t') # needs fpylll Spectrum of Quotient of Multivariate Polynomial Ring in u, v, t over Rational Field by the ideal (-u*v + t^2) """ @@ -2594,10 +2601,10 @@ def affine_algebraic_patch(self, cone=None, names=None): sage: cone = Cone([(0,1), (2,1)]) sage: A2Z2 = AffineToricVariety(cone) - sage: A2Z2.affine_algebraic_patch() + sage: A2Z2.affine_algebraic_patch() # needs fpylll Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: -z0*z1 + z2^2 - sage: A2Z2.affine_algebraic_patch(Cone([(0,1)]), names='x, y, t') + sage: A2Z2.affine_algebraic_patch(Cone([(0,1)]), names='x, y, t') # needs fpylll Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: 1 """ @@ -3085,7 +3092,7 @@ def __init__(self, variety): True sage: TDiv.scheme().cohomology_ring() is X2.cohomology_ring() # this is where it gets tricky True - sage: TDiv.gen(0).Chern_character() * X2.cohomology_ring().one() + sage: TDiv.gen(0).Chern_character() * X2.cohomology_ring().one() # needs sage.libs.singular [1] """ self._variety = variety @@ -3147,6 +3154,7 @@ def _element_constructor_(self,x): EXAMPLES:: + sage: # needs sage.libs.singular sage: dP6 = toric_varieties.dP6() sage: H = dP6.cohomology_ring() sage: cone = dP6.fan().cone_containing(2,3); cone @@ -3164,6 +3172,7 @@ def _element_constructor_(self,x): coefficient is a multiple depending on the orbifold singularity. See also [CLS2011]_, Lemma 12.5.2:: + sage: # needs sage.libs.singular sage: P2_123 = toric_varieties.P2_123() sage: HH = P2_123.cohomology_ring() sage: HH(Cone([(1,0)])) * HH(Cone([(-2,-3)])) @@ -3179,6 +3188,7 @@ def _element_constructor_(self,x): Numbers will be converted into the ring:: + sage: # needs sage.libs.singular sage: P2 = toric_varieties.P2() sage: H = P2.cohomology_ring() sage: H._element_constructor_(1) @@ -3222,6 +3232,7 @@ def __call__(self, x, coerce=True): EXAMPLES:: + sage: # needs sage.libs.singular sage: P2 = toric_varieties.P2() sage: H = P2.cohomology_ring() sage: H(1) @@ -3245,7 +3256,7 @@ def gens(self): EXAMPLES:: sage: P2 = toric_varieties.P2() - sage: P2.cohomology_ring().gens() + sage: P2.cohomology_ring().gens() # needs sage.libs.singular ([z], [z], [z]) """ if "_gens" not in self.__dict__: @@ -3270,7 +3281,7 @@ def gen(self, i): EXAMPLES:: sage: P2 = toric_varieties.P2() - sage: P2.cohomology_ring().gen(2) + sage: P2.cohomology_ring().gen(2) # needs sage.libs.singular [z] """ return CohomologyClass(self, self._polynomial_ring.gen(i)) @@ -3295,9 +3306,9 @@ def is_CohomologyClass(x): sage: P2 = toric_varieties.P2() sage: HH = P2.cohomology_ring() sage: from sage.schemes.toric.variety import is_CohomologyClass - sage: is_CohomologyClass( HH.one() ) + sage: is_CohomologyClass( HH.one() ) # needs sage.libs.singular True - sage: is_CohomologyClass( HH(P2.fan(1)[0]) ) + sage: is_CohomologyClass( HH(P2.fan(1)[0]) ) # needs sage.libs.singular True sage: is_CohomologyClass('z') False @@ -3319,6 +3330,7 @@ class CohomologyClass(QuotientRingElement): EXAMPLES:: + sage: # needs sage.libs.singular sage: P2 = toric_varieties.P2() sage: P2.cohomology_ring().gen(0) [z] @@ -3348,7 +3360,7 @@ def __init__(self, cohomology_ring, representative): sage: P2 = toric_varieties.P2() sage: H = P2.cohomology_ring() sage: from sage.schemes.toric.variety import CohomologyClass - sage: CohomologyClass(H, H.defining_ideal().ring().zero() ) + sage: CohomologyClass(H, H.defining_ideal().ring().zero() ) # needs sage.libs.singular [0] """ assert representative in cohomology_ring.defining_ideal().ring(), \ @@ -3365,7 +3377,7 @@ def _repr_(self): EXAMPLES:: - sage: toric_varieties.P2().cohomology_ring().gen(0)._repr_() + sage: toric_varieties.P2().cohomology_ring().gen(0)._repr_() # needs sage.libs.singular '[z]' """ return '[' + super()._repr_() + ']' @@ -3380,8 +3392,8 @@ def _latex_(self): EXAMPLES:: - sage: cohomology_class = toric_varieties.P2().cohomology_ring().gen(0)^2/2 - sage: cohomology_class._latex_() + sage: cohomology_class = toric_varieties.P2().cohomology_ring().gen(0)^2/2 # needs sage.libs.singular + sage: cohomology_class._latex_() # needs sage.libs.singular '\\left[ \\frac{1}{2} z^{2} \\right]' """ return r'\left[ %s \right]' % latex(self.lift()) @@ -3399,9 +3411,9 @@ def deg(self): EXAMPLES:: sage: P2 = toric_varieties.P2() - sage: P2.cohomology_ring().gen(0).deg() + sage: P2.cohomology_ring().gen(0).deg() # needs sage.libs.singular 1 - sage: P2.cohomology_ring().zero().deg() + sage: P2.cohomology_ring().zero().deg() # needs sage.libs.singular -1 """ return self.lift().degree() @@ -3424,6 +3436,7 @@ def part_of_degree(self, d): EXAMPLES:: + sage: # needs sage.libs.singular sage: P1xP1 = toric_varieties.P1xP1() sage: t = P1xP1.cohomology_ring().gen(0) sage: y = P1xP1.cohomology_ring().gen(2) @@ -3460,6 +3473,7 @@ def exp(self): EXAMPLES:: + sage: # needs sage.libs.singular sage: P2 = toric_varieties.P2() sage: H_class = P2.cohomology_ring().gen(0) sage: H_class diff --git a/src/sage/schemes/toric/weierstrass_covering.py b/src/sage/schemes/toric/weierstrass_covering.py index 13e3c24b2c1..cc9caeeae4d 100644 --- a/src/sage/schemes/toric/weierstrass_covering.py +++ b/src/sage/schemes/toric/weierstrass_covering.py @@ -351,7 +351,7 @@ def WeierstrassMap_P1xP1(polynomial, variables=None): sage: f, g = WeierstrassForm_P1xP1(biquadric, [x0, x1, y0, y1]); (f,g) (-625/48*a^4 + 25/3*a^2 - 16/3, 15625/864*a^6 - 625/36*a^4 - 100/9*a^2 + 128/27) sage: X, Y, Z = WeierstrassMap_P1xP1(biquadric, [x0, x1, y0, y1]) - sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(biquadric)) + sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(biquadric)) # needs sage.libs.singular 0 sage: R = PolynomialRing(QQ, 'x,y,s,t', order='lex') @@ -361,7 +361,7 @@ def WeierstrassMap_P1xP1(polynomial, variables=None): ....: + t^2*(7*x^2+8*x*y+9*y^2)) sage: X, Y, Z = WeierstrassMap_P1xP1(equation, [x,y,s,t]) sage: f, g = WeierstrassForm_P1xP1(equation, variables=[x,y,s,t]) - sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(equation)) + sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(equation)) # needs sage.libs.singular 0 sage: R = PolynomialRing(QQ, 'x,s', order='lex') @@ -370,7 +370,7 @@ def WeierstrassMap_P1xP1(polynomial, variables=None): sage: equation = s^2*(x^2+2*x+3) + s*(4*x^2+5*x+6) + (7*x^2+8*x+9) sage: X, Y, Z = WeierstrassMap_P1xP1(equation) sage: f, g = WeierstrassForm_P1xP1(equation) - sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(equation)) + sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(equation)) # needs sage.libs.singular 0 """ x, y, s, t = _check_polynomial_P1xP1(polynomial, variables) @@ -425,7 +425,7 @@ def WeierstrassMap_P2_112(polynomial, variables=None): sage: equation = y^2 + a0*x^4 + 4*a1*x^3 + 6*a2*x^2 + 4*a3*x + a4 sage: X, Y, Z = WeierstrassMap_P2_112(equation, [x,y]) sage: f, g = WeierstrassForm_P2_112(equation, variables=[x,y]) - sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(equation)) + sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(equation)) # needs sage.libs.singular 0 Another example, this time in homogeneous coordinates:: @@ -441,7 +441,7 @@ def WeierstrassMap_P2_112(polynomial, variables=None): sage: WeierstrassForm_P2_112(C_eqn, [x,y,z,t]) (-97/48, 17/864) sage: X, Y, Z = WeierstrassMap_P2_112(C_eqn, [x,y,z,t]) - sage: (-Y^2 + X^3 - 97/48*X*Z^4 + 17/864*Z^6).reduce(C.defining_ideal()) + sage: (-Y^2 + X^3 - 97/48*X*Z^4 + 17/864*Z^6).reduce(C.defining_ideal()) # needs sage.libs.singular 0 """ x, y, z, t = _check_polynomial_P2_112(polynomial, variables) From 3538edec2b86e5c29d50f9c0c63dadce71f01a37 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 23 Sep 2023 13:23:11 -0700 Subject: [PATCH 20/32] projective_morphism.py, projective_ds.py: Test for QQbar using sage.rings.abc --- .../dynamics/arithmetic_dynamics/projective_ds.py | 15 +++++++-------- .../schemes/projective/projective_morphism.py | 8 +++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index 30d7b3c229f..00675082bff 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -115,7 +115,6 @@ class initialization directly. lazy_import('sage.rings.algebraic_closure_finite_field', 'AlgebraicClosureFiniteField_generic') lazy_import('sage.rings.number_field.number_field_ideal', 'NumberFieldFractionalIdeal') lazy_import('sage.rings.padics.factory', 'Qp') -lazy_import('sage.rings.qqbar', ['QQbar', 'number_field_elements_from_algebraics']) try: from sage.libs.pari.all import PariError @@ -1274,7 +1273,7 @@ def arakelov_zhang_pairing(self, g, **kwds): if not self.is_endomorphism(): raise TypeError("Self must be an endomorphism.") - if R not in NumberFields() and R is not QQbar: + if R not in NumberFields() and not isinstance(R, sage.rings.abc.AlgebraicField) raise NotImplementedError("Only implemented for number fields.") f_iterate_map = self.nth_iterate_map(n) @@ -2280,7 +2279,7 @@ def canonical_height(self, P, **kwds): K = FractionField(self.codomain().base_ring()) if K not in NumberFields(): - if K is not QQbar: + if not isinstance(K, sage.rings.abc.AlgebraicField): raise NotImplementedError("must be over a number field or a number field order or QQbar") else: #since this an absolute height, we can compute the height of a QQbar point @@ -2794,7 +2793,7 @@ def nth_preimage_tree(self, Q, n, **kwds): if self.domain().dimension_relative() > 1: raise NotImplementedError("only implemented for dimension 1") base_ring = self.base_ring() - if base_ring is QQbar: + if isinstance(base_ring, sage.rings.abc.AlgebraicField): if numerical: raise ValueError("can't solve numerically over QQbar, no embedding into CC") fbar = self @@ -4605,7 +4604,7 @@ def preperiodic_points(self, m, n, **kwds): if return_scheme: # this includes the indeterminacy locus points! return X if X.dimension() <= 0: - if R in NumberFields() or R is QQbar or R in FiniteFields(): + if R in NumberFields() or isinstance(R, sage.rings.abc.AlgebraicField) or R in FiniteFields(): Z = f.base_indeterminacy_locus() points = [dom(Q) for Q in X.rational_points()] good_points = [] @@ -4951,7 +4950,7 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari if return_scheme: # this includes the indeterminacy locus points! return X if X.change_ring(FF).dimension() <= 0: - if R in NumberFields() or R is QQbar or R in FiniteFields(): + if R in NumberFields() or isinstance(R, sage.rings.abc.AlgebraicField) or R in FiniteFields(): Z = f.base_indeterminacy_locus() points = [dom(Q) for Q in X.rational_points()] good_points = [] @@ -5220,7 +5219,7 @@ def multiplier_spectra(self, n, formal=False, type='point', use_algebraic_closur # if we are already using an algebraic closure, we move the # map into a finite extension and set use_algebraic_closure to True # in order to get a scheme defined over a finite extension - if K is QQbar or isinstance(K, AlgebraicClosureFiniteField_generic): + if isinstance(K, sage.rings.abc.AlgebraicField) or isinstance(K, AlgebraicClosureFiniteField_generic): f = self.reduce_base_field() K = f.base_ring() use_algebraic_closure = True @@ -8142,7 +8141,7 @@ def is_conjugate(self, other, R=None, num_cpus=2): else: f = self.change_ring(R) g = other.change_ring(R) - if not (R in NumberFields() or R is QQbar or R in FiniteFields()): + if not (R in NumberFields() or isinstance(R, sage.rings.abc.AlgebraicField) or R in FiniteFields()): raise NotImplementedError("ring must be a number field or finite field") try: f.normalize_coordinates() diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index c4c3c96299c..697a108b770 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -66,6 +66,7 @@ from sage.misc.misc_c import prod from sage.misc.cachefunc import cached_method from sage.misc.lazy_attribute import lazy_attribute +from sage.misc.lazy_import import lazy_import from sage.ext.fast_callable import fast_callable from sage.calculus.functions import jacobian import sage.rings.abc @@ -77,7 +78,6 @@ from sage.rings.integer_ring import ZZ from sage.rings.number_field.order import is_NumberFieldOrder from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing -from sage.rings.qqbar import QQbar, number_field_elements_from_algebraics from sage.rings.quotient_ring import QuotientRing_generic from sage.rings.rational_field import QQ from sage.modules.free_module_element import vector @@ -88,6 +88,8 @@ from sage.categories.homset import Hom, End from sage.categories.fields import Fields +lazy_import('sage.rings.qqbar', 'number_field_elements_from_algebraics') + _NumberFields = NumberFields() _FiniteFields = FiniteFields() _Fields = Fields() @@ -1404,7 +1406,7 @@ def global_height(self, prec=None): K = self.domain().base_ring() if K in _NumberFields or is_NumberFieldOrder(K): f = self - elif K is QQbar: + elif isinstance(K, sage.rings.abc.AlgebraicField): f = self._number_field_from_algebraics() else: raise TypeError("Must be over a Numberfield or a Numberfield Order or QQbar") @@ -2144,7 +2146,7 @@ def reduce_base_field(self): (x^2 + y^2 : y^2) """ K = self.base_ring() - if K in NumberFields() or K is QQbar: + if K in NumberFields() or isinstance(K, sage.rings.abc.AlgebraicField): return self._number_field_from_algebraics() if K in FiniteFields(): #find the degree of the extension containing the coefficients From 3e7447625abcb9512c0bd7e3e2c52a2a59990134 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 4 Jun 2023 23:28:24 -0700 Subject: [PATCH 21/32] sage.schemes: Modularization fixes --- src/sage/schemes/generic/homset.py | 21 ++++++++++--------- .../schemes/product_projective/morphism.py | 9 ++++---- src/sage/schemes/product_projective/point.py | 7 ++++--- .../product_projective/rational_point.py | 5 +++-- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/sage/schemes/generic/homset.py b/src/sage/schemes/generic/homset.py index 904a30d4e59..60e840619ac 100644 --- a/src/sage/schemes/generic/homset.py +++ b/src/sage/schemes/generic/homset.py @@ -36,6 +36,7 @@ # ***************************************************************************** from sage.categories.homset import HomsetWithBase +from sage.misc.lazy_import import lazy_import from sage.structure.factory import UniqueFactory from sage.structure.parent import Set_generic @@ -49,6 +50,11 @@ SchemeMorphism_structure_map, SchemeMorphism_spec ) +lazy_import('sage.schemes.affine.affine_space', 'AffineSpace_generic', as_='AffineSpace') +lazy_import('sage.schemes.generic.algebraic_scheme', 'AlgebraicScheme_subscheme') +lazy_import('sage.schemes.product_projective.space', 'ProductProjectiveSpaces_ring', as_='ProductProjectiveSpaces') +lazy_import('sage.schemes.projective.projective_space', 'ProjectiveSpace_ring', as_='ProjectiveSpace') + def is_SchemeHomset(H): r""" @@ -568,9 +574,8 @@ def _coerce_map_from_(self, other): # and the base rings are coercible if isinstance(other, CommutativeRing): try: - from sage.schemes.affine.affine_space import is_AffineSpace - if is_AffineSpace(target.ambient_space())\ - and target.ambient_space().dimension_relative() == 1: + if (isinstance(target.ambient_space(), AffineSpace) + and target.ambient_space().dimension_relative() == 1): return target.base_ring().has_coerce_map_from(other) else: return False @@ -578,7 +583,6 @@ def _coerce_map_from_(self, other): return False elif isinstance(other, SchemeHomset_points): #we are converting between scheme points - from sage.schemes.generic.algebraic_scheme import AlgebraicScheme_subscheme source = other.codomain() if isinstance(target, AlgebraicScheme_subscheme): #subscheme coerce when there is containment @@ -592,9 +596,6 @@ def _coerce_map_from_(self, other): #if the target is an ambient space, we can coerce if the base rings coerce #and they are the same type: affine, projective, etc and have the same #variable names - from sage.schemes.projective.projective_space import is_ProjectiveSpace - from sage.schemes.affine.affine_space import is_AffineSpace - from sage.schemes.product_projective.space import is_ProductProjectiveSpaces try: ta = target.ambient_space() sa = source.ambient_space() @@ -602,15 +603,15 @@ def _coerce_map_from_(self, other): return False #for projective and affine varieties, we check dimension #and matching variable names - if (is_ProjectiveSpace(ta) and is_ProjectiveSpace(sa))\ - or (is_AffineSpace(ta) and is_AffineSpace(sa)): + if ((isinstance(ta, ProjectiveSpace) and isinstance(sa, ProjectiveSpace)) + or (isinstance(ta, AffineSpace) and isinstance(sa, AffineSpace))): if (ta.variable_names() == sa.variable_names()): return self.domain().coordinate_ring().has_coerce_map_from(other.domain().coordinate_ring()) else: return False #for products of projective spaces, we check dimension of #components and matching variable names - elif (is_ProductProjectiveSpaces(ta) and is_ProductProjectiveSpaces(sa)): + elif isinstance(ta, ProductProjectiveSpaces) and isinstance(sa, ProductProjectiveSpaces): if (ta.dimension_relative_components() == sa.dimension_relative_components()) \ and (ta.variable_names() == sa.variable_names()): return self.domain().coordinate_ring().has_coerce_map_from(other.domain().coordinate_ring()) diff --git a/src/sage/schemes/product_projective/morphism.py b/src/sage/schemes/product_projective/morphism.py index 74b424022a2..3524dbdb508 100644 --- a/src/sage/schemes/product_projective/morphism.py +++ b/src/sage/schemes/product_projective/morphism.py @@ -19,12 +19,13 @@ # the License, or (at your option) any later version. # https://www.gnu.org/licenses/ # **************************************************************************** + +import sage.rings.abc + from sage.schemes.generic.morphism import SchemeMorphism_polynomial from sage.categories.fields import Fields from sage.categories.number_fields import NumberFields -from sage.rings.number_field.order import is_NumberFieldOrder from sage.rings.fraction_field import FractionField -from sage.rings.qqbar import QQbar _Fields = Fields() @@ -460,14 +461,14 @@ def global_height(self, prec=None): 2.56494935746154 """ K = self.domain().base_ring() - if K in NumberFields() or is_NumberFieldOrder(K): + if K in NumberFields() or K == ZZ or isinstance(K, sage.rings.abc.Order): H = 0 for i in range(self.domain().ambient_space().ngens()): C = self[i].coefficients() h = max(c.global_height(prec=prec) for c in C) H = max(H, h) return H - elif K == QQbar: + elif isinstance(K, sage.rings.abc.AlgebraicField): raise NotImplementedError("not implemented for QQbar") else: raise TypeError("Must be over a Numberfield or a Numberfield Order or QQbar") diff --git a/src/sage/schemes/product_projective/point.py b/src/sage/schemes/product_projective/point.py index b9430804695..34e6804910b 100644 --- a/src/sage/schemes/product_projective/point.py +++ b/src/sage/schemes/product_projective/point.py @@ -21,11 +21,12 @@ # https://www.gnu.org/licenses/ # **************************************************************************** from copy import copy + +import sage.rings.abc + from sage.categories.integral_domains import IntegralDomains from sage.categories.number_fields import NumberFields from sage.rings.fraction_field import FractionField -from sage.rings.number_field.order import is_NumberFieldOrder -from sage.rings.qqbar import QQbar from sage.schemes.generic.morphism import SchemeMorphism from sage.schemes.generic.morphism import SchemeMorphism_point from sage.structure.sequence import Sequence @@ -466,7 +467,7 @@ def global_height(self, prec=None): 0.536479304144700 """ K = self.codomain().base_ring() - if K not in NumberFields() and not is_NumberFieldOrder(K) and K != QQbar: + if K not in NumberFields() and K != ZZ and not isinstance(K, (sage.rings.abc.Order, sage.rings.abc.AlgebraicField)): raise TypeError("must be over a number field or a number field order or QQbar") n = self.codomain().ambient_space().num_components() diff --git a/src/sage/schemes/product_projective/rational_point.py b/src/sage/schemes/product_projective/rational_point.py index 5375ffb4535..e31e31c00a6 100644 --- a/src/sage/schemes/product_projective/rational_point.py +++ b/src/sage/schemes/product_projective/rational_point.py @@ -61,11 +61,12 @@ from sage.misc.misc_c import prod from sage.arith.misc import next_prime, previous_prime, crt from sage.rings.integer_ring import ZZ -from sage.rings.real_mpfr import RR from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF from sage.parallel.ncpus import ncpus from sage.parallel.use_fork import p_iter_fork -from sage.matrix.constructor import matrix + +lazy_import('sage.matrix.constructor', 'matrix') +lazy_import('sage.rings.real_mpfr', 'RR') def enum_product_projective_rational_field(X, B): From 23fecb1665fffd9555db4b69104d7673c5de52cd Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Mar 2023 14:38:08 -0700 Subject: [PATCH 22/32] sage.schemes: Modularization fixes for imports --- src/sage/schemes/affine/affine_morphism.py | 11 ++++--- src/sage/schemes/affine/affine_point.py | 9 +++--- src/sage/schemes/affine/affine_space.py | 8 +++-- src/sage/schemes/generic/algebraic_scheme.py | 11 ++++--- .../schemes/projective/projective_morphism.py | 32 +++++++++++-------- 5 files changed, 39 insertions(+), 32 deletions(-) diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index 1fc3f207464..33536eda52f 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -48,6 +48,8 @@ import sys +import sage.rings.abc + from sage.calculus.functions import jacobian from sage.categories.homset import Hom, End @@ -68,10 +70,7 @@ from sage.schemes.generic.morphism import SchemeMorphism_polynomial -from sage.ext.fast_callable import fast_callable - from sage.categories.number_fields import NumberFields -from sage.rings.number_field.order import is_NumberFieldOrder _NumberFields = NumberFields() _Fields = Fields() @@ -361,6 +360,8 @@ def _fastpolys(self): 1), ('load_arg', ...), ('ipow', 1), 'mul', 'add', ('load_const', 1), 'add', 'return']] """ + from sage.ext.fast_callable import fast_callable + polys = self._polys R = self.domain().ambient_space().coordinate_ring() @@ -800,7 +801,7 @@ def local_height(self, v, prec=None): 1.09861228866811 """ K = FractionField(self.domain().base_ring()) - if K not in _NumberFields or is_NumberFieldOrder(K): + if not (K not in _NumberFields or K == ZZ or isinstance(K, sage.rings.abc.Order)): raise TypeError("must be over a number field or a number field order") return max([K(c).local_height(v, prec=prec) for f in self for c in f.coefficients()]) @@ -848,7 +849,7 @@ def local_height_arch(self, i, prec=None): 0.6931471805599453094172321214582 """ K = FractionField(self.domain().base_ring()) - if K not in _NumberFields or is_NumberFieldOrder(K): + if not (K not in _NumberFields or K == ZZ or isinstance(K, sage.rings.abc.Order)): raise TypeError("must be over a number field or a number field order") if K == QQ: diff --git a/src/sage/schemes/affine/affine_point.py b/src/sage/schemes/affine/affine_point.py index a665ba6881a..dabcaa134f9 100644 --- a/src/sage/schemes/affine/affine_point.py +++ b/src/sage/schemes/affine/affine_point.py @@ -31,9 +31,7 @@ from sage.categories.number_fields import NumberFields from sage.rings.integer_ring import ZZ -from sage.rings.number_field.order import is_NumberFieldOrder -from sage.rings.real_mpfr import RealField -from sage.schemes.generic.morphism import (SchemeMorphism_point, SchemeMorphism, is_SchemeMorphism) +from sage.schemes.generic.morphism import SchemeMorphism_point, SchemeMorphism, is_SchemeMorphism from sage.structure.sequence import Sequence _NumberFields = NumberFields() @@ -206,13 +204,14 @@ def global_height(self, prec=None): P-adic heights. """ if self.domain().base_ring() == ZZ: + from sage.rings.real_mpfr import RealField if prec is None: R = RealField() else: R = RealField(prec) H = max([self[i].abs() for i in range(self.codomain().ambient_space().dimension_relative())]) - return R(max(H, 1)).log() - if self.domain().base_ring() in _NumberFields or is_NumberFieldOrder(self.domain().base_ring()): + return R(max(H,1)).log() + if self.domain().base_ring() in _NumberFields or isinstance(self.domain().base_ring(), sage.rings.abc.Order): return max([self[i].global_height(prec) for i in range(self.codomain().ambient_space().dimension_relative())]) else: raise NotImplementedError("must be over a number field or a number field Order") diff --git a/src/sage/schemes/affine/affine_space.py b/src/sage/schemes/affine/affine_space.py index 2680982c232..f4483fd0f78 100644 --- a/src/sage/schemes/affine/affine_space.py +++ b/src/sage/schemes/affine/affine_space.py @@ -10,7 +10,6 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.functions.orthogonal_polys import chebyshev_T, chebyshev_U from sage.rings.integer import Integer from sage.rings.integer_ring import ZZ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing @@ -23,7 +22,6 @@ from sage.categories.number_fields import NumberFields from sage.misc.latex import latex from sage.misc.mrange import cartesian_product_iterator -from sage.matrix.constructor import matrix from sage.structure.category_object import normalize_names from sage.schemes.generic.scheme import AffineScheme from sage.schemes.generic.ambient_space import AmbientSpace @@ -938,9 +936,13 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): if self.dimension_relative() != 1: raise TypeError("affine space must be of dimension 1") n = ZZ(n) - if (n < 0): + if n < 0: raise ValueError("first parameter 'n' must be a non-negative integer") + from sage.dynamics.arithmetic_dynamics.affine_ds import DynamicalSystem_affine + from sage.functions.orthogonal_polys import chebyshev_T, chebyshev_U + from sage.matrix.constructor import matrix + if kind == 'first': if monic and self.base().characteristic() != 2: f = DynamicalSystem_affine([chebyshev_T(n, self.gen(0))], domain=self) diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index b84d5626584..56b0bbf0852 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -118,10 +118,8 @@ from sage.rings.ideal import is_Ideal from sage.rings.integer_ring import ZZ -from sage.rings.qqbar import QQbar from sage.rings.rational_field import is_RationalField from sage.rings.finite_rings.finite_field_base import FiniteField -from sage.rings.number_field.order import is_NumberFieldOrder from sage.misc.latex import latex from sage.misc.misc import is_iterator @@ -129,8 +127,6 @@ from sage.structure.all import Sequence from sage.structure.richcmp import richcmp, richcmp_method -from sage.calculus.functions import jacobian - from sage.arith.functions import lcm from sage.arith.misc import gcd @@ -1125,7 +1121,9 @@ def normalize_defining_polynomials(self): """ BR = self.base_ring() - if BR == QQbar or BR in NumberFields() or is_NumberFieldOrder(BR): + if (BR == ZZ + or isinstance(BR, (sage.rings.abc.AlgebraicField, sage.rings.abc.Order)) + or BR in NumberFields()): normalized_polys = [] initial_polys = list(self.__polys) @@ -1334,6 +1332,9 @@ def Jacobian_matrix(self): l = self.defining_polynomials() if len(l) == 0: return sage.matrix.constructor.Matrix(R, 0) + + from sage.calculus.functions import jacobian + return jacobian(l, R.gens()) def Jacobian(self): diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 697a108b770..4a1a7f19b35 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -62,34 +62,24 @@ import sys from sage.arith.misc import GCD as gcd from sage.arith.functions import lcm -from sage.interfaces.singular import singular from sage.misc.misc_c import prod from sage.misc.cachefunc import cached_method from sage.misc.lazy_attribute import lazy_attribute -from sage.misc.lazy_import import lazy_import -from sage.ext.fast_callable import fast_callable -from sage.calculus.functions import jacobian import sage.rings.abc from sage.rings.integer import Integer from sage.rings.algebraic_closure_finite_field import AlgebraicClosureFiniteField_generic from sage.rings.finite_rings.finite_field_base import FiniteField -from sage.rings.finite_rings.finite_field_constructor import GF from sage.rings.fraction_field import FractionField from sage.rings.integer_ring import ZZ -from sage.rings.number_field.order import is_NumberFieldOrder from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.quotient_ring import QuotientRing_generic from sage.rings.rational_field import QQ -from sage.modules.free_module_element import vector -from sage.matrix.constructor import matrix from sage.schemes.generic.morphism import SchemeMorphism_polynomial from sage.categories.finite_fields import FiniteFields from sage.categories.number_fields import NumberFields from sage.categories.homset import Hom, End from sage.categories.fields import Fields -lazy_import('sage.rings.qqbar', 'number_field_elements_from_algebraics') - _NumberFields = NumberFields() _FiniteFields = FiniteFields() _Fields = Fields() @@ -432,6 +422,8 @@ def _fastpolys(self): [[('load_const', 0), ('load_const', 1), ('load_arg', ...), ('ipow', 2), 'mul', 'add', ('load_const', 1), ('load_arg', ...), ('ipow', 2), 'mul', 'add', 'return'], [('load_const', 0), ('load_const', 1), ('load_arg', 1), ('ipow', 2), 'mul', 'add', 'return']] """ + from sage.ext.fast_callable import fast_callable + polys = self._polys fastpolys = [] @@ -629,6 +621,7 @@ def _matrix_times_polymap_(self, mat, h): """ from sage.modules.free_module_element import vector from sage.dynamics.arithmetic_dynamics.generic_ds import DynamicalSystem + if not mat.is_square(): raise ValueError("matrix must be square") if mat.ncols() != self.codomain().ngens(): @@ -1404,7 +1397,7 @@ def global_height(self, prec=None): 6.43775164973640 """ K = self.domain().base_ring() - if K in _NumberFields or is_NumberFieldOrder(K): + if K in _NumberFields or K == ZZ or isinstance(K, sage.rings.abc.Order): f = self elif isinstance(K, sage.rings.abc.AlgebraicField): f = self._number_field_from_algebraics() @@ -1474,7 +1467,7 @@ def local_height(self, v, prec=None): 1.09861228866811 """ K = FractionField(self.domain().base_ring()) - if K not in _NumberFields or is_NumberFieldOrder(K): + if not (K not in _NumberFields or K == ZZ or isinstance(K, sage.rings.abc.Order)): raise TypeError("must be over a number field or a number field order") return max([K(c).local_height(v, prec=prec) for f in self for c in f.coefficients()]) @@ -1522,7 +1515,7 @@ def local_height_arch(self, i, prec=None): 0.6931471805599453094172321214582 """ K = FractionField(self.domain().base_ring()) - if K not in _NumberFields or is_NumberFieldOrder(K): + if not (K not in _NumberFields or isinstance(K, sage.rings.abc.Order)): raise TypeError("must be over a number field or a number field order") if K == QQ: return max([K(c).local_height_arch(prec=prec) for f in self for c in f.coefficients()]) @@ -1561,6 +1554,8 @@ def wronskian_ideal(self): Ideal (4*x*y, 2*x^2 + 4*y^2, -2*y^2) of Multivariate Polynomial Ring in x, y over Rational Field """ + from sage.calculus.functions import jacobian + dom = self.domain() from sage.schemes.projective.projective_space import is_ProjectiveSpace if not (is_ProjectiveSpace(dom) and is_ProjectiveSpace(self.codomain())): @@ -1801,7 +1796,9 @@ def _number_field_from_algebraics(self): Defn: Defined on coordinates by sending (x : y) to ((-0.6823278038280193?)*x^3 + (-13)*y^3 : (-14)*y^3) """ + from sage.rings.qqbar import number_field_elements_from_algebraics from sage.schemes.projective.projective_space import is_ProjectiveSpace + if not (is_ProjectiveSpace(self.domain()) and is_ProjectiveSpace(self.domain())): raise NotImplementedError("not implemented for subschemes") @@ -1811,7 +1808,7 @@ def _number_field_from_algebraics(self): if K_pre is QQ: if K_pre is self.base_ring(): return self - elif self.base_ring() != QQbar and K_pre.is_isomorphic(self.base_ring()): + elif not isinstance(self.base_ring(), sage.rings.abc.AlgebraicField) and K_pre.is_isomorphic(self.base_ring()): return self # Issue 23808: The field K_pre returned above does not have its embedding set to be phi # and phi is forgotten, so we redefine K_pre to be a field K with phi as the specified @@ -2153,6 +2150,8 @@ def reduce_base_field(self): c = [v for g in self for v in g.coefficients()] d = lcm([a.minpoly().degree() for a in c]) if d == 1: + from sage.rings.finite_rings.finite_field_constructor import GF + return self.change_ring(GF(K.characteristic())) if d == K.degree(): return self @@ -2372,6 +2371,8 @@ def __eq__(self, other): e = Y.projective_embedding(0) return (e * self) == (e * other) + from sage.matrix.constructor import matrix + R = self.domain().coordinate_ring() mat = matrix([self.defining_polynomials(), other.defining_polynomials()]) return all(R(minor).is_zero() for minor in mat.minors(2)) @@ -2479,6 +2480,7 @@ def representatives(self): raise ValueError("domain is not an irreducible scheme") # prepare homogeneous coordinate ring of X in Singular + from sage.interfaces.singular import singular from sage.rings.polynomial.term_order import TermOrder T = TermOrder('degrevlex') T._singular_ringorder_column = 1 # (c,dp) in Singular @@ -2778,6 +2780,8 @@ def projective_degrees(self): G = self.graph() I = G.defining_ideal() # a bihomogeneous ideal + from sage.modules.free_module_element import vector + degrees = xn * [vector([1, 0])] + yn * [vector([0, 1])] res = I.graded_free_resolution(degrees=degrees, algorithm='shreyer') kpoly = res.K_polynomial() From 67b279f76eb5a8355a45a328ad3cd1eac98e9c6d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 23 Sep 2023 13:46:09 -0700 Subject: [PATCH 23/32] sage.schemes, sage.dynamics.arithmetic_dynamics: Modularization fixes --- src/sage/dynamics/arithmetic_dynamics/projective_ds.py | 5 +++-- src/sage/schemes/curves/affine_curve.py | 10 ++++++++-- src/sage/schemes/generic/algebraic_scheme.py | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index 00675082bff..9bbd1723571 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -1273,7 +1273,7 @@ def arakelov_zhang_pairing(self, g, **kwds): if not self.is_endomorphism(): raise TypeError("Self must be an endomorphism.") - if R not in NumberFields() and not isinstance(R, sage.rings.abc.AlgebraicField) + if R not in NumberFields() and not isinstance(R, sage.rings.abc.AlgebraicField): raise NotImplementedError("Only implemented for number fields.") f_iterate_map = self.nth_iterate_map(n) @@ -2458,7 +2458,7 @@ def height_difference_bound(self, prec=None): """ FF = FractionField(self.domain().base_ring()) #lift will only work over fields, so coercing into FF if FF not in NumberFields(): - if FF == QQbar: + if isinstance(FF, sage.rings.abc.AlgebraicField): #since this is absolute height, we can choose any number field over which the #function is defined. f = self._number_field_from_algebraics() @@ -8841,6 +8841,7 @@ def is_newton(self, return_conjugation=False): return False, None else: return False + from sage.rings.qqbar import QQbar Fbar = self.change_ring(QQbar) Pbar = Fbar.domain() fixed = Fbar.periodic_points(1) diff --git a/src/sage/schemes/curves/affine_curve.py b/src/sage/schemes/curves/affine_curve.py index 326c0d86e77..ce8c0ff0655 100644 --- a/src/sage/schemes/curves/affine_curve.py +++ b/src/sage/schemes/curves/affine_curve.py @@ -125,6 +125,8 @@ # https://www.gnu.org/licenses/ # **************************************************************************** +import sage.rings.abc + from sage.misc.lazy_attribute import lazy_attribute from sage.misc.cachefunc import cached_method @@ -139,10 +141,11 @@ from sage.matrix.constructor import matrix +from sage.misc.lazy_import import lazy_import + from sage.rings.polynomial.multi_polynomial_element import degree_lowest_rational_function from sage.rings.number_field.number_field import NumberField from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing -from sage.rings.qqbar import number_field_elements_from_algebraics, QQbar from sage.rings.rational_field import is_RationalField from sage.rings.infinity import infinity @@ -162,6 +165,8 @@ from .closed_point import IntegralAffineCurveClosedPoint +lazy_import('sage.rings.qqbar', 'number_field_elements_from_algebraics') + class AffineCurve(Curve_generic, AlgebraicScheme_subscheme_affine): """ @@ -671,7 +676,7 @@ def tangents(self, P, factor=True): T = sum([binomial(r, i)*deriv[i]*(vars[0])**i*(vars[1])**(r-i) for i in range(r+1)]) if not factor: return [T(coords)] - if self.base_ring() == QQbar: + if isinstance(self.base_ring(), sage.rings.abc.AlgebraicField): fact = [] # first add tangents corresponding to vars[0], vars[1] if they divide T t = min([e[0] for e in T.exponents()]) @@ -1534,6 +1539,7 @@ def resolution_of_singularities(self, extend=False): def extension(self): F = self.base_ring() + from sage.rings.qqbar import QQbar pts = self.change_ring(F.embeddings(QQbar)[0]).rational_points() L = [t for pt in pts for t in pt] K = number_field_elements_from_algebraics(L)[0] diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index 56b0bbf0852..e030371f70e 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -113,6 +113,7 @@ # https://www.gnu.org/licenses/ # **************************************************************************** +import sage.rings.abc from sage.categories.number_fields import NumberFields From dce871a116a41e25ef60b7eeecb9b850c9616dde Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 13 May 2023 18:54:18 -0700 Subject: [PATCH 24/32] sage.{rings,schemes}: Simplify some tests for number fields --- .../rings/polynomial/multi_polynomial_element.py | 4 ++-- src/sage/rings/polynomial/polynomial_element.pyx | 13 +++++-------- src/sage/schemes/affine/affine_morphism.py | 4 ++-- src/sage/schemes/projective/projective_morphism.py | 4 ++-- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/sage/rings/polynomial/multi_polynomial_element.py b/src/sage/rings/polynomial/multi_polynomial_element.py index 0c510df8d59..d4e2b115e39 100644 --- a/src/sage/rings/polynomial/multi_polynomial_element.py +++ b/src/sage/rings/polynomial/multi_polynomial_element.py @@ -1150,7 +1150,7 @@ def local_height(self, v, prec=None): prec = 53 K = FractionField(self.base_ring()) - if not (K in NumberFields() or isinstance(K, (sage.rings.abc.Order, IntegerRing_class))): + if K not in NumberFields(): raise TypeError("must be over a Numberfield or a Numberfield order") return max([K(c).local_height(v, prec=prec) for c in self.coefficients()]) @@ -1199,7 +1199,7 @@ def local_height_arch(self, i, prec=None): prec = 53 K = FractionField(self.base_ring()) - if not (K in NumberFields() or isinstance(K, (sage.rings.abc.Order, IntegerRing_class))): + if K not in NumberFields(): return TypeError("must be over a Numberfield or a Numberfield Order") if K == QQ: diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index c5a1129aecf..ec88e323c02 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -5448,15 +5448,12 @@ cdef class Polynomial(CommutativePolynomial): if self.degree() <= 1: return R.fraction_field() - from sage.rings.number_field.number_field import is_NumberField, NumberField - if is_IntegerRing(R): from sage.rings.number_field.number_field import NumberField return NumberField(self, names) from sage.rings.number_field.number_field_base import NumberField as NumberField_base - - if sage.rings.rational_field.is_RationalField(R) or isinstance(R, NumberField_base): + if isinstance(R, NumberField_base): from sage.rings.number_field.number_field import NumberField return NumberField(self, names) @@ -6022,14 +6019,14 @@ cdef class Polynomial(CommutativePolynomial): K = self.base_ring() if K in NumberFields() or isinstance(K, sage.rings.abc.Order) or is_IntegerRing(K): from sage.schemes.projective.projective_space import ProjectiveSpace - P = ProjectiveSpace(K, self.number_of_terms()-1) + P = ProjectiveSpace(K, self.number_of_terms() - 1) return P.point(self.coefficients()).global_height(prec=prec) elif isinstance(K, sage.rings.abc.AlgebraicField): from sage.rings.qqbar import number_field_elements_from_algebraics from sage.schemes.projective.projective_space import ProjectiveSpace K_pre, P, phi = number_field_elements_from_algebraics(self.coefficients()) - Pr = ProjectiveSpace(K_pre, len(P)-1) + Pr = ProjectiveSpace(K_pre, len(P) - 1) return Pr.point(P).global_height(prec=prec) raise TypeError("Must be over a Numberfield or a Numberfield Order.") @@ -6078,7 +6075,7 @@ cdef class Polynomial(CommutativePolynomial): prec = 53 K = FractionField(self.base_ring()) - if not (K in NumberFields() or isinstance(K, sage.rings.abc.Order) or is_IntegerRing(K)): + if K not in NumberFields(): raise TypeError("must be over a Numberfield or a Numberfield order") return max([K(c).local_height(v, prec=prec) for c in self.coefficients()]) @@ -6127,7 +6124,7 @@ cdef class Polynomial(CommutativePolynomial): prec = 53 K = FractionField(self.base_ring()) - if not (K in NumberFields() or isinstance(K, sage.rings.abc.Order) or is_IntegerRing(K)): + if K not in NumberFields(): return TypeError("must be over a Numberfield or a Numberfield Order") if K == QQ: diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index 33536eda52f..7e855f78921 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -801,7 +801,7 @@ def local_height(self, v, prec=None): 1.09861228866811 """ K = FractionField(self.domain().base_ring()) - if not (K not in _NumberFields or K == ZZ or isinstance(K, sage.rings.abc.Order)): + if K not in _NumberFields: raise TypeError("must be over a number field or a number field order") return max([K(c).local_height(v, prec=prec) for f in self for c in f.coefficients()]) @@ -849,7 +849,7 @@ def local_height_arch(self, i, prec=None): 0.6931471805599453094172321214582 """ K = FractionField(self.domain().base_ring()) - if not (K not in _NumberFields or K == ZZ or isinstance(K, sage.rings.abc.Order)): + if K not in _NumberFields: raise TypeError("must be over a number field or a number field order") if K == QQ: diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 4a1a7f19b35..8de12ccf4a5 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -1467,7 +1467,7 @@ def local_height(self, v, prec=None): 1.09861228866811 """ K = FractionField(self.domain().base_ring()) - if not (K not in _NumberFields or K == ZZ or isinstance(K, sage.rings.abc.Order)): + if K not in _NumberFields: raise TypeError("must be over a number field or a number field order") return max([K(c).local_height(v, prec=prec) for f in self for c in f.coefficients()]) @@ -1515,7 +1515,7 @@ def local_height_arch(self, i, prec=None): 0.6931471805599453094172321214582 """ K = FractionField(self.domain().base_ring()) - if not (K not in _NumberFields or isinstance(K, sage.rings.abc.Order)): + if K not in _NumberFields: raise TypeError("must be over a number field or a number field order") if K == QQ: return max([K(c).local_height_arch(prec=prec) for f in self for c in f.coefficients()]) From d78e78a109aef34241469ae34c3e23dac42e4889 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 23 Sep 2023 14:21:29 -0700 Subject: [PATCH 25/32] sage.schemes, sage.dynamics.arithmetic_dynamics: Modularization fixes --- .../dynamics/arithmetic_dynamics/projective_ds.py | 14 +++++++++----- src/sage/schemes/product_projective/morphism.py | 4 +++- src/sage/schemes/product_projective/point.py | 1 + .../schemes/product_projective/rational_point.py | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index 9bbd1723571..d75972f812d 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -115,6 +115,7 @@ class initialization directly. lazy_import('sage.rings.algebraic_closure_finite_field', 'AlgebraicClosureFiniteField_generic') lazy_import('sage.rings.number_field.number_field_ideal', 'NumberFieldFractionalIdeal') lazy_import('sage.rings.padics.factory', 'Qp') +lazy_import('sage.rings.qqbar', 'number_field_elements_from_algebraics') try: from sage.libs.pari.all import PariError @@ -763,15 +764,17 @@ def dynatomic_polynomial(self, period): We check that the dynatomic polynomial has the right parent (see :trac:`18409`):: - sage: P. = ProjectiveSpace(QQbar,1) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: P. = ProjectiveSpace(QQbar,1) sage: f = DynamicalSystem_projective([x^2 - 1/3*y^2, y^2]) sage: f.dynatomic_polynomial(2).parent() # needs sage.libs.pari Multivariate Polynomial Ring in x, y over Algebraic Field :: - sage: T. = QuadraticField(33) # needs sage.rings.number_field - sage: S. = PolynomialRing(T) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: T. = QuadraticField(33) + sage: S. = PolynomialRing(T) sage: P. = ProjectiveSpace(FractionField(S),1) sage: f = DynamicalSystem_projective([t*x^2 - 1/t*y^2, y^2]) sage: f.dynatomic_polynomial([1, 2]).parent() # needs sage.libs.pari @@ -4396,9 +4399,10 @@ def preperiodic_points(self, m, n, **kwds): :: + sage: # needs sage.rings.number_field sage: P. = ProjectiveSpace(QQ, 1) - sage: K. = QuadraticField(5) # needs sage.rings.number_field - sage: phi = QQ.embeddings(K)[0] # needs sage.rings.number_field + sage: K. = QuadraticField(5) + sage: phi = QQ.embeddings(K)[0] sage: f = DynamicalSystem_projective([x^2 - y^2, y^2]) sage: f.preperiodic_points(1, 1, R=phi) [(-1/2*v - 1/2 : 1), (1/2*v - 1/2 : 1)] diff --git a/src/sage/schemes/product_projective/morphism.py b/src/sage/schemes/product_projective/morphism.py index 3524dbdb508..d5b1974164b 100644 --- a/src/sage/schemes/product_projective/morphism.py +++ b/src/sage/schemes/product_projective/morphism.py @@ -22,10 +22,12 @@ import sage.rings.abc -from sage.schemes.generic.morphism import SchemeMorphism_polynomial from sage.categories.fields import Fields from sage.categories.number_fields import NumberFields from sage.rings.fraction_field import FractionField +from sage.rings.integer_ring import ZZ +from sage.schemes.generic.morphism import SchemeMorphism_polynomial + _Fields = Fields() diff --git a/src/sage/schemes/product_projective/point.py b/src/sage/schemes/product_projective/point.py index 34e6804910b..70cc344806f 100644 --- a/src/sage/schemes/product_projective/point.py +++ b/src/sage/schemes/product_projective/point.py @@ -27,6 +27,7 @@ from sage.categories.integral_domains import IntegralDomains from sage.categories.number_fields import NumberFields from sage.rings.fraction_field import FractionField +from sage.rings.integer_ring import ZZ from sage.schemes.generic.morphism import SchemeMorphism from sage.schemes.generic.morphism import SchemeMorphism_point from sage.structure.sequence import Sequence diff --git a/src/sage/schemes/product_projective/rational_point.py b/src/sage/schemes/product_projective/rational_point.py index e31e31c00a6..c9a2cf6b25f 100644 --- a/src/sage/schemes/product_projective/rational_point.py +++ b/src/sage/schemes/product_projective/rational_point.py @@ -57,6 +57,7 @@ from sage.schemes.generic.scheme import is_Scheme from sage.schemes.product_projective.space import is_ProductProjectiveSpaces +from sage.misc.lazy_import import lazy_import from sage.misc.mrange import xmrange from sage.misc.misc_c import prod from sage.arith.misc import next_prime, previous_prime, crt From b39df390e89ea0172b1d80a645fea924fae926eb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 23 Sep 2023 17:40:37 -0700 Subject: [PATCH 26/32] sage.schemes: Update # needs --- .../schemes/projective/projective_subscheme.py | 4 ++-- src/sage/schemes/toric/toric_subscheme.py | 2 +- src/sage/schemes/toric/variety.py | 14 +++++++------- src/sage/schemes/toric/weierstrass_higher.py | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index 6370bef6ad2..d31bfd5a2a7 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -1440,14 +1440,14 @@ def global_height(self, prec=None): sage: NF. = NumberField(x^2 - 5) sage: P. = ProjectiveSpace(NF, 2) sage: X = P.subscheme([x^2 + y*z, 2*y*z, 3*x*y]) - sage: X.global_height() + sage: X.global_height() # needs sage.libs.singular 0.000000000000000 :: sage: P. = ProjectiveSpace(QQ, 2) sage: X = P.subscheme([z^2 - 101*y^2 - 3*x*z]) - sage: X.global_height() # long time + sage: X.global_height() # long time # needs sage.libs.singular 4.61512051684126 """ return self.Chow_form().global_height(prec) diff --git a/src/sage/schemes/toric/toric_subscheme.py b/src/sage/schemes/toric/toric_subscheme.py index 770e459335e..6b3645d0e4a 100644 --- a/src/sage/schemes/toric/toric_subscheme.py +++ b/src/sage/schemes/toric/toric_subscheme.py @@ -270,7 +270,7 @@ def affine_algebraic_patch(self, cone=None, names=None): Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: z0^3 + z1^3 + 1 - sage: # needs fpylll + sage: # needs fpylll sage.libs.singular sage: cone = Cone([(0,1), (2,1)]) sage: A2Z2. = AffineToricVariety(cone) sage: A2Z2.affine_algebraic_patch() diff --git a/src/sage/schemes/toric/variety.py b/src/sage/schemes/toric/variety.py index 01064ffbc95..44e33505d44 100644 --- a/src/sage/schemes/toric/variety.py +++ b/src/sage/schemes/toric/variety.py @@ -232,7 +232,7 @@ (False, True) sage: HH = P4_11133.cohomology_ring(); HH Rational cohomology ring of a 4-d CPR-Fano toric variety covered by 5 affine patches - sage: P4_11133.cohomology_basis() + sage: P4_11133.cohomology_basis() # needs sage.libs.singular (([1],), ([z4],), ([z4^2],), ([z4^3],), ([z4^4],)) Every cone defines a torus orbit closure, and hence a (co)homology class:: @@ -2486,18 +2486,18 @@ def _semigroup_ring(self, cone=None, names=None): EXAMPLES:: sage: A2Z2 = Cone([(0,1), (2,1)]) - sage: AffineToricVariety(A2Z2)._semigroup_ring() # needs fpylll + sage: AffineToricVariety(A2Z2)._semigroup_ring() # needs fpylll sage.libs.singular (Multivariate Polynomial Ring in z0, z1, z2 over Rational Field, Ideal (-z0*z1 + z2^2) of Multivariate Polynomial Ring in z0, z1, z2 over Rational Field, 2-d cone in 2-d lattice M) sage: P2 = toric_varieties.P2() sage: cone = P2.fan().generating_cone(0) - sage: P2._semigroup_ring(cone) # needs fpylll + sage: P2._semigroup_ring(cone) # needs fpylll sage.libs.singular (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 fpylll + sage: P2.change_ring(GF(101))._semigroup_ring(cone) # needs fpylll sage.libs.singular (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) @@ -2567,7 +2567,7 @@ def Spec(self, cone=None, names=None): A more interesting example:: sage: A2Z2 = Cone([(0,1), (2,1)]) - sage: AffineToricVariety(A2Z2).Spec(names='u,v,t') # needs fpylll + sage: AffineToricVariety(A2Z2).Spec(names='u,v,t') # needs fpylll sage.libs.singular Spectrum of Quotient of Multivariate Polynomial Ring in u, v, t over Rational Field by the ideal (-u*v + t^2) """ @@ -2601,10 +2601,10 @@ def affine_algebraic_patch(self, cone=None, names=None): sage: cone = Cone([(0,1), (2,1)]) sage: A2Z2 = AffineToricVariety(cone) - sage: A2Z2.affine_algebraic_patch() # needs fpylll + sage: A2Z2.affine_algebraic_patch() # needs fpylll sage.libs.singular Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: -z0*z1 + z2^2 - sage: A2Z2.affine_algebraic_patch(Cone([(0,1)]), names='x, y, t') # needs fpylll + sage: A2Z2.affine_algebraic_patch(Cone([(0,1)]), names='x, y, t') # needs fpylll sage.libs.singular Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: 1 """ diff --git a/src/sage/schemes/toric/weierstrass_higher.py b/src/sage/schemes/toric/weierstrass_higher.py index 2a83234e6ca..6e2cc57e59d 100644 --- a/src/sage/schemes/toric/weierstrass_higher.py +++ b/src/sage/schemes/toric/weierstrass_higher.py @@ -258,7 +258,7 @@ def WeierstrassMap_P3(quadratic1, quadratic2, variables=None): (-1/4, 0) sage: ideal = R.ideal(quadratic1, quadratic2) - sage: (-Y^2 + X^3 + a*X*Z^4 + b*Z^6).reduce(ideal) + sage: (-Y^2 + X^3 + a*X*Z^4 + b*Z^6).reduce(ideal) # needs sage.libs.singular 0 TESTS:: From a1195b05abb92292d39f9d2982c9b25d3b1a41eb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 23 Sep 2023 19:49:10 -0700 Subject: [PATCH 27/32] sage.schemes: Update # needs --- src/sage/schemes/affine/affine_homset.py | 2 +- src/sage/schemes/affine/affine_morphism.py | 4 ++-- src/sage/schemes/affine/affine_subscheme.py | 6 +++--- src/sage/schemes/generic/algebraic_scheme.py | 4 ++-- src/sage/schemes/generic/morphism.py | 8 ++++---- src/sage/schemes/projective/projective_homset.py | 2 +- src/sage/schemes/projective/projective_point.py | 4 ++-- src/sage/schemes/toric/divisor.py | 4 ++-- src/sage/schemes/toric/ideal.py | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/sage/schemes/affine/affine_homset.py b/src/sage/schemes/affine/affine_homset.py index 52ea3f83c85..b6570bd6f6d 100644 --- a/src/sage/schemes/affine/affine_homset.py +++ b/src/sage/schemes/affine/affine_homset.py @@ -393,7 +393,7 @@ def numerical_points(self, F=None, **kwds): EXAMPLES:: - sage: # needs sage.rings.number_field + sage: # needs sage.libs.singular 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]) diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index 7e855f78921..dd9eb7cf844 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -1069,7 +1069,7 @@ def weil_restriction(self): sage: A. = AffineSpace(K, 2) sage: H = End(A) sage: f = H([x^2 - y^2, y^2]) - sage: f.weil_restriction() + sage: f.weil_restriction() # needs sage.libs.singular 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) @@ -1084,7 +1084,7 @@ def weil_restriction(self): sage: F = f.weil_restriction() sage: P = PS(2, 1) sage: Q = P.weil_restriction() - sage: f(P).weil_restriction() == F(Q) + sage: f(P).weil_restriction() == F(Q) # needs sage.libs.singular True """ if any(isinstance(f, FractionFieldElement) for f in self): diff --git a/src/sage/schemes/affine/affine_subscheme.py b/src/sage/schemes/affine/affine_subscheme.py index ed125a60193..e55f4512a15 100644 --- a/src/sage/schemes/affine/affine_subscheme.py +++ b/src/sage/schemes/affine/affine_subscheme.py @@ -374,7 +374,7 @@ def intersection_multiplicity(self, X, P): ....: -7*b^5 + 21*b^4 - 28*b^3 + 21*b^2 - 21*b + 14, ....: -b^5 + 2*b^4 - 3*b^3 + 2*b^2 - 2*b, ....: 0]) - sage: X.intersection_multiplicity(Y, Q) + sage: X.intersection_multiplicity(Y, Q) # needs sage.libs.singular 3 :: @@ -470,10 +470,10 @@ def multiplicity(self, P): sage: A. = AffineSpace(K, 5) sage: X = A.subscheme([y^7 - x^2*z^5 + z^3*t^8 - x^2*y^4*z - t^8]) sage: Q1 = A([1,1,0,1,-1]) - sage: X.multiplicity(Q1) + sage: X.multiplicity(Q1) # needs sage.libs.singular 1 sage: Q2 = A([0,0,0,-a,0]) - sage: X.multiplicity(Q2) + sage: X.multiplicity(Q2) # needs sage.libs.singular 7 Check that :trac:`27479` is fixed:: diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index e030371f70e..0648ad2a9f4 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -1282,7 +1282,7 @@ def is_irreducible(self): sage: K = QuadraticField(-3) sage: P. = ProjectiveSpace(K, 5) sage: X = P.subscheme([x*y - z^2 - K.0*t^2, t*w*x + y*z^2 - u^3]) - sage: X.is_irreducible() + sage: X.is_irreducible() # needs sage.libs.singular True :: @@ -1775,7 +1775,7 @@ def rational_points(self, **kwds): sage: K. = NumberField(u^2 + 3) sage: A. = ProjectiveSpace(K, 1) sage: X = A.subscheme(x^2 - y^2) - sage: X.rational_points(bound=3) + sage: X.rational_points(bound=3) # needs sage.libs.singular [(-1 : 1), (1 : 1)] One can enumerate points up to a given bound on a projective scheme diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index 7597d385b40..4405268fed6 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -1349,8 +1349,8 @@ def change_ring(self, R, check=True): sage: K2. = NumberField(t**4 - 2) sage: P. = ProjectiveSpace(QQ, 1) sage: phi = K.embeddings(K2)[0] - sage: f = DynamicalSystem_projective([x**2 + 3*y**2, y**2]) - sage: f.change_ring(phi) + sage: f = DynamicalSystem_projective([x**2 + 3*y**2, y**2]) # needs sage.schemes + sage: f.change_ring(phi) # needs sage.schemes 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) @@ -1364,8 +1364,8 @@ def change_ring(self, R, check=True): sage: K2. = NumberField(t^8 - 2) sage: P. = ProjectiveSpace(K, 1) sage: phi = K1.embeddings(K2)[0] - sage: f = DynamicalSystem_projective([x^2 + 3*y^2, y^2]) - sage: f.change_ring(phi) + sage: f = DynamicalSystem_projective([x^2 + 3*y^2, y^2]) # needs sage.schemes + sage: f.change_ring(phi) # needs sage.schemes Traceback (most recent call last): ... ValueError: no canonical coercion of base ring of morphism to domain of embedding diff --git a/src/sage/schemes/projective/projective_homset.py b/src/sage/schemes/projective/projective_homset.py index e1031e71fcf..2a61c1dd17c 100644 --- a/src/sage/schemes/projective/projective_homset.py +++ b/src/sage/schemes/projective/projective_homset.py @@ -581,7 +581,7 @@ 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: # needs sage.rings.number_field sage.schemes sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^2 + x - (3^3-3)) sage: E = EllipticCurve('37a') diff --git a/src/sage/schemes/projective/projective_point.py b/src/sage/schemes/projective/projective_point.py index 9769b7237c6..e22e0a858b1 100644 --- a/src/sage/schemes/projective/projective_point.py +++ b/src/sage/schemes/projective/projective_point.py @@ -728,8 +728,8 @@ def global_height(self, prec=None): :: 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 + sage: Q = P([QQbar(sqrt(3)), QQbar(sqrt(-2)), 1]) # needs sage.rings.number_field sage.symbolic + sage: Q.global_height() # needs sage.rings.number_field sage.symbolic 0.549306144334055 :: diff --git a/src/sage/schemes/toric/divisor.py b/src/sage/schemes/toric/divisor.py index c928cec4a7a..796d667c518 100644 --- a/src/sage/schemes/toric/divisor.py +++ b/src/sage/schemes/toric/divisor.py @@ -1267,7 +1267,7 @@ def Kodaira_map(self, names='z'): sage: P1. = toric_varieties.P1() sage: D = -P1.K() - sage: D.Kodaira_map() # needs fpylll + sage: D.Kodaira_map() # needs fpylll sage.libs.singular Scheme morphism: From: 1-d CPR-Fano toric variety covered by 2 affine patches To: Closed subscheme of Projective Space of dimension 2 @@ -1276,7 +1276,7 @@ def Kodaira_map(self, names='z'): sage: dP6 = toric_varieties.dP6() sage: D = -dP6.K() - sage: D.Kodaira_map(names='x') # needs fpylll + sage: D.Kodaira_map(names='x') # needs fpylll sage.libs.singular Scheme morphism: From: 2-d CPR-Fano toric variety covered by 6 affine patches To: Closed subscheme of Projective Space of dimension 6 diff --git a/src/sage/schemes/toric/ideal.py b/src/sage/schemes/toric/ideal.py index bf9eb94e331..6d611719c14 100644 --- a/src/sage/schemes/toric/ideal.py +++ b/src/sage/schemes/toric/ideal.py @@ -1,4 +1,4 @@ -# sage.doctest: needs sage.geometry.polyhedron sage.graphs +# sage.doctest: needs sage.geometry.polyhedron sage.graphs sage.libs.singular r""" Toric ideals From e38afeb967ae884fb8609ce35191a72e8ad0ade9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 1 Oct 2023 09:52:26 -0700 Subject: [PATCH 28/32] src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py: Use file and block tags --- .../arithmetic_dynamics/berkovich_ds.py | 222 +++++++++--------- 1 file changed, 108 insertions(+), 114 deletions(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py index 5bb5e01d488..8f356067367 100644 --- a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.rings.padics r""" Dynamical systems on Berkovich space over `\CC_p`. @@ -71,9 +72,9 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet We can easily create a dynamical system on Berkovich space using a dynamical system on projective space over `\QQ_p`:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_projective([2*x^2 + 4*y^2, 3*x^2 + 9*y^2]) # needs sage.rings.padics - sage: DynamicalSystem_Berkovich(f) # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_projective([2*x^2 + 4*y^2, 3*x^2 + 9*y^2]) + sage: DynamicalSystem_Berkovich(f) Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -82,8 +83,8 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet Or directly from polynomials:: - sage: P. = ProjectiveSpace(Qp(3),1) # needs sage.rings.padics - sage: DynamicalSystem_Berkovich([x^2 + y^2, y^2]) # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3),1) + sage: DynamicalSystem_Berkovich([x^2 + y^2, y^2]) Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -91,8 +92,8 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet :class:`DynamicalSystem_Berkovich` defaults to projective:: - sage: R. = Qp(3)[] # needs sage.rings.padics - sage: DynamicalSystem_Berkovich([x^2, y^2]) # needs sage.rings.padics + sage: R. = Qp(3)[] + sage: DynamicalSystem_Berkovich([x^2, y^2]) Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -101,30 +102,31 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet To create an affine dynamical system on Berkovich space, pass an affine dynamical system to :class:`DynamicalSystem_Berkovich`:: - sage: A. = AffineSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_affine(z^2 + 1) # needs sage.rings.padics - sage: DynamicalSystem_Berkovich(f) # needs sage.rings.padics + sage: A. = AffineSpace(Qp(3), 1) + sage: f = DynamicalSystem_affine(z^2 + 1) + sage: DynamicalSystem_Berkovich(f) Dynamical system of Affine Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (z) to (z^2 + 1 + O(3^20)) ``domain`` can be used to specify the type of dynamical system:: - sage: A. = AffineSpace(Qp(3), 1) # needs sage.rings.padics - sage: C = Berkovich_Cp_Affine(3) # needs sage.rings.padics - sage: DynamicalSystem_Berkovich([z^2 + 1], C) # needs sage.rings.padics + sage: A. = AffineSpace(Qp(3), 1) + sage: C = Berkovich_Cp_Affine(3) + sage: DynamicalSystem_Berkovich([z^2 + 1], C) Dynamical system of Affine Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (z) to (z^2 + 1 + O(3^20)) We can create dynamical systems which act on Berkovich spaces backed by number fields:: + 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(2) # needs sage.rings.padics - sage: P. = ProjectiveSpace(A, 1) # needs sage.rings.padics - sage: B = Berkovich_Cp_Projective(P, ideal) # needs sage.rings.padics - sage: DynamicalSystem_Berkovich([x^2 + y^2, 2*a*x*y], B) # needs sage.rings.number_field sage.rings.padics + sage: A. = NumberField(z^2 + 1) + sage: ideal = A.prime_above(2) + sage: P. = ProjectiveSpace(A, 1) + sage: B = Berkovich_Cp_Projective(P, ideal) + sage: DynamicalSystem_Berkovich([x^2 + y^2, 2*a*x*y], B) Dynamical system of Projective Berkovich line over Cp(2), with base Number Field in a with defining polynomial z^2 + 1 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -133,11 +135,12 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet We can use the optional parameter ``ideal`` to create the same dynamical system more efficiently:: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(z^2 + 1) # needs sage.rings.number_field - sage: prime_ideal = A.prime_above(2) # needs sage.rings.padics - sage: P. = ProjectiveSpace(A, 1) # needs sage.rings.padics - sage: DynamicalSystem_Berkovich([x^2 + y^2, 2*a*x*y], ideal=prime_ideal) # needs sage.rings.number_field sage.rings.padics + sage: A. = NumberField(z^2 + 1) + sage: prime_ideal = A.prime_above(2) + sage: P. = ProjectiveSpace(A, 1) + sage: DynamicalSystem_Berkovich([x^2 + y^2, 2*a*x*y], ideal=prime_ideal) Dynamical system of Projective Berkovich line over Cp(2), with base Number Field in a with defining polynomial z^2 + 1 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -146,7 +149,6 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet Creating a map on Berkovich space creates the Berkovich space it acts on:: - sage: # needs sage.rings.padics sage: P. = ProjectiveSpace(Qp(3), 1) sage: f = DynamicalSystem_projective([x^2, y^2]) sage: g = DynamicalSystem_Berkovich(f) @@ -155,7 +157,6 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet The image of type I point is the image of the center:: - sage: # needs sage.rings.padics sage: P. = ProjectiveSpace(Qp(3), 1) sage: F = DynamicalSystem_Berkovich([x^2, y^2]) sage: B = F.domain() @@ -167,13 +168,12 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet the image is the type II/III point corresponding to the image of the disk:: - sage: Q2 = B(0, 3) # needs sage.rings.padics - sage: F(Q2) # needs sage.rings.padics + sage: Q2 = B(0, 3) + sage: F(Q2) Type II point centered at (0 : 1 + O(3^20)) of radius 3^2 The image of any type II point can be computed:: - sage: # needs sage.rings.padics sage: g = DynamicalSystem_projective([x^2 + y^2, x*y]) sage: G = DynamicalSystem_Berkovich(g) sage: Q3 = B(0, 1) @@ -183,15 +183,15 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet The image of type III points can be computed has long as the corresponding disk contains no poles of the dynamical system:: - sage: Q4 = B(1/9, 1.5) # needs sage.rings.padics - sage: G(Q4) # needs sage.rings.padics + sage: Q4 = B(1/9, 1.5) + sage: G(Q4) Type III point centered at (3^-2 + 3^2 + O(3^18) : 1 + O(3^20)) of radius 1.50000000000000 Sometimes, however, the poles are contained in an extension of `\QQ_p` that Sage does not support:: - sage: H = DynamicalSystem_Berkovich([x*y^2, x^3 + 20*y^3]) # needs sage.rings.padics + sage: H = DynamicalSystem_Berkovich([x*y^2, x^3 + 20*y^3]) sage: H(Q4) # not tested Traceback (most recent call last): ... @@ -212,7 +212,7 @@ class DynamicalSystem_Berkovich(Element, metaclass=InheritComparisonClasscallMet Alternatively, if checking for poles in the disk has been done already, ``type_3_pole_check`` can be set to ``False``:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) sage: H = DynamicalSystem_Berkovich([x*y^2, x^3 + 20*y^3]) sage: B = H.domain() sage: Q4 = B(1/9, 1.5) @@ -232,9 +232,9 @@ def __classcall_private__(cls, dynamical_system, domain=None, ideal=None): EXAMPLES:: - sage: R. = Qp(3)[] # needs sage.rings.padics - sage: f = DynamicalSystem_affine(t^2 - 3) # needs sage.rings.padics - sage: DynamicalSystem_Berkovich(f) # needs sage.rings.padics + sage: R. = Qp(3)[] + sage: f = DynamicalSystem_affine(t^2 - 3) + sage: DynamicalSystem_Berkovich(f) Dynamical system of Affine Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending ((1 + O(3^20))*t) to ((1 + O(3^20))*t^2 + 2*3 + 2*3^2 + 2*3^3 + 2*3^4 + 2*3^5 + 2*3^6 + @@ -292,7 +292,6 @@ def __init__(self, dynamical_system, domain): TESTS:: - sage: # needs sage.rings.padics sage: P. = ProjectiveSpace(Qp(3), 1) sage: f = DynamicalSystem_projective([2*x^2 + 4*y^2, 3*x^2 + 9*y^2]) sage: g = DynamicalSystem_Berkovich(f) @@ -308,15 +307,15 @@ def __eq__(self, other): EXAMPLES:: - sage: R. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_Berkovich([x^2, y^2]) # needs sage.rings.padics - sage: f == f # needs sage.rings.padics + sage: R. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_Berkovich([x^2, y^2]) + sage: f == f True :: - sage: g = DynamicalSystem_Berkovich([x^3, x*y^2]) # needs sage.rings.padics - sage: f == g # needs sage.rings.padics + sage: g = DynamicalSystem_Berkovich([x^3, x*y^2]) + sage: f == g True """ if not isinstance(other, type(self)): @@ -329,15 +328,15 @@ def __neq__(self, other): EXAMPLES:: - sage: R. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_Berkovich([x^2, y^2]) # needs sage.rings.padics - sage: f != f # needs sage.rings.padics + sage: R. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_Berkovich([x^2, y^2]) + sage: f != f False :: - sage: g = DynamicalSystem_Berkovich([x^2 + y^2, y^2]) # needs sage.rings.padics - sage: f != g # needs sage.rings.padics + sage: g = DynamicalSystem_Berkovich([x^2 + y^2, y^2]) + sage: f != g True """ return not (self == other) @@ -350,7 +349,6 @@ def domain(self): EXAMPLES:: - sage: # needs sage.rings.padics sage: Q. = ProjectiveSpace(Qp(3), 1) sage: f = DynamicalSystem_projective([3*x^2, 2*y^2]) sage: g = DynamicalSystem_Berkovich(f) @@ -367,9 +365,9 @@ def as_scheme_dynamical_system(self): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_Berkovich([x^2 + y^2, x*y]) # needs sage.rings.padics - sage: f.as_scheme_dynamical_system() # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_Berkovich([x^2 + y^2, x*y]) + sage: f.as_scheme_dynamical_system() Dynamical System of Projective Space of dimension 1 over 3-adic Field with capped relative precision 20 Defn: Defined on coordinates by sending (x : y) to (x^2 + y^2 : x*y) @@ -389,7 +387,6 @@ def __getitem__(self, i): EXAMPLES:: - sage: # needs sage.rings.padics sage: P. = ProjectiveSpace(Qp(3), 1) sage: f = DynamicalSystem_projective([x^2 + y^2, 2*y^2]) sage: g = DynamicalSystem_Berkovich(f) @@ -407,7 +404,6 @@ def defining_polynomials(self): EXAMPLES:: - sage: # needs sage.rings.padics sage: P. = ProjectiveSpace(Qp(3), 1) sage: f = DynamicalSystem_projective([2*x^2 + 4*y^2, 3*x^2 + 9*y^2]) sage: g = DynamicalSystem_Berkovich(f) @@ -425,18 +421,19 @@ def base_ring(self): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_Berkovich([x^2 + y^2, y^2]) # needs sage.rings.padics - sage: f.base_ring() # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_Berkovich([x^2 + y^2, y^2]) + sage: f.base_ring() 3-adic Field with capped relative precision 20 :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(z^3 + 20) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(A, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_Berkovich([x^2, x^2 + y^2], ideal=A.prime_above(2)) # needs sage.rings.number_field - sage: f.base_ring() # needs sage.rings.padics + sage: A. = NumberField(z^3 + 20) + sage: P. = ProjectiveSpace(A, 1) + sage: f = DynamicalSystem_Berkovich([x^2, x^2 + y^2], ideal=A.prime_above(2)) + sage: f.base_ring() Number Field in a with defining polynomial z^3 + 20 """ return self.domain().base_ring() @@ -449,7 +446,6 @@ def _repr_(self): EXAMPLES:: - sage: # needs sage.rings.padics sage: Q. = ProjectiveSpace(Qp(3), 1) sage: f = DynamicalSystem_projective([3*x^2, 2*y^2]) sage: f = DynamicalSystem_Berkovich(f) @@ -487,9 +483,9 @@ class DynamicalSystem_Berkovich_projective(DynamicalSystem_Berkovich): We can easily create a dynamical system on Berkovich space using a dynamical system on projective space over `\QQ_p`:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_projective([1/2*x^2 + x*y + 3*y^2, 3*x^2 + 9*y^2]) # needs sage.rings.padics - sage: DynamicalSystem_Berkovich(f) # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_projective([1/2*x^2 + x*y + 3*y^2, 3*x^2 + 9*y^2]) + sage: DynamicalSystem_Berkovich(f) Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -499,17 +495,17 @@ class DynamicalSystem_Berkovich_projective(DynamicalSystem_Berkovich): Or from a morphism:: - sage: P1. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: H = End(P1) # needs sage.rings.padics - sage: DynamicalSystem_Berkovich(H([y, x])) # needs sage.rings.padics + sage: P1. = ProjectiveSpace(Qp(3), 1) + sage: H = End(P1) + sage: DynamicalSystem_Berkovich(H([y, x])) Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to (y : x) Or from polynomials:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: DynamicalSystem_Berkovich([x^2+y^2, y^2]) # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: DynamicalSystem_Berkovich([x^2+y^2, y^2]) Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to (x^2 + y^2 : y^2) @@ -521,9 +517,9 @@ def __classcall_private__(cls, dynamical_system, domain=None): EXAMPLES:: - sage: P1. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics + sage: P1. = ProjectiveSpace(Qp(3), 1) sage: from sage.dynamics.arithmetic_dynamics.berkovich_ds import DynamicalSystem_Berkovich_projective - sage: DynamicalSystem_Berkovich_projective([y, x]) # needs sage.rings.padics + sage: DynamicalSystem_Berkovich_projective([y, x]) Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to (y : x) @@ -559,8 +555,8 @@ def __init__(self, dynamical_system, domain=None): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: DynamicalSystem_Berkovich([x^2 + x*y + 2*y^2, 2*x*y]) # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: DynamicalSystem_Berkovich([x^2 + x*y + 2*y^2, 2*x*y]) Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -580,22 +576,23 @@ def scale_by(self, t): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_Berkovich([x^2, y^2]) # needs sage.rings.padics - sage: f.scale_by(x); f # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_Berkovich([x^2, y^2]) + sage: f.scale_by(x); f Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to (x^3 : x*y^2) :: + sage: # needs sage.rings.number_field sage: Q. = QQ[] - sage: A. = NumberField(z^3 + 20) # needs sage.rings.number_field - sage: ideal = A.prime_above(3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(A, 1) # needs sage.rings.number_field - sage: B = Berkovich_Cp_Projective(P, ideal) # needs sage.rings.number_field sage.rings.padics - sage: f = DynamicalSystem_Berkovich([x^2 + y^2, 2*x*y], B) # needs sage.rings.number_field sage.rings.padics - sage: f.scale_by(2); f # needs sage.rings.padics + sage: A. = NumberField(z^3 + 20) + sage: ideal = A.prime_above(3) + sage: P. = ProjectiveSpace(A, 1) + sage: B = Berkovich_Cp_Projective(P, ideal) + sage: f = DynamicalSystem_Berkovich([x^2 + y^2, 2*x*y], B) + sage: f.scale_by(2); f Dynamical system of Projective Berkovich line over Cp(3), with base Number Field in a with defining polynomial z^3 + 20 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -611,9 +608,9 @@ def normalize_coordinates(self): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_Berkovich([2*x^2, 2*y^2]) # needs sage.rings.padics - sage: f.normalize_coordinates(); f # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_Berkovich([2*x^2, 2*y^2]) + sage: f.normalize_coordinates(); f Dynamical system of Projective Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x : y) to (x^2 : y^2) @@ -621,8 +618,8 @@ def normalize_coordinates(self): Normalize_coordinates may sometimes fail over p-adic fields:: - sage: g = DynamicalSystem_Berkovich([2*x^2, x*y]) # needs sage.rings.padics - sage: g.normalize_coordinates() #not tested + sage: g = DynamicalSystem_Berkovich([2*x^2, x*y]) + sage: g.normalize_coordinates() # not tested Traceback (most recent call last): ... TypeError: unable to coerce since the denominator is not 1 @@ -664,7 +661,6 @@ def conjugate(self, M, adjugate=False, new_ideal=None): EXAMPLES:: - sage: # needs sage.rings.padics sage: P. = ProjectiveSpace(Qp(3), 1) sage: f = DynamicalSystem_projective([x^2 + y^2, 2*y^2]) sage: g = DynamicalSystem_Berkovich(f) @@ -676,12 +672,13 @@ def conjugate(self, M, adjugate=False, new_ideal=None): :: + sage: # needs sage.rings.number_field sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_Berkovich([x^2 + y^2, y^2], ideal=5) sage: R. = QQ[] - sage: A. = NumberField(z^2 + 1) # needs sage.rings.number_field - sage: conj = Matrix([[1, a], [0, 1]]) # needs sage.rings.number_field - sage: f.conjugate(conj) # needs sage.rings.number_field + sage: A. = NumberField(z^2 + 1) + sage: conj = Matrix([[1, a], [0, 1]]) + sage: f.conjugate(conj) Dynamical system of Projective Berkovich line over Cp(5), with base Number Field in a with defining polynomial z^2 + 1 induced by the map Defn: Defined on coordinates by sending (x : y) to @@ -691,10 +688,11 @@ def conjugate(self, M, adjugate=False, new_ideal=None): the base ring of ``M`` and of this dynamical system are not the same:: - sage: ideal = A.ideal(5).factor()[1][0]; ideal # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: ideal = A.ideal(5).factor()[1][0]; ideal Fractional ideal (2*a + 1) - sage: g = f.conjugate(conj, new_ideal=ideal) # needs sage.rings.number_field - sage: g.domain().ideal() # needs sage.rings.padics + sage: g = f.conjugate(conj, new_ideal=ideal) + sage: g.domain().ideal() Fractional ideal (2*a + 1) """ if self.domain().is_padic_base(): @@ -727,18 +725,19 @@ def resultant(self, normalize=False): EXAMPLES:: - sage: P. = ProjectiveSpace(Qp(3), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_Berkovich([x^2 + y^2, y^2]) # needs sage.rings.padics - sage: f.resultant() # needs sage.rings.padics + sage: P. = ProjectiveSpace(Qp(3), 1) + sage: f = DynamicalSystem_Berkovich([x^2 + y^2, y^2]) + sage: f.resultant() 1 + O(3^20) :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: A. = NumberField(z^3 + 20) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(A, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_Berkovich([2*x^2, x^2 + y^2], ideal=A.prime_above(2)) # needs sage.rings.number_field - sage: f.resultant() # needs sage.rings.padics + sage: A. = NumberField(z^3 + 20) + sage: P. = ProjectiveSpace(A, 1) + sage: f = DynamicalSystem_Berkovich([2*x^2, x^2 + y^2], ideal=A.prime_above(2)) + sage: f.resultant() 4 """ return self._system.resultant(normalize=normalize) @@ -759,7 +758,6 @@ def dehomogenize(self, n): EXAMPLES:: - sage: # needs sage.rings.padics sage: P. = ProjectiveSpace(Qp(3), 1) sage: f = DynamicalSystem_projective([x^2 + y^2, x*y + y^2]) sage: g = DynamicalSystem_Berkovich(f) @@ -793,7 +791,6 @@ def __call__(self, x, type_3_pole_check=True): EXAMPLES:: - sage: # needs sage.rings.padics sage: P. = ProjectiveSpace(Qp(3), 1) sage: g = DynamicalSystem_projective([x^2 + y^2, x*y]) sage: G = DynamicalSystem_Berkovich(g) @@ -804,7 +801,6 @@ def __call__(self, x, type_3_pole_check=True): :: - sage: # needs sage.rings.padics sage: P. = ProjectiveSpace(Qp(3), 1) sage: H = DynamicalSystem_Berkovich([x*y^2, x^3 + 20*y^3]) sage: B = H.domain() @@ -984,17 +980,17 @@ class DynamicalSystem_Berkovich_affine(DynamicalSystem_Berkovich): induced by a dynamical system on `\QQ_p` or an extension of `\QQ_p`:: - sage: A. = AffineSpace(Qp(5), 1) # needs sage.rings.padics - sage: f = DynamicalSystem_affine([(x^2 + 1)/x]) # needs sage.rings.padics - sage: DynamicalSystem_Berkovich(f) # needs sage.rings.padics + sage: A. = AffineSpace(Qp(5), 1) + sage: f = DynamicalSystem_affine([(x^2 + 1)/x]) + sage: DynamicalSystem_Berkovich(f) Dynamical system of Affine Berkovich line over Cp(5) of precision 20 induced by the map Defn: Defined on coordinates by sending (x) to ((x^2 + 1 + O(5^20))/x) Dynamical system can be created from a morphism:: - sage: H = End(A) # needs sage.rings.padics - sage: phi = H([x + 3]) # needs sage.rings.padics - sage: DynamicalSystem_Berkovich(phi) # needs sage.rings.padics + sage: H = End(A) + sage: phi = H([x + 3]) + sage: DynamicalSystem_Berkovich(phi) Dynamical system of Affine Berkovich line over Cp(5) of precision 20 induced by the map Defn: Defined on coordinates by sending (x) to (x + 3 + O(5^20)) """ @@ -1005,9 +1001,9 @@ def __classcall_private__(cls, dynamical_system, domain=None): EXAMPLES:: - sage: A. = AffineSpace(Qp(3), 1) # needs sage.rings.padics + sage: A. = AffineSpace(Qp(3), 1) sage: from sage.dynamics.arithmetic_dynamics.berkovich_ds import DynamicalSystem_Berkovich_affine - sage: DynamicalSystem_Berkovich_affine(DynamicalSystem_affine(x^2)) # needs sage.rings.padics + sage: DynamicalSystem_Berkovich_affine(DynamicalSystem_affine(x^2)) Dynamical system of Affine Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x) to (x^2) @@ -1039,9 +1035,9 @@ def __init__(self, dynamical_system, domain): EXAMPLES:: - sage: A. = AffineSpace(Qp(3), 1) # needs sage.rings.padics + sage: A. = AffineSpace(Qp(3), 1) sage: from sage.dynamics.arithmetic_dynamics.berkovich_ds import DynamicalSystem_Berkovich_affine - sage: DynamicalSystem_Berkovich_affine(DynamicalSystem_affine(x^3)) # needs sage.rings.padics + sage: DynamicalSystem_Berkovich_affine(DynamicalSystem_affine(x^3)) Dynamical system of Affine Berkovich line over Cp(3) of precision 20 induced by the map Defn: Defined on coordinates by sending (x) to (x^3) @@ -1065,7 +1061,6 @@ def homogenize(self, n): EXAMPLES:: - sage: # needs sage.rings.padics sage: A. = AffineSpace(Qp(3), 1) sage: f = DynamicalSystem_affine(1/x) sage: f = DynamicalSystem_Berkovich(f) @@ -1086,7 +1081,6 @@ def __call__(self, x): EXAMPLES:: - sage: # needs sage.rings.padics sage: P. = AffineSpace(Qp(3), 1) sage: f = DynamicalSystem_affine(x^2) sage: g = DynamicalSystem_Berkovich(f) From 8443583acd1f37329d4c81b6cd5d40b6509ed72f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 1 Oct 2023 10:24:12 -0700 Subject: [PATCH 29/32] src/sage/dynamics/arithmetic_dynamics/projective_ds.py: Many more block tags --- .../arithmetic_dynamics/projective_ds.py | 580 ++++++++++-------- 1 file changed, 325 insertions(+), 255 deletions(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index d75972f812d..6625f1bd92b 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -1230,16 +1230,17 @@ def arakelov_zhang_pairing(self, g, **kwds): sage: # Correct value should be = 0.323067... sage: f.arakelov_zhang_pairing(g, n=9) # long time # needs sage.rings.function_field 0.323091061918965 - sage: _ - 0.323067 # long time # needs sage.rings.function_field + sage: _ - 0.323067 # long time # needs sage.rings.function_field 0.0000240619189654789 Also from Prop. 18 of Petsche, Szpiro and Tucker, includes places of bad reduction:: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(ZZ) - sage: K. = NumberField(z^3 - 11) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field - sage: a = 7/(b - 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: K. = NumberField(z^3 - 11) + sage: P. = ProjectiveSpace(K,1) + sage: a = 7/(b - 1) + sage: f = DynamicalSystem_projective([a*y^2 - (a*y - x)^2, y^2]) sage: g = DynamicalSystem_projective([x^2, y^2]) If all archimedean absolute values of a have modulus > 2, @@ -1247,7 +1248,7 @@ def arakelov_zhang_pairing(self, g, **kwds): sage: f.arakelov_zhang_pairing(g, n=6) # long time # needs sage.rings.number_field 1.93846423207664 - sage: _ - a.global_height() # long time # needs sage.rings.number_field + sage: _ - a.global_height() # long time # needs sage.rings.number_field -0.00744591697867292 """ n = kwds.pop('n', 5) @@ -1710,11 +1711,12 @@ def resultant(self, normalize=False): :: + 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: f = DynamicalSystem_projective([s*x^3 - 13*y^3, y^3 - 15*y^3]) # needs sage.rings.number_field - sage: f.resultant() # needs sage.rings.number_field + sage: s = (t^3 + t + 1).roots(QQbar)[0][0] + sage: P. = ProjectiveSpace(QQbar, 1) + sage: f = DynamicalSystem_projective([s*x^3 - 13*y^3, y^3 - 15*y^3]) + sage: f.resultant() 871.6925062959149? """ if normalize: @@ -1788,11 +1790,12 @@ def primes_of_bad_reduction(self, check=True): A number field example:: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(z^2 - 2) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([1/3*x^2+1/a*y^2, y^2]) # needs sage.rings.number_field - sage: f.primes_of_bad_reduction() # needs sage.rings.function_field sage.rings.number_field + sage: K. = NumberField(z^2 - 2) + sage: P. = ProjectiveSpace(K,1) + sage: f = DynamicalSystem_projective([1/3*x^2+1/a*y^2, y^2]) + sage: f.primes_of_bad_reduction() # needs sage.rings.function_field [Fractional ideal (a), Fractional ideal (3)] This is an example where ``check=False`` returns extra primes:: @@ -2221,14 +2224,15 @@ def canonical_height(self, P, **kwds): Notice that preperiodic points may not return exactly 0:: + 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: K. = NumberField(X^2 + X - 1) + sage: P. = ProjectiveSpace(K,1) sage: f = DynamicalSystem_projective([x^2 - 2*y^2, y^2]) - sage: Q = P.point([a,1]) # needs sage.rings.number_field - sage: f.canonical_height(Q, error_bound=0.000001) # Answer only within error_bound of 0 # needs sage.rings.number_field + sage: Q = P.point([a,1]) + sage: f.canonical_height(Q, error_bound=0.000001) # Answer only within error_bound of 0 5.7364919788790160119266380480e-8 - sage: f.nth_iterate(Q, 2) == Q # but it is indeed preperiodic # needs sage.rings.number_field + sage: f.nth_iterate(Q, 2) == Q # but it is indeed preperiodic True :: @@ -2437,19 +2441,21 @@ def height_difference_bound(self, prec=None): A number field example:: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(x^3 - 2) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([1/(c+1)*x^2 + c*y^2, 210*x*y, 10000*z^2]) # needs sage.rings.number_field - sage: f.height_difference_bound() # needs sage.rings.number_field sage.symbolic + sage: K. = NumberField(x^3 - 2) + sage: P. = ProjectiveSpace(K, 2) + sage: f = DynamicalSystem_projective([1/(c+1)*x^2 + c*y^2, 210*x*y, 10000*z^2]) + sage: f.height_difference_bound() # needs sage.symbolic 11.3683039374269 :: - sage: P. = ProjectiveSpace(QQbar, 2) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2, QQbar(sqrt(-1))*y^2, # needs sage.rings.number_field sage.symbolic + sage: # needs sage.rings.number_field sage.symbolic + sage: P. = ProjectiveSpace(QQbar, 2) + sage: f = DynamicalSystem_projective([x^2, QQbar(sqrt(-1))*y^2, ....: QQbar(sqrt(3))*z^2]) - sage: f.height_difference_bound() # needs sage.rings.number_field sage.symbolic + sage: f.height_difference_bound() 2.89037175789616 :: @@ -3314,14 +3320,15 @@ def all_minimal_models(self, return_transformation=False, prime_list=None, TESTS:: + sage: # needs sage.rings.function_field sage: P. = ProjectiveSpace(QQ, 1) sage: c = 2^2*5^2*11^3 sage: f = DynamicalSystem([x^3 - c^2*y^3, x*y^2]) - sage: MM = f.all_minimal_models(return_transformation=True, algorithm='BM') # needs sage.rings.function_field - sage: all(f.conjugate(m) == F for F, m in MM) # needs sage.rings.function_field + sage: MM = f.all_minimal_models(return_transformation=True, algorithm='BM') + sage: all(f.conjugate(m) == F for F, m in MM) True - sage: MM = f.all_minimal_models(return_transformation=True, algorithm='HS') # needs sage.rings.function_field - sage: all(f.conjugate(m) == F for F,m in MM) # needs sage.rings.function_field + sage: MM = f.all_minimal_models(return_transformation=True, algorithm='HS') + sage: all(f.conjugate(m) == F for F,m in MM) True REFERENCES: @@ -3419,9 +3426,10 @@ def affine_preperiodic_model(self, m, n, return_conjugation=False): :: - sage: P. = ProjectiveSpace(GF(9), 2) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(9), 2) sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) - sage: f.affine_preperiodic_model(0, 1) # needs sage.rings.finite_rings sage.rings.function_field + sage: f.affine_preperiodic_model(0, 1) # needs sage.rings.function_field Dynamical System of Projective Space of dimension 2 over Finite Field in z2 of size 3^2 Defn: Defined on coordinates by sending (x : y : z) to @@ -3645,7 +3653,8 @@ def automorphism_group(self, **kwds): sage: R. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([3*x^2*y - y^3, x^3 - 3*x*y^2]) - sage: lst, label = f.automorphism_group(algorithm='CRT', return_functions=True, # needs sage.libs.pari + sage: lst, label = f.automorphism_group(algorithm='CRT', # needs sage.libs.pari + ....: return_functions=True, ....: iso_type=True) sage: sorted(lst), label # needs sage.libs.pari ([-1/x, 1/x, (-x - 1)/(x - 1), (-x + 1)/(x + 1), (x - 1)/(x + 1), @@ -3749,9 +3758,10 @@ def critical_subscheme(self): :: - sage: P. = ProjectiveSpace(GF(81), 3) # needs sage.rings.finite_rings - sage: g = DynamicalSystem_projective([x^3 + y^3, y^3 + z^3, z^3 + x^3, w^3]) # needs sage.rings.finite_rings - sage: g.critical_subscheme() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(81), 3) + sage: g = DynamicalSystem_projective([x^3 + y^3, y^3 + z^3, z^3 + x^3, w^3]) + sage: g.critical_subscheme() Closed subscheme of Projective Space of dimension 3 over Finite Field in z4 of size 3^4 defined by: 0 @@ -3933,11 +3943,12 @@ def is_postcritically_finite(self, err=0.01, use_algebraic_closure=True): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(z^8 + 3*z^6 + 3*z^4 + z^2 + 1) # needs sage.rings.number_field - sage: PS. = ProjectiveSpace(K,1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^3 + v*y^3, y^3]) # needs sage.rings.number_field - sage: f.is_postcritically_finite() # long time + sage: K. = NumberField(z^8 + 3*z^6 + 3*z^4 + z^2 + 1) + sage: PS. = ProjectiveSpace(K,1) + sage: f = DynamicalSystem_projective([x^3 + v*y^3, y^3]) + sage: f.is_postcritically_finite() # long time True :: @@ -3950,10 +3961,11 @@ def is_postcritically_finite(self, err=0.01, use_algebraic_closure=True): :: - sage: K = UniversalCyclotomicField() # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field + sage: # needs sage.libs.gap sage.rings.number_field + sage: K = UniversalCyclotomicField() + sage: P. = ProjectiveSpace(K,1) sage: F = DynamicalSystem_projective([x^2 - y^2, y^2], domain=P) - sage: F.is_postcritically_finite() # needs sage.rings.number_field + sage: F.is_postcritically_finite() True :: @@ -3972,9 +3984,10 @@ def is_postcritically_finite(self, err=0.01, use_algebraic_closure=True): :: - sage: P. = ProjectiveSpace(QQbar,1) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: P. = ProjectiveSpace(QQbar,1) sage: f = DynamicalSystem_projective([x^4 - x^2*y^2, y^4]) - sage: f.is_postcritically_finite() # needs sage.rings.number_field + sage: f.is_postcritically_finite() False """ #iteration of subschemes not yet implemented @@ -4018,7 +4031,7 @@ def is_dynamical_belyi_map(self): EXAMPLES:: - sage: P.=ProjectiveSpace(QQ, 1) + sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([-2*x^3 - 9*x^2*y - 12*x*y^2 - 6*y^3, y^3]) sage: f.is_dynamical_belyi_map() # needs sage.rings.number_field True @@ -4039,26 +4052,29 @@ def is_dynamical_belyi_map(self): :: - sage: F = QuadraticField(-7) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(F, 1) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: F = QuadraticField(-7) + sage: P. = ProjectiveSpace(F, 1) sage: f = DynamicalSystem_projective([5*x^7 - 7*x^6*y, -7*x*y^6 + 5*y^7]) - sage: f.is_dynamical_belyi_map() # needs sage.rings.number_field + sage: f.is_dynamical_belyi_map() True :: sage: P. = ProjectiveSpace(QQ, 1) - sage: f = DynamicalSystem_projective([2*x^3 + 3*x^2*y - 3*x*y^2 + 2*y^3, x^3 + y^3]) + sage: f = DynamicalSystem_projective([2*x^3 + 3*x^2*y - 3*x*y^2 + 2*y^3, + ....: x^3 + y^3]) sage: f.is_dynamical_belyi_map() # needs sage.rings.number_field False :: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: N. = NumberField(t^3 - 2) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(N, 1) # needs sage.rings.number_field - sage: f=DynamicalSystem_projective([x^2 + c*y^2, x*y]) # needs sage.rings.number_field - sage: f.is_dynamical_belyi_map() # needs sage.rings.number_field + sage: N. = NumberField(t^3 - 2) + sage: P. = ProjectiveSpace(N, 1) + sage: f=DynamicalSystem_projective([x^2 + c*y^2, x*y]) + sage: f.is_dynamical_belyi_map() False :: @@ -4108,11 +4124,12 @@ def critical_point_portrait(self, check=True, use_algebraic_closure=True): EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(z^6 + 2*z^5 + 2*z^4 + 2*z^3 + z^2 + 1) # needs sage.rings.number_field - sage: PS. = ProjectiveSpace(K,1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 + v*y^2, y^2]) # needs sage.rings.number_field - sage: f.critical_point_portrait(check=False) # long time # needs sage.graphs sage.rings.number_field + sage: K. = NumberField(z^6 + 2*z^5 + 2*z^4 + 2*z^3 + z^2 + 1) + sage: PS. = ProjectiveSpace(K,1) + sage: f = DynamicalSystem_projective([x^2 + v*y^2, y^2]) + sage: f.critical_point_portrait(check=False) # long time # needs sage.graphs Looped digraph on 6 vertices :: @@ -4133,12 +4150,13 @@ def critical_point_portrait(self, check=True, use_algebraic_closure=True): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(t^3 + 2*t^2 + t + 1) # needs sage.rings.number_field - sage: phi = K.embeddings(QQbar)[0] # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 + v*y^2, y^2]) # needs sage.rings.number_field - sage: f.change_ring(phi).critical_point_portrait() # needs sage.graphs sage.rings.number_field + sage: K. = NumberField(t^3 + 2*t^2 + t + 1) + sage: phi = K.embeddings(QQbar)[0] + sage: P. = ProjectiveSpace(K, 1) + sage: f = DynamicalSystem_projective([x^2 + v*y^2, y^2]) + sage: f.change_ring(phi).critical_point_portrait() # needs sage.graphs Looped digraph on 4 vertices :: @@ -4150,9 +4168,10 @@ def critical_point_portrait(self, check=True, use_algebraic_closure=True): :: - sage: P. = ProjectiveSpace(QQbar,1) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: P. = ProjectiveSpace(QQbar,1) sage: f = DynamicalSystem_projective([8*x^4 - 8*x^2*y^2 + y^4, y^4]) - sage: f.critical_point_portrait() # long time # needs sage.graphs sage.rings.number_field + sage: f.critical_point_portrait() # long time # needs sage.graphs Looped digraph on 6 vertices :: @@ -4354,9 +4373,10 @@ def preperiodic_points(self, m, n, **kwds): :: - sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 - x*y + 2*y^2, x^2 - y^2]) # needs sage.rings.number_field - sage: f.preperiodic_points(1, 2, minimal=False) # needs sage.rings.function_field sage.rings.number_field + sage: # needs sage.rings.number_field + sage: P. = ProjectiveSpace(QQbar, 1) + sage: f = DynamicalSystem_projective([x^2 - x*y + 2*y^2, x^2 - y^2]) + sage: f.preperiodic_points(1, 2, minimal=False) # needs sage.rings.function_field [(-3.133185666641252? : 1), (-1 : 1), (-0.3478103847799310? - 1.028852254136693?*I : 1), @@ -4370,11 +4390,12 @@ def preperiodic_points(self, m, n, **kwds): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(w^6 - 3*w^5 + 5*w^4 - 5*w^3 + 5*w^2 - 3*w + 1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: K. = NumberField(w^6 - 3*w^5 + 5*w^4 - 5*w^3 + 5*w^2 - 3*w + 1) + sage: P. = ProjectiveSpace(K, 2) sage: f = DynamicalSystem_projective([x^2 + z^2, y^2 + x^2, z^2 + y^2]) - sage: sorted(f.preperiodic_points(0, 1), key=str) # needs sage.rings.function_field sage.rings.number_field + sage: sorted(f.preperiodic_points(0, 1), key=str) # needs sage.rings.function_field [(-2*s^5 + 4*s^4 - 5*s^3 + 3*s^2 - 4*s : -2*s^5 + 5*s^4 - 7*s^3 + 6*s^2 - 7*s + 3 : 1), (-s^5 + 3*s^4 - 4*s^3 + 4*s^2 - 4*s + 2 : -s^5 + 2*s^4 - 2*s^3 + s^2 - s : 1), (-s^5 + 3*s^4 - 5*s^3 + 4*s^2 - 3*s + 1 : s^5 - 2*s^4 + 3*s^3 - 3*s^2 + 4*s - 1 : 1), @@ -4674,19 +4695,21 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari EXAMPLES:: + sage: # needs sage.rings.number_field sage: set_verbose(None) - sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 - x*y + y^2, x^2 - y^2 + x*y]) # needs sage.rings.number_field - sage: f.periodic_points(1) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(QQbar, 1) + sage: f = DynamicalSystem_projective([x^2 - x*y + y^2, x^2 - y^2 + x*y]) + sage: f.periodic_points(1) [(-0.50000000000000000? - 0.866025403784439?*I : 1), (-0.50000000000000000? + 0.866025403784439?*I : 1), (1 : 1)] :: - sage: P. = ProjectiveSpace(QuadraticField(5,'t'), 2) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 - 21/16*z^2, y^2 - z^2, z^2]) # needs sage.rings.number_field - sage: f.periodic_points(2) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: P. = ProjectiveSpace(QuadraticField(5,'t'), 2) + sage: f = DynamicalSystem_projective([x^2 - 21/16*z^2, y^2 - z^2, z^2]) + sage: f.periodic_points(2) [(-5/4 : -1 : 1), (-5/4 : -1/2*t + 1/2 : 1), (-5/4 : 0 : 1), (-5/4 : 1/2*t + 1/2 : 1), (-3/4 : -1 : 1), (-3/4 : 0 : 1), (1/4 : -1 : 1), (1/4 : -1/2*t + 1/2 : 1), (1/4 : 0 : 1), @@ -4701,11 +4724,12 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari :: + sage: # needs sage.rings.number_field sage: w = QQ['w'].0 - sage: K = NumberField(w^6 - 3*w^5 + 5*w^4 - 5*w^3 + 5*w^2 - 3*w + 1,'s') # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: K = NumberField(w^6 - 3*w^5 + 5*w^4 - 5*w^3 + 5*w^2 - 3*w + 1,'s') + sage: P. = ProjectiveSpace(K, 2) sage: f = DynamicalSystem_projective([x^2 + z^2, y^2 + x^2, z^2 + y^2]) - sage: sorted(f.periodic_points(1), key=str) # needs sage.rings.function_field sage.rings.number_field + sage: sorted(f.periodic_points(1), key=str) # needs sage.rings.function_field [(-2*s^5 + 4*s^4 - 5*s^3 + 3*s^2 - 4*s : -2*s^5 + 5*s^4 - 7*s^3 + 6*s^2 - 7*s + 3 : 1), (-s^5 + 3*s^4 - 4*s^3 + 4*s^2 - 4*s + 2 : -s^5 + 2*s^4 - 2*s^3 + s^2 - s : 1), (-s^5 + 3*s^4 - 5*s^3 + 4*s^2 - 3*s + 1 : s^5 - 2*s^4 + 3*s^3 - 3*s^2 + 4*s - 1 : 1), @@ -4760,9 +4784,10 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari :: - sage: P. = ProjectiveSpace(GF(13^2, 't'), 1) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(13^2, 't'), 1) sage: f = DynamicalSystem_projective([x^3 + 3*y^3, x^2*y]) - sage: f.periodic_points(30, minimal=True, algorithm='cyclegraph') # needs sage.graphs sage.rings.finite_rings + sage: f.periodic_points(30, minimal=True, algorithm='cyclegraph') # needs sage.graphs [(t + 3 : 1), (6*t + 6 : 1), (7*t + 1 : 1), (2*t + 8 : 1), (3*t + 4 : 1), (10*t + 12 : 1), (8*t + 10 : 1), (5*t + 11 : 1), (7*t + 4 : 1), (4*t + 8 : 1), (9*t + 1 : 1), (2*t + 2 : 1), @@ -4792,13 +4817,14 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(x^2 - x + 3) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: K. = NumberField(x^2 - x + 3) + sage: P. = ProjectiveSpace(K, 2) sage: X = P.subscheme(2*x - y) sage: f = DynamicalSystem_projective([x^2 - y^2, 2*(x^2 - y^2), y^2 - z^2], ....: domain=X) - sage: f.periodic_points(2) # needs sage.rings.function_field sage.rings.number_field + sage: f.periodic_points(2) # needs sage.rings.function_field [(-1/5*u - 1/5 : -2/5*u - 2/5 : 1), (1/5*u - 2/5 : 2/5*u - 4/5 : 1)] :: @@ -4836,8 +4862,9 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari sage: P. = ProjectiveSpace(ZZ, 2) sage: f = DynamicalSystem([x^2 - 2*y^2, y^2, z^2]) - sage: X = f.periodic_points(2, minimal=False, formal=True, return_scheme=True) # long time - sage: len(X.defining_polynomials()) # long time + sage: X = f.periodic_points(2, minimal=False, formal=True, # long time + ....: return_scheme=True) + sage: len(X.defining_polynomials()) # long time 19 TESTS:: @@ -5058,12 +5085,13 @@ def multiplier_spectra(self, n, formal=False, type='point', use_algebraic_closur :: + sage: # needs sage.rings.number_field sage: set_verbose(None) sage: z = QQ['z'].0 - sage: K. = NumberField(z^4 - 4*z^2 + 1,'z') # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 - w/4*y^2, y^2]) # needs sage.rings.number_field - sage: sorted(f.multiplier_spectra(2, formal=False, type='cycle')) # needs sage.rings.number_field + sage: K. = NumberField(z^4 - 4*z^2 + 1,'z') + sage: P. = ProjectiveSpace(K, 1) + sage: f = DynamicalSystem_projective([x^2 - w/4*y^2, y^2]) + sage: sorted(f.multiplier_spectra(2, formal=False, type='cycle')) [0, 0.0681483474218635? - 1.930649271699173?*I, 0.0681483474218635? + 1.930649271699173?*I, @@ -5127,9 +5155,10 @@ def multiplier_spectra(self, n, formal=False, type='point', use_algebraic_closur :: - sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: P. = ProjectiveSpace(QQbar, 1) sage: f = DynamicalSystem_projective([x^5 + 3*y^5, 4*x^3*y^2]) - sage: f.multiplier_spectra(1) # needs sage.rings.number_field + sage: f.multiplier_spectra(1) [0, -4.106544657178796?, -7/4, @@ -5568,27 +5597,29 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', :: + sage: # needs sage.rings.number_field sage: set_verbose(None) sage: z = QQ['z'].0 - sage: K = NumberField(z^4 - 4*z^2 + 1, 'z') # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 - 5/4*y^2, y^2]) # needs sage.rings.number_field - sage: f.sigma_invariants(2, formal=False, type='cycle') # needs sage.rings.number_field + sage: K = NumberField(z^4 - 4*z^2 + 1, 'z') + sage: P. = ProjectiveSpace(K, 1) + sage: f = DynamicalSystem_projective([x^2 - 5/4*y^2, y^2]) + sage: f.sigma_invariants(2, formal=False, type='cycle') [13, 11, -25, 0] - sage: f.sigma_invariants(2, formal=False, type='point') # needs sage.rings.number_field + sage: f.sigma_invariants(2, formal=False, type='point') [12, -2, -36, 25, 0] check that infinity as part of a longer cycle is handled correctly:: + sage: # needs sage.rings.number_field sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([y^2, x^2]) - sage: f.sigma_invariants(2, type='cycle') # needs sage.rings.number_field + sage: f.sigma_invariants(2, type='cycle') [12, 48, 64, 0] - sage: f.sigma_invariants(2, type='point') # needs sage.rings.number_field + sage: f.sigma_invariants(2, type='point') [12, 48, 64, 0, 0] - sage: f.sigma_invariants(2, type='cycle', formal=True) # needs sage.rings.number_field + sage: f.sigma_invariants(2, type='cycle', formal=True) [0] - sage: f.sigma_invariants(2, type='point', formal=True) # needs sage.rings.number_field + sage: f.sigma_invariants(2, type='point', formal=True) [0, 0] :: @@ -5624,14 +5655,15 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', :: + sage: # needs sage.rings.number_field sage: R. = QQ[] sage: Pc. = ProjectiveSpace(R, 1) sage: f = DynamicalSystem_projective([x^2 + c*y^2, y^2]) - sage: f.sigma_invariants(1) # needs sage.rings.number_field + sage: f.sigma_invariants(1) [2, 4*c, 0] - sage: f.sigma_invariants(2, formal=True, type='point') # needs sage.rings.number_field + sage: f.sigma_invariants(2, formal=True, type='point') [8*c + 8, 16*c^2 + 32*c + 16] - sage: f.sigma_invariants(2, formal=True, type='cycle') # needs sage.rings.number_field + sage: f.sigma_invariants(2, formal=True, type='cycle') [4*c + 4] :: @@ -5641,7 +5673,8 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', sage: f = DynamicalSystem([x^2 + c*y^2, y^2]) sage: f.sigma_invariants(1, return_polynomial=True) w^3 + (-3)*w^2*t + 2*w^2 + 3*w*t^2 + (-4)*w*t + 4*c*w - t^3 + 2*t^2 + (-4*c)*t - sage: f.sigma_invariants(2, chow=True, formal=True, return_polynomial=True) # needs sage.libs.pari + sage: f.sigma_invariants(2, chow=True, formal=True, # needs sage.libs.pari + ....: return_polynomial=True) w^2 + (-2)*w*t + (8*c + 8)*w + t^2 + (-8*c - 8)*t + 16*c^2 + 32*c + 16 :: @@ -5683,11 +5716,12 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: N. = NumberField(w^2 + 1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(N, 2) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) # needs sage.rings.number_field - sage: f.sigma_invariants(1, chow=True) == f.change_ring(QQ).sigma_invariants(1, chow=True) # needs sage.rings.number_field + sage: N. = NumberField(w^2 + 1) + sage: P. = ProjectiveSpace(N, 2) + sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) + sage: f.sigma_invariants(1, chow=True) == f.change_ring(QQ).sigma_invariants(1, chow=True) True :: @@ -6092,36 +6126,39 @@ def reduced_form(self, **kwds): :: + sage: # needs sage.rings.real_mpfr sage.symbolic sage: P. = ProjectiveSpace(RR, 1) - sage: f = DynamicalSystem_projective([x^4, RR(sqrt(2))*y^4]) # needs sage.symbolic + sage: f = DynamicalSystem_projective([x^4, RR(sqrt(2))*y^4]) sage: m = matrix(RR, 2, 2, [1,12,0,1]) - sage: f = f.conjugate(m) # needs sage.symbolic - sage: g, m = f.reduced_form(smallest_coeffs=False); m # needs sage.symbolic + sage: f = f.conjugate(m) + sage: g, m = f.reduced_form(smallest_coeffs=False); m [ 1 -12] [ 0 1] :: + sage: # needs sage.rings.real_mpfr sage.symbolic sage: P. = ProjectiveSpace(CC, 1) - sage: f = DynamicalSystem_projective([x^4, CC(sqrt(-2))*y^4]) # needs sage.symbolic + sage: f = DynamicalSystem_projective([x^4, CC(sqrt(-2))*y^4]) sage: m = matrix(CC, 2, 2, [1,12,0,1]) sage: f = f.conjugate(m) - sage: g, m = f.reduced_form(smallest_coeffs=False); m # needs sage.symbolic + sage: g, m = f.reduced_form(smallest_coeffs=False); m [ 1 -12] [ 0 1] :: - sage: K. = QuadraticField(2) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^3, w*y^3]) # needs sage.rings.number_field - sage: m = matrix(K, 2, 2, [1,12,0,1]) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(2) + sage: P. = ProjectiveSpace(K, 1) + sage: f = DynamicalSystem_projective([x^3, w*y^3]) + sage: m = matrix(K, 2, 2, [1,12,0,1]) sage: f = f.conjugate(m) - sage: f.reduced_form(smallest_coeffs=False) # needs sage.rings.number_field + sage: f.reduced_form(smallest_coeffs=False) ( Dynamical System of Projective Space of dimension 1 over Number Field in w with defining polynomial x^2 - 2 with w = 1.414213562373095? - Defn: Defined on coordinates by sending (x : y) to (x^3 : w*y^3) , + Defn: Defined on coordinates by sending (x : y) to (x^3 : w*y^3) , [ 1 -12] [ 0 1] @@ -6129,14 +6166,15 @@ def reduced_form(self, **kwds): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(x^5 + x - 3, # needs sage.rings.number_field + sage: K. = NumberField(x^5 + x - 3, ....: embedding=(x^5 + x - 3).roots(ring=CC)[0][0]) - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([12*x^3, 2334*w*y^3]) # needs sage.rings.number_field - sage: m = matrix(K, 2, 2, [-12,1,1,0]) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) + sage: f = DynamicalSystem_projective([12*x^3, 2334*w*y^3]) + sage: m = matrix(K, 2, 2, [-12,1,1,0]) sage: f = f.conjugate(m) - sage: f.reduced_form(smallest_coeffs=False) # needs sage.rings.number_field + sage: f.reduced_form(smallest_coeffs=False) ( Dynamical System of Projective Space of dimension 1 over Number Field in w with defining polynomial x^5 + x - 3 with w = 1.132997565885066? @@ -6323,12 +6361,13 @@ def _is_preperiodic(self, P, err=0.1, return_period=False): Check that :trac:`23814` is fixed (works even if domain is not specified):: + 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: K. = NumberField(X^2 + X - 1) + sage: P. = ProjectiveSpace(K,1) sage: f = DynamicalSystem_projective([x^2 - 2*y^2, y^2]) - sage: Q = P.point([a,1]) # needs sage.rings.number_field - sage: Q.is_preperiodic(f) # needs sage.rings.function_field sage.rings.number_field + sage: Q = P.point([a,1]) + sage: Q.is_preperiodic(f) # needs sage.rings.function_field True :: @@ -6353,13 +6392,14 @@ def _is_preperiodic(self, P, err=0.1, return_period=False): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(t^2 - t - 1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # needs sage.rings.number_field + sage: K. = NumberField(t^2 - t - 1) + sage: P. = ProjectiveSpace(K, 2) sage: X = P.subscheme(z) sage: f = DynamicalSystem([x^2 - y^2, y^2, z^2], domain=X) - sage: p = X((-a + 1, 1, 0)) # needs sage.rings.number_field - sage: f._is_preperiodic(p) # needs sage.rings.function_field sage.rings.number_field + sage: p = X((-a + 1, 1, 0)) + sage: f._is_preperiodic(p) # needs sage.rings.function_field True """ codomain = self.codomain() @@ -6462,22 +6502,24 @@ def postcritical_set(self, check=True): :: - sage: K. = QuadraticField(2) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(2) + sage: P. = ProjectiveSpace(K,1) sage: f = DynamicalSystem([x^2 + (-2)*y^2, y^2]) - sage: m = matrix(K, 2, 2, [v, 1, 0, 1]) # needs sage.rings.number_field - sage: g = f.conjugate(m) # needs sage.rings.number_field - sage: g.postcritical_set() # needs sage.rings.number_field + sage: m = matrix(K, 2, 2, [v, 1, 0, 1]) + sage: g = f.conjugate(m) + sage: g.postcritical_set() [(-3/2*a : 1), (1/2*a : 1), (1 : 0)] :: - sage: F. = FiniteField(9) # needs sage.rings.finite_rings - sage: P. = ProjectiveSpace(F, 1) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = FiniteField(9) + sage: P. = ProjectiveSpace(F, 1) sage: f = DynamicalSystem([x^2 + (-2)*y^2, y^2]) - sage: m = matrix(F, 2, 2, [z, 1, 0, 1]) # needs sage.rings.finite_rings - sage: g = f.conjugate(m) # needs sage.rings.finite_rings - sage: g.postcritical_set() # needs sage.rings.finite_rings + sage: m = matrix(F, 2, 2, [z, 1, 0, 1]) + sage: g = f.conjugate(m) + sage: g.postcritical_set() [(1 : 0), (0 : 1), (a + 2 : 1)] """ if not is_ProjectiveSpace(self.domain()): @@ -6539,7 +6581,8 @@ def is_chebyshev(self): sage: L. = CyclotomicField(4) sage: M = Matrix([[0,i],[-i,0]]) sage: F.conjugate(M) - Dynamical System of Projective Space of dimension 1 over Cyclotomic Field of order 4 and degree 2 + Dynamical System of Projective Space of dimension 1 over + Cyclotomic Field of order 4 and degree 2 Defn: Defined on coordinates by sending (x : y) to ((-i)*x^2 : (-i)*x^2 + (2*i)*y^2) sage: F.is_chebyshev() @@ -6650,7 +6693,7 @@ def is_Lattes(self): r""" Check if ``self`` is a Lattes map - OUTPUT: True if ``self`` is Lattes, False otherwise + OUTPUT: ``True`` if ``self`` is Lattes, ``False`` otherwise EXAMPLES:: @@ -6699,7 +6742,8 @@ def is_Lattes(self): sage: L. = CyclotomicField(4) sage: M = Matrix([[i, 0], [0, -i]]) sage: f.conjugate(M) - Dynamical System of Projective Space of dimension 1 over Cyclotomic Field of order 4 and degree 2 + Dynamical System of Projective Space of dimension 1 over + Cyclotomic Field of order 4 and degree 2 Defn: Defined on coordinates by sending (x : y) to ((-1/4*i)*x^4 + (-4*i)*x*y^3 : (-i)*x^3*y + (2*i)*y^4) sage: f.is_Lattes() @@ -6840,9 +6884,8 @@ def lift_to_rational_periodic(self, points_modp, B=None): sage: f.lift_to_rational_periodic([[P(0,1).change_ring(GF(7)), 4]]) # needs sage.symbolic [[(0 : 1), 2]] - :: + There may be multiple points in the lift. :: - There may be multiple points in the lift. sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([-5*x^2 + 4*y^2, 4*x*y]) sage: f.lift_to_rational_periodic([[P(1,0).change_ring(GF(3)), 1]]) # long time @@ -6862,7 +6905,7 @@ def lift_to_rational_periodic(self, points_modp, B=None): ....: + 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.lift_to_rational_periodic([[P(14,19,1).change_ring(GF(23)), 9]]) # long time + sage: f.lift_to_rational_periodic([[P(14,19,1).change_ring(GF(23)), 9]]) # long time [[(-9 : -4 : 1), 9]] """ if not points_modp: @@ -7101,20 +7144,22 @@ def all_periodic_points(self, **kwds): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(x^2 - x + 1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([u^2 + v^2, v^2]) # needs sage.rings.number_field - sage: sorted(f.all_periodic_points()) # needs sage.rings.function_field sage.rings.number_field + sage: K. = NumberField(x^2 - x + 1) + sage: P. = ProjectiveSpace(K,1) + sage: f = DynamicalSystem_projective([u^2 + v^2, v^2]) + sage: sorted(f.all_periodic_points()) # needs sage.rings.function_field [(-w + 1 : 1), (w : 1), (1 : 0)] :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(x^2 - x + 1) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([u^2 + v^2, u*v]) # needs sage.rings.number_field - sage: f.all_periodic_points() # needs sage.rings.function_field sage.rings.number_field + sage: K. = NumberField(x^2 - x + 1) + sage: P. = ProjectiveSpace(K,1) + sage: f = DynamicalSystem_projective([u^2 + v^2, u*v]) + sage: f.all_periodic_points() # needs sage.rings.function_field Traceback (most recent call last): ... NotImplementedError: rational periodic points for number fields @@ -7122,11 +7167,12 @@ def all_periodic_points(self, **kwds): :: + sage: # needs sage.rings.number_field sage: P. = ProjectiveSpace(QQ, 1) - sage: K. = QuadraticField(5) # needs sage.rings.number_field - sage: phi = QQ.embeddings(K)[0] # needs sage.rings.number_field + sage: K. = QuadraticField(5) + sage: phi = QQ.embeddings(K)[0] sage: f = DynamicalSystem_projective([x^2 - y^2, y^2]) - sage: sorted(f.all_periodic_points(R=phi)) # needs sage.rings.number_field + sage: sorted(f.all_periodic_points(R=phi)) [(-1 : 1), (-1/2*v + 1/2 : 1), (0 : 1), (1 : 0), (1/2*v + 1/2 : 1)] :: @@ -7332,11 +7378,12 @@ def all_rational_preimages(self, points): A number field example:: + sage: # needs sage.rings.number_field sage: z = QQ['z'].0 - sage: K. = NumberField(z^3 + (z^2)/4 - (41/16)*z + 23/64) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field + sage: K. = NumberField(z^3 + (z^2)/4 - (41/16)*z + 23/64) + sage: P. = ProjectiveSpace(K,1) sage: f = DynamicalSystem_projective([16*x^2 - 29*y^2, 16*y^2]) - sage: sorted(f.all_rational_preimages([P(16*w^2 - 29, 16)]), key=str) # needs sage.rings.number_field + sage: sorted(f.all_rational_preimages([P(16*w^2 - 29, 16)]), key=str) [(-w - 1/2 : 1), (-w : 1), (-w^2 + 21/16 : 1), @@ -7651,12 +7698,13 @@ def connected_rational_component(self, P, n=0): EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^3 + 1/4*x^2 - 41/16*x + 23/64) # needs sage.rings.number_field - sage: PS. = ProjectiveSpace(1,K) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 - 29/16*y^2, y^2]) # needs sage.rings.number_field - sage: P = PS([w,1]) # needs sage.rings.number_field - sage: sorted(f.connected_rational_component(P), key=str) # needs sage.rings.number_field + sage: K. = NumberField(x^3 + 1/4*x^2 - 41/16*x + 23/64) + sage: PS. = ProjectiveSpace(1,K) + sage: f = DynamicalSystem_projective([x^2 - 29/16*y^2, y^2]) + sage: P = PS([w,1]) + sage: sorted(f.connected_rational_component(P), key=str) [(-w - 1/2 : 1), (-w : 1), (-w^2 + 21/16 : 1), @@ -7781,11 +7829,12 @@ def conjugating_set(self, other, R=None, num_cpus=2): EXAMPLES:: + sage: # needs sage.rings.number_field sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 - 2*y^2, y^2]) - sage: m = matrix(QQbar, 2, 2, [-1, 3, 2, 1]) # needs sage.rings.number_field - sage: g = f.conjugate(m) # needs sage.rings.number_field - sage: f.conjugating_set(g) # needs sage.rings.number_field + sage: m = matrix(QQbar, 2, 2, [-1, 3, 2, 1]) + sage: g = f.conjugate(m) + sage: f.conjugating_set(g) [ [-1 3] [ 2 1] @@ -7867,11 +7916,12 @@ def conjugating_set(self, other, R=None, num_cpus=2): :: - sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: P. = ProjectiveSpace(QQbar, 1) sage: f = DynamicalSystem_projective([7*x + 12*y, 8*x]) sage: g = DynamicalSystem_projective([1645*x - 318*y, 8473*x - 1638*y]) - sage: m = f.conjugating_set(g)[0] # needs sage.rings.number_field - sage: f.conjugate(m) == g # needs sage.rings.number_field + sage: m = f.conjugating_set(g)[0] + sage: f.conjugate(m) == g True note that only one possible conjugation is returned:: @@ -7889,32 +7939,34 @@ def conjugating_set(self, other, R=None, num_cpus=2): :: - sage: L. = CyclotomicField(8) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(L, 2) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: L. = CyclotomicField(8) + sage: P. = ProjectiveSpace(L, 2) sage: f = DynamicalSystem_projective([2*x + 12*y, 11*y + 2*z, x + z]) - sage: m1 = matrix(L, 3, 3, [1,4,v^2,0,2,1,1,1,1]) # needs sage.rings.number_field + sage: m1 = matrix(L, 3, 3, [1,4,v^2,0,2,1,1,1,1]) sage: g = f.conjugate(m1) - sage: m = f.conjugating_set(g)[0] # long time # needs sage.rings.number_field - sage: f.conjugate(m) == g # long time # needs sage.rings.number_field + sage: m = f.conjugating_set(g)[0] # long time + sage: f.conjugate(m) == g # long time True TESTS: Make sure the caching problem is fixed, see #28070 :: - sage: K. = QuadraticField(-1) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(-1) sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem_projective([x^2 - 2*y^2, y^2]) sage: m = matrix(QQ, 2, 2, [-1, 3, 2, 1]) sage: g = f.conjugate(m) - sage: f.conjugating_set(g) # needs sage.rings.function_field sage.rings.number_field + sage: f.conjugating_set(g) # needs sage.rings.function_field [ [-1 3] [ 2 1] ] - sage: f = f.change_ring(K) # needs sage.rings.number_field - sage: g = g.change_ring(K) # needs sage.rings.number_field - sage: f.conjugating_set(g) # needs sage.rings.function_field sage.rings.number_field + sage: f = f.change_ring(K) + sage: g = g.change_ring(K) + sage: f.conjugating_set(g) # needs sage.rings.function_field [ [-1 3] [ 2 1] @@ -8046,12 +8098,13 @@ def is_conjugate(self, other, R=None, num_cpus=2): :: + sage: # needs sage.rings.number_field sage: set_verbose(None) - sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 + x*y, y^2]) # needs sage.rings.number_field - sage: m = matrix(QQbar, 2, 2, [1, 1, 2, 1]) # needs sage.rings.number_field - sage: g = f.conjugate(m) # needs sage.rings.number_field - sage: f.is_conjugate(g) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(QQbar, 1) + sage: f = DynamicalSystem_projective([x^2 + x*y, y^2]) + sage: m = matrix(QQbar, 2, 2, [1, 1, 2, 1]) + sage: g = f.conjugate(m) + sage: f.is_conjugate(g) True :: @@ -8081,10 +8134,11 @@ def is_conjugate(self, other, R=None, num_cpus=2): :: - sage: P. = ProjectiveSpace(QQbar, 1) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: P. = ProjectiveSpace(QQbar, 1) sage: f = DynamicalSystem_projective([7*x + 12*y, 8*x]) sage: g = DynamicalSystem_projective([1645*x - 318*y, 8473*x - 1638*y]) - sage: f.is_conjugate(g) # needs sage.rings.number_field + sage: f.is_conjugate(g) True Conjugation is only checked over the base field by default:: @@ -8126,16 +8180,17 @@ def is_conjugate(self, other, R=None, num_cpus=2): Make sure the caching problem is fixed, see #28070 :: - sage: K. = QuadraticField(5) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = QuadraticField(5) sage: P. = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem_projective([x^2 - 2*y^2, y^2]) sage: m = matrix(QQ, 2, 2, [-1, 3, 2, 1]) sage: g = f.conjugate(m) - sage: f.is_conjugate(g) # needs sage.rings.number_field + sage: f.is_conjugate(g) True - sage: f = f.change_ring(K) # needs sage.rings.number_field - sage: g = g.change_ring(K) # needs sage.rings.number_field - sage: f.is_conjugate(g) # needs sage.rings.number_field + sage: f = f.change_ring(K) + sage: g = g.change_ring(K) + sage: f.is_conjugate(g) True """ f = copy(self) @@ -8196,22 +8251,24 @@ def is_polynomial(self): EXAMPLES:: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = QuadraticField(7) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x**2 + 2*x*y - 5*y**2, 2*x*y]) # needs sage.rings.number_field - sage: f.is_polynomial() # needs sage.rings.number_field + sage: K. = QuadraticField(7) + sage: P. = ProjectiveSpace(K, 1) + sage: f = DynamicalSystem_projective([x**2 + 2*x*y - 5*y**2, 2*x*y]) + sage: f.is_polynomial() False :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = QuadraticField(7) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x**2 - 7*x*y, 2*y**2]) # needs sage.rings.number_field - sage: m = matrix(K, 2, 2, [w, 1, 0, 1]) # needs sage.rings.number_field - sage: f = f.conjugate(m) # needs sage.rings.number_field - sage: f.is_polynomial() # needs sage.rings.number_field + sage: K. = QuadraticField(7) + sage: P. = ProjectiveSpace(K, 1) + sage: f = DynamicalSystem_projective([x**2 - 7*x*y, 2*y**2]) + sage: m = matrix(K, 2, 2, [w, 1, 0, 1]) + sage: f = f.conjugate(m) + sage: f.is_polynomial() True :: @@ -8347,14 +8404,15 @@ def normal_form(self, return_conjugation=False): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(x^2 - 5) # needs sage.rings.number_field - sage: P. = ProjectiveSpace(K,1) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 + w*x*y, y^2]) # needs sage.rings.number_field - sage: g,m,psi = f.normal_form(return_conjugation=True); m # needs sage.rings.number_field + sage: K. = NumberField(x^2 - 5) + sage: P. = ProjectiveSpace(K,1) + sage: f = DynamicalSystem_projective([x^2 + w*x*y, y^2]) + sage: g,m,psi = f.normal_form(return_conjugation=True); m [ 1 -1/2*w] [ 0 1] - sage: f.change_ring(psi).conjugate(m) == g # needs sage.rings.number_field + sage: f.change_ring(psi).conjugate(m) == g True :: @@ -8552,11 +8610,12 @@ def potential_good_reduction(self, prime, return_conjugation=False): EXAMPLES:: + sage: # needs sage.rings.number_field sage: P. = ProjectiveSpace(QQ, 1) sage: system = DynamicalSystem_projective([x^2 - y^2, 2*x*y]) - sage: prime = system.field_of_definition_periodic(1).prime_above(2) # needs sage.rings.number_field - sage: new_system = system.potential_good_reduction(prime)[1] # needs sage.rings.number_field - sage: new_system # needs sage.rings.number_field + sage: prime = system.field_of_definition_periodic(1).prime_above(2) + sage: new_system = system.potential_good_reduction(prime)[1] + sage: new_system Dynamical System of Projective Space of dimension 1 over Number Field in a with defining polynomial x^2 + 1 Defn: Defined on coordinates by sending (x : y) to @@ -8596,12 +8655,13 @@ def potential_good_reduction(self, prime, return_conjugation=False): TESTS:: + sage: # needs sage.rings.number_field sage: P. = ProjectiveSpace(QQ, 1) sage: R. = QQ[] - sage: A. = NumberField(z^2 + 1) # needs sage.rings.number_field - sage: prime = A.prime_above(2) # needs sage.rings.number_field + sage: A. = NumberField(z^2 + 1) + sage: prime = A.prime_above(2) sage: system = DynamicalSystem_projective([x^2 - y^2, 2*x*y]) - sage: system.potential_good_reduction(prime) # needs sage.rings.number_field + sage: system.potential_good_reduction(prime) (True, Dynamical System of Projective Space of dimension 1 over Number Field in a with defining polynomial x^2 + 1 @@ -8618,12 +8678,13 @@ def potential_good_reduction(self, prime, return_conjugation=False): :: + sage: # needs sage.rings.number_field sage: P. = ProjectiveSpace(QQ, 1) sage: system = DynamicalSystem_projective([x**5 - 11*y**5, x**4*y]) - sage: B, new_sys, conj = system.potential_good_reduction(11, True) # needs sage.rings.number_field - sage: system.conjugate(conj).resultant() == 1 # needs sage.rings.number_field + sage: B, new_sys, conj = system.potential_good_reduction(11, True) + sage: system.conjugate(conj).resultant() == 1 True - sage: system.conjugate(conj) == new_sys # needs sage.rings.number_field + sage: system.conjugate(conj) == new_sys True :: @@ -8736,10 +8797,11 @@ def reduce_base_field(self): :: - sage: P. = ProjectiveSpace(QQbar, 2) # needs sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2 + QQbar(sqrt(3))*y^2, # needs sage.rings.number_field sage.symbolic + sage: # needs sage.rings.number_field sage.symbolic + sage: P. = ProjectiveSpace(QQbar, 2) + sage: f = DynamicalSystem_projective([x^2 + QQbar(sqrt(3))*y^2, ....: y^2, QQbar(sqrt(2))*z^2]) - sage: f.reduce_base_field() # needs sage.rings.number_field sage.symbolic + sage: f.reduce_base_field() Dynamical System of Projective Space of dimension 2 over Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a = -0.5176380902050415? Defn: Defined on coordinates by sending (x : y : z) to @@ -8747,15 +8809,16 @@ def reduce_base_field(self): :: + sage: # needs sage.rings.number_field sage: R. = QQ[] - sage: K. = NumberField(x^3 - 2, embedding=(x^3 - 2).roots(ring=CC)[0][0]) # needs sage.rings.number_field + sage: K. = NumberField(x^3 - 2, embedding=(x^3 - 2).roots(ring=CC)[0][0]) sage: R. = QQ[] - sage: L. = NumberField(x^6 + 9*x^4 - 4*x^3 + 27*x^2 + 36*x + 31, # needs sage.rings.number_field + sage: L. = NumberField(x^6 + 9*x^4 - 4*x^3 + 27*x^2 + 36*x + 31, ....: embedding=(x^6 + 9*x^4 - 4*x^3 ....: + 27*x^2 + 36*x + 31).roots(ring=CC)[0][0]) - sage: P. = ProjectiveSpace(L,1) # needs sage.rings.number_field - sage: f = DynamicalSystem([L(v)*x^2 + y^2, x*y]) # needs sage.rings.number_field - sage: f.reduce_base_field().base_ring().is_isomorphic(K) # needs sage.rings.number_field + sage: P. = ProjectiveSpace(L,1) + sage: f = DynamicalSystem([L(v)*x^2 + y^2, x*y]) + sage: f.reduce_base_field().base_ring().is_isomorphic(K) True :: @@ -8825,11 +8888,12 @@ def is_newton(self, return_conjugation=False): :: - sage: K. = CyclotomicField(2*4) # needs sage.rings.number_field - sage: A. = AffineSpace(K, 1) # needs sage.rings.number_field - sage: f = DynamicalSystem_affine(z-(z^3+zeta*z)/(3*z^2+zeta)) # needs sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = CyclotomicField(2*4) + sage: A. = AffineSpace(K, 1) + sage: f = DynamicalSystem_affine(z-(z^3+zeta*z)/(3*z^2+zeta)) sage: F = f.homogenize(1) - sage: F.is_newton() # needs sage.rings.number_field + sage: F.is_newton() True """ if self.degree() == 1: @@ -8978,10 +9042,11 @@ def orbit_structure(self, P): :: - sage: R. = GF(13^3) # needs sage.rings.finite_rings - sage: P. = ProjectiveSpace(R,1) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = GF(13^3) + sage: P. = ProjectiveSpace(R,1) sage: f = DynamicalSystem_projective([x^2 - y^2, y^2], domain=P) - sage: f.orbit_structure(P(t, 4)) # needs sage.rings.finite_rings + sage: f.orbit_structure(P(t, 4)) (11, 6) """ orbit = [] @@ -9016,6 +9081,7 @@ def cyclegraph(self): :: + sage: needs sage.rings.finite_rings sage: P. = ProjectiveSpace(GF(3^2,'t'),2) # needs sage.rings.finite_rings sage: f = DynamicalSystem_projective([x^2 + y^2, y^2, z^2 + y*z]) # needs sage.rings.finite_rings sage: f.cyclegraph() # needs sage.graphs sage.rings.finite_rings @@ -9165,9 +9231,10 @@ def automorphism_group(self, **kwds): EXAMPLES:: - sage: R. = ProjectiveSpace(GF(7^3,'t'),1) # needs sage.rings.finite_rings - sage: f = DynamicalSystem_projective([x^2 - y^2, x*y]) # needs sage.rings.finite_rings - sage: f.automorphism_group() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = ProjectiveSpace(GF(7^3,'t'),1) + sage: f = DynamicalSystem_projective([x^2 - y^2, x*y]) + sage: f.automorphism_group() [ [1 0] [6 0] [0 1], [0 1] @@ -9180,7 +9247,7 @@ def automorphism_group(self, **kwds): sage: f = DynamicalSystem_projective([x^3, y^3]) sage: lst, label = f.automorphism_group(return_functions=True, # long time ....: iso_type=True) - sage: sorted(lst, key=str), label # long time + sage: sorted(lst, key=str), label # long time ([(2*x + 1)/(x + 1), (2*x + 1)/x, (2*x + 2)/(x + 2), @@ -9209,16 +9276,18 @@ def automorphism_group(self, **kwds): :: - sage: R. = ProjectiveSpace(GF(2^5,'t'),1) # needs sage.rings.finite_rings - sage: f = DynamicalSystem_projective([x^5, y^5]) # needs sage.rings.finite_rings - sage: f.automorphism_group(return_functions=True, iso_type=True) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = ProjectiveSpace(GF(2^5,'t'),1) + sage: f = DynamicalSystem_projective([x^5, y^5]) + sage: f.automorphism_group(return_functions=True, iso_type=True) ([x, 1/x], 'Cyclic of order 2') :: - sage: R. = ProjectiveSpace(GF(3^4,'t'),1) # needs sage.rings.finite_rings - sage: f = DynamicalSystem_projective([x^2 + 25*x*y + y^2, x*y + 3*y^2]) # needs sage.rings.finite_rings - sage: f.automorphism_group(absolute=True) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = ProjectiveSpace(GF(3^4,'t'),1) + sage: f = DynamicalSystem_projective([x^2 + 25*x*y + y^2, x*y + 3*y^2]) + sage: f.automorphism_group(absolute=True) [Univariate Polynomial Ring in w over Finite Field in b of size 3^4, [ [1 0] @@ -9265,9 +9334,10 @@ def all_periodic_points(self, **kwds): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(5^2),1) # needs sage.rings.finite_rings - sage: f = DynamicalSystem_projective([x^2 + y^2, x*y]) # needs sage.rings.finite_rings - sage: f.all_periodic_points() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(5^2),1) + sage: f = DynamicalSystem_projective([x^2 + y^2, x*y]) + sage: f.all_periodic_points() [(1 : 0), (z2 + 2 : 1), (4*z2 + 3 : 1)] :: @@ -9276,12 +9346,12 @@ def all_periodic_points(self, **kwds): sage: f = DynamicalSystem_projective([x^2 + y^2 + z^2, x*y + x*z, z^2]) sage: f.all_periodic_points() [(1 : 0 : 0), - (0 : 0 : 1), - (1 : 0 : 1), - (2 : 1 : 1), - (1 : 4 : 1), - (3 : 0 : 1), - (0 : 3 : 1)] + (0 : 0 : 1), + (1 : 0 : 1), + (2 : 1 : 1), + (1 : 4 : 1), + (3 : 0 : 1), + (0 : 3 : 1)] :: From 869d776fa9bf616f319e987a86be87083eed1303 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 1 Oct 2023 10:32:46 -0700 Subject: [PATCH 30/32] src/sage/dynamics/arithmetic_dynamics/wehlerK3.py: update error messages, docstring cosmetics --- .../dynamics/arithmetic_dynamics/wehlerK3.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py b/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py index 72676c1ad2a..97d77991e34 100644 --- a/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py +++ b/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py @@ -336,8 +336,8 @@ def Gpoly(self, component, k): They are defined as: `G^*_k = \left(L^*_j\right)^2Q^*_{ii}-L^*_iL^*_jQ^*_{ij}+\left(L^*_i\right)^2Q^*_{jj}` - where {i, j, k} is some permutation of (0, 1, 2) and * is either - x (``component=1``) or y (``component=0``). + where `(i, j, k)` is some permutation of `(0, 1, 2)` and `*` is either + `x` (``component=1``) or `y` (``component=0``). INPUT: @@ -345,7 +345,7 @@ def Gpoly(self, component, k): - ``k`` -- Integer: 0, 1 or 2 - OUTPUT: polynomial in terms of either y (``component=0``) or x (``component=1``) + OUTPUT: polynomial in terms of either `y` (``component=0``) or `x` (``component=1``) EXAMPLES:: @@ -875,11 +875,11 @@ def degenerate_fibers(self): return [xFibers,yFibers] @cached_method - def degenerate_primes(self,check=True): + def degenerate_primes(self, check=True): r""" - Determine which primes `p` self has degenerate fibers over `GF(p)`. + Determine which primes `p` self has degenerate fibers over `\GF{p}`. - If check is False, then may return primes that do not have degenerate fibers. + If ``check`` is ``False``, then may return primes that do not have degenerate fibers. Raises an error if the surface is degenerate. Works only for ``ZZ`` or ``QQ``. @@ -888,15 +888,15 @@ def degenerate_primes(self,check=True): ALGORITHM: `p` is a prime of bad reduction if and only if the defining - polynomials of self plus the G and H polynomials have a common + polynomials of ``self`` plus the G and H polynomials have a common zero. Or stated another way, `p` is a prime of bad reduction if and only if the radical of the ideal defined by the defining - polynomials of self plus the G and H polynomials is not + polynomials of ``self`` plus the G and H polynomials is not `(x_0,x_1,\ldots,x_N)`. This happens if and only if some power of each `x_i` is not in the ideal defined by the - defining polynomials of self (with G and H). This last condition + defining polynomials of ``self`` (with G and H). This last condition is what is checked. The lcm of the coefficients of the monomials `x_i` in - a groebner basis is computed. This may return extra primes. + a Groebner basis is computed. This may return extra primes. OUTPUT: List of primes. @@ -915,9 +915,9 @@ def degenerate_primes(self,check=True): PP = self.ambient_space() if PP.base_ring() != ZZ and PP.base_ring() != QQ: if PP.base_ring() in _NumberFields or isinstance(PP.base_ring(), sage.rings.abc.Order): - raise NotImplementedError("must be ZZ or QQ") + raise NotImplementedError("only implemented for ZZ and QQ") else: - raise TypeError("must be over a number field") + raise TypeError("must be over a number field or number field order") if self.is_degenerate(): raise TypeError("surface is degenerate at all primes") RR = PP.coordinate_ring() From 1b873b9ec91c4f6422cd8173f0222be4163b5e24 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 1 Oct 2023 10:38:39 -0700 Subject: [PATCH 31/32] src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py: Docstring cosmetics --- .../hyperelliptic_curves/monsky_washnitzer.py | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py b/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py index c8683230212..f8c8f847350 100644 --- a/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py +++ b/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py @@ -684,11 +684,11 @@ def transpose_list(input): def helper_matrix(Q): - """ + r""" Compute the (constant) matrix used to calculate the linear combinations of the `d(x^i y^j)` needed to eliminate the - negative powers of `y` in the cohomology (i.e. in - reduce_negative()). + negative powers of `y` in the cohomology (i.e., in + :func:`reduce_negative`). INPUT: @@ -722,14 +722,14 @@ def helper_matrix(Q): def lift(x): r""" - Try to call ``x.lift()``, presumably from the `p`-adics to ``ZZ``. + Try to call ``x.lift()``, presumably from the `p`-adics to `\ZZ`. If this fails, it assumes the input is a power series, and tries to - lift it to a power series over ``QQ``. + lift it to a power series over `\QQ`. This function is just a very kludgy solution to the problem of - trying to make the reduction code (below) work over both Zp and - Zp[[t]]. + trying to make the reduction code (below) work over both `\ZZ_p` and + `\ZZ_p[[t]]`. EXAMPLES:: @@ -763,7 +763,7 @@ def reduce_negative(Q, p, coeffs, offset, exact_form=None): - ``Q`` -- cubic polynomial - ``coeffs`` -- list of length 3 lists. The - `i^{th}` list [a, b, c] represents + `i`-th list ``[a, b, c]`` represents `y^{2(i - offset)} (a + bx + cx^2) dx/y`. - ``offset`` -- nonnegative integer @@ -866,7 +866,7 @@ def reduce_positive(Q, p, coeffs, offset, exact_form=None): - ``Q`` -- cubic polynomial - ``coeffs`` -- list of length 3 lists. The - `i^{th}` list [a, b, c] represents + `i`-th list [a, b, c] represents `y^{2(i - offset)} (a + bx + cx^2) dx/y`. - ``offset`` -- nonnegative integer @@ -960,7 +960,7 @@ def reduce_zero(Q, coeffs, offset, exact_form=None): - ``Q`` -- cubic polynomial - ``coeffs`` -- list of length 3 lists. The - `i^{th}` list [a, b, c] represents + `i`-th list [a, b, c] represents `y^{2(i - offset)} (a + bx + cx^2) dx/y`. - ``offset`` -- nonnegative integer @@ -1012,7 +1012,7 @@ def reduce_all(Q, p, coeffs, offset, compute_exact_form=False): - ``Q`` -- cubic polynomial - ``coeffs`` -- list of length 3 lists. The - `i^{th}` list [a, b, c] represents + `i`-th list [a, b, c] represents `y^{2(i - offset)} (a + bx + cx^2) dx/y`. - ``offset`` -- nonnegative integer @@ -1088,7 +1088,7 @@ def frobenius_expansion_by_newton(Q, p, M): coefficient ring of `Q`.) `F_0` and `F_1` are computed in the - SpecialCubicQuotientRing associated to `Q`, so all powers + :class:`SpecialCubicQuotientRing` associated to `Q`, so all powers of `x^j` for `j \geq 3` are reduced to powers of `T`. @@ -1106,7 +1106,7 @@ def frobenius_expansion_by_newton(Q, p, M): OUTPUT: - ``F0, F1`` -- elements of - SpecialCubicQuotientRing(Q), as described above + ``SpecialCubicQuotientRing(Q)``, as described above - ``r`` -- non-negative integer, as described above @@ -1261,7 +1261,7 @@ def frobenius_expansion_by_series(Q, p, M): and `R` is the coefficient ring of `Q`.) `F_0` and `F_1` are computed in the - SpecialCubicQuotientRing associated to `Q`, so all powers + :class:`SpecialCubicQuotientRing` associated to `Q`, so all powers of `x^j` for `j \geq 3` are reduced to powers of `T`. @@ -1294,7 +1294,7 @@ def frobenius_expansion_by_series(Q, p, M): OUTPUT: - ``F0, F1`` -- elements of - SpecialCubicQuotientRing(Q), as described above + ``SpecialCubicQuotientRing(Q)``, as described above - ``r`` -- non-negative integer, as described above From ba0a3d7d2b6c0b22359748ed844ea9a9aee3fd07 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 1 Oct 2023 15:29:30 -0700 Subject: [PATCH 32/32] src/sage/dynamics/arithmetic_dynamics/projective_ds.py: Fixup --- src/sage/dynamics/arithmetic_dynamics/projective_ds.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index 6625f1bd92b..f087ce16649 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -9081,10 +9081,10 @@ def cyclegraph(self): :: - sage: needs sage.rings.finite_rings - sage: P. = ProjectiveSpace(GF(3^2,'t'),2) # needs sage.rings.finite_rings - sage: f = DynamicalSystem_projective([x^2 + y^2, y^2, z^2 + y*z]) # needs sage.rings.finite_rings - sage: f.cyclegraph() # needs sage.graphs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(3^2,'t'),2) + sage: f = DynamicalSystem_projective([x^2 + y^2, y^2, z^2 + y*z]) + sage: f.cyclegraph() # needs sage.graphs Looped digraph on 91 vertices ::