# Computing the coefficients of series

I am trying to fully expand the following $$\sum_{n=0}^{\infty} \frac{q^{\frac{n(n+1)}{2}}}{(q;q)_n}$$ Which when expressed in Mathematic is: q^(n*(n + 1)/2)/QPochhammer[q, q, n]

I would like to be able to fully expand this series into individual powers of q. This should be a power series, with integer coefficients for each power. How can I get the fully expanded power series? Ultimately, I would like to obtain a list of all the coefficients. Your help will go along way.

Thanks

• Which when expressed in Mathematic is: q^{n*(n + 1)/2}/QPochhammer[q, q, n] No it is not. You are using curly brackets which are for lists and things, not subexpressions. The correct way is q^(n(n+1)/2)/QPochhammer[q, q, n] Commented Oct 8, 2020 at 17:47
• Ah, you are right. But this does not solve my problem. Can you help me? Commented Oct 8, 2020 at 17:51
• You say you want all of the coefficients. I don't know if that is possible. If you want all of the coefficients up to say q^55, that is easy. Commented Oct 8, 2020 at 18:08
• @Carl Woll Yes, this would be sufficient Commented Oct 8, 2020 at 18:43

There seems to be a weakness in series expansions of QPochhammer in Mathematica:

Series[QPochhammer[q, q, 2], {q, 0, 1}] //TeXForm


$$1+q \left(\text{QPochhammer}^{(0,1,0)}(0,0,2)+\text{QPochhammer}^{(1,0,0)}(0,0,2)\right)+O \left(q^2\right)$$

You can fix this by using FunctionExpand (essentially Vaclav Kotesovec's comment to Bill Watt's answer):

Series[FunctionExpand @ QPochhammer[q, q, 2], {q, 0, 1}] //TeXForm


$$1-q+O\left(q^2\right)$$

So, the following should produce your desired result:

ser[k_] := With[{m = Ceiling[1/2 (-1+Sqrt[1+8 k])]},
Series[
Sum[q^(n (n+1)/2) / FunctionExpand @ QPochhammer[q, q, n], {n, 0, m}],
{q, 0, k}
]
]


Example:

ser[20] //TeXForm


$$1+q+q^2+2 q^3+2 q^4+3 q^5+4 q^6+5 q^7+6 q^8+8 q^9+10 q^{10}+12 q^{11}+15 q^{12}+18 q^{13}+22 q^{14}+27 q^{15}+32 q^{16}+38 q^{17}+46 q^{18}+54 q^{19}+64 q^{20}+O\left(q^{21}\right)$$

• thank you so much! Commented Oct 8, 2020 at 19:40

I'm not sure how you get all the terms, but if you want to look at a finite number you can do something like this:

First get a series in q from

fn = q^(1/2 n (n + 1))/QPochhammer[q, q, n]

Series[fn, {q, 0, 100}] // Normal


Then apply the first few n

Plus @@ (Table[%, {n, 0, 100}] // Expand)


That should give you several coefficients to play with. If you want more, you can make the Series and Table longer if you have the computing power.

• When I implement this, I don't get the coefficients. What might I be doing wrong? Commented Oct 8, 2020 at 18:51
• Use n = 10; Series[Sum[q^(k*(k+1)/2)/Product[(1 - q^j), {j, 1, k}], {k, 0, n}], {q, 0, n}] Commented Oct 8, 2020 at 18:58
• This is also sequence A000009 in the OEIS. Commented Oct 8, 2020 at 19:01
• You should get a series in powers of $q$. What are you getting instead? Commented Oct 8, 2020 at 19:38
• In general should I use the product command, as opposed to QPochhammer? Commented Oct 8, 2020 at 19:44