How to expand an infinite product?

How can I use Mathematica to expand such a product (only need a finite number of terms):

$$\prod^{\infty}_{n=1}\frac{({1-yq^{n+1}})({1-y^{-1}q^n})}{(1-q^n)^2}$$

• Have you seen QPochhammer[]? Feb 23 '16 at 9:51

If you follow @J.M. 's hint and assume that 0 < q < 1, you can get a value for the infinite product:

Product[(1 - y q^(n + 1)) (1 - q^n/y)/(1 - q^n)^2,
{n, 1, ∞},
Assumptions -> 0 < q < 1]

with result

-((y QPochhammer[1/y, q] QPochhammer[q y, q])/((-1 + y) (-1 + q y) QPochhammer[q, q]^2))

Given that you only need a finite number of terms, I would do something like this:

ClearAll[prod, expand];
prod[num_?NumericQ] :=Product[(1 - y*q^(n + 1))*(1 - q^n/y)/(1 -q^n)^2, {n, 1, num}];
expand[num_?NumericQ] := Total[Total[#] & /@ Numerator[#]/Flatten[DeleteDuplicates[#] & /@ Denominator[#]] &@GatherBy[List @@ Expand[prod[num]], Denominator]]

Of course, you can just run Expand on your product. But do it and observe the longish result. So my approach (which I bet is not the most beautiful one to accomplish this, btw) gathers by common denominators and sums their respective numerators. This, at least to me, makes the expanded result way more readable. Of course, that depends on what you want to do with your result. Example: Of course, you can also run Simplify on such constructs, but that will for sure need more time. However, there you may specify TransformationFunctions to end up with a form of your desire.

AbsoluteTiming of Simplify@Expand@prod: 0.134552

AbsoluteTiming of expand: 0.009244