next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
CharacteristicClasses :: CharacteristicClasses

CharacteristicClasses -- Chern classes and other characteristic classes of subschemes of certain smooth toric varieties, including products of projective spaces


The package CharacteristicClasses provides commands to compute the Chern class, Chern-Schwartz-MacPherson class Segre class and Euler characteristic of closed subschemes of certain smooth complete varieties, including products of projective spaces ℙn1 x ... x ℙnm. In particular the methods of this package are applicable for toric varieties for which all Cartier divisors are numerically effective (nef), see [7] for details. For simplicity a method (CheckToricVarietyValid) is provided which allows the user to determine if these methods can be applied to a given object of class NormalToricVariety. Note that to perform computations involving toric varieties it is required that the package NormalToricVarieties is also loaded.

More precisely the CharacteristicClasses package computes the pushforward of the respective classes to the Chow ring of either a product of projective space or of the appropriate toric variety. In the case where the input is an ideal I (in the appropriate graded coordinate ring) defining a subscheme V of ℙn1 x ... x ℙnm the characteristic class is returned as an element of the Chow ring A*(ℙn1 x ... x ℙnm)=ℤ[h1,...,hm]/(h1n1+1,...,hmnm+1); here hi represents (the pullback of) the rational equivalence class of a hyperplane in ℙi. In the case where V is a subscheme of a smooth toric variety XΣ with total coordinate ring (that is Cox ring) R the characteristic classes will be represented as elements of the Chow ring of X, A*(XΣ)=R/(I+J) where I is the Stanley-Reisner Ideal of the fan Σand J is the ideal defined by linear relations among the rays. See Theorem 12.5.3 of "Toric varieties" by Cox, Little and Schenck.

If V is smooth, then by definition the (total) Chern classes of V is the Chern classes of the tangent bundle TV, that is c(V)=c(TV)∩[V]. The Chern classes are cycles in the Chow ring of V, i.e., linear combinations of subvarieties of V modulo rational equivalence.

In practice all cycle classes will be represented in terms of integers multiplied by hyperplane classes. Consider, for example, a hypersurface V=V(f) in ℙn1 x ... x ℙnm where f has multi-degree (d1,...,dm), then [V]=d1h1+...+dmhm. This extends linearly to linear combinations of cycles. Computing the Chern class of V is equivalent to computing the pushforward of the Chern classes to the Chow ring of the ambient space. Also by definition, the Segre classes of V a subscheme of X are the Segre classes of V in X, that is the Segre classes of the normal cone to V in X, CVX. For definitions of the concepts used so far see, for example, "Intersection Theory" by W. Fulton. Chern-Schwartz-MacPherson (CSM) classes are a generalization of Chern classes of smooth schemes to possibly singular schemes with nice functorial properties including the a relation to the Euler characteristic.

The functions computing characteristic classes in this package can have several different types of output, with the default form being objects of type QuotientRingElelement, that is elements in the appropriate Chow ring. See the function documentation for more details.

This implementation offers several different algorithms to compute characteristic classes. For the general case of subschemes of smooth toric varieties or the case of products of projective spaces ℙn1 x ... x ℙnm (with m>1) the computational method used is CompMethod=>ProjectiveDegree. These methods, in the toric case, are described in [7]. In the case of projective space see also [5]. The main computational step of this approach is the computation of the projective degrees. This can be done symbolically, using Gröbner bases, or numerically using a package such as Bertini, however only the symbolic implementation is offered at present.

To compute the CSM class the default method is inclusion-exclusion, which uses the inclusion-exclusion property of CSM classes to compute the CSM class for codimension greater than one (this is the option Method=>InclusionExclusion). When V is a complete intersection subscheme of an applicable toric variety then CSM(V) may also be computed Method=>DirectCompleteInt may also be used; this method is described in [6] and [7] and may offer a performance improvement in some applicable cases, particularly in projective space.

In the special case where the ambient space is ℙn the computational methods CompMethod=>PnResidual and CompMethod=>bertini may be used. These methods are described in [1, 2, 8]. The main step in this approach is the computation of the residuals. This can be done symbolically, using Gröbner bases, and numerically, using the regenerative cascade implemented in Bertini. The regenerative cascade is described in [3].

All algorithms are probabilistic but will succeed with high probability. In the case of the symbolic implementation of the ProjecvtiveDegree method practical experience and algorithm testing indicate that a finite field with over 25000 elements is more than sufficient, i.e. using the finite field kk=ZZ/25073 the experiential chance of failure with the ProjectiveDegree algorithm on a variety of examples was less than 1/2000. Using kk=ZZ/32749 resulted in no failures in over 10000 attempts of several different examples. Read more under probabilistic algorithm.

[1] David Eklund, Christine Jost, Chris Peterson. A method to compute Segre classes, Journal of Algebra and Its Applications 12(2), 2013
[2] Daniel J. Bates, Jonathan D. Hauenstein, Andrew J. Sommese, Charles W. Wampler. Bertini: Software for Numerical Algebraic Geometry, available at
[3] Jonathan D. Hauenstein, Andrew J. Sommese, Charles W. Wampler. Regenerative cascade homotopies for solving polynomial systems, Applied Mathematics and Computation 218(4), 2011
[4] Christine Jost. An algorithm for computing the topological Euler characteristic of complex projective varieties, submitted, arXiv:1301.4128 [math.AG]
[5] Martin Helmer. Algorithms to compute the topological Euler characteristic, Chern-Schwartz-Macpherson class and Segre class of projective varieties. Journal of Symbolic Computation, 2015. Preprint on arXiv at arXiv:1402.2930.
[6] Martin Helmer. A Direct Algorithm to Compute the Topological Euler Characteristic and Chern-Schwartz-MacPherson Class of Projective Complete Intersection Varieties. (2014). arXiv preprint arXiv:1410.4113.
[7] Martin Helmer. An Algorithm to Compute the Topological Euler Characteristic, the Chern-Schwartz-MacPherson Class and the Segre class of Subschemes of Some Smooth Complete Toric Varieties. (2015). arXiv preprint arXiv:1508.03785
[8]Sandra Di Rocco, David Eklund, Chris Peterson, and Andrew J. Sommese. Chern numbers of smooth varieties via homotopy continuation and intersection theory. Journal of symbolic computation 46, no. 1 (2011): 23-33.


Certification a gold star

Version 1.1 of this package was accepted for publication in volume 7 of the journal The Journal of Software for Algebra and Geometry on 5 June 2015, in the article Computing characteristic classes and the topological Euler characteristic of complex projective schemes. That version can be obtained from the journal or from the Macaulay2 source code repository,, commit number 82375d8c668f3acf1d825b8ba991081769fba742.


This documentation describes version 2.0 of CharacteristicClasses.

Source code

The source code from which this documentation is derived is in the file CharacteristicClasses.m2.


  • Functions and commands
    • bertiniCheck -- Checks whether the numerical version of the algorithms using Bertini works
    • CheckToricVarietyValid -- Checks if the input normal toric variety X is a valid choice for an ambient space when computing characteristic classes of subschemes V of X
    • Chern -- The Chern class
    • ChowRing -- Computes the Chow ring of a product of projective spaces m projective spaces given the coordinate ring
    • ClassInChowRing -- Gives the class of a hypersurface in the associated Chow ring of a product of projective spaces
    • ClassInToricChowRing -- Gives the class of a hypersurface in the assocated Chow ring of a toric variety
    • CSM -- The Chern-Schwartz-MacPherson class
    • Euler -- The Euler Characteristic
    • isMultiHomogeneous -- Checks if an ideal is homogeneous with respect to the grading on its ring (i.e. multi-homogeneous in the multi-graded case)
    • MultiProjCoordRing -- A quick way to build the coordinate ring of a product of projective spaces
    • Segre -- The Segre class of a subscheme
    • ToricChowRing -- Computes the Chow ring Ch=R/(SR+LR) of a normal toric variety with coordinate ring R, here SR is the Stanley-Reisner ideal of the corresponding fan and LR is the ideal of linear relations amount the rays
  • Symbols