Numerical Hilbert functions for Macaulay2
Abstract.
The NumericalHilbert package for Macaulay2 includes algorithms for computing local dual spaces of polynomial ideals, and related local combinatorial data about its scheme structure. These techniques are numerically stable, and can be used with floating point arithmetic over the complex numbers. They provide a viable alternative in this setting to purely symbolic methods such as standard bases. In particular, these methods can be used to compute initial ideals, local Hilbert functions and Hilbert regularity.
1. Introduction
Symbolic algorithms in algebraic geometry are well studied and can be very powerful, but for many applications they can also be ineffective. Many problems are most naturally phrased over the real or complex numbers, and the running times of symbolic algorithms may become impractical. There has been a recent push to develop numerical or symbolnumeric hybrid alternatives. These methods have already shown success in tackling problems in engineering and other fields [10], for example using homotopy tracking to quickly solve zerodimensional polynomial systems [1], [5]. Numerical methods are good at computing information about varieties, and often do best when things are regular, but we would also like insight into schemes structure.
The Macaulay dual space is a tool that can be used to numerically compute local combinatorial information, such as multiplicity structure and Hilbert function, about a polynomial system at a particular point. In conjunction with other tools, this information can be used to recover scheme theoretic data about an ideal. First introduced in [6], for a thorough discussion we refer to [8]. The NumericalHilbert package for Macaulay2 [3] provides methods for both computing dual spaces and extracting information from them, implementing algorithms described in [9], [2] and [4]. These methods are designed to work using floating point arithmetic over the complex numbers, and are stable to numerical error.
Related existing software includes ApaTools by Zeng [11] and a Maple package of Mantzaflaris and Mourrain [7]. Both can compute multiplicity structure of an isolated solution to a polynomial system, while our package expands this functionality by including tools for computing on positivedimensional varieties as well.
We will assume we have blackbox methods for computing numerical rank, kernel or image of a matrix. In practice this can be done with singular value decomposition. Additionally we will assume access to a method that can approximately sample points from a variety, with any desired precision.
2. Dual space
Let and let denote the subspace of polynomials of degree at most . The truncated dual space is the vectorspace dual , i.e. the set of functionals . The Macaulay dual space (or local dual space) of at the origin is
For each monomial , we define a monomial functional by
Note that these monomial functionals form a basis of , and so its elements can be represented as “polynomials” in .
For an arbitrary point we can also define the dual space at , denoted , by translating to the origin. The monomial functional evaluates to 1 on and to 0 on all other monomials in . We will take our point of interest to be the origin without loss of generality, since we can make it so by a change of coordinates.
The classes PolySpace and DualSpace defined in the NAGtypes package are used to represent finitedimensional subspaces of and respectively. PolySpace stores a basis of the subspace, and DualSpace stores a basis and the base point . For convenience we express dual space elements as polynomials in by identifying with although this is an abuse of notation.
For an ideal there is a subspace of dual functionals which is the orthogonal to .
We refer to as the dual space of , while the truncated dual space of is .
The dual space of exactly characterizes the local properties of at the origin. To make this precise, let denote the localization of at the maximal ideal . Expressing elements of as power series, we can still evaluate them with functionals in and so define .
Proposition 1.
satisfies the following


The orthogonal to in is exactly .
Computing a basis for the dual space of immediately provides useful combinatorial data about the local behavior of at the origin. A consequence of the above proposition is that
Therefore if the origin is an isolated solution to the system described by then its multiplicity is equal to .
There is a simple algorithm to compute the dual space of truncated to degree from a generating set . A functional is in if and only if for all and . Form a matrix with rows the coefficient vectors of each , including only the terms of degree . The kernel of this matrix consists of the coefficient vectors of . For a full discussion of this algorithm we refer to [2].
The method truncatedDual computes a basis of the truncated dual of an ideal at a point . If is known to be an isolated solution then zeroDimensionalDual can be used to compute a basis for the full dual space of . The optional argument Strategy allows the user to specify which algorithm to use. Using Strategy => DZ will use the simple algorithm described above. However the default Strategy => BM is an implementation of an algorithm developed by Mourrain in [9], which generally has better asymptotic running time.
Example 2.
Let . An approximate solution to the system is .
i1 : needsPackage "NumericalHilbert"; i2 : R = CC[x_1,x_2]; i3 : I = ideal{x_1^2 + x_2^2  4, (x_1  1)^2} 2 2 2 o3 = ideal (x + x  4, x  2x + 1) 1 2 1 1 o3 : Ideal of R i4 : y = point matrix{{1,1.7320508}}; i5 : zeroDimensionalDual(y, I) o5 =  1 .866025x_1.5x_2  o5 : DualSpace
Here has dimension 2, the multiplicity of the solution approximated by .
3. Computing Hilbert functions
If is positivedimensional at the point of interest, the dual space of has infinite dimension and computing a basis is not possible. However truncated duals can always be computed, the dimensions of which correspond to values of the Hilbert function. We define the local Hilbert function of at 0 to be
where , the maximal ideal at 0.
Proposition 3.
The method hilbertFunction can be applied to a DualSpace to find its dimension in a particular degree or list of degrees.
Example 4.
Consider the cyclic 4root system . It cuts out a curve in with several singular points including . We obtain an approximation of this point with our numerical solver.
i6 : R = CC[x_1..x_4]; i7 : I = ideal {x_1 + x_2 + x_3 + x_4, x_1*x_2 + x_2*x_3 + x_3*x_4 + x_4*x_1, x_2*x_3*x_4 + x_1*x_3*x_4 + x_1*x_2*x_4 + x_1*x_2*x_3, x_1*x_2*x_3*x_4  1}; i8 : y = point matrix{{1.000000000000023.43663806114685e15*ii, .999999999999981+1.03073641806016e14*ii, 1.000000000000021.08861573140903e14*ii, .999999999999984+3.31351409927520e15*ii}}; i9 : D = truncatedDual(y, I, 6); i10 : hilbertFunction({0,1,2,3,4,5,6}, D) o10 = {1, 2, 1, 1, 1, 1, 1} o10 : List
We see that values of for from 0 to 6 are . We might guess from this that the Hilbert function remains constant for all but this can’t be verified from the information here so far.
For the Hilbert function is polynomial in and this is called the Hilbert polynomial, . If the Hilbert polynomial has degree , then has dimension . The multiplicity of at the origin is where is the lead coefficient of .
To compute the Hilbert polynomial of positivedimensional we use the dual space to compute the generators of the initial ideal of using the algorithm described in [4]. Let be a graded monomial order on the monomial functional of , and let be the reverse order but on , i.e. a graded local order on the monomials. The initial ideal of , denoted , is the monomial ideal generated by the initial terms of elements of . Similarly the initial dual space is spanned by the initial terms of . A monomial is in if and only if is not in , or equivalently
By observing the monomials missing from we search for generators of . The stopping criteria described in [4] makes this search exhaustive.
The method gCorners produces the generators of the initial ideal . Similarly sCorners produces a list of the maximal monomials not in . To compute the Hilbert polynomial of we can use the existing method hilbertPolynomial on the monomial ideal generated by the output of gCorners. The method localHilbertRegularity computes the degree at which the Hilbert function and Hilbert polynomial agree.
Example 5.
We continue with the cyclic 4root system from Example 4. We omit intermediate output for readability.
i11 : G = gCorners(y, I) o11 =  x_4 x_3 x_2^2 x_1x_2  1 4 o11 : Matrix R < R i12 : hilbertPolynomial(monomialIdeal G, Projective=>false) o12 = 1 o12 : QQ[i]
The generators of the initial ideal are . The Hilbert function of an ideal and its initial ideal agree. The Hilbert polynomial of a monomial ideal such as is simple to compute and here we see it is . Since the Hilbert polynomial has degree 0, the local dimension of at is 1. The multiplicity is also 1.
i13 : localHilbertRegularity(y, I) o13 = 2
The regularity of the Hilbert function is . This confirms that for all . We have now completely described the local Hilbert function of at .
References

[1]
Daniel J Bates, Jonathan D Hauenstein, Andrew J Sommese, and Charles W Wampler.
Bertini: Software for numerical algebraic geometry.
Available at
www.nd.edu/~sommese/bertini
, 2006.  [2] Barry H Dayton and Zhonggang Zeng. Computing the multiplicity structure in solving polynomial systems. In International Symposium on Symbolic and Algebraic Computation, pages 116–123. ACM, 2005.

[3]
Daniel R. Grayson and Michael E. Stillman.
Macaulay2, a software system for research in algebraic geometry.
Available at
www.math.uiuc.edu/Macaulay2/
.  [4] Robert Krone. Numerical algorithms for dual bases of positivedimensional ideals. Journal of Algebra and Its Applications, 12(06):1350018, 2013.
 [5] Anton Leykin. Numerical algebraic geometry. Journal of Software for Algebra and Geometry, 3:5–10, 2011.
 [6] Francis Sowerby Macaulay. The algebraic theory of modular systems. Cambridge University Press, 1916.
 [7] Angelos Mantzaflaris and Bernard Mourrain. Deflation and certified isolation of singular zeros of polynomial systems. In Proceedings of the 36th international symposium on Symbolic and algebraic computation, pages 249–256. ACM, 2011.
 [8] M Marinari, H Möller, and T Mora. On multiplicities in polynomial system solving. Transactions of the American Mathematical Society, 348(8):3283–3321, 1996.
 [9] B. Mourrain. Isolated points, duality and residues. J. Pure Appl. Algebra, 117/118:469–493, 1997. Algorithms for algebra (Eindhoven, 1996).
 [10] Andrew J. Sommese and Charles W. Wampler, II. The numerical solution of systems of polynomials. World Scientific Publishing Co. Pte. Ltd., Hackensack, NJ, 2005.
 [11] Zhonggang Zeng. Apatools: a software toolbox for approximate polynomial algebra. In Software for Algebraic Geometry, pages 149–167. Springer, 2008.