Note
You should never create the morphisms directy. Instead, use the hom() and Hom() methods that are inherited by all schemes.
If you want to extend the Sage library with some new kind of scheme, your new class (say, myscheme) should provide a method
Optionally, you can also provide a special Hom-set class for your subcategory of schemes. If you want to do this, you should also provide a method
Note that points on schemes are morphisms , too. But we
typically use a different notation, so they are implemented in a
different derived class. For this, you should implement a method
Optionally, you can also provide a special Hom-set for the points, for example the point Hom-set can provide a method to enumerate all points. If you want to do this, you should also provide a method
AUTHORS:
Bases: sage.structure.element.Element
Base class for scheme morphisms
INPUT:
EXAMPLES:
sage: from sage.schemes.generic.scheme import Scheme
sage: X = Scheme(ZZ)
sage: Hom = X.Hom(X)
sage: from sage.schemes.generic.morphism import SchemeMorphism
sage: f = SchemeMorphism(Hom)
sage: type(f)
<class 'sage.schemes.generic.morphism.SchemeMorphism'>
Return the category of the Hom-set.
OUTPUT:
A category.
EXAMPLES:
sage: A2 = AffineSpace(QQ,2)
sage: A2.structure_morphism().category()
Category of hom sets in Category of Schemes
Return the codomain (range) of the morphism.
OUTPUT:
A scheme. The codomain of the morphism self.
EXAMPLES:
sage: A2 = AffineSpace(QQ,2)
sage: A2.structure_morphism().codomain()
Spectrum of Rational Field
Return the domain of the morphism.
OUTPUT:
A scheme. The domain of the morphism self.
EXAMPLES:
sage: A2 = AffineSpace(QQ,2)
sage: A2.structure_morphism().domain()
Affine Space of dimension 2 over Rational Field
Glue two morphism
INPUT:
OUTPUT:
Assuming that self and other are open immersions with the same domain, return scheme obtained by gluing along the images.
EXAMPLES:
We construct a scheme isomorphic to the projective line over
by gluing two copies of
minus a point:
sage: R.<x,y> = PolynomialRing(QQ, 2)
sage: S.<xbar, ybar> = R.quotient(x*y - 1)
sage: Rx = PolynomialRing(QQ, 'x')
sage: i1 = Rx.hom([xbar])
sage: Ry = PolynomialRing(QQ, 'y')
sage: i2 = Ry.hom([ybar])
sage: Sch = Schemes()
sage: f1 = Sch(i1)
sage: f2 = Sch(i2)
Now f1 and f2 have the same domain, which is a
minus a point. We glue along the domain:
sage: P1 = f1.glue_along_domains(f2)
sage: P1
Scheme obtained by gluing X and Y along U, where
X: Spectrum of Univariate Polynomial Ring in x over Rational Field
Y: Spectrum of Univariate Polynomial Ring in y over Rational Field
U: Spectrum of Quotient of Multivariate Polynomial Ring in x, y
over Rational Field by the ideal (x*y - 1)
sage: a, b = P1.gluing_maps()
sage: a
Affine Scheme morphism:
From: Spectrum of Quotient of Multivariate Polynomial Ring in x, y
over Rational Field by the ideal (x*y - 1)
To: Spectrum of Univariate Polynomial Ring in x over Rational Field
Defn: Ring morphism:
From: Univariate Polynomial Ring in x over Rational Field
To: Quotient of Multivariate Polynomial Ring in x, y over
Rational Field by the ideal (x*y - 1)
Defn: x |--> xbar
sage: b
Affine Scheme morphism:
From: Spectrum of Quotient of Multivariate Polynomial Ring in x, y
over Rational Field by the ideal (x*y - 1)
To: Spectrum of Univariate Polynomial Ring in y over Rational Field
Defn: Ring morphism:
From: Univariate Polynomial Ring in y over Rational Field
To: Quotient of Multivariate Polynomial Ring in x, y over
Rational Field by the ideal (x*y - 1)
Defn: y |--> ybar
Return wether the morphism is an endomorphism.
OUTPUT:
Boolean. Whether the domain and codomain are identical.
EXAMPLES:
sage: X = AffineSpace(QQ,2)
sage: X.structure_morphism().is_endomorphism()
False
sage: X.identity_morphism().is_endomorphism()
True
Bases: sage.schemes.generic.morphism.SchemeMorphism
Return the identity morphism from to itself.
INPUT:
EXAMPLES:
sage: X = Spec(ZZ)
sage: X.identity_morphism() # indirect doctest
Scheme endomorphism of Spectrum of Integer Ring
Defn: Identity map
Bases: sage.schemes.generic.morphism.SchemeMorphism
Base class for rational points on schemes.
Recall that the -rational points of a scheme
over
can
be identified with the set of morphisms
. In Sage,
the rational points are implemented by such scheme morphisms.
EXAMPLES:
sage: from sage.schemes.generic.morphism import SchemeMorphism
sage: f = SchemeMorphism(Spec(ZZ).Hom(Spec(ZZ)))
sage: type(f)
<class 'sage.schemes.generic.morphism.SchemeMorphism'>
Return the scheme whose point is represented.
OUTPUT:
A scheme.
EXAMPLES:
sage: A = AffineSpace(2, QQ)
sage: a = A(1,2)
sage: a.scheme()
Affine Space of dimension 2 over Rational Field
Bases: sage.structure.element.AdditiveGroupElement, sage.schemes.generic.morphism.SchemeMorphism_point_projective_field
A rational point of an abelian variety over a field.
EXAMPLES:
sage: E = EllipticCurve([0,0,1,-1,0])
sage: origin = E(0)
sage: origin.domain()
Spectrum of Rational Field
sage: origin.codomain()
Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field
Bases: sage.schemes.generic.morphism.SchemeMorphism_point
A rational point on an affine scheme.
INPUT:
EXAMPLES:
sage: A = AffineSpace(2, QQ)
sage: A(1,2)
(1, 2)
Bases: sage.schemes.generic.morphism.SchemeMorphism_point_projective_ring
A rational point of projective space over a field.
INPUT:
EXAMPLES:
sage: P = ProjectiveSpace(3, RR)
sage: P(2,3,4,5)
(0.400000000000000 : 0.600000000000000 : 0.800000000000000 : 1.00000000000000)
Bases: sage.schemes.generic.morphism.SchemeMorphism_point
A rational point of projective space over a ring.
INPUT:
- ``X`` -- a homset of a subscheme of an ambient projective space over a field `K`
EXAMPLES:
sage: P = ProjectiveSpace(2, ZZ)
sage: P(2,3,4)
(2 : 3 : 4)
Removes common factors from the coordinates of self (including -1).
INPUT:
- None.
OUTPUT:
- None.
Examples:
sage: P=ProjectiveSpace(ZZ,2,'x')
sage: p=P([-5,-15,-20])
sage: p.normalize_coordinates(); p
(1 : 3 : 4)
sage: P=ProjectiveSpace(Zp(7),2,'x')
sage: p=P([-5,-15,-2])
sage: p.normalize_coordinates(); p
(5 + O(7^20) : 1 + 2*7 + O(7^20) : 2 + O(7^20))
sage: R.<t>=PolynomialRing(QQ)
sage: P=ProjectiveSpace(R,2,'x')
sage: p=P([3/5*t^3,6*t, t])
sage: p.normalize_coordinates(); p
(3/5*t^2 : 6 : 1)
Scale the coordinates of the point by t. A TypeError occurs if the point is not in the base_ring of the codomain after scaling.
INPUT:
- ``t`` - a ring element
OUTPUT:
- None.
Examples:
sage: R.<t>=PolynomialRing(QQ)
sage: P=ProjectiveSpace(R,2,'x')
sage: p=P([3/5*t^3,6*t, t])
sage: p.scale_by(1/t); p
(3/5*t^2 : 6 : 1)
Bases: sage.schemes.generic.morphism.SchemeMorphism
A morphism of schemes determined by polynomials that define what the morphism does on points in the ambient space.
INPUT:
EXAMPLES:
An example involving the affine plane:
sage: R.<x,y> = QQ[]
sage: A2 = AffineSpace(R)
sage: H = A2.Hom(A2)
sage: f = H([x-y, x*y])
sage: f([0,1])
(-1, 0)
An example involving the projective line:
sage: R.<x,y> = QQ[]
sage: P1 = ProjectiveSpace(R)
sage: H = P1.Hom(P1)
sage: f = H([x^2+y^2,x*y])
sage: f([0,1])
(1 : 0)
Some checks are performed to make sure the given polynomials define a morphism:
sage: f = H([exp(x),exp(y)])
Traceback (most recent call last):
...
TypeError: polys (=[e^x, e^y]) must be elements of
Multivariate Polynomial Ring in x, y over Rational Field
Return the defining polynomials.
OUTPUT:
An immutable sequence of polynomials that defines this scheme morphism.
EXAMPLES:
sage: R.<x,y> = QQ[]
sage: A.<x,y> = AffineSpace(R)
sage: H = A.Hom(A)
sage: H([x^3+y, 1-x-y]).defining_polynomials()
[x^3 + y, -x - y + 1]
Bases: sage.schemes.generic.morphism.SchemeMorphism_polynomial
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)
Bases: sage.schemes.generic.morphism.SchemeMorphism_polynomial
A morphism of schemes determined by rational functions that define what the morphism does on points in the ambient projective space.
EXAMPLES:
sage: R.<x,y> = QQ[]
sage: P1 = ProjectiveSpace(R)
sage: H = P1.Hom(P1)
sage: H([y,2*x])
Scheme endomorphism of Projective Space of dimension 1 over Rational Field
Defn: Defined on coordinates by sending (x : y) to
(y : 2*x)
An example of a morphism between projective plane curves (see #10297):
sage: P2.<x,y,z> = ProjectiveSpace(QQ,2)
sage: f = x^3+y^3+60*z^3
sage: g = y^2*z-( x^3 - 6400*z^3/3)
sage: C = Curve(f)
sage: E = Curve(g)
sage: xbar,ybar,zbar = C.coordinate_ring().gens()
sage: H = C.Hom(E)
sage: H([zbar,xbar-ybar,-(xbar+ybar)/80])
Scheme morphism:
From: Projective Curve over Rational Field defined by x^3 + y^3 + 60*z^3
To: Projective Curve over Rational Field defined by -x^3 + y^2*z + 6400/3*z^3
Defn: Defined on coordinates by sending (x : y : z) to
(z : x - y : -1/80*x - 1/80*y)
A more complicated example:
sage: P2.<x,y,z> = ProjectiveSpace(2,QQ)
sage: P1 = P2.subscheme(x-y)
sage: H12 = P1.Hom(P2)
sage: H12([x^2,x*z, z^2])
Scheme morphism:
From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by:
x - y
To: Projective Space of dimension 2 over Rational Field
Defn: Defined on coordinates by sending (x : y : z) to
(y^2 : y*z : z^2)
We illustrate some error checking:
sage: R.<x,y> = QQ[]
sage: P1 = ProjectiveSpace(R)
sage: H = P1.Hom(P1)
sage: f = H([x-y, x*y])
Traceback (most recent call last):
...
ValueError: polys (=[x - y, x*y]) must be of the same degree
sage: H([x-1, x*y+x])
Traceback (most recent call last):
...
ValueError: polys (=[x - 1, x*y + x]) must be homogeneous
sage: H([exp(x),exp(y)])
Traceback (most recent call last):
...
TypeError: polys (=[e^x, e^y]) must be elements of
Multivariate Polynomial Ring in x, y over Rational Field
Scales by 1/gcd of the coordinate functions. Also, scales to clear any denominators from the coefficients. This is done in place.
INPUT:
- None.
OUTPUT:
- None.
Examples:
sage: P.<x,y>=ProjectiveSpace(QQ,1)
sage: H=Hom(P,P)
sage: f=H([5/4*x^3,5*x*y^2])
sage: f.normalize_coordinates(); f
Scheme endomorphism of Projective Space of dimension 1 over Rational
Field
Defn: Defined on coordinates by sending (x : y) to
(x^2 : 4*y^2)
Note
-gcd raises an attribute error if the base_ring does not support gcds.
Scales each coordiantes by a factor of t. A TypeError occurs if the point is not in the coordinate_ring of the parent after scaling.
INPUT:
- ``t`` - a ring element
OUTPUT:
- None.
Examples:
sage: R.<t>=PolynomialRing(QQ)
sage: P.<x,y>=ProjectiveSpace(R,1)
sage: H=Hom(P,P)
sage: f=H([3/5*x^2,6*y^2])
sage: f.scale_by(5/3*t); f
Scheme endomorphism of Projective Space of dimension 1 over Univariate
Polynomial Ring in t over Rational Field
Defn: Defined on coordinates by sending (x : y) to
(t*x^2 : 10*t*y^2)
Bases: sage.schemes.generic.morphism.SchemeMorphism
Morphism of spectra of rings
INPUT:
EXAMPLES:
sage: R.<x> = PolynomialRing(QQ)
sage: phi = R.hom([QQ(7)]); phi
Ring morphism:
From: Univariate Polynomial Ring in x over Rational Field
To: Rational Field
Defn: x |--> 7
sage: X = Spec(QQ); Y = Spec(R)
sage: f = X.hom(phi); f
Affine Scheme morphism:
From: Spectrum of Rational Field
To: Spectrum of Univariate Polynomial Ring in x over Rational Field
Defn: Ring morphism:
From: Univariate Polynomial Ring in x over Rational Field
To: Rational Field
Defn: x |--> 7
sage: f.ring_homomorphism()
Ring morphism:
From: Univariate Polynomial Ring in x over Rational Field
To: Rational Field
Defn: x |--> 7
Return the underlying ring homomorphism.
OUTPUT:
A ring homomorphism.
EXAMPLES:
sage: R.<x> = PolynomialRing(QQ)
sage: phi = R.hom([QQ(7)])
sage: X = Spec(QQ); Y = Spec(R)
sage: f = X.hom(phi)
sage: f.ring_homomorphism()
Ring morphism:
From: Univariate Polynomial Ring in x over Rational Field
To: Rational Field
Defn: x |--> 7
Bases: sage.schemes.generic.morphism.SchemeMorphism
The structure morphism
INPUT:
EXAMPLES:
sage: Spec(ZZ).structure_morphism() # indirect doctest
Scheme morphism:
From: Spectrum of Integer Ring
To: Spectrum of Integer Ring
Defn: Structure map
Test whether f is a scheme morphism.
INPUT:
OUTPUT:
Boolean. Return True if f is a scheme morphism or a point on an elliptic curve.
EXAMPLES:
sage: A.<x,y> = AffineSpace(QQ,2); H = A.Hom(A)
sage: f = H([y,x^2+y]); f
Scheme endomorphism of Affine Space of dimension 2 over Rational Field
Defn: Defined on coordinates by sending (x, y) to
(y, x^2 + y)
sage: from sage.schemes.generic.morphism import is_SchemeMorphism
sage: is_SchemeMorphism(f)
True