In my ongoing series of posts on implementations to Hodge numbers for interesting smooth projective varieties we have now arrived at Hilbert squares and Hilbert cubes. In Hodge numbers for $\operatorname{Hilb}^nS$ I explained how to compute these for Hilbert schemes of $n$ points on smooth projective surfaces. When one looks at $\operatorname{Hilb}^nX$ for $X$ a higher-dimensional variety, these are very singular, unless $n=2,3$. These special cases are then called Hilbert squares (resp. Hilbert cubes).

As before, we'll denote the Hodge polynomial of a smooth projective variety $X$ as \begin{equation} \mathrm{h}(X,x,y):=\sum_{p,q=0}^{\dim X}\mathrm{h}^{p,q}(X)x^py^q \end{equation} where $\mathrm{h}^{p,q}=\dim\operatorname{H}^q(X,\Omega_X^p)$.

Then the game we are playing is to express the Hodge polynomial of $\operatorname{Hilb}^2X$ and $\operatorname{Hilb}^3X$ in terms of that of $X$.

### Hilbert squares

The Hodge numbers for the Hilbert square can be considered classical, using the description of $\operatorname{Hilb}^2X$ as the blowup in the diagonal of the quotient of $X\times X$ by the group $\mathbb{Z}/2\mathbb{Z}$ permuting the factors. One can show that \begin{equation} \mathrm{h}(\operatorname{Hilb}^2X,x,y) = \frac{1}{2} \left( \mathrm{h}(X,x,y)^2 + \mathrm{h}(X,-x^2,-y^2) \right) + \mathrm{h}(X,x,y)\left( \sum_{i=1}^{\dim X-1}(xy)^i \right) \end{equation}

### Hilbert cubes

For Hilbert cubes the description is more complicated, and the resulting formula can be found on page 507 of On the cohomology of Hilbert schemes of points. Without further ado, here it is (with intentional overflow to showcase how \begin{equation} \mathrm{h}(\operatorname{Hilb}^3X,x,y) = \frac{1}{6}\mathrm{h}(X,x,y)^3 \\\qquad + \frac{1}{2}\mathrm{h}(X,x,y)\mathrm{h}(X,-x^2,-y^2) \\\qquad + \frac{1}{3}\mathrm{h}(X,x^3,y^3) \\\qquad + \mathrm{h}(X,x,y)^2\left( \sum_{i=1}^{\dim X-1}(xy)^i \right) \\\qquad + \mathrm{h}(X,x,y)\left( \sum_{1\leq i\leq j\leq\dim X-1}(xy)^{i+j} \right) \end{equation}

### Implementation in Sage

No post about Hodge numbers is complete without a Sage implementation (it is the sole purpose of these posts), so here goes. It becomes clear that constructing the Hodge polynomial for these higher-dimensional varieties is becoming quite cumbersome in non-trivial cases, so this is where my little library of Hodge diamond related tools will come in handy. Stay tuned for that!