arXiv:math/0511074v1 [math.CA] 3 Nov 2005 ua ntecs fteohrsre osdrd–teGaussia the – considered corresponding the other the 2 reproducing of form, case the closed In funct in mula. zeta solved Riemann the be for can series Dirichlet the of remainder ytmo iereutos h iereutosflo fr follow equations equation difference linear inhomogeneous The the equations. of linear solution of system a eibecmuainlshms(e o xml 7 1 1 r[9 S [19, efficien or for 21] demand 11, therein). [7, great references example a open for and created (see Mathematica also schemes or computational it reliable and Maple applications, like developmen new the systems many with algebra combination computer in powerful computers functions. special electronic in of interest availability of revival e a some witness problem. We to substantially. unsolved and less – or been more a had re century, – functions is 20th special still the the most whereas of of results, evaluation middle analytical reliable the emphasized to had up functions developm However, special already new expected. significant developed abo no be knowledge that been to our and that complete had believe essentially theory to is tempting functions function is it special Thus, century. of 19th part large A Introduction 1 formalism new the of usefulness examples. practical numerical The some Maple. of help integral − Summary. [email protected] Germany Regensburg, D-93040 Universit¨at Chemie Regensburg, Theoretische und f¨ur Physikalische Institut Weniger Joachim Ernst Special for Functions Representations Series of Errors Truncation to Approximations Asymptotic F P 1 ( u oteipc fcmueso ahmtc,testainhsc has situation the , on computers of impact the to Due ,b a, ν ∞ =0 ; E a c ν ; 1 z ( fifiieseries infinite of n h iegn smttcivrepwrsre o h e the for series power inverse asymptotic divergent the and ) z smttcapoiain ( approximations Asymptotic h orsodn iereutosaesle symbolica solved are equations linear corresponding the – ) P ν ∞ =0 a ν o pca ucin r osrce ysolving by constructed are functions special for n ∞ → otetucto errors truncation the to ) ∆r n = a o,telna equations linear the ion, yegoercseries hypergeometric n n ma approximative an om +1 ue-alui for- Euler-Maclaurin sdmntae by demonstrated is ntecs fthe of case the In . ffiin and efficient h general The l ihthe with lly xponential cin13] ection tspecial ut erhon search nsare ents hanged nthe in dup ed xtend and t r n of t = 2 Ernst Joachim Weniger

Most are defined via infinite series. Examples are the Dirichlet series for the , ∞ − ζ(s) = (ν + 1) s . (1) ν=0 X which converges for Re(s) > 1, or the Gaussian hypergeometric series

∞ (a)ν (b)ν ν 2F1(a,b; c; z) = z , (2) (c)ν ν! ν=0 X which converges for |z| < 1. The definition of special functions via infinite series is to some extent highly advantageous since it greatly facilitates analytical manipulations. However, from a purely numerical point of view, infinite series representations are at best a mixed blessing. For example, the Dirichlet series (1) converges for Re(s) > 1, but is notorious for extremely slow convergence if Re(s) is only slightly larger than one. Similarly, the Gaussian hypergeometric series (2) converges only for |z| < 1, but the corresponding Gaussian hypergeometric function is a multivalued function defined in the whole complex plane with branch points at z = 1 and ∞. A different computational problem occurs in the case of the asymptotic series for the exponential integral: ∞ z m z e E1(z) ∼ (−1/z) m! = 2F0(1, 1; −1/z) , z → ∞ . (3) m=0 X This series is probably the most simple example of a large class of series that diverge for every finite argument z and that are only asymptotic in the sense of Poincar´eas z → ∞. In contrast, the exponential integral E1(z), which has a cut along the negative real axis, is defined in the whole complex plane. Problems with slow convergence or divergence were encountered already in the early days of calculus. Thus, numerical techniques for the acceleration of convergence or the summation of are almost as old as calculus. According to Knopp [9, p. 249], the first systematic work in this direction can be found in Stirling’s book [17], which was published already in 1730 (recently, Tweddle [20] published a new annotated translation), and in 1755 Euler [6] published the series transformation which now bears his name. The convergence and divergence problems mentioned above can be for- n malized as follows: Let us assume that the partial sums sn = ν=0 aν of a ∞ convergent or divergent but summable series form a {sn}n=0 whose elements can be partitioned into a (generalized) limit s and aP remainder or truncation error rn according to

sn = s + rn , n ∈ N0 . (4)

This implies Asymptotic Approximations to Truncation Errors 3 ∞

rn = − aν , n ∈ N0 . (5) ν=n+1 X At least in principle, a convergent infinite series can be evaluated by adding up the terms successively until the remainders become negligible. This ap- proach has two obvious shortcomings. Firstly, convergence can be so slow that it is uneconomical or practically impossible to achieve sufficient accuracy. Sec- ondly, this approach does not work in the case of a divergent but summable series because increasing the index n normally only aggravates divergence. As a principal alternative, we can try to compute a sufficiently accurate approximationr ¯n to the truncation error rn. If this is possible,r ¯n can be eliminated from sn, yielding a (much) better approximation sn − r¯n to the (generalized) limit s than sn itself. This approach looks very appealing since it is in principle remarkably powerful. In addition, it can avoid the troublesome asymptotic regime of large indices n, and it also works in the case of divergent but summable and series. Unfortunately, it is by no means easy to obtain sufficiently accurate approximationsr ¯n to truncation errors rn. The straightforward computation of rn by adding up the terms does not gain anything. The Euler-Maclaurin formula, which is discussed in Section 2, is a prin- cipal analytical tool that produces asymptotic approximations to truncation errors of monotone series in terms of integrals plus correction terms. Unfortu- nately, it is not always possible to apply the Euler-Maclaurin formula. Given a reasonably well behaved integrand, it is straightforward to compute a sum of integrand values plus derivatives of the integrand. But for a given series term an, it may be prohibitively difficult to differentiate and integrate it with respect to the index n. In Section 3, an alternative approach for the construction of asymptotic approximations (n → ∞) to the truncation errors rn of infinite series is pro- posed that is based on the solution of a system of linear equations. The linear equations exist under very mild conditions: It is only necessary that the ratio an+2/an+1 or similar ratios of series terms possesses an asymptotic expansion in terms of inverse powers 1/(n + α) with α> 0. Moreover, it is also fairly to solve these linear equations since they have a triangular structure. The asymptotic nature of the approximants makes it difficult to use them also for small indices n, although this would be highly desirable. In Section 4, it is mentioned briefly that series and Pad´eapproximants can be helpful in this respect since they can accomplish a numerical . In Section 5, the formalism proposed in this article is applied to the trun- cation error of the Dirichlet series for the Riemann zeta function. It is shown that the linear equations can in this case be reduced to a well known recurrence formula of the Bernoulli numbers. Accordingly, the terms of the corresponding Euler-Maclaurin formula are exactly reproduced. In Section 6, the Gaussian hypergeometric series 2F1(a,b; c; z) is treated. Since the terms of this series depend on three parameters and one argument, a 4 Ernst Joachim Weniger closed form solution of the linear equations seems to be out of reach. Instead, approximations are computed symbolically with the help of the computer algebra system Maple. The practical usefulness of these approximations is demonstrated by some numerical examples. In Section 7, the divergent asymptotic inverse for the expo- nential integral E1(z) is treated. Again, the linear equations are solved sym- bolically with the help of Maple, and the practical usefulness of these solutions is demonstrated by some numerical examples.

2 The Euler-Maclaurin Formula

The derivation of the Euler-Maclaurin formula is based on the assumption N that g(x) is a smooth and slowly varying function. Then, M g(x)dx with Z 1 M,N ∈ can be approximated by the finite sum 2 g(M)+ g(M +1)+ ··· + 1 R g(N − 1) + 2 g(N). This finite sum can also be interpreted as a trapezoidal quadrature rule. In the years between 1730 and 1740, Euler and Maclaurin de- rived independently correction terms to this quadrature rule, which ultimately yielded what we now call the Euler-Maclaurin formula (see for example [19, Eq. (1.20)]):

N N 1 g(ν) = g(x) dx + g(M)+ g(N) 2 ν M M X= Z k   B − − + 2j g(2j 1)(N) − g(2j 1)(M) + R (g) , (6a) (2j)! k j=1 X h i 1 N R (g) = − B x −⌊x⌋ g(2k)(x) dx . (6b) k (2k)! 2k ZM  (m) Here, g (x) is the m-th derivative, ⌊x⌋ is the integral part of x, Bm(x) is a Bernoulli polynomial defined by the text/(et − 1) = ∞ n n=0 Bn(x)t /n!, and Bm = Bm(0) is a Bernoulli number. It is not a priori clear whether the integral Rk(g) in (6) vanishes as k → ∞ forP a given function g(x). Thus, the Euler-Maclaurin formula may lead to an asymptotic expansion that ultimately diverges. In this article, it is always assumed that the Euler-Maclaurin formula and related expansions are only asymptotic in the sense of Poincar´e. Although originally used to express the in the early 18th century still unfa- miliar integral in terms more elementary quantities, the Euler-Maclaurin for- ∞ mula is now often used to approximate the truncation error rn = − ν=n+1 aν of a slowly convergent monotone series by an integral plus correction terms. The power and the usefulness of this approach can be demonstratedP convinc- ingly via the Dirichlet series (1) for the Riemann zeta function. Asymptotic Approximations to Truncation Errors 5

The terms (ν + 1)−s of the Dirichlet series (1) are obviously smooth and slowly varying functions of the index ν, and they can be differentiated and integrated easily. Thus, the application of the Euler-Maclaurin formula (6) with M = n + 1 and N = ∞ to the truncation error of the Dirichlet series yields: ∞ 1−s − (n + 2) 1 − − (ν + 1) s = − − (n + 2) s s − 1 2 ν=n+1 X k (s) − B − − − 2j 1 2j (n + 2) s 2j+1 + R (n,s) , (7a) (2j)! k j=1 X ∞ (s) B2k x −⌊x⌋ R (n,s) = 2k dx . (7b) k (2k)! (x + 1)s+2k Zn+1 

Here, (s)m = s(s + 1) ··· (s + m − 1) = Γ (s + m)/Γ (s) with s ∈ C and m ∈ N0 is a Pochhammer symbol. In [3, Tables 8.7 and 8.8, p. 380] and in [25, Section 2] it was shown thata few terms of the sum in (7a) suffice for a convenient and reliable computation of ζ(s) with s = 1.1 and s = 1.01, respectively. For these arguments, the Dirichlet series for ζ(s) converges so slowly that it is practically impossible to evaluate it by adding up its terms. In order to understand better its nature, the Euler-Maclaurin formula (6) is rewritten in a more suggestive form. Let us set M = n+1 and N = ∞, and let ′ ′′ us also assume limN→∞ g(N) = limN→∞ g (N) = limN→∞ g (N) = ··· = 0. With the help of B0 = 1. B1 = −1/2, and B2n+1 = 0 with n ∈ N (see for example [19, p. 3]), we obtain: ∞ ∞ m µ−1 (−1) B − − g(ν) = −B g(x) dx + µ g(µ 1)(ν) + R (g) , 0 µ! m ν=n+1 n+1 µ=1 X Z X (8a) ∞ (−1)m R (g) = B x −⌊x⌋ g(m)(x) dx, m ∈ N . (8b) m (m)! m Zn+1  In the same way, we obtain for the Euler-Maclaurin approximation (7) to the truncation error of the Dirichlet series: ∞ m µ−1 − (−1) (s) − B − − − (ν + 1) s = µ 1 µ (n + 2)1 s µ + R (n,s) , µ! m ν=n+1 µ=0 X X (9a) m ∞ (−1) (s) Bm x −⌊x⌋ R (n,s) = m dx, m ∈ N . (9b) m (m)! (1 + x)s+m Zn+1  The reformulated Euler-Maclaurin approximation (9) looks suspiciously like a truncated expansion of the truncation error in terms of the asymptotic 6 Ernst Joachim Weniger

−µ ∞ sequence {(n + 2) }µ=0 of inverse powers. An analogous interpretation of the reformulated Euler-Maclaurin formula (8) is possible if we assume that ∞ the quantities g(x)dx, g(n),g′(n),g′′(n),... form an asymptotic sequence ∞ n+1 G (n) as n → ∞ according to µ µ=0 R  ∞ G0(n) = g(x) dx , (10a) Zn+1 (µ−1) Gµ(n) = g (n) , µ ∈ N . (10b)

∞ The expansion of the truncation error − g(ν) in terms of the ∞ ν=n+1 asymptotic sequence G (n) according to (8) has the undeniable ad- µ µ=0 P vantage that the expansion coefficients do not depend on the terms g(ν) and  are explicitly known. The only remaining computational problem is the∞ de- termination of the leading elements of the asymptotic sequence Gµ(n) µ=0. In the case of the Dirichlet series (1), this is trivially simple. Unfortunately,  the terms of most series expansions for special functions are (much) more complicated than the terms of the Dirichlet series (1). In those less fortunate cases, it can be extremely difficult to do the necessary differentiations and ∞ integrations. Thus, the construction of the asymptotic sequence Gµ(n) µ=0 may turn out to be an unsurmountable problem. 

3 Asymptotic Approximations To Truncation Errors

Let us assume that we want to construct an asymptotic expansion of a special function f(z) as z → ∞. First, we have to find a suitable asymptotic sequence ∞ ∞ {ϕj (z)}j=0. Obviously, {ϕj (z)}j=0 must be able to model the essential features ∞ of f(z) as z → ∞. On the other hand, {ϕj (z)}j=0 should also be sufficiently simple in order to facilitate the necessary analytical manipulations. In that −j ∞ respect, the most convenient asymptotic sequence is the sequence {z }j=0 of inverse powers, and it is also the one which is used almost exclusively in special function theory. An obvious example is the asymptotic series (3). The behavior of most special functions as z → ∞ is incompatible with an expansion in terms of inverse powers. Therefore, an indirect approach has to be pursued: For a given f(z), one has to find some g(z) such that the ratio f(z)/g(z) admits an asymptotic expansion in terms of inverse powers:

∞ j f(z)/g(z) ∼ cj /z , z → ∞ . (11) j=0 X −j ∞ Although f(z) cannot be expanded in terms of inverse powers {z }j=0, it can j ∞ be expanded in terms of the asymptotic sequence {g(z)/z }j=0. The asymp- totic series (3) is of the form of (11) with f(z)= E1(z) and g(z) = exp(−z)/z. Asymptotic Approximations to Truncation Errors 7

It is the central hypothesis of this article that such an indirect approach is useful for the construction of asymptotic approximations to remainders ∞ rn = − ν=n+1 aν of infinite series as n → ∞. Thus, instead of trying to use the technically difficult Euler-Maclaurin formula (6), we should try to find P some ρn such that the ratio rn/ρn admits an asymptotic expansion as n → ∞ −j ∞ in terms of inverse powers {(n + α) }j=0 with α> 0. A natural candidate for ρn is the first term an+1 neglected in the partial n sum sn = ν=0 aν , but in some cases it is better to choose instead ρn = an or ρn = (n+α)an+1 with α> 0. Moreover, the terms an+1 and the remainders rn of an infiniteP series are connected by the inhomogeneous difference equation

∆rn = rn+1 − rn = an+1 , n ∈ N0 . (12) In Jagerman’s book [8, Chapter 3 and 4], solutions to difference equations of that kind are called N¨orlund sums. If we knew how to solve (12) efficiently and reliably for essentially arbitrary inhomogeneities an+1, all problems related to the evaluation of infinite series would in principle be solved. Unfortunately, this is not the case. Nevertheless, we can use (12) to construct the leading terms of an asymptotic expansion of rn/an+1 or of related expressions in terms of inverse powers. For that purpose, we make the following ansatz: m γm r(m) = − a µ , n ∈ N , m ∈ N , α> 0 . (13) n n+1 (n + α)µ 0 µ=0 X This ansatz, which is inspired by the theory of converging factors [1, 13] and by a truncation error estimate for Levin’s sequence transformation [10] proposed by Smith and Ford [16, Eq. (2.5)] (see also [22, Section 7.3] or [24, Section IV]), is not completely general and has to be modified slightly both in the case of the Dirichlet series (1) for the Riemann zeta function, which is discussed in Section 5, and in the case of the divergent asymptotic series (3) for the exponential integral, which is discussed in Section 7. Moreover, the ansatz (13) does not cover the series expansions of all special functions of interest. For example, in [23] a power for the digamma function ψ(z) was analyzed whose truncation errors cannot be approximated by a truncated power series of the type of (13). Nevertheless, the examples considered in this article should suffice to convince even a sceptical reader that the ansatz (13) is indeed computationally useful. We cannot expect that the ansatz (13) satisfies the the inhomogeneous difference equation (12) exactly. However, we can choose the unspecified co- (m) efficients γµ in (13) in such a way that only a higher order error remains:

(m) (m) m m m m rn+1 − rn γµ an+2 γµ = µ − µ (14) an (n + α) an (n + α + 1) +1 µ=0 +1 µ=0 X − − X = 1+O(n m 1) , n → ∞ . (15) 8 Ernst Joachim Weniger

The approach of this article depends crucially on the assumption that the ratio an+2/an+1 can be expressed as an (asymptotic) power series in 1/(n + α). If this is the case, then the right-hand side of (14) can be expanded in powers of 1/(n + α) and we obtain:

(m) (m) m (m) rn+1 − rn Cµ −m−1 = µ + O n , n → ∞ . (16) an (n + α) +1 µ=0 X  Now, (15) implies that we have solve the following system of linear equations:

(m) Cµ = δµ0 , 0 ≤ µ ≤ m . (17) (m) (m) Since Cµ with 0 ≤ µ ≤ m contains only the unspecified coefficients γ0 , ... , (m) (m) (m) γµ but not γµ+1 ... , γm , the linear system (17) has a triangular structure (m) (m) and the unspecified coefficients γ0 ,...,γµ can be determined by solving (m) (m) (m) successively the equations C0 = 1, C1 = 0, ... , Cm = 0. Another important aspect is that the linear equations (17) do not depend (m) explicitly on m, which implies that the coefficients γµ in (13) also do not (m) (m) depend explicitly on m. Accordingly, the superscript m of both Cµ and γµ is superfluous and will be dropped in the following Sections.

4 Numerical Analytic Continuation

Divergent asymptotic series of the type of (11) can be extremely useful com- putationally: For sufficiently large arguments z, truncated expansions of that kind are able to provide (very) accurate approximations to the corresponding special functions, in particular if the series is truncated in the vicinity of the minimal term. If, however, the argument z is small, truncated expansions of that kind produce only relatively poor or even completely nonsensical results. We can expect that our asymptotic expansions in powers of 1/(n+α) have similar properties. Thus, we can be confident that they produce (very) good re- sults for sufficiently large indices n, but it would be overly optimistic to assume that these expressions necessarily produce good results in the nonasymptotic regime of moderately large or even small indices n. Asymptotic approximants can often be constructed (much) more easily than other approximants that are valid in a wider domain. Thus, it is desirable to use asymptotic approximants also outside the asymptotic domain. This means that we would like to use our asymptotic approximants also for small indices n in order to avoid the computationally problematic asymptotic regime of large indices. Obviously, this is intrinsically contradictory. We also must find a way of extracting additional information from the terms of a truncated divergent inverse power series expansion. Asymptotic Approximations to Truncation Errors 9

Often, this can be accomplished at low computational costa by converting ∞ n ∞ an inverse power series n=0 cn/z to a factorial series n=0 c˜n/(z)n. Fac- torial series, which had already been known to Stirling [20, p. 6], frequently have superior convergenceP properties. An example is theP incomplete gamma function Γ (a,z), which possesses a divergent asymptotic series of the type of (11) [5, Eq. (6) on p. 135] and also a convergent factorial series [5, Eq. (1) on p. 139]. Accordingly, the otherwise so convenient inverse powers are not necessarily the computationally most effective asymptotic sequence. The transformation of an inverse power series to a factorial series can be accomplished with the help of the Stirling numbers of the first kind which n S(1) ν are normally defined via the expansion (z − n + 1)n = ν=0 (n,ν)z of a Pochhammer symbol in terms of powers. As already known to Stirling (see for example [20, p. 29] or [14, Eq. (6) on p. 78]), the StirlingP numbers of the first kind occur also in the factorial series expansion of an inverse power:

∞ κ S(1) 1 (−1) (k + κ, k) N k+1 = , k ∈ 0 . (18) z (z)k κ κ=0 + +1 X This infinite generating function can also be derived by exploiting the well known recurrence relationships of the Stirling numbers. With the help of (18), the following transformation formula can be derived easily:

∞ ∞ k k cn c1 (−1) κ S(1) n = c0 + + (−1) (k − 1,κ − 1) cκ . (19) z (z) (z)k n=0 1 k κ=1 X X=2 X Let us now assume that the coefficients γµ with 0 ≤ µ ≤ m of a truncated expansion of rn/an+1 in powers of 1/(n + α) according to (13) are known. Then, (19) implies that we can use the transformation scheme

γµ , µ =0, 1 , µ γ˜µ =  (20) µ+ν (1)  (−1) S (µ − 1,ν − 1) γν , µ ≥ 2 ,  ν=1 X  to obtain instead of (13) the truncated factorial series

m (m) γ˜µ −m−1 r˜n = −an+1 + O n , n → ∞ . (21) (n + α)µ "µ=0 # X  Pad´eapproximants, which convert the partial sums of a to a doubly indexed sequence of rational functions, can also be quite helpful. They are now used almost routinely in applied mathematics and theoretical physics to overcome convergence problems with power series (see for example the monograph by Baker and Graves-Morris [2] and references therein). The 10 Ernst Joachim Weniger ansatz (13) produces a truncated series expansion of rn/an+1 in powers of 1/(n + α), which can be converted to a Pad´eapproximant, i.e., to a rational function in 1/(n + α). The numerical results presented in Sections 6 and 7 that the conversion to factorial series and Pad´eapproximants improves the accuracy of our approx- imants, in particular for small indices n.

5 The Dirichlet Series for the Riemann Zeta Function

In this Section, an asymptotic approximation to the truncation error of the Dirichlet series for the Riemann zeta function is constructed by suitably adapt- ing the approach described in Section 3. In the case of the Dirichlet series (1), we have: n −s sn = (ν + 1) , (22) ν=0 X ∞ ∞ −s − − ν r = − (ν + 1) s = −(n + 2) s 1+ , (23) n n +2 ν=n+1 ν=0   X −s X ∆rn = (n + 2) . (24)

It is an obvious idea to express the infinite series on the right-hand side of (23) as a power series in 1/(n + 2). If ν

− − ∆nα = (n + 1)α − nα = αnα 1 +O nα 2 , n → ∞ . (26)

Thus, we make the following ansatz, which takes into account the specific features of the Dirichlet series (1):

m − γ r(m) − (n + 2)1 s µ , m ∈ N , n ∈ N . (27) n (n + 2)µ 0 µ=0 X This ansatz is inspired by the truncation error estimate for Levin’s u trans- formation [10] (see also [22, Section 7.3] or [24, Section IV]). Asymptotic Approximations to Truncation Errors 11

As in Section 3, the unspecified coefficients γµ are chosen in such a way that only a higher order error remains:

(m) −s −m−1 ∆rn = (n + 2) 1+O n , n → ∞ . (28) For that purpose, we write:  

(m) (m) m 1−s m r − rn γ n +3 γ n+1 = µ − µ (29) (n + 2)1−s (n + 2)µ n +2 (n + 3)µ µ=0   µ=0 Xm X γ − − = µ 1 − [1 + 1/(n + 2)]1 s µ . (30) (n + 2)µ µ=0 X  With the help of the binomial series [12, p. 38], we obtain:

∞ λ − − (s + µ − 1) (−1) 1 − [1 + 1/(n + 2)]1 s µ = λ+1 . (31) (λ + 1)! (n + 2)λ+1 λ X=0 Inserting (31) into (30) yields:

m γ − − µ 1 − [1 + 1/(n + 2)]1 s µ = (n + 2)µ µ=0 X m  ∞ γ (s + µ − 1) (−1)λ = µ λ+1 (32) (n + 2)µ (λ + 1)! (n + 2)λ+1 µ=0 λ X X=0 ∞ min(ν,m) − − (1 − s − ν) γ − = − (n + 2) ν 1 λ+1 ν λ . (33) (λ + 1)! ν=0 λ X X=0 Thus, we obtain the following truncated asymptotic expansion:

(m) (m) m r − rn − n+1 = − (n + 2) µ (n + 2)−s µ=0 µ X (1 − s − µ) γ − − − × λ+1 µ λ + O n m 1 , n → ∞ . (34) (λ + 1)! λ=0 X  The unspecified coefficients γµ have to be determined by solving the following system of linear equations, whose triangular structure is obvious:

µ (1 − s − µ) γ − λ+1 µ λ = δ , 0 ≤ µ ≤ m . (35) (λ + 1)! µ0 λ X=0 For a more detailed analysis of the linear system (35), let us define βµ via

(s) − γ = (−1)µ µ 1 β , µ ∈ N . (36) µ µ! µ 0 12 Ernst Joachim Weniger

Inserting (36) into (35) yields:

µ µ−λ (1 − s − µ)λ+1 (−1) (s)µ−λ−1 β − = δ , µ ∈ N . (37) (λ + 1)! (µ − λ)! µ λ µ0 0 λ X=0 λ+1 Next, we use (1 − s − µ)λ+1 = (−1) (s)µ and obtain

µ µ (1 − s − µ) γ − β − λ+1 µ λ = (−1)µ+1 (s) µ λ (38) (λ + 1)! µ (λ + 1)!(µ − λ)! λ=0 λ=0 X µ X (−1)µ+1(s) (µ + 1)! = µ β (39) (µ + 1)! (µ − σ + 1)!σ! σ σ=0 Xµ (−1)µ+1(s) µ +1 = µ β = δ , µ ∈ N . (40) (µ + 1)! σ σ µ0 0 σ=0 X   Thus, the linear system (35) is equivalent to the well known recurrence formula

n n +1 B = 0 , n ∈ N , (41) ν ν ν=0 X   of the Bernoulli numbers (see for example [19, Eq. (1.11)]) together with the initial condition B0 = 1. Thus. the ansatz (27) reproduces the finite sum (7a) or (9a) of the Euler-Maclaurin formula for the truncation error of the Dirichlet series, which is not really surprising since asymptotic series are unique, if they exist. Only the integral (7b) or (9b)) cannot be reproduced in this way.

6 The Gaussian Hypergeometric Series

The simplicity of the terms of the Dirichlet series (1) facilitates the deriva- tion of explicit asymptotic approximations to truncation errors by solving a system of linear equations in closed form. A much more demanding test for the feasibility of the new formalism is the Gaussian hypergeometric series (2), which depends on three parameters a, b, and c, and one argument z. Due to the complexity of the terms of the Gaussian hypergeometric series (2), there is little hope in obtaining explicit analytical solutions to the linear equations. From a pragmatist’s point of view, it is therefore recommendable to use computer algebra systems like Maple and Mathematica and let the computer do the work. In the case of a nonterminating Gaussian hypergeometric series, we have: Asymptotic Approximations to Truncation Errors 13

n (a)ν (b)ν ν sn(z) = z , (42) (c)ν ν! ν=0 X ∞ (a)ν (b)ν ν rn(z) = − z (c)ν ν! ν=n+1 X ∞ (a) (b) (a + n + 1) (b + n + 1) = − n+1 n+1 zn+1 ν ν zν , (43) (c)n (n + 1)! (c + n + 1)ν (n + 2)ν +1 ν=0 X (a)n+1(b)n+1 n+1 ∆rn(z) = z . (44) (c)n+1(n + 1)!

Since [(a + n + 1)ν (b + n + 1)ν ]/[(c + n + 1)ν (n + 2)ν ] can be expressed as a power series in 1/(n + 1), the following ansatz make sense:

m (m) (a)n+1(b)n+1 n+1 γµ rn (z) = − z µ , (c)n (n + 1)! (n + 1) +1 µ=0 X m ∈ N , n ∈ N0 , |z| < 1 . (45)

Again, we choose the unspecified coefficients γµ in (45) in such a way that only a higher order error error remains:

(m) (m) (m) ∆rn (z) = rn+1(z) − rn (z) (a) (b) − − = n+1 n+1 zn+1 1+O n m 1 , n → ∞ . (46) (c)n+1(n + 1)!   This convergence condition can be reformulated as follows:

(m) (m) rn+1(z) − rn (z) n+1 [(a)n+1(b)n+1z ]/[(c)n+1(n + 1)!] m m γ (a + n + 1)(b + n + 1) γ = µ − z µ (47) (n + 1)µ (c + n + 1)(n + 2) (n + 2)µ µ=0 µ=0 X − − X = 1+O n m 1 , n → ∞ . (48)

Now, we only have to do an asymptotic expansion of (47) in terms of the j ∞ asymptotic sequence {1/(n + 1) }j=0 as n → ∞. This yields:

(m) (m) rn+1(z) − rn (z) n+1 [(a)n+1(b)n+1z ]/[(c)n+1(n + 1)!] m C − − = µ + O n m 1 , n → ∞ . (49) (n + 1)µ µ=0 X  We then obtain the following system of coupled linear equations in the un- specified coefficient γµ with 0 ≤ µ ≤ m: 14 Ernst Joachim Weniger

Cµ = δµ0 , 0 ≤ µ ≤ m . (50)

As discussed in Section 3, a coefficient Cµ with 0 ≤ µ ≤ m contains only the unspecified coefficients γ0, ... , γµ but not γµ+1 ... , γm. Thus, the symbolic solution of these linear equations for a Gaussian 2F1(a,b; c; z) with unspecified parameters a, b, and c and unspecified argument z is not particularly difficult for a computer algebra system, since the unspecified coefficient γµ can be determined successively. The following linear equations were constructed with the help of Maple 8:

C0 = (1 − z) γ0 = 1 , (51a)

C1 = (c − a − b + 1) zγ0 + (1 − z) γ1 = 0 , (51b) 2 C2 = [(c − b + 1) a + (c + 1) b − 1 − c − c ] zγ0

+ (c +2 − b − a) zγ1 + (1 − z) γ2 = 0 , (51c) 2 2 3 2 C3 = {[(c + 1) b − 1 − c − c ] a − (1 + c + c ) b + c + c + c +1} zγ0 2 + [(c +2 − b) a + (c + 2) b − 3 − c − 2 c] zγ1

+ (3 − b − a + c) zγ2 + (1 − z) γ3 = 0 . (51d)

This example shows that the complexity of the coefficients Cµ in (49) increases so rapidly with increasing index µ that a solution of the linear equations (50) becomes soon unmanageable for humans. This is also confirmed by the following solutions of (51) obtained symbolically with the help of Maple 8:

(z − 1) γ0 = 1 , (52a) 2 (z − 1) γ1 = z (a + b − c − 1) , (52b) 3 2 2 (z − 1) γ2 = z {[a + (b − c − 2) a + b − (c + 2) b +1+2 c] z + (b − c − 1) a − (c + 1) b +1+ c + c2} , (52c) 4 3 2 2 (z − 1) γ3 = z {[a + (b − c − 3) a + (b − (c + 3) b +3+3 c) a + b3 − (c + 3) b2 +(3+3 c) b − 1 − 3 c] z2 + [(2 b − 2 c − 3) a2 + (2 b2 − (4 c + 8) b +2 c2 +7+8 c) a − (2 c + 3) b2 + (2 c2 +7+8 c) b − 4 − 5 c2 − 7 c] z + [−(c + 1) b +1+ c2 + c] a +(1+ c2 + c) b − 1 − c2 − c − c3} . (52d)

The solutions (52), which are rational in z, demonstrate quite clearly a principal weakness of symbolic computing. Typically, the results are compli- cated and poorly structured algebraic expressions, and it is normally very difficult to gain further insight from them. Nevertheless, symbolic solutions of the linear equations (50) are computationally very useful. For the Gaussian hypergeometric series with a = 1/3, b = 7/5, c = 9/2, and z = −0.85, Maple 8 produced for m = 8 and n = 1 the following results: Asymptotic Approximations to Truncation Errors 15

r1 = −0.016 412 471 , (53a)

a2 [4/4] = −0.016 410 482 , (53b) (8) a2 r˜1 = −0.016 414 203 , (53c) (8) a2 r1 = −0.004 008 195 . (53d)

It is in my opinion quite remarkable that for n = 1, which is very far away from the asymptotic regime, at least the Pad´eapproximant a2[4/4] and the (8) truncated factorial series a2r˜1 agree remarkably well with the “exact” trun- (8) cation error r1. In contrast, the truncated inverse power series a2r1 produces a relatively poor result. For n = 10, which possibly already belongs to the asymptotic regime, Maple 8 produced the following results:

r10 = 0.000 031 925 482 , (54a)

a11 [4/4] = 0.000 031 925 482 , (54b) (8) a11 r˜10 = 0.000 031 925 483 , (54c) (8) a11 r10 = 0.000 031 925 471 . (54d)

Finally, let me emphasize that the formalism of this article is not limited to a Gaussian hypergeometric series (2), but works just as well in the case of a generalized hypergeometric series p+1Fp α1,...,αp+1.β1,...,βp; z .  7 The Asymptotic Series for the Exponential Integral

The divergent asymptotic series (3) for the exponential integral E1(z) is prob- ably the most simple model for many other factorially divergent asymptotic inverse power series occurring in special function theory. Well known examples are the asymptotic series for the modified Bessel function Kν (z), the comple- mentary error function erfc(z), the incomplete gamma function Γ (a,z), or the Whittaker function Wκ,µ(z). Moreover, factorial divergence is also the rule rather than the exception among the perturbation expansions of quan- tum physics (see [24] for a condensed review of the relevant literature). The exponential integral E1(z) can also be expressed as a Stieltjes integral: ∞ e−tdt z ez E (z) = . (55) 1 1+ t/z Z0 If z < 0, this integral has to be interpreted as a principal value integral. In the case of a factorially divergent inverse power series, it is of little use to represent the truncation error rn(z) by a power series as in (43). If, n ν n+1 however, we use ν=0 x = [1 − x ]/[1 − x] in (55), we immediately obtain: P 16 Ernst Joachim Weniger

n ν sn(z) = (−1/z) ν! , (56) ν=0 X ∞ n+1 −t − − t e dt r (z) = −(−z) n 1 , (57) n 1+ t/z Z0 n+1 ∆rn(z) = (−1/z) (n + 1)! . (58)

Because of the factorial growth of the coefficients in (3), it is advantageous to use instead of (13) the following ansatz:

m γ r(m)(z) = (−1/z)nn! µ , m ∈ N , n ∈ N . (59) n (n + 1)µ 0 µ=0 X

Again, we choose the unspecified coefficients γµ in (59) in such a way that only a higher order error error remains:

(m) n+1 −m−1 ∆rn (z) = (−1/z) (n + 1)! 1+O n , n → ∞ . (60)

This convergence condition can be reformulated as follows:

(m) (m) m m r (z) − rn (z) −z γ γ n+1 = µ − µ (61) (−1/z)n+1(n + 1)! n +1 (n + 1)µ (n + 2)µ µ=0 µ=0 X− − X = 1+O n m 1 , n → ∞ . (62)

Next, we do an asymptotic expansion of the right-hand side of (61) in terms j ∞ of the asymptotic sequence {1/(n + 1) }j=0 as n → ∞. This yields:

(m) (m) m r (z) − rn (z) C − − n+1 = µ + O n m 1 , n → ∞ . (63) (−1/z)n+1(n + 1)! (n + 1)µ µ=0 X  Again, we have to solve the following system of linear equations:

Cµ = δµ0 , 0 ≤ µ ≤ m . (64)

The following linear equations were constructed with the help of Maple 8:

C0 = −γ0 = 1 , (65a)

C1 = −zγ0 − γ1 = 0 , (65b)

C2 = (1 − z) γ1 − γ2 = 0 , (65c)

C3 = −γ1 + (2 − z) γ2 − γ3 = 0 , (65d)

C4 = γ1 − 3 γ2 + (3 − z) γ3 − γ4 = 0 . (65e)

If we compare the complexity of the equations (65) with those of (51), we see that in the case of the asymptotic series (3) for the exponential integral Asymptotic Approximations to Truncation Errors 17 there may be a chance of finding explicit expressions for the coefficients γµ. At least, the solutions of the linear system (65) obtained symbolically with the help of Maple 8 look comparatively simple:

γ0 = −1 , (66a)

γ1 = z , (66b)

γ2 = −(z − 1) z , (66c) 2 γ3 = (z − 3 z + 1) z , (66d) 3 2 γ4 = −(z − 6 z +7 z − 1) z . (66e) Of course, this requires further investigations. The relative simplicity of the coefficients in (66) offers other perspectives. For example, the [2/2] Pad´eapproximant to the truncated power series in (59) is compact enough to be printed without problems: 3 − z 2 −1+ + n +1 (n + 1)2 n2 − n + zn + z [2/2] = = . (67) 2z − 3 z2 − 2z +2 n2 − n +2zn + z2 1+ + n +1 (n + 1)2 Pad´eapproximants to the truncated power series in (59) seem to be a new class of approximants that are rational in both n and z. For the asymptotic series (3) for E1(z) with z = 5, Maple 8 produced for m = 16 and n = 2 the following results:

r2 = 0.027 889 , (68a)

a2 [8/8] = 0.027 965 , (68b) (16) a2 r˜2 = 0.028 358 , (68c) (16) a2 r2 = −177.788 . (68d)

(16) The Pad´eapproximant a2[8/8] and the truncated factorial series a2r˜2 agree well with the “exact” truncation error r2, but the truncated inverse power (16) series a2r2 is way off. For n = 10, all results agree reasonably well

r10 = 0.250 470 879 , (69a)

a10 [8/8] = 0.250 470 882 , (69b) (16) a10 r˜10 = 0.250 470 902 , (69c) (16) a10 r10 = 0.250 470 221 . (69d)

8 Conclusions and Outlook

A new formalism is proposed that permits the construction of asymptotic ∞ approximations to truncation errors rn = − ν=n+1 aν of infinite series for P 18 Ernst Joachim Weniger special functions by solving a system of linear equations. Approximations to truncation errors of monotone series can be obtained via the Euler-Maclaurin formula. The formalism proposed here is, however, based on different assump- tions and can be applied even if the terms of the series have a comparatively complicated structure. In addition, the new formalism works also in the case of alternating and even divergent series. Structurally, the asymptotic approximations of this article resemble the asymptotic inverse power series for special functions as z → ∞, since they are not expansions of rn, but rather expansions of ratios like rn/an+1, rn/an, or rn/[(n+α)an+1] with α> 0. This is consequential, because it makes it possible j ∞ to use the convenient asymptotic sequence {1/(n + α) }j=0 of inverse powers. This greatly facilitate the necessary analytical manipulations and ultimately leads to comparatively simple systems of linear equations. As shown in Section 5, the new formalism reproduces in the case of the Dirichlet series (1) for the Riemann zeta function the expressions (7a) or (9a) that follow from the Euler-Maclaurin formula. The linear equations (35) are equivalent to the recurrence formula (41) of the Bernoulli numbers. Thus, only the integral (7b) or (9b)) cannot be obtained in this way. Much more demanding is the Gaussian hypergeometric series (2), which is discussed in Section 6. The terms of this series depend on three in general complex parameters a, b, and c and one argument z. Accordingly, there is little hope that we might succeed in finding an explicit solution to the linear equa- tions. However, all linear equations considered in this article have a triangular structure. Consequently, it is relatively easy to construct solutions symboli- cally with the help of a computer algebra system like Maple. The numerical results presented in Section 6 also indicate that the formalism proposed in this article is indeed computationally useful. As a further example, the divergent asymptotic series (3) for the exponen- tial integral E1(z) is considered in Section 7. The linear equations are again solved symbolically by Maple. Numerical results are also presented. This ex- ample is important since it shows that the new formalism works also in the case of factorially divergent series. The Euler-Maclaurin formula can only handle convergent monotone series. Although the preliminary results look encouraging, a definite assessment of the usefulness of the new formalism for the computation of special functions is not yet possible. This requires much more data. Consequently, the new formalism should be be applied to other series expansions for special functions and the performance of the resulting approximations should be analyzed and compared with other computational approaches. I suspect that in most cases it will be necessary to solve the linear equa- tions symbolically with the help of a computer algebra system like Maple. Nevertheless, it cannot be ruled out that at least for some special functions with sufficiently simple series expansions explicit analytical solutions to the linear equations can be found. Asymptotic Approximations to Truncation Errors 19

Effective numerical analytic continuation methods are of considerable rel- evance for the new formalism which produces asymptotic approximations. We cannot tacitly assume that these approximations provide good results outside the asymptotic regime, although it would be highly desirable to use them also for small indices. In Section 4, only factorial series and Pad´eapproximants are mentioned, although many other numerical techniques are known that can accomplish such an analytic continuation. Good candidates are sequence transformations which are often more effective than the better known Pad´e approximants. Details can be found in books by Brezinski and Redivo Zaglia [4], Sidi [15], or Wimp [26], or in a review by the present author [22].

References

1. J. R. Airey: The “converging factor” in asymptotic series and the calculation of Bessel, Laguerre and other functions, Philos. Mag., 24, 521 – 552 (1937). 2. G. A. Baker, Jr. and P. Graves-Morris: Pad´eApproximants, Cambridge U. P., Cambridge, 2 ed. (1996). 3. C. M. Bender and S. A. Orszag: Advanced Mathematical Methods for Scientists and Engineers, McGraw-Hill, New York (1978). 4. C. Brezinski and M. Redivo Zaglia: Extrapolation Methods, North-Holland, Am- sterdam (1991). 5. A. Erd´elyi, W. Magnus, F. Oberhettinger, and F. G. Tricomi: Higher Transcen- dental Functions, vol. II, McGraw-Hill, New York (1953). 6. L. Euler: Institutiones calculi differentialis cum eius usu in analysi finitorum ac doctrina serium. Pars II.1. De transformatione serium, Academia Imperi- alis Scientiarum Petropolitana, St. Petersburg (1755). Reprinted as vol. X of Leonardi Euleri Opera Omnia, Seria Prima (Teubner, Leipzig and Berlin, 1913). 7. A. Gil, J. Segura, and N. Temme: Computing special functions by using quadra- ture rules, Numer. Algor., 33, 265 – 275 (2003). 8. D. L. Jagerman: Difference Equations with Applications to Queues, Marcel Dekker, New York (2000). 9. K. Knopp: Theorie und Anwendung der unendlichen Reihen, Springer-Verlag, Berlin (1964). 10. D. Levin: Development of non-linear transformations for improving convergence of sequences, Int. J. Comput. Math. B, 3, 371 – 388 (1973). 11. D. W. Lozier and F. W. Olver: Numerical evaluation of special functions, in: W. Gautschi (ed.), Mathematics of Computation 1943 - 1993: A Half-Century of Computational Mathematics, vol. 48 of Proc. Symp. Appl. Math., 79 – 125, American Mathematical Society, Providence (1994). 12. W. Magnus, F. Oberhettinger, and R. P. Soni: Formulas and Theorems for the Special Functions of Mathematical Physics, Springer-Verlag, New York (1966). 13. J. C. P. Miller: A method for the determination of converging factors, applied to the asymptotic expansions for the parabolic cylinder function, Proc. Cambridge Phil. Soc., 48, 243 – 254 (1952). 14. N. Nielsen: Die Gammafunktion, Chelsea, New York (1965). Originally published by Teubner, Leipzig und Berlin, 1906. 15. A. Sidi: Practical Extrapolation Methods, Cambridge U. P., Cambridge (2003). 20 Ernst Joachim Weniger

16. D. A. Smith and W. F. Ford: Acceleration of linear and logarithmic convergence, SIAM J. Numer. Anal., 16, 223 – 240 (1979). 17. J. Stirling: Methodus differentialis sive tractatus de summatione et interpolatione serium infinitarum, London (1730). English translation by F. Holliday [18]. 18. J. Stirling: The Differential Method, or, a Treatise Concerning the Summation and Interpolation of Infinite Series, London (1749). 19. N. M. Temme: Special Functions – An Introduction to the Classical Functions of Mathematical Physics, Wiley, New York (1996). 20. I. Tweddle: James Stirling’s Methodus Differentialis: An Annotated Translation of Stirling’s Text, Springer-Verlag, London (2003). 21. C. G. van der Laan and N. M. Temme: Calculation of Special Functions: The Gamma Function, the Exponential Integrals and Error-Like Functions, Centrum voor Wiskunde en Informatica, Amsterdam (1980). 22. E. J. Weniger: Nonlinear sequence transformations for the acceleration of con- vergence and the summation of divergent series, Comput. Phys. Rep., 10, 189 – 371 (1989). Los Alamos Preprint math-ph/0306302 (http://arXiv.org). 23. E. J. Weniger: A rational approximant for the digamma function, Numer. Algor., 33, 499 – 507 (2003). 24. E. J. Weniger: Mathematical properties of a new Levin-type sequence transfor- mation introduced by C´ıˇzek,ˇ Zamastil, and Sk´ala. I. Algebraic theory, J. Math. Phys., 45, 1209 – 1246 (2004). 25. E. J. Weniger and B. Kirtman: Extrapolation methods for improving the conver- gence of oligomer calculations to the infinite chain limit of quasi-onedimensional stereoregular polymers, Comput. Math. Applic., 45, 189 – 215 (2003). 26. J. Wimp: Sequence Transformations and Their Applications, Academic Press, New York (1981).