Dynamical systems on affine schemes - Discrete dynamics

Skip to content
Back to top
View this page
Edit this page

# Dynamical systems on affine schemes

An endomorphism of an affine scheme or subscheme determined by polynomials or rational functions.

The main constructor function is given by `DynamicalSystem_affine`. The constructor function can take polynomials, rational functions, or morphisms from which to construct a dynamical system. If the domain is not specified, it is constructed. However, if you plan on working with points or subvarieties in the domain, it recommended to specify the domain.

The initialization checks are always performed by the constructor functions. It is possible, but not recommended, to skip these checks by calling the class initialization directly.

AUTHORS:

- David Kohel, William Stein

- Volker Braun (2011-08-08): Renamed classes, more documentation, misc cleanups.

- Ben Hutz (2017) relocate code and create new class

class sage.dynamics.arithmetic_dynamics.affine_ds.DynamicalSystem_affine(polys_or_rat_fncts, domain)

  Bases: `SchemeMorphism_polynomial_affine_space`, `DynamicalSystem`

  An endomorphism of affine schemes determined by rational functions.

  Warning

  You should not create objects of this class directly because no type or consistency checking is performed. The preferred method to construct such dynamical systems is to use `DynamicalSystem_affine()` function.

  INPUT:

  - `morphism_or_polys` – a SchemeMorphism, a polynomial, a rational function, or a list or tuple of polynomials or rational functions

  - `domain` – (optional) affine space or subscheme of such; the following combinations of `morphism_or_polys` and `domain` are meaningful:

    - `morphism_or_polys` is a SchemeMorphism; `domain` is ignored in this case

    - `morphism_or_polys` is a list of polynomials or rational functions that define a rational endomorphism of `domain`

    - `morphism_or_polys` is a list of polynomials or rational functions and `domain` is unspecified; `domain` is then taken to be the affine space of appropriate dimension over the common base ring, if one exists, of the elements of `morphism_or_polys`

    - `morphism_or_polys` is a single polynomial or rational function; `domain` is ignored and assumed to be the 1-dimensional affine space over the base ring of `morphism_or_polys`

  OUTPUT: `DynamicalSystem_affine`

  EXAMPLES:

  Sage

      sage: A3.<x,y,z> = AffineSpace(QQ, 3)
      sage: DynamicalSystem_affine([x, y, 1])
      Dynamical System of Affine Space of dimension 3 over Rational Field
            Defn: Defined on coordinates by sending (x, y, z) to
                  (x, y, 1)

  Python

      >>> from sage.all import *
      >>> A3 = AffineSpace(QQ, Integer(3), names=('x', 'y', 'z',)); (x, y, z,) = A3._first_ngens(3)
      >>> DynamicalSystem_affine([x, y, Integer(1)])
      Dynamical System of Affine Space of dimension 3 over Rational Field
            Defn: Defined on coordinates by sending (x, y, z) to
                  (x, y, 1)

  Sage

      sage: R.<x,y> = QQ[]
      sage: DynamicalSystem_affine([x/y, y^2 + 1])
      Dynamical System of Affine Space of dimension 2 over Rational Field
        Defn: Defined on coordinates by sending (x, y) to
              (x/y, y^2 + 1)

  [Python]

      >>> from sage.all import *
      >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
      >>> DynamicalSystem_affine([x/y, y**Integer(2) + Integer(1)])
      Dynamical System of Affine Space of dimension 2 over Rational Field
        Defn: Defined on coordinates by sending (x, y) to
              (x/y, y^2 + 1)

  Sage

      sage: R.<t> = ZZ[]
      sage: DynamicalSystem_affine(t^2 - 1)
      Dynamical System of Affine Space of dimension 1 over Integer Ring
        Defn: Defined on coordinates by sending (t) to
              (t^2 - 1)

  Python

      >>> from sage.all import *
      >>> R = ZZ['t']; (t,) = R._first_ngens(1)
      >>> DynamicalSystem_affine(t**Integer(2) - Integer(1))
      Dynamical System of Affine Space of dimension 1 over Integer Ring
        Defn: Defined on coordinates by sending (t) to
              (t^2 - 1)

  Sage

      sage: A.<x,y> = AffineSpace(QQ, 2)
      sage: X = A.subscheme([x-y^2])
      sage: DynamicalSystem_affine([9/4*x^2, 3/2*y], domain=X)
      Dynamical System of Closed subscheme of Affine Space of dimension 2 over Rational Field defined by:
            -y^2 + x
            Defn: Defined on coordinates by sending (x, y) to
                  (9/4*x^2, 3/2*y)

  [Python]

      >>> from sage.all import *
      >>> A = AffineSpace(QQ, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
      >>> X = A.subscheme([x-y**Integer(2)])
      >>> DynamicalSystem_affine([Integer(9)/Integer(4)*x**Integer(2), Integer(3)/Integer(2)*y], domain=X)
      Dynamical System of Closed subscheme of Affine Space of dimension 2 over Rational Field defined by:
            -y^2 + x
            Defn: Defined on coordinates by sending (x, y) to
                  (9/4*x^2, 3/2*y)

  Sage

      sage: A.<x,y> = AffineSpace(QQ, 2)
      sage: H = End(A)
      sage: f = H([x^2, y^2])
      sage: DynamicalSystem_affine(f)
      Dynamical System of Affine Space of dimension 2 over Rational Field
        Defn: Defined on coordinates by sending (x, y) to
              (x^2, y^2)

  Python

      >>> from sage.all import *
      >>> A = AffineSpace(QQ, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
      >>> H = End(A)
      >>> f = H([x**Integer(2), y**Integer(2)])
      >>> DynamicalSystem_affine(f)
      Dynamical System of Affine Space of dimension 2 over Rational Field
        Defn: Defined on coordinates by sending (x, y) to
              (x^2, y^2)

  Notice that \(ZZ\) becomes \(QQ\) since the function is rational:

  Sage

      sage: A.<x,y> = AffineSpace(ZZ, 2)
      sage: DynamicalSystem_affine([3*x^2/(5*y), y^2/(2*x^2)])
      Dynamical System of Affine Space of dimension 2 over Rational Field
        Defn: Defined on coordinates by sending (x, y) to
              (3*x^2/(5*y), y^2/(2*x^2))

  [Python]

      >>> from sage.all import *
      >>> A = AffineSpace(ZZ, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
      >>> DynamicalSystem_affine([Integer(3)*x**Integer(2)/(Integer(5)*y), y**Integer(2)/(Integer(2)*x**Integer(2))])
      Dynamical System of Affine Space of dimension 2 over Rational Field
        Defn: Defined on coordinates by sending (x, y) to
              (3*x^2/(5*y), y^2/(2*x^2))

  Sage

      sage: A.<x,y> = AffineSpace(QQ, 2)
      sage: DynamicalSystem_affine([3/2*x^2, y^2])
      Dynamical System of Affine Space of dimension 2 over Rational Field
        Defn: Defined on coordinates by sending (x, y) to
              (3/2*x^2, y^2)

  Python

      >>> from sage.all import *
      >>> A = AffineSpace(QQ, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
      >>> DynamicalSystem_affine([Integer(3)/Integer(2)*x**Integer(2), y**Integer(2)])
      Dynamical System of Affine Space of dimension 2 over Rational Field
        Defn: Defined on coordinates by sending (x, y) to
              (3/2*x^2, y^2)

  If you pass in quotient ring elements, they are reduced:

  Sage

      sage: # needs sage.libs.singular
      sage: A.<x,y,z> = AffineSpace(QQ, 3)
      sage: X = A.subscheme([x - y])
      sage: u,v,w = X.coordinate_ring().gens()
      sage: DynamicalSystem_affine([u, v, u+v], domain=X)
      Dynamical System of Closed subscheme of Affine Space of dimension 3
      over Rational Field defined by:
        x - y
        Defn: Defined on coordinates by sending (x, y, z) to
              (y, y, 2*y)

  [Python]

      >>> from sage.all import *
      >>> # needs sage.libs.singular
      >>> A = AffineSpace(QQ, Integer(3), names=('x', 'y', 'z',)); (x, y, z,) = A._first_ngens(3)
      >>> X = A.subscheme([x - y])
      >>> u,v,w = X.coordinate_ring().gens()
      >>> DynamicalSystem_affine([u, v, u+v], domain=X)
      Dynamical System of Closed subscheme of Affine Space of dimension 3
      over Rational Field defined by:
        x - y
        Defn: Defined on coordinates by sending (x, y, z) to
              (y, y, 2*y)

  Sage

      sage: # needs sage.libs.singular
      sage: R.<t> = PolynomialRing(QQ)
      sage: A.<x,y,z> = AffineSpace(R, 3)
      sage: X = A.subscheme(x^2 - y^2)
      sage: H = End(X)
      sage: f = H([x^2/(t*y), t*y^2, x*z])
      sage: DynamicalSystem_affine(f)
      Dynamical System of Closed subscheme of Affine Space of dimension 3
      over Univariate Polynomial Ring in t over Rational Field defined by:
        x^2 - y^2
        Defn: Defined on coordinates by sending (x, y, z) to
              (x^2/(t*y), t*y^2, x*z)

  Python

      >>> from sage.all import *
      >>> # needs sage.libs.singular
      >>> R = PolynomialRing(QQ, names=('t',)); (t,) = R._first_ngens(1)
      >>> A = AffineSpace(R, Integer(3), names=('x', 'y', 'z',)); (x, y, z,) = A._first_ngens(3)
      >>> X = A.subscheme(x**Integer(2) - y**Integer(2))
      >>> H = End(X)
      >>> f = H([x**Integer(2)/(t*y), t*y**Integer(2), x*z])
      >>> DynamicalSystem_affine(f)
      Dynamical System of Closed subscheme of Affine Space of dimension 3
      over Univariate Polynomial Ring in t over Rational Field defined by:
        x^2 - y^2
        Defn: Defined on coordinates by sending (x, y, z) to
              (x^2/(t*y), t*y^2, x*z)

  Sage

      sage: x = var('x')                                                              # needs sage.symbolic
      sage: DynamicalSystem_affine(x^2 + 1)                                           # needs sage.symbolic
      Traceback (most recent call last):
      ...
      TypeError: symbolic ring cannot be the base ring

  [Python]

      >>> from sage.all import *
      >>> x = var('x')                                                              # needs sage.symbolic
      >>> DynamicalSystem_affine(x**Integer(2) + Integer(1))                                           # needs sage.symbolic
      Traceback (most recent call last):
      ...
      TypeError: symbolic ring cannot be the base ring

  conjugate(M)

    Conjugate this dynamical system by `M`, i.e. \(M^{-1} \circ f \circ M\).

    If possible the new map will be defined over the same space. Otherwise, will try to coerce to the base ring of `M`.

    INPUT:

    - `M` – a square invertible matrix

    OUTPUT: an affine dynamical system

    EXAMPLES:

    Sage

        sage: A.<t> = AffineSpace(QQ, 1)
        sage: f = DynamicalSystem_affine([t^2 + 1])
        sage: f.conjugate(matrix([[1,2], [0,1]]))
        Dynamical System of Affine Space of dimension 1 over Rational Field
          Defn: Defined on coordinates by sending (t) to
                (t^2 + 4*t + 3)

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(1), names=('t',)); (t,) = A._first_ngens(1)
        >>> f = DynamicalSystem_affine([t**Integer(2) + Integer(1)])
        >>> f.conjugate(matrix([[Integer(1),Integer(2)], [Integer(0),Integer(1)]]))
        Dynamical System of Affine Space of dimension 1 over Rational Field
          Defn: Defined on coordinates by sending (t) to
                (t^2 + 4*t + 3)

    Sage

        sage: A.<x,y> = AffineSpace(ZZ,2)
        sage: f = DynamicalSystem_affine([x^3 + y^3, y^2])
        sage: f.conjugate(matrix([[1,2,3], [0,1,2], [0,0,1]]))
        Dynamical System of Affine Space of dimension 2 over Integer Ring
          Defn: Defined on coordinates by sending (x, y) to
                (x^3 + 6*x^2*y + 12*x*y^2 + 9*y^3
                  + 9*x^2 + 36*x*y + 40*y^2 + 27*x + 58*y + 28, y^2 + 4*y + 2)

    [Python]

        >>> from sage.all import *
        >>> A = AffineSpace(ZZ,Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([x**Integer(3) + y**Integer(3), y**Integer(2)])
        >>> f.conjugate(matrix([[Integer(1),Integer(2),Integer(3)], [Integer(0),Integer(1),Integer(2)], [Integer(0),Integer(0),Integer(1)]]))
        Dynamical System of Affine Space of dimension 2 over Integer Ring
          Defn: Defined on coordinates by sending (x, y) to
                (x^3 + 6*x^2*y + 12*x*y^2 + 9*y^3
                  + 9*x^2 + 36*x*y + 40*y^2 + 27*x + 58*y + 28, y^2 + 4*y + 2)

    Sage

        sage: # needs sage.rings.number_field
        sage: R.<x> = PolynomialRing(QQ)
        sage: K.<i> = NumberField(x^2 + 1)
        sage: A.<x> = AffineSpace(ZZ,1)
        sage: f = DynamicalSystem_affine([x^3 + 2*x^2 + 3])
        sage: f.conjugate(matrix([[i,i], [0,-i]]))
        Dynamical System of Affine Space of dimension 1 over Integer Ring
          Defn: Defined on coordinates by sending (x) to
                (x^3 + x^2 - x - 5)

    Python

        >>> from sage.all import *
        >>> # needs sage.rings.number_field
        >>> R = PolynomialRing(QQ, names=('x',)); (x,) = R._first_ngens(1)
        >>> K = NumberField(x**Integer(2) + Integer(1), names=('i',)); (i,) = K._first_ngens(1)
        >>> A = AffineSpace(ZZ,Integer(1), names=('x',)); (x,) = A._first_ngens(1)
        >>> f = DynamicalSystem_affine([x**Integer(3) + Integer(2)*x**Integer(2) + Integer(3)])
        >>> f.conjugate(matrix([[i,i], [Integer(0),-i]]))
        Dynamical System of Affine Space of dimension 1 over Integer Ring
          Defn: Defined on coordinates by sending (x) to
                (x^3 + x^2 - x - 5)

  degree()

    Return the degree of the affine dynamical system.

    EXAMPLES:

    Sage

        sage: # needs sage.rings.number_field
        sage: R.<c> = QuadraticField(7)
        sage: A.<x,y,z> = AffineSpace(R, 3)
        sage: f = DynamicalSystem_affine([x^2 + y^5 + c, x^11, z^19])
        sage: f.degree()
        19

    Python

        >>> from sage.all import *
        >>> # needs sage.rings.number_field
        >>> R = QuadraticField(Integer(7), names=('c',)); (c,) = R._first_ngens(1)
        >>> A = AffineSpace(R, Integer(3), names=('x', 'y', 'z',)); (x, y, z,) = A._first_ngens(3)
        >>> f = DynamicalSystem_affine([x**Integer(2) + y**Integer(5) + c, x**Integer(11), z**Integer(19)])
        >>> f.degree()
        19

    Sage

        sage: R.<c> = QQ[]
        sage: A.<x> = AffineSpace(R, 1)
        sage: f = DynamicalSystem_affine([x^4])
        sage: f.degree()
        4

    [Python]

        >>> from sage.all import *
        >>> R = QQ['c']; (c,) = R._first_ngens(1)
        >>> A = AffineSpace(R, Integer(1), names=('x',)); (x,) = A._first_ngens(1)
        >>> f = DynamicalSystem_affine([x**Integer(4)])
        >>> f.degree()
        4

    Sage

        sage: A.<x,y> = AffineSpace(QQ, 2)
        sage: f = DynamicalSystem_affine([x, y/(1 + x^2)])
        sage: f.degree()
        2

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([x, y/(Integer(1) + x**Integer(2))])
        >>> f.degree()
        2

  dynatomic_polynomial(period)

    Compute the (affine) dynatomic polynomial of a dynamical system \(f: \mathbb{A}^1 \to \mathbb{A}^1\).

    The dynatomic polynomial is the analog of the cyclotomic polynomial and its roots are the points of formal period \(n\).

    ALGORITHM:

    Homogenize to a map \(f: \mathbb{P}^1 \to \mathbb{P}^1\) and compute the dynatomic polynomial there. Then, dehomogenize.

    INPUT:

    - `period` – positive integer or a list/tuple \([m,n]\), where \(m\) is the preperiod and \(n\) is the period

    OUTPUT:

    If possible, a single variable polynomial in the coordinate ring of the polynomial. Otherwise a fraction field element of the coordinate ring of the polynomial.

    EXAMPLES:

    Sage

        sage: A.<x,y> = AffineSpace(QQ, 2)
        sage: f = DynamicalSystem_affine([x^2+y^2, y^2])
        sage: f.dynatomic_polynomial(2)
        Traceback (most recent call last):
        ...
        TypeError: does not make sense in dimension >1

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([x**Integer(2)+y**Integer(2), y**Integer(2)])
        >>> f.dynatomic_polynomial(Integer(2))
        Traceback (most recent call last):
        ...
        TypeError: does not make sense in dimension >1

    Sage

        sage: A.<x> = AffineSpace(ZZ, 1)
        sage: f = DynamicalSystem_affine([(x^2+1)/x])
        sage: f.dynatomic_polynomial(4)                                             # needs sage.libs.pari
        2*x^12 + 18*x^10 + 57*x^8 + 79*x^6 + 48*x^4 + 12*x^2 + 1

    [Python]

        >>> from sage.all import *
        >>> A = AffineSpace(ZZ, Integer(1), names=('x',)); (x,) = A._first_ngens(1)
        >>> f = DynamicalSystem_affine([(x**Integer(2)+Integer(1))/x])
        >>> f.dynatomic_polynomial(Integer(4))                                             # needs sage.libs.pari
        2*x^12 + 18*x^10 + 57*x^8 + 79*x^6 + 48*x^4 + 12*x^2 + 1

    Sage

        sage: A.<x> = AffineSpace(CC, 1)
        sage: f = DynamicalSystem_affine([(x^2+1)/(3*x)])
        sage: f.dynatomic_polynomial(3)
        13.0000000000000*x^6 + 117.000000000000*x^4 + 78.0000000000000*x^2 +
        1.00000000000000

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(CC, Integer(1), names=('x',)); (x,) = A._first_ngens(1)
        >>> f = DynamicalSystem_affine([(x**Integer(2)+Integer(1))/(Integer(3)*x)])
        >>> f.dynatomic_polynomial(Integer(3))
        13.0000000000000*x^6 + 117.000000000000*x^4 + 78.0000000000000*x^2 +
        1.00000000000000

    Sage

        sage: A.<x> = AffineSpace(QQ, 1)
        sage: f = DynamicalSystem_affine([x^2-10/9])
        sage: f.dynatomic_polynomial([2, 1])
        531441*x^4 - 649539*x^2 - 524880

    [Python]

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(1), names=('x',)); (x,) = A._first_ngens(1)
        >>> f = DynamicalSystem_affine([x**Integer(2)-Integer(10)/Integer(9)])
        >>> f.dynatomic_polynomial([Integer(2), Integer(1)])
        531441*x^4 - 649539*x^2 - 524880

    Sage

        sage: A.<x> = AffineSpace(CC, 1)
        sage: f = DynamicalSystem_affine([x^2+CC.0])
        sage: f.dynatomic_polynomial(2)
        x^2 + x + 1.00000000000000 + 1.00000000000000*I

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(CC, Integer(1), names=('x',)); (x,) = A._first_ngens(1)
        >>> f = DynamicalSystem_affine([x**Integer(2)+CC.gen(0)])
        >>> f.dynatomic_polynomial(Integer(2))
        x^2 + x + 1.00000000000000 + 1.00000000000000*I

    Sage

        sage: K.<c> = FunctionField(QQ)
        sage: A.<x> = AffineSpace(K, 1)
        sage: f = DynamicalSystem_affine([x^2 + c])
        sage: f.dynatomic_polynomial(4)
        x^12 + 6*c*x^10 + x^9 + (15*c^2 + 3*c)*x^8 + 4*c*x^7 + (20*c^3 + 12*c^2 + 1)*x^6
        + (6*c^2 + 2*c)*x^5 + (15*c^4 + 18*c^3 + 3*c^2 + 4*c)*x^4 + (4*c^3 + 4*c^2 + 1)*x^3
        + (6*c^5 + 12*c^4 + 6*c^3 + 5*c^2 + c)*x^2 + (c^4 + 2*c^3 + c^2 + 2*c)*x
        + c^6 + 3*c^5 + 3*c^4 + 3*c^3 + 2*c^2 + 1

    [Python]

        >>> from sage.all import *
        >>> K = FunctionField(QQ, names=('c',)); (c,) = K._first_ngens(1)
        >>> A = AffineSpace(K, Integer(1), names=('x',)); (x,) = A._first_ngens(1)
        >>> f = DynamicalSystem_affine([x**Integer(2) + c])
        >>> f.dynatomic_polynomial(Integer(4))
        x^12 + 6*c*x^10 + x^9 + (15*c^2 + 3*c)*x^8 + 4*c*x^7 + (20*c^3 + 12*c^2 + 1)*x^6
        + (6*c^2 + 2*c)*x^5 + (15*c^4 + 18*c^3 + 3*c^2 + 4*c)*x^4 + (4*c^3 + 4*c^2 + 1)*x^3
        + (6*c^5 + 12*c^4 + 6*c^3 + 5*c^2 + c)*x^2 + (c^4 + 2*c^3 + c^2 + 2*c)*x
        + c^6 + 3*c^5 + 3*c^4 + 3*c^3 + 2*c^2 + 1

    Sage

        sage: A.<z> = AffineSpace(QQ, 1)
        sage: f = DynamicalSystem_affine([z^2+3/z+1/7])
        sage: f.dynatomic_polynomial(1).parent()
        Multivariate Polynomial Ring in z over Rational Field

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(1), names=('z',)); (z,) = A._first_ngens(1)
        >>> f = DynamicalSystem_affine([z**Integer(2)+Integer(3)/z+Integer(1)/Integer(7)])
        >>> f.dynatomic_polynomial(Integer(1)).parent()
        Multivariate Polynomial Ring in z over Rational Field

    Sage

        sage: R.<c> = QQ[]
        sage: A.<z> = AffineSpace(R,1)
        sage: f = DynamicalSystem_affine([z^2 + c])
        sage: f.dynatomic_polynomial([1,1])
        z^2 + z + c

    [Python]

        >>> from sage.all import *
        >>> R = QQ['c']; (c,) = R._first_ngens(1)
        >>> A = AffineSpace(R,Integer(1), names=('z',)); (z,) = A._first_ngens(1)
        >>> f = DynamicalSystem_affine([z**Integer(2) + c])
        >>> f.dynatomic_polynomial([Integer(1),Integer(1)])
        z^2 + z + c

    Sage

        sage: A.<x> = AffineSpace(CC,1)
        sage: F = DynamicalSystem_affine([1/2*x^2 + CC(sqrt(3))])                   # needs sage.symbolic
        sage: F.dynatomic_polynomial([1,1])                                         # needs sage.symbolic
        (0.125000000000000*x^4 + 0.366025403784439*x^2 + 1.50000000000000)/(0.500000000000000*x^2 - x + 1.73205080756888)

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(CC,Integer(1), names=('x',)); (x,) = A._first_ngens(1)
        >>> F = DynamicalSystem_affine([Integer(1)/Integer(2)*x**Integer(2) + CC(sqrt(Integer(3)))])                   # needs sage.symbolic
        >>> F.dynatomic_polynomial([Integer(1),Integer(1)])                                         # needs sage.symbolic
        (0.125000000000000*x^4 + 0.366025403784439*x^2 + 1.50000000000000)/(0.500000000000000*x^2 - x + 1.73205080756888)

  homogenize(n)

    Return the homogenization of this dynamical system.

    If its domain is a subscheme, the domain of the homogenized map is the projective embedding of the domain. The domain and codomain can be homogenized at different coordinates: `n[0]` for the domain and `n[1]` for the codomain.

    INPUT:

    - `n` – tuple of nonnegative integers; if \(n\) is an integer, then the two values of the tuple are assumed to be the same

    OUTPUT: `DynamicalSystem_projective`

    EXAMPLES:

    Sage

        sage: A.<x,y> = AffineSpace(ZZ, 2)
        sage: f = DynamicalSystem_affine([(x^2-2)/x^5, y^2])
        sage: f.homogenize(2)
        Dynamical System of Projective Space of dimension 2 over Rational Field
          Defn: Defined on coordinates by sending (x0 : x1 : x2) to
                (x0^2*x2^5 - 2*x2^7 : x0^5*x1^2 : x0^5*x2^2)

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(ZZ, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([(x**Integer(2)-Integer(2))/x**Integer(5), y**Integer(2)])
        >>> f.homogenize(Integer(2))
        Dynamical System of Projective Space of dimension 2 over Rational Field
          Defn: Defined on coordinates by sending (x0 : x1 : x2) to
                (x0^2*x2^5 - 2*x2^7 : x0^5*x1^2 : x0^5*x2^2)

    Sage

        sage: A.<x,y> = AffineSpace(CC, 2)
        sage: f = DynamicalSystem_affine([(x^2-2)/(x*y), y^2-x])
        sage: f.homogenize((2, 0))
        Dynamical System of Projective Space of dimension 2 over Complex Field with 53 bits of precision
          Defn: Defined on coordinates by sending (x0 : x1 : x2) to
                (x0*x1*x2^2 : x0^2*x2^2 + (-2.00000000000000)*x2^4 : x0*x1^3 - x0^2*x1*x2)

    [Python]

        >>> from sage.all import *
        >>> A = AffineSpace(CC, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([(x**Integer(2)-Integer(2))/(x*y), y**Integer(2)-x])
        >>> f.homogenize((Integer(2), Integer(0)))
        Dynamical System of Projective Space of dimension 2 over Complex Field with 53 bits of precision
          Defn: Defined on coordinates by sending (x0 : x1 : x2) to
                (x0*x1*x2^2 : x0^2*x2^2 + (-2.00000000000000)*x2^4 : x0*x1^3 - x0^2*x1*x2)

    Sage

        sage: A.<x,y> = AffineSpace(ZZ, 2)
        sage: X = A.subscheme([x-y^2])
        sage: f = DynamicalSystem_affine([9*y^2, 3*y], domain=X)
        sage: f.homogenize(2)
        Dynamical System of Closed subscheme of Projective Space
        of dimension 2 over Integer Ring defined by:
            x1^2 - x0*x2
            Defn: Defined on coordinates by sending (x0 : x1 : x2) to
                  (9*x1^2 : 3*x1*x2 : x2^2)

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(ZZ, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> X = A.subscheme([x-y**Integer(2)])
        >>> f = DynamicalSystem_affine([Integer(9)*y**Integer(2), Integer(3)*y], domain=X)
        >>> f.homogenize(Integer(2))
        Dynamical System of Closed subscheme of Projective Space
        of dimension 2 over Integer Ring defined by:
            x1^2 - x0*x2
            Defn: Defined on coordinates by sending (x0 : x1 : x2) to
                  (9*x1^2 : 3*x1*x2 : x2^2)

    Sage

        sage: A.<x> = AffineSpace(QQ, 1)
        sage: f = DynamicalSystem_affine([x^2-1])
        sage: f.homogenize((1, 0))
        Dynamical System of Projective Space of dimension 1 over Rational Field
          Defn: Defined on coordinates by sending (x0 : x1) to
                (x1^2 : x0^2 - x1^2)

    [Python]

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(1), names=('x',)); (x,) = A._first_ngens(1)
        >>> f = DynamicalSystem_affine([x**Integer(2)-Integer(1)])
        >>> f.homogenize((Integer(1), Integer(0)))
        Dynamical System of Projective Space of dimension 1 over Rational Field
          Defn: Defined on coordinates by sending (x0 : x1) to
                (x1^2 : x0^2 - x1^2)

    Sage

        sage: # needs sage.rings.number_field
        sage: R.<a> = PolynomialRing(QQbar)
        sage: A.<x,y> = AffineSpace(R, 2)
        sage: f = DynamicalSystem_affine([QQbar(sqrt(2))*x*y, a*x^2])               # needs sage.symbolic
        sage: f.homogenize(2)                                                       # needs sage.symbolic
        Dynamical System of Projective Space of dimension 2 over Univariate
        Polynomial Ring in a over Algebraic Field
          Defn: Defined on coordinates by sending (x0 : x1 : x2) to
                (1.414213562373095?*x0*x1 : a*x0^2 : x2^2)

    Python

        >>> from sage.all import *
        >>> # needs sage.rings.number_field
        >>> R = PolynomialRing(QQbar, names=('a',)); (a,) = R._first_ngens(1)
        >>> A = AffineSpace(R, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([QQbar(sqrt(Integer(2)))*x*y, a*x**Integer(2)])               # needs sage.symbolic
        >>> f.homogenize(Integer(2))                                                       # needs sage.symbolic
        Dynamical System of Projective Space of dimension 2 over Univariate
        Polynomial Ring in a over Algebraic Field
          Defn: Defined on coordinates by sending (x0 : x1 : x2) to
                (1.414213562373095?*x0*x1 : a*x0^2 : x2^2)

    Sage

        sage: P.<x,y,z> = AffineSpace(QQ, 3)
        sage: f = DynamicalSystem_affine([x^2 - 2*x*y + z*x, z^2 -y^2 , 5*z*y])
        sage: f.homogenize(2).dehomogenize(2) == f
        True

    [Python]

        >>> from sage.all import *
        >>> P = AffineSpace(QQ, Integer(3), names=('x', 'y', 'z',)); (x, y, z,) = P._first_ngens(3)
        >>> f = DynamicalSystem_affine([x**Integer(2) - Integer(2)*x*y + z*x, z**Integer(2) -y**Integer(2) , Integer(5)*z*y])
        >>> f.homogenize(Integer(2)).dehomogenize(Integer(2)) == f
        True

  multiplier(P, n, check=True)

    Return the multiplier of the point \(P\) of period \(n\) by this dynamical system.

    INPUT:

    - `P` – a point on domain of the map

    - `n` – positive integer, the period of \(P\)

    - `check` – boolean (default: `True`); verify that \(P\) has period \(n\)

    OUTPUT: a square matrix of size `self.codomain().dimension_relative()` in the `base_ring` of the map

    EXAMPLES:

    Sage

        sage: P.<x,y> = AffineSpace(QQ, 2)
        sage: f = DynamicalSystem_affine([x^2, y^2])
        sage: f.multiplier(P([1, 1]), 1)
        [2 0]
        [0 2]

    Python

        >>> from sage.all import *
        >>> P = AffineSpace(QQ, Integer(2), names=('x', 'y',)); (x, y,) = P._first_ngens(2)
        >>> f = DynamicalSystem_affine([x**Integer(2), y**Integer(2)])
        >>> f.multiplier(P([Integer(1), Integer(1)]), Integer(1))
        [2 0]
        [0 2]

    Sage

        sage: P.<x,y,z> = AffineSpace(QQ, 3)
        sage: f = DynamicalSystem_affine([x, y^2, z^2 - y])
        sage: f.multiplier(P([1/2, 1, 0]), 2)
        [1 0 0]
        [0 4 0]
        [0 0 0]

    [Python]

        >>> from sage.all import *
        >>> P = AffineSpace(QQ, Integer(3), names=('x', 'y', 'z',)); (x, y, z,) = P._first_ngens(3)
        >>> f = DynamicalSystem_affine([x, y**Integer(2), z**Integer(2) - y])
        >>> f.multiplier(P([Integer(1)/Integer(2), Integer(1), Integer(0)]), Integer(2))
        [1 0 0]
        [0 4 0]
        [0 0 0]

    Sage

        sage: P.<x> = AffineSpace(CC, 1)
        sage: f = DynamicalSystem_affine([x^2 + 1/2])
        sage: f.multiplier(P([0.5 + 0.5*I]), 1)                                     # needs sage.symbolic
        [1.00000000000000 + 1.00000000000000*I]

    Python

        >>> from sage.all import *
        >>> P = AffineSpace(CC, Integer(1), names=('x',)); (x,) = P._first_ngens(1)
        >>> f = DynamicalSystem_affine([x**Integer(2) + Integer(1)/Integer(2)])
        >>> f.multiplier(P([RealNumber('0.5') + RealNumber('0.5')*I]), Integer(1))                                     # needs sage.symbolic
        [1.00000000000000 + 1.00000000000000*I]

    Sage

        sage: R.<t> = PolynomialRing(CC, 1)
        sage: P.<x> = AffineSpace(R, 1)
        sage: f = DynamicalSystem_affine([x^2 - t^2 + t])
        sage: f.multiplier(P([-t + 1]), 1)
        [(-2.00000000000000)*t + 2.00000000000000]

    [Python]

        >>> from sage.all import *
        >>> R = PolynomialRing(CC, Integer(1), names=('t',)); (t,) = R._first_ngens(1)
        >>> P = AffineSpace(R, Integer(1), names=('x',)); (x,) = P._first_ngens(1)
        >>> f = DynamicalSystem_affine([x**Integer(2) - t**Integer(2) + t])
        >>> f.multiplier(P([-t + Integer(1)]), Integer(1))
        [(-2.00000000000000)*t + 2.00000000000000]

    Sage

        sage: P.<x,y> = AffineSpace(QQ, 2)
        sage: X = P.subscheme([x^2 - y^2])
        sage: f = DynamicalSystem_affine([x^2, y^2], domain=X)
        sage: f.multiplier(X([1, 1]), 1)
        [2 0]
        [0 2]

    Python

        >>> from sage.all import *
        >>> P = AffineSpace(QQ, Integer(2), names=('x', 'y',)); (x, y,) = P._first_ngens(2)
        >>> X = P.subscheme([x**Integer(2) - y**Integer(2)])
        >>> f = DynamicalSystem_affine([x**Integer(2), y**Integer(2)], domain=X)
        >>> f.multiplier(X([Integer(1), Integer(1)]), Integer(1))
        [2 0]
        [0 2]

  nth_iterate(P, n)

    Return the \(n\)-th iterate of the point \(P\) by this dynamical system.

    INPUT:

    - `P` – a point in the map’s domain

    - `n` – positive integer

    OUTPUT: a point in the map’s codomain

    EXAMPLES:

    Sage

        sage: A.<x,y> = AffineSpace(QQ, 2)
        sage: f = DynamicalSystem_affine([(x-2*y^2)/x, 3*x*y])
        sage: f.nth_iterate(A(9, 3), 3)
        (-104975/13123, -9566667)

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([(x-Integer(2)*y**Integer(2))/x, Integer(3)*x*y])
        >>> f.nth_iterate(A(Integer(9), Integer(3)), Integer(3))
        (-104975/13123, -9566667)

    Sage

        sage: A.<x,y> = AffineSpace(ZZ, 2)
        sage: X = A.subscheme([x-y^2])
        sage: f = DynamicalSystem_affine([9*y^2, 3*y], domain=X)
        sage: f.nth_iterate(X(9, 3), 4)
        (59049, 243)

    [Python]

        >>> from sage.all import *
        >>> A = AffineSpace(ZZ, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> X = A.subscheme([x-y**Integer(2)])
        >>> f = DynamicalSystem_affine([Integer(9)*y**Integer(2), Integer(3)*y], domain=X)
        >>> f.nth_iterate(X(Integer(9), Integer(3)), Integer(4))
        (59049, 243)

    Sage

        sage: R.<t> = PolynomialRing(QQ)
        sage: A.<x,y> = AffineSpace(FractionField(R), 2)
        sage: f = DynamicalSystem_affine([(x-t*y^2)/x, t*x*y])
        sage: f.nth_iterate(A(1, t), 3)
        ((-t^16 + 3*t^13 - 3*t^10 + t^7 + t^5 + t^3 - 1)/(t^5 + t^3 - 1), -t^9 - t^7 + t^4)

    Python

        >>> from sage.all import *
        >>> R = PolynomialRing(QQ, names=('t',)); (t,) = R._first_ngens(1)
        >>> A = AffineSpace(FractionField(R), Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([(x-t*y**Integer(2))/x, t*x*y])
        >>> f.nth_iterate(A(Integer(1), t), Integer(3))
        ((-t^16 + 3*t^13 - 3*t^10 + t^7 + t^5 + t^3 - 1)/(t^5 + t^3 - 1), -t^9 - t^7 + t^4)

    Sage

        sage: A.<x,y,z> = AffineSpace(QQ, 3)
        sage: X = A.subscheme([x^2-y^2])
        sage: f = DynamicalSystem_affine([x^2, y^2, x+y], domain=X)
        sage: f.nth_iterate_map(2)
        Dynamical System of Closed subscheme of Affine Space of dimension 3 over Rational Field defined by:
              x^2 - y^2
              Defn: Defined on coordinates by sending (x, y, z) to
                    (x^4, y^4, x^2 + y^2)

    [Python]

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(3), names=('x', 'y', 'z',)); (x, y, z,) = A._first_ngens(3)
        >>> X = A.subscheme([x**Integer(2)-y**Integer(2)])
        >>> f = DynamicalSystem_affine([x**Integer(2), y**Integer(2), x+y], domain=X)
        >>> f.nth_iterate_map(Integer(2))
        Dynamical System of Closed subscheme of Affine Space of dimension 3 over Rational Field defined by:
              x^2 - y^2
              Defn: Defined on coordinates by sending (x, y, z) to
                    (x^4, y^4, x^2 + y^2)

  nth_iterate_map(n)

    Return the \(n\)-th iterate of `self`.

    ALGORITHM:

    Uses a form of successive squaring to reducing computations.

    Todo

    This could be improved.

    INPUT:

    - `n` – positive integer

    OUTPUT: a dynamical system of affine space

    EXAMPLES:

    Sage

        sage: A.<x,y> = AffineSpace(ZZ, 2)
        sage: f = DynamicalSystem_affine([(x^2-2)/(2*y), y^2-3*x])
        sage: f.nth_iterate_map(2)
        Dynamical System of Affine Space of dimension 2 over Rational Field
          Defn: Defined on coordinates by sending (x, y) to
                ((x^4 - 4*x^2 - 8*y^2 + 4)/(8*y^4 - 24*x*y^2), (2*y^5 - 12*x*y^3
        + 18*x^2*y - 3*x^2 + 6)/(2*y))

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(ZZ, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([(x**Integer(2)-Integer(2))/(Integer(2)*y), y**Integer(2)-Integer(3)*x])
        >>> f.nth_iterate_map(Integer(2))
        Dynamical System of Affine Space of dimension 2 over Rational Field
          Defn: Defined on coordinates by sending (x, y) to
                ((x^4 - 4*x^2 - 8*y^2 + 4)/(8*y^4 - 24*x*y^2), (2*y^5 - 12*x*y^3
        + 18*x^2*y - 3*x^2 + 6)/(2*y))

    Sage

        sage: A.<x> = AffineSpace(QQ, 1)
        sage: f = DynamicalSystem_affine([(3*x^2-2)/(x)])
        sage: f.nth_iterate_map(3)
        Dynamical System of Affine Space of dimension 1 over Rational Field
          Defn: Defined on coordinates by sending (x) to
                ((2187*x^8 - 6174*x^6 + 6300*x^4 - 2744*x^2 + 432)/(81*x^7 -
        168*x^5 + 112*x^3 - 24*x))

    [Python]

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(1), names=('x',)); (x,) = A._first_ngens(1)
        >>> f = DynamicalSystem_affine([(Integer(3)*x**Integer(2)-Integer(2))/(x)])
        >>> f.nth_iterate_map(Integer(3))
        Dynamical System of Affine Space of dimension 1 over Rational Field
          Defn: Defined on coordinates by sending (x) to
                ((2187*x^8 - 6174*x^6 + 6300*x^4 - 2744*x^2 + 432)/(81*x^7 -
        168*x^5 + 112*x^3 - 24*x))

    Sage

        sage: A.<x,y> = AffineSpace(ZZ, 2)
        sage: X = A.subscheme([x-y^2])
        sage: f = DynamicalSystem_affine([9*x^2, 3*y], domain=X)
        sage: f.nth_iterate_map(2)
        Dynamical System of Closed subscheme of Affine Space of dimension 2
        over Integer Ring defined by:
          -y^2 + x
          Defn: Defined on coordinates by sending (x, y) to
                (729*x^4, 9*y)

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(ZZ, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> X = A.subscheme([x-y**Integer(2)])
        >>> f = DynamicalSystem_affine([Integer(9)*x**Integer(2), Integer(3)*y], domain=X)
        >>> f.nth_iterate_map(Integer(2))
        Dynamical System of Closed subscheme of Affine Space of dimension 2
        over Integer Ring defined by:
          -y^2 + x
          Defn: Defined on coordinates by sending (x, y) to
                (729*x^4, 9*y)

    Sage

        sage: A.<x,y> = AffineSpace(ZZ, 2)
        sage: f = DynamicalSystem_affine([3/5*x^2, y^2/(2*x^2)])
        sage: f.nth_iterate_map(2)
        Dynamical System of Affine Space of dimension 2 over Rational Field
          Defn: Defined on coordinates by sending (x, y) to
                (27/125*x^4, y^4/(72/25*x^8))

    [Python]

        >>> from sage.all import *
        >>> A = AffineSpace(ZZ, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([Integer(3)/Integer(5)*x**Integer(2), y**Integer(2)/(Integer(2)*x**Integer(2))])
        >>> f.nth_iterate_map(Integer(2))
        Dynamical System of Affine Space of dimension 2 over Rational Field
          Defn: Defined on coordinates by sending (x, y) to
                (27/125*x^4, y^4/(72/25*x^8))

  orbit(P, n)

    Return the orbit of \(P\) by the dynamical system.

    Let \(F\) be this dynamical system. If \(n\) is an integer return \([P, F(P), \ldots, F^n(P)]\). If \(n\) is a list or tuple \(n = [m,k]\) return \([F^m(P), \ldots, F^k(P)]\).

    INPUT:

    - `P` – a point in the map’s domain

    - `n` – nonnegative integer or list or tuple of two nonnegative integers

    OUTPUT: list of points in the map’s codomain

    EXAMPLES:

    Sage

        sage: A.<x,y> = AffineSpace(QQ, 2)
        sage: f = DynamicalSystem_affine([(x-2*y^2)/x, 3*x*y])
        sage: f.orbit(A(9, 3), 3)
        [(9, 3), (-1, 81), (13123, -243), (-104975/13123, -9566667)]

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([(x-Integer(2)*y**Integer(2))/x, Integer(3)*x*y])
        >>> f.orbit(A(Integer(9), Integer(3)), Integer(3))
        [(9, 3), (-1, 81), (13123, -243), (-104975/13123, -9566667)]

    Sage

        sage: A.<x> = AffineSpace(QQ, 1)
        sage: f = DynamicalSystem_affine([(x-2)/x])
        sage: f.orbit(A(1/2), [1, 3])
        [(-3), (5/3), (-1/5)]

    [Python]

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(1), names=('x',)); (x,) = A._first_ngens(1)
        >>> f = DynamicalSystem_affine([(x-Integer(2))/x])
        >>> f.orbit(A(Integer(1)/Integer(2)), [Integer(1), Integer(3)])
        [(-3), (5/3), (-1/5)]

    Sage

        sage: A.<x,y> = AffineSpace(ZZ, 2)
        sage: X = A.subscheme([x-y^2])
        sage: f = DynamicalSystem_affine([9*y^2, 3*y], domain=X)
        sage: f.orbit(X(9, 3), (0, 4))
        [(9, 3), (81, 9), (729, 27), (6561, 81), (59049, 243)]

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(ZZ, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> X = A.subscheme([x-y**Integer(2)])
        >>> f = DynamicalSystem_affine([Integer(9)*y**Integer(2), Integer(3)*y], domain=X)
        >>> f.orbit(X(Integer(9), Integer(3)), (Integer(0), Integer(4)))
        [(9, 3), (81, 9), (729, 27), (6561, 81), (59049, 243)]

    Sage

        sage: R.<t> = PolynomialRing(QQ)
        sage: A.<x,y> = AffineSpace(FractionField(R), 2)
        sage: f = DynamicalSystem_affine([(x-t*y^2)/x, t*x*y])
        sage: f.orbit(A(1, t), 3)
        [(1, t),
         (-t^3 + 1, t^2),
         ((t^5 + t^3 - 1)/(t^3 - 1), -t^6 + t^3),
         ((-t^16 + 3*t^13 - 3*t^10 + t^7 + t^5 + t^3 - 1)/(t^5 + t^3 - 1), -t^9 - t^7 + t^4)]

    [Python]

        >>> from sage.all import *
        >>> R = PolynomialRing(QQ, names=('t',)); (t,) = R._first_ngens(1)
        >>> A = AffineSpace(FractionField(R), Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([(x-t*y**Integer(2))/x, t*x*y])
        >>> f.orbit(A(Integer(1), t), Integer(3))
        [(1, t),
         (-t^3 + 1, t^2),
         ((t^5 + t^3 - 1)/(t^3 - 1), -t^6 + t^3),
         ((-t^16 + 3*t^13 - 3*t^10 + t^7 + t^5 + t^3 - 1)/(t^5 + t^3 - 1), -t^9 - t^7 + t^4)]

class sage.dynamics.arithmetic_dynamics.affine_ds.DynamicalSystem_affine_field(polys_or_rat_fncts, domain)

  Bases: `DynamicalSystem_affine`, `SchemeMorphism_polynomial_affine_space_field`

  reduce_base_field()

    Return this map defined over the field of definition of the coefficients.

    The base field of the map could be strictly larger than the field where all of the coefficients are defined. This function reduces the base field to the minimal possible. This can be done when the base ring is a number field, `QQbar`, a finite field, or algebraic closure of a finite field.

    OUTPUT: a dynamical system

    EXAMPLES:

    Sage

        sage: # needs sage.rings.finite_rings
        sage: K.<t> = GF(5^2)
        sage: A.<x,y> = AffineSpace(K, 2)
        sage: f = DynamicalSystem_affine([x^2 + 3*y^2, 3*y^2])
        sage: f.reduce_base_field()
        Dynamical System of Affine Space of dimension 2 over Finite Field of size 5
          Defn: Defined on coordinates by sending (x, y) to
                (x^2 - 2*y^2, -2*y^2)

    Python

        >>> from sage.all import *
        >>> # needs sage.rings.finite_rings
        >>> K = GF(Integer(5)**Integer(2), names=('t',)); (t,) = K._first_ngens(1)
        >>> A = AffineSpace(K, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([x**Integer(2) + Integer(3)*y**Integer(2), Integer(3)*y**Integer(2)])
        >>> f.reduce_base_field()
        Dynamical System of Affine Space of dimension 2 over Finite Field of size 5
          Defn: Defined on coordinates by sending (x, y) to
                (x^2 - 2*y^2, -2*y^2)

    Sage

        sage: # needs sage.rings.number_field sage.symbolic
        sage: A.<x,y> = AffineSpace(QQbar, 2)
        sage: f = DynamicalSystem_affine([x^2 + QQbar(sqrt(3))*y^2,
        ....:                             QQbar(sqrt(-1))*y^2])
        sage: f.reduce_base_field()
        Dynamical System of Affine Space of dimension 2 over Number Field in a
         with defining polynomial y^4 - y^2 + 1
         with a = -0.866025403784439? + 0.50000000000000000?*I
          Defn: Defined on coordinates by sending (x, y) to
                (x^2 + (a^3 - 2*a)*y^2, (a^3)*y^2)

    [Python]

        >>> from sage.all import *
        >>> # needs sage.rings.number_field sage.symbolic
        >>> A = AffineSpace(QQbar, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([x**Integer(2) + QQbar(sqrt(Integer(3)))*y**Integer(2),
        ...                             QQbar(sqrt(-Integer(1)))*y**Integer(2)])
        >>> f.reduce_base_field()
        Dynamical System of Affine Space of dimension 2 over Number Field in a
         with defining polynomial y^4 - y^2 + 1
         with a = -0.866025403784439? + 0.50000000000000000?*I
          Defn: Defined on coordinates by sending (x, y) to
                (x^2 + (a^3 - 2*a)*y^2, (a^3)*y^2)

    Sage

        sage: # needs sage.rings.number_field
        sage: K.<v> = CyclotomicField(5)
        sage: A.<x,y> = AffineSpace(K, 2)
        sage: f = DynamicalSystem_affine([(3*x^2 + y) / (5*x), (y^2+1) / (x+y)])
        sage: f.reduce_base_field()
        Dynamical System of Affine Space of dimension 2 over Rational Field
          Defn: Defined on coordinates by sending (x, y) to
                ((3*x^2 + y)/(5*x), (5*y^2 + 5)/(5*x + 5*y))

    Python

        >>> from sage.all import *
        >>> # needs sage.rings.number_field
        >>> K = CyclotomicField(Integer(5), names=('v',)); (v,) = K._first_ngens(1)
        >>> A = AffineSpace(K, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([(Integer(3)*x**Integer(2) + y) / (Integer(5)*x), (y**Integer(2)+Integer(1)) / (x+y)])
        >>> f.reduce_base_field()
        Dynamical System of Affine Space of dimension 2 over Rational Field
          Defn: Defined on coordinates by sending (x, y) to
                ((3*x^2 + y)/(5*x), (5*y^2 + 5)/(5*x + 5*y))

  weil_restriction()

    Compute the Weil restriction of this morphism over some extension field.

    If the field is a finite field, then this computes the Weil restriction to the prime subfield.

    A Weil restriction of scalars - denoted \(Res_{L/k}\) - is a functor which, for any finite extension of fields \(L/k\) and any algebraic variety \(X\) over \(L\), produces another corresponding variety \(Res_{L/k}(X)\), defined over \(k\). It is useful for reducing questions about varieties over large fields to questions about more complicated varieties over smaller fields. Since it is a functor it also applied to morphisms. In particular, the functor applied to a morphism gives the equivalent morphism from the Weil restriction of the domain to the Weil restriction of the codomain.

    OUTPUT:

    Scheme morphism on the Weil restrictions of the domain and codomain of the map.

    EXAMPLES:

    Sage

        sage: # needs sage.rings.number_field
        sage: K.<v> = QuadraticField(5)
        sage: A.<x,y> = AffineSpace(K, 2)
        sage: f = DynamicalSystem_affine([x^2 - y^2, y^2])
        sage: f.weil_restriction()
        Dynamical System of Affine Space of dimension 4 over Rational Field
          Defn: Defined on coordinates by sending (z0, z1, z2, z3) to
                (z0^2 + 5*z1^2 - z2^2 - 5*z3^2, 2*z0*z1 - 2*z2*z3, z2^2 + 5*z3^2, 2*z2*z3)

    Python

        >>> from sage.all import *
        >>> # needs sage.rings.number_field
        >>> K = QuadraticField(Integer(5), names=('v',)); (v,) = K._first_ngens(1)
        >>> A = AffineSpace(K, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([x**Integer(2) - y**Integer(2), y**Integer(2)])
        >>> f.weil_restriction()
        Dynamical System of Affine Space of dimension 4 over Rational Field
          Defn: Defined on coordinates by sending (z0, z1, z2, z3) to
                (z0^2 + 5*z1^2 - z2^2 - 5*z3^2, 2*z0*z1 - 2*z2*z3, z2^2 + 5*z3^2, 2*z2*z3)

    Sage

        sage: # needs sage.rings.number_field
        sage: K.<v> = QuadraticField(5)
        sage: PS.<x,y> = AffineSpace(K, 2)
        sage: f = DynamicalSystem_affine([x, y])
        sage: F = f.weil_restriction()
        sage: P = PS(2, 1)
        sage: Q = P.weil_restriction()
        sage: f(P).weil_restriction() == F(Q)
        True

    [Python]

        >>> from sage.all import *
        >>> # needs sage.rings.number_field
        >>> K = QuadraticField(Integer(5), names=('v',)); (v,) = K._first_ngens(1)
        >>> PS = AffineSpace(K, Integer(2), names=('x', 'y',)); (x, y,) = PS._first_ngens(2)
        >>> f = DynamicalSystem_affine([x, y])
        >>> F = f.weil_restriction()
        >>> P = PS(Integer(2), Integer(1))
        >>> Q = P.weil_restriction()
        >>> f(P).weil_restriction() == F(Q)
        True

class sage.dynamics.arithmetic_dynamics.affine_ds.DynamicalSystem_affine_finite_field(polys_or_rat_fncts, domain)

  Bases: `DynamicalSystem_affine_field`, `SchemeMorphism_polynomial_affine_space_finite_field`

  cyclegraph()

    Return the digraph of all orbits of this morphism mod \(p\).

    For subschemes, only points on the subscheme whose image are also on the subscheme are in the digraph.

    OUTPUT: a digraph

    EXAMPLES:

    Sage

        sage: P.<x,y> = AffineSpace(GF(5), 2)
        sage: f = DynamicalSystem_affine([x^2 - y, x*y + 1])
        sage: f.cyclegraph()                                                        # needs sage.graphs
        Looped digraph on 25 vertices

    Python

        >>> from sage.all import *
        >>> P = AffineSpace(GF(Integer(5)), Integer(2), names=('x', 'y',)); (x, y,) = P._first_ngens(2)
        >>> f = DynamicalSystem_affine([x**Integer(2) - y, x*y + Integer(1)])
        >>> f.cyclegraph()                                                        # needs sage.graphs
        Looped digraph on 25 vertices

    Sage

        sage: # needs sage.rings.finite_rings
        sage: P.<x> = AffineSpace(GF(3^3, 't'), 1)
        sage: f = DynamicalSystem_affine([x^2 - 1])
        sage: f.cyclegraph()                                                        # needs sage.graphs
        Looped digraph on 27 vertices

    [Python]

        >>> from sage.all import *
        >>> # needs sage.rings.finite_rings
        >>> P = AffineSpace(GF(Integer(3)**Integer(3), 't'), Integer(1), names=('x',)); (x,) = P._first_ngens(1)
        >>> f = DynamicalSystem_affine([x**Integer(2) - Integer(1)])
        >>> f.cyclegraph()                                                        # needs sage.graphs
        Looped digraph on 27 vertices

    Sage

        sage: P.<x,y> = AffineSpace(GF(7), 2)
        sage: X = P.subscheme(x - y)
        sage: f = DynamicalSystem_affine([x^2, y^2], domain=X)
        sage: f.cyclegraph()                                                        # needs sage.graphs
        Looped digraph on 7 vertices

    Python

        >>> from sage.all import *
        >>> P = AffineSpace(GF(Integer(7)), Integer(2), names=('x', 'y',)); (x, y,) = P._first_ngens(2)
        >>> X = P.subscheme(x - y)
        >>> f = DynamicalSystem_affine([x**Integer(2), y**Integer(2)], domain=X)
        >>> f.cyclegraph()                                                        # needs sage.graphs
        Looped digraph on 7 vertices

  orbit_structure(P)

    Every point is preperiodic over a finite field.

    This function returns the pair \([m,n]\) where \(m\) is the preperiod and \(n\) is the period of the point \(P\) by this map.

    INPUT:

    - `P` – a point in the map’s domain

    OUTPUT: list \([m, n]\) of integers

    EXAMPLES:

    Sage

        sage: A.<x,y> = AffineSpace(GF(13), 2)
        sage: f = DynamicalSystem_affine([x^2 - 1, y^2])
        sage: f.orbit_structure(A(2, 3))
        [1, 6]

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(GF(Integer(13)), Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> f = DynamicalSystem_affine([x**Integer(2) - Integer(1), y**Integer(2)])
        >>> f.orbit_structure(A(Integer(2), Integer(3)))
        [1, 6]

    Sage

        sage: # needs sage.rings.finite_rings
        sage: A.<x,y,z> = AffineSpace(GF(49, 't'), 3)
        sage: f = DynamicalSystem_affine([x^2 - z, x - y + z, y^2 - x^2])
        sage: f.orbit_structure(A(1, 1, 2))
        [7, 6]

    [Python]

        >>> from sage.all import *
        >>> # needs sage.rings.finite_rings
        >>> A = AffineSpace(GF(Integer(49), 't'), Integer(3), names=('x', 'y', 'z',)); (x, y, z,) = A._first_ngens(3)
        >>> f = DynamicalSystem_affine([x**Integer(2) - z, x - y + z, y**Integer(2) - x**Integer(2)])
        >>> f.orbit_structure(A(Integer(1), Integer(1), Integer(2)))
        [7, 6]