The file hodgepack2 gives Maple code for computing the Hodge and Betti numbers of weighted hypersurfaces in projective space.
Examples
The Maple code below uses the Poincare polynomial, whose coefficients give the dimensions of the Jacobian ring. See Igor Dolfacev's article "Weighted projective varieties" in Group Actions and Vector Fields, Proceedings 1981, Springer Lecture Notes 956 (1982), or Loring Tu's article " Macaulay's theorem and local Torelli for weighted hypersurfaces," Compositio Math. 60: 33-44 (1986). Since the main procedure WH is somewhat long, we also give a simplified version.
# Poincare polynomial for regular sequence of length 1
pop1 := (d,q) -> simplify( (1-t^d)/(1-t^q) ):
# Poincare polynomial for a regular sequence where
# L = [[d1, w1], [d2, w2], .. ] is a list of
# degrees and weights
pop := proc( L )
local p, i;
p := 1;
for i from 1 to nops(L) do
p := p*pop1(L[i][1],L[i][2]);
od;
sort( expand( p ) );
end:
# jac( W, d ) is the list of degrees and weights for
# the regular sequence obtained from a weighted homogeneous
# form of degree where W is the list of weights
jac := proc( W, d )
local i, L;
L := [];
for i from 1 to nops(W) do
L := [ op(L), [d-W[i],W[i]] ];
od;
L;
end:
# pj(W,d) = Poincare polynomial for Jacobian ring of poly of degre d
pj := pop@jac:
# wmoduli( W, d ) is the dimension of the moduli space of hypersurfaces
# of degree d with weights W
wmoduli := (W,d) -> coeff( pj(W,d), t, d ):
# sumlist(L) = sum of the elements of the list L.
sumlist := proc(L)
local i, s;
s := 0;
for i from 1 to nops(L) do
s := s + L[i];
od;
s;
end:
# WH( W, d ) = list of Hodge numbers for a hypersurface of degree d with
# weights W.
#
# WH( n, d ) = list of Hodge numbers for a hypersurface of degree d with
# in P^{n+1} = P(1,1,..,1).
#
# WH( W, d, k ) = same, but for the z^k eigenspace, where z = exp( 2\pi i k / d )
# and where the last variable appears only as a d-th power, and the
# action of the d-th roots of unity is by multiplication in that variable.
#
# WH( n, d, k ) = same as if W = [ 1, 1, ... 1 ].
#
# WH( W, d, m, k ) = Hodge numbers in the z^k eigenspace for the m-sheeted cover of P(W)
# branched along a hypersurface of degree d.
# As usual n can be substituted for W.
#
# All this function does is pick out the appropriate coefficients of the Poincare
# polynomial.
WH := proc()
# Local variables:
# W = list of weights, d = degree
# nw = new weight for added variable if present
# = degree of poly / degree of cover
# i = eigenvalue, if relevant
# q+1 = order of pole for rational differential
# n = dimension of variety
# POP = Poincare polynomial
# HL = list of Hodge numbers
# k = degree in Jacobian ring
# = degree of term in Poincare polynomial
# vdeg = weight of volume form in numerator
local W,d,nw,i, q, n, POP, HL, k, vdeg, kk;
# process arguments and set local variables
#########################################################
# process args so either (W,d) or (n,d) is OK.
W := args[1]; d := args[2];
if type(W,integer) then
n := W;
W := X(n);
fi;
n := nops(W)-2; # n = dimension of variety
# case of 4 args = (W,d,k,i)
# compute for i-th eigenspace of k-fold cyclic cover:
if nargs = 4 then # correct n, using cyclic cover
n := n + 1;
nw := d/args[3];
i := args[4];
fi;
# case of 3 args = ([W|n], d, i)
# compute for ith eigenspace, assume that
# given hypersurface is cyclic cover of degree d
# thus that W' = [ op(W), 1 ] is the weight sequence:
if nargs = 3 then # n is correct, cover is of degree d
nw := W[nops(W)];
kk := d/nw;
W := [ W[i] $i=1..nops(W)-1 ];
i := args[3];
RETURN( WH(W,d,kk,i) );
fi;
###############################################################
# CORE: compute the Hodge numbers from the Poincare polynomial
vdeg := sumlist(W);
POP := pj(W,d);
HL := [];
for q from 0 to n do
k := (q+1)*d - vdeg;
if nargs > 2 then # correct degree for eigenspace
k := k - nw*i;
fi;
HL := [ op(HL), coeff( POP, t, k) ];
od;
HL;
end:
# X(n) is the weight sequence [1,..,1] used for a variety
# of dimension n. Thus WH(X(2),4) computes the Hodge numbers
# for a quartic surface.
X := n -> [ 1$'i'=1..n+2 ]:
# wb0( W, d ) = middle primitive Betti number of weighted hypersurface of degree d
#
# wb0( n, d ) = same, but weights are [1,1,..,1]
#
# wb0( W, d, k ) = same, but dimension is that of z^k-th eigenspace
#
# wb0( n, d, k ) = same, but weights are [1,1,..,1]
wb0 := proc()
sumlist( WH( args ) );
end: