= 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 035/185] 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 036/185] 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 037/185] 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 038/185] 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 039/185] 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 040/185] 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.