Is there a general way of counting the number of homogeneous polynomials of certain degree in a complex projective space or a weighted complex projective space, mod the ideal generated by some homogeneous polynomials with smaller degrees? 


As an example, consider the degree 18 homogeneous polynomials in $W\mathbb{P}\_{[2,2,2,4]}^3$, mod the ideal generated by two degree 8 homogeneous polynomials $P\_1=x^4\_1$ and $P\_2=x\_2^4$, where $x\_1$ and $x\_2$ are the first and second coordinates of $W\mathbb{P}\_{[2,2,2,4]}^3$. I can count the number of equivalent classes by directly listing all of such homogeneous polynomials; I would like to know if there is a more general and efficient way of doing this.


*Edit*: to avoid possible confusion, I have replaced "polynomial" by "homogeneous polynomial".



Count the number of homogeneous polynomials
I guess what you are after is the Hilbert function of ideal. More precisely, if you have a multigraded polynomial ring $k[x\_1,\ldots,x\_n]$ and the ideal is given by $I=(f\_1,\ldots,f\_r)$, the Hilbert function is simply the number
$$
h(\alpha)=\dim\_k (k[x\_1,\ldots,x\_n]/I)\_\alpha.
$$Here $\alpha$ may take values in the multigrading. When $|\alpha|$ is large, the Hilbert-Serre theorem says that $h(\alpha)$ is actually a polynomial function in $\alpha$ and so the generating function is actually a rational function. There are many algorithms to compute the Hilbert function of such rings based on the theory of Gröbner basis and you could try them out in Macaulay2. 


In certain special cases there are other alternatives though. As in your case, you can often turn this problem into a counting problem. Note that monomials of degree $n$ in $\mathbb{P}\_{2,2,2,4}$ correspond bijectively to non-negative solutions of the equation
$$
2a+2b+2c+4d=n
$$Let $s(n)$ denote this number. Then since the ideal $I=(P\_1,P\_2)$ is a complete intersection of two degree 8 polynomials, we get that the dimension of polynomials of degree $n$ modulo $I$ is exactly
$$
s(n)-2s(n-8)+s(n-16)
$$If $n=18$, we get dimension $125-2\cdot 35+3=60$. In particular, if the ideal is c.i., this argument shows that it suffices to know the number of degree $k$ polynomials in the polynomial ring. In the general case however, you might not be so lucky that your ideal is a c.i. and then perhaps Hilbert-functions are better suited.


