I'm working on a problem for my thermal physics course and got stuck when trying to evaluate a specific sum. Looking at the solutions, they transformed the sum into an integral. For some reason, I have never come across this in my physics career. The specific transformation I'm referring to is this:
$$\sum_{n=0}^\infty \lambda \exp(-\varepsilon_n / \tau) = \frac{\pi}{2}\int_0^\infty \lambda \exp(-\varepsilon_n / \tau) n \ \mathrm dn $$
What are the conditions to be able to evaluate a sum in this manner and what is the method to be able to find this integral?
EDIT: It seems I should be a little more specific regarding the problem. The exact question I'm working on is:
Find the chemical potential of an ideal monatomic gas in two dimensions, with $N$ atoms confined to a square area $A=L^2$. The spin is zero.
For this system, $$\varepsilon_n = \frac{\hbar^2 \pi^2}{2m} \frac{(n_x^2 + n_y^2)}{L^2} = \alpha \frac{n^2}{A} $$
For $\alpha = \frac{\hbar^2 \pi^2}{2m}$
I did find the formula for the transformation in the book, but there is no derivation. They give it as fact, which I don't really like. Any help with why this is possible would be appreciated.
Thank you.
EDIT 2:
I believe I found a mistake in my book. In one area they use the expression I listed above, but in another there is an $n^2$ instead of an $n$. i.e.,
$$\sum_{n=0}^\infty \lambda \exp(-\varepsilon_n / \tau) = \frac{\pi}{2}\int_0^\infty \lambda \exp(-\varepsilon_n / \tau) n^2 \ \mathrm dn $$
Does this fix any issues with my question?
I believe the general idea goes as follows. Let $n^2 = n_1^2 + \ldots + n_d^2$. First make the approximation $$\sum_{n_1 \gt 0, ..., n_d \gt 0} f(n) e^{-\alpha n^2} \approx \int_0^\infty \dots \int_0^\infty f(n) e^{-\alpha n^2} \mathrm d n_1 \mathrm \dots \mathrm d n_d,$$ valid for small $\alpha$, assuming some conditions on $f$ hold.
Then convert the integral to spherical coordinates. Integrating over all spherical angles leaves $\mathrm d V_d(n)$, where $V_d(n)$ is the volume of the part of the $d$-dimensional ball of radius $n$ where all coordinates are positive. The result is $$\int_0^\infty f(n) e^{-\alpha n^2} \mathrm d V_d(n) = \frac {d \pi^{d/2}} {2^d \Gamma\left( \frac d 2 + 1 \right)} \int_0^\infty f(n) n^{d - 1} e^{-\alpha n^2} \mathrm d n.$$ In particular, $$\mathrm d V_2(n) = \mathrm d\left( \frac {\pi n^2} 4 \right) = \frac \pi 2 n \mathrm dn, \\ \mathrm d V_3(n) = \mathrm d\left( \frac {4 \pi n^3 / 3} 8 \right) = \frac \pi 2 n^2 \mathrm dn.$$