A fast and simple algorithm for the computation of the Lerch transcendent
Eleonora Denich, Paolo Novati

TL;DR
This paper presents a fast, reliable algorithm using Gauss-Laguerre quadrature for computing the Lerch transcendent, including error estimates and a MATLAB implementation, enabling arbitrary precision calculations.
Contribution
It introduces a novel, efficient algorithm for Lerch transcendent computation with error control and practical MATLAB code, improving upon existing methods.
Findings
Error estimates enable precise quadrature node selection
Algorithm achieves high accuracy with fewer nodes
Numerical tests confirm reliability and efficiency
Abstract
This paper deals with the computation of the Lerch transcendent by means of the Gauss-Laguerre formula. An a priori estimate of the quadrature error, that allows to compute the number of quadrature nodes necessary to achieve an arbitrary precision, is derived. Exploiting the properties of the Gauss-Laguerre rule and the error estimate, a truncated approach is also considered. The algorithm used and its Matlab implementation are reported. The numerical examples confirm the reliability of this approach.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsScientific Measurement and Uncertainty Evaluation · Iterative Methods for Nonlinear Equations · Control Systems and Identification
A fast and simple algorithm for the computation of the Lerch transcendent
Eleonora Denich Dipartimento di Matematica e Geoscienze, Università di Trieste, Trieste, Italy, [email protected]
Paolo Novati Dipartimento di Matematica e Geoscienze, Università di Trieste, Trieste, Italy, [email protected]
Abstract
This paper deals with the computation of the Lerch transcendent by means of the Gauss-Laguerre formula. An a priori estimate of the quadrature error, that allows to compute the number of quadrature nodes necessary to achieve an arbitrary precision, is derived. Exploiting the properties of the Gauss-Laguerre rule and the error estimate, a truncated approach is also considered. The algorithm used and its Matlab implementation are reported. The numerical examples confirm the reliability of this approach.
1 Introduction
In this work we consider the Lerch transcendent introduced in [10] and defined as (see [14, p.628 n.25.14.1])
[TABLE]
where , or , . For other values of , is defined by analytic continuation. For a recent investigation on the analytic properties of , we refer to [11].
The Lerch transcendent and its special cases, such as the polylogarithm (corresponding to ), appears for instance in quantum Bose and Fermi statistics. In particular, the particle number density, the pressure, the internal energy and the entropy of the ideal quantum gases of Fermi and Bose can be expressed in terms of the polylogarithm [5]. Another application of the Lerch transcendent is in biophysics. Indeed, some discrete distributions, related to the Lerch transcendent by the normalization constant of the associated probability mass functions, are used to establish the statistical composition of DNA and protein sequences [2].
In order to evaluate the Lerch transcendent, some authors have used series representations and asymptotic expansions. Among the others, we quote [6, 3] for an overview of properties, identities and numerical methods for the computation of the Lerch transcendent. Moreover, in [2], combined non-linear condensation transformation, which is an algorithm that allows to evaluate slowly convergent nonalternating series, is considered. More recently, in [13], starting from the Hermite-type integral representation of the Lerch transcendent, a new uniform asymptotic expansion of , for large order of the parameters and argument , is derived.
In this work, exploiting the integral representation
[TABLE]
where is the Gamma function, we compute by employing the Gauss-Laguerre formula and, starting from the analysis given in [4], we derive an accurate error estimate for the quadrature error. To the best of our knowledge, the Gauss-Laguerre formula has never been used to this purpose, even if the generalized Laguerre weight clearly appears in the integral representation (1). Moreover, after removing the weight, what remains is bounded, and therefore the use of the Gauss-Laguerre method appears a natural choice for this problem. Finally, since the weights of this rule decay exponentially, we present a reliable algorithm which allows to reduce the number of function evaluations, without significant loss of accuracy in the computation of the integral.
Throughout this work we use the symbol to indicate a generic approximation. Whereas, the symbol is used to express the asymptotic equality.
The paper is organized as follows. In Section 2, working with and real, we present the Gauss-Laguerre approach, together with the error analysis and some numerical experiments. In Section 3 we introduce the truncated approach and the algorithm that allows to compute the Lerch transcendent with a prescribed accuracy. Some tables with experiments are given in Section 4. In Section 5 we show how to extend the method for and complex. An appendix contains an auxiliary result and the Matlab code we have used.
2 The Gauss-Laguerre approach
For simplicity we assume . In order to employ the Gauss-Laguerre rule, we consider the change of variable in (1), that leads to
[TABLE]
where
[TABLE]
Denoting by
[TABLE]
the corresponding -point Gauss-Laguerre rule, where and , , are the nodes and the weights respectively, we obtain the approximation
[TABLE]
2.1 Error analysis
In order to derive an estimate for the error
[TABLE]
with
[TABLE]
we first need to locate the poles of the function defined in (2). By solving , we obtain
[TABLE]
It is known that for the error of the Gauss-Laguerre formula it holds
[TABLE]
where is -th degree generalized Laguerre polynomial and is the corresponding associated function (see [7, 15]). is a contour in the complex plane containing the set but no singularity of the function can lie on or within . For a suitable choice of , we consider, for , the parabola of the complex plane defined by the equation
[TABLE]
It is immediate to verify that the parabola, which we denote by , can be rewritten as
[TABLE]
It is symmetric with respect to the real axis, with vertex in and convexity oriented towards the positive real axis. The parabola degenerates to as .
Let be an arbitrary small circle surrounding the pole . Assuming , the pole closest to the real axis is (see (5)), and therefore for any non negative integer we can define
[TABLE]
with such that the parabola contains in its interior the poles but none of the others.
In order to evaluate (6), with as in (9), we first observe that, for n , [7, p.33]
[TABLE]
where and , are the modified Bessel functions of the first and second kind, respectively. Since , we can use for the asymptotic expansions (see [1, p.377 n.9.7.1-2])
[TABLE]
valid for large , , and therefore,
[TABLE]
By using (11) in (10), we find
[TABLE]
and therefore
[TABLE]
By defining for simplicity
[TABLE]
and with as in (9), we obtain
[TABLE]
where denotes the residue. At this point, by (12) and (7)
[TABLE]
where
[TABLE]
We remark that, since is bounded, the above integral is also bounded. Moreover, since , , by (5) we have
[TABLE]
where we use the notation
[TABLE]
and (for ) represents the parabola passing through , that is, solves . Joining the above results we finally obtain
[TABLE]
Under the assumption , we have , for , and therefore, by collecting the term involving ,
[TABLE]
This situation in shown in Figure 1a, where .
In the case of we have that the poles are symmetric with respect to the real axes and it holds if , whereas if , (see Figure 1b, in which ). In both situations, formula (15) needs to be replaced by the sum of the terms corresponding to the poles and , for , and and for . In both cases, we obtain the same result. Assuming for instance , we have that , and therefore
[TABLE]
Working with the modulus, the only essential difference between the above formula and (15) is a factor 2. Moreover, since the latter should also be used for close to , independently of we finally consider the error estimate
[TABLE]
for the integral, and therefore (see (3))
[TABLE]
2.2 Some numerical experiments
In Figure 2 we show the quality of estimate (17) on some examples. Specifically, we consider the polylogarithm [14, n.25.12] (Figure 2a)
[TABLE]
the Dirichlet beta function [1, p.807, n.23.2.21] (Figure 2b)
[TABLE]
and the Dirichlet eta function [1, p.807, n.23.2.19] (Figure 2c)
[TABLE]
These functions can be written in terms of for particular values of the parameters, that is,
[TABLE]
We remark that the value chosen for the polylogarithm represents the case of the three-dimensional Bose gas in a box. Finally, in Figure 2d we consider a general situation. As for the computation of the nodes and weights of the generalized Gauss-Laguerre rule (c.f. (2)), we employ the Matlab routine [16], based on the traditional Golub-Welsch algorithm (see [8, 7]). We point out that the oscillations of the error in Figure 2a-b-c are due to the term (cf. (14)- (15)).
3 A truncated approach
Having at disposal an accurate error estimate, in this section we derive a reliable algorithm that allows to reduce the number of evaluations of the function (see (2)), required by the quadrature rule. This is possible because the weights of the Gauss-Laguerre rule decay exponentially and, moreover, because the function is bounded. Indeed, a simple analysis, reported in Appendix, shows that
[TABLE]
Now, let be the solution of
[TABLE]
where is defined in (2.1). By using the relation [9, p.942 n.8.357]
[TABLE]
we approximate by solving with respect to the equation
[TABLE]
The solution is given by
[TABLE]
where denotes the Lambert W function. In particular, we obtain
[TABLE]
for , and
[TABLE]
for . It is known that ([14, n. 4.13.10-11])
[TABLE]
and therefore , where
[TABLE]
Note that has a removable singularity in , so that we can define
[TABLE]
that is also the exact solution of (19), with respect to , for . In conclusion, we have that , for .
We are now on the point to introduce the truncated rule
[TABLE]
where is the smallest integer such that , for each . As for the error, we have
[TABLE]
Now, using the bound [12, eqs. 2.4-2.7]
[TABLE]
where is a constant independent of and close to for large , we have
[TABLE]
Finally, for the truncated rule we obtain the estimate
[TABLE]
In order to understand the decay rate with respect to we use the relations [1, n. 22.16.8]
[TABLE]
and [1, n. 9.5.12]
[TABLE]
to finally obtain
[TABLE]
At this point, it is possible to derive an analytical approximation of by imposing with the help of (25). In order to detect the new asymptotic behavior, we further simplify the computation by neglecting the term involving in (22), that is, we solve with respect to
[TABLE]
We remark, however, that this simplification is not used in the algorithm presented below. By (2.1) and defining
[TABLE]
we find
[TABLE]
so that, for large enough,
[TABLE]
By using this relation in (2.1) we finally obtain
[TABLE]
which expresses the speed up attainable with the truncation. Indeed, the number of function evaluations is now raised to the power of , whereas in (2.1) the power is . This decay rate is well visible in Figure 3, where we show the benefits of the truncated rule on some examples. In particular, as in Section 2.2, we consider the polylogarithm (Figure 3a), the Dirichlet beta function (Figure 3b), the Dirichlet eta function (Figure 3c) and a general situation (Figure 3d).
We summarize the basic steps for the computation of the Lerch transcendent by using the truncated Laguerre rule and with a prescribed error tolerance in the following algorithm.
Algorithm 1** (Truncated Laguerre rule)**
Given
compute the corresponding tolerance for the integral (see (3) and (24)) 2. 2.
compute as in (18) 3. 3.
compute such that by using (8) 4. 4.
solve with respect to (see (2.1)) and then set 5. 5.
estimate by solving, with respect to , , by using (25) and (22) (in the implementation it is convenient to add one or two more points in order to prevent the under estimation of the error, because of the large number of approximations used) 6. 6.
compute the first nodes and weights , , of the -point Laguerre rule 7. 7.
approximate with (see (23))
4 Numerical experiments
In this section, working with prescribed error tolerances and , we test Algorithm 1 on several examples. In particular, we present some tables in which, for each set of parameters, we report the corresponding values of and , given by steps -, together with the final error obtained by using a reference solution. Specifically, we consider the polylogarithm in Table 1, the Dirichlet beta function in Table 2, the Dirichlet eta function in Table 3 and general cases of the Lerch transcendent in Table 4, for different values of the parameters . In Tables 1 and 4, is set in order to consider the arguments . We can see that, except in few rare cases, the prescribed tolerance is achieved.
5 Complex case
Starting from the integral representation (1)
[TABLE]
by using the change of variable , we obtain
[TABLE]
The function
[TABLE]
inside the integral is the main difference with respect to the case of . Some experiments have revealed that the case of does not constitute a problem for the Laguerre rule, unless . On the other side, the case of may be difficult to handle. Indeed, as , the real and the imaginary part of the function oscillate with increasing frequency and the Laguerre rule appears to be inadequate (Figure 4a). The situation is overtaken whenever and , since the term makes the oscillations negligible near zero (see Figure 4b).
6 Conclusion
In this work we have employed the generalized Gauss-Laguerre formula to compute the Lerch transcendent for and . We have derived sharp error estimates that enable to know a priori the number of quadrature points necessary to achieve a prescribed accuracy and to truncate the rule. We have tested the arising algorithm on several examples and the results confirm the reliability of this approach. The extension to and complex is not theoretically analyzed. Anyway, at a first glance the Laguerre rule appears robust if the imaginary parts are relatively small with respect to the moduli. On the contrary, the high frequency of the oscillations makes the method unsuited.
Appendix A Bounds for the integrand function
In order to derive the bound (18), we define , , so that
[TABLE]
The function is a parabola and its minimum in defines . The vertex is at and we have three cases. Let be the domain of definition of integral (1) with respect to . Let , and . Note that are mutually disjoint and . Moreover, the set is the solution of the inequality . At this point, if , then and , and therefore
[TABLE]
If , then , and we find
[TABLE]
Finally, if , then , and we obtain
[TABLE]
Appendix B Matlab code
Acknowledgements
This work was partially supported by GNCS-INdAM, FRA-University of Trieste and CINECA under HPC-TRES program award number 2019-04. The authors are member of the INdAM research group GNCS.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] M. Abramowitz and I. A. Stegun (1970), Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables , 7th Edition, Dover Publications, Inc., New York.
- 2[2] S. V. Aksenov, A. S. Michael, D. J. Ulrich, and J. Becher, G. Soff and P. J. Mohr, Application of the combined nonlinear-condensation transformation to problems in statistical analysis and theoretical physics, Computer Physics Communications 150(1) (2003), 1-20.
- 3[3] D. H. Bailey and J. M.Borwein, Crandall’s computation of the incomplete Gamma function and the Hurwitz zeta function, with applications to Dirichlet L-series, Applied Mathematics and Computation 268 (2015), 462-477.
- 4[4] W. Barrett, Convergence properties of Gaussian quadrature formulae, Comput. J. 3 (1960/1961), 272–277.
- 5[5] S. Ciccariello, The Lerch function and the thermodynamical functions of the ideal quantum gases, J. Math. Phys. 45 (2004), 3353.
- 6[6] R. E. Crandall (2012), Unified algorithms for polylogarithms, L-series, and zeta variants .
- 7[7] P. J. Davis and P. Rabinowitz (1975), Methods of numerical integration , Academic Press, Inc., New York.
- 8[8] G.H. Golub and J.H. Welsch, Calculation of Gauss Quadrature Rules, Mathematics of Computation , 23(106) (1969), 221-230.
