# Calculating the series expansion of a theta function

I have defined the q-theta function as follows:

$$\theta(x;q) = \prod_{k=0}^{\infty} (1-q^k x)(1-q^{k+1}/x)$$

I want to calculating, using this, the series expansion of the following series:

$$\frac{\theta^2(x)\theta(q^{1/2}x^2)}{\theta^2(a)\theta(ax)\theta(a/x)}$$

As a naive approach, I have defined the theta function as the above product in my Mathematica file and tried a series expansion of the more complicated function using Series, about {z,0,2}, say, but unfortunately my code doesn't return anything useful and/or accurate. Instead I get a mess of Pochhammer symbols which I think are incorrect.

If anyone has any tips on calculating the series expansions of these types of q-hypergeometric function-related objects,I would be extremely grateful.

θ[z_, q_] := Product[(1 - q^k z) (1 - q^(k + 1)/z), {k, 0, ∞}];
Series[(θ[x, q]/θ[a, q])^2 θ[q^(1/2) x^2, q]/(θ[a*x, q] θ[a/x, q]), {x, 0, 1}]

• Could you include what you have tried? Nov 27, 2018 at 18:41
– Aran
Nov 27, 2018 at 18:56
• Could you consider taking the logarithm and doing an expansion of that? Nov 27, 2018 at 19:17
• I have tried that, but I keep getting QPochhamer[f[x],q] factors (where f[x] is a function of x, such as 1/x or q/(ax), they appear in various places) when I want a series expansion in x itself.
– Aran
Nov 27, 2018 at 19:24
• Why don't you use EllipticTheta[]? Nov 27, 2018 at 20:37

Try the following code with an example:

QP[a_, q_] := QPochhammer[a, q];
(* T[x, q] == Product[(1 - x q^k) (1 - q/x q^k), {k, 0, Infinity}] *)
T[x_, q_] := QP[x, q] QP[q/x, q];
U[a_, x_, Q_] := With[{q = Q^2}, (T[x, q]^2 T[Q x^2 , q]) /
(T[a, q]^2 T[a x, q] T[a/x, q])];
A = U[q^2, q^1, q^5] + O[q]^11


You will get an ordinary power series in q.

However, you wanted a series in x instead. Try something like this:

(List @@ Normal[ U[a, x, q] + O[q]^6)(1 + O[x]^4) // Total // Simplify


With various series truncations. You will get truncations of a series in powers of x and 1/x.

Try this:

L[a_, x_, Q_, n_] := Normal[U[a, x, Q] + O[Q]^n] + x O[x]^Quotient[n + 1, 2] // Expand;
L[x^2, x, q, 5]


in order o get a truncation of the series in x. To compare to the q-series, try this:

Do[Print[n, ": ", (Normal[L[q^2, q^1, Q, n]] /. Q -> q^5 ) - A], {n, 10}];


in order to see the convergence to the example.

Just to be clear, because of the negative powers of x, we have a Laurent series in x instead of an ordinary power series. This is most likely why you were not able to get a power series in x using the obvious method -- unlike the easy way to get a power series in q.

We use the famous expression q-theta function $$\theta (x;q)=(x;q)_{\infty} (q/x;q)_{\infty}$$ where $$(x;q)_{\infty}$$ is the q-Pochhammer symbol. At x=0 it is impossible to expand into a Series, but you can, for example, expand around x=1

T0 = QPochhammer[x, q]*QPochhammer[q/x, q];
T1 = QPochhammer[q^(1/2)*x^2, q]*QPochhammer[q/(q^(1/2)*x^2), q];
T2 = QPochhammer[a, q]*QPochhammer[q/a, q];
T3 = QPochhammer[a*x, q]*QPochhammer[q/(a*x), q];
T4 = QPochhammer[a/x, q]*QPochhammer[q/(a/x), q];

S = T0^2*T1/(T2^2*T3*T4);
Series[S, {x, 1, 2}];
Normal[%]

(*(QPochhammer[1, q]^2 QPochhammer[Sqrt[q], q]^2 QPochhammer[q, q]^2)/(
QPochhammer[a, q]^4 QPochhammer[q/a,
q]^4) - (2 (-1 + x) QPochhammer[1, q]^2 QPochhammer[q,
q]^2 (QPochhammer[Sqrt[q], q]^2 QPolyGamma[0, 0, q] -
QPochhammer[Sqrt[q], q]^2 QPolyGamma[0, 1, q]))/(Log[
q] QPochhammer[a, q]^4 QPochhammer[q/a,
q]^4) + ((-1 + x)^2 QPochhammer[Sqrt[q],
q]^2 (Log[q] QPochhammer[1, q]^2 QPochhammer[q, q]^2 QPolyGamma[
0, 0, q] +
2 QPochhammer[1, q]^2 QPochhammer[q, q]^2 QPolyGamma[0, 0,
q]^2 - Log[q] QPochhammer[1, q]^2 QPochhammer[q,
q]^2 QPolyGamma[0, 1, q] -
4 QPochhammer[1, q]^2 QPochhammer[q, q]^2 QPolyGamma[0, 0,
q] QPolyGamma[0, 1, q] +
2 QPochhammer[1, q]^2 QPochhammer[q, q]^2 QPolyGamma[0, 1,
q]^2 - QPochhammer[1, q]^2 QPochhammer[q, q]^2 QPolyGamma[1,
0, q] - QPochhammer[1, q]^2 QPochhammer[q, q]^2 QPolyGamma[1,
1, q] + QPochhammer[1, q]^2 QPochhammer[q, q]^2 QPolyGamma[1,
Log[a]/Log[q], q] -
4 QPochhammer[1, q]^2 QPochhammer[q, q]^2 QPolyGamma[1,
Log[Sqrt[q]]/Log[q], q] +
QPochhammer[1, q]^2 QPochhammer[q, q]^2 QPolyGamma[1, Log[q/a]/
Log[q], q]))/(Log[q]^2 QPochhammer[a, q]^4 QPochhammer[q/a,
q]^4)*)