# BSc thesis - calculating Hilbert series

## 2493 days ago by jakub.witaszek

Homogenous = SFAHomogeneous(QQ) Elementary = SFAElementary(QQ) def e(n,deg): return Polynomial(Elementary([deg]).expand(n)) if deg > 0 else (1 if deg == 0 else 0) def h(n, deg): return Polynomial(Homogenous([deg]).expand(n)) if deg > 0 else (1 if deg == 0 else 0) def H(n,s,l): return sum(map(lambda r: h(n,s-r)*e(n,r)*(-1)^r, range(0,l+1))) def a(n,k,l): def a_help(n,k,l,b): return sum(map(lambda a: ((-1)^a)*e(n,a)*H(n,k+b-a,b), range(0, k+l+1))) return sum(map(lambda b: (z[n]^b)*a_help(n,k,l,b), range(0,n))) # main_hilbert calculates coefficients aij def main_hilbert(size, n): if n == 2 or n==1: return Matrix(Polynomial, size, 1, lambda i,j: 1 if i==0 else 0) M = Matrix(Polynomial, size, size, lambda i,j: a(n-1, i-j, j)) return M*main_hilbert(size, n-1) # find_hilbert_series finds the numerators of the Hilbert series def find_hilbert_series(n): v = [Matrix(Polynomial, n+1, 1, lambda i,j: z[n]^i) for n in range(0,n+1)] return (v[n].transpose()*main_hilbert(n+1, n))[0][0] # Example num_var = 5 Polynomial = PolynomialRing(QQ, num_var, 'z') z = PolynomialRing(QQ, num_var, 'z').gens() res = find_hilbert_series(num_var-1)
res
 -z0^2*z1^2*z2^2*z3^2*z4^2 + z0^2*z1*z2*z3*z4 + z0*z1^2*z2*z3*z4 + z0*z1*z2^2*z3*z4 + z0*z1*z2*z3^2*z4 + z0*z1*z2*z3*z4^2 - z0*z1*z2*z3 - z0*z1*z2*z4 - z0*z1*z3*z4 - z0*z2*z3*z4 - z1*z2*z3*z4 + 1
SF = SymmetricFunctions(QQ); SF.from_polynomial(res);
 m[] - m[1, 1, 1, 1] + m[2, 1, 1, 1, 1] - m[2, 2, 2, 2, 2]