Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions src/sage/dynamics/arithmetic_dynamics/dynamical_semigroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
- Dang Phan (August 6th, 2023): initial implementation
"""

#*****************************************************************************
# ****************************************************************************
# Dang Phan <dang8phan@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
# https://www.gnu.org/licenses/
# ****************************************************************************

from collections.abc import Collection
from sage.categories.fields import Fields
Expand All @@ -33,6 +33,7 @@
from sage.rings.rational_field import QQ
from sage.structure.parent import Parent


class DynamicalSemigroup(Parent, metaclass=InheritComparisonClasscallMetaclass):
r"""
A dynamical semigroup defined by a multiple dynamical systems on projective or affine space.
Expand Down Expand Up @@ -959,16 +960,15 @@ def __mul__(self, other_dynamical_semigroup):
Traceback (most recent call last):
...
ValueError: left dynamical semigroup's domain must equal right dynamical semigroup's codomain

"""
if type(self) != type(other_dynamical_semigroup):
if not isinstance(other_dynamical_semigroup, DynamicalSemigroup):
raise TypeError("can only multiply dynamical semigroups with other dynamical semigroups of the same type")
if self.domain() != other_dynamical_semigroup.codomain():
raise ValueError("left dynamical semigroup's domain must equal right dynamical semigroup's codomain")
composite_systems = []
for f in self.defining_systems():
for g in other_dynamical_semigroup.defining_systems():
composite_systems.append(DynamicalSystem(f*g))
composite_systems.append(DynamicalSystem(f * g))
return DynamicalSemigroup(composite_systems)

def __pow__(self, n):
Expand All @@ -982,7 +982,7 @@ def __pow__(self, n):

OUTPUT: :class:`DynamicalSemigroup`

EXAMPLES:
EXAMPLES::

sage: A.<x> = AffineSpace(QQ, 1)
sage: f = DynamicalSystem(x^2, A)
Expand Down Expand Up @@ -1200,12 +1200,13 @@ def __eq__(self, other):
"""
if isinstance(other, DynamicalSemigroup):
if any(ds.degree() == 1 for ds in self.defining_systems()) or \
any(ds.degree() == 1 for ds in other.defining_systems()):
any(ds.degree() == 1 for ds in other.defining_systems()):
raise NotImplementedError("cannot compare dynamical semigroups with at least one generator of degree 1")
return all(ds in other.defining_systems() for ds in self.defining_systems()) and \
all(ds in self.defining_systems() for ds in other.defining_systems())
return False


class DynamicalSemigroup_projective(DynamicalSemigroup):
r"""
A dynamical semigroup defined by a multiple dynamical systems on projective space.
Expand Down Expand Up @@ -1248,7 +1249,7 @@ def __classcall_private__(cls, ds_data):
raise ValueError(str(ds_datum) + " does not define a 'DynamicalSystem_projective' object")
else:
if isinstance(ds_data, DynamicalSystem_projective):
systems.append(ds_data)
systems.append(ds_data)
else:
try:
systems.append(DynamicalSystem_projective(ds_data))
Expand Down Expand Up @@ -1327,12 +1328,15 @@ def dehomogenize(self, n):
new_systems.append(new_system)
return DynamicalSemigroup_affine(new_systems)


class DynamicalSemigroup_projective_field(DynamicalSemigroup_projective):
pass


class DynamicalSemigroup_projective_finite_field(DynamicalSemigroup_projective_field):
pass


class DynamicalSemigroup_affine(DynamicalSemigroup):
r"""
A dynamical semigroup defined by multiple dynamical systems on affine space.
Expand Down Expand Up @@ -1374,7 +1378,7 @@ def __classcall_private__(cls, ds_data):
raise ValueError(str(ds_datum) + " does not define a 'DynamicalSystem_affine' object")
else:
if isinstance(ds_data, DynamicalSystem_affine):
systems.append(ds_data)
systems.append(ds_data)
else:
try:
systems.append(DynamicalSystem_affine(ds_data))
Expand Down Expand Up @@ -1435,12 +1439,15 @@ def homogenize(self, n):
new_systems.append(ds.homogenize(n))
return DynamicalSemigroup_projective(new_systems)


class DynamicalSemigroup_affine_field(DynamicalSemigroup_affine):
pass


class DynamicalSemigroup_affine_finite_field(DynamicalSemigroup_affine_field):
pass


def _standardize_domains_of_(systems):
r"""
Coerces dynamical systems to the same domain and have the same generators.
Expand Down Expand Up @@ -1509,7 +1516,7 @@ def _standardize_domains_of_(systems):

for i in range(len(systems)):
if systems[i].base_ring() != biggest_ring:
systems[i] = systems[i].change_ring(biggest_ring)
systems[i] = systems[i].change_ring(biggest_ring)

domain = systems[0].domain()

Expand All @@ -1531,4 +1538,4 @@ def _standardize_domains_of_(systems):
new_polys.append(poly.subs(sub_dict))
systems[i] = DynamicalSystem(new_polys, domain)

return systems
return systems
2 changes: 1 addition & 1 deletion src/sage/rings/polynomial/polynomial_zz_pex.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ cdef class Polynomial_ZZ_pEX(Polynomial_template):
def inverse_series_trunc(self, prec):
r"""
Compute and return the inverse of self modulo `x^prec`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume it should be x^{prec} here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

voilà, voilà


The constant term of self must be invertible.

EXAMPLES::
Expand Down