Continuing my short and irregular series of blogposts regarding the computation of Hodge numbers directly from your browser (earlier installments are Hodge numbers for $\operatorname{Hilb}^nS$ and A visualisation of Serre duality and Hodge diamonds (for complete intersections)), I present you today the Hodge numbers of $\operatorname{M}_C(r,\mathcal{L})$.

$\operatorname{M}_C(r,\mathcal{L})$ is the moduli space of rank $r$ vector bundles with determinant isomorphic to $\mathcal{L}$ of degree $d$ such that $(d,r)=1$, all on a smooth projective curve $C$ of genus $g\geq 2$. These are very interesting Fano varieties with $\operatorname{Pic}(\operatorname{M}_C(r,\mathcal{L}))=\mathbb{Z}$, and 10 years ago a closed formula for their Hodge–Poincaré polynomial was found. Recall that the Hodge–Poincaré polynomial of a variety $X$ is \[ \operatorname{HP}(X,x,y)=\sum_{p,q=0}^{\dim X}\mathrm{h}^q(X,\Omega_X^p)x^py^q. \]

del Bano computed the Hodge–Poincaré polynomial for $\operatorname{M}_C(r,\mathcal{L})$ in On the Chow motive of some moduli spaces. If we denote $\langle\alpha\rangle$ the decimal part of $\alpha\in\mathbb{R}$, then the formula is the following \begin{align*} \operatorname{HP}(\operatorname{M}_C(r,\mathcal{L}),x,y) &= \sum_{r_1+\ldots+r_\ell=r} (-1)^{\ell-1}\frac{\left( (1+x)^g(1+y)^g \right)^{\ell-1}}{(1-xy)^{\ell-1}} \\ &\qquad\qquad\qquad\cdot\prod_{j=1}^\ell\prod_{i=1}^{r_j-1}\frac{(1+x^iy^{i+1})^g(1+x^{i+1}y^i)^g}{(1-(xy)^i)(1-(xy)^{i+1})} \\ &\qquad\qquad\qquad\cdot\prod_{j=1}^{\ell-1}\frac{1}{1-(xy)^{r_j+r_{j+1}}} \\ &\qquad\qquad\qquad\cdot(xy)^{\sum_{i<j}r_ir_j(g-1)+\sum_{i=1}^{\ell-1}(r_i+r_{i+1})\langle -(r_1+\ldots+r_i)d/r\rangle} \end{align*}

I've fixed a small typo in the exponent on the fourth line.

This looks like the perfect thing to implement in Sage, and below you find the direct translation into computer code.

The example with $r=2$, $d=1$ and $g=2$ is the easiest case. It can be shown that this is also the complete intersection of two quadrics in $\mathbb{P}^5$, so one can check the result using the Hodge diamond for complete intersections.

It should be remarked that Donu Arapura also has a Sage implementation, but his implementation deals with fractions of polynomials in a different way, using series expansion and truncation at every step. As a result, my (naive) implementation above turns out to be much faster (although that might not have been the case when he implemented the formula, I can certainly imagine the implementation for fractions of polynomials in Sage to have improved over time).