# Morphisms on affine varieties¶

A morphism of schemes determined by rational functions that define what the morphism does on points in the ambient affine space.

AUTHORS:

• David Kohel, William Stein
• Volker Braun (2011-08-08): Renamed classes, more documentation, misc cleanups.
• Ben Hutz (2013-03) iteration functionality and new directory structure for affine/projective
class sage.schemes.affine.affine_morphism.SchemeMorphism_polynomial_affine_space(parent, polys, check=True)

A morphism of schemes determined by rational functions that define what the morphism does on points in the ambient affine space.

EXAMPLES:

sage: RA.<x,y> = QQ[]
sage: A2 = AffineSpace(RA)
sage: RP.<u,v,w> = QQ[]
sage: P2 = ProjectiveSpace(RP)
sage: H = A2.Hom(P2)
sage: f = H([x, y, 1])
sage: f
Scheme morphism:
From: Affine Space of dimension 2 over Rational Field
To:   Projective Space of dimension 2 over Rational Field
Defn: Defined on coordinates by sending (x, y) to
(x : y : 1)

dynatomic_polynomial(period)

For a map $$f:\mathbb{A}^1 \to \mathbb{A}^1$$ this function computes the (affine) dynatomic polynomial. 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 – a 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 self. Otherwise a fraction field element of the coordinate ring of self

EXAMPLES:

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

::

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

::

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

::

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

global_height(prec=None)

Returns the maximum of the heights of the coefficients in any of the coordinate functions of self.

INPUT:

• prec – desired floating point precision (default: default RealField precision).

OUTPUT:

• a real number

EXAMPLES:

sage: A.<x>=AffineSpace(QQ,1)
sage: H=Hom(A,A)
sage: f=H([1/1331*x^2+4000]);
sage: f.global_height()
8.29404964010203

sage: R.<x>=PolynomialRing(QQ)
sage: k.<w>=NumberField(x^2+5)
sage: A.<x,y>=AffineSpace(k,2)
sage: H=Hom(A,A)
sage: f=H([13*w*x^2+4*y, 1/w*y^2]);
sage: f.global_height(prec=100)
3.3696683136785869233538671082


Todo

add heights to integer.pyx and remove special case

homogenize(n, newvar='h')

Return the homogenization of self. If self.domain() is a subscheme, the domain of the homogenized map is the projective embedding of self.domain()

INPUT:

• newvar – the name of the homogenization variable (only used when self.domain() is affine space)
• n – the n-th projective embedding into projective space

OUTPUT:

• SchemMorphism_polynomial_projective_space

EXAMPLES:

sage: A.<x,y>=AffineSpace(ZZ,2)
sage: H=Hom(A,A)
sage: f=H([(x^2-2)/x^5,y^2])
sage: f.homogenize(2,'z')
Scheme endomorphism of Projective Space of dimension 2 over Integer Ring
Defn: Defined on coordinates by sending (x : y : z) to
(x^2*z^5 - 2*z^7 : x^5*y^2 : x^5*z^2)

sage: A.<x,y>=AffineSpace(CC,2)
sage: H=Hom(A,A)
sage: f=H([(x^2-2)/(x*y),y^2-x])
sage: f.homogenize(0,'z')
Scheme endomorphism of Projective Space of dimension 2 over Complex
Field with 53 bits of precision
Defn: Defined on coordinates by sending (x : y : z) to
(x*y*z^2 : x^2*z^2 + (-2.00000000000000)*z^4 : x*y^3 - x^2*y*z)

sage: A.<x,y>=AffineSpace(ZZ,2)
sage: X=A.subscheme([x-y^2])
sage: H=Hom(X,X)
sage: f=H([9*y^2,3*y])
sage: f.homogenize(2)
Scheme endomorphism 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*x0*x2 : 3*x1*x2 : x2^2)

sage: R.<t>=PolynomialRing(ZZ)
sage: A.<x,y>=AffineSpace(R,2)
sage: H=Hom(A,A)
sage: f=H([(x^2-2)/y,y^2-x])
sage: f.homogenize(0,'z')
Scheme endomorphism of Projective Space of dimension 2 over Univariate
Polynomial Ring in t over Integer Ring
Defn: Defined on coordinates by sending (x : y : z) to
(y*z^2 : x^2*z + (-2)*z^3 : y^3 - x*y*z)

nth_iterate(P, n)

Returns the point $$self^n(P)$$

INPUT:

• P – a point in self.domain()
• n – a positive integer.

OUTPUT:

• a point in self.codomain()

EXAMPLES:

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

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

sage: R.<t>=PolynomialRing(QQ)
sage: A.<x,y>=AffineSpace(FractionField(R),2)
sage: H=Hom(A,A)
sage: f=H([(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)

nth_iterate_map(n)

This function returns the nth iterate of self

ALGORITHM:

Uses a form of successive squaring to reducing computations.

Todo

This could be improved.

INPUT:

• n - a positive integer.

OUTPUT:

• A map between Affine spaces

EXAMPLES:

sage: A.<x,y>=AffineSpace(ZZ,2)
sage: H=Hom(A,A)
sage: f=H([(x^2-2)/(2*y),y^2-3*x])
sage: f.nth_iterate_map(2)
Scheme endomorphism of Affine Space of dimension 2 over Integer Ring
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: A.<x>=AffineSpace(QQ,1)
sage: H=Hom(A,A)
sage: f=H([(3*x^2-2)/(x)])
sage: f.nth_iterate_map(3)
Scheme endomorphism 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: A.<x,y>=AffineSpace(ZZ,2)
sage: X=A.subscheme([x-y^2])
sage: H=Hom(X,X)
sage: f=H([9*x^2,3*y])
sage: f.nth_iterate_map(2)
Scheme endomorphism 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)

orbit(P, n)

Returns the orbit of $$P$$ by self. If $$n$$ is an integer it returns $$[P,self(P),\ldots,self^n(P)]$$.

If $$n$$ is a list or tuple $$n=[m,k]$$ it returns $$[self^m(P),\ldots,self^k(P)]$$

INPUT:

• P – a point in self.domain()
• n – a non-negative integer or list or tuple of two non-negative integers

OUTPUT:

• a list of points in self.codomain()

EXAMPLES:

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

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

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

sage: R.<t>=PolynomialRing(QQ)
sage: A.<x,y>=AffineSpace(FractionField(R),2)
sage: H=Hom(A,A)
sage: f=H([(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)]

class sage.schemes.affine.affine_morphism.SchemeMorphism_polynomial_affine_space_field(parent, polys, check=True)

The Python constructor.

See SchemeMorphism_polynomial for details.

INPUT:

• parent – Hom
• polys – list or tuple of polynomial or rational functions
• check – Boolean

OUTPUT:

EXAMPLES:

sage: A.<x,y>=AffineSpace(ZZ,2)
sage: H=Hom(A,A)
sage: H([3/5*x^2,y^2/(2*x^2)])
Traceback (most recent call last):
...
TypeError: polys (=[3/5*x^2, y^2/(2*x^2)]) must be rational functions in
Multivariate Polynomial Ring in x, y over Integer Ring

sage: A.<x,y>=AffineSpace(ZZ,2)
sage: H=Hom(A,A)
sage: H([3*x^2/(5*y),y^2/(2*x^2)])
Scheme endomorphism of Affine Space of dimension 2 over Integer Ring
Defn: Defined on coordinates by sending (x, y) to
(3*x^2/(5*y), y^2/(2*x^2))

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

sage: A.<x,y>=AffineSpace(QQ,2)
sage: X=A.subscheme([x-y^2])
sage: H=Hom(X,X)
sage: H([9/4*x^2,3/2*y])
Scheme endomorphism 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: P.<x,y,z>=ProjectiveSpace(ZZ,2)
sage: H=Hom(P,P)
sage: f=H([5*x^3 + 3*x*y^2-y^3,3*z^3 + y*x^2, x^3-z^3])
sage: f.dehomogenize(2)
Scheme endomorphism of Affine Space of dimension 2 over Integer Ring
Defn: Defined on coordinates by sending (x0, x1) to
((5*x0^3 + 3*x0*x1^2 - x1^3)/(x0^3 - 1), (x0^2*x1 + 3)/(x0^3 - 1))

class sage.schemes.affine.affine_morphism.SchemeMorphism_polynomial_affine_space_finite_field(parent, polys, check=True)

The Python constructor.

See SchemeMorphism_polynomial for details.

INPUT:

• parent – Hom
• polys – list or tuple of polynomial or rational functions
• check – Boolean

OUTPUT:

EXAMPLES:

sage: A.<x,y>=AffineSpace(ZZ,2)
sage: H=Hom(A,A)
sage: H([3/5*x^2,y^2/(2*x^2)])
Traceback (most recent call last):
...
TypeError: polys (=[3/5*x^2, y^2/(2*x^2)]) must be rational functions in
Multivariate Polynomial Ring in x, y over Integer Ring

sage: A.<x,y>=AffineSpace(ZZ,2)
sage: H=Hom(A,A)
sage: H([3*x^2/(5*y),y^2/(2*x^2)])
Scheme endomorphism of Affine Space of dimension 2 over Integer Ring
Defn: Defined on coordinates by sending (x, y) to
(3*x^2/(5*y), y^2/(2*x^2))

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

sage: A.<x,y>=AffineSpace(QQ,2)
sage: X=A.subscheme([x-y^2])
sage: H=Hom(X,X)
sage: H([9/4*x^2,3/2*y])
Scheme endomorphism 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: P.<x,y,z>=ProjectiveSpace(ZZ,2)
sage: H=Hom(P,P)
sage: f=H([5*x^3 + 3*x*y^2-y^3,3*z^3 + y*x^2, x^3-z^3])
sage: f.dehomogenize(2)
Scheme endomorphism of Affine Space of dimension 2 over Integer Ring
Defn: Defined on coordinates by sending (x0, x1) to
((5*x0^3 + 3*x0*x1^2 - x1^3)/(x0^3 - 1), (x0^2*x1 + 3)/(x0^3 - 1))

cyclegraph()

returns Digraph of all orbits of self 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: P.<x,y>=AffineSpace(GF(5),2)
sage: H=Hom(P,P)
sage: f=H([x^2-y,x*y+1])
sage: f.cyclegraph()
Looped digraph on 25 vertices

sage: P.<x>=AffineSpace(GF(3^3,'t'),1)
sage: H=Hom(P,P)
sage: f=H([x^2-1])
sage: f.cyclegraph()
Looped digraph on 27 vertices

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


#### Previous topic

Points on affine varieties

#### Next topic

Enumeration of rational points on affine schemes