Suppose $f$ is the fPolynomial of $P$, and $d$ is the degree of $f$. Then the h-polynomial of $P$ is the polynomial $(1-q)^d f(q/(1-q))$.
i1 : hPolynomial booleanLattice 3 2 o1 = q + 4q + 1 o1 : ZZ[q] |
The h-polynomial of the $n$ chain is $1$.
i2 : hPolynomial chain 5 o2 = 1 o2 : ZZ[q] |
The object hPolynomial is a method function with options.