Skip to content

Commit f7c0045

Browse files
fixed integers
1 parent c51f504 commit f7c0045

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

src/sage/dynamics/arithmetic_dynamics/dynamical_semigroup.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,14 @@ def orbit(self, p, n):
665665
666666
TESTS::
667667
668+
sage: P.<x,y> = ProjectiveSpace(QQ, 1)
669+
sage: d = DynamicalSemigroup(([x, y], [x^2, y^2]))
670+
sage: one = QQ(1)
671+
sage: d.orbit(2, one)
672+
({(2 : 1)}, {(2 : 1), (4 : 1)})
673+
674+
::
675+
668676
sage: P.<x,y> = ProjectiveSpace(QQ, 1)
669677
sage: d = DynamicalSemigroup(([x, y], [x^2, y^2]))
670678
sage: d.orbit(2, -2)
@@ -679,7 +687,7 @@ def orbit(self, p, n):
679687
sage: d.orbit(2, x)
680688
Traceback (most recent call last):
681689
...
682-
TypeError: x must be an integer or list or tuple of two integers
690+
TypeError: not a constant polynomial
683691
684692
sage: P.<x,y> = ProjectiveSpace(QQ, 1)
685693
sage: d = DynamicalSemigroup(([x, y], [x^2, y^2]))
@@ -706,12 +714,25 @@ def orbit(self, p, n):
706714
...
707715
ValueError: [2, 1] cannot be in descending order
708716
"""
709-
if isinstance(n, Integer) or isinstance(n, int):
717+
# if isinstance(n, Integer) or isinstance(n, int):
718+
# if n < 0:
719+
# raise ValueError(str(n) + " must be a nonnegative integer")
720+
# return self.orbit(p, [0, n])
721+
# if not isinstance(n, Collection):
722+
# raise TypeError(str(n) + " must be an integer or list or tuple of two integers")
723+
# if not len(n) == 2:
724+
# raise ValueError(str(n) + " must be an integer or list or tuple of two integers")
725+
# if n[0] < 0 or n[1] < 0:
726+
# raise ValueError(str(n) + " must contain exactly two nonnegative integers")
727+
# if n[0] > n[1]:
728+
# raise ValueError(str(n) + " cannot be in descending order")
729+
730+
if not isinstance(n, Collection):
731+
n = ZZ(n)
710732
if n < 0:
711733
raise ValueError(str(n) + " must be a nonnegative integer")
712734
return self.orbit(p, [0, n])
713-
if not isinstance(n, Collection):
714-
raise TypeError(str(n) + " must be an integer or list or tuple of two integers")
735+
715736
if not len(n) == 2:
716737
raise ValueError(str(n) + " must be an integer or list or tuple of two integers")
717738
if n[0] < 0 or n[1] < 0:

0 commit comments

Comments
 (0)