<s>[INST] Evaluating a function in a closed form Let $$g(x)=\lim_{n\rightarrow\infty}\sqrt{n}\int_0^x z^2e^{n(\cos^2z-1)}\ \mathsf dz$$
Evaluate $g$ in closed form. The answer is right here: http://math.nyu.edu/student_resources/wwiki/index.php/Advanced_Calculus:_2004_January:_Problem_2
However, in the last part of the answer. It says at singular $x=k\pi$, $$\int_{k\pi-\delta}^{k\pi} z^2e^{n(\cos^2z-1)}\ \mathsf dz\stackrel{\delta\to0}\longrightarrow \frac{1}{2}k^2\pi^{5/2}$$ 
Can someone please explain why this happens? Also, why does $$g(x)=\frac{\pi^{5/2}}6k(2k^2+1)$$ when $x=k\pi$. Thanks so much
 [/INST] Actually, that limit for $x = k\pi$ that you're interested in is not as $\delta \to 0$ but as $n \to \infty$.
Heuristically that does follow from symmetry.  It was shown in the line above that
$$
\int_{k\pi-\delta}^{k\pi+\delta} \sqrt{n}z^2e^{n(\cos^2z-1)}\ \mathsf dz\stackrel{n\to\infty}\longrightarrow k^2\pi^{5/2},
$$
and the dominant factor in the integrand, $e^{n(\cos^2 z-1)}$, is even about the point $z=k\pi$, so you would expect that
$$
\int_{k\pi-\delta}^{k\pi} \sqrt{n}z^2e^{n(\cos^2z-1)}\ \mathsf dz\stackrel{n\to\infty}\longrightarrow \frac{1}{2}k^2\pi^{5/2}.
$$
It still needs to be shown rigorously, though, but this is done just as it was done when the interval of integration was $(k\pi-\delta,k\pi+\delta)$:
$$
\begin{align}
&\int_{k\pi-\delta}^{k\pi} \sqrt{n}z^2e^{n(\cos^2z-1)}\ \, dz \\
&\qquad = \int_{-\sqrt{n}\delta}^0 \left(\frac{v}{\sqrt{n}}+k\pi\right)^2 e^{-v^2+O(1/n^2)}\,dv \\
&\qquad \to \int_{-\infty}^{0} (k\pi)^2 e^{-v^2}\,dv \\
&\qquad = \frac{1}{2}k^2\pi^{5/2}.
\end{align}
$$
For your second question, if $x = k\pi$ then
$$
\begin{align}
g(x) &= \lim_{n\to\infty} \int_0^{k\pi-\delta} \sqrt{n}z^2 e^{n(\cos^2 z-1)}\,dz + \lim_{n\to\infty} \int_{k\pi-\delta}^{k\pi} \sqrt{n}z^2 e^{n(\cos^2 z-1)}\,dz \\
&= \sum_{0<j\pi<x} j^2\pi^{5/2} + \frac{1}{2}k^2\pi^{5/2} \\
&= \sum_{0<j\pi < k\pi} j^2\pi^{5/2} + \frac{1}{2}k^2\pi^{5/2} \\
&= \pi^{5/2}\sum_{j=1}^{k-1} j^2 + \frac{1}{2}k^2\pi^{5/2} \\
&= \frac{\pi^{5/2}}{6} (k-1) k (2 k-1) + \frac{1}{2}k^2\pi^{5/2} \\
&= \frac{\pi^{5/2}}{6} k (2k^2+1).
\end{align}
$$
</s>