Skip to content

Commit

Permalink
projective_ds.py: Minor changes to docstring and comments; calling `c…
Browse files Browse the repository at this point in the history
…hange_ring` to ensure that `X.dimension()` works
  • Loading branch information
guojing0 committed Aug 15, 2023
1 parent 466276c commit bfdce75
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions src/sage/dynamics/arithmetic_dynamics/projective_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -4279,7 +4279,7 @@ def critical_height(self, **kwds):

def preperiodic_points(self, m, n, **kwds):
r"""
Computes the preperiodic points of period ``m, n`` of this dynamical system
Compute the preperiodic points of period ``m, n`` of this dynamical system
defined over the ring ``R`` or the base ring of the map.
This is done by finding the rational points on the variety
Expand All @@ -4291,16 +4291,16 @@ def preperiodic_points(self, m, n, **kwds):
INPUT:
- ``n`` - a positive integer, the period
- ``m`` - a non-negative integer, the preperiod
- ``m`` - a non negative integer, the preperiod
- ``n`` - a positive integer, the period
kwds:
- ``minimal`` -- (default: ``True``) boolean; ``True`` specifies to
find only the preperiodic points of minimal period ``m``,``n`` and
``False`` specifies to find all preperiodic points of period
``m``, ``n``
find only the preperiodic points of minimal period ``m``, ``n``,
and ``False`` specifies to find all preperiodic points of period
``m``, ``n``.
- ``formal`` -- (default: ``False``) boolean; ``True`` specifies to
find the formal periodic points only. The formal periodic points
Expand All @@ -4310,12 +4310,12 @@ def preperiodic_points(self, m, n, **kwds):
commutative ring over which to find the preperiodic points
- ``return_scheme`` -- (default: ``False``) boolean; return a
subscheme of the ambient space that defines the ``m``,``n`` th
subscheme of the ambient space that defines the ``m``,``n``-th
preperiodic points
OUTPUT:
A list of preperiodic points of this map or the subscheme defining
A list of preperiodic points of this map, or the subscheme defining
the preperiodic points.
EXAMPLES::
Expand Down Expand Up @@ -4473,7 +4473,9 @@ def preperiodic_points(self, m, n, **kwds):
sage: P.<x,y> = ProjectiveSpace(ZZ, 1)
sage: f = DynamicalSystem_projective([4*x^2 - 7*y^2, 4*y^2])
sage: f.preperiodic_points(1, 2)
0
Traceback (most recent call last):
...
NotImplementedError: ring must a number field or finite field
::
Expand Down Expand Up @@ -4505,13 +4507,13 @@ def preperiodic_points(self, m, n, **kwds):
ValueError: dynamical system is not a morphism,
cannot calculate minimal or formal preperiodic points
"""
n = ZZ(n)
m = ZZ(m)
n = ZZ(n)

if m < 0:
raise ValueError("a non-negative preperiod must be specified")

Check warning on line 4514 in src/sage/dynamics/arithmetic_dynamics/projective_ds.py

View check run for this annotation

Codecov / codecov/patch

src/sage/dynamics/arithmetic_dynamics/projective_ds.py#L4514

Added line #L4514 was not covered by tests
if n <= 0:
raise ValueError("a positive integer period must be specified")
if m < 0:
raise ValueError("a non negative preperiod must be specified")

R = kwds.pop('R', None)

Expand All @@ -4530,18 +4532,19 @@ def preperiodic_points(self, m, n, **kwds):
dom = f_sub.domain()
PS = f_sub.codomain().ambient_space()

if dom != PS:
if dom is not PS:
f = DynamicalSystem(f_sub.defining_polynomials())
else:
f = f_sub

N = PS.dimension_relative() + 1
formal = kwds.pop('formal', False)
minimal = kwds.pop('minimal', True)
return_scheme = kwds.pop('return_scheme', False)

if formal and (N == 2) and (dom == PS):
X = PS.subscheme([f.dynatomic_polynomial([m,n])])
N = PS.dimension_relative() + 1

if formal and (N == 2) and (dom is PS):
X = PS.subscheme([f.dynatomic_polynomial([m, n])])
else:
F_1 = f.nth_iterate_map(n + m)
F_2 = f.nth_iterate_map(m)
Expand Down Expand Up @@ -4610,6 +4613,7 @@ def preperiodic_points(self, m, n, **kwds):
psi = UnflatteningMorphism(flatCR, CR)
In = flatCR.ideal([phi(i) for i in X.defining_polynomials()])
X = PS.subscheme([psi(i) for i in In.saturation(Ik)[0].gens()])

else:
Ik = CR.ideal(1)

Expand All @@ -4622,14 +4626,15 @@ def preperiodic_points(self, m, n, **kwds):
In = X.defining_ideal()
X = PS.subscheme(In.saturation(Ik)[0])

if dom != PS:
if dom is not PS:
X = PS.subscheme(list(X.defining_polynomials()) + list(dom.defining_polynomials()))

# This includes the indeterminacy locus points!
if return_scheme:
return X

if X.dimension() <= 0:
# Ensure calling `X.dimension()` works
if X.change_ring(FractionField(R)).dimension() <= 0:
if (R in NumberFields()) or (R is QQbar) or (R in FiniteFields()):
points = [dom(Q) for Q in X.rational_points()]
good_points = []
Expand Down

0 comments on commit bfdce75

Please sign in to comment.