For schemes \(X\) and \(Y\), this module implements the set of morphisms \(Hom(X,Y)\). This is done by SchemeHomset_generic.
As a special case, the Hom-sets can also represent the points of a scheme. Recall that the \(K\)-rational points of a scheme \(X\) over \(k\) can be identified with the set of morphisms \(Spec(K) \to X\). In Sage, the rational points are implemented by such scheme morphisms. This is done by SchemeHomset_points and its subclasses.
Note
You should not create the Hom-sets manually. Instead, use the Hom() method that is inherited by all schemes.
AUTHORS:
EXAMPLES:
Here is a simple example, the projection of \(\mathbb{P}^1\times\mathbb{P}^1\to \mathbb{P}^1\)
sage: P1xP1 = toric_varieties.P1xP1()
sage: P1 = toric_varieties.P1()
sage: hom_set = P1xP1.Hom(P1); hom_set
Set of morphisms
From: 2-d CPR-Fano toric variety covered by 4 affine patches
To: 1-d CPR-Fano toric variety covered by 2 affine patches
In terms of the fan, we can define this morphism by the projection onto the first coordinate. The Hom-set can construct the morphism from the projection matrix alone:
sage: hom_set(matrix([[1],[0]]))
Scheme morphism:
From: 2-d CPR-Fano toric variety covered by 4 affine patches
To: 1-d CPR-Fano toric variety covered by 2 affine patches
Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
to Rational polyhedral fan in 1-d lattice N.
sage: _.as_polynomial_map()
Scheme morphism:
From: 2-d CPR-Fano toric variety covered by 4 affine patches
To: 1-d CPR-Fano toric variety covered by 2 affine patches
Defn: Defined on coordinates by sending [s : t : x : y] to
[s : t]
In the case of toric algebraic schemes (defined by polynomials in toric varieties), this module defines the underlying morphism of the ambient toric varieties:
sage: P1xP1.inject_variables()
Defining s, t, x, y
sage: S = P1xP1.subscheme([s*x-t*y])
sage: type(S.Hom(S))
<class 'sage.schemes.toric.homset.SchemeHomset_toric_variety_with_category'>
Finally, you can have morphisms defined through homogeneous coordinates where the codomain is not implemented as a toric variety:
sage: P2_toric.<x,y,z> = toric_varieties.P2()
sage: P2_native.<u,v,w> = ProjectiveSpace(QQ, 2)
sage: toric_to_native = P2_toric.Hom(P2_native); toric_to_native
Set of morphisms
From: 2-d CPR-Fano toric variety covered by 3 affine patches
To: Projective Space of dimension 2 over Rational Field
sage: type(toric_to_native)
<class 'sage.schemes.toric.homset.SchemeHomset_toric_variety_with_category'>
sage: toric_to_native([x^2, y^2, z^2])
Scheme morphism:
From: 2-d CPR-Fano toric variety covered by 3 affine patches
To: Projective Space of dimension 2 over Rational Field
Defn: Defined on coordinates by sending [x : y : z] to
(x^2 : y^2 : z^2)
sage: native_to_toric = P2_native.Hom(P2_toric); native_to_toric
Set of morphisms
From: Projective Space of dimension 2 over Rational Field
To: 2-d CPR-Fano toric variety covered by 3 affine patches
sage: type(native_to_toric)
<class 'sage.schemes.generic.homset.SchemeHomset_generic_with_category'>
sage: native_to_toric([u^2, v^2, w^2])
Scheme morphism:
From: Projective Space of dimension 2 over Rational Field
To: 2-d CPR-Fano toric variety covered by 3 affine patches
Defn: Defined on coordinates by sending (u : v : w) to
[u^2 : v^2 : w^2]
Bases: sage.schemes.toric.homset.SchemeHomset_points_toric_base
Python constructor.
INPUT:
See SchemeHomset_generic.
EXAMPLES:
sage: from sage.schemes.generic.homset import SchemeHomset_points
sage: SchemeHomset_points(Spec(QQ), AffineSpace(ZZ,2))
Set of rational points of Affine Space of dimension 2 over Rational Field
Bases: sage.schemes.generic.homset.SchemeHomset_points
Base class for homsets with toric ambient spaces
INPUT:
OUPUT:
A scheme morphism of type SchemeHomset_points_toric_base.
EXAMPLES:
sage: P1xP1 = toric_varieties.P1xP1()
sage: P1xP1(QQ)
Set of rational points of 2-d CPR-Fano toric variety
covered by 4 affine patches
TESTS:
sage: import sage.schemes.toric.homset as HOM
sage: HOM.SchemeHomset_points_toric_base(Spec(QQ), P1xP1)
Set of rational points of 2-d CPR-Fano toric variety covered by 4 affine patches
Return whether there are finitely many points.
OUTPUT:
Boolean.
EXAMPLES:
sage: P2 = toric_varieties.P2()
sage: P2.point_set().is_finite()
False
sage: P2.change_ring(GF(7)).point_set().is_finite()
True
Bases: sage.schemes.toric.homset.SchemeHomset_points_toric_base
Set of rational points of a toric variety.
You should not use this class directly. Instead, use the point_set() method to construct the point set of a toric variety.
INPUT:
OUPUT:
A scheme morphism of type SchemeHomset_points_toric_field.
EXAMPLES:
sage: P1xP1 = toric_varieties.P1xP1()
sage: P1xP1.point_set()
Set of rational points of 2-d CPR-Fano toric variety
covered by 4 affine patches
sage: P1xP1(QQ)
Set of rational points of 2-d CPR-Fano toric variety
covered by 4 affine patches
The quotient \(\mathbb{P}^2 / \ZZ_3\) over \(GF(7)\) by the diagonal action. This is tricky because the base field has a 3-rd root of unity:
sage: fan = NormalFan(ReflexivePolytope(2, 0))
sage: X = ToricVariety(fan, base_field=GF(7))
sage: point_set = X.point_set()
sage: point_set.cardinality()
21
sage: sorted(X.point_set().list())
[[0 : 0 : 1], [0 : 1 : 0], [0 : 1 : 1], [0 : 1 : 3],
[1 : 0 : 0], [1 : 0 : 1], [1 : 0 : 3], [1 : 1 : 0],
[1 : 1 : 1], [1 : 1 : 2], [1 : 1 : 3], [1 : 1 : 4],
[1 : 1 : 5], [1 : 1 : 6], [1 : 3 : 0], [1 : 3 : 1],
[1 : 3 : 2], [1 : 3 : 3], [1 : 3 : 4], [1 : 3 : 5],
[1 : 3 : 6]]
As for a non-compact example, the blow-up of the plane is the line bundle \(O_{\mathbf{P}^1}(-1)\). Its point set is the cartesian product of the points on the base \(\mathbf{P}^1\) with the points on the fiber:
sage: fan = Fan([Cone([(1,0), (1,1)]), Cone([(1,1), (0,1)])])
sage: blowup_plane = ToricVariety(fan, base_ring=GF(3))
sage: point_set = blowup_plane.point_set()
sage: sorted(point_set.list())
[[0 : 1 : 0], [0 : 1 : 1], [0 : 1 : 2],
[1 : 0 : 0], [1 : 0 : 1], [1 : 0 : 2],
[1 : 1 : 0], [1 : 1 : 1], [1 : 1 : 2],
[1 : 2 : 0], [1 : 2 : 1], [1 : 2 : 2]]
Toric varieties with torus factors (that is, where the fan is not full-dimensional) also work:
sage: F_times_Fstar = ToricVariety(Fan([Cone([(1,0)])]), base_field=GF(3))
sage: sorted(F_times_Fstar.point_set().list())
[[0 : 1], [0 : 2], [1 : 1], [1 : 2], [2 : 1], [2 : 2]]
TESTS:
sage: import sage.schemes.toric.homset as HOM
sage: HOM.SchemeHomset_points_toric_field(Spec(QQ), P1xP1)
Set of rational points of 2-d CPR-Fano toric variety covered by 4 affine patches
Return the number of points of the toric variety.
OUTPUT:
An integer or infinity. The cardinality of the set of points.
EXAMPLES:
sage: o = lattice_polytope.cross_polytope(3)
sage: V = ToricVariety(FaceFan(o))
sage: V.change_ring(GF(2)).point_set().cardinality()
27
sage: V.change_ring(GF(8, "a")).point_set().cardinality()
729
sage: V.change_ring(GF(101)).point_set().cardinality()
1061208
For non-smooth varieties over finite fields, the points are actually constructed and iterated over. This works but is much slower:
sage: fan = NormalFan(ReflexivePolytope(2, 0))
sage: X = ToricVariety(fan, base_field=GF(7))
sage: X.point_set().cardinality()
21
Fulton’s formula does not apply since the variety is not smooth. And, indeed, naive application gives a different result:
sage: q = X.base_ring().order()
sage: n = X.dimension()
sage: d = map(len, fan().cones())
sage: sum(dk * (q-1)**(n-k) for k, dk in enumerate(d))
57
Over infinite fields the number of points is not very tricky:
sage: V.count_points()
+Infinity
ALGORITHM:
Uses the formula in Fulton [F], section 4.5.
REFERENCES:
[F] | Fulton, W., “Introduction to Toric Varieties”, Princeton University Press, 1993. |
AUTHORS:
Bases: sage.schemes.generic.homset.SchemeHomset_generic
Set of homomorphisms between two toric varieties.
EXAMPLES:
sage: P1xP1 = toric_varieties.P1xP1()
sage: P1 = toric_varieties.P1()
sage: hom_set = P1xP1.Hom(P1); hom_set
Set of morphisms
From: 2-d CPR-Fano toric variety covered by 4 affine patches
To: 1-d CPR-Fano toric variety covered by 2 affine patches
sage: type(hom_set)
<class 'sage.schemes.toric.homset.SchemeHomset_toric_variety_with_category'>
sage: hom_set(matrix([[1],[0]]))
Scheme morphism:
From: 2-d CPR-Fano toric variety covered by 4 affine patches
To: 1-d CPR-Fano toric variety covered by 2 affine patches
Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
to Rational polyhedral fan in 1-d lattice N.