A Macaulay2 package for computations with rational maps
Giovanni Staglian\`o

TL;DR
This paper introduces a Macaulay2 package called Cremona that enables efficient computation of degrees, projective degrees, and Segre classes of rational maps between projective varieties, supporting both deterministic and probabilistic methods.
Contribution
The paper presents new algorithms and implementations in Macaulay2 for computing invariants of rational maps without theoretical limitations, including probabilistic approaches.
Findings
Computes degrees and projective degrees of rational maps.
Provides a method to compute push-forward of Segre classes.
Supports both deterministic and probabilistic computations.
Abstract
The Macaulay2 package Cremona performs some computations on rational and birational maps between irreducible projective varieties. For instance, it provides methods to compute degrees and projective degrees of rational maps without any theoretical limitation, from which is derived a general method to compute the push-forward to projective space of Segre classes. Moreover, the computations can be done both deterministically and probabilistically. We give here a brief description of the methods and algorithms implemented.
| Field: | |||||
|---|---|---|---|---|---|
| Probability: | 0.0% | 0.0% | 0.2% | 7.4% | 25.3% |
| Input |
|
|
|
|
||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| complete int. of type in | 0.15 | 1.01 | 34.15 | 74.57 | ||||||||
| rational normal surface | 1.41 | 0.74 | 5.32 | 0.06 | ||||||||
| Grassmannian | 0.16 | 0.09 | 0.42 | 0.02 | ||||||||
| base locus of in Ex. 2.2 | 0.23 | 0.44 | 6.49 | 663.79 | ||||||||
| in Ex. 2.3 over | 65.76 | 83.66 | – | 0.85 | ||||||||
| in Ex. 2.3 over | 3.62 | 11.61 | 198.92 | 0.74 |
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
A Macaulay2 package for computations with rational maps
Giovanni Staglianò
Dipartimento di Ingegneria Industriale e Scienze Matematiche, Università Politecnica delle Marche, via Brecce Bianche, I-60131 Ancona, Italy
Abstract.
The Macaulay2 package Cremona performs some computations on rational and birational maps between irreducible projective varieties. For instance, it provides methods to compute degrees and projective degrees of rational maps without any theoretical limitation, from which is derived a general method to compute the push-forward to projective space of Segre classes. Moreover, the computations can be done both deterministically and probabilistically. We give here a brief description of the methods and algorithms implemented.
Key words and phrases:
Rational map, birational map, projective degrees, Segre class
2010 Mathematics Subject Classification:
14E05, 14Q15
Introduction
In this note we describe the computational package Cremona, included with Macaulay2 since version 1.9 [GS17]. A first rudimentary version of this package has been already used in an essential way in [Sta15] (it was originally named bir.m2), and recent applications can be found in [Sta17, RS17]. Here we describe version 4.2.1 of the package, included with Macaulay2 version 1.11.
Cremona performs computations on rational and birational maps between absolutely irreducible projective varieties over a field . Among other things, it provides general methods to compute projective degrees of rational maps, from which, as is well-known (see Proposition 1.2), one can interpret them as methods to compute the push-forward to projective space of Segre classes. The algorithms are naively derived from the mathematical definitions, with the advantages of being obvious, quite general and easily implemented. Moreover, all the methods (where this may make sense) are available both in a probabilistic version and in a deterministic version, and one can switch from one to the other with a boolean option named MathMode.
In Section 1, we will describe the main methods provided by the package and the algorithms implemented. Most of these have already been described in [Sta15, Section 2], but here we will consider a more general setting. For instance, Algorithm 1.3 for computing homogeneous components of kernels of homogeneous ring maps was presented in [Sta15, Algorithm 2.5] requiring that the map was between polynomial rings. In section 2, we will show how these methods work in some particular examples, concluding with an experimental comparison of the running times of one of these methods with the corresponding ones proposed in [Hel16] and [Har17] (see also [Jos15]). For further technical details we refer to the documentation of the package, which can be shown using the command viewHelp Cremona.
We mention that the package RationalMaps, by K. Schwede, D. Smolkin, S. H. Hassanzadeh, and C. J. Bott, is another package included with Macaulay2 for working with rational maps. It mainly focuses on providing a general method for inverting birational maps, which in some cases turns out to be competitive with the corresponding method of Cremona.
1. Description of the main methods
Throughout, we shall use the following notation. Let denote a field; in practical, it can be for instance , a finite field, or a fraction field of a polynomial ring over these. Let be a rational map from a subvariety to a subvariety , which can be represented, although not uniquely, by a homogeneous ring map of quotients of polynomial rings by homogeneous ideals. Sometimes we will denote by homogeneous forms of the same degree such that , for . The common degree of these elements will be denoted by .
1.1. From algebraic geometry to computational algebra
For each homogeneous ideal (resp. ), we have a closed subscheme (resp. ), and the following basic formulae hold:111By a little abuse of notation, we here are considering as a morphism defined on the open set .
[TABLE]
In particular, the (closure of the) image of is defined by the kernel of . Several issues about rational maps lead naturally to an examination of the left-hand sides of (1.1), and the right-hand sides of (1.1) can be determined using Gröbner basis techniques, whenever and are explicitly given. Furthermore, Macaulay2 provides useful commands as preimage, kernel and saturate, so that the required users’ skills are quite low. The aim of the package Cremona is to provide further tools.
1.2. Computing projective degrees
The projective degrees are the most basic invariants of a rational map. Many others can be derived from them, as for instance the dimension and the degree of the base locus. For more details on the subject, see [Har92, Example 19.4, p. 240].
Definition 1.1** (Projective degrees, [Har92]).**
- (1)
The projective degrees of the map are defined as the components of the multidegree of the closure of the graph ; equivalently, 2. (2)
the -th projective degree can be defined in terms of dimension and degree of the closure of , where is a general -dimensional linear subspace of ; precisely, if , and otherwise.
In common computer algebra systems such as Macaulay2, it is easy to translate Definition 1.1 into code. We now describe more in details how this can be done. All of this is implemented in the method projectiveDegrees; see Example 2.2 for an example using it.
1.2.1. Deterministic approach
Taking into account Definition 1.1(1), a bihomogeneous ideal for in can be, for instance, obtained as
[TABLE]
Therefore its multidegree can be computed in Macaulay2 with the command multidegree, which implements an algorithm according to [MS05, p. 165].
1.2.2. Probabilistic approach
(See also [Sta15, Remark 2.4].) Taking into account Definition 1.1(2), if is defined by an ideal , the second formula of (1.1) says us that is defined by the saturation of the ideal by in the ring . So replacing the word general with random in the definition, we get a probabilistic algorithm that computes all the projective degrees. Moreover, we can considerably speed up this algorithm by taking into account two remarks: firstly, the saturation is the same as , where are general scalars; secondly, the -th projective degree of coincides with the -th projective degree of the restriction of to a general hyperplane section of .
1.2.3. An alternative deterministic approach
Replacing the word general with symbolic in Definition 1.1(2) gives us a deterministic algorithm for computing projective degrees. For instance, in the case in which is a dominant rational map, extending to the fractional field of a polynomial ring , we have that is the degree of the fibre of at the symbolic point .
1.3. Some applications using projective degrees
1.3.1. The degree of a rational map
The degree of the map is the number of isolated points in the inverse image of a general point of over the algebraic closure of . This is the same as the ratio of and , and thus it can be explicitly computed. Let us note, however, that in several cases we do not need to compute the kernel of . For instance, if is a projective space, we are able to pick up an abundance of rational points of and then we apply the second formula of (1.1). Another special case is when is a prime number: here we have only to establish if the image of is a linear subspace (e.g. applying Algorithm 1.3 with ). The method provided by Cremona for this computation is named degreeOfRationalMap.222Notice that, in general, if the result of the probabilistic algorithm for degreeOfRationalMap is wrong, it can be either to small or to large. However, as a consequence of [Har77, Chapter III, Exercise 10.9], it should always provide a lower bound when the map is dominant between smooth varieties.
Methods related to this are isBirational and isDominant with obvious meaning. The latter does not compute the kernel of , but it uses an algorithm that looks for , where . More precisely, the algorithm is based on the following fact: let be a random zero-dimensional linear section of ; if , then is certainly dominant, otherwise it is probably not dominant (see [Mum88, Chapter I, § 8] or [Har77, Chapter II, Exercise 3.22]). When this last case occurs, it is generally easy to find a nonzero element in the kernel of , and so this method turns out to be very effective even in its deterministic version (see Example 2.1).
1.3.2. The Segre class
It is well-known that one can deduce an algorithm computing the push-forward to projective space of Segre classes from an algorithm computing projective degrees of rational maps between projective varieties and vice versa. Indeed, with our notation, we have the following:
Proposition 1.2** **(Proposition 4.4 in [Ful84];
see also Subsection 2.3 in [Dol11] and Section 3 in [Alu03]).
Let be the subscheme defined by and let be the inclusion. If denotes the hyperplane class of and , then the push-forward of the Segre class of in is
[TABLE]
The general method SegreClass, provided by Cremona for computing the push-forward to projective space of Segre classes, does basically nothing more than apply (1.3); see Example 2.3 for an example using this method. Furthermore, applying one of the main results in [Alu03], a method is derived to compute the push-forward to projective space of the Chern-Schwartz-MacPherson class of the support of a projective scheme ; recall that the component of dimension [math] of is the topological Euler characteristic of the support of .
1.4. Computing homogeneous components of kernels
To compute, using Macaulay2, the homogeneous component of degree of the kernel of phi=, one can perform the command ideal image basis(d,kernel phi). This is equivalent to the command kernel(phi,d) provided by Cremona, but the latter uses the following obvious algorithm.
Algorithm 1.3**.**
**Input: **
the ring map and an integer .
**Output: **
homogeneous component of degree of the kernel of .
- •
Find vector space bases of and of , where subscripts stand for homogeneous components;
- •
take generic linear combinations and , and find a basis of solutions for the homogeneous linear system obtained by imposing that the polynomial vanishes identically;
- •
for each vector obtained in the previous step, replace in the coefficients with ; return all these elements.
For small values of , applying Algorithm 1.3 may turn out to be much faster than computing a list of generators of the kernel of the map; see for instance Example 2.1 below.
1.5. Inverting birational maps
General algorithms for inverting birational maps are known. One of them is implemented in the package Parametrization by J. Boehm, and the method inverseMap of Cremona uses the same one for the general case as well. However, when the source of the rational map is a projective space and a further technical condition is satisfied, then it uses the following powerful algorithm.
Algorithm 1.4** ([RS01]; see also [Sim04]).**
**Input: **
the ring map (assuming that is birational and further conditions are satisfied).
**Output: **
a ring map representing the inverse map of .
- •
Find generators for the module of linear syzygies of ;
- •
compute the Jacobian matrix of the bihomogeneus forms with respect to the variables and consider the map of graded free modules ;
- •
return the map defined by a generator for the kernel of .
Remark 1.5*.*
One of the main feature of the package RationalMaps, by K. Schwede, D. Smolkin, S. H. Hassanzadeh, and C. J. Bott, is a method for inverting birational maps, which, in the case when Algorithm 1.4 does not apply, appears to be quite competitive with the method inverseMap of Cremona.
1.5.1. Heuristic approach
The method approximateInverseMap provides a heuristic approach to compute the inverse of a birational map modulo a change of coordinate. The idea of the algorithm is to try to construct the base locus of the inverse by looking for the images of general linear sections. Consider, for simplicity, the case in which is a Cremona transformation. Then, by taking the images of general hyperplanes in , we form a linear system of hypersurfaces in of degree which defines a rational map such that is a (linear) isomorphism; i.e. we find an approximation of . Next, we can fix the error of the approximation by observing that we have . It is surprising that this method turns to be effective in examples where other deterministic algorithms seem to run endlessly; see for instance Example 2.1 below.
2. Examples
In this section, we show how the methods described in Section 1 can be applied in some particular examples. We point out that the package Cremona provides the data type RationalMap, but here we will use the more familiar type RingMap. For brevity, we will omit irrelevant output lines. We start with an example reviewing the construction given in [Sta15] of a quadro-quadric Cremona transformation of .
Example 2.1**.**
The code below constructs a ring map psi representing a rational map .333Precisely, the algorithm for constructing is as follows: take to be a -dimensional Edge variety of degree , namely, the residual intersection of with a general quadric in containing one of the ’s of the rulings of ; next, see embedded in a hyperplane of and take the birational map defined by the quadrics of containing ; take to be the map defined by the quadrics of containing the image of . For this first part, we use the package Cremona only to shorten the code.
Macaulay2, version 1.11with packages: ConwayPolynomials, Elimination, IntegralClosure, InverseSystems, LLLBases, PrimaryDecomposition, ReesAlgebra, TangentConei1 : loadPackage "Cremona";i2 : K = ZZ/70001;i3 : P8 = K[t_0..t_8]; E = saturate(minors(2,genericMatrix(P8,4,2))+sum( (ideal(t_0..t_7)ideal(t_0..t_3))_,u->random(K)*u),ideal(t_0..t_3)) + t_8;i5 : psi = toMap kernel(toMap(E,2),2); Up to this point, the computation was standard. But now we want to determine the homogeneous ideal of , which turns out to be generated by quadrics. Computing this using kernel psi seems an impossible task, but it is elementary using kernel(psi,2). So we can consider as a dominant rational map .
i6 : time Z = kernel(psi,2); -- used 2.84998 secondsi7 : psi = toMap(psi,Dominant=>Z); The map turns out to be not only dominant but birational.
i8 : time degreeOfRationalMap psi -- used 2.11216 secondso8 = 1 We now want to compute the inverse of . This is a case where inverseMap can apply Algorithm 1.4, but the running time is several hours. We can perform this computation in seconds by using approximateInverseMap.
i9 : time psi’ = approximateInverseMap(psi,CodimBsInv=>10,MathMode=>true); -- used 15.9724 seconds A Cremona transformation of is then obtained combining and as follows.
i10 : omega = toMap(lift(matrix psi’,ring Z)|gens Z); Even checking just the dominance of , by computing kernel omega, seems an impossible task, but it can be done quickly with isDominant.
i11 : time isDominant(omega,MathMode=>true) -- used 0.100369 secondso11 = true We now check that our map is birational and compute its inverse using Algorithm 1.4.
i12 : time isBirational omega -- used 0.0366468 secondso12 = truei13 : time inverseMap omega; -- used 0.0717518 seconds
Example 2.2**.**
In this example, we use the probabilistic versions of some methods. Take to be a generic matrix of linear forms on , and let be the rational map defined by the minors of (its base locus is a smooth threefold scroll over a plane).
i14 : P6 = K[x_0..x_6]; M = matrix pack(5,for i from 1 to 15 list random(1,P6));i16 : phi = toMap(minors(3,M),Dominant=>2); We check that the map is birational and compute its inverse.
i17 : time isBirational phi -- used 0.217607 secondso17 = truei18 : time psi = inverseMap phi; -- used 1.39511 seconds Now we compute the multidegrees of and .
i19 : time (projectiveDegrees phi, projectiveDegrees psi) -- used 1.37582 secondso19 = ({1, 3, 9, 17, 21, 15, 5}, {5, 15, 21, 17, 9, 3, 1}) We also compute the push-forward to (resp. ) of the Segre class of the base locus of (resp. ) in (resp. in ). As usual, denotes the hyperplane class.
i20 : time (SegreClass phi, SegreClass psi) -- used 1.43359 seconds 6 5 4 3 9 8 7 6 5o20 = (- 680H + 228H - 60H + 10H , 728H - 588H + 276H - 98H + 24H )
Example 2.3**.**
In this example, we use the deterministic version of the method SegreClass. We take to be the dual quartic hypersurface of , where is a smooth quadric hypersurface, and take to be the singular locus of . We then compute the push-forward to the Chow ring of of the Segre class both of in and of in working over the Galois field .
i21 : P11 = GF(331^2)[x_0..x_11];i22 : Y = ideal sum(first entries gens minors(2,genericMatrix(P11,6,2)),t->t^2);i23 : X = sub(ideal jacobian Y,P11/Y);i24 : time SegreClass(X, MathMode=>true) -- push-forward of s(X,Y) -- used 0.789986 seconds 11 10 9 8 7 6 5 4 3o24 = 507384H - 137052H + 35532H - 9018H + 2340H - 658H + 204H - 64H + 16Hi25 : time SegreClass(lift(X,P11), MathMode=>true) -- push-forward of s(X,P^11) -- used 0.846234 seconds 11 10 9 8 7 6 5 4 3o25 = 313568H - 101712H + 30636H - 8866H + 2532H - 720H + 198H - 48H + 8H
Example 2.4**.**
Here we experimentally measure the probability of obtaining an incorrect answer using the probabilistic version of the method projectiveDegrees with a simple example of a birational map defined over . We define a procedure which computes this probability as a function of the field . In Table 1, we report the results obtained by running the procedure with various fields.
i26 : p = (K) -> ( x := local x; R := K[x_0..x_4]; phi := inverseMap toMap(minors(2,matrix{{x_0..x_3},{x_1..x_4}}),Dominant=>2); m := projectiveDegrees(phi,MathMode=>true); 0.1 * # select(1000,i -> projectiveDegrees phi != m));
Example 2.5**.**
In this last example, we deal with an experimental comparison of the method SegreClass of Cremona and the corresponding ones of other Macaulay2 packages. Precisely, we want to compare the method SegreClass against the corresponding methods of the two following packages: CharacteristicClasses version 2.0, by M. Helmer and C. Jost (see [Hel16, Jos15]), which provides a probabilistic method; and FMPIntersectionTheory version 0.1, by C. Harris (see [Har17]), which provides a deterministic method. Since the former puts restrictions on the ambient variety, we will only consider examples where the ambient is a projective space. We are unable to determine precisely which is the fastest among all the methods and which, in the probabilistic case, has highest probability of giving the correct answer. We just summarize in Table 2 the running times for some special examples. Below is the code from which we obtained the first row of the Table.
i27 : loadPackage "CharacteristicClasses"; loadPackage "FMPIntersectionTheory";i29 : X = last(P5=ZZ/16411[vars(0..5)],ideal(random(3,P5),random(3,P5),random(4,P5)));i30 : (time Segre X,time SegreClass X,time segreClass X,time SegreClass(X,MathMode=>true)); -- used 0.1511 seconds -- used 1.00936 seconds -- used 34.1471 seconds -- used 74.572 seconds
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[Alu 03] P. Aluffi, Computing characteristic classes of projective schemes , J. Symbolic Comput. 35 (2003), no. 1, 3–19.
- 2[Dol 11] I. Dolgachev, Lectures on Cremona transformations, Ann Arbor-Rome , available at http://www.math.lsa.umich.edu/~idolga/cremonalect.pdf , 2010/2011.
- 3[Ful 84] W. Fulton, Intersection theory , Ergeb. Math. Grenzgeb. (3), no. 2, Springer-Verlag, 1984.
- 4[GS 17] D. R. Grayson and M. E. Stillman, Macaulay 2 — A software system for research in algebraic geometry (version 1.10) , available at http://www.math.uiuc.edu/Macaulay 2/ , 2017.
- 5[Har 77] R. Hartshorne, Algebraic geometry , Grad. Texts in Math., vol. 52, Springer-Verlag, New York-Heidelberg, 1977.
- 6[Har 92] J. Harris, Algebraic geometry: A first course , Grad. Texts in Math., vol. 133, Springer-Verlag, New York, 1992.
- 7[Har 17] C. Harris, Computing Segre classes in arbitrary projective varieties , J. Symbolic Comput. 82 (2017), 26 – 37.
- 8[Hel 16] M. Helmer, Algorithms to compute the topological Euler characteristic, Chern–Schwartz–Macpherson class and Segre class of projective varieties , J. Symbolic Comput. 73 (2016), 120–138.
