1 Introduction
The partition function is a cornerstone of statistical mechanics [1, 2], in particular since thermodynamics quantities can be obtained as derivatives of . Nevertheless, computing for larger systems is a challenging task if a closedform solution cannot be found. In this work we are concerned with an efficient numerical method for evaluating and the associated free energy density for (semi)classical chains, in the thermodynamic limit of infinite system size. In more detail, we consider a Hamiltonian on a (quasi) onedimensional lattice of size , containing solely nearest neighbor terms:
(1) 
with for all and some fixed . We assume periodic boundary conditions and thus set . A canonical example is a classical particle chain, with the momentum and position of the th particle (), and
(2) 
consisting of kinetic energy terms and the potential energy described by .
The partition function of the physical system is defined as
(3) 
with the “inverse temperature”. Our goal is to take the thermodynamic limit and compute the canonical free energy density
(4) 
2 Method
To evaluate the partition function numerically, we combine the wellknown transfermatrix method [3, 4] with a numerical discretization of integral kernels based on numerical quadrature methods. The latter idea traces back to Nyström [5] and was recently applied by the second author to the computation of Fredholm determinants [6].
2.1 Assumptions
To keep technical preliminaries as simple as possible, we make the following assumptions, which cover the applications in the next section: Let be a (not necessarily finite) interval of and be a finite positive measure on with a strictly positive, continuous density (weight function). Now we rewrite the partition function in the form
(5) 
with as before. Here the integral kernel
(6) 
is assumed to be continuous and bounded; it is strictly positive by construction. We further assume that , i.e., is a symmetric kernel. These assumptions imply, in particular,
(7) 
so that the symmetric kernel induces an integral operator [7, §16.1]
(8) 
on the Hilbert space that is selfadjoint and Hilbert–Schmidt (and hence, compact). Since the product of two HilbertSchmidt operators is of trace class and the trace class operators form an ideal within the bounded ones, Eq. (5) for may be represented as^{3}^{3}3This holds for only if would be trace class itself, cf. the discussion in [6, pp. 878–879].
(9) 
2.2 Dominant eigenvalue and free energy
Following the mathematical theory of compact operators on Hilbert spaces [7, §21.2], the nonzero elements of the spectrum of
(which is real since the operator is selfadjoint) are at most countably many eigenvalues of finite multiplicity that accumulate only at
(which belongs to the spectrum).Generalizing the Perron–Frobenius theory in matrix analysis [8, §8.2], Jentzsch’s Theorem [9, §8.7, Satz 3] states that the HilbertSchmidt operator with strictly positive kernel has a simple, dominant, strictly positive eigenvalue. That is, all the nonzero eigenvalues can be ordered as (with each eigenvalue listed as often as given by its multiplicity)
Hence, evaluating Eq. (9) together with Lidskii’s theorem [7, §30.3], that is,
leads to
(10) 
Thus the calculation of the free energy amounts to computing the dominant eigenvalue of .
2.3 Nyström method for computing the dominant eigenvalue
For simplicity, we restrict the discussion of the numerical method to , that is, . For the multidimensional case , see the discussion of the example in Sect. 3.3.
We make use of a numerical quadrature rule of the form
(11) 
with positive weights and nodes . The approximation is of order if the quadrature rule is exact for polynomials of degree at most . It is possible to construct such a unique quadrature rule of maximum order , called Gauss quadrature rule; see [10] for the classical construction of Gaussian weights and nodes from the tridiagonal Jacobi matrix of the orthogonal polynomials associated with the measure
. Error estimates depend on the regularity of the integrand
, e.g., [11, §4.8]: the error for is of the form if and of the form with some if extends analytically to an ellipse or (semi)strip in the complex plane containing . The former estimate is called algebraic convergence, the latter exponential convergence.Inserting the quadrature rule into Eq. (8) results in
(12) 
for all . Setting , we have thus discretized the integral operator by the symmetric matrix (Nyström method)
(13) 
By the Perron–Frobenius theory [8, Cor. 8.2.6], this (elementwise) strictly positive matrix has a simple, dominant, strictly positive eigenvalue . The following theorem shows that , and thus for the free energy density in Eq. (4)
(14) 
with a speed of convergence, algebraic or exponential, depending on the smoothness of .
Theorem 1.
Under the assumptions in Sect. 2.1 the error of the Nyström method for computing the dominant eigenvalue behaves as follows as :

if then there is algebraic convergence ;

if extends analytically to , where is an ellipse or (semi)strip, there is exponential convergence with some constant .
The classical, though long and quite involved proof goes by the theory of collectively compact operators and can be found in many books on the numerical treatment of integral equations, e.g., [12, Thm. 4.8.20]. Note, that though only the case of algebraic convergence is covered in this reference, the proof extends literally to the case of exponential convergence by adjusting the consistence assumptions accordingly.
An alternative, conceptually much simpler novel proof based on the theory of the Fredholm determinant can be found in the Appendix of this paper.
Remark.
While the Nyström method for the dominant eigenvalue essentially inherits the convergence properties of an underlying cubature formula also in the multidimensional case (see the proof in the Appendix for guidance), we refrained from formulating a general theorem since the characterization of convergence properties of general cubature formulae is much more involved in the first place. If, however, a Gaussian quadrature is applied coordinatewise, Theorem 1 extends in a straightforward fashion (in the case of exponential convergence has then to be chosen as an polyellipse or poly(semi)strip), cf. the example in Sect. 3.3.
3 Applications
We demonstrate the range of applicability of the method via a diverse selection of model systems.
3.1 Classical particle chain
Consider a classical particle chain governed by a Hamiltonian of the form (2) above. For evaluating the partition function, the integration over the momentum variables can be performed in closed form, such that
(15) 
with
(16) 
As specific example for the following, we choose
(17) 
with anharmonic onsite potential
(18) 
and coefficients , , . The term ensures that grows asymptotically to infinity as , and the above is equivalent to its symmetrized version .
We now assign the term from the onsite potential to the weight function:
(19) 
This leads to a (rescaled) GaussHermite quadrature rule [13, §3.5(v)], and we denote the weights by and nodes by , , as above.^{4}^{4}4A modern, fast numerical method of optimal complexity for calculating these weights and nodes can be found in [14]. The particular choice of the weight function is somewhat arbitrary — we could have also included the cubic and quartic terms from the onsite potential into the weight function; at the expense, though, of a less straightforward computation of the weights and nodes of the quadrature rule. The general reasoning is to capture most of the local weight while retaining a wellbehaved kernel for the genuine interparticle potential (see Eq. (21) below).
Combining the weight function (19) with Eq. (16) leads to
(20) 
with the symmetrized kernel
(21) 
We then assemble the symmetric matrix in Eq. (13). Finally, after taking all prefactors in to account, the numerical approximation of the free energy density reads
(22) 
The special case serves as reference, since the partition function factorizes in this case, i.e., with
(23) 
For the following numerical examples, we set and . Fig. 1 visualizes the kernel in Eq. (21). The factor localizes the kernel around the line , which poses a challenge for accurately “sampling” it using a limited number of points in Eq. (13).
Fig. (a)a shows the free energy as function of , for several values of , and Fig. (b)b the relative error depending on the number of quadrature points . One observes exponential convergence. The less favorable shape of the kernel with increasing , as mentioned above (see also Fig. 1), translates to a slower convergence rate.
Based on the free energy one can obtain averages and higherorder cumulants following the wellknown procedure based on derivatives of . For example, the average squared particle distance and energy per site are
(24) 
independent of by translation invariance. In practice, a higherorder finite difference scheme on a fine grid is well suited to calculate the derivatives. Fig. 3 shows these averages, for the same parameters as before. One notices that the average energy hardly depends on .
As a remark, for the case of vanishing onsite potential, , the model conserves momentum, and the statistical mechanics description changes accordingly [15]. Numerically computing the free energy is less challenging in this case since the partition function factorizes after introducing the “stretch” .
3.2 Discrete nonlinear Schrödinger equation
The method described in Sect. 2 has been employed in the work [16] on the discrete nonlinear Schrödinger equation. Here we present and elaborate on the numerical aspects in more detail.
To be selfcontained, we first restate the physical setup: the central object is a complexvalued wave field () governed by the semiclassical Hamiltonian
(25) 
with parameter (socalled defocusing case). The corresponding partition function reads
(26) 
where we have introduced the chemical potential as additional parameter, which is dual to the total particle number .
A symplectic change of variables to polar coordinates leads to the representation
(27) 
with , and (unit circle). The Hamiltonian in these variables reads
(28) 
It depends only on phase differences, which implies the invariance under the global shift . For evaluating the partition function, the integrals can be calculated in closed form [17]. This leads to
(29) 
with the kernel
(30) 
is the modified Bessel function of the first kind. For this example, we use the second factor of the integrand in Eq. (29) as weight function:
(31) 
with , and the normalization constant
(32) 
After constructing a Gauss quadrature rule on as described in Sect. 2.3, we form the symmetric matrix in Eq. (13), here denoted since it implicitly also depends on via the quadrature points and weights. Then, taking the prefactor in Eq. (29) and the normalization constant (32) into account, one arrives at
(33) 
Fig. 4 shows the free energy as function of , for various values of .
Numerically, we again observe exponential convergence with respect to the number of quadrature points, see Fig. 5. At and for example, points suffice for double precision accuracy. The reference data stems from a calculation with .
As mentioned before, one can obtain thermodynamic averages based on derivatives of . For example, the average density and energy per lattice site are
(34) 
See [16] for a detailed study of the model.
3.3 Classical oscillators on a cylindrical lattice
The numerical method is in principle also applicable to twodimensional lattices, by using periodic boundary conditions in one direction and reducing the setting to a quasione dimensional problem. Specifically, we consider the lattice for , i.e., starting with periodic boundary conditions both in  and direction, but eventually sending while keeping finite. Thus we arrive at a cylindrical lattice, as visualized in Fig. 6.
We identify a lattice site by the index , and consider for simplicity scalar spatial variables ; these could be displacements from the reference positions in one fixed direction, for example. denotes the momentum of the th particle.
As demonstration, let the system be governed by the Hamiltonian
(35) 
consisting of sitelocal kinetic and potential energy terms (first sum) as well as nearest neighbor interactions (second sum). Specifically, we consider a local quadratic potential , , and an interaction potential with two coefficients and .
To cast the Hamiltonian (35) into the form of Eq. (1
), we subsume the particles contained in one lattice “ring” into the vectors
(36)  
(37) 
for .
Similar to the particle chain in subsection 3.1, the momentum integration for evaluating the partition function can be performed explicitly. This results in
(38) 
with
(39) 
where
(40) 
and
(41) 
Note that is symmetric in its arguments, i.e., for any .
It suggests itself to use the factor in Eq. (39
) as integration measure, resulting in a tensor product of normal distributions:
(42) 
We use a rescaled GaussHermite quadrature rule along each coordinate direction, as in Sect. 3.1. Theorem 1
extends straightforwardly to this choice. An alternative, which is less affected by the inherent curse of dimensionality, is a cubature rule dedicated to multidimensional integration
[18, 19, 20, 21], or sparse grid methods. The convergence properties of such cubature rules are more involved, but they would essentially be inherited by the Nyström method for the dominated eigenvalue. We leave an exploration of these ideas for future work.Following the factorized quadrature rule, the symmetric matrix in Eq. (13) takes the form
(45) 
with multiindices and the definitions , and , , the weights and points of the onedimensional rescaled GaussHermite quadrature rule. Thus the overall number of weights and points is .
The numerical approximation of the free energy per lattice site is then
(46) 
with kept fixed. For the following examples, we set , such that the overall number of quadrature points remains manageable up to . Fig. (a)a visualizes the free energy as function of , for several combinations of . One notices that the curve for is visually indistinguishable from the case with interchanged parameters , pointing to the conclusion that the influence of a finite compared to the “infinite” on the free energy is quite small.
Fig. (b)b shows the corresponding relative error depending on the number of quadrature points along one dimension. In the special case (without coupling in direction), the partition function factorizes, such that, analogous to Sect. 3.1, with
(47) 
We evaluate this integral numerically and use it as reference for computing the relative error in Fig. (b)b for . The relative error is still rather large for and ; as before, this observation can be explained by the difficulty of accurately sampling the kernel (44) via (45) using a small number of quadrature points along each coordinate. To mitigate this issue for the present example, one could associate the terms in the Hamiltonian to the integration measure instead of the kernel, at the expense of a more complicated quadrature rule.
In summary, this application example demonstrates that our method can in principle handle twodimensional lattice topologies as well, although the large number of required quadrature points (when interpreting the problem as quasi onedimensional) limits the size of the periodic dimension in practice.
4 Conclusion and outlook
The convergence plots of the example applications illustrate the validity of Theorem 1, which states that approximating the dominant eigenvalue of the discretized kernel inherits the favorable exponential convergence properties of the underlying quadrature rule in the case of kernels extending analytically into the complex domain.
To optimize the numerical performance of the method for the cylindrical topologies, one could further exploit the factorized structure of in (44) along coordinate directions, or use sparse grid methods for the quadrature as mentioned above.
Concerning transfer operator techniques in general, it could be fruitful to adopt ideas from quantum mechanics (see e.g. [22]), or set oriented numerical methods [23].
Acknowledgments
C.M. likes to thank Herbert Spohn and Abhishek Dhar for helpful discussions, and the Munich Center for Quantum Science and Technology for support.
Appendix
We give here an alternative, conceptually much simpler proof^{5}^{5}5To the best of our knowledge, this proof has not yet been given in the literature. of Theorem 1 based on the theory of the Fredholm determinant of the kernel , namely
Given the assumptions in Sect. 2.1, is an entire function whose roots are exactly the reciprocal nonzero eigenvalues of , see [9, §6.2, Satz 3]. The Weierstrass product [9, §6.4, Satz 1]
shows that the multiplicities of the roots of and the multiplicities of the nonzero eigenvalues of agree. In particular, is a simple root and therefore . Also, [6, Thm. 6.2] (whose proof can literally be extended to the current assumptions) gives
(#) 
where, uniformly for bounded , the error is given by or according to whether or extends analytically into the complex plane. By Perron–Frobenius is the simple, dominant, strictly positive eigenvalue of the entrywise positive matrix , which by the argument principle of complex analysis must satisfy
Hence, by inserting into (# ‣ Appendix), followed by a Taylor expansion, we get
which completes the proof.
References
 [1] L. D. Landau and E. M. Lifshitz. Statistical Physics: Part 1. Pergamon, 1980.
 [2] K. Huang. Introduction to Statistical Physics. Taylor and Francis, 2010.
 [3] H. A. Kramers and G. H. Wannier. Statistics of the twodimensional ferromagnet. Part I. Phys. Rev., 60:252–262, 1941.
 [4] G. Mussardo. Statistical Field Theory: An Introduction to Exactly Solved Models in Statistical Physics. Oxford University Press, 2009.
 [5] E. J. Nyström. Über die praktische Auflösung von Integralgleichungen mit Anwendungen auf Randwertaufgaben. Acta Math., 54:185–204, 1930.
 [6] F. Bornemann. On the numerical evaluation of Fredholm determinants. Math. Comp., 79:871–915, 2010.
 [7] P. D. Lax. Functional Analysis. WileyInterscience, 2002.
 [8] R. A. Horn and C. R. Johnson. Matrix analysis. Cambridge University Press, Cambridge, 1985.
 [9] S. Fenyö and H.W. Stolle. Theorie und Praxis der linearen Integralgleichungen 2. VEB Deutscher Verlag der Wissenschaften, Berlin, 1983.
 [10] G. H. Golub and J. H. Welsch. Calculation of Gauss quadrature rules. Math. Comp., 23:221–230, 1969.
 [11] P. J. Davis and P. Rabinowitz. Methods of numerical integration. Dover Publications, Inc., Mineola, NY, 2007. Corrected reprint of the second (1984) edition.
 [12] W. Hackbusch. Integral Equations, Theory and Numerical Treatment. Birkhäuser Verlag, Basel, 1995.
 [13] F. W. J. Olver, D. W. Lozier, R. F. Boisvert, and C. W. Clark, editors. NIST Handbook of Mathematical Functions. Cambridge University Press, 2010.
 [14] A. Townsend, T. Trogdon, and S. Olver. Fast computation of Gauss quadrature nodes and weights on the whole real line. IMA J. Numer. Anal., 36:337–358, 2016.
 [15] H. Spohn. Nonlinear fluctuating hydrodynamics for anharmonic chains. J. Stat. Phys., 154:1191–1227, 2014.
 [16] C. B. Mendl and H. Spohn. Low temperature dynamics of the onedimensional discrete nonlinear Schrödinger equation. J. Stat. Mech., 2015:P08028, 2015.
 [17] K. O. Rasmussen, T. Cretegny, P. G. Kevrekidis, and N. GrønbechJensen. Statistical mechanics of a discrete nonlinear system. Phys. Rev. Lett., 84:3740–3743, 2000.
 [18] A. H. Stroud. Approximate Calculation of Multiple Integrals. PrenticeHall, 1971.
 [19] R. Cools and P. Rabinowitz. Monomial cubature rules since “Stroud”: a compilation. J. Comput. Appl. Math., 48:309–326, 1993.
 [20] R. Cools. Constructing cubature formulae: the science behind the art. Acta Numerica, 6:1–54, 1997.
 [21] V. Keshavarzzadeh, R. M. Kirby, and A. Narayan. Numerical integration in multiple dimensions with designed quadrature. SIAM J. Sci. Comput., 40:A2033–A2061, 2018.
 [22] J. Haegeman and F. Verstraete. Diagonalizing transfer matrices and matrix product operators: A medley of exact and computational methods. Annu. Rev. Condens. Matter Phys., 8:355–406, 2017.
 [23] M. Dellnitz and O. Junge. On the approximation of complicated dynamical behavior. SIAM J. Numer. Anal., 36:491–515, 1999.