Infinite sum and Jacobi Theta function I have encountered a sum as following:
\begin{equation}
\sum_{n=1}^{\infty} q^{n^2}
\end{equation}
\begin{equation}
\sum_{n=1}^{\infty} n^2 q^{n^2}
\end{equation}
where $0<q<1$.
I know that the first sum is related to Jacobi Theta function, but what about second sum? Can I do anything about that?
 A: A series expansion of an Elliptic Theta function (up to order 100) is:
$1-2 q+2 q^4-2 q^9+2 q^{16}-2 q^{25}+2 q^{36}-2 q^{49}+2 q^{64}-2 q^{81}+2
   q^{100}+O\left(q^{101}\right)$
A: For the first sum, we have a Jacobi Theta function, just as you claim.
$$\vartheta_3(q)=\sum_{n=-\infty}^\infty q^{n^2}\\\frac12(\vartheta_3(q)-1)=\sum_{n=1}^\infty q^{n^2}$$
Take the derivative w.r.t. $q$ and you will find that
$$\frac12\vartheta_3'(q)=\sum_{n=1}^\infty n^2q^{n^2-1}$$
$$\frac q2\vartheta_3'(q)=\sum_{n=1}^\infty n^2q^{n^2}$$
Though one cannot improve on this form, according to Wolfram.  Note these series representations themselves converge extremely fast for $|q|<1$, so I'm not quite sure on any forms that would converge faster.
But anyways, if that's what you want,
$$\sum_{n=1}^\infty n^2q^{n^2}=\sum_{n=1}^\infty\left[4n^2(q^4)^{n^2}+(-1)^{n+1}n^2q^{n^2}\right]$$
$$\frac q2\vartheta_3'(q)=2q^4\vartheta_3'(q^4)-\frac q2\vartheta_4'(q)$$
Repeatedly apply this and you will get

$$\frac q2\vartheta_3'(q)=-\sum_{n=0}^\infty2^{2n-1}q^{4^{n-1}}\vartheta_4'(q^{4^n})$$

