99 - Dang Phan (August 6th, 2023): initial implementation
1010"""
1111
12- #* ****************************************************************************
12+ # ****************************************************************************
1313# Dang Phan <dang8phan@gmail.com>
1414#
1515# This program is free software: you can redistribute it and/or modify
1616# it under the terms of the GNU General Public License as published by
1717# the Free Software Foundation, either version 2 of the License, or
1818# (at your option) any later version.
19- # http ://www.gnu.org/licenses/
20- #* ****************************************************************************
19+ # https ://www.gnu.org/licenses/
20+ # ****************************************************************************
2121
2222from collections .abc import Collection
2323from sage .categories .fields import Fields
3333from sage .rings .rational_field import QQ
3434from sage .structure .parent import Parent
3535
36+
3637class DynamicalSemigroup (Parent , metaclass = InheritComparisonClasscallMetaclass ):
3738 r"""
3839 A dynamical semigroup defined by a multiple dynamical systems on projective or affine space.
@@ -959,16 +960,15 @@ def __mul__(self, other_dynamical_semigroup):
959960 Traceback (most recent call last):
960961 ...
961962 ValueError: left dynamical semigroup's domain must equal right dynamical semigroup's codomain
962-
963963 """
964- if type (self ) != type (other_dynamical_semigroup ):
964+ if type (self ) is not type (other_dynamical_semigroup ):
965965 raise TypeError ("can only multiply dynamical semigroups with other dynamical semigroups of the same type" )
966966 if self .domain () != other_dynamical_semigroup .codomain ():
967967 raise ValueError ("left dynamical semigroup's domain must equal right dynamical semigroup's codomain" )
968968 composite_systems = []
969969 for f in self .defining_systems ():
970970 for g in other_dynamical_semigroup .defining_systems ():
971- composite_systems .append (DynamicalSystem (f * g ))
971+ composite_systems .append (DynamicalSystem (f * g ))
972972 return DynamicalSemigroup (composite_systems )
973973
974974 def __pow__ (self , n ):
@@ -982,7 +982,7 @@ def __pow__(self, n):
982982
983983 OUTPUT: :class:`DynamicalSemigroup`
984984
985- EXAMPLES:
985+ EXAMPLES::
986986
987987 sage: A.<x> = AffineSpace(QQ, 1)
988988 sage: f = DynamicalSystem(x^2, A)
@@ -1200,12 +1200,13 @@ def __eq__(self, other):
12001200 """
12011201 if isinstance (other , DynamicalSemigroup ):
12021202 if any (ds .degree () == 1 for ds in self .defining_systems ()) or \
1203- any (ds .degree () == 1 for ds in other .defining_systems ()):
1203+ any (ds .degree () == 1 for ds in other .defining_systems ()):
12041204 raise NotImplementedError ("cannot compare dynamical semigroups with at least one generator of degree 1" )
12051205 return all (ds in other .defining_systems () for ds in self .defining_systems ()) and \
12061206 all (ds in self .defining_systems () for ds in other .defining_systems ())
12071207 return False
12081208
1209+
12091210class DynamicalSemigroup_projective (DynamicalSemigroup ):
12101211 r"""
12111212 A dynamical semigroup defined by a multiple dynamical systems on projective space.
@@ -1248,7 +1249,7 @@ def __classcall_private__(cls, ds_data):
12481249 raise ValueError (str (ds_datum ) + " does not define a 'DynamicalSystem_projective' object" )
12491250 else :
12501251 if isinstance (ds_data , DynamicalSystem_projective ):
1251- systems .append (ds_data )
1252+ systems .append (ds_data )
12521253 else :
12531254 try :
12541255 systems .append (DynamicalSystem_projective (ds_data ))
@@ -1327,12 +1328,15 @@ def dehomogenize(self, n):
13271328 new_systems .append (new_system )
13281329 return DynamicalSemigroup_affine (new_systems )
13291330
1331+
13301332class DynamicalSemigroup_projective_field (DynamicalSemigroup_projective ):
13311333 pass
13321334
1335+
13331336class DynamicalSemigroup_projective_finite_field (DynamicalSemigroup_projective_field ):
13341337 pass
13351338
1339+
13361340class DynamicalSemigroup_affine (DynamicalSemigroup ):
13371341 r"""
13381342 A dynamical semigroup defined by multiple dynamical systems on affine space.
@@ -1374,7 +1378,7 @@ def __classcall_private__(cls, ds_data):
13741378 raise ValueError (str (ds_datum ) + " does not define a 'DynamicalSystem_affine' object" )
13751379 else :
13761380 if isinstance (ds_data , DynamicalSystem_affine ):
1377- systems .append (ds_data )
1381+ systems .append (ds_data )
13781382 else :
13791383 try :
13801384 systems .append (DynamicalSystem_affine (ds_data ))
@@ -1435,12 +1439,15 @@ def homogenize(self, n):
14351439 new_systems .append (ds .homogenize (n ))
14361440 return DynamicalSemigroup_projective (new_systems )
14371441
1442+
14381443class DynamicalSemigroup_affine_field (DynamicalSemigroup_affine ):
14391444 pass
14401445
1446+
14411447class DynamicalSemigroup_affine_finite_field (DynamicalSemigroup_affine_field ):
14421448 pass
14431449
1450+
14441451def _standardize_domains_of_ (systems ):
14451452 r"""
14461453 Coerces dynamical systems to the same domain and have the same generators.
@@ -1509,7 +1516,7 @@ def _standardize_domains_of_(systems):
15091516
15101517 for i in range (len (systems )):
15111518 if systems [i ].base_ring () != biggest_ring :
1512- systems [i ] = systems [i ].change_ring (biggest_ring )
1519+ systems [i ] = systems [i ].change_ring (biggest_ring )
15131520
15141521 domain = systems [0 ].domain ()
15151522
@@ -1531,4 +1538,4 @@ def _standardize_domains_of_(systems):
15311538 new_polys .append (poly .subs (sub_dict ))
15321539 systems [i ] = DynamicalSystem (new_polys , domain )
15331540
1534- return systems
1541+ return systems
0 commit comments