TITLE: Asymptotic equivalent of $\sum_{n\ge0} q^{n^2}{x^n}$ as $x\to+\infty$
QUESTION [19 upvotes]: Let $q\in\Bbb C^*$ with $|q|<1$, define
$$f:x\mapsto\sum_{n\ge0} q^{n^2}{x^n}$$
I want to find an asymptotic equivalent of $f$ as $x\to+\infty$.
I found that

$$a\le|f(x)|\cdot\exp\left(\frac{\ln^2|x|}{4\ln |q|}\right)\le b$$
  where
  $$a=\min\left( \left|\sum_{n\in\Bbb Z} q^{(n+\frac12)^2}\right|, \left|\sum_{n\in\Bbb Z} q^{n^2}\right|\right)$$
  $$b=\max\left( \left|\sum_{n\in\Bbb Z} q^{(n+\frac12)^2}\right|, \left|\sum_{n\in\Bbb Z} q^{n^2}\right|\right)$$

Here is what I did:
Let $x=q^{-2k}$ with $k\in\Bbb R_+$, let $k=K+d$ such that $K\in\Bbb N$ and $d\in(-\frac12,\frac12]$, then
\begin{align}
f(q^{-2k})&=\sum_{n\ge0} q^{n^2-2kn}\\
&=q^{-k^2}\sum_{n\ge0} q^{(n-k)^2}\\
&=q^{-k^2}\sum_{n\ge-K} q^{(n-d)^2}\\
&=q^{-k^2}\left(\sum_{n\in\Bbb Z} q^{(n-d)^2}-\sum_{n>K} q^{(n+d)^2}\right)\\
\end{align}
Thus,
$$
|f(q^{-2k})\cdot q^{k^2}|=_{k\to+\infty}l(d)+o(1)
$$
where
$$
l:d\mapsto\left|\sum_{n\in\Bbb Z} q^{(n-d)^2}\right|
$$
and below is the graph of $l(d)$ with $q=\frac12$ and $-\frac12$.

Since $\lim_{k\to+\infty}|q^{-2k}|=+\infty$, the results are shown by replacing $k$ with $-\frac{\ln |x|}{2\ln|q|}$.

I expect any further studies of this problem.

REPLY [2 votes]: Edit: We assume that $q$ is real, $0<q<1$ and $x$ is real and positive.
We want to study the behavior of $f(x)$ as $x\to\infty$.
We have $f(x)=g(x)-\sum_{n=-\infty}^{-1} q^{n^2}x^n$ with $g(x)=\sum_{n=-\infty}^\infty q^{n^2}x^n$. Therefore $f(x)=g(x)+O(x^{-1})$ as $x\to\infty$. Now we calculate
$$q\,x\, g(q^{2} x)=q\,x\,\sum_{n=-\infty}^\infty q^{n^2}q^{2n}x^n=
\sum_{n=-\infty}^\infty q^{n^2+2n+1}x^{n+1}=\sum_{n=-\infty}^\infty q^{n^2}x^n=g(x)$$
for all real $x$. 
Consider now with $\mu=\log q$ the function $d(x)=\exp\left(\frac1{4\mu}(\log x)^2\right)g(x)$, defined for real positive $x$. We calculate 
$$\begin{matrix}d(q^2x)&=&\exp\left(\frac1{4\mu}(\log x+\mu)^2\right)g(q^2x)=
\exp\left(\frac1{4\mu}(\log x)^2\right)\exp(\log(x))\exp(\mu)g(q^2x)\\&=&
\exp\left(\frac1{4\mu}(\log x)^2\right)\,x\,q\,g(q^2x)=\exp\left(\frac1{4\mu}(\log x)^2\right)g(x)=d(x)\end{matrix}.$$
This means that the function $p(t)=d(e^{2\mu t})$ is 1-periodic. We have found that
$$g(x)=\exp\left(-\frac1{4\mu}(\log x)^2\right)p\left(\frac1{2\mu}\log x\right)$$
with a certain 1-periodic function $p$.
In summary, with $\mu=\log q<0$, we have shown the existence of a 1-periodic function
$p$ such that 
$$f(x)=\exp\left(-\frac1{4\mu}(\log x)^2\right)p\left(\frac1{2\mu}\log x\right)+O(x^{-1}).$$
Observe that, by construction, $p$ is positive and hence also its minimum is positive.
If we use the Theta function, this periodic function $p$ can be identified.
If we put $q=\exp(\pi\tau i)$ and $x=\exp(2\pi z i)$ then $g(x)=\vartheta(z,\tau)$. The Jacobi identity 
$\vartheta\left(\frac z\tau;-\frac1\tau\right)=(-i\tau)^{1/2}\exp(\frac\pi\tau i z^2)\vartheta(z;\tau)$ yields after a short calculation that
$$p(t)=\sqrt{\frac{\pi}{-\mu}}\left(1+2\sum_{n=1}^\infty e^{\pi^2n^2/\mu}\cos(2\pi n t)\right).$$
Edit 2: User reuns indicates a way to avoid using the Theta function and the Jacobi identity as a black box. If I remember correctly, this is a way to prove the Jacobi identity.
We have (since $t=\frac1{2\mu}\log x$) that
$$p(t)=\sum_{n=-\infty}^\infty \exp\left(\mu(n+t)^2\right).$$
This shows in particular clearly that $p$ is a 1-periodic function.
Its Fourier series is
$$p(t)=\sqrt{\frac{\pi}{-\mu}}\sum_{n=-\infty}^\infty e^{\pi^2n^2/\mu}\exp(2\pi i n t);$$
here it is used that $\int_{-\infty}^\infty \exp(\mu t^2 -2\pi i m t)\,dt=
\sqrt{\frac\pi{-\mu}}\exp(\pi^2 m^2/\mu)$ for $m\in{\mathbb Z}$.
Edit: If $q\in{\mathbb C}^*$, $|q|<1$, then we still have $f(x)-g(x)=O(x^{-1})$, even as $|x|\to\infty$ even for complex $x$, but we have just $\mbox{Re }\mu<0$. The function $p(t)$ is still 1-periodic, but we need it for values $t=\frac1{2\mu}\log x$, $x$ real tending to $+\infty$, for which $|\mbox{Im } t|$ tends to infinity. The asymptotic behavior of $g(x)$ is more complicated then. I think, it is dominated by the term  $q^{n^2}x^n$ of maximal norm, that is when $x|q|^{2n+1}\approx1$.