The functionality outlined below, and much more, is implemented in Hodge diamond cutter, which can be used in Sage. If you use it for your research, please cite it using .

I really enjoy being able to compute things straight out of my browser, and it's also convenient to quickly show people things this way. I already have this for the Hodge numbers of complete intersections, but its functionality is limited by the interface that I decided to implement 4 years ago. So continuing my series on Hodge numbers using Sage, I present you the code for complete intersections.

SGA7, éxposé XI, théorème 2.3 tells us that $\mathrm{h}^{p,q}(X_{d_1,\ldots,d_k})$ for $X_{d_1,\ldots,d_k}$ a complete intersection inside $\mathbb{P}^{n+k}$, and $p+q=n$ (i.e. the middle cohomology is described, which is the only interesting part in any case) is given by the coefficient of $x^py^q$ in the power series \begin{equation} \frac{1}{(1+x)(1+y)} \left( \prod_{i=1}^k\frac{(1+x)^{d_i}-(1+y)^{d_i}}{(x(1+y)^{d_i}-y(1+x)^{d_i}} \right) +\frac{1}{1-xy} \end{equation}

The formula in SGA7 is for the primitive part of cohomology, so we add a term to make up for this 1-dimensional piece.

The Sage code for this, which could not have been more naive than it is right now, is

Donu Arapura also has an implementation in Sage, and there is no clear best choice when it comes to speed this time.