About the asymptotic behavior of specific Jacobi $\theta$ function $\operatorname{\vartheta}_3\left(0;x\right)$ when $x\to{1-}$. Since $\displaystyle\sum_{n=1}^\infty{x^{n^2}}=\dfrac{\operatorname{\vartheta}_3\left(0,x\right)-1}2$ for $x\in\left(0,1\right)$ (just in case), it suffices to consider the former below. (Another relevant identity is that $\displaystyle\sum_{n=1}^\infty{x^{n^2}}=\left(1-x\right)\mspace{-2mu}\sum_{n=1}^\infty{\!\left\lfloor\mspace{-1mu}\sqrt{n}\right\rfloor\!x^n}$.)
Many a post (e.g.,

*

*What is $\lim_{x\to1^{-}} (1-x)\left(\sum_{i=0}^{\infty} x^{i^2}\right)^{2}$?,

*Why is $\lim_{x\to 1}\sqrt{1-x}\sum_{n=0}^\infty x^{n^2}=\sqrt{\pi}/2\,\,$?,

*Compute the limit of $\sqrt{1-a}\sum\limits_{n=0}^{+\infty} a^{n^2}$ when $a\to1^-$,

*$\lim_{x\to 1^-}\sqrt{1-x}\ \left(1+x+x^4+x^9+x^{16}+x^{25}+\cdots\right)=\sqrt{\pi}/2$ is true?, and

*How to prove that $\lim_{x\to 1^-} \left(\left(\sum_{n=1}^{\infty}x^n \right)\cdot \log\left(\frac{1}{x}\right) \right)= 1$ WITHOUT computing the sum)

has shown that
$$\lim_{\mspace{-1mu}x\to1^-}{\sqrt{1-x\mspace{2mu}}\sum_{n=1}^\infty{\mspace{-1.5mu}x^{n^2}}}=\frac{\mspace{-1.5mu}\sqrt\pi\mspace{1mu}}2\text{.}$$ Nevertheless, none of them evaluated the limit $$\lim_{\mspace{-1mu}x\to1^-}{\mspace{-3mu}\left({\sqrt{\mspace{-0.5mu}\frac\pi{1-x}}-2\mspace{-0.75mu}\sum_{n=1}^\infty{\mspace{-1.75mu}x^{n^2}}}\right)\mspace{-1mu}}\text{,}$$ which is equal to $1$. how to find the asymptotic expansion of the following sum: sketched out a possible approach to finding this kind of limit. Some other related posts are as follows:

*

*Asymptotics of a recurrence relation,

*Asymptotic behavior of $\sum\limits_{n=0}^{\infty}x^{b^n}$ when $x\to1^-$,

*Evaluate $\lim_{x\to1^-}\left(\sum_{n=0}^{\infty}\left(x^{(2^n)}\right)-\log_2\frac{1}{1-x}\right)$ and

*What's the limit of the series $\log_2(1-x)+x+x^2+x^4+x^8+\cdots$..

In Analysis of Series and Products. Part 1: The Euler–Maclaurin Formula and Analysis of Series and Products. Part 2: The Trapezoidal Rule, the authors show that $${{\sum_{j=1}^\infty\mathrm{e}^{-j^2/x^2}-\frac{x\sqrt\pi}2+\frac12}\to0}\quad\text{as}\quad{x\to{+\infty}}\text{,}$$ and the magnitude of the left-hand side decreases exponentially as $x$ increases. (Then set $u=\exp\left(-x^{-2}\right)$. How about the Abel–Plana formula?)
In addition, in On the asymptotics of some partial theta functions and Some new asymptotic expansions of certain partial theta functions, each author showes that $$\dfrac{\operatorname{\vartheta}_3\left(0,x\right)+1}2=\sum_{n\in\mathbb{N}}{x^{n^2}}=\frac12\sqrt{\frac{-\pi}{\ln{x}}}+\frac12+\operatorname{\mathcal{O}}\left(\ln^q{\!x}\right)\text{,}\quad\forall{q\in\mathbb{N_+}}\text{,}$$ as $x\to1^-$ (after making some substitutions).
It is generally known that $\ln{x}\sim{x-1}$ as $x\to1$; hence, as $x\to1^-$, $\displaystyle\sum_{n=1}^\infty{x^{n^2}}\sim\frac12\sqrt{\frac{\pi}{1-x}}$ just means that $\displaystyle\sum_{n=1}^\infty{x^{n^2}}\sim\frac12\sqrt{\frac{-\pi}{\ln{x}}}$. Yet, if one uses the former in the asymptotic expansion, what about the remainder term?
Via a number of numerical experiments, it seems that $$\frac{\operatorname{\vartheta}_3\left(0,x\right)}{\sqrt{\pi\!\left(1-x\right)}}=\frac1{\sqrt{\pi\!\left(1-x\right)}}\sum_{n\in\mathbb{Z}}{x^{n^2}}=\frac1{1-x}-\frac14+\operatorname{\mathcal{o}}\left(1\right)\quad\text{as}\quad{x\to1^-}\text{.}$$ Unfortunately, I have no idea how to prove it. Any idea? Many thanks!
 A: We use the fact that the Mellintransform $M$ of a Gaussian is given by
$$
M(e^{-  x^2})=\frac{\Gamma(s/2)}{2}\,\,\,\, (*) 
$$
In following we are using a method discovered by Flajolet and co-workers. First of all we can see that the sum in question ($-a^2=\log(x)$)
$$
\mathcal{S}(a)=\sum_n e^{-a^2 n^2}
$$
is a harmonic sum with frequencies $f_n=n$ , amplitudes $A_n=1$ and base function $g(x)=e^{-x^2}$. Therefore by the above reference we have (using (*) and $\Lambda(s)=\sum_{n\geq1 } f_n^{-s} $):
$$
M(\mathcal{S})=\Lambda(s)g^*(s)=\zeta(s)\frac{\Gamma(s/2)}{2}
$$
now we can use the "Mellin Summation Formula" stated on page 25 of the reference ($H$ is the set of residues left of the fundamental strip $(0,\infty)$ ).
$$
\mathcal{S}(a)\sim_{a\rightarrow 0} \sum_{s \in H}\text{res}(M(\mathcal S)a^{-s/2})
$$
we have $\text{res}(M(\mathcal S)a^{-s/2})|_{s=1}=\sqrt{\pi}/(2a^{1/2})$ and
$\text{res}(M(\mathcal S)a^{-s/2})|_{s=0}=-1/2$ and therefore
$$
\mathcal{S}(a)\sim_{a\rightarrow 0} \frac{\sqrt{\pi}}{2a^{1/2}}-\frac12
$$
Note the corrections are expontially small since $\zeta(-2n)=0$ so no other residue has finite value and no further correction of $O(x^n)$ exists.
