Skip to content

Commit b93122b

Browse files
fixed orbit to use sets
1 parent 5b1c5bd commit b93122b

File tree

1 file changed

+7
-172
lines changed

1 file changed

+7
-172
lines changed

src/sage/dynamics/arithmetic_dynamics/dynamical_semigroup.py

Lines changed: 7 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -562,28 +562,28 @@ def orbit(self, p, n):
562562
sage: P.<x,y> = ProjectiveSpace(QQ, 1)
563563
sage: d = DynamicalSemigroup(([x, y], [x^2, y^2]))
564564
sage: d.orbit(2, 0)
565-
(((2 : 1),),)
565+
({(2 : 1)},)
566566
567567
::
568568
569569
sage: P.<x,y> = ProjectiveSpace(QQ, 1)
570570
sage: d = DynamicalSemigroup(([x, y], [x^2, y^2]))
571571
sage: d.orbit(2, 1)
572-
(((2 : 1),), ((2 : 1), (4 : 1)))
572+
({(2 : 1)}, {(2 : 1), (4 : 1)})
573573
574574
::
575575
576576
sage: P.<x,y> = ProjectiveSpace(QQ, 1)
577577
sage: d = DynamicalSemigroup(([x, y], [x^2, y^2]))
578578
sage: d.orbit(2, 2)
579-
(((2 : 1),), ((2 : 1), (4 : 1)), ((2 : 1), (4 : 1), (4 : 1), (16 : 1)))
579+
({(2 : 1)}, {(2 : 1), (4 : 1)}, {(2 : 1), (4 : 1), (16 : 1)})
580580
581581
::
582582
583583
sage: P.<x,y> = ProjectiveSpace(QQ, 1)
584584
sage: d = DynamicalSemigroup(([x, y], [x^2, y^2]))
585585
sage: d.orbit(2, [1, 2])
586-
(((2 : 1), (4 : 1)), ((2 : 1), (4 : 1), (4 : 1), (16 : 1)))
586+
({(2 : 1), (4 : 1)}, {(2 : 1), (4 : 1), (16 : 1)})
587587
588588
TESTS::
589589
@@ -645,10 +645,10 @@ def orbit(self, p, n):
645645
current_iterate = self.nth_iterate(p, n[0])
646646
result.append(current_iterate)
647647
for i in range(n[0] + 1, n[1] + 1):
648-
next_iterate = []
648+
next_iterate = set()
649649
for value in current_iterate:
650-
next_iterate.extend(self(value))
651-
result.append(tuple(next_iterate))
650+
next_iterate.update(self(value))
651+
result.append(next_iterate)
652652
current_iterate = next_iterate
653653
return tuple(result)
654654

@@ -1263,171 +1263,6 @@ def homogenize(self, n):
12631263
new_systems.append(new_system)
12641264
return DynamicalSemigroup_projective(new_systems)
12651265

1266-
# def _mul_(self, other_dynamical_semigroup):
1267-
# r"""
1268-
# Return a new :class:`DynamicalSemigroup_affine` that is the result of multiplying
1269-
# this dynamical semigroup with another dynamical semigroup using the * operator.
1270-
1271-
# Let `f` be a dynamical semigroup with generators `\{ f_1, f_2, \dots, f_m \}`
1272-
# and `g` be a dynamical semigroup with generators `\{ g_1, g_2, \dots, g_n \}`.
1273-
# The product `f * g` has generators
1274-
# `\{ f_i(g_j) : 1 \leq i \leq m, 1 \leq j \leq n \} \cup \{ g_j(f_i) : 1 \leq i \leq m, 1 \leq j \leq n \}`.
1275-
1276-
# INPUT:
1277-
1278-
# - ``other_dynamical_semigroup`` -- a dynamical semigroup over affine space
1279-
1280-
# OUTPUT: :class:`DynamicalSemigroup_affine`
1281-
1282-
# EXAMPLES::
1283-
1284-
# sage: A.<x> = AffineSpace(QQ, 1)
1285-
# sage: f1 = DynamicalSystem(x, A)
1286-
# sage: f2 = DynamicalSystem(x^2, A)
1287-
# sage: g1 = DynamicalSystem(x^3, A)
1288-
# sage: g2 = DynamicalSystem(x^4, A)
1289-
# sage: f = DynamicalSemigroup((f1, f2))
1290-
# sage: g = DynamicalSemigroup((g1, g2))
1291-
# sage: f*g
1292-
# Dynamical semigroup over Affine Space of dimension 1 over Rational Field defined by 8 dynamical systems:
1293-
# Dynamical System of Affine Space of dimension 1 over Rational Field
1294-
# Defn: Defined on coordinates by sending (x) to
1295-
# (x^3)
1296-
# Dynamical System of Affine Space of dimension 1 over Rational Field
1297-
# Defn: Defined on coordinates by sending (x) to
1298-
# (x^4)
1299-
# Dynamical System of Affine Space of dimension 1 over Rational Field
1300-
# Defn: Defined on coordinates by sending (x) to
1301-
# (x^6)
1302-
# Dynamical System of Affine Space of dimension 1 over Rational Field
1303-
# Defn: Defined on coordinates by sending (x) to
1304-
# (x^8)
1305-
# Dynamical System of Affine Space of dimension 1 over Rational Field
1306-
# Defn: Defined on coordinates by sending (x) to
1307-
# (x^3)
1308-
# Dynamical System of Affine Space of dimension 1 over Rational Field
1309-
# Defn: Defined on coordinates by sending (x) to
1310-
# (x^6)
1311-
# Dynamical System of Affine Space of dimension 1 over Rational Field
1312-
# Defn: Defined on coordinates by sending (x) to
1313-
# (x^4)
1314-
# Dynamical System of Affine Space of dimension 1 over Rational Field
1315-
# Defn: Defined on coordinates by sending (x) to
1316-
# (x^8)
1317-
1318-
# TESTS::
1319-
1320-
# sage: A.<x> = AffineSpace(QQ, 1)
1321-
# sage: f1 = DynamicalSystem(x, A)
1322-
# sage: f2 = DynamicalSystem(x^2, A)
1323-
# sage: g1 = DynamicalSystem(x^3, A)
1324-
# sage: g2 = DynamicalSystem(x^4, A)
1325-
# sage: f = DynamicalSemigroup((f1, f2))
1326-
# sage: g = DynamicalSemigroup((g1, g2))
1327-
# sage: f*g == g*f
1328-
# True
1329-
1330-
# ::
1331-
1332-
# sage: A.<x> = AffineSpace(QQ, 1)
1333-
# sage: B.<y> = AffineSpace(QQ, 1)
1334-
# sage: f1 = DynamicalSystem(x, A)
1335-
# sage: f2 = DynamicalSystem(x^2, A)
1336-
# sage: g1 = DynamicalSystem(y^3, B)
1337-
# sage: g2 = DynamicalSystem(y^4, B)
1338-
# sage: f = DynamicalSemigroup((f1, f2))
1339-
# sage: g = DynamicalSemigroup((g1, g2))
1340-
# sage: f*g == g*f
1341-
# True
1342-
1343-
# ::
1344-
1345-
# sage: A.<x> = AffineSpace(QQ, 1)
1346-
# sage: f1 = DynamicalSystem(x, A)
1347-
# sage: f2 = DynamicalSystem(x^2, A)
1348-
# sage: g1 = DynamicalSystem(x^3, A)
1349-
# sage: g2 = DynamicalSystem(x^4, A)
1350-
# sage: h1 = DynamicalSystem(x^5, A)
1351-
# sage: h2 = DynamicalSystem(x^6, A)
1352-
# sage: f = DynamicalSemigroup((f1, f2))
1353-
# sage: g = DynamicalSemigroup((g1, g2))
1354-
# sage: h = DynamicalSemigroup((h1, h2))
1355-
# sage: f*(g*h) == (f*g)*h
1356-
# True
1357-
1358-
# ::
1359-
1360-
# sage: A.<x> = AffineSpace(QQ, 1)
1361-
# sage: B.<y> = AffineSpace(QQ, 1)
1362-
# sage: C.<z> = AffineSpace(QQ, 1)
1363-
# sage: f1 = DynamicalSystem(x, A)
1364-
# sage: f2 = DynamicalSystem(x^2, A)
1365-
# sage: g1 = DynamicalSystem(y^3, B)
1366-
# sage: g2 = DynamicalSystem(y^4, B)
1367-
# sage: h1 = DynamicalSystem(z^5, C)
1368-
# sage: h2 = DynamicalSystem(z^6, C)
1369-
# sage: f = DynamicalSemigroup((f1, f2))
1370-
# sage: g = DynamicalSemigroup((g1, g2))
1371-
# sage: h = DynamicalSemigroup((h1, h2))
1372-
# sage: f*(g*h) == (f*g)*h
1373-
# True
1374-
1375-
# ::
1376-
1377-
# sage: A.<x> = AffineSpace(QQ, 1)
1378-
# sage: P.<y,z> = ProjectiveSpace(QQ, 1)
1379-
# sage: f1 = DynamicalSystem(x, A)
1380-
# sage: f2 = DynamicalSystem(x^2, A)
1381-
# sage: g1 = DynamicalSystem([y^3, z^3], P)
1382-
# sage: g2 = DynamicalSystem([y^4, z^4], P)
1383-
# sage: f = DynamicalSemigroup((f1, f2))
1384-
# sage: g = DynamicalSemigroup((g1, g2))
1385-
# sage: f*g
1386-
# Traceback (most recent call last):
1387-
# ...
1388-
# TypeError: can only multiply `DynamicalSemigroup_affine` objects
1389-
1390-
# ::
1391-
1392-
# sage: A.<x> = AffineSpace(QQ, 1)
1393-
# sage: B.<y,z> = AffineSpace(QQ, 2)
1394-
# sage: f1 = DynamicalSystem(x, A)
1395-
# sage: f2 = DynamicalSystem(x^2, A)
1396-
# sage: g1 = DynamicalSystem([y^3, z^3], B)
1397-
# sage: g2 = DynamicalSystem([y^4, z^4], B)
1398-
# sage: f = DynamicalSemigroup((f1, f2))
1399-
# sage: g = DynamicalSemigroup((g1, g2))
1400-
# sage: f*g
1401-
# Traceback (most recent call last):
1402-
# ...
1403-
# ValueError: cannot multiply dynamical semigroups of different dimensions
1404-
# """
1405-
# if not isinstance(other_dynamical_semigroup, DynamicalSemigroup_affine):
1406-
# raise TypeError("can only multiply `DynamicalSemigroup_affine` objects")
1407-
# if self._dynamical_systems[0].domain().dimension() != other_dynamical_semigroup._dynamical_systems[0].domain().dimension():
1408-
# raise ValueError("cannot multiply dynamical semigroups of different dimensions")
1409-
composite_systems = []
1410-
# my_polys = self.defining_polynomials()
1411-
# other_polys = other_dynamical_semigroup.defining_polynomials()
1412-
# for my_poly in my_polys:
1413-
# for other_poly in other_polys:
1414-
# composite_poly = []
1415-
# for coordinate_poly in my_poly:
1416-
# composite_poly.append(coordinate_poly(other_poly))
1417-
# composite_system = DynamicalSystem_affine(composite_poly)
1418-
# composite_systems.append(composite_system)
1419-
# for other_poly in other_polys:
1420-
# for my_poly in my_polys:
1421-
# composite_poly = []
1422-
# for coordinate_poly in other_poly:
1423-
# composite_poly.append(coordinate_poly(my_poly))
1424-
# composite_system = DynamicalSystem_affine(composite_poly)
1425-
# composite_systems.append(composite_system)
1426-
# for f in self.defining_systems():
1427-
# for g in other_dynamical_semigroup.defining_systems():
1428-
# composite_systems.append(f*g)
1429-
# return DynamicalSemigroup_affine(composite_systems)
1430-
14311266
class DynamicalSemigroup_affine_field(DynamicalSemigroup_affine):
14321267
pass
14331268

0 commit comments

Comments
 (0)