Skip to content

Commit

Permalink
sagemathgh-36271: sage.{dynamics,schemes}: Modularization fixes, do…
Browse files Browse the repository at this point in the history
…cstring 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 sagemath#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 sagemath#12345". -->
- Part of: sagemath#29705
- Cherry-picked from: sagemath#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
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36271
Reported by: Matthias Köppe
Reviewer(s): David Coudert, Matthias Köppe
  • Loading branch information
Release Manager committed Oct 29, 2023
2 parents 6bb8c4d + 7033d7d commit 8d91ee0
Show file tree
Hide file tree
Showing 49 changed files with 1,530 additions and 1,262 deletions.
68 changes: 42 additions & 26 deletions src/sage/dynamics/arithmetic_dynamics/affine_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,9 @@ class DynamicalSystem_affine(SchemeMorphism_polynomial_affine_space,
If you pass in quotient ring elements, they are reduced::
sage: # needs sage.libs.singular
sage: A.<x,y,z> = AffineSpace(QQ, 3)
sage: X = A.subscheme([x-y])
sage: X = A.subscheme([x - y])
sage: u,v,w = X.coordinate_ring().gens()
sage: DynamicalSystem_affine([u, v, u+v], domain=X)
Dynamical System of Closed subscheme of Affine Space of dimension 3
Expand All @@ -174,9 +175,10 @@ class DynamicalSystem_affine(SchemeMorphism_polynomial_affine_space,
::
sage: # needs sage.libs.singular
sage: R.<t> = PolynomialRing(QQ)
sage: A.<x,y,z> = AffineSpace(R, 3)
sage: X = A.subscheme(x^2-y^2)
sage: X = A.subscheme(x^2 - y^2)
sage: H = End(X)
sage: f = H([x^2/(t*y), t*y^2, x*z])
sage: DynamicalSystem_affine(f)
Expand All @@ -188,8 +190,8 @@ class DynamicalSystem_affine(SchemeMorphism_polynomial_affine_space,
::
sage: x = var('x')
sage: DynamicalSystem_affine(x^2+1)
sage: x = var('x') # needs sage.symbolic
sage: DynamicalSystem_affine(x^2 + 1) # needs sage.symbolic
Traceback (most recent call last):
...
TypeError: symbolic ring cannot be the base ring
Expand Down Expand Up @@ -397,10 +399,11 @@ def homogenize(self, n):
::
sage: # needs sage.rings.number_field
sage: R.<a> = PolynomialRing(QQbar)
sage: A.<x,y> = AffineSpace(R, 2)
sage: f = DynamicalSystem_affine([QQbar(sqrt(2))*x*y, a*x^2])
sage: f.homogenize(2)
sage: f = DynamicalSystem_affine([QQbar(sqrt(2))*x*y, a*x^2]) # needs sage.symbolic
sage: f.homogenize(2) # needs sage.symbolic
Dynamical System of Projective Space of dimension 2 over Univariate
Polynomial Ring in a over Algebraic Field
Defn: Defined on coordinates by sending (x0 : x1 : x2) to
Expand Down Expand Up @@ -453,7 +456,7 @@ def dynatomic_polynomial(self, period):
sage: A.<x> = AffineSpace(ZZ, 1)
sage: f = DynamicalSystem_affine([(x^2+1)/x])
sage: f.dynatomic_polynomial(4)
sage: f.dynatomic_polynomial(4) # needs sage.libs.pari
2*x^12 + 18*x^10 + 57*x^8 + 79*x^6 + 48*x^4 + 12*x^2 + 1
::
Expand Down Expand Up @@ -507,8 +510,8 @@ def dynatomic_polynomial(self, period):
::
sage: A.<x> = 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))]) # needs sage.symbolic
sage: F.dynatomic_polynomial([1,1]) # needs sage.symbolic
(0.125000000000000*x^4 + 0.366025403784439*x^2 + 1.50000000000000)/(0.500000000000000*x^2 - x + 1.73205080756888)
TESTS::
Expand Down Expand Up @@ -770,7 +773,7 @@ def multiplier(self, P, n, check=True):
sage: P.<x> = AffineSpace(CC, 1)
sage: f = DynamicalSystem_affine([x^2 + 1/2])
sage: f.multiplier(P([0.5 + 0.5*I]), 1)
sage: f.multiplier(P([0.5 + 0.5*I]), 1) # needs sage.symbolic
[1.00000000000000 + 1.00000000000000*I]
::
Expand All @@ -784,7 +787,7 @@ def multiplier(self, P, n, check=True):
::
sage: P.<x,y> = AffineSpace(QQ, 2)
sage: X = P.subscheme([x^2-y^2])
sage: X = P.subscheme([x^2 - y^2])
sage: f = DynamicalSystem_affine([x^2, y^2], domain=X)
sage: f.multiplier(X([1, 1]), 1)
[2 0]
Expand Down Expand Up @@ -823,7 +826,7 @@ def conjugate(self, M):
EXAMPLES::
sage: A.<t> = AffineSpace(QQ, 1)
sage: f = DynamicalSystem_affine([t^2+1])
sage: f = DynamicalSystem_affine([t^2 + 1])
sage: f.conjugate(matrix([[1,2], [0,1]]))
Dynamical System of Affine Space of dimension 1 over Rational Field
Defn: Defined on coordinates by sending (t) to
Expand All @@ -832,18 +835,20 @@ def conjugate(self, M):
::
sage: A.<x,y> = AffineSpace(ZZ,2)
sage: f = DynamicalSystem_affine([x^3+y^3,y^2])
sage: f = DynamicalSystem_affine([x^3 + y^3, y^2])
sage: f.conjugate(matrix([[1,2,3], [0,1,2], [0,0,1]]))
Dynamical System of Affine Space of dimension 2 over Integer Ring
Defn: Defined on coordinates by sending (x, y) to
(x^3 + 6*x^2*y + 12*x*y^2 + 9*y^3 + 9*x^2 + 36*x*y + 40*y^2 + 27*x + 58*y + 28, y^2 + 4*y + 2)
(x^3 + 6*x^2*y + 12*x*y^2 + 9*y^3
+ 9*x^2 + 36*x*y + 40*y^2 + 27*x + 58*y + 28, y^2 + 4*y + 2)
::
sage: # needs sage.rings.number_field
sage: R.<x> = PolynomialRing(QQ)
sage: K.<i> = NumberField(x^2+1)
sage: K.<i> = NumberField(x^2 + 1)
sage: A.<x> = AffineSpace(ZZ,1)
sage: f = DynamicalSystem_affine([x^3+2*x^2+3])
sage: f = DynamicalSystem_affine([x^3 + 2*x^2 + 3])
sage: f.conjugate(matrix([[i,i], [0,-i]]))
Dynamical System of Affine Space of dimension 1 over Integer Ring
Defn: Defined on coordinates by sending (x) to
Expand All @@ -860,6 +865,7 @@ def degree(self):
EXAMPLES::
sage: # needs sage.rings.number_field
sage: R.<c> = QuadraticField(7)
sage: A.<x,y,z> = AffineSpace(R, 3)
sage: f = DynamicalSystem_affine([x^2 + y^5 + c, x^11, z^19])
Expand Down Expand Up @@ -911,16 +917,18 @@ def weil_restriction(self):
EXAMPLES::
sage: # needs sage.rings.number_field
sage: K.<v> = QuadraticField(5)
sage: A.<x,y> = AffineSpace(K, 2)
sage: f = DynamicalSystem_affine([x^2-y^2, y^2])
sage: f = DynamicalSystem_affine([x^2 - y^2, y^2])
sage: f.weil_restriction()
Dynamical System of Affine Space of dimension 4 over Rational Field
Defn: Defined on coordinates by sending (z0, z1, z2, z3) to
(z0^2 + 5*z1^2 - z2^2 - 5*z3^2, 2*z0*z1 - 2*z2*z3, z2^2 + 5*z3^2, 2*z2*z3)
::
sage: # needs sage.rings.number_field
sage: K.<v> = QuadraticField(5)
sage: PS.<x,y> = AffineSpace(K, 2)
sage: f = DynamicalSystem_affine([x, y])
Expand All @@ -940,13 +948,14 @@ def reduce_base_field(self):
The base field of the map could be strictly larger than
the field where all of the coefficients are defined. This function
reduces the base field to the minimal possible. This can be done when
the base ring is a number field, QQbar, a finite field, or algebraic
the base ring is a number field, ``QQbar``, a finite field, or algebraic
closure of a finite field.
OUTPUT: A dynamical system
EXAMPLES::
sage: # needs sage.rings.finite_rings
sage: K.<t> = GF(5^2)
sage: A.<x,y> = AffineSpace(K, 2)
sage: f = DynamicalSystem_affine([x^2 + 3*y^2, 3*y^2])
Expand All @@ -957,15 +966,20 @@ def reduce_base_field(self):
::
sage: # needs sage.rings.number_field sage.symbolic
sage: A.<x,y> = AffineSpace(QQbar, 2)
sage: f = DynamicalSystem_affine([x^2 + QQbar(sqrt(3))*y^2, QQbar(sqrt(-1))*y^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
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: # needs sage.rings.number_field
sage: K.<v> = CyclotomicField(5)
sage: A.<x,y> = AffineSpace(K, 2)
sage: f = DynamicalSystem_affine([(3*x^2 + y) / (5*x), (y^2+1) / (x+y)])
Expand Down Expand Up @@ -1001,6 +1015,7 @@ def orbit_structure(self, P):
::
sage: # needs sage.rings.finite_rings
sage: A.<x,y,z> = AffineSpace(GF(49, 't'), 3)
sage: f = DynamicalSystem_affine([x^2 - z, x - y + z, y^2 - x^2])
sage: f.orbit_structure(A(1, 1, 2))
Expand Down Expand Up @@ -1028,23 +1043,24 @@ def cyclegraph(self):
EXAMPLES::
sage: P.<x,y> = AffineSpace(GF(5), 2)
sage: f = DynamicalSystem_affine([x^2-y, x*y+1])
sage: f.cyclegraph()
sage: f = DynamicalSystem_affine([x^2 - y, x*y + 1])
sage: f.cyclegraph() # needs sage.graphs
Looped digraph on 25 vertices
::
sage: # needs sage.rings.finite_rings
sage: P.<x> = AffineSpace(GF(3^3, 't'), 1)
sage: f = DynamicalSystem_affine([x^2-1])
sage: f.cyclegraph()
sage: f = DynamicalSystem_affine([x^2 - 1])
sage: f.cyclegraph() # needs sage.graphs
Looped digraph on 27 vertices
::
sage: P.<x,y> = AffineSpace(GF(7), 2)
sage: X = P.subscheme(x-y)
sage: X = P.subscheme(x - y)
sage: f = DynamicalSystem_affine([x^2, y^2], domain=X)
sage: f.cyclegraph()
sage: f.cyclegraph() # needs sage.graphs
Looped digraph on 7 vertices
"""
V = []
Expand Down
Loading

0 comments on commit 8d91ee0

Please sign in to comment.