# Symbolically Expanding One-Variable $q$-hypergeometric Series

In general, how do I get Mathematica to symbolically expand various infinite series to an arbitrary degree of accuracy? I deal with $q$-hypergeometric series quite frequently, and specifically want to expand series like the following: $$\sum_{n=0}^{\infty}\frac{(-1)^nq^{6n^2}}{(q^3;q^3)_n(-q;q)_{3n}},$$ where $(a;q)_n$ denotes the standard $q$-Pochhammer symbol $\prod\limits_{k=0}^{n-1}(1-aq^k)$. I would like to input a maximal degree, and for Mathematica to output the first few terms of the infinite series up until the specified degree. For example, if I inputted $13$, I would want Mathematica to output (I believe, doing this by hand) $q^6-q^7+q^{10}-q^{11}+q^{12}-q^{13}$. I cannot get the existing series functions to give something as clean as what I want.

One preliminary input I tried was

FunctionExpand[Sum[(-1)^n/QPochhammer[q^3, q^3, n], {n, 0, 10}]]


which returned

1 - 1/(1 -
q^3) + 1/((1 - q^3) (1 - q^6)) - 1/((1 - q^3) (1 - q^6) (1 -
q^9)) + 1/((1 - q^3) (1 - q^6) (1 - q^9) (1 - q^12)) - 1/((1 -
q^3) (1 - q^6) (1 - q^9) (1 - q^12) (1 - q^15)) + 1/((1 -
q^3) (1 - q^6) (1 - q^9) (1 - q^12) (1 - q^15) (1 -
q^18)) - 1/((1 - q^3) (1 - q^6) (1 - q^9) (1 - q^12) (1 -
q^15) (1 - q^18) (1 - q^21)) + 1/((1 - q^3) (1 - q^6) (1 -
q^9) (1 - q^12) (1 - q^15) (1 - q^18) (1 - q^21) (1 -
q^24)) - 1/((1 - q^3) (1 - q^6) (1 - q^9) (1 - q^12) (1 -
q^15) (1 - q^18) (1 - q^21) (1 - q^24) (1 - q^27)) + 1/((1 -
q^3) (1 - q^6) (1 - q^9) (1 - q^12) (1 - q^15) (1 - q^18) (1 -
q^21) (1 - q^24) (1 - q^27) (1 - q^30)),


which is not the form of output that I want because the sum is not fully expanded as a polynomial in $q$. Also, if I insert an additional QPochhammer[-q, q, Infinity] out front, it leaves the $(-q;q)_{\infty}$ unexpanded because there is no degree specification. (This is why I want to implement the degree specification rather than settling for expanded partial sums.) These are two central issues that I'm not sure how to address.

• Post examples of what you've tried and the results vs what you require. More likely to get help that way. – ciao Apr 8 '14 at 2:39

Is this is what you are after?

Series[Sum[(-1)^n/QPochhammer[q^3, q^3, n], {n, 0, 10}], {q, 0,
10}] // Normal

(*  1 + q^6 + q^9   *)

• I was about to say the same thing Series[Sum[(-1)^n q^(6 n^2)/( QPochhammer[-q,q,3n]QPochhammer[q^3,q^3,n]),{n,0,20}],{q,0,13}] – chuy Apr 8 '14 at 14:59

Just for reference, the sum depicted in the OP has a representation in terms of the $q$-hypergeometric function. In particular,

$$\sum_{n=0}^{\infty}\frac{(-1)^nq^{6n^2}}{(q^3;q^3)_n(-q;q)_{3n}}={}_1\phi_4\left({{0}\atop{-q,-q^2,-q^3,0}}\mid q^3,-q^6\right)$$

Compare:

Series[QHypergeometricPFQ[{0}, {-q, -q^2, -q^3, 0}, q^3, -q^6], {q, 0, 15}]
1 - q^6 + q^7 - q^10 + q^11 - q^12 + q^13 - q^14 + q^15 + O[q]^16

% - FunctionExpand[Sum[((-1)^n q^(6 n^2))/
(QPochhammer[q^3, q^3, n] QPochhammer[-q, q, 3 n]), {n, 0, 15}]]
O[q]^16