Summation of $\sum_{n=0}^{\infty}a^nq^{n^2}$ I am trying to find the result for the sum of the form
$\sum_{n=0}^{\infty}a^nq^{n^2}$.
The special case for $a=1$ is easily given by $\vartheta(0,q)$, where $\vartheta(z,q)$ is the third Jacobi Theta function. So, whatever the answer is, it must collapse to $\vartheta(0,q)$ for $a=1$.
I tried the approach:
$\sum_{n=0}^{\infty}\exp(2niz)q^{n^2}$, where $z=-i\frac{\ln(a)}{2}$, to make the summation look like $\vartheta(z,q)$. However, Jacobi Theta functions include summation from $-\infty$ to $\infty$, while I need it to start at 0.
I tried to use the Parseval's relation as well as several other methods but I cannot proceed any further.
Edit: Following Somos' comment on partial theta functions, this relation indeed is one of the many partial theta functions
$\Theta_P(a;q)=\sum_{i=0}^n a^nq^{n^2}$ (Eq. I)
However, this is no good for computation as I cannot express this in an existing function in python. I know this is an addition to the question, yet I am still looking for a closed form expression that can be used for simulations.
Another partial theta function is given in the form
$\Theta_P(a;q)=\Pi_{k=1}^n (1+aq^{k})(1+a^{-1}q^{k})$ (Eq. II)
If there exists a relationship between Eq. I and Eq. II, it may be possible to find the summation I am looking for in terms of, including but not limiting to theta functions and q-pochhammer.
Another possibly promising solution I pursued was Abel-Poisson summation method, yet of knowledge my mathematics did not allow me to pursue this to the end.
Thank you.
 A: Sequence $\{a^n q^{n^2}\} = \{b^n\},\ $ where $\,\{b_n=aq^n\},\ $ converges to zero if and only if $|q|<1.$ If $aq>1,\ $ then it has increasing beginning part (see Wolfram Alpha plot for $q=3/4, a=1/2,1,2,4\ $ with the unit of the vertical axis in the decimal logarithms.).

The given series converges absolutely, if and only if $|q|<1.$
Known Laplace transform
$$\mathcal L\left(e^{\Large -\,^{t^2}\!/\!_{4k^2}}\right)=k\sqrt\pi\, e^{k^2s^2}\operatorname{erfc}ks\,(k>0)\tag1$$
allows to apply the Euler-Maclaurin formlula with the same nodes, as the given sum.
On the other hand, the direct summation gives the better accuracy and calculation complexity.
At the same time, since
$$\theta_3(z,q)=\sum\limits_{n=-\infty}^\infty q^{\large n^2}e^{\large 2inz},\tag2$$
then
$$S=\sum\limits_{n=0}^{\infty} a^n q^{\large n^2}
=\sum\limits_{n=-N}^{\infty} a^{n+N} q^{\large (n+N)^2}
= \lim\limits_{N\to\infty}a^{\large N} q^{\large N^2}\sum\limits_{n=-N}^{\infty}  q^{\large n^2}(aq^{2N})^{\large n}\\
= \lim\limits_{N\to\infty}a^{\large N} q^{\large N^2}\sum\limits_{n=-N}^{\infty}  q^{\large n^2}e^{\large i n (-i(\ln a + 2N\ln q))},$$
$$S= \lim\limits_{N\to\infty}\left(aq^{\large N}\right)^{\large N}
\theta_3\left(-i\dfrac{\ln a + 2N\ln q}2,q\right).\tag3$$
The worst case of summation is $aq^L = 1$ for the large values of $L.$
Then the greatest value of $M\approx a^nq^{n^2}$ achieves if
$$\dfrac{a^{n+1}q^{(n+1)^2}}{a^nq^{n^2}} = 1, \quad n\approx \dfrac{-\log q}{2\log a}\approx\dfrac L2,\quad M\approx a^Lq^{L^2}\approx a^{\Large^L\!/\!_4},\quad a\approx \sqrt[\Large L]{M^4}.\tag4$$
If $a=1.335,\quad q=0.99887$, then $M\approx 10^8,\ L\approx 255.$

In this case, formula $(3)$ with $N=0$ gives
$$S\approx 54764\,68327.05684,$$
and direct summation gives
$$S = 54764\,683241.58768\dots$$
