Skip to content

Commit 6afeae8

Browse files
author
Release Manager
committed
gh-36271: `sage.{dynamics,schemes}`: Modularization fixes, docstring cosmetics, update `# needs` <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> - Part of: #29705 - Cherry-picked from: #35095 <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [ ] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #36271 Reported by: Matthias Köppe Reviewer(s): David Coudert, Matthias Köppe
2 parents b42b381 + 7033d7d commit 6afeae8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1530
-1262
lines changed

src/sage/dynamics/arithmetic_dynamics/affine_ds.py

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,9 @@ class DynamicalSystem_affine(SchemeMorphism_polynomial_affine_space,
162162
163163
If you pass in quotient ring elements, they are reduced::
164164
165+
sage: # needs sage.libs.singular
165166
sage: A.<x,y,z> = AffineSpace(QQ, 3)
166-
sage: X = A.subscheme([x-y])
167+
sage: X = A.subscheme([x - y])
167168
sage: u,v,w = X.coordinate_ring().gens()
168169
sage: DynamicalSystem_affine([u, v, u+v], domain=X)
169170
Dynamical System of Closed subscheme of Affine Space of dimension 3
@@ -174,9 +175,10 @@ class DynamicalSystem_affine(SchemeMorphism_polynomial_affine_space,
174175
175176
::
176177
178+
sage: # needs sage.libs.singular
177179
sage: R.<t> = PolynomialRing(QQ)
178180
sage: A.<x,y,z> = AffineSpace(R, 3)
179-
sage: X = A.subscheme(x^2-y^2)
181+
sage: X = A.subscheme(x^2 - y^2)
180182
sage: H = End(X)
181183
sage: f = H([x^2/(t*y), t*y^2, x*z])
182184
sage: DynamicalSystem_affine(f)
@@ -188,8 +190,8 @@ class DynamicalSystem_affine(SchemeMorphism_polynomial_affine_space,
188190
189191
::
190192
191-
sage: x = var('x')
192-
sage: DynamicalSystem_affine(x^2+1)
193+
sage: x = var('x') # needs sage.symbolic
194+
sage: DynamicalSystem_affine(x^2 + 1) # needs sage.symbolic
193195
Traceback (most recent call last):
194196
...
195197
TypeError: symbolic ring cannot be the base ring
@@ -397,10 +399,11 @@ def homogenize(self, n):
397399
398400
::
399401
402+
sage: # needs sage.rings.number_field
400403
sage: R.<a> = PolynomialRing(QQbar)
401404
sage: A.<x,y> = AffineSpace(R, 2)
402-
sage: f = DynamicalSystem_affine([QQbar(sqrt(2))*x*y, a*x^2])
403-
sage: f.homogenize(2)
405+
sage: f = DynamicalSystem_affine([QQbar(sqrt(2))*x*y, a*x^2]) # needs sage.symbolic
406+
sage: f.homogenize(2) # needs sage.symbolic
404407
Dynamical System of Projective Space of dimension 2 over Univariate
405408
Polynomial Ring in a over Algebraic Field
406409
Defn: Defined on coordinates by sending (x0 : x1 : x2) to
@@ -453,7 +456,7 @@ def dynatomic_polynomial(self, period):
453456
454457
sage: A.<x> = AffineSpace(ZZ, 1)
455458
sage: f = DynamicalSystem_affine([(x^2+1)/x])
456-
sage: f.dynatomic_polynomial(4)
459+
sage: f.dynatomic_polynomial(4) # needs sage.libs.pari
457460
2*x^12 + 18*x^10 + 57*x^8 + 79*x^6 + 48*x^4 + 12*x^2 + 1
458461
459462
::
@@ -507,8 +510,8 @@ def dynatomic_polynomial(self, period):
507510
::
508511
509512
sage: A.<x> = AffineSpace(CC,1)
510-
sage: F = DynamicalSystem_affine([1/2*x^2 + CC(sqrt(3))])
511-
sage: F.dynatomic_polynomial([1,1])
513+
sage: F = DynamicalSystem_affine([1/2*x^2 + CC(sqrt(3))]) # needs sage.symbolic
514+
sage: F.dynatomic_polynomial([1,1]) # needs sage.symbolic
512515
(0.125000000000000*x^4 + 0.366025403784439*x^2 + 1.50000000000000)/(0.500000000000000*x^2 - x + 1.73205080756888)
513516
514517
TESTS::
@@ -770,7 +773,7 @@ def multiplier(self, P, n, check=True):
770773
771774
sage: P.<x> = AffineSpace(CC, 1)
772775
sage: f = DynamicalSystem_affine([x^2 + 1/2])
773-
sage: f.multiplier(P([0.5 + 0.5*I]), 1)
776+
sage: f.multiplier(P([0.5 + 0.5*I]), 1) # needs sage.symbolic
774777
[1.00000000000000 + 1.00000000000000*I]
775778
776779
::
@@ -784,7 +787,7 @@ def multiplier(self, P, n, check=True):
784787
::
785788
786789
sage: P.<x,y> = AffineSpace(QQ, 2)
787-
sage: X = P.subscheme([x^2-y^2])
790+
sage: X = P.subscheme([x^2 - y^2])
788791
sage: f = DynamicalSystem_affine([x^2, y^2], domain=X)
789792
sage: f.multiplier(X([1, 1]), 1)
790793
[2 0]
@@ -823,7 +826,7 @@ def conjugate(self, M):
823826
EXAMPLES::
824827
825828
sage: A.<t> = AffineSpace(QQ, 1)
826-
sage: f = DynamicalSystem_affine([t^2+1])
829+
sage: f = DynamicalSystem_affine([t^2 + 1])
827830
sage: f.conjugate(matrix([[1,2], [0,1]]))
828831
Dynamical System of Affine Space of dimension 1 over Rational Field
829832
Defn: Defined on coordinates by sending (t) to
@@ -832,18 +835,20 @@ def conjugate(self, M):
832835
::
833836
834837
sage: A.<x,y> = AffineSpace(ZZ,2)
835-
sage: f = DynamicalSystem_affine([x^3+y^3,y^2])
838+
sage: f = DynamicalSystem_affine([x^3 + y^3, y^2])
836839
sage: f.conjugate(matrix([[1,2,3], [0,1,2], [0,0,1]]))
837840
Dynamical System of Affine Space of dimension 2 over Integer Ring
838841
Defn: Defined on coordinates by sending (x, y) to
839-
(x^3 + 6*x^2*y + 12*x*y^2 + 9*y^3 + 9*x^2 + 36*x*y + 40*y^2 + 27*x + 58*y + 28, y^2 + 4*y + 2)
842+
(x^3 + 6*x^2*y + 12*x*y^2 + 9*y^3
843+
+ 9*x^2 + 36*x*y + 40*y^2 + 27*x + 58*y + 28, y^2 + 4*y + 2)
840844
841845
::
842846
847+
sage: # needs sage.rings.number_field
843848
sage: R.<x> = PolynomialRing(QQ)
844-
sage: K.<i> = NumberField(x^2+1)
849+
sage: K.<i> = NumberField(x^2 + 1)
845850
sage: A.<x> = AffineSpace(ZZ,1)
846-
sage: f = DynamicalSystem_affine([x^3+2*x^2+3])
851+
sage: f = DynamicalSystem_affine([x^3 + 2*x^2 + 3])
847852
sage: f.conjugate(matrix([[i,i], [0,-i]]))
848853
Dynamical System of Affine Space of dimension 1 over Integer Ring
849854
Defn: Defined on coordinates by sending (x) to
@@ -860,6 +865,7 @@ def degree(self):
860865
861866
EXAMPLES::
862867
868+
sage: # needs sage.rings.number_field
863869
sage: R.<c> = QuadraticField(7)
864870
sage: A.<x,y,z> = AffineSpace(R, 3)
865871
sage: f = DynamicalSystem_affine([x^2 + y^5 + c, x^11, z^19])
@@ -911,16 +917,18 @@ def weil_restriction(self):
911917
912918
EXAMPLES::
913919
920+
sage: # needs sage.rings.number_field
914921
sage: K.<v> = QuadraticField(5)
915922
sage: A.<x,y> = AffineSpace(K, 2)
916-
sage: f = DynamicalSystem_affine([x^2-y^2, y^2])
923+
sage: f = DynamicalSystem_affine([x^2 - y^2, y^2])
917924
sage: f.weil_restriction()
918925
Dynamical System of Affine Space of dimension 4 over Rational Field
919926
Defn: Defined on coordinates by sending (z0, z1, z2, z3) to
920927
(z0^2 + 5*z1^2 - z2^2 - 5*z3^2, 2*z0*z1 - 2*z2*z3, z2^2 + 5*z3^2, 2*z2*z3)
921928
922929
::
923930
931+
sage: # needs sage.rings.number_field
924932
sage: K.<v> = QuadraticField(5)
925933
sage: PS.<x,y> = AffineSpace(K, 2)
926934
sage: f = DynamicalSystem_affine([x, y])
@@ -940,13 +948,14 @@ def reduce_base_field(self):
940948
The base field of the map could be strictly larger than
941949
the field where all of the coefficients are defined. This function
942950
reduces the base field to the minimal possible. This can be done when
943-
the base ring is a number field, QQbar, a finite field, or algebraic
951+
the base ring is a number field, ``QQbar``, a finite field, or algebraic
944952
closure of a finite field.
945953
946954
OUTPUT: A dynamical system
947955
948956
EXAMPLES::
949957
958+
sage: # needs sage.rings.finite_rings
950959
sage: K.<t> = GF(5^2)
951960
sage: A.<x,y> = AffineSpace(K, 2)
952961
sage: f = DynamicalSystem_affine([x^2 + 3*y^2, 3*y^2])
@@ -957,15 +966,20 @@ def reduce_base_field(self):
957966
958967
::
959968
969+
sage: # needs sage.rings.number_field sage.symbolic
960970
sage: A.<x,y> = AffineSpace(QQbar, 2)
961-
sage: f = DynamicalSystem_affine([x^2 + QQbar(sqrt(3))*y^2, QQbar(sqrt(-1))*y^2])
971+
sage: f = DynamicalSystem_affine([x^2 + QQbar(sqrt(3))*y^2,
972+
....: QQbar(sqrt(-1))*y^2])
962973
sage: f.reduce_base_field()
963-
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
974+
Dynamical System of Affine Space of dimension 2 over Number Field in a
975+
with defining polynomial y^4 - y^2 + 1
976+
with a = -0.866025403784439? + 0.50000000000000000?*I
964977
Defn: Defined on coordinates by sending (x, y) to
965978
(x^2 + (a^3 - 2*a)*y^2, (a^3)*y^2)
966979
967980
::
968981
982+
sage: # needs sage.rings.number_field
969983
sage: K.<v> = CyclotomicField(5)
970984
sage: A.<x,y> = AffineSpace(K, 2)
971985
sage: f = DynamicalSystem_affine([(3*x^2 + y) / (5*x), (y^2+1) / (x+y)])
@@ -1001,6 +1015,7 @@ def orbit_structure(self, P):
10011015
10021016
::
10031017
1018+
sage: # needs sage.rings.finite_rings
10041019
sage: A.<x,y,z> = AffineSpace(GF(49, 't'), 3)
10051020
sage: f = DynamicalSystem_affine([x^2 - z, x - y + z, y^2 - x^2])
10061021
sage: f.orbit_structure(A(1, 1, 2))
@@ -1028,23 +1043,24 @@ def cyclegraph(self):
10281043
EXAMPLES::
10291044
10301045
sage: P.<x,y> = AffineSpace(GF(5), 2)
1031-
sage: f = DynamicalSystem_affine([x^2-y, x*y+1])
1032-
sage: f.cyclegraph()
1046+
sage: f = DynamicalSystem_affine([x^2 - y, x*y + 1])
1047+
sage: f.cyclegraph() # needs sage.graphs
10331048
Looped digraph on 25 vertices
10341049
10351050
::
10361051
1052+
sage: # needs sage.rings.finite_rings
10371053
sage: P.<x> = AffineSpace(GF(3^3, 't'), 1)
1038-
sage: f = DynamicalSystem_affine([x^2-1])
1039-
sage: f.cyclegraph()
1054+
sage: f = DynamicalSystem_affine([x^2 - 1])
1055+
sage: f.cyclegraph() # needs sage.graphs
10401056
Looped digraph on 27 vertices
10411057
10421058
::
10431059
10441060
sage: P.<x,y> = AffineSpace(GF(7), 2)
1045-
sage: X = P.subscheme(x-y)
1061+
sage: X = P.subscheme(x - y)
10461062
sage: f = DynamicalSystem_affine([x^2, y^2], domain=X)
1047-
sage: f.cyclegraph()
1063+
sage: f.cyclegraph() # needs sage.graphs
10481064
Looped digraph on 7 vertices
10491065
"""
10501066
V = []

0 commit comments

Comments
 (0)