Skip to content

Commit 851abeb

Browse files
committed
avoid using "is_prime_field" in dynamics
1 parent 209ae4c commit 851abeb

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/sage/dynamics/arithmetic_dynamics/affine_ds.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class initialization directly.
2525
- Ben Hutz (2017) relocate code and create new class
2626
"""
2727

28-
#*****************************************************************************
28+
# ****************************************************************************
2929
# Copyright (C) 2011 Volker Braun <[email protected]>
3030
# Copyright (C) 2006 David Kohel <[email protected]>
3131
# Copyright (C) 2006 William Stein <[email protected]>
@@ -34,8 +34,8 @@ class initialization directly.
3434
# it under the terms of the GNU General Public License as published by
3535
# the Free Software Foundation, either version 2 of the License, or
3636
# (at your option) any later version.
37-
# http://www.gnu.org/licenses/
38-
#*****************************************************************************
37+
# https://www.gnu.org/licenses/
38+
# ****************************************************************************
3939

4040
from sage.categories.fields import Fields
4141
from sage.dynamics.arithmetic_dynamics.generic_ds import DynamicalSystem
@@ -255,7 +255,7 @@ def __classcall_private__(cls, morphism_or_polys, domain=None):
255255
if isinstance(R, FiniteField):
256256
return DynamicalSystem_affine_finite_field(polys, domain)
257257
return DynamicalSystem_affine_field(polys, domain)
258-
elif isinstance(morphism_or_polys,(list, tuple)):
258+
elif isinstance(morphism_or_polys, (list, tuple)):
259259
polys = list(morphism_or_polys)
260260
else:
261261
polys = [morphism_or_polys]
@@ -321,7 +321,7 @@ def __init__(self, polys_or_rat_fncts, domain):
321321
L = polys_or_rat_fncts
322322
# Next attribute needed for _fast_eval and _fastpolys
323323
R = L[0].base_ring()
324-
self._is_prime_finite_field = isinstance(R, FiniteField) and R.is_prime_field()
324+
self._is_prime_finite_field = isinstance(R, FiniteField) and R.degree() == 1
325325
DynamicalSystem.__init__(self, L, domain)
326326

327327
def __copy__(self):
@@ -535,15 +535,15 @@ def dynatomic_polynomial(self, period):
535535
if isinstance(F.parent(), sage.rings.abc.SymbolicRing):
536536
from sage.symbolic.ring import var
537537
u = var(self.domain().coordinate_ring().variable_name())
538-
return F.subs({F.variables()[0]:u,F.variables()[1]:1})
538+
return F.subs({F.variables()[0]: u, F.variables()[1]: 1})
539539
elif T(F.denominator()).degree() == 0:
540540
R = F.parent()
541541
phi = R.hom([S.gen(0), 1], S)
542542
return phi(F)
543543
else:
544544
R = F.numerator().parent()
545545
phi = R.hom([S.gen(0), 1], S)
546-
return phi(F.numerator())/phi(F.denominator())
546+
return phi(F.numerator()) / phi(F.denominator())
547547

548548
def nth_iterate_map(self, n):
549549
r"""
@@ -612,8 +612,8 @@ def nth_iterate_map(self, n):
612612
for i in range(len(D)):
613613
for k in range(D[i]):
614614
PHI = [poly(F) for poly in PHI]
615-
if i != len(D)-1: #avoid extra iterate
616-
F = [R(poly(F)) for poly in F] #'square'
615+
if i != len(D) - 1: # avoid extra iterate
616+
F = [R(poly(F)) for poly in F] # 'square'
617617
return DynamicalSystem_affine(PHI, domain=self.domain())
618618

619619
def nth_iterate(self, P, n):
@@ -724,11 +724,11 @@ def orbit(self, P, n):
724724
if isinstance(n, (list, tuple)):
725725
bounds = list(n)
726726
else:
727-
bounds = [0,n]
728-
for i in range(1, bounds[0]+1):
727+
bounds = [0, n]
728+
for i in range(1, bounds[0] + 1):
729729
Q = self(Q)
730730
orb = [Q]
731-
for i in range(bounds[0]+1, bounds[1]+1):
731+
for i in range(bounds[0] + 1, bounds[1] + 1):
732732
Q = self(Q)
733733
orb.append(Q)
734734
return orb
@@ -802,7 +802,7 @@ def multiplier(self, P, n, check=True):
802802
J = self.jacobian()
803803
for i in range(0, n):
804804
R = self(Q)
805-
l = J(tuple(Q))*l #chain rule matrix multiplication
805+
l = J(tuple(Q)) * l # chain rule matrix multiplication
806806
Q = R
807807
return l
808808

src/sage/dynamics/arithmetic_dynamics/projective_ds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def __init__(self, polys, domain):
474474
"""
475475
# Next attribute needed for _fast_eval and _fastpolys
476476
R = polys[0].base_ring()
477-
self._is_prime_finite_field = isinstance(R, FiniteField) and R.is_prime_field()
477+
self._is_prime_finite_field = isinstance(R, FiniteField) and R.degree() == 1
478478
DynamicalSystem.__init__(self, polys, domain)
479479

480480
def __copy__(self):

0 commit comments

Comments
 (0)