Taylor expansion of a function containing QPochhammer[q, q, n]

The reason it doesn't work is because somewhere between v10.0 and v10.3, the seventh definition of QPochhammer was modified to check that the second argument does not depend on the expansion parameter.

To restore previous behavior, clear the seventh definition,

(*Triggers loading of definitions*)
Series[QPochhammer[0, x, 3], {x, 0, 1}];

(*Unprotect*)
Unprotect[QPochhammer];

QPochhammer /: 
 System`Private`InternalSeries[
   HoldPattern[QPochhammer][System`SeriesDump`w_, 
    System`SeriesDump`q_, 
    System`SeriesDump`k_Integer?Positive], {System`SeriesDump`z_, 
    System`SeriesDump`p_, System`SeriesDump`n_Integer}] /; 
 Internal`DependsOnQ[System`SeriesDump`w, System`SeriesDump`z] && ! 
    Internal`DependsOnQ[{System`SeriesDump`q, System`SeriesDump`p}, 
    System`SeriesDump`z] =.

Then add the definition from earlier versions,

QPochhammer /: 
 System`Private`InternalSeries[
   HoldPattern[QPochhammer][System`SeriesDump`w_, 
    System`SeriesDump`q_, 
    System`SeriesDump`k_Integer?Positive], {System`SeriesDump`z_, 
    System`SeriesDump`p_, System`SeriesDump`n_Integer}] /; 
  Internal`DependsOnQ[System`SeriesDump`w, System`SeriesDump`z] := 
 Module[{System`SeriesDump`lim, System`SeriesDump`ord, 
   System`SeriesDump`qq, System`SeriesDump`ww}, 
  System`SeriesDump`lim = 
   System`SeriesDump`getExpansionPoint[System`SeriesDump`w, 
    System`SeriesDump`z, 
    System`SeriesDump`p]; (System`SeriesDump`ord = 
     Min[System`SeriesDump`k, 
      System`SeriesDump`AdjustExpansionOrder[System`SeriesDump`w, 
       System`SeriesDump`lim, System`SeriesDump`z, 
       System`SeriesDump`p, System`SeriesDump`n]]; 
    System`SeriesDump`ww = 
     System`Private`InternalSeries[
      System`SeriesDump`w, {System`SeriesDump`z, System`SeriesDump`p, 
       System`SeriesDump`n}]; 
    System`SeriesDump`qq = 
     System`Private`InternalSeries[
      System`SeriesDump`q, {System`SeriesDump`z, System`SeriesDump`p, 
       System`SeriesDump`n}]; 
    1 + Plus @@ 
      Table[(-System`SeriesDump`ww)^
        System`SeriesDump`m System`SeriesDump`qq^
        Binomial[System`SeriesDump`m, 2] QBinomial[
         System`SeriesDump`k, System`SeriesDump`m, 
         System`SeriesDump`qq], {System`SeriesDump`m, 
        System`SeriesDump`ord}]) /; System`SeriesDump`lim === 0];

Protect[QPochhammer];

Now we get the desired behavior,

Series[QPochhammer[q, q, 3], {q, 0, 4}]

Desired result

Warning The seventh definition was modified in later releases probably because someone discovered that it leads to incorrect results in some cases. Proceed with caution.


An easier method is to perform a preliminary application of FunctionExpand[]:

Series[QPochhammer[q, q, 3] // FunctionExpand, {q, 0, 4}]
   1 - q - q^2 + q^4 + O[q]^5