Say that as a simple example I want to extract the fourth coefficient (partitions of $4$) of $$[x^4]\,G(x)= \prod_{i=1}^4 \frac{1}{1 - x^i}$$.
What is the best way to go about it?
Is it Wolfram Alpha? If so, how is it entered?
Is it usually calculated with ad hoc code? Suggestions?





Here are some ways to compute this on a computer. First of all if you have access to powerful mathematical software like Mathematica this can be done very easily. For example like this:
where
Residueis an instruction to extract the coefficient of the $\frac{1}{x}$ term in a power-series. We can alsoSeriesexpand a function about $x=0$ and simply read off the coefficient usingSeries[ gseries , {x, 0, n + 1} ].This solution relies on having all these complex functionality in the programming environment, but we can also quite easily solve this without having it.
We can represent a polynomial (or power-series) $A(x) = \sum_{n\geq 0} a_n x^n$ on a computer as a sequence $\{a_0,a_1,\ldots,a_{n_{\rm max}}\}$. The product of two power-series is given by the Cauchy-product
$$A(x)B(x) = \sum_{n\geq 0} c_n x^n~~~\text{where}~~~c_n = \sum_{k=0}^na_n b_{n-k}$$
which tells us how the sequences transform under multiplication. We will use this as a basis to compute the power-series. Below is a implementation in Mathematica (but it uses no Mathematica specific functions so it can be implemented in any programming language without needing special libraries).
Note that in this example we only need to take
nmax = 5to get the answer.