Approximate sum by an integral: valid or not? Let:
$$S_n = \frac{1}{n} \sum_{i=0}^n \mathrm{e}^{n f(i/n)} g(i/n)$$
$$I_n = \int_0^1 \mathrm{e}^{nf(x)}g(x)\mathrm{d}x$$
where $f(x)$ and $g(x)$ are smooth functions (assume they are differentiable up to any order required), $g(x) > 0$, and $n$ is a positive integer. 
Note that the sum looks like a Riemann sum, but not quite, because there is an $n$ in the exponent.
Prove or disprove, that $R_n = |(S_n - c I_n) / S_n| \rightarrow 0$ as $n \rightarrow \infty$, for some constant $c$ that may depend on $f,g$ and/or its derivatives, but does not depend on $n$. If true, find the value of $c$ and characterize how fast $R_n$ decays as $n$ increases; is it exponentially fast?
 A: The main observation:
Let $f,g$ be analytic in the disk $\{|z|\le 2\delta\}$ and real on the interval
$(-2\delta,2\delta)$. Assume that $f(0)=0$ and $f(x)<0$ for $0<|x|<2\delta$. Let $\psi$ be any $C^2$-smooth function on $\mathbb R$ such that $\psi\equiv 1$ on $(-\delta,\delta)$ and $\operatorname{supp}\psi\subset(-2\delta,2\delta)$. Let $n$ be a large integer and let $\Lambda$ be any arithmetic progression with step $1/n$. Put $F_n(x)=\psi(x)g(x)e^{nf(x)}$. Then
$$
\frac 1n \sum_{x\in\Lambda}F_n(x)-\int_{\mathbb R}F_n(x)\,dx=O(e^{-cn})
$$
with some $c>0$.
Proof:
By the Poisson summation formula, the absolute value of the left hand side is bounded by
$
\sum_{y\in n\mathbb Z\setminus\{0\}}|\widehat F_n(y)|
$
where $\widehat F_n(y)=\int_{\mathbb R}F_n(x)e^{-2\pi i yx}\,dx$. Thus, our aim is to estimate the Fourier transform of $F_n$. Since we want to bound an infinite sum, it will be more convenient to get a uniform bound for the Fourier transform of $F_n''$ outside $[-n,n]$, which will give us an extra factor $1/y^2$ when passing to $F_n$ itself. Notice that $F_n''=G_ne^{nf}$ where $G_n$ is continuous, supported inside $(-2\delta,2\delta)$ and analytic in $\{|z|<\delta\}$. Also $|G_n|\le Cn^2$.
Since $f$ attains its strict maximum at the origin and is analytic in a neighborhood, there exist $a>0$, $k\in\mathbb N$ such that $f(z)=-2az^{2k}+\text{higher order terms}$ and the first term dominates in some disk $\{|z|\le 2\Delta\}$. In particular, $|f(z)|\le 3a|z|^{2k}$ when $|z|\le 2\Delta$ and $\Re f(z)\le -a|z|^{2k}$ when $|z|\le 2\Delta$ and $|\Im z|\le \frac \pi{8k}|\Re z|$, say. Now take the integral defining the Fourier transform of $F_n''$ with $y\ge n$ and shift the contour of integration to the one going from $-\infty$ to $-\Delta$ to $-\Delta-\frac\pi{8k}\Delta i$ to $\Delta-\frac\pi{8k}\Delta i$ to $\Delta$ to $+\infty$.
Now just notice that $e^{nf(z)}e^{-2\pi i zy}$ is bounded by $e^{-cn}$ everywhere on the new contour. If is obvious for all pieces except the bottom horizontal one because $\Re f$ is negative and separated from $0$ there. However on the bottom horizontal piece we have
$$
\Re[nf(z)-2\pi i yz]\le n|f(z)|-2\pi \frac\pi{8k} y\Delta
\\
\le \left[3a(2\Delta)^{2k}-2\pi \frac\pi{8k}\Delta\right]n
$$
for $y\ge n$ and we can always make $\Delta>0$ smaller, if needed, to ensure that the expression in the brackets is negative. The pre-factor $G_n$ is $O(n^2)$ everywhere on the contour, so it does not affect this estimate too much.
The rest should be more or less clear (take an appropriate partition of unity and blah-blah-blah) but feel free to ask questions if you meet any difficulty :-) . 
A: If I'm not mistaken,
take $f:x\mapsto x$ and $g:x\mapsto 1$.
Then, $(S_n-I_n)/S_n=\frac{\frac{\mathrm{e}^n}{n}\frac{\mathrm{1}}{\mathrm{e}-1}-\frac{1}{n}\frac{1}{\mathrm{e}-1}+\frac{1}{n}}{\frac{1}{n}\frac{\mathrm{\mathrm{e}^{n+1}}-1}{\mathrm{e}-1}}$, which converges to $\frac{1}{e}$.
