@@ -665,6 +665,14 @@ def orbit(self, p, n):
665
665
666
666
TESTS::
667
667
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
+
668
676
sage: P.<x,y> = ProjectiveSpace(QQ, 1)
669
677
sage: d = DynamicalSemigroup(([x, y], [x^2, y^2]))
670
678
sage: d.orbit(2, -2)
@@ -679,7 +687,7 @@ def orbit(self, p, n):
679
687
sage: d.orbit(2, x)
680
688
Traceback (most recent call last):
681
689
...
682
- TypeError: x must be an integer or list or tuple of two integers
690
+ TypeError: not a constant polynomial
683
691
684
692
sage: P.<x,y> = ProjectiveSpace(QQ, 1)
685
693
sage: d = DynamicalSemigroup(([x, y], [x^2, y^2]))
@@ -706,12 +714,25 @@ def orbit(self, p, n):
706
714
...
707
715
ValueError: [2, 1] cannot be in descending order
708
716
"""
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 )
710
732
if n < 0 :
711
733
raise ValueError (str (n ) + " must be a nonnegative integer" )
712
734
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
+
715
736
if not len (n ) == 2 :
716
737
raise ValueError (str (n ) + " must be an integer or list or tuple of two integers" )
717
738
if n [0 ] < 0 or n [1 ] < 0 :
0 commit comments