# How to turn a sum into an integral?

In, An Introduction to Thermal Physics, page 235, Schroder wants to evaluate the partition function

$$Z_{tot}=\sum_0^\infty (2j+1)e^{-j(j+1)\epsilon/kT}$$

in the limit that $$kT\gg\epsilon$$, thus he writes

$$Z_{tot}\approx\int_0^\infty (2j+1)e^{-j(j+1)\epsilon/kT}\,dj$$

But how is this correct? There was no factor of $$j$$ in the sum that could be replaced with $$dj$$. Also, it is good that $$j$$ is just a number, otherwise even the dimensions of $$Z_{tot}$$ would be wrong.

• What have you done so far to examine this problem? Have you studied Riemann sums? Commented Jul 8 at 21:09
• @user121330 Yes, I have studied those, but precisely because they are sums of areas, there is an extra factor of "length" (here dj), that I have a problem with. Commented Jul 8 at 21:12
• This link to an answer on Mathematics SE might be useful. Commented Jul 8 at 22:09
• The displayed sum is a sum of areas of rectangles of width $1$. Commented Jul 8 at 22:51

So the trapezoid rule states that, if we partition an interval $$(a, b)$$ into $$N + 1$$ equally spaced points, $$\Delta x = \frac{b - a}{N},~~~x_k = a + k~\Delta x,$$ then $$\int_a^b \mathrm dx ~f(x) = \Delta x\sum_{k=0}^{N} f(x_k) - \Delta x~\frac{f(a) + f(b)}{2} - \frac{(b - a) (\Delta x)^2}{12} f''(\xi)$$ for some $$\xi$$ on $$(a, b).$$

Normally we use this “forwards” to assess $$\int \mathrm dx ~f(x)$$ but your textbook author is using this “backwards” with $$\Delta x$$ fixed to $$1$$ to instead find that, $$\sum_{k=0}^{N} f(k) = \int_a^b \mathrm dx ~f(x) + \frac{f(0) + f(N)}{2} + \frac{N}{12} f''(n)$$ for some $$0 < n < N.$$

If one is doing this, one needs to be a little bit careful to make sure that the integral on the right hand side is growing much faster than the $$N~f''(n)$$ error term is, so that the relative error is not too great. But it's a perfectly mathematically valid way to use that equation. It is somewhat easy to forget, so worth underlining, that in mathematics, equals signs generally don't have a direction. If $$a = b$$, then you can always also say that $$b = a$$. The two expressions are just different names for, or ways to calculate, the same resultant number.

$$Z_{tot}=\sum_0^\infty (2j+1)e^{-j(j+1)\epsilon/kT}$$

in the limit that $$kT\gg\epsilon$$, thus he writes

$$Z_{tot}\approx\int_0^\infty (2j+1)e^{-j(j+1)\epsilon/kT}\,dj$$

But how is this correct? There was no factor of $$j$$ in the sum that could be replaced with $$dj$$.

Factors of $$j$$ in the sum translate to factors of $$j$$ in the integral, not factors of $$dj$$. The $$dj$$ terms basically is just there to remind us that the dummy integration variable is $$j$$.

If it makes you more comfortable, you are free to define $$\Delta j = 1$$ and write: $$Z_{tot}=\sum_0^\infty (2j+1)e^{-j(j+1)\epsilon/kT}$$ $$=\sum_0^\infty 1(2j+1)e^{-j(j+1)\epsilon/kT}$$ $$=\sum_0^\infty \Delta j(2j+1)e^{-j(j+1)\epsilon/kT}$$

Also, it is good that $$j$$ is just a number, otherwise even the dimensions of $$Z_{tot}$$ would be wrong.

Yes. That is good, isn't it?

If the summation variable of interest happened to have dimensions, then you would need to introduce some constant with the same dimensions in order to proceed from sum to integral. But, your summation/integration variable already is dimensionless, so you don't have to worry about that in this case.

• My statement about dimensions was precisely to point out the difficulty of this method that I have. For the sake of argument, let $j=\epsilon$, therefore $j$ has dimensions now. I don't think this would affect the above method of turning sum to integral, but now dimensions aren't the same on both sides. Commented Jul 8 at 21:31
• @GedankenExperimentalist You are not allowed to do that replacement ($j\to\epsilon$) because then the argument of the exponential would have dimensions, which is not allowed. In general, if the thing you are summing over has dimensions then you need to introduce some constant with the same dimensions to avoid the issue you are worried about when you transition to an integral. But your summation variable already does not have dimensions, so you don't have to worry about it.
– hft
Commented Jul 8 at 21:35
– hft
Commented Jul 8 at 22:19

Here is an answer as a mathematician.

The situation you have is that you want to compare $$\sum_{j=0}^\infty f_s(j)\qquad\text{ and} \qquad \int_0^\infty f_s(t)\,dt,$$ where $$f_s(t)$$ is a function that decreases on $$t$$, with $$f_s(0)=1$$ for all $$s$$, and such that $$\lim_{s\to0}f_s(t)=0$$ for all $$t>0$$. In this situation you have $$\tag1 \lim_{s\to0}\sum_{j=0}^\infty f_s(j)=-1+\lim_{s\to0} \int_0^\infty f_s(t)\,dt$$ That is, in the original notation $$\tag2 \lim_{\epsilon/kT\to0}\sum_0^\infty (2j+1)e^{-j(j+1)\epsilon/kT} =-1+\lim_{\epsilon/kT\to0}\int_0^\infty (2j+1)e^{-j(j+1)\epsilon/kT}\,dj,$$ and the $$-1$$ term would disappear if you started both the sum and the integral from $$j=1$$ instead of $$j=0$$.

To see why $$(1)$$ is true, note first that $$\int_j^{j+1}f_s(t)\,dt\leq\int_j^{j+1} f_s(j)\,dt=f_s(j),$$ so $$\int_1^\infty f_s(t)\,dt=\sum_{j=1}^\infty \int_j^{j+1}f_(t)\,dt\leq\sum_{j=1}^\infty f_s(j).$$ Hence \begin{align} \bigg|\sum_{j=1}^\infty f_s(j)-\int_1^\infty f_s(t)\,dt\bigg| &=\sum_{j=1}^\infty f_s(j)-\int_1^\infty f_s(t)\,dt\\[0.2cm] &=\sum_{j=1}^\infty \int_j^{j+1} [f_s(j)-f_s(t)]\,dt\\[0.2cm] &\leq\sum_{j=1}^\infty \int_j^{j+1} [f_s(j)-f_s(j+1)]\,dt\\[0.2cm] &=\sum_{j=1}^\infty [f_s(j)-f_s(j+1)]=f_s(1).\\[0.2cm] \end{align} As $$f_s(1)\to0$$ as $$s\to0$$, we have $$\tag3 \lim_{s\to0}\sum_{j=1}^\infty f_s(j)=\lim_{s\to0} \int_1^\infty f_s(t)\,dt.$$ It remains to see that $$\lim_{s\to0} -1+\int_0^1f_s(t)\,dt=1.$$ Here $$f_s(t)=(2t+1)e^{-t(t+1)s}$$. Then, with the substitution $$v=2t+1$$, \begin{align} \int_0^1f_s(t)\,dt &=\int_0^1(2t+1)e^{-(t^2+t)s}\,dt =\int_0^2 e^{-vs}\,dv=\frac{1-e^{-2s}}s\xrightarrow[s\to0]{}2. \end{align}

• "where $f_s(t)$ is a function that decreases on t..." the function of interest is not always decreasing in the region of interest...
– hft
Commented Jul 10 at 22:28
• The derivative is zero at $\bar x = \frac{1}{2}\left(\sqrt{2kT/\epsilon} - 1\right)$, but OP said $kT >> \epsilon$, so $\bar x$ is positive. The function is increasing before $\bar x$ and decreasing after $\bar x$.
– hft
Commented Jul 10 at 22:32
• Good catch. No time now, but later today I'll see what of the argument survives in that case. Commented Jul 11 at 3:00

Really, why $$j$$ , not any other variable like $$\epsilon$$ and even $$T$$ .

See , as we have summation variables in integrals , there is always some variable in pure sum ( $$\Sigma$$ ) also. They are generally told at the time of forming the sum .

Not about the specific partition function you have mentioned, but almost all of them are summed over microstates in the system .And most probably,I could say that the $$j$$ here would be some sort of microstate variable , right ?

If you want to know in detail , how they are summed over microstates, there is a very basic example (somewhat long) here.

Since $$j$$ increases by $$1$$ from term to term in the series, trivially, its increment is also $$\Delta j= \left(j+1\right) - j = 1$$, and it is correct to write

\begin{aligned} Z_\mathrm{tot} & = \sum_{j=0}^\infty(2j+1)e^{-j\left(j+1\right)\epsilon/kT} = \sum_{j=0}^\infty(2j+1)e^{-j\left(j+1\right)\epsilon/kT}\Delta j \text{ .} \end{aligned}

Notice how this sum corresponds to a "left" rectangle integration rule of the function

$$f(j)=(2j + 1)e^{-j\left(j+1\right)\epsilon/kT}\text{ ,}$$ using subinvervals in $$j$$ of width $$\Delta j$$.

(Look at the yellow figure in the appended link, where the function value at the left limit of each subinterval is used as approximation for the function in each whole respective subinterval, as if the function was in fact rectangular.)

In the limit $$\Delta j\to 0$$, the sum would exactly match the respective integral, that is,

$$\lim_{\Delta j\to 0} \sum_{j=0}^\infty(2j+1)e^{-j\left(j+1\right)\epsilon/kT} \Delta j= \int_{j=0}^\infty(2j+1)e^{-j\left(j+1\right)\epsilon/kT}\,dj\text{ .}$$

However, that is not the case here since $$\Delta j=1$$. Still, the sum may be a valid approximation to the integral if function $$f$$ does not vary too much in each interval $$[j,\, j + \Delta j]$$ where the function magnitude is significant (since where the function magnitude is not, that is, where $$f(j)\approx 0$$ regardless of the variation, the contribution of the respective terms in the sum would be close to null just like in the integral). In a circumstance of significant magnitude, one would need to have

$$f(l)\approx f(j),\quad \text{for } l\in[j,\,j+\Delta j]\text{ .}$$

Using a first order Tayler expansion around $$l = j$$ as an approximation to $$f(l)$$, one gets

\begin{aligned} f(l) & \approx f(j) + f'(j)\cdot(l - j) \\ & \approx f(j) + (l - j)\cdot \left(2 - \frac{\epsilon}{kT}\left(2j+1\right)^2\right)e^{-j\left(j+1\right)\epsilon/kT}\text{ .} \end{aligned}

Thus,

\begin{aligned} \frac{\left|f(l)-f(j)\right|}{f(j)} &\le \left|\frac{2}{2j + 1} - \frac{\epsilon}{kT}\left(2j+1\right)\right|\underbrace{\Delta j}_{=1} \\ & \le \left|\frac{2}{2j + 1} - \frac{\epsilon}{kT}\left(2j+1\right)\right| \end{aligned}

From this, one gets $$\frac{\left|f(l)-f(j)\right|}{f(j)} \approx 0$$ if $$j\ll kT/\epsilon$$, but $$\frac{\left|f(l)-f(j)\right|}{f(j)} \gtrsim 1$$ if $$j\gtrsim kT/\epsilon$$, meaning that the varition of function $$f$$ when compared to the function magnitude starts to be significant at $$j\gtrsim kT/\epsilon$$. Nevertheless, if the magnitude is negligible for such region, the approximation sum-to-integral would still be valid.

Well,

$$f(j\sim \frac{kT}{\epsilon})\sim\frac{kT}{\epsilon}e^{-kT/\epsilon}\text{ .}$$ Since $$e^{-kT/\epsilon}$$ grows much faster to $$0$$ than $$\frac{kT}{\epsilon}$$ to $$\infty$$, one has $$f(j\sim \frac{kT}{\epsilon})\approx 0$$. The function magnitude at $$j\gtrsim \frac{kT}{\epsilon}$$ would be much smaller than for previous values. Indeed, the maximum magnitude is mugh grater than 1:

$$f_{\mathrm{max}}=f\left(\frac{1}{2}\sqrt{2\frac{kT}{\epsilon}}-\frac{1}{2}\right)=\underbrace{\sqrt{2 \frac{kT}{\epsilon}}}_{\gg 1}\cdot \underbrace{e^{\frac{1}{4}\frac{\epsilon}{kT} - \frac{1}{2}}}_{\sim 1}\gg 1\text{ .}$$

One then concludes that under the condition $$kT\gg\epsilon$$, the approximation sum-to-integral is valid.