AN ANALYSIS OF THE LANCZOS GAMMA APPROXIMATION

by

GLENDON RALPH PUGH

B.Sc. (Mathematics) University of New Brunswick, 1992 M.Sc. (Mathematics) University of British Columbia, 1999

A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF

THE REQUIREMENTS FOR THE DEGREE OF

DOCTOR OF PHILOSOPHY

in

THE FACULTY OF GRADUATE STUDIES

Department of Mathematics

We accept this thesis as conforming to the required standard

......

......

......

......

......

THE UNIVERSITY OF BRITISH COLUMBIA

November 2004

c Glendon Ralph Pugh, 2004

In presenting this thesis in partial fulfillment of the requirements for an ad- vanced degree at the University of British Columbia, I agree that the Library shall make it freely available for reference and study. I further agree that permission for extensive copying of this thesis for scholarly purposes may be granted by the head of my department or by his or her representatives. It is understood that copying or publication of this thesis for financial gain shall not be allowed without my written permission.

(Signature)

Department of Mathematics The University of British Columbia Vancouver, Canada

Date Abstract

This thesis is an analysis of C. Lanczos’ approximation of the classical Γ(z+1) as given in his 1964 paper A Precision Approximation of the Gamma Function [14]. The purposes of this study are:

(i) to explain the details of Lanczos’ paper, including proofs of all claims made by the author; (ii) to address the question of how best to implement the approximation method in practice; and (iii) to generalize the methods used in the derivation of the approximation.

At present there are a number of algorithms for approximating the gamma function. The oldest and most well-known is Stirling’s asymptotic series which is still widely used today. Another more recent method is that of Spouge [27], which is similar in form though different in origin than Lanczos’ formula. All three of these approximation methods take the form

z+1/2 z w Γ(z +1)=√2π(z + w) e− − [sw,n(z)+ǫw,n(z)] (1)

where sw,n(z) denotes a series of n + 1 terms and ǫw,n(z) a relative error to be estimated. The real variable w is a free parameter which can be adjusted to control the accuracy of the approximation. Lanczos’ method stands apart from the other two in that, with w 0 fixed, asn the series s (z) ≥ →∞ w,n converges while ǫw,n(z) 0 uniformly on Re(z) > w. Stirling’s and Spouge’s methods do not share this→ property. − What is new here is a simple empirical method for bounding the relative error ǫ (z) in the right half plane based on the behaviour of this function | w,n | as z . This method is used to produce pairs (n, w) which give formu- las| (1)|→∞ which, in the case of a uniformly bounded error, are more efficient than Stirling’s and Spouge’s methods at comparable accuracy. In the n = 0 case, a variation of Stirling’s formula is given which has an empirically determined uniform error bound of 0.006 on Re(z) 0. Another result is a proof of the limit formula ≥

z 1 12/r z 22/r z(z 1) Γ(z + 1) = 2 lim r e− + e− − + r 2 − z +1 (z +1)(z +2) ··· →∞   as stated without proof by Lanczos at the end of his paper.

ii Table of Contents

Abstract ii

Table of Contents iii

List of Tables vi

List of Figures vii

Acknowledgments viii

Chapter 1. Introduction 1 1.1 Lanczos and His Formula ...... 2 1.2 Thesis Overview ...... 8

Chapter 2. A Primer on the Gamma Function 20 2.1 First Encounters with Gamma ...... 20 2.2 A Brief History of Gamma ...... 22 2.3 Definition of Γ ...... 25 2.4 Standard Results and Identities ...... 27 2.5 Stirling’s Series and Formula ...... 29 2.5.1 The Formula ...... 29 2.5.2 Some Remarks about Error Bounds ...... 34 2.6 Spouge’s Method ...... 36 2.7 Additional Remarks ...... 39

Chapter 3. The Lanczos Formula 40 3.1 The Lanczos Derivation ...... 41 3.1.1 Preliminary Transformations ...... 42 3.1.2 The Implicit Function v(θ) ...... 44 3.1.3 Series Expansion of fE,r ...... 46 3.2 Derivation in the Chebyshev Setting ...... 47 3.3 Derivation in the Hilbert Space Setting ...... 49 3.4 Additional Remarks ...... 50

Chapter 4. The Functions v and fE,r 52 4.1 Closed Form Formulas ...... 52 4.1.1 Closed Form for v(x) ...... 53

iii Table of Contents

4.1.2 Closed Form for fr(x) andf E,r(x) ...... 54 r 4.2 Smoothness of v (x), fr(x) andf E,r(x) ...... 56 r 4.3 Smoothness of v (θ), fr(θ) andf E,r(θ) ...... 59 4.3.1 Generalized fr(θ) ...... 59 4.3.2 Derivatives of G(β,j,k,l; θ) ...... 61 4.3.3 Application to fr ...... 61 4.4 Fourier Series and Growth Order of Coefficients ...... 64

Chapter 5. Analytic Continuation of Main Formula 66

5.1 Domain of Convergence of Sr(z) ...... 66 5.2 Analytic Continuation ...... 69 5.3 Additional Remarks ...... 69

Chapter 6. Computing the Coefficients 72 6.1 The Lanczos Method ...... 72 6.2 A Horner Type Method ...... 74 6.3 Another Recursion Formula ...... 76 6.4 Discrete Fourier Transform ...... 77 6.4.1 Finite Fourier Series ...... 77 6.4.2 Finite Chebyshev Series ...... 78 6.5 Some Sample Coefficients ...... 80 6.6 Partial Fraction Decomposition ...... 80 6.7 Matrix Representation ...... 82

Chapter 7. Lanczos’ Limit Formula 84 7.1 Some Motivation ...... 85 7.2 Proof of the Limit Formula ...... 87 7.3 Additional Remarks ...... 95

Chapter 8. Implementation & Error Discussion 98 8.1 A Word or Two about Errors ...... 99 8.1.1 Absolute and Relative Error ...... 99 8.1.2 Lanczos’ Relative Error ...... 100 8.1.3 Restriction to Re(z) 0 ...... 101 8.2 Some Notation and a Theorem≥ ...... 102 8.3 Lanczos’ Error Estimates ...... 105 8.4 Luke’s Error Estimates ...... 108

8.5 Numerical Investigations & the Zeros of ǫr,n∞ ...... 109 8.5.1 The Motivating Idea ...... 109

8.5.2 Zeros of ǫr,n∞ ...... 111

iv Table of Contents

8.5.3 Improved Lanczos Formula ...... 111 8.5.4 Optimal Formulas ...... 114 8.6 Additional Remarks ...... 116

Chapter 9. Comparison of the Methods 120 9.1 Stirling’s Series ...... 120 32 9.1.1 Γ(20+17i) with ǫρ < 10− ...... 120 | | 32 9.1.2 Γ(1+ z) with ǫρ < 10− Uniformly ...... 122 9.2 Spouge’s Method ...... | | 123 32 9.2.1 Γ(20+17i) with ǫρ < 10− ...... 123 | | 32 9.2.2 Γ(1+ z) with ǫρ < 10− Uniformly ...... 124 9.3 Lanczos’ Method ...... | | 125 9.4 Discussion ...... 125

Chapter 10. Consequences of Lanczos’ Paper 128 10.1 The Lanczos Transform ...... 128 10.2 A Combinatorial Identity ...... 133 10.3 Variations on Stirling’s Formula ...... 134

Chapter 11. Conclusion and Future Work 139 11.1 Outstanding Questions Related to Lanczos’ Paper ..... 140 11.2 Outstanding Questions Related to Error Bounds ...... 141 11.3 Conjectures on a Deterministic Algorithm ...... 143

Bibliography 145

Appendix A. Preliminary Steps of Lanczos Derivation 148

Appendix B. A Primer on Chebyshev Polynomials 149

Appendix C. Empirical Error Data 152

v List of Tables

1.1 Relative decrease of ak(r), r =1, 4, 7 ...... 4

2.1 Upper bound on EN,n(6+13i) in Stirling Series ...... 33 2.2 Coefficients of Spouge’s| Series, |a =12.5 ...... 38

6.1 Scaled summands of c6(6) ...... 75 6.2 Coefficients as functions of r ...... 80

8.1 Lanczos’ uniform error bounds ...... 106 8.2 Location of maximum of ηr,n(θ) ...... 107 8.3 Errors at infinity ...... 107

8.4 Approximate Zeros of ǫr,∞6 ...... 113 8.5 Sample coefficients, n = 10, r =10.900511 ...... 116 8.6 Comparison of Mr(n),n and an+1(r(n)) ...... 119 9.1 Upper bound on E (19 + 17i) in Stirling Series ...... 121 | N,n | 9.2 Upper bound on EN,n(0) in Stirling Series ...... 122 9.3 Coefficients of Spouge’s| series,| a =39 ...... 124 9.4 Coefficients of Lanczos’ series, r =22.618910 ...... 126

C.1 Error Data, n =0,...,30 ...... 153 C.2 Error Data, n =31,...,60 ...... 154

vi List of Figures

1.1 Cornelius Lanczos ...... 3 1.2 Relative decrease of ak(1) ...... 5 1.3 Relative decrease of ak(4) ...... 5 1.4 Relative decrease of ak(7) ...... 6 1.5 Lanczos shelf, r =20 ...... 7 1.6 Lanczos shelf, r =40 ...... 7 1.7 Lanczos shelf, r =60 ...... 8 1.8 f (θ), π/2 θ π/2 ...... 13 r − ≤ ≤ 2.1 Γ(z +1), 4

2 7.1 exp[ r(θ π/2) ] gr(θ) for r =1, 6, 10 ...... 86 7.2 log Q−(k, 10),− k =0,...,− 24 ...... 96 7.3 log Q(k, 20), k =0,...,24 ...... 97 7.4 log Q(k, 50), k =0,...,24 ...... 97

1/5 8.1 ǫ∞ , n =0, 1, 2, 3, 1/2

11.1 ǫr,n(z), 0.5

vii Acknowledgments

I would like to thank all those who have assisted, guided and sup- ported me in my studies leading to this thesis. In particular, I wish to thank my supervisor Dr. Bill Casselman for his patience, guidance and encouragement, my committee members Dr. David Boyd and Dr. Richard Froese, and Ms. Lee Yupitun for her assistance as I found my way through the administrative maze of graduate school. I would also like to thank Professor Wesley Doggett of North Carolina State Uni- versity for his kind assistance in obtaining permission to reproduce the photo of C.Lanczos in Chapter 1. The online computing community has been a great help to me also in making available on the web many useful tools which helped in my research. In particular, MPJAVA, a multiple precision floating point computation package in Java produced by The HARPOON Project at the University of North Carolina was used for many of the high precision numerical investigations. In addition, the online spreadsheet MathSheet developed by Dr. Bill Casselman and Dr. David Austin was very helpful in producing many of the PostScript plots in the thesis. Finally, I would like to thank my family for their support and en- couragement: my parents Anne and Charles, and especially my wife Jacqueline for her encouragement and many years of understanding during the course of my studies.

viii Chapter 1 Introduction

The focus of this study is the little known Lanczos approximation [14] for computing the gamma function Γ(z + 1) with complex argument z. The aim is to address the following questions:

(i) What are the properties of the approximation? This involves a detailed examination of Lanczos’ derivation of the method.

(ii) How are the parameters of the method best chosen to approximate Γ(z +1)?

(iii) How does Lanczos’ method compare against other methods?

(iv) Does Lanczos’ method generalize to other functions?

The subject of approximating the factorial function and its gener- alization, the gamma function, is a very old one. Within a year of Euler’s first consideration of the gamma function in 1729, Stirling pub- lished the asymptotic formula for the factorial with integer argument which bears his name. The generalization of this idea, Stirling’s series, has received much attention over the years, especially since the advent of computers in the twentieth century. Stirling’s series remains today the state of the art and forms the basis of many, if not most algorithms for computing the gamma func- tion, and is the subject of many papers dealing with optimal computa- tional strategies. There are, however, other methods for computing the gamma function with complex argument [7][20][26][14][27]. One such method is that of Lanczos, and another similar in form though different in origin is that of Spouge.

1 Chapter 1. Introduction

The methods of Stirling and Lanczos share the common strategy of terminating an infinite series and estimating the error which results. Also in common among these two methods, as well as that of Spouge, is a free parameter which controls the accuracy of the approximation. The Lanczos’ method, though, is unique in that the infinite series term of the formula converges, and the resulting formula defines the gamma function in right-half planes Re(z) r where r 0 is the aforementioned free parameter. This is in≥− contrast to the≥ divergent nature of the series in Stirling’s method. The main results of this work are

(i) Improved versions of Lanczos’ formulas for computing Γ(z +1) on Re(z) 0. In the specific case of a uniformly bounded relative ≥ 32 error of 10− in the right-half plane, a formula which is both simpler and more efficient than Stirling’s series is found. A one term approximation similar to Stirling’s formula is also given, but with a uniform error bound of 0.006 in the right-half plane. These results stem from the examination of the relative error as an analytic function of z, and in particular, the behaviour of this error as z . | |→∞ (ii) A careful examination of Lanczos’ paper [14], including a proof of the limit formula stated without proof at the end of the paper.

1.1 Lanczos and His Formula

The object of interest in this work is the formula

z+1/2 (z+r+1/2) Γ(z +1)=√2π (z + r +1/2) e− Sr(z) (1.1)

where 1 z z(z 1) S (z)= a (r)+a (r) + a (r) − + . (1.2) r 2 0 1 z +1 2 (z +1)(z +2) ···   This unusual formula is due to Cornelius Lanczos, who published it in his 11 page 1964 paper A Precision Approximation of the Gamma Func- tion [14]. The method has been popularized somewhat by its mention in Numerical Recipes in C [21], though this reference gives no indication

2 Chapter 1. Introduction as to why it should be true, nor how one should go about selecting trun- 1 cation orders of the series Sr(z) or values of the parameter r . Despite this mention, few of the interesting properties of the method have been explored. For example, unlike divergent asymptotic formulas such as Stirling’s series, the series Sr(z) converges. Yet, in a manner similar to a divergent series, the coefficients ak(r) initially decrease quite rapidly, followed by slower decay as k increases. Furthermore, with increasing r, the region of convergence of the series extends further and further to the left of the , including z on the negative real axis and not an integer.

Figure 1.1: Cornelius Lanczos

The coefficients ak(r) in (1.2) are expressible in closed form as functions of the free parameter r 0, and equation (1.1) is valid for ≥ Re(z + r) > 0, z not a negative integer. Equation (1.1) actually rep-

1In fact, according to [21], r should be chosen to be an integer, which need not be the case.

3 Chapter 1. Introduction resents an infinite family of formulas, one for each value of r, and the choice of this parameter is quite crucial in determining the accuracy of the formula when the series Sr(z) is truncated at a finite number of terms. It is precisely the peculiar r dependency of the coefficients ak(r), and hence Sr(z) itself, which makes Lanczos’ method interesting.

To get a sense of the r parameter’s influence on Sr(z) at this early stage, consider the ratios ak+1(r)/ak(r) for sample values r =1, 4, 7 in Table 1.1. Observe how| for r = 1,| the relative size of successive

k a (1)/a (1) a (4)/a (4) a (7)/a (7) | k+1 k | | k+1 k | | k+1 k | 0 .31554 1.10590 1.39920 1 .00229 .15353 .33574 2 .32102 .02842 .15091 3 .34725 .00085 .05917 4 .43102 .00074 .01752 5 .50107 .05011 .00258 6 .55757 .36295 .00002 7 .60343 .24357 .00335 8 .64113 .25464 .06382 9 .67258 .27771 .03425 10 .69914 .30151 .58252

Table 1.1: Relative decrease of ak(r), r =1, 4, 7

coefficients drops very quickly at k = 1, but then flattens out into a more regular pattern. Compare this with the r =4andr = 7 columns where the drop occurs later, at k =4andk = 6 respectively, but the size of which is increasingly precipitous. A graphical illustration makes this behaviour more apparent; re- fer to Figures 1.2, 1.3, and 1.4 for bar graphs of log a (r)/a (r) , − | k+1 k | r =1, 4, 7, respectively. Observe the large peak to the left of each cor- responding to the steep drop-off in the coefficients. Considering that the scale in these graphs is logarithmic, the behaviour is dramatic. No- tice also that after the initial large decrease, the ratios do not follow a smooth pattern as in the r = 1 case, but rather, jump around irregu- larly.

The ak(r) are actually Fourier coefficients of a certain function, and 2r are bounded asymptotically by a constant times k− . However, the ini-

4 Chapter 1. Introduction

12

log a (1)/a (1) − | k+1 k |

0

4 − 0 k 29 Figure 1.2: Relative decrease of ak(1)

12

log a (4)/a (4) − | k+1 k |

0

4 − 0 k 29 Figure 1.3: Relative decrease of ak(4)

tial decrease of the coefficients appears more exponential in nature, and then switches abruptly to behave according to the asymptotic bound.

5 Chapter 1. Introduction

12

log a (7)/a (7) − | k+1 k |

0

4 − 0 k 29 Figure 1.4: Relative decrease of ak(7)

This peculiar phenomenon is nicely illustrated in Figures 1.5, 1.6 and 1.7 where log a (r)/er is plotted for k =0,...,50 using r =20, 40 − | k | and 60, respectively. The abrupt transition in decay (around k r in each case) appears unique to Lanczos’ formula, a phenomenon termed≈ the “Lanczos shelf” in this work. When using the Lanczos formula in practice, the shelf behaviour suggests that the series (1.2) should be terminated at about the k r term, or equivalently, a k-term approx- ≈ imation should use r k, since the decay rate of coefficients after the cutoff point slows considerably.≈ Apart from the observations noted so far, the methods used both in the derivation of the main formula and for the calculation of the coefficients makes Lanczos’ work worthy of further consideration. The techniques used extend to other functions defined in terms of a partic- ular integral transform. Lanczos was primarily a physicist, although his contributions to mathematics and in particular numerical analysis were vast [15]. There is no question that he had an appreciation for rigour and pure anal- ysis, and was no doubt adept and skilled technically. At the same time, however, he seemed to have a certain philosophical view that the worth of a theoretical result should be measured in part by its practi-

6 Chapter 1. Introduction

300

log a (20)/e20 − | k |

0 0 k 100 Figure 1.5: Lanczos shelf, r =20

300

log a (40)/e40 − | k |

0 0 k 100 Figure 1.6: Lanczos shelf, r =40

cality. It is this practicality which is in evidence more so than rigour in his 1938 paper [11] and his book [12], in which much emphasis is

7 Chapter 1. Introduction

300

log a (60)/e60 − | k |

0 0 k 100 Figure 1.7: Lanczos shelf, r =60

placed on the benefits of interpolation over extrapolation of analytical functions (that is, Fourier series versus Taylor series). In these works one does not find the standard format of theorems followed by proofs common today. Rather, Lanczos explains his methods in very readable (and mostly convincing) prose followed by examples, and leaves many technical details to the reader. This same style pervades [14], the focus of this study, and is one of the motivations for the more thorough analysis undertaken here. A number of statements are given without proof, or even hint of why they should be in fact be true, and a number of authors have noted this scarcity of detail. Aspects of his work are variously described as “none is quite as neat . . . seemingly plucked from thin air” [21], “exceedingly curious” [29], and “complicated” [27], so a more detailed examination seems warranted.

1.2 Thesis Overview

The goals of this work are threefold: (i) To explain in detail Lanczos’ paper, including proofs of all state-

8 Chapter 1. Introduction

ments.

(ii) From a practical point of view, to determine how (1.1) is best used to compute Γ(z +1), which reduces to an examination of the error resulting from truncation of the series (1.2), and to compare Lanczos’ method with other known methods.

(iii) To note consequences and extensions of Lanczos’ method.

The thesis is organized into eleven chapters, which fall into six more or less distinct categories. These are

I. History and Background of Γ(z +1): Chapter 2

II. Lanczos’ Paper: Details and Proofs; Lanczos Limit Formula: Chapters 3-7

III. Error Discussion: Chapter 8

IV. Comparison of Calculation Methods: Chapter 9

V. Consequences and Extensions of the Theory: Chapter 10

VI. Conclusion and Future Work: Chapter 11

I have attempted to summarize the content and state main results at the beginning of each chapter, followed by details and proofs in the body. The remainder of this introductory chapter is dedicated to an overview of the six categories noted, with the aim of providing the reader with a survey of the main ideas, thus serving as a guide for navigating the rest of the thesis.

History and Background of Γ(z +1)

The gamma function is a familiar mathematical object for many, being the standard generalization of the factorial n! for non-negative integer n. The history of the function is not so well known, however, and so a brief one is given here, culminating with Euler’s representation

∞ x 1 t Γ(x)= t − e− dt Z0

9 Chapter 1. Introduction which is the form with which Lanczos begins his study. Following the formal definition of Γ(z + 1), a number of standard identities are given with some explanation but without formal proof. The chapter concludes with a discussion of computational methods, beginning with Stirling’s series, which is a generalization of the familiar Stirling’s formula

n n n! √2πnn e− as n . ∼ →∞ Stirling’s asymptotic series forms the basis for most computational al- gorithms for the gamma function and much has been written on its implementation. An example on the use of Stirling’s series is given with a short discussion of error bounds. The second computational method noted is the relatively recent formula of Spouge [27]. This method is similar in form to Lanczos’ formula but differs greatly in its origin. The formula takes the form

N z+1/2 (z+a) 1/2 ck Γ(z +1)=(z + a) e− (2π) c0 + + ǫ(z) " z + k # Xk=1

where N = a 1, c0 = 1andc k is the residue of Γ(z + 1)(z + (z+1/2) z+a⌈ ⌉−1/2 a)− e (2π)− at z = k. Although not quite as accurate as − Lanczos’ method using the same number of terms of the series, Spouge’s method has simpler error estimates, and the coefficients ck are much easier to compute. This method also extends to the Ψ(z +1)=d/dz [log Γ(z + 1)] and trigamma function Ψ′(z).

Lanczos’ Paper: Details and Proofs

Chapter 3 examines in detail Lanczos’ paper, beginning with the deriva- tion of the main formula (1.1). The derivation makes use of Fourier se- ries in a novel way by first defining an implicit function whose smooth- ness can be controlled with a free parameter r 0, and then replacing that function with its Fourier series. Specifically,≥ beginning with

∞ z t Γ(z +1)= t e− dt , Z0

10 Chapter 1. Introduction these steps yield

z+1/2 (z+r+1/2) Γ(z +1/2)=(z + r +1/2) e− √2

(1.3) π/2 √2 v(θ)r sin θ cos2z θ dθ . × π/2 log v(θ) Z− " # The function v(θ) in the integrand is defined implicitly by v(1 log v)=cos2 θ − where v is increasing, and v =0, 1,e corresponds to θ = π/2, 0,π/2, − respectively.

Denoting by fr(θ) the term in square brackets in the integrand of (1.3), and fE,r(θ) its even part, the properties of this last function are such that it can be replaced by a uniformly convergent Fourier series

a (r) ∞ f (θ)= 0 + a (r)cos(2kθ) . E,r 2 k Xk=1 Integrating this series against cos2z θ term by term then gives rise to the series Sr(z) of (1.2) with the help of a handy trigonometric integral. The derivation of (1.1) can also be carried out using Chebyshev se- ries instead of Fourier series (really one and the same), which seems closer in spirit to methods seen later for computing the coefficients ak(r). In fact, both the Fourier and Chebyshev methods can be gen- eralized to a simple inner product using Hilbert space techniques, and this is noted as well.

From the theory of Fourier series, the smoothness of fE,r(θ) governs the rate of asymptotic decrease of the coefficients ak(r), which in turn determines the region of convergence of the expansion. This funda- mental relationship motivates a detailed examination of the properties of v(θ), fr(θ) andf E,r(θ) in Chapter 4. Practical formulas for these functions are found in terms of Lambert W functions, and a few rep- resentative graphs are plotted for several values of r.

Chapter 5 addresses the convergence of the series Sr(z). Once the growth order of the ak(r) is established, a bound on the functions 1 ifk =0, Hk(z)= z (z k+1) (1.4) ··· − ( (z+1) (z+k) if k 1. ··· ≥ 11 Chapter 1. Introduction

appearing in Sr(z) is found which leads to the conclusion that Sr(z) converges absolutely and uniformly on compact subsets of Re(z) > r away from the negative integers, and thus equation (1.1) defines the− gamma function in this region. Finally, Chapter 6 addresses the practical problem of computing the ak(r). The standard method provided by Fourier theory, namely the direct integration 2 π/2 ak(r)= fE,r(θ)cos(2kθ) dθ (1.5) π π/2 Z− proves impractical due to the complicated nature of fE,r(θ). Lanczos overcomes this difficulty with the clever use of Chebyshev polynomials as follows: define 1/2 z 1/2 (z)=2− Γ(z +1/2)(z + r +1/2)− − exp (z + r +1/2) , Fr which is just the integral in (1.3), and recall the defining property of the 2kth Chebyshev polynomial:

k 2j T2k(cos θ)= C2j,2k cos θ j=0 X = cos(2kθ ) . Then (1.5) becomes

2 π/2 k a (r)= f (θ) C cos2j θdθ k π E,r 2j,2k π/2 j=0 Z− X

2 k = C (j) , π 2j,2kFr j=0 X

a simple linear combination of evaluated at integer arguments. Fr Aside from Lanczos’ method for computing the coefficients, several others are noted. In particular, a recursive method similar to Horner’s rule is described, as well as a matrix method which reduces floating point operations thus avoiding some round off error. In addition, these matrix methods provide formulas for the partial fraction decomposition of the series Sr(z) once terminated at a finite number of terms.

12 Chapter 1. Introduction

The Lanczos Limit Formula

Lanczos concludes his paper with the following formula which he claims is the limiting behaviour of (1.1), and which defines the gamma function in the entire complex plane away from the negative integers:

∞ z 1 k k2/r Γ(z + 1) = 2 lim r + ( 1) e− Hk(z) . (1.6) r →∞ "2 − # Xk=1

The Hk(z) functions here are as defined by (1.4). He gives no proof, nor any explanation of why this should be true. In Chapter 7 the limit (1.6) is proved in detail, a result termed the “Lanczos Limit Formula” in this work. The proof is motivated by the plots in Figure 1.8 of the function fr(θ) from equation (1.3). Notice that as r increases, the area un-

√2e2 r=2

fr(θ)

√2e r=1

√2 r=0

π π 0 − 2 2 Figure 1.8: f (θ), π/2 θ π/2 r − ≤ ≤

13 Chapter 1. Introduction

der fr(θ) appears to be increasingly concentrated near θ = π/2 where r fr(π/2) = √2e . er The limit formula (1.6) suggests a rescaling of fr(θ)to r/(2π)fer(θ)e− , which decays rapidly to zero on [ π/2,π/2] except at θ = π/2 where p it has the value r/π. This behaviour− is reminiscent of that of the Gaussian distribution r/π exp [ r(θ π/2)2]on( ,π/2], and in- p − − −∞ deed, plots of these two functions in the vicinity of θ = π/2 show a p remarkable fit, even for small values of r. With some work, the limiting value of (1.3) is shown to be expressible in the form

z ∞ 2z r(θ π/2)2 Γ(z +1/2) = lim r cos θ√re− − dθ r →∞ Z−∞ which, upon replacement of cos2z θ by its Fourier series, gives rise to the coefficients via

1 ∞ 1/2 r(θ π/2)2 k k2/r cos (2kθ)r e− − dt =( 1) e− . √π − Z−∞ A comparison of (1.6) with the main formula (1.1) suggests that for large r, πr ak(er) k k2/r ( 1) e− , (1.7) 2 eer ∼ − r and plots of these coefficients for various r values supports this rela- tionship. From the smoothness analysis of fr(θ) it follows that ak(r)= 2r O k−⌈ ⌉ . Yet, (1.7) suggests a much more rapid decrease of the coef- ficients for large fixed r and increasing k. Indeed, in his paper, Lanczos  states

Generally, the higher r becomes, the smaller will be the value of the coefficients at which the convergence begins to slow down. At the same time, however, we have to wait longer, before the asymptotic stage is reached.

Although he does not make precise quantitatively how this conclusion is reached, it seems likely based on the comparison (1.7). Note that this description is precisely the behaviour of the coefficients observed at the beginning of this chapter. Unfortunately, the proof of the Lanczos Limit Formula does not clarify quantitatively Lanczos’ observation, but it does shed some light on what perhaps motivated him to make it in the first place.

14 Chapter 1. Introduction

Error Discussion

To use Lanczos’ formula in practice, the series Sr(z) is terminated at a finite number of terms, and an estimate of the resulting (relative) error is therefore required. Chapter 8 begins with a survey of existing error considerations found in the literature, followed by the two prin- cipal results of the chapter. The first is a simple empirical method for bounding the relative error. The second is an observation about the behaviour of the relative error as z . This observation leads to | |→∞ improved error bounds for certain choices of r as a function of the series truncation order n. For the purposes of error estimation, one need only be concerned with Re(z) 0 since the reflection formula ≥ πz Γ(1 + z)Γ(1 z)= − sin πz provides estimates for gamma in the left hand plane if the function in right half plane is known. For notation, write

Sr(z)=Sr,n(z)+ǫr,n(z)

where Sr,n(z) is the sum of the first n terms and

∞ ǫr,n(z)= ak(r)Hk(z) . k=Xn+1 Following Lanczos, the function ǫr,n(z) is considered the relative error, which differs slightly from the standard definition, but which matters little when it comes to bounding the error. Lanczos gives, for Re(z) 0, uniform bounds on ǫ (z) for seven combinations of n and r values≥ | r,n | but does not provide precise details as to how he obtains these figures. Attempts to reproduce his estimates based on his description were not successful, and no examination of his estimates appears elsewhere in the literature. Lanczos’ figures do appear correct, however, based on the new estimation method which follows.

In order to bound ǫr,n(z) , observe that ǫr,n(z) is an analytic func- tion on Re(z) 0. It turns| out| that ≥ n a0(r) lim ǫr,n(z)=1 ak(r) , z − 2 − | |→∞ Xk=1 15 Chapter 1. Introduction

a constant denoted ǫr,n∞ , the error at infinity. Under these conditions, as a consequence of the maximum modulus principle, the maximum of ǫr,n(z) on Re(z) 0 must occur on the line Re(z) = 0, possibly at infinity.| | Furthermore,≥ thanks to the Schwartz reflection principle, this maximum will occur on the positive imaginary axis. Thus to bound ǫ (z) on Re(z) 0, it is sufficient to bound ǫ (it) ,0 t< : | r,n | ≥ | r,n | ≤ ∞ still a daunting task. The problem is overcome by first transforming the domain to a finite interval via the mapping z(t)=it/(1 t), 0 t<1, − ≤ and then observing that under this mapping the functions Hk(z(t)) have the simple well behaved form

k 1 − t(i + j) j H (z(t)) = − . k t(i j 1)+ j +1 j=0 Y − − Thus the maximum of ǫ (z) on Re(z) 0 can be easily estimated | r,n | ≥ empirically by examining the first few terms of ǫ (z(t)) on 0 t<1. | r,n | ≤ This estimation method is used to examine the dependence of ǫr,n(z) on both the truncation order n and the parameter r. The prevailing thought in the literature is that n should be chosen as a function of r; the approach to the problem here is just the opposite: r is selected as a function of n, with surprising results. Using the relative error in Stirling’s formula as a guide, the question is: for a given value of n, can r be chosen so that the relative error at infinity is zero? That is,

does ǫr,n∞ = 0 have solutions? This question motivated an extensive numerical examination of the relative error functions ǫr,n(z) andǫ r,n∞ for n =0,...,60. The results of this investigation are tabulated in Appendix C.

Experimentally, ǫr,n∞ = 0 was found to have a finite number of real solutions. For the values 0 n 60 examined, ǫr,n∞ had at most 2n +2 real zeros located between≤r =≤ 1/2 and r = n + 4. Furthermore, − for each n, the largest zero of ǫr,n∞ was found to give the least uniform bound on ǫ (z) . For example, Lanczos gives the following uniform | r,n | error bounds for various values of n and r (for Re(z) 0): ≥

16 Chapter 1. Introduction

n r ǫ (z) < | r,n | 1 1 0.001 1 1.5 0.00024 5 2 2 5.1 10− × 6 3 2 1.5 10− × 6 3 3 1.4 10− × 8 4 4 5 10− × 10 6 5 2 10− ×

By contrast, selecting r to be the largest zero of ǫr,n∞ yields the following dramatically improved uniform error bounds (again, for Re(z) 0): ≥

n r ǫr,n(z) < | | 4 1 1.489194 1.0 10− × 7 2 2.603209 6.3 10− × 8 3 3.655180 8.5 10− × 9 4 4.340882 4.3 10− × 12 6 6.779506 2.7 10− ×

Comparison of Calculation Methods

The purpose of this chapter is to compare the methods of Lanczos, Spouge and Stirling in the context of an extended precision compu- tation. For each method, a detailed calculation of Γ(20 + 17i) with 32 relative error ǫρ < 10− is carried out. Additionally, formulas for | | 32 Γ(1 + z) with uniform error bound of 10− are given for each. The conclusion is that each method has its merits and shortcomings, and the question of which is best has no clear answer. For a uniformly bounded relative error, Lanczos’ method seems most efficient, while Stirling’s series yields very accurate results for z of large modulus due to its error term which decreases rapidly with increasing z . Spouge’s method, on the other hand, is the easiest to implement thanks| | to its simple formulas for both the series coefficients and the error bound.

Consequences and Extensions of the Theory

Chapter 10 discusses a variety of results which follow from various as- pects of Lanczos’ paper and the theory of earlier chapters.

17 Chapter 1. Introduction

The main result is a generalization of the integral transform in (1.3) which is termed a “Lanczos transform” in this work. Briefly, if F (z) is defined for Re(z) 0as ≥ π/2 F (z)= cos2z θg(θ) dθ π/2 Z− where g(θ) L2[ π/2,π/2] is even, then ∈ − Γ(z +1/2) 1 z z(z 1) F (z)=√π a + a + a − + . Γ(z +1) 2 0 1 z +1 2 (z +1)(z +2) ···  

The ak in the series are the Fourier coefficients of g(θ), and these are given by 2 k a = C F (j) , k π 2j,2k j=0 X exactly as in the gamma function case. Again, just as in the gamma function case, the smoothness of g has a direct influence on the domain and speed of convergence of the series. The relative error resulting from truncating the series at a finite number of terms is constant at infin- ity, and so the empirical error bounding methods used in the gamma function case also apply to the more general Lanczos transform. Aside from the Lanczos transform, two non-trivial combinatorial identities which follow directly from the Lanczos Limit Formula are noted. The third result is a variation on Stirling’s formula. A result of the work in previous chapters was the one term approximation

(z+1/2) (z+r+1/2) Γ(z +1)=(z + r +1/2) e− √2π (1 + ǫr,0(z)) , . where r =0.319264, the largest zero of ǫr,∞0, and ǫr,0(z) < 0.006 every- where in the right-half plane Re(z) 0. The natural| question| is: can ≥ r be chosen as a function of z so that ǫr(z),0(z) = 0, thus yielding

(z+1/2) (z+r(z)+1/2) Γ(z +1)=(z + r(z)+1/2) e− √2π ?

The answer is shown to be yes, with the help of Lambert W functions, and numerical checks indicate that the functions r(z) vary little over the entire real line.

18 Chapter 1. Introduction

Future Work and Outstanding Questions

The concluding chapter notes a number of outstanding questions and areas requiring further investigation. This topic is broken down into three categories: unresolved problems from Lanczos’ paper itself, ques- tions arising out of the theory developed in this study, particularly with respect to error bounds, and finally, a conjectured deterministic algorithm for calculating the gamma function based on the numerical evidence of Appendix C. The last of these is of greatest practical interest. Letting r(n) denote the largest zero of ǫ∞ and M the maximum of ǫ (it) for 0 r,n r(n),n | r,n | ≤ t< , a plot of (n, log M ) reveals a near perfect linear trend ∞ − r(n),n n = a log Mr(n),n + b. The algorithm is then clear: given ǫ>0, select n = − a log ǫ + b , and setr = r(n). Then (1.1) truncated after the ⌈− ⌉ nth term computes Γ(1 + z) with a uniformly bounded relative error of at most ǫ. Although a proof is not available at present, the data is compelling and further investigation is warranted.

19 Chapter 2 A Primer on the Gamma Function

This chapter gives a brief overview of the history of the gamma func- tion, followed by the definition which serves as the starting point of Lanczos’ work. A summary of well known results and identities involv- ing the gamma function is then given, concluding with a survey of two computational methods with examples: Stirling’s series and Spouge’s method. The introductory material dealing with the definition and resulting identities is standard and may be safely skipped by readers already familiar with the gamma function. The computational aspects of the function, on the other hand, may be less familiar and readers may therefore wish to include the material starting with Section 2.5.

2.1 First Encounters with Gamma

Most any student who has taken a mathematics course at the senior secondary level has encountered the gamma function in one form or another. For some, the initial exposure is accidental: n! is that button on their scientific calculator which causes overflow errors for all but the first few dozen integers. The first formal treatment, however, is typically in the study of permutations where for integer n 0 the factorial function first makes an appearance in the form ≥

1 ifn =0, n!= n(n 1)! else. ( −

20 Chapter 2. A Primer on the Gamma Function

Once some familiarity with this new object is acquired (and students are convinced that 0! should indeed equal 1), it is generally applied to counting arguments in combinatorics and probability. This is the end of the line for some students. Others continue on to study calculus, where n! is again encountered in the freshman year, typically in the result dn xn = n! dxn for n a non-negative integer. Closely related to this result is the ap- pearance of n! in Taylor’s formula. Some are asked to prove

∞ n t n!= t e− dt (2.1) Z0 as homework, while a fortunate few learn how (2.1) “makes sense” for non-integer n. Some even go so far as to prove

n n n! √2πnn e− as n . ∼ →∞ At this point the audience begins to fracture: some leave math- ematics and the gamma function forever, having satisfied their credit requirement. Others push on into engineering and the physical sciences, and a few venture into the more abstract territory of pure mathemat- ics. The last two of these groups have not seen the end of the gamma function. For the physical scientists, the next encounter is in the study of differential equations and Laplace transform theory, and for those who delve into asymptotics, computation of the gamma function is a classic application of the saddle point method. In statistics the gamma function forms the basis of a family of density functions which includes the exponential and chi-square distributions. For the mathematicians the show is just beginning. In complex analysis they learn that not only can the gamma function be extended to non-integer arguments, but even to an analytic function away from the negative integers. Computationally, they learn about Stirling’s for- mula and the associated Stirling series. In number theory, the gamma function is the springboard for developing the analytic continuation of Riemann’s zeta function ζ(s), which leads into the prime number theorem and a tantalizing glimpse of the Riemann Hypothesis. The gamma function has many guises, but exactly how is it defined, and more importantly for our purposes, how does one compute it? So

21 Chapter 2. A Primer on the Gamma Function far, a precise definition of the function, and notation for it (save the n! used) has been avoided. The gamma function is a generalization of n!, but the question remains: what definition generalizes the factorial function in the most natural way?

2.2 A Brief History of Gamma

Most works dealing with the gamma function begin with a statement of the definition, usually in terms of an integral or a limit. These def- initions generalize the factorial n!, but there are many other functions which interpolate n! between the non-negative integers; why are the standard definitions the “right” ones? The life of gamma is retraced in the very entertaining paper of Davis [6], according to which the year 1729 saw “the birth” of the gamma function as Euler studied the pattern 1, 1 2, 1 2 3, ... . · · · The problem was simple enough: it was well known that interpolating formulas of the form n(n +1) 1+2+ + n = ··· 2 existed for sums; was there a similar formula f(n)=1 2 n for prod- ucts? The answer, Euler showed, was no; the products· 1···2 n would · ··· require their own symbol. The notation n! was eventually adopted (though not universally) to denote the product, however this notation did not arrive on the scene until 1808 when C. Kramp used it in a paper. Today the symbol n! is normally read “n-factorial”, although some early English texts suggested the somewhat amusing reading of “n-admiration”. Refer to [4] for a detailed history of the notation. Euler went on further and found representations of the factorial which extended its domain to non-integer arguments. One was a prod- uct m!(m +1)x x! = lim , (2.2) m (x +1) (x + m) →∞ ··· and the second an integral representation:

1 x!= ( log t)x dt . (2.3) − Z0

22 Chapter 2. A Primer on the Gamma Function

The product (2.2) converges for any x not a negative integer. The integral (2.3) converges for real x> 1. The substitution u = log t puts (2.3) into the more familiar form− −

∞ x u x!= u e− du . Z0 In 1808 Legendre introduced the notation which would give the gamma function its name1. He defined

∞ x 1 t Γ(x)= t − e− dt , (2.4) Z0 so that Γ(n +1)=n!. It is unclear why Legendre chose to shift the argument in his notation. Lanczos remarks in the opening paragraph of his paper [14]:

The normalization of the gamma function Γ(n + 1) in- stead of Γ(n) is due to Legendre and void of any rationality. This unfortunate circumstance compels us to utilize the no- tation z! instead of Γ(z + 1), although this notation is ob- viously highly unsatisfactory from the operational point of view.

Lanczos’ was not the only voice of objection. Edwards, in his well- known treatise on the [8], reverts to Gauss’ notation Π(s)=s!, stating:

Unfortunately, Legendre subsequently introduced the no- tation Γ(s) for Π(s 1). Legendre’s reasons for considering (n 1)! instead of n!− are obscure (perhaps he felt it was more natural− to have the first pole occur at s = 0 rather than at s = 1) but, whatever the reason, this notation prevailed in France− and, by the end of the nineteenth century, in the rest of the world as well. Gauss’s original notation appears to me to be much more natural and Riemann’s use of it gives me a welcome opportunity to reintroduce it.

It is true, however, that (2.4) represents Γ(x) as the Mellin transform of exp ( t), so that Legendre’s normalization is the right one in some − 1Whittaker and Watson [30] give 1814 as the date, however.

23 Chapter 2. A Primer on the Gamma Function sense, though Mellin was not born until some twenty one years after Legendre’s death. An interesting recent investigation into the history of the Γ notation appears in the paper by Gronau [10]. The question remains, are Euler’s representations (2.2) and (2.3) the “natural” generalizations of the factorial? These expressions are equivalent for x> 1 (see [16]), so consider the integral form (2.3), or equivalently, (2.4).− Some compelling evidence in support of (2.4) comes in the form of the complete characterization of Γ(x) by the Bohr- Mollerup theorem (see [23]): Theorem 2.1. Suppose f :(0, ) (0, ) is such that f(1) = 1, f(x +1)=xf(x), and f is log-convex.∞ → Then∞f =Γ.

So as a function of a real variable, Γ(x) has nice behaviour. But if gamma is extended beyond the real line, its properties are even more ∞ z 1 t satisfying: as a function of a complex variable z,Γ(z)= 0 t − e− dt defines an analytic function on Re(z) > 0. Along with the fundamental R recursion Γ(z +1) = zΓ(z), Γ can then be extended to an analytic function on z C 0, 1, 2, 3,... . Indeed, Euler’s formula (2.2) ∈ \{ − − − } converges and defines Γ on this same domain. The definition created to describe a mathematical object is an arti- ficial absolute which, it is hoped, precisely captures and describes every aspect which characterizes the object. However, it is impossible to state with certainty that a particular definition is in some way the correct one. In the present case, a definition of the correct generalization of n! is sought. The Bohr-Mollerup theorem and the analytic properties of Euler’s Γ strongly suggest that (2.4) is indeed the right definition. The appearance of Euler’s Γ in so many areas of mathematics, and its natural relationship to so many other functions further support this claim. This viewpoint is perhaps best summarized by Temme in [28]: This does not make clear why Euler’s choice of general- ization is the best one. But, afterwards, this became abun- dantly clear. Time and again, the Euler gamma function shows up in a very natural way in all kinds of problems. Moreover, the function has a number of interesting proper- ties.

∞ z 1 t So is Γ(z)= 0 t − e− dt the natural extension of n! ? It seems so, and we will take it as such and study its properties, and in particular, R how to compute it.

24 Chapter 2. A Primer on the Gamma Function 2.3 Definition of Γ

As noted, there are several equivalent ways to define the gamma func- tion. Among these, the one which served as the starting point for Lanczos’ paper [14] will be used: Definition 2.1. For z C with Re(z) > 1, the gamma function is ∈ − defined by the integral

∞ z t Γ(z +1)= t e− dt . (2.5) Z0 From this definition, we immediately state Theorem 2.2. For Γ(z +1)defined by (2.5):

(i) Γ(z +1)is analytic on Re(z) > 1; − (ii) Γ(z +1)=zΓ(z) on Re(z) > 0 ;

(iii) Γ(z +1) extends to an analytic function on C with simple poles at the negative integers.

Proof of Theorem 2.2:

z t (i) Let Ω denote the domain Re(z) > 1. The integrand of ∞ t e− dt − 0 is continuous as a function of t and z, and for fixed t>0 is ana- R lytic on Ω. Further the integral converges uniformly on compact subsets of Ω. Hence Γ(z + 1) is analytic on Ω.

(ii) For Re(z) > 0, integrating by parts gives

∞ z t Γ(z +1)= t d( e− ) − Z0 z t ∞ z 1 t = t e− ∞ + z t − e− dt − 0 Z0 = zΓ(z) 

(iii) For Re(z) > 0 and any integer n 0, the fundamental recursion Γ(z +1)=zΓ(z) implies ≥ Γ(z + n +1) Γ(z)= n . (2.6) k=0(z + k)

25Q Chapter 2. A Primer on the Gamma Function

The right hand side of (2.6) is analytic on Re(z) > n 1, z not − − a negative integer, and is equal to Γ(z)onRe(z) > 0. Hence (2.6) is the unique analytic continuation of Γ(z) to the right half plane Re(z) > n 1, z not a negative integer. Since n was an arbitrary − − non-negative integer, Γ(z) can be extended to an analytic function on C 0, 1, 2, 3,... . \{ − − − } For z = n a negative integer, (2.6) shows that Γ has a simple pole with− residue

Γ(z + n +1) lim (z + n)Γ(z) = lim (z + n) n z n z n →− →− k=0(z + k) Γ(1) = n 1 Q − ( n + k) k=0 − 1 = Qn 1 − ( n + k) k=0 − ( 1)n = Q− . n!

An interesting generalization of (2.5) due to Cauchy leads to another analytic continuation of the gamma function. Let σ = Re( z 1). Then − − k ∞ z t ( t) Γ(z +1)= t e− − dt . (2.7) − k! 0 0 k<σ ! Z ≤X An empty sum in the integrand of (2.7) is to be considered zero. This integral converges and is analytic for z C such that Re(z) = 1, 2, 3,... and reduces to (2.5) if Re(z) >∈ 1. See [30, pp.243–6 − − − − 244] Figure 2.1 shows a graph of Γ(z +1) for z real. Note the the poles at z = 1, 2,... and the contrast between the distinctly different behaviours− of− the function on either side of the origin. Figure 2.2 shows a surface plot of Γ(x + iy) which illustrates the behaviour of the function away from the| real axis.|

26 Chapter 2. A Primer on the Gamma Function

Γ(z +1)

3

2 2 z −

3 −

Figure 2.1: Γ(z +1), 4

2.4 Standard Results and Identities

From the proof of Theorem 2.2 it is clear that the fundamental recursion Γ(z +1)=zΓ(z) holds for all z C 0, 1, 2, 3,... . There are many more properties of the gamma∈ \{ function− − which− follow} from the definition and Theorem 2.2. The main ones are stated here without proof; the interested reader is referred to [16, pp. 391–412] for details. The first result is Euler’s formula n!nz Γ(z) = lim (2.8) n z(z +1) (z + n) →∞ ··· which converges for all z C 0, 1, 2, 3,... . This identity follows ∈ \{n − −t n −z 1 } from integrating by parts in 1 t − dt to get 0 − n n n z t Rz 1  n!n 1 t − dt = − n z(z +1) (z + n) Z0   ··· 27 Chapter 2. A Primer on the Gamma Function

6

3

0 2 2 − 0 0 2 2 y x −

Figure 2.2: Γ(x + iy) , 3

and then letting n . →∞ Rewriting (2.8) in reciprocal form as

n z(z +1) (z + n) z( log n+Pn 1/k) z z/k lim ··· = lim ze − k=1 1+ e− n z n →∞ n!n →∞ k kY=1   yields the Weierstrass product

∞ 1 γz z z/k = ze 1+ e− . (2.9) Γ(z) k kY=1   The γ appearing in (2.9) is the Euler (or sometimes Euler- Mascheroni) n constant γ = limn (1/k) log n 0.5772 . →∞ k=1 − ≈ ··· Writing both Γ(z)P and Γ( z) using (2.9) and recalling the infinite −

28 Chapter 2. A Primer on the Gamma Function product representation of the sine function

∞ z2 sin z = z 1 , − k2π2 Yk=1   we arrive at the very useful reflection formula πz Γ(1 + z)Γ(1 z)= . (2.10) − sin πz Equation (2.10) is of great practical importance since it reduces the problem of computing the gamma function at arbitrary z to that of z with positive real part.

2.5 Stirling’s Series and Formula

Among the well known preliminary results on the gamma function, one is of particular importance computationally and requires special atten- tion: Stirling’s series. This is an asymptotic expansion for Γ(z +1) which permits evaluation of the function to any prescribed accuracy, and variations of this method form the basis of many calculation rou- tines.

2.5.1 The Formula

Stirling’s series is named after James Stirling (1692–1770) who in 1730 published the simpler version for integer arguments commonly known as Stirling’s Formula. The more general Stirling’s series can be stated thus:

N log Γ(z +1) (z + k) =(z + N +1/2)log(z + N) " # Yk=1 1 (z + N)+ log2π − 2 (2.11) n B + 2j 2j(2j 1)(z + N)2j 1 j=1 − X − ∞ B (x) 2n dx . − 2n(z + N + x)2n Z0

29 Chapter 2. A Primer on the Gamma Function

The product in the left hand side of (2.11) is understood to be one if N = 0. TheB 2j are the Bernoulli numbers, which are defined by writing t/(et 1) as a Maclaurin series: − t ∞ B = j tj . et 1 j! j=0 − X th The function B2n(x)isthe2n Bernoulli polynomial defined over R by periodic extension of its values on [0, 1]. By judiciously selecting n and N the absolute error in log Γ(z +1), that is, the absolute value of the integral term in (2.11), can be made as small as desired, and hence the same can be achieved with the relative error of Γ(z + 1) itself. Equation (2.11) is valid in the so-called slit plane C t R t N . \{ ∈ | ≤− } Equation (2.11) with N = 0 is derived using Euler-Maclaurin sum- mation. Alternatively, again with N = 0, begin with the formula of Binet obtained from an application of Plana’s theorem,

1 ∞ arctan (t/z) log Γ(z +1)=(z +1/2) log z z + log2π +2 dt , − 2 e2πt 1 Z0 − and expand arctan(t/z) in the last term into a Taylor polynomial with remainder. The resulting series of integrals produce the terms of (2.11) containing the Bernoulli numbers [30, pp.251–253]. The gen- eral form (2.11) with N 1 is obtained by replacing z with z + N and ≥ applying the fundamental recursion. Exponentiation of Stirling’s series (with N = 0) yields Stirling’s asymptotic formula for Γ(z + 1) itself:

z z+1/2 1/2 1 1 Γ(z +1)=e− z (2π) 1+ + + . (2.12) 12z 288z2 ···   Equation (2.12) also follows from applying Laplace’s method (or equiva- lently, the saddle point method) to (2.5). Truncating the series in (2.12) after the constant term yields the familiar Stirling’s formula noted in the introduction: z z Γ(z +1) √2πzz e− as z . (2.13) ∼ | |→∞ It may be tempting to let n in (2.11) with the hope that the integral error term will go to zero,→∞ but unfortunately the series contain- ing the B2j becomes divergent. The terms of this sum initially decrease

30 Chapter 2. A Primer on the Gamma Function in modulus, but then begin to grow without bound as a result of the rapid growth of the Bernoulli numbers. The odd Bernoulli numbers are all zero except for B1 = 1/2, while for the even ones, B0 = 1, and for j 1, − ≥ ( 1)j+12(2j)!ζ(2j) B = − . (2.14) 2j (2π)2j 2j 2j Since ζ(2j)= ∞ k− 1 rapidly with increasing j, B = O ((2j)!(2π)− ) k=1 → 2j (see [8, p.105]). P What is true, however, is that the integral error term in (2.11) tends to zero uniformly as z in any sector arg(z + N) δ<π. In | |→∞ | |≤ terms of Γ(z + 1) itself, this means the relative error tends to zero uniformly as z in any sector arg(z + N) δ<π. | |→∞ | |≤ In order to use (2.11) to evaluate the gamma function, an estimate of the error (as a function of n, N, andz ) is required when the integral term of (2.11) is omitted. The following result is due to Stieltjes [8, p.112]:

Theorem 2.3. Let θ = arg(z + N), where π<θ<π, and denote − the absolute error by

∞ B (x) E (z)= 2n dx . N,n 2n(z + N + x)2n Z0 Then

1 2n+2 B E (z) 2n+2 . (2.15) | N,n |≤ cos (θ/2) (2n + 2)(2n +1)(z + N)2n+1  

In other words, if the series in (2.11) is terminated after the B2n term and the integral term is omitted, the resulting error is at most 2n 2 (cos(θ/2))− − times the B2n+2 term. To get an idea of how to use Stirling’s series and the error esti- mate (2.15), consider the following

Example 2.1. Compute Γ(7+13i) accurate to within an absolute error 12 of ǫ =10− .

Solution: For convenience, let EN,n denote the integral error term EN,n(6+13i) in this example. The first task is to translate the absolute

31 Chapter 2. A Primer on the Gamma Function

12 bound ǫ =10− on the error in computing Γ(7 + 13i) into a bound on EN,n. Letlog(GP N ) denote the left hand side of (2.11), where G represents the true value of Γ(7 + 13i) and PN the product term. Let log GN,n denote the right hand side of (2.11) without the integral error term. Then (2.11) becomes

log(GPN )=logGN,n + EN,n ,

so that GN,n G = eEN,n , PN and the requirement is

GN,n GN,n eEN,n <ǫ. P − P N N

That is, it is desired that ǫ eEN,n 1 < − GN,n/PN | | from which E E2 ǫ E 1+ N,n + N,n + < . | N,n| 2! 3! ··· G /P N,n N | |

The infinite series is at most e in modulus provided EN,n 1, so that if E < ǫ/( e G /P ), the prescribed accuracy is guaranteed.≤ This | N,n| | N,n N | last estimate is self-referencing, but GN,n/PN can be estimated using Stirling’s formula (2.13). That is, we require

z 1 ǫe − EN,n < | | √ z+1/2 2πz

12 5 10− ≈ × upon setting z =6+13i. Now that a target bound for E has been determined, n and N | N,n| must now be selected to meet the target. In Table 2.1 are listed bounds on EN,n as given by (2.15) for z =6+13i and various combinations of (|N,n).|

32 Chapter 2. A Primer on the Gamma Function

n N =0 N =1 N =2 N =3 N =4 6 6 6 6 7 1 1.9 10− 1.6 10− 1.3 10− 1.1 10− 9.7 10− × 9 × 9 × 9 × 9 × 9 2 3.7 10− 2.8 10− 2.2 10− 1.7 10− 1.3 10− × 11 × 11 × 12 × 12 × 12 3 1.9 10− 1.3 10− 9.1 10− 6.4 10− 4.4 10− × 13 × 13 × 14 × 14 × 14 4 1.9 10− 1.2 10− 7.3 10− 4.6 10− 2.9 10− × 15 × 15 × 16 × 16 × 16 5 2.9 10− 1.6 10− 9.3 10− 5.3 10− 3.1 10− × × × × × Table 2.1: Upper bound on E (6+13i) in Stirling Series | N,n |

We can see that N = 0 withn = 4 is sufficient to produce the desired accuracy. Using these values with z =6+13i, and leaving off the error term in (2.11) then gives

logΓ(7 + 13i) log G ≈ 0,4 1 = (6+13i +1 /2)log(6+ 13i) (6+13i)+ log2π − 2 4 B + 2j 2j(2j 1)(6 + 13i)2j 1 j=1 − − . X = 2.5778902638380984 + i 28.9938056395651838 . −

Taking exponentials yields the final approximation . Γ(7 + 13i) G = 0.0571140842611710 i 0.0500395762571980 . ≈ 0,4 − − Using the symbolic computation package Maple with forty digit preci- . sion, the absolute error in the estimate is found to be Γ(7 + 13i) G0,4 = 15 | − | 2.5 10− , which is well within the prescribed bound. × Observe from Table 2.1 that N = 4 withn = 3 would also have given the desired accuracy, in which case only n = 3 terms of the series would be needed.

The reader has no doubt noticed the ad-hoc manner in which n and N were selected in this example. The question of how best to choose n and N given z and absolute error ǫ is not an easy one, and will not be addressed here.

33 Chapter 2. A Primer on the Gamma Function

It is a simpler matter, however, to determine the maximum accuracy that can be expected for a given choice of N, both for a fixed z and uniformly, and this is done in the following sections.

2.5.2 Some Remarks about Error Bounds

From Table 2.1 it may seem difficult to believe that as n continues to increase, the error will reach a minimum and then eventually grow without bound. However, for a fixed z and N it is possible to determine the value of n which gives the least possible error bound that can be achieved with (2.15). More generally, for each N 1, it is possible to establish the best possible uniform error estimate≥ reported by (2.15) for Re(z) 0. ≥ In the following discussion, let 1 2n+2 B U (z)= 2n+2 , N,n cos (θ/2) (2n + 2)(2n +1)(z + N)2n+1   which is the right hand side of (2.15). Recall that θ =arg(z + N).

Minimum of |UN,n(6 + 13i)|

For each N, what is the best accuracy that can be achieved in Exam- ple 2.1 using the error estimate in Stirling’s Series (2.15)? Throughout this section let U = U (6+13i) . To find the minimum value of | N,n| | N,n | UN,n , withN fixed, it is sufficient to determine the n value at which the| sequence| of U changes from decreasing to increasing, which cor- | N,n| responds to the first n such that UN,n/UN,n+1 1. Using the explicit form of the Bernoulli numbers (2.14),| the task|≤ then is to find the least n such that (2π)2(z + N)2 cos2 (θ/2) ζ(2n +2) 1 . (2n + 2)(2n +1) ζ(2n +4) ≤

That is, we want the least n satisfying

3 1 ζ(2n +4) π(z + N)cos(θ/2) n 1+ + . | |≤ 2n 2n2 ζ(2n +2) s  The square root term is at most √14π/7 when n = 1 and decreases to 1 rapidly, so that if n is chosen n π z + N cos (θ/2) (2.16) ≈⌈ | | ⌉ 34 Chapter 2. A Primer on the Gamma Function a minimal error should result. In the case of z =6+13i, cos(θ/ 2) = 1/2+3/√205 and N =0, (2.16) predicts a minimum error for n =q 38. Using Maple the cor- 34 responding error is found to be E < 1.3 10− . This bound is | 0,38| × impressive, but bear in mind that the corresponding Bernoulli number required to achieve this is B 8 1050. This is the best possible | 76|≈ × accuracy for z =6+13i with N = 0; greater accuracy is possible as N is increased from zero. For example, with N = 4, (2.16) predicts a 42 minimum error for n = 47, at which E < 6.7 10− . | 4,47| ×

Uniform Bound of |UN,n(z)|

As demonstrated, for fixed z and N there is a limit to the accuracy which can be achieved by taking more and more terms of the Stirling series. It is worthwhile to determine this limiting accuracy in the form of the best possible uniform error bound as a function of N 0. By the reflection formula (2.10), it is enough to consider only the right≥ half plane Re(z) 0. Now for N 0 fixed andz + N = u + iv, UN,n(z) will be worst≥ possible where ≥ | |

cos (θ/2) 2n+2 u + iv 2n+1 | | | | is a minimum in u N. IfN = 0, letting u + iv 0 along the positive ≥ → real axis shows that U grows without bound. Assume then that | 0,n| N 1. Writing cos(θ/2) = (1 + cos θ)/2 and cosθ = u/√u2 + v2 puts≥ (2.5.2) in the form p 1 n/2 n+1 cos (θ/2) 2n+2 u + iv 2n+1 = u2 + v2 √u2 + v2 + u | | | | 2n+1    which is clearly minimized when u and v are minimized, that is, at v =0andu = N. In terms ofz and θ, this says that UN,n(z) is worst possible at z = θ = 0. By (2.16), n should then be chosen| n | πN , ≈⌈ ⌉

35 Chapter 2. A Primer on the Gamma Function and we have B U 2n+2 | N,n|≤ (2n + 2)(2n +1)N 2n+1

2(2n +2)!ζ(2n +2) = from (2.14) (2π)2n+2(2n +2)(2n +1)N 2n+1

2(2n)! since ζ(2n +2) 1 ≈ (2π)2n+2N 2n+1 ≈

2 √4πn(2n)2n e 2n − from (2.13) ≈ (2π)2n+2N 2n+1

e 2πN = − upon setting n πN . π√N ≈

So selecting n πN results in a uniform bound which decreases rapidly with N. The≈⌈ problem⌉ remains, however, that the larger N, and hence n becomes, so too do the Bernoulli numbers required in the Stirling series. In practice, unless one is dealing with z values near the origin, one can use much smaller values of N which result in acceptable error bounds.

2.6 Spouge’s Method

To conclude this survey of standard results, special mention is made of the 1994 work of Spouge [27]. In that work, the author develops the formula N z+1/2 (z+a) 1/2 ck(a) Γ(z +1)=(z + a) e− (2π) c0 + + ǫ(z) (2.17) " z + k # Xk=1 which is valid for Re(z + a) > 0. The parameter a is real, N = a 1, (z+1/2) z+a ⌈ ⌉−1/2 c0(a)=1andck(a) is the residue of Γ(z +1)(z + a)− e (2π)− at z = k. Explicitly, for 1 k N, this is − ≤ ≤ k 1 1 ( 1) − k 1/2 k+a ck(a)= − ( k + a) − e− . (2.18) √2π (k 1)! − − 36 Chapter 2. A Primer on the Gamma Function

Spouge’s formula has the very simple relative error bound ǫS(a, z) ǫ(z) ǫ (a, z) = | S | Γ(z +1)(z + a) (z+1/2)ez+a(2π) 1/2 − −

√a 1 < , (2π)a+1/2 Re(z + a)

provided a 3. Thus for z in the right half plane Re(z) 0, ǫS(a, z) has the uniform≥ bound ≥ 1 ǫ (a, z) < . (2.19) | S | √a(2π)a+1/2

Though similar in form to Lanczos’ formula (note for example, the free parameter a), Spouge’s work differs greatly in the derivation, mak- ing extensive use of complex analysis and residue calculus. To see how Spouge’s method works in practice, we revisit the com- putation of Γ(7 + 13i) from Example 2.1: Example 2.2. Estimate Γ(7+13i) accurate to within an absolute error 12 of ǫ =10− using Spouge’s method.

12 Solution: An absolute error bound of ǫ<10− means the relative error must be bounded by ǫ ǫ (a, z) < | S | Γ(7 + 13i)

10 12e6+13i − by Stirling’s formula ≈ √ 6+13i+1/2 2π(6+13i)

. 11 =1.3 10− . ×

By plotting ǫS(a, 6+13i) , a =12.5 and hence N = 12 terms of the series (2.17)| are sufficient| to achieve this bound. The calculation of the coefficients (2.18) for these values yields Table 2.2. Equation (2.17)

37 Chapter 2. A Primer on the Gamma Function

k ck(a) 0 +1.0000000000000 100 × 1 +1.3355050294248 105 × 2 4.9293093529936 105 − × 3 +7.4128747369761 105 × 4 5.8509737760400 105 − × 5 +2.6042527033039 105 × 6 6.5413353396114 104 − × 7 +8.8014596350842 103 × 8 5.6480502412898 102 − × 9 +1.3803798339181 101 × 2 10 8.0781761698951 10− − × 5 11 +3.4797414457425 10− × 12 12 5.6892712275042 10− − × Table 2.2: Coefficients of Spouge’s Series, a =12.5

then gives Γ(7 + 13i) 0.0571140842611682 i0.0500395762571984, ≈− − 16 which differs in absolute value from Γ(7 + 13i) by less than 2.9 10− . × Compared to Stirling’s series, many more terms of Spouge’s series are required to achieve the same accuracy, but the individual terms are much easier to compute, and the selection criterion for a and hence N is straightforward.

Spouge’s work is important for several reasons. The first is that the coefficients ck(a) are simpler to compute than those of the Lanczos series. The second is that Spouge gives a simpler yet more accurate version of Stirling’s formula. And finally, Spouge’s approximation and error estimates apply not only to Γ(z + 1), but also to the digamma function Ψ(z +1)=d/dz [log Γ(z + 1)] and trigamma function Ψ′(z). To see the link between (2.17) and Lanczos’ formula (1.1), write a = r +1/2 and resolve the first N terms of the series (1.2) into partial

38 Chapter 2. A Primer on the Gamma Function fractions,

1 z z (z N +1) a (r)+a (r) + + a (r) ··· − + ǫ(z) 2 0 1 z +1 ··· N (z +1) (z + N) ··· N b (r) = b (r)+ k + ǫ(z) . 0 z + k Xk=1

Comparing this with (2.17), the bk(r) obtained from truncating the (z+1/2) z+a 1/2 Lanczos series are the approximate residues of Γ(z+1)(z+a)− e (2π)− at z = k, and the larger N becomes the better the approximation. −

2.7 Additional Remarks

The standard definition and properties of the gamma function can be found in many works dealing with special functions and analysis. For this study the especially clear treatments given in [28, pp.41–77] and [23, pp.192–195] are of note. The references [16, pp. 391–412] and [30, pp.235–264] are also worthy of mention. A thorough treatment of Stirling’s series can be found in [8, p.105]. Finally, the work of Artin [2] is of interest for the treatment of Γ(x) for x real from the point of view of convexity. For a survey and comparison of various computational methods for computing the gamma function, including Stirling’s series, see the paper by Ng [20]. Among the methods covered there is that of Spira [26] in which a simpler error bound on Stirling’s series than (2.15) is given.

39 Chapter 3 The Lanczos Formula

We arrive at last at the examination of Lanczos’ paper itself, beginning in this chapter with the derivation of the main formula (1.1). The derivation consists of three steps, which in a nutshell can be broken down as

∞ z 1/2 t Γ(z +1/2) = t − e− dt Z0

z+1/2 (z+r+1/2) =(z + r +1/2) e− √2 e z 1/2 r [v(1 log v)] − v dv (step I) × − Z0

z+1/2 (z+r+1/2) =(z + r +1/2) e− √2 π/2 √2 v(θ)r sin θ cos2z θ dθ (step II) × π/2 log v(θ) Z− " #

z+1/2 (z+r+1/2) =(z + r +1/2) e− √2

π/2 ∞ 2z a0(r) cos θ + ak(r)cos(2kθ) dθ . (step III) × π/2 " 2 # Z− Xk=0

The series in Equation (1.1) then follows from the last integral upon integrating term by term. The derivation is first retraced more or less along the same lines as Lanczos uses in his paper [14]. This approach uses Fourier series tech-

40 Chapter 3. The Lanczos Formula niques in a novel albeit complicated way to obtain explicit formulas for the coefficients an(r) as a linear combination of Chebyshev polyno- mial coefficients. The appearance of Chebyshev coefficients suggests a connection with the orthogonal system of Chebyshev polynomials, and indeed the derivation in the setting of these polynomials provides a slightly cleaner argument. Finally, both of these derivations are seen to be cases of a much more general idea, that of inner products in Hilbert space. The following notation which will be standard throughout the re- mainder of this work: Definition 3.1. Define H0(z)=1, and for k 1, ≥ Γ(z +1)Γ(z +1) H (z)= k Γ(z k +1)Γ(z + k +1) −

1 = (z +1)k(z +1) k −

z (z k +1) = ··· − . (z +1) (z + k) ···

Using this new notation, (1.1) may be restated1:

∞ z+1/2 (z+r+1/2) ′ Γ(z +1)=√2π (z + r +1/2) e− ak(r)Hk(z) . (3.1) Xk=0 3.1 The Lanczos Derivation

Lanczos uses as his starting point Euler’s formula (2.5) and transforms the integral in a series of steps. The motivation for these transforma- tions is not immediately obvious, though the effect is to extract from 1The prime notation in the sum indicates that the k = 0 term is given weight 1/2.

41 Chapter 3. The Lanczos Formula the integral a term similar in form to the first factor of Stirling’s series (2.12). The integral which remains is then precisely the form required to perform a clever series expansion. In the exposition the following conventions have been adopted:

1. The complex variable z = σ + it where σ =Re(z) andt = Im(z );

2. For a, b C with a not a negative real number or zero, define ab = eb log∈a where Im(log a) is between π and π. −

3.1.1 Preliminary Transformations

Beginning with

∞ z t Γ(z +1)= t e− dt, Re(z) > 1 , (3.2) − Z0 make the substitution t αt where Re(α) > 0 to obtain →

z+1 ∞ z αt Γ(z +1)=α t e− dt . Z0 The validity of this substitution for complex α can be shown using contour arguments or via the following lemma2:

Lemma 3.1. For Re(α) > 0 and Re(z) > 1, −

z+1 ∞ z αt Γ(z +1)=α t e− dt . Z0 Proof of Lemma 3.1: For fixed z with Re(z) > 1 andα> 0 real, replacing t with αt in (3.2) gives −

z+1 ∞ z αt Γ(z +1)=α t e− dt . Z0 Viewed as a function of α, the right hand side is analytic in the right half α-plane, and equals the constant Γ(z + 1) along the positive real

2This result can be found as an exercise in [30, p.243]. For real α>0 the result is elementary, however Lanczos makes no comment as to its validity for complex α.

42 Chapter 3. The Lanczos Formula axis. Hence the integral must equal Γ(z + 1) throughout the right half α-plane.

Next set α = z + r + 1, where r 0, so that ≥

z+1 ∞ z (z+r+1)t Γ(z +1)=(z + r +1) t e− dt, Re(z) > 1 . (3.3) − Z0 Here r 0 is a free parameter which plays a key role later. Now reduce the bounds≥ of integration to a finite case via the change of variable t =1 log v, dt =( 1/v)dv: − − 0 z+1 z (z+r+1)(1 log v) 1 Γ(z +1)=(z + r +1) (1 log v) e− − − dv e − v Z e z+1 (z+r+1) z z r 1 =(z + r +1) e− (1 log v) v v v dv 0 − v Z e z+1 (z+r+1) z r =(z + r +1) e− [v(1 log v)] v dv . (3.4) − Z0 σ+r ǫ The integrand in this last expression is O(v − ) for every ǫ>0as v 0, while it is O( v e σ)asv e . Equation (3.4) is therefore → | − | → valid for Re(z) > 1.3 − The substitution t =1 log v appears to be the key to the Lanczos method in the sense that− it puts all the right pieces in all the right places for the series expansion to come. It has the effect of peeling off

3There is an error in [17, p.30, Eq.(1)] at this point concerning the domain of convergence of the formula. There the author makes the replacement z z 1/2 and states (using σ to signify what is here denoted r): → − Γ(z +1/2) = (z + σ +1/2)z+1/2 exp [ (z + σ +1/2)]F (z), − F (z)= e[v(1 log v)]z 1/2vσ dv, Re(z + σ +1/2) > 0 . 0 − − However, the integralR F (z) diverges with, for example, z = 3/4 and a − choice of σ =5/4. To see this, note that v(1 log v) (e v) on [0,e ], so − ≤ − that [v/(e v)]5/4 [v(1 log v)] 5/4v5/4, whence − ≤ − − e e 5/4 5/4 5/4 [v/(e v)] dv [v(1 log v)]− v dv . − ≤ − Z0 Z0 But the left hand side e[v/(e v)]5/4 dv = . 0 − ∞ R 43 Chapter 3. The Lanczos Formula leading terms similar in form to Stirling’s formula, while factoring the integrand into separate powers of z and r. The sequence of substitutions used here, however, namely α (z + r +1) and t 1 log v, is quite different from the seemingly→ disconnected chain→ of sub−stitutions Lanczos uses in [14] to arrive at equation (3.4). His steps are perhaps clues to the motivation behind his method and so these are reproduced in Appendix A.

3.1.2 The Implicit Function v(θ)

The next step in the derivation is the transformation of the integral in (3.4) into a form more amenable to Fourier methods. The path of v(1 log v) is shown in Figure 3.1 so that v may be implicitly defined as a− function of θ via

cos2 θ = v(1 log v) , − where θ = π/2 corresponds to v =0,θ =0tov =1, andθ = π/2to − v = e.

1 v(1 log v) −

0 1 e v

Figure 3.1: Path of v(1 log v) −

Making the substitution v(1 log v)=cos2 θ, dv = 2 sinθ cos θ/ log vdθ −

44 Chapter 3. The Lanczos Formula in (3.4) then gives

π/2 z+1 (z+r+1) 2 z r 2 sinθ cos θ Γ(z +1)=(z + r +1) e− (cos θ) v dθ π/2 log v Z− π/2 r z+1 (z+r+1) 2z+1 2v sin θ =(z + r +1) e− cos θ dθ . (3.5) π/2 log v Z−

The integrand in (3.5) is O( θ + π/2 2σ+2r+1) nearθ = π/2, O(1) near θ = 0, but is O( θ π/2 2|σ+1)asθ| π/2 so this expression− in once again valid for Re(| z−) > |1. → − Moving a √2 outside the integral and replacing z with z 1/2, the reason for which will become apparent later4, yields −

π/2 r 2z √2v sin θ Γ(z +1/2) = Pr(z) cos θ dθ , (3.6) π/2 log v Z− " #

where Pr(z) is defined

z+1/2 (z+r+1/2) Pr(z)=√2(z + r +1/2) e− .

Now denote by fr(θ) the term in square brackets in (3.6) and by fE,r(θ) its even part [fr(θ)+fr( θ)] /2. Noting that the odd part of the inte- grand integrates out to zero− finally puts (3.6) in the form

π/2 2z Γ(z +1/2) = Pr(z) cos θfE,r(θ) dθ (3.7) π/2 Z− for Re(z) > 1/2 andr 0. Equation (3.7) is the starting point for the series expansion− in (3.1).≥

4Shifting the argument to z 1/2 at the outset, that is, starting the derivation − with ∞ z 1/2 t Γ(z +1/2) = t − e− dt, Re(z) > 1/2 − Z0 in place of equation (3.2), would seem more logical, considering the reason for the shift is yet to come anyway. For some reason Lanczos does not do this.

45 Chapter 3. The Lanczos Formula

3.1.3 Series Expansion of fE,r

The next step in the development is the replacement of fE,r(θ)bya series which can be integrated term by term. Lanczos first constructs a Taylor series in sin θ for fr(θ) but notes that the resulting series after integrating is of slow convergence. Instead, he turns from the ‘extrapo- lating’ Taylor series to an ‘interpolating’ series of orthogonal functions: a Fourier series. The properties of fE,r will be examined later, but for the time being assume that this function may be represented by a uniformly convergent Fourier series on [ π/2,π/2]. Further, this series − will contain only cosine terms since fE,r is even. Thus

1 ∞ kπθ f (θ)= a (r)+ a (r)cos E,r 2 0 k π/2 Xk=1  

∞ ′ = ak(r) cos (2kθ ) (3.8) Xk=0

where the coefficients ak(r) are given by

2 π/2 ak(r)= fE,r(θ)cos(2kθ) dθ . π π/2 Z−

On the surface this substitution would appear to complicate mat- ters, or at least offer little improvement. It turns out, however, that thanks to a handy identity, the resulting integrals evaluate explicitly to the rational functions Hk(z) which exhibit the poles of Γ(z + 1). This identity is stated as a lemma, the proof of which can be found in [17, p.16]:

Lemma 3.2. For Re(z) > 1/2 − π/2 2z Γ(z +1/2) cos θ cos (2kθ) dθ = √π Hk(z) (3.9) π/2 Γ(z +1) Z−

Picking up where we left off with (3.7), and using (3.8) to replace

46 Chapter 3. The Lanczos Formula

fE,r(θ), we obtain

π/2 ∞ 2z ′ Γ(z +1/2) = Pr(z) cos θ ak(r)cos(2kθ) dθ π/2 Z− Xk=0 ∞ π/2 ′ 2z = Pr(z) ak(r) cos θ cos (2kθ) dθ π/2 Xk=0 Z− Γ(z +1/2) ∞ = P (z)√π ′ a (r)H (z) . (3.10) r Γ(z +1) k k Xk=0 Now it is just a matter of eliminating Γ(z +1/2) on both sides of (3.10), the reason for replacing z with z 1/2 in (3.5), and moving the − Γ(z + 1) to the left hand side to get the final form:

∞ z+1/2 (z+r+1/2) ′ Γ(z +1)=(z + r +1/2) e− √2π ak(r)Hk(z) , (3.11) Xk=0 where again, Re(z) > 1/2, and r 0. We will see later that conver- gence of this series can− be extended≥ to the left of Re(z)= 1/2. −

3.2 Derivation in the Chebyshev Setting

The argument used to obtain (3.11) is now repeated, but this time using the set of Chebyshev polynomials T (x) orthogonal on the in- { k } terval [ 1, 1]. For a brief overview of Chebyshev polynomials and their connection− to Fourier expansions the reader is referred to Appendix B. Beginning with equation (3.4), e z+1 (z+r+1) z r Γ(z +1)=(z + r +1) e− [v(1 log v)] v dv , − Z0 this time define v(x) implicitly with 1 x2 = v(1 log v) , (3.12) − − where x = 1 corresponds to v =0,x =0tov = 1, andx =1to − v = e. This yields

1 r z+1 (z+r+1) 2 z 2xv Γ(z +1)=(z + r +1) e− (1 x ) dx . (3.13) 1 − log v Z−   47 Chapter 3. The Lanczos Formula

z+1/2 Once again let Pr(z)=√2(z + r +1/2) exp [ (z + r +1/2)], re- − r place z with z 1/2, and denote by fE,r(x) the even part of √2xv / log v, giving −

1 2 z dx Γ(z +1/2) = Pr(z) (1 x ) fE,r(x) . (3.14) 2 1 − √1 x Z− − The motivation this time for the replacement z z 1/2 is a bit clearer: with the introduction of the weight function→ 1/√−1 x2, the integral 2 − 2 in (3.14) reveals itself as an inner product on [ 1,1](dx/√1 x ) which has the Chebyshev polynomials as orthogonalL − basis. −

Expanding fE,r(x) in a series of even Chebyshev polynomials (the justification for which will follow) produces

∞ ′ fE,r(x)= ck(r)T2k(x) (3.15) Xk=0 so that

1 ∞ 2 z ′ dx Γ(z +1/2) = Pr(z) (1 x ) ck(r)T2k(x) , 2 1 − √1 x Z− Xk=0 − which upon integrating term by term gives

Γ(z +1/2) ∞ Γ(z +1/2) = P (z)√π ′ c (r)( 1)k H (z) . r Γ(z +1) k − k Xk=0 The term by term integration uses an equivalent form of the iden- tity (3.9):

1 2 z dx k Γ(z +1/2) (1 x ) T2k(x) =( 1) √π Hk(z) . 2 1 − √1 x − Γ(z +1) Z− − Finally, multiplying through by Γ(z +1)/Γ(z +1/2) and writing a (r)=( 1)kc (r) once again yields k − k

∞ z+1/2 (z+r+1/2) ′ Γ(z +1)=(z + r +1/2) e− √2π ak(r)Hk(z) . (3.16) Xk=0

48 Chapter 3. The Lanczos Formula 3.3 Derivation in the Hilbert Space Set- ting

It is worth noting that both (3.7) and (3.14) show that Γ(z+1/2)/Pr(z) manifests itself as an inner product in Hilbert space, so that (3.16) can be deduced directly using Hilbert space theory. In fact, the requirement that fE,r be equal to a uniformly convergent Fourier (resp. Chebyshev) series is unnecessary, if we ask only that fE,r be square summable with respect to Lebesgue measure. Take for example the Fourier setting. Parseval’s theorem [24, p.91] says that for even f,g L2[ π/2,π/2] with g real, ∈ −

π/2 ∞ 2 ′ f(θ)g(θ) dθ = fˆkgˆk π π/2 Z− Xk=0

where fˆk denotes the Fourier coefficient

π/2 ˆ 2 fk = f(θ)cos(2kθ) dθ . π π/2 Z−

In the present case, the Fourier coefficients of p(θ)=cos2z(θ) are

π/2 2 2z pˆk = cos (θ)cos(2kθ) dθ π π/2 Z−

2 Γ(z +1/2) = H (z) , √π Γ(z +1) k

from Lemma 3.2, while those of f are a (r), assuming f L2[ π/2,π/2]. E,r k E,r ∈ −

49 Chapter 3. The Lanczos Formula

Thus by Parseval’s theorem, (3.7) becomes simply

π/2 2z Γ(z +1/2) = Pr(z) cos θfE,r(θ) dθ π/2 Z−

π ∞ = P (z) ′ pˆ a (r) r 2 k k Xk=0

Γ(z +1/2) ∞ = P (z)√π ′ a (r) H (z) , r Γ(z +1) k k Xk=0

which again yields equation (3.1).

3.4 Additional Remarks

To conclude this chapter, a number of remarks on various aspects of the derivation of (3.1) are worthy of mention. The first remark is concerning the use of both Fourier and Cheby- shev series to achieve the same result. These are clearly equivalent since, as Boyd notes in [3], a Chebyshev polynomial expansion is merely a Fourier cosine series in disguise. In this case, the transformation x sin θ links one to the other. Based on the extensive use of Cheby- shev→ polynomials in his work [11], Lanczos was likely aware of the pos- sibility of using either expansion in his derivation. Indeed, he does make the substitution (3.12) in his paper, but not as a springboard for a Chebyshev expansion, but rather to set the stage for expressing f0(θ) as a Taylor polynomial in sin θ. From the periodicity of this last function he then argues that the interpolating Fourier cosine series is a better choice in terms of convergence versus the extrapolating Taylor series. Secondly, the Fourier methods used here, in particular the use of the identity (3.9), bear a striking resemblance to a technique used in Lanczos’ 1961 work [13, p.45]. There he derives an expansion for Bessel functions of arbitrary order in terms of Bessel functions of even integer order. Part of that derivation involves a clever method for computing

50 Chapter 3. The Lanczos Formula the coefficients of the expansion which will be described in the sequel. This common thread is not so surprising since, as Lanczos notes in the acknowledgments of each of [14] and [13], the winter of 1959-60 saw much of both works completed at the Mathematics Research Center of the U.S. Army at the University of Wisconsin in Madison. Thirdly, the derivation of (3.1) can be simplified if one considers first only real z> 1/2 followed by an application of the principle of analytic continuation− at the end. This approach obviates Lemma 3.1 but requires consideration of the analytic properties of the infinite series factor of the formula. Such matters will be examined later when (3.1) is extended to the left of Re(z)= 1/2. − The final remark involves the free parameter r as it relates to the Fourier coefficients ak(r) (or equivalently ck(r) in the Chebyshev set- ting). There are several methods for computing the coefficients and these will be examined in due course. For the moment, note Lanczos’ own formulation: the constant term of the series is

2e 1/2 a (r)= er, (3.17) 0 π(r +1/2)   while for k 1, ≥ 2 k a (r)= C (j) . (3.18) k π 2j,2kFr j=0 X 1/2 j 1/2 Here r(j)=2− Γ(j +1/2)(j + r +1/2)− − exp (j + r +1/2) and F 2j th C2j,2k is the coefficient of x in the 2k Chebyshev polynomial. These coefficients are functions of r and this parameter plays a fundamental role in the rate of convergence of the series. This role will be examined in detail, but for now observe that the constraint r 0 imposed by Lanczos is unduly restrictive in the sense that the substitution≥ in equation (3.3) requires only that Re(r) 0. Under this relaxed constraint, the Fourier coefficients given by (3.17)≥ and (3.18) are then single valued analytic functions of r in this region. The properties of the ak(r) as a function of a complex variable were not considered here, but it would be interesting to investigate further the effect of this generalization on (3.1).

51 Chapter 4 The Functions v and fE,r

The derivation of Lanczos’ main formula (1.1) in Chapter 3 relies on the validity of expanding the implicitly defined function fE,r(θ) of equa- tion (3.7) (resp. fE,r(x) of (3.14)) into an infinite interpolating Fourier (resp. Chebyshev) series. Furthermore, the smoothness and summa- bility properties of fE,r determine the asymptotic growth rate of the coefficients ak(r) (resp. ck(r)), and consequently the convergence of the series (1.2).

In this chapter the properties of the implicit functions v, fr and fE,r are examined in detail, and bounds are established on the coefficients appearing in the series (3.8) (resp. (3.15)). The principal results are

r (i) In the Chebyshev setting, f (x) C⌊ ⌋[ 1, 1] and is of bounded E,r ∈ − variation, so that the expansion (3.15) is justified.

2r (ii) In the Fourier setting, fE,r(θ) C⌊ ⌋[ π/2,π/2] and is of bounded variation, thus justifying the∈ expansion− (3.8).

(iii) f (n) L1[ π/2,π/2], where n = 2r . E,r ∈ − ⌈ ⌉ 2r (iv) a (r)=O(k−⌈ ⌉)ask . k →∞

4.1 Closed Form Formulas

We begin by finding explicit expressions for v and fE,r in terms of Lambert W functions W0 and W 1. This is useful for several reasons: − the first is that graphs of v and fE,r can be easily plotted using the built in Lambert W evaluation routines of Maple 8. The second is that the

52 Chapter 4. The Functions v and fE,r

smoothness properties of v and fE,r can be deduced directly from those of W0 and W 1. Third, the expression for fE,r can be used to compute − approximate values of the coefficients ak(r) using finite Fourier series. In this section we work first in the Chebyshev setting and establish explicit formulas for v(x)andf (x)on[ 1, 1]. These formulas are in E,r − terms of the two real branches W 1 and W0 of the Lambert W function − defined implicitly by W (t)eW (t) = t. See [5] for a thorough treatment of Lambert W functions.

4.1.1 Closed Form for v(x)

Recall that v(x) was defined implicitly via

1 x2 = v(1 log v) , (4.1) − − where x = 1 corresponds to v =0,x =0tov = 1, andx =1to − v = e. Letting w =log(v/e), this is equivalent to

x2 1 − = wew e whence x2 1 w = W − e   so that v x2 1 = expW − e e   x2 1 e− = . (4.2)  x2 1 W e− For 1

In developing this expression, care must be taken to ensure that v takes on the prescribed values at the endpoints x =1, 1 where W 1 (y(x)) − , and also at x = 0 where H(x) has a jump− discontinuity. Taking→ limits−∞ of (4.3) at these points shows that indeed v takes on the pre- scribed values and is thus continuous on [ 1, 1]. See Figure 4.1 for a plot of v(x)/e. −

1

v(x) e

101 − Figure 4.1: v(x)/e, 1 x 1 − ≤ ≤

4.1.2 Closed Form for fr(x) and fE,r(x)

For the function f (x)=√2 xvr/ log v, note that log v =1+W ((x2 r − 1)/e) from (4.2), so that fr(x) may be expressed

r r y(x) y(x) f (x) W−1(y(x)) W0(y(x)) r √ r = 2 x H( x)+ H(x) , e 1+ W 1 (y(x)) − 1+ W0 (y(x))  −   54 Chapter 4. The Functions v and fE,r

while its even part f (x)=[f (x)+f ( x)] /2 becomes E,r r r − r r y(x) y(x) fE,r(x) x W0(y(x)) W−1(y(x)) r = | | . (4.4) e √2 1+ W0 (y(x)) − 1+ W 1 (y(x)) −   r Plots of √2 fE,r(x)/e are shown in Figure 4.2 for various values of r. Notice the value of the function at the endpoints is one for the four r values of r plotted. It is clear from the definition fr(x)=√2 xv / log v that √2 f ( 1)/er =1ifr 0 and is + otherwise. Also notice E,r ± ≥ ∞ the extreme behaviour of the derivative of fE,r at the end points for r = 0. Lanczos notes that the parameter r serves to smooth out this singularity and hence improve the convergence of the Fourier series of fE,r.

r =0

1

r =1

r =2

r =4

101 − Figure 4.2: √2 f (x)/er, 1 x 1, r =0, 1, 2, 4 E,r − ≤ ≤

55 Chapter 4. The Functions v and fE,r

r 4.2 Smoothness of v (x), fr(x)andfE,r(x)

r The smoothness of v , fr and fE,r can be seen to be essentially the r+1 same problem with the observation that √2 fr(x)=d/dx[v /(r +1)]. This follows from the fact that 1 x2 = v(1 log v) from which − − d 2x v(x)= . (4.5) dx log v

r In this section it is shown that v , fr (and hence fE,r) have r contin- uous derivatives on [ 1, 1]. ⌊ ⌋ −

Smoothness on (−1, 1]

Away from x = 1 (wherev> 0), the smoothness of vr is precisely the same as that of −v. As such, it is enough to consider v(x)on( 1, 1]. − 2 On ( 1, 0) (0, 1), the functions Wk((x 1)/e) of (4.3) are smooth and not− zero (see∪ [5]), and so v(x) is smooth− on this set. About x = 2 1, v(x)/e = expW 0((x 1)/e) which is again smooth since W0(t) is smooth at t =0. − This leaves x = 0 where the situation is not so clear, but the implicit function theorem gives the result. By expressing the right hand side of (4.1) as a Taylor series, it is not difficult to show that (4.1) may be written 1/2 ∞ (v 1)j x =(v 1) ( 1)j − − − (j +1)(j +2) " j=0 # X where the series on the right hand side converges absolutely and uni- formly for v 1 < 1. Denote this right hand side by h(v) and set | − | φ(v,x)=x h(v). Now φ(1, 0) = 0, ∂φ/∂v = 1/√2, and φ C∞ − |(1,0) − ∈ at (1, 0). Therefore by the implicit function theorem there are open sets 2 U R and W R and a function g : W R such that g C∞, (1,⊂0) U,0 W⊂, g(0) = 1, and φ(g(x),x) =→ 0 for every x W∈ (see ∈ ∈ ∈ [19, p.103]). Thus v = g(x) is smooth aboutx =0. Thus v is smooth as a function of x on ( 1, 1], from which vr and − fr are as well.

56 Chapter 4. The Functions v and fE,r

Smoothness at x = −1

It remains to examine smoothness at x = 1. At this point the role of the parameter r becomes crucial and must− be taken into account. + When r =1,v and v′ =2x/ log v are zero as x 1 , while v′′ = 2/ log v 4x2/[v(log v)3] there. Thus v is→− once continuously − →∞ differentiable at x = 1. Raising v to the power r>1, on the other hand, forces vr to zero− more rapidly as x = 1+, and so has the effect of smoothing out the singularity there. →− Begin with a simple calculus result: if r 0 and k 0 then ≥ ≤ lim xjvr(log v)k = lim vr log v k x 1+ v 0+ | | →− → < . (4.6) ∞

With this in mind, consider the smoothness properties of the gen- eralized function g(x)=xjvr(log v)k where j and k are integers and r is real. Using (4.5) to differentiate g(x) yields

d xjvr(log v)k = dx

j 1 r k  j+1 r 1 k 1 j+1 r 1 k 2 jx − v (log v) +2rx v − (log v) − +2kx v − (log v) − which can be abstracted as

d/dx G(j, r, k) jG(j 1,r,k)+2rG(j+1,r 1,k 1)+2kG(j+1,r 1,k 2) . −→ − − − − (4.7)−

r In the present case, v corresponds to G(0, r, 0), while fr corresponds to 2G(1, r, 1). Now beginning with G(0, r,0) and differentiating re- − peatedly, (4.7) shows that with each derivative, the k component of any resulting G terms remains zero or negative while the least r com- ponent reduces by 1. By (4.6), at least the first r derivatives of vr ⌊ ⌋ are bounded as x = 1+ . The caser = 1 shows that this bound is →− r+1 best possible. Since fr(x)=d/dx[v /(r + 1)], it follows that fr has r derivatives as well. ⌊ ⌋ In summary

57 Chapter 4. The Functions v and fE,r

Theorem 4.1.

(i) f (x) and vr are smooth on ( 1, 1]; r − r r (ii) f (x), f (x), and v are in C⌊ ⌋[ 1, 1]. r E,r −

Before proceeding to the examination of fr as a function of θ, we end this section with a result which justifies the representation of fr in equation (3.15) by a uniformly convergent Chebyshev series:

Theorem 4.2. f (x) is increasing on [ 1, 1]. r −

Proof of Theorem 4.2: It is enough to show fr′(x) 0on( 1, 1). Since ≥ − √2 xvr f (x)= r log v and vr is non negative and increasing, it is enough to show that x h(x)= log v

is non negative and increasing. It is clear that h(x)=v′(x)/2 0. ≥ Now log v 2x2/(v log v) h′(x)= − , (log v)2 so it is enough to show that the numerator

p(x)=logv 2x2/(v log v) − v (log (v))2 2+2v 2 v log(v) = − − v log(v)

is non negative. But this last function is minimized when v = 1 where p(0) = 0, completing the proof.

Since fr(x) is increasing its total variation is fr(1) fr( 1), from which − −

58 Chapter 4. The Functions v and fE,r

Corollary 4.1. fr(x) and fE,r(x) are functions of bounded variation on [ 1, 1]. −

From the continuity of fE,r(x) and Corollary 4.1 it follows that fE,r(x) may be expressed as a uniformly convergent Chebyshev series on [ 1, 1]. −

r 4.3 Smoothness of v (θ), fr(θ)andfE,r(θ)

By setting x = sinθ and d dx d = , dθ dθ dx

r it follows easily from the previous section that v (θ), fr(θ) and fE,r(θ) have at least r continuous derivatives on [ π/2,π/2]. In fact, this argument shows⌊ ⌋ that these functions are smooth− on ( π/2,π/2], with a singularity at θ = π/2. − − In this section, the precise order of the singularity of fr(θ) (and consequently f (θ)) at θ = π/2 is determined. This will then be E,r − used to bound the growth of the Fourier coefficients ak(r). To do so, we proceed as in the Chebyshev setting and define a generalized function, although the generalization is slightly more complicated in this case.

4.3.1 Generalized fr(θ)

Define G(β,j,k,l; θ)as

G(β,j,k,l; θ)=vβ sinj θ cosk θ(log v)l , (4.8)

where β R, j, k, l Z. Note thatf (θ)=√2 G(r, 1, 0, 1; θ). From ∈ ∈ r − tedious application of derivative rules and using the fact that 2 sinθ cos θ v′(θ)= , log v

59 Chapter 4. The Functions v and fE,r

G(β,j,k,l; θ) has the derivative form

d [G(β,j,k,l; θ)] = 2βG(β 1,j+1,k+1,l 1; θ) dθ − − +jG(β,j 1,k+1,l; θ) − kG(β,j +1,k 1,l; θ) − − +2lG(β 1,j+1,k+1,l 2; θ) . (4.9) − − Thus G and its derivatives can always be written as a linear combination of functions of the form (4.8). The following lemmas will help to clarify the dependence of G on β, j, k and l. Begin with an easy result from calculus:

Lemma 4.1. Suppose β R and l Z. Then ∈ ∈ 0 if β>0 if β<0 β l  ∞ lim v log v =  1 if β =0, l =0 v 0+ | |  →  if β =0, l>0 0∞ if β =0, l<0 .   

From this follows

Lemma 4.2. Suppose β R and j, k, l Z. Then ∈ ∈ 0 if β + k/2 > 0 ( 1)l+j if β + k/2 < 0  − ·∞ lim G(β,j,k,l; θ)= ( 1)l+j if β + k/2=0and k/2+l =0 π +  θ 2  − l+j →−  ( 1) if β + k/2=0and k/2+l>0 0− ·∞ if β + k/2=0and k/2+l<0 .    Proof of Lemma 4.2: Near θ = π/2 − cos θ = v1/2 1 log v 1/2 . | − |

Also recall that as θ π/2+, v 0+. Now write →− →

60 Chapter 4. The Functions v and fE,r

lim G(β,j,k,l; θ) = lim vβ sinj θ cosk θ(log v)l θ π + θ π + →− 2 →− 2 = lim vβvk/2 1 log v k/2 sinj θ log v l ( 1)l θ π + | − | | | − →− 2 = lim vβ+k/2 log v l+k/2 ( 1)l+j θ π + | | − →− 2 and use Lemma (4.1).

The next section shows how to use these lemmas to determine lower bounds on the order to which G is continuously differentiable at π/2. −

4.3.2 Derivatives of G(β,j,k,l; θ)

To apply the results of the previous section to fr, abstract the process of differentiating G(β,j,k,l; θ) as follows. Identify with G(β,j,k,l; θ) the monomial xβyjzkwl, and view differentiation of G(β,j,k,l; θ)asthe linear mapping :

β j k l β 1 j+1 k+1 l 1 D : x y z w 2βx − y z w − 7→ β j 1 k+1 l +jx y − z w β j+1 k 1 l kx y z − w − β 1 j+1 k+1 l 2 +2lx − y z w − . (4.10)

Higher order derivatives of G(β,j,k,l; θ) are then obtained recur- sively as D2 = D D, D3 = D D D, etc. For consistency, let D0 denote the identity◦ mapping. ◦ ◦

4.3.3 Application to fr

We arrive finally at the analysis of fr.

Theorem 4.3. fr(θ) is continuous, increasing and hence of bounded variation on [ π/2,π/2]. − 61 Chapter 4. The Functions v and fE,r

Proof of Theorem 4.3: This follows from Theorems 4.2 and 4.1 upon writing x = sinθ and df df dx r = r . dθ dx dθ

Theorem 4.4. f (θ) has 2r continuous derivatives at θ = π/2. r ⌊ ⌋ − Proof of Theorem 4.4: Using the notation of Section (4.3.1), write fr(θ)/√2=G(r, 1, 0, 1; θ). By Lemma 4.2, fr is continuous at θ = π/2 for r 0. Now− consider the associated sequence − ≥ 0 r 1 0 1 1 r 1 0 1 2 r 1 0 1 D (x y z w− ),D(x y z w− ),D(x y z w− ),... (4.11)

n+1 r 1 0 1 The task is to determine the least n such that D (x y z w− ) contains a term whose powers meet one of the conditions in Lemma 4.2. G(β,j,k,l; θ) will then be n-times continuously∞ differentiable at π/2. − Observe first that the third and fourth conditions of Lemma 4.2 (β + k/2=0andk/2+l 0) can never be satisfied by a term of one of n r 1 0 1 ≥ the D (x y z w− ) in the sequence (4.11), since these conditions imply β l 0, which translates into deg (x) deg (w) 0 in some term of −n r≤1 0 1 − ≤ 0 D (x y z w− ). But deg (x) deg (w)=r +1> 0 inD and (4.10) implies this quantity is non-decreasing− with n. The only other condition in Lemma 4.2 is satisfied when deg (x)+ ∞ n r 1 0 1 0 deg (z)/2 < 0 for a term in some D (x y z w− ). In D , deg (x )+ deg (z)/2=r 0. Equation (4.10) implies that the least value ≥ n r 1 0 1 of deg (x) + deg (z )/2 taken over the summands of D (x y z w− ) decreases by at most 1/2 with each increase in n. Further, since deg (w)= 1 inD 0, the fourth term of (4.10) guarantees that this − decrease will indeed occur with each n. Thus, it is enough to determine the largest integer n such that r n(1/2) 0, which is the largest n such that n 2r, i.e. n = 2r .− In other≥ words, for r 0, f (θ) has ≤ ⌊ ⌋ ≥ r 2r continuous derivatives. Lemma 4.2 also gives that all of these 2r ⌊derivatives⌋ are zero. ⌊ ⌋

(n) Theorem 4.5. fr (π/2)=0for n a positive odd integer.

62 Chapter 4. The Functions v and fE,r

Proof of Theorem 4.5: Again identify f (θ)/√2 with G(r, 1, 0, 1; θ) r − and consider the associated sequence of derivatives

0 r 1 0 1 1 r 1 0 1 2 r 1 0 1 D (x y z w− ),D(x y z w− ),D(x y z w− ),...

By (4.10), each term of every odd order derivative has deg (z) > 0. Thus each term of every odd order derivative has a factor of cos θ which is zero at θ = π/2.

(n) 1 Theorem 4.6. fr L [ π/2,π/2] where n = 2r . ∈ − ⌈ ⌉ Proof of Theorem 4.6: It has been established that f is smooth on (n) + ( π/2,π/2], so it is sufficient to bound the growth offr as θ π/2 . − →− Again it is easiest to work with the generalized fr as given in Section 4.3.1, from which it is not difficult to determine conditions on β,j,k and l which guarantee summability of the integral. Beginning with

π/2 I = G(β,j,k,l; θ) dθ π/2 | | Z− π/2 vβ sinj θ cosk θ = l dθ , π/2 (log v) Z−

change to v variables with the substitution v(1 log v)=cos2 θ: − e vβ[1 v(1 log v)]j/2[v(1 log v)]k/2 log v I = − − − dv (log v)l[1 v(1 log v)]1/2[v(1 log v)]1/2 Z0 − − − e β (j 1)/2 (k 1)/2 1 l = v [1 v(1 log v)] − [v(1 log v)] − log v − dv − − − | | Z0

+ β+k/2 1/2 k/2 l+1/2 As v 0 , the integrand is O(v − (log v) − ). Provided β + k/2 →1/2 > 1, that is, β + k/2+1/2 > 0, the integral converges. − − In the case at hand off r(θ)=√2 G(r, 1, 0, 1; θ), the exponent β + k/2 1/2 starts off at r 1/2 and decreases− by 1/2 with each − − derivative as (4.10) shows. Thus if n is chosen to be the largest integer such that r 1/2 n(1/2) > 1 − − − 63 Chapter 4. The Functions v and fE,r

π/2 (n) then convergence of π/2 fr dθ is guaranteed. That is, if n is the − | | (n) largest integer such thatR n<2r + 1, which is just 2r , thenf r L1[ π/2,π/2]. ⌈ ⌉ ∈ −

The results of Theorems 4.3, 4.4, 4.5 and 4.6 extend easily to the even part of fr: Corollary 4.2. Suppose r 0 and ≥ f (θ)+f ( θ) f (θ)= r r − . E,r 2 Then

(i) fE,r is a continuous function of bounded variation on [ π/2,π/2] such that f ( π/2) = f (π/2) = er/√2 and f (0)=1− ; E,r − E,r E,r n (n) (n) (ii) fE,r C [ π/2,π/2], where n = 2r , and fE,r( π/2) = fE,r(π/2) = 0 for∈n −2r an odd integer; ⌊ ⌋ − ≤⌊ ⌋ (iii) f (n) L1[ π/2,π/2], where n = 2r . E,r ∈ − ⌈ ⌉

4.4 Fourier Series and Growth Order of Coefficients

We conclude this chapter with the application of Corollary 4.2 to the justification of the replacement of fE,r by its Fourier series in equa- tion (3.8), and to the estimate of the growth order of the Fourier coef- ficients ak(r) in equation (1.1).

First of all, from (i) of Corollary 4.2 it follows that fE,r has a Fourier series expansion which converges uniformly on [ π/2,π/2] (see [25]). − Since fE,r(θ) is even, this series will contain only cosine terms. Thus

1 ∞ f (θ)= a (r)+ a (r)cos(2kθ) E,r 2 0 k Xk=1

64 Chapter 4. The Functions v and fE,r

for coefficients 2 π/2 ak(r)= fE,r(θ)cos(2kθ) dθ . π π/2 Z− By substituting θ = π/2 and θ = 0 at this stage we get

r ∞ e 1 k = a0(r)+ ( 1) ak(r) √2 2 − Xk=1 and 1 ∞ 1= a (r)+ a (r) , (4.12) 2 0 k Xk=1 useful facts for testing the accuracy of computed ak(r)’s and examining the error later. Conclusions (ii) and (iii) of Corollary 4.2 allow the determination of a growth bound on the ak(r): 2r Theorem 4.7. As k , a (r)=O(k−⌈ ⌉). →∞ k Proof of Theorem 4.7: Beginning with 2 π/2 ak(r)= fE,r(θ)cos(2kθ) dθ , π π/2 Z− integrate by parts n = 2r times to get ⌈ ⌉ r π/2 ( 1)⌈ ⌉ 2 (n) ak(r)= − n fE,r(θ) cos (2kθ) sin (2kθ) n dθ . (4.13) (2k) π π/2 { | } Z− Here cos (2kθ) if2 r is even, cos (2kθ) sin (2kθ) = ⌈ ⌉ { | }n sin (2kθ) if2 r is odd.  ⌈ ⌉ From (4.13) it follows that

π/2 1 2 (n) ak(r) n fE,r(θ) dθ , | |≤(2k) π π/2 Z−

whence 2r ak(r)=O(k−⌈ ⌉) . (4.14)

65 Chapter 5 Analytic Continuation of Main Formula

At the end of the derivation of the main formula (1.1) in Section 3.1, it ′ was noted that convergence of the series Sr(z)= ak(r)Hk(z) could be extended to the left of the line Re(z)= 1/2. In this chapter this − X statement is made precise by proving in detail that the series converges absolutely and uniformly compact subsets of the half plane Re(z) > r excluding the negative integers. It is then shown that the main − formula (1.1) is analytic, and thus defines Γ(z + 1) in this region. Begin with some notation: Definition 5.1. For r 0, define the open set ≥ Ω = z C Re(z) > r and z = 1, 2, 3,... . r { ∈ | − 6 − − − }

5.1 Domain of Convergence of Sr(z)

Theorem 5.1. Suppose r 0. Then the series ≥ ∞ ′ Sr(z)= ak(r)Hk(z) Xk=0 converges absolutely and uniformly on every compact K Ω . Conse- ⊂ r quently, the series defines an analytic function on Ωr.

Proof of Theorem 5.1: First, observe that each term of the series is analytic on Ωr. Now suppose K is a compact subset of Ωr, let D(0,R)

66 Chapter 5. Analytic Continuation of Main Formula be a closed disk of radius R containing K, and letδ be the distance between K and C Ω . \ r 2r 2δ 1 It will first be shown that H (z) = O k − − on K. Fork>R , | k | by the reflection formula (2.10),  Γ(z +1)Γ(z +1) H (z)= k Γ(z +1+k)Γ(z +1 k) −

( 1)k+1[Γ(z +1)]2 sin (πz) Γ(1 z + k) = − − π Γ(1 + z + k)(k z) −

Γ(1 z + k) = h(z) − , say. Γ(1 + z + k)(k z) −

Now h(z) is analytic on Ω, so h(z) is bounded on K since K is r | | compact. It remains to bound the second factor. For k>R,1 z + k and 1 + z + k lie in the right half plane Re(z) 0, so using Stirling’s− formula to replace the gamma functions in the≥ fraction,

Γ(1 z + k) − Γ(1 + z + k)(k z) −

z k k z+1/2 √2πe − (k z) − (1 + δ (k)) 1 = − 1 √2πe z k(k + z)k+z+1/2(1 + δ (k)) (k z) − − 2 −

k z k 1 z k z 1/2 1 (1 + δ (k)) = e2z − − 1 k + z (k z)(k + z) k + z (k z) (1 + δ (k))    −    − 2

where δ (k) 0ask and the δ do not depend on z. Selecting j → →∞ j

67 Chapter 5. Analytic Continuation of Main Formula z D(0,R) to make this last expression as large as possible, ∈ Γ(1 z + k) − Γ(1 + z + k)(k z)

k + R k k + R 1/2 (1 + δ (k)) 1 e2R 1 ≤ k R k R (1 + δ (k)) (k R)2σ+1  −   −  2 −

k + R k k + R 1/2 (1 + δ (k)) 1 e2R 1 ≤ k R k R (1 + δ (k)) (k R)2( r+δ)+1  −   −  2 − −

2r 2δ 1 = O k − − .

This last inequality follows since, as k , →∞ k + R k k + R 1/2 (1 + δ (k)) e2R 1 e4R . k R k R (1 + δ (k)) →  −   −  2 Recalling that h(z) is bounded, the conclusion is | | 2r 2δ 1 H (z) = O k − − | k | on K. 

2r Since a (r) = O(k−⌈ ⌉) from Theorem 4.7, it then follows that | k | 2r 2r 1 2δ a (r)H (z) = O(k −⌈ ⌉− − ) | k k | 1 2δ = O(k− − ) ,

whence, for some positive constant A and any n 1 ≥ ∞ ∞ 1 a (r)H (z) A < , | k k |≤ k1+2δ ∞ Xk=n Xk=n completing the proof.

68 Chapter 5. Analytic Continuation of Main Formula 5.2 Analytic Continuation

Theorem 5.2. For r 0, the function ≥

∞ z+1/2 (z+r+1/2) ′ √2π (z + r +1/2) e− ak(r)Hk(z) Xk=0

is analytic on Ωr.

Proof of Theorem 5.2: The factor √2π (z + r +1/2)z+1/2 is analytic since Re(z + r +1/2) > 0onΩr. The factor exp[ (z + r +1/2)] is entire. The series factor is analytic by Theorem 5.1.−

Theorem 5.3.

∞ z+1/2 (z+r+1/2) ′ Γ(z +1)=√2π (z + r +1/2) e− ak(r)Hk(z) Xk=0

on Ωr.

Proof of Theorem 5.3: The right hand side is analytic on Ωr and equals Γ(z +1) on Re(z) > 1/2. Hence by the principle of analytic − continuation, it equals Γ(z + 1) throughout Ωr.

5.3 Additional Remarks

In his original paper, in reference to the main formula (1.1), Lanczos remarks simply:

It is of interest to observe, however, that the convergence of the infinite expansion extends even to the negative realm and is in fact limited by the straight line

Re(z) > (r +1/2) . −

69 Chapter 5. Analytic Continuation of Main Formula

This is most certainly true. Indeed, with r = 0 this bound is in agree- ment with the bound given following equation (3.11). However, the proof of Lanczos’ bound eludes me.

Observe that Sr(z) may be expressed

1/2 (z+1/2) z+r+1/2 Sr(z)=Γ(z + 1)(2π)− (z + r +1/2)− e ,

and that, except for the simple poles at z = 1, 2,... which are present on both sides of the equation, z = r 1/−2 is− the first singular- ity encountered as z moves into the left-hand− plane.− Lanczos’ statement seems to be based on a principle similar to that for the power series of an analytic function, that the radius of convergence of the series extends to the first singularity. Closer in spirit is a result from the the- ory of Dirichlet series: suppose f(s) is an analytic function on the half s plane Re(s) >c1, andf (s) is expressible as a series f(s)= k∞=1 qkk− on Re(s) c2 c1, where the coefficients qk are eventually positive. ≥ ≥ P Then the series actually converges on the larger set Re(s) >c1. The best that can be achieved with the techniques used here is convergence on Re(z) > 2r /2, a slight improvement over Theo- −⌈ ⌉ 2r rem 5.3. If the bound ak(r)=O(k−⌈ ⌉) could be improved to ak(r)= (2r+1) O(k− ) then the theorem would give absolute and uniform conver- gence of Sr(z) on compact subsets of Re(z) > (r +1/2). Numerical checks do support this slightly more rapid rate− of decrease. For exam- 2r+1 2r ple, in Figure 5.1, log ak(r)k is compared against log ak(r)k⌈ ⌉ , for the first 150 coefficients− | with r| =1.25 ( log a (r)−is also| plotted | − | k | for reference). Of the two lower curves, the flatter one corresponding to log a (r)k2r+1 indicates the tighter bound. − | k | The difficulty lies in finding a more precise bound on the Fourier 2r coefficients than the rather cumbersome estimate ak(r)=O(k−⌈ ⌉). To do this requires a better understanding of the asymptotic behaviour 2 of fr(θ) about the singularity θ = π/2. Letting h =(θ + π/2) , it is true that − hr f (θ) √2 r ∼ ( log h)r+1 − as θ π/2. These two functions have the same number of derivatives there,→− so the asymptotic tendency of their Fourier coefficients should be the same. The asymptotic behaviour of the Fourier coefficients of hr/( log h)r+1 does not appear straightforward, however. −

70 Chapter 5. Analytic Continuation of Main Formula

25

log a (r) − | k |

log a (r)k⌈2r⌉ − | k |

log a (r)k2r+1 − | k |

0 0 k 150 (2r+1) 2r Figure 5.1: Growth of ak(r), k− , andk −⌈ ⌉ with r =1.25

71 Chapter 6 Computing the Coefficients

In order to use the formula (1.1) in practice, the Fourier coefficients ak(r) must first be determined. The method given by Fourier theory, namely the direct integration 2 π/2 ak(r)= fE,r(θ)cos(2kθ) dθ (6.1) π π/2 Z− in not practical due to the complicated nature of the factor fE,r(θ) in the integrand. There are, however, a number of other methods for computing the ak(r), and in this chapter these various methods are discussed along with some comments on their practicality. The first method is that of Lanczos as described in Chapter 1. The second method is a recursive procedure which uses nested calculations similar to Horner’s rule for increased efficiency. This method was found to work very well in practice, and was used for most large scale calcula- tions and numerical investigations. These first two methods rely on the fact that Γ(z + 1) is explicitly known at the integers and half integers. The third method is another recursive procedure based on the identity Γ(z +1)=zΓ(z). The fourth method uses the Chebyshev version of a finite Fourier transform on the closed form expression for fE,r from Sec- tion 4.1.2. This last method is essentially a numerical approximation of the integral (6.1).

6.1 The Lanczos Method

The first method for finding the ak(r) is the clever and elegant method of Lanczos, as given in his original paper, but carried out in the Cheby- shev setting which simplifies it slightly. (Recall that a (r)=( 1)kc (r).) k − k 72 Chapter 6. Computing the Coefficients

First define (z) as the integral function Fr 1 2 z dx r(z)= (1 x ) fE,r(x) 2 F 1 − √1 x Z− − appearing in equation (3.14), and notice by this same equation that r can also be written F

1/2 z 1/2 (z)=2− Γ(z +1/2)(z + r +1/2)− − exp (z + r +1/2) . Fr th k 2j Now denote the 2k Chebyshev polynomial by T2k(x)= j=0 C2j,2kx , and from (B.2) the coefficients in the Chebyshev series are defined as P 2 1 dx ck(r)= fE,r(x)T2k(x) . 2 π 1 √1 x Z− − The Chebyshev series coefficients are then given by

2 1 dx ck(r)= fE,r(x)T2k(x) 2 π 1 √1 x Z− − 1 k 2 2j dx = fE,r(x) C2j,2kx π √ 2 1 " j=0 # 1 x Z− X − 1 k 2 k 2 j dx = fE,r(x) ( 1) C2j,2k(1 x ) using (B.3) π − − √ 2 1 " j=0 # 1 x Z− X − k 1 k 2 2 j dx =(1) C2j,2k (1 x ) fE,r(x) − π − √ 2 j=0 1 1 x X Z− − 2 k =(1)k C (j) . (6.2) − π 2j,2kFr j=0 X With a ready list of Chebyshev polynomial coefficients and precom- puted values, (6.2) can be concisely expressed Fr C (0) c (r) 0,0 Fr 0 2 C0,2 C2,2 r(1) c1(r)  .   F .  =  − .  . π . . .      k   C0,2k C2,2k C2k,2k   r(k)   ( 1) ck(r)   ···   F   −        73 Chapter 6. Computing the Coefficients

In other words, c (r) is simply a weighted sum of values over k Fr the first k integers, where the weights are Chebyshev polynomial co- efficients. This is yet another peculiar feature of Lanczos’ paper: the coefficients of the approximating series Sr(z) are in terms of the very function being approximated. From this point of view, Sr(z) is the infi- 1/2 z 1/2 nite interpolation of (2π)− Γ(z+1)(z+r+1/2)− − exp (z + r +1/2) by rational functions Hk(z). To get an explicit form for the coefficients, an expression for the coefficients C is required. For j =0,C =( 1)k, while for j 1 2j,2k 0,2k − ≥

k j k k + j j C =( 1) − 4 . 2j,2k − k + j k j  −  r Using this in equation (6.2) yields c0(r)= 2e/[π(r +1/2)] e and

2 k (k + j 1)!p e j+1/2 c (r)= erk ( 1)j − . k π − (k j)!j! j + r +1/2 r j=0 X −   The corresponding a (r) appearing in (1.1) are then a (r)=( 1)kc (r). k k − k Although this method provides a convenient closed form for com- puting individual coefficients, it has the drawback of requiring generous floating point precision to handle the addition of large values of alter- nating sign which arise in intermediate calculations. This problem can be partially overcome with the observation that each summand of (6.2) contains a factor of exp(r), so this term can be factored out to reduce the size of intermediate calculations. Even so, the problem persists. For example, consider the calculation of c6(6) using (6.2). In Table 6.1 the individual terms are listed; note the order of the largest scaled sum- 10 mands. Yet the sum of the last column is only 1.711 10− , which 6 . × when multiplied by 2e /π, yields c6(6) =0.00000004396.

6.2 A Horner Type Method

This method is based on the simple observation that the series Sr(z) of (1.2) terminates if z is a non-negative integer. Thus the an(r) can be recursively determined by successively setting z =0, 1, 2 ..., etc. Specifically, defining

(z+1/2) z+r+1/2 1/2 Fr(z)=Γ(z +1)(z + r +1/2)− e (2π)− , (6.3)

74 Chapter 6. Computing the Coefficients

j C (j)/e6 C (j)/e6 2j,12 F6 2j,12F6 0 1 .810495300735 .810495300735 1 72 .136735023817 9.844921714804 − − 2 840 .054363835840 45.665622105199 3 3584 .029448235581 105.542476320579 − − 4 6912 .018797607523 129.929063197172 5 6144 .013277713616 81.578272459508 − − 6 2048 .010039301705 20.560489891957

Table 6.1: Scaled summands of c6(6)

then (1.1) may be stated1

1 z z(z 1) F (z)= a (r)+a (r) + a (r) − + r 2 0 1 z +1 2 (z +1)(z +2) ···   from which the coefficients can be efficiently found using a type of Horner procedure:

a0 =2Fr(0)

a 2 a = F (1) 0 1 r − 2 1   a 3 4 a = F (2) 0 a , 2 r − 2 2 − 1 1   

and in general, for n 3, ≥

a0 n +1 n +2 n +3 2n an(r)= Fr(n) a1 a2 an 1 . − 2 n − n 1 − n 2 −···− − 1    −  − (6.4) 

Although not very efficient for computing a single an(r) value, it proves quite practical and easy to program when a list of coefficients (for a given value of r) is required, as is most often the case.

1 Fr(z) is clearly identical to Sr(z). The use of Fr(z) is meant to indicate that this quantity should be computed using the closed form (6.3).

75 Chapter 6. Computing the Coefficients 6.3 Another Recursion Formula

Recall that the Lanczos formula (1.1) is a convergent formula for the gamma function. As such, it inherits the standard properties of this function, in particular the fundamental recursion Γ(z +1)=zΓ(z). Recall the notation for the rational functions appearing in the infi- nite series of (1.1): H (z) = 1, and for k 1 an integer, 0 ≥ Γ(z +1)Γ(z +1) H (z)= k Γ(z k +1)Γ(z + k +1) − z (z k +1) = ··· − . (6.5) (z +1) (z + k) ··· It is a simple exercise to deduce the following relationships:

(N k)(N + k) H (N 1) = − H (N), 0 k N 1 (6.6) k − N 2 k ≤ ≤ − and (2N)! H (N)= H (N), 0 k N. (6.7) k (N k)!(N + k)! N ≤ ≤ − Now

∞ z+1/2 (z+r+1/2) ′ Γ(z +1)=(z + r +1/2) e− √2π ak(r)Hk(z) , (6.8) Xk=0 and

∞ z 1/2 (z+r 1/2) ′ zΓ(z)=z(z + r 1/2) − e− − √2π a (r)H (z 1) . − k k − Xk=0 By the fundamental recursion, the right hand sides of these two equa- tions are equal, from which it follows that

z 1/2 ′ ez(z + r 1/2) − ak(r)Hk(z 1) 1= − − . (6.9) z+1/2 ′ (z + r +1/2) X ak(r)Hk(z) X r For a0(r), set z = 0 in equation (6.8) to get a0(r)= 2e/[π(r +1/2)] e . For N 1, set z = N in (6.9). Both series then terminate, one at the ≥ p 76 Chapter 6. Computing the Coefficients

N 1 term while the other at the Nth term. Isolating a (r) and − N simplifying using (6.6) and (6.7) then yields

N 1 N 1/2 − N + r 1/2 − (N k)(N + k) ak(r) aN (r)=(2N)! e − − 1 . " N + r +1/2 N(N + r +1/2) − # (N k)!(N + k)! Xk=0   − As with the Horner type of method, this method is not very efficient for computing a single an(r) value, but is more practical due to recycling of previous computations when a list of coefficients is required.

6.4 Discrete Fourier Transform

The final method discussed is that of the discrete Fourier transform, but in the Chebyshev setting. This method takes advantage of the closed form formula for fE,r(x) determined in Section 4.1.2. The gen- eral properties of discrete (or finite) Fourier transforms are explained, followed by the equivalent treatment in the Chebyshev setting.

6.4.1 Finite Fourier Series

The method is based on the principle that the family of exponential

functions exp (2πikx) k∞= is orthogonal not only with respect to in- tegration over{ [0, 1], but} also−∞ with respect to summation over equispaced data on this interval. Specifically, in the case of integrals

1 2πinx 2πimx 1 ifn = m, e e− dx = (6.10) 0 else. Z0  For the discrete analogue, fix an integer N 2 and consider the values x = j/N, j =1,...,N in [0, 1]. Then for 1≥ n, m N, j ≤ ≤ N 1 2πinx 2πimx 1 ifn = m, e j e− j = (6.11) N 0 else. j=1 X  More generally, for n, m Z, ∈ N 1 2πinx 2πimx 1 ifn m (mod N), e j e− j = ≡ (6.12) N 0 else. j=1 X  77 Chapter 6. Computing the Coefficients

Now assume that f(x) has a uniformly convergent Fourier expansion 2πijx f(x)= j∞= bje on [0, 1], and that the values of f are known at −∞ the points xj = j/N, j =1,...,N. Compute approximations to the FourierP coefficients as

N 2πijxk ¯bj = f(xk)e− Xk=1 and form the discrete Fourier series

N ¯ ¯ 2πijx f(x)= bje . j=1 X

Then f¯ = f on the equispaced data points xj, j =1,...,N, andf ¯ is a good approximation to f for the points in between. The larger the number N of sampled data points becomes, the better the approx- imation. This is clear from equation (6.11) since this expression is an N-subinterval Riemann sum approximating the integral in (6.10). In fact, it is possible to derive an explicit relationship between the coeffi- ¯ cients bj of the approximation, and the bj of the Fourier series. Since f¯(xn)=f(xn), n =1,...,N, it follows that

N ∞ ¯ 2πikxn 2πikxn bke = bke , k=1 k= X X−∞

again for n =1,...,N. Now multiply both sides by exp ( 2πijxn), sum over n =1,...,N, and use (6.12) to get −

¯ bj = bk . k j (modX≡ N)

For this reason, the smoother the function f being approximated, the more rapidly its Fourier coefficients bj decrease to zero, and hence the better the one term approximation ¯b b . j ≈ j

6.4.2 Finite Chebyshev Series

In the Chebyshev setting, the theory of the previous section translates as follows: for a given function f(x)on[ 1, 1], fix an integer N and −

78 Chapter 6. Computing the Coefficients

consider the Chebyshev polynomial TN (x) which has N zeros x1,...,xN at π(k 1/2) x =cos − . k N   Define the coefficientsc ¯n by

2 N c¯ = f(x )T (x ) n N k n k Xk=1

2 N π(k 1/2) nπ(k 1/2) = f cos − cos − . N N N Xk=1      Then the approximation

N f(x) c¯ T (x) ≈ ′ n n n=0 X

is exact on the N zeros of TN (x). Larger N values produce more accu- rate estimates ofc ¯n and hence f(x). This method can be applied to estimate the coefficients in (1.1) using the explicit form of fE,r(x) from equation (4.4):

2 N a¯ =( 1)nc¯ =( 1)n f (x )T (x ) . n − n − N E,r k 2n k Xk=1

This calculation can be economized since fE,r(xk)andT2n(xk) are even with respect to xk, hence, taking N even,

N/2 4 π(k 1/2) 2nπ(k 1/2) a¯ =( 1)n f cos − cos − . n − N E,r N N Xk=1     

Furthermore, the N values fE,r(x1),...,fE,r(xN ) need only be com- puted once since they do not depend on n, the index of the coefficient being computed.

Selecting N = 20 was sufficient to reproduce a0,...,a5 to six dec- imals as given in Lanczos’ original paper for r =1, 1.5, 2, 3. In fact, N = 20 is really only needed for r = 1, as the error c (r) c¯ appears | n − n|

79 Chapter 6. Computing the Coefficients to drop drastically as r increases. For example, with r =3andN = 20, 10 decimal precision is achieved for the first 6 coefficients.

What is not so straightforward, however, is the evaluation of fE,r(x) to produce the sample function values. The closed form of fE,r(x) requires evaluation of the Lambert W functions W 1(y) andW 0(y) − near their branch points y = 0andy = 1/e. In [5] the authors discuss the subtleties involved with evaluation− near these points. The numerical experiments noted here were carried out using Maple 8 which has built-in evaluation routines based on [5].

6.5 Some Sample Coefficients

To sum up this discussion, noted here for the record are coefficients corresponding to various values of the parameter r. Reproduced in Table 6.2 are the coefficients given in Lanczos’ original paper. These values were computed using the Lanczos method.

r =1 r =1.5 r =2 r =3 a0/2 +1.4598430249 +2.0844142416 +3.0738046712 +7.0616588080 a1 -0.4606423129 -1.0846349295 -2.1123757377 -6.5993579389 a2 +0.0010544242 +0.0001206982 +0.0386211602 +0.5396522297 a3 -0.0003384921 +0.0001145664 -0.0000510050 -0.0019519669 a4 +0.0001175425 -0.0000176145 +0.0000004776 -0.0000013258 a5 -0.0000506634 +0.0000038119 +0.0000006715 +0.0000002201 Table 6.2: Coefficients as functions of r

6.6 Partial Fraction Decomposition

For the final summary of his results, Lanczos truncates the main for- mula (1.1) after a finite number of terms and resolves the resulting rational functions into their constituent partial fractions, resulting in the formula N z+1/2 (z+r+1/2) bk(r) Γ(z +1) (z + r +1/2) e− √2π b (r)+ . ≈ 0 z + k " k=1 # X (6.13)

80 Chapter 6. Computing the Coefficients

This makes for increased efficiency of the formula when multiple eval- uations are required once a final set of ak(r) coefficients has been com- puted. For this purpose, it is worthwhile deriving the general formula for the decomposition. Recall the infinite series portion of the main formula is

1 z z(z 1) S (z)= a (r)+a (r) + a (r) − + r 2 0 1 z +1 2 (z +1)(z +2) ···   ∞ ′ = ak(r)Hk(z) . Xk=0 If this is terminated after the N’th term, the goal is to express the N resulting series Sr,N (z)=a0(r)/2+ k=1 ak(r)Hk(z) in the form

P N b (r) S (z)=b (r)+ k . r,N 0 z + k Xk=1

Observe that for k 1, bk(r) is the residue of Sr,N (z)atz = k, while, upon taking z ≥, − →∞ N

b0(r)=a0(r)/2+ ak(r) . Xk=1 Now

k j+1 (k+j 1)! − ( 1) − (k j)![(j 1)!]2 if 1 j k, Res[Hk(z)]z= j = − − − ≤ ≤ − (0 else,

so that

k k j+1 (k + j 1)! 1 H (z)=1+ ( 1) − − . k − (k j)![(j 1)!]2 z + k j=1 X − −

To determine bj(r) of equation (6.13), simply sum up the coefficients of 1/(z + j) inS r,N (z):

N k j+1 (k + j 1)! b (r)= a (r)( 1) − − . j k − (k j)![(j 1)!]2 Xk=j − −

81 Chapter 6. Computing the Coefficients 6.7 Matrix Representation

As remarked in Section 6.1, the calculation of the coefficients can be concisely expressed in matrix form, which, along with the partial frac- tion decomposition, reduce many of the intermediate calculations to integer arithmetic thus avoiding some round-off error. Godfrey makes this observation in [9] and carries through the details. The matrices required for this purpose are constructed here. Begin by introducing some notation. Let a(r) be the column vector of coefficients a0(r),...,aN (r), and let b(r) be the column vector of partial fraction coefficients b0(r),...,bN (r).

Writing C as the matrix of Chebyshev coefficients C2i,2j,0 i, j N, C has entries ≤ ≤ 0 ifij, 1/2 ifi = j =0, B = ij 1 ifi =0,j>0,   ( 1)j−i+1(j+i 1)! − − else. (j i)! ((i 1)!)2  − − as given in Section 6.6.  r 1/2 Denote by Fr the column vector of scaled values √2 r(j)e− − , 0 j N, where as in Section 6.1, F ≤ ≤ 1/2 z 1/2 (z)=2− Γ(z +1/2)(z + r +1/2)− − exp (z + r +1/2) . Fr With this notation, the Fourier coefficients appearing in (1.1) can be concisely expressed √2er+1/2 a(r)= CF π r while the coefficients for the partial fraction decomposition are simply √2er+1/2 b(r)= BCF . π r

82 Chapter 6. Computing the Coefficients

r+1/2 The only floating point calculations are in the term (√2e /π)Fr, so that if multiple sets of coefficients are required for different values of r, only this term need be recomputed. Still further efficiency can be realized by observing that the leading er+1/2 term of the b(r) coefficients cancels once inserted into (6.13). 1 Letting u(z) denote the vector of rational functions 1, (z+1)− ,...,(z+ k 1)− , equation (6.13) becomes simply

e z + r +1/2 z+1/2 Γ(z +1) 2 uT (z)BCF . (6.14) ≈ π e r r  

83 Chapter 7 Lanczos’ Limit Formula

The final result of Lanczos’ paper [14] is the beautiful limit formula, stated here as

Theorem 7.1. For Re(z) 0, ≥

∞ z ′ k k2/r Γ(z + 1) = 2 lim r ( 1) e− Hk(z) . (7.1) r →∞ − Xk=0 This result1 seems to be a departure from the practical nature of the rest of the paper, and the connection to the previous formula (1.1) is not an obvious one. Indeed, Lanczos’ reviewer [29] notes “Exceedingly curious is the additional remark, made by the author without any proof . . . ”. Lanczos offers little insight into how this result follows from his main derivation, other than the two sentences which precede the formula:

If r grows to infinity, we obtain a representation of the facto- rial function which holds everywhere in the complex plane. In this case we are able to give the coefficients of the se- ries . . . in explicit form, due to the extreme nature of the function vr.

In this chapter the validity of (7.1) is proved in detail for Re(z) 0. ≥ 1Note that the formula is misstated in the review [29]. There the term rz is incorrectly stated as r2.

84 Chapter 7. Lanczos’ Limit Formula 7.1 Some Motivation

As noted, it is difficult to say what lead Lanczos to state in a matter of fact fashion that (7.1) should be true. Some insight can be gained, however, by examining the behaviour of the integral in equation (3.6) for large positive r. To this end, write (3.6) as

π/2 r z+1/2 (z+r+1/2) 2z 2v sin θ Γ(z +1/2)=(z + r +1/2) e− cos θ dθ π/2 log v Z−

z + r +1/2 z+1/2 π/2 2(v/e)r sin θ = cos2z θ dθ . e π/2 log v   Z− A rescaling of r to er produces the rz term of equation (7.1) and elim- inates the exponential term in the limit, thus z + er +1/2 z+1/2 π/2 r1/2 (v/e)er sin θ Γ(z +1/2)=2rz cos2z θ dθ er π/2 log v   Z−

z+1/2 π/2 z z + er +1/2 2z 1/2 =2r cos θr gr(θ) dθ say, er π/2   Z− (7.2)

where sin θ g (θ)=(v/e)er . r log v

Now gr(θ) converges point-wise to zero rapidly on [ π/2,π/2) with increasing r, but equals one at θ = π/2. As a result,− as r increases, 1/2 (r/π) gr(θ) takes on the appearance of a the Gaussian distribution 1/2 2 2 (r/π) exp [ r(θ π/2) ]. Plots of exp[ r(θ π/2) ] gr(θ) for in- creasing values− of r−show a convincing fit;− see Figure− 7.1.− Furthermore,

1 ∞ 1/2 r(θ π/2)2 k k2/r cos (2kθ)r e− − dt =( 1) e− . √π − Z−∞ 2 so that if gr(θ) is replaced by exp [ r(θ π/2) ] and the bounds of integration [ π/2,π/2] are extended− to (− , ), the integral gives − k2/r 2z −∞ ∞ rise to the terms e− upon writing cos θ as its Fourier series.

85 Chapter 7. Lanczos’ Limit Formula

0.08

r=1

r=6

r=10 π 0 π − 2 2 Figure 7.1: exp[ r(θ π/2)2] g (θ) for r =1, 6, 10 − − − r

These ideas lead to the following outline of the proof of equa- tion (7.1). For large r and fixed z,

z+1/2 π/2 z z + er +1/2 2z 1/2 Γ(z +1/2)=2r cos θr gr(θ) dθ er π/2   Z−

π/2 z 2z 1/2 r(θ π/2)2 2r cos θr e− − dθ ≈ π/2 Z−

z ∞ 2z 1/2 r(θ π/2)2 r cos θr e− − dθ ≈ Z−∞

86 Chapter 7. Lanczos’ Limit Formula

∞ z ∞ ′ 2 Γ(z +1/2) 1/2 r(θ π/2)2 = r H (z)cos(2kθ) r e− − dθ √π Γ(z +1) k 0 ! Z−∞ X

∞ z Γ(z +1/2) ′ k k2/r =2r ( 1) e− H (z) , Γ(z +1) − k 0 X

where the symbol becomes equality as r . The remainder of the chapter is≈ dedicated to making precise the→∞ details of this argument.

7.2 Proof of the Limit Formula

The steps of the proof will be justified by a series of smaller lemmas. Begin with a definition:

Definition 7.1. For r>0, define

1 1/4 δ = . (7.3) r r log r   Clearly δ 0asr . r → →∞ It will also be convenient to introduce some notation for the various intervals of integration:

Definition 7.2. For δr <π, define the intervals π π I = δ , , r 2 − r 2 h i π π J = , δ , and r − 2 2 − r h i π K = , δ . r −∞ 2 − r  i

The first lemma is straightforward:

87 Chapter 7. Lanczos’ Limit Formula

Lemma 7.1. The function

0 if θ =0, h(θ)= sin θ ( log v else

is continuous on [ π/2,π/2], and is thus bounded. −

er 1/2 Proof of Lemma 7.1: On ( π/2,π/2], h(θ)=fer(θ)v− 2− , which is continuous by Theorem 4.3.− At θ = π/2, − lim h(θ)=0=h( π/2) . θ π/2 − →−

The next lemma shows that the integral in equation (7.2) is con- centrated on the small interval Ir containing π/2: Lemma 7.2. Suppose Re(z) 0, and let ≥ er 2z 1/2 v sin θ 1(r, z)= cos θr dθ . I J e log v Z r   Then z lim r 1(r, z)=0. r →∞ I Proof of Lemma 7.2: First, recall the calculus result

sin2 x lim =1, x 0 2 → x so that for x sufficiently small, | | 1 sin2 x x2 . (7.4) ≥ 2

88 Chapter 7. Lanczos’ Limit Formula

Now bound (r, z) as follows: I1 v er sin θ rz cos2z θr1/2 dθ e log v ZJr  

v er C rz cos2z θr1/2 dθ for some C > 0 by Lemma 7.1 ≤ 1 e 1 ZJr  

v(π/2 δ ) er C rσ+1/2 − r J since v is increasing on J ≤ 1 e | r| r  

σ+1/2 er[log v(π/2 δr ) 1] C r e − − ≤ 2

2 σ+1/2 er cos (π/2 δr )/v = C2r e− − by the implicit definition of v(θ)

2 σ+1/2 er cos (π/2 δr )/e C r e− − ≤ 2

2 σ+1/2 r sin δr = C2r e−

σ+1/2 rδ2/2 C r e− r for δ sufficiently small, by (7.4) ≤ 2 r

σ+1/2 (1/2)√r/ log r = C2r e−

0asr −→ →∞

The next lemma justifies the replacement of g (θ) by exp [ r(θ π/2)2] r − − on Ir: Lemma 7.3. Suppose Re(z) 0, and let ≥ er 2z 1/2 v sin θ r(θ π/2)2 2(r, z)= cos θr e− − dθ . I I e log v − Z r   

89 Chapter 7. Lanczos’ Limit Formula

Then z lim r 2(r, z)=0. r →∞ I Proof of Lemma 7.3: Begin with

er z 2z 1/2 v sin θ r(θ π/2)2 r cos θr e− − dθ e log v − ZIr    

er σ 2σ 1/2 r(θ π/2)2 v sin θ r(θ π/2)2 r cos θr e− − e − 1 dθ . ≤ e log v − ZIr  

Letting χr denote the indicator function on Ir, it is enough to show that as r →∞ (i) er v sin θ r(θ π/2)2 e − 1 χ 0 e log v − r −→

  uniformly, and

(ii) that σ 2σ 1/2 r(θ π/2)2 r cos θr e− − dθ ZIr remains bounded.

For (i), since limθ π/2− sin θ/ log v = 1, it is enough to show that → er v r(θ π/2)2 er(log v 1)+r(θ π/2)2 e − 1 χ = e − − 1 χ 0 e − r − r −→ h  i h i uniformly, which boils down to showing that

er(log v 1) + r(θ π/2)2 χ 0 − − r −→ uniformly. Expanding e(log v 1)+(θ π/2)2 about θ = π/2 gives − − e(log v 1)+(θ π/2)2 − −

1 1 1 135 60 = (θ π/2)4 + 4 + (θ π/2)6 + O (θ π/2)6 . 3 − e − 90 − − e2 e − −      90 Chapter 7. Lanczos’ Limit Formula

Now the coefficient (1/3 1/e) < 0, so that for θ π/2 sufficiently − | − | small, (θ π/2)4 e(log v 1)+(θ π/2)2 0 , − − ≤ − − ≤ so that, for r sufficiently large,

(θ π/2)4 e(log v 1)+(θ π/2)2 χ 0 , − − ≤ − − r ≤ whence  

r(θ π/2)4 er(log v 1) + r(θ π/2)2 χ 0 . − − ≤ − − r ≤ The term (θ π/2) is at most δ in magnitude on I , so − r r rδ4 er(log v 1) + r(θ π/2)2 χ 0 , − r ≤ − − r ≤ and hence   1 r er(log v 1) + r(θ π/2)2 χ 0 . − r log r ≤ − − r ≤     Now let r to get →∞ er(log v 1) + r(θ π/2)2 χ 0 uniforly. − − r −→ This proves (i).  For (ii), first observe that about θ = π/2,

cos2σ θ (θ π/2)2σ. ≤ − Thus

σ 2σ 1/2 r(θ π/2)2 r cos θr e− − dθ ZIr

σ 2σ 1/2 r(θ π/2)2 r (θ π/2) r e− − dθ ≤ − ZIr

σ ∞ 2σ 1/2 r(θ π/2)2 r (θ π/2) r e− − dθ . ≤ − Zπ/2

91 Chapter 7. Lanczos’ Limit Formula

Now make the change of variables u = r(θ π/2)2, du =2r(θ π/2)dθ. − − This gives

σ ∞ 2σ 1/2 r(θ π/2)2 r (θ π/2) r e− − dθ . − Zπ/2

σ 1/2 1 σ 1 ∞ u − 1/2 u = r − r e− du 2 0 r Z  

1 ∞ σ 1/2 u = u − e− du 2 Z0

1 = Γ(σ +1/2) . 2

That is,

σ 2σ 1/2 r(θ π/2)2 1 r cos θr e− − dθ Γ(σ +1/2) . ≤ 2 ZIr This proves (ii) and completes the proof.

Lemma 7.4. Suppose Re(z) 0, and let ≥

2z 1/2 r(θ π/2)2 (r, z)= cos θr e− − dθ . I3 ZKr Then z lim r 3(r, z)=0. r →∞ I

92 Chapter 7. Lanczos’ Limit Formula

Proof of Lemma 7.4:

z 2z 1/2 r(θ π/2)2 r cos θr e− − dθ ZKr

σ 1/2 r(θ π/2)2 r r e− − dθ ≤ ZKr

σ ∞ u2 = r e− du , Z√rδr

this last line a result of the change of variables u = √r(θ π/2). This − can be expressed in terms of the error function

x 2 t2 erf(x)= e− dt √π Z0 e x2 1 − as x . ≈ − √πx →∞

Picking up where we left off then we have

σ ∞ u2 σ √π r e− du = r 1 erf(√rδ ) 2 − r Z√rδr  

2 1 e (√rδr) rσ − ≈ 2 √rδr

1 σ 1/4 1/4 (r/ log r)1/2 = r − (log r) e− 2

0asr , −→ →∞

completing the proof.

93 Chapter 7. Lanczos’ Limit Formula

Lemma 7.5. For integer k,

1 ∞ 1/2 r(θ π/2)2 k k2/r cos (2kθ)r e− − dθ =( 1) e− . (7.5) √π − Z−∞ Proof of Lemma 7.5: The integral in (7.5) is the real part of

1 ∞ 1/2 i2kθ r(θ π/2)2 r e − − dθ √π Z−∞

k k2/r 1 ∞ 1/2 r(θ i2k+πr )2 =( 1) e− r e− − 2r dθ upon completing the square − √π Z−∞

k k2/r 1 ∞ 1/2 rθ2 =( 1) e− r e− dθ with a simple contour shift − √π Z−∞

k k2/r =( 1) e− . −

We are now in a position to prove (7.1). Proof of Theorem 7.1: Recall equation (7.2) which is true for all r 0: ≥ z + er +1/2 z+1/2 π/2 r1/2 (v/e)er sin θ Γ(z+1/2)=2rz cos2z θ dθ . er π/2 log v   Z− From the definitions of 1(r, z), 2(r, z)and 3(r, z) in Lemmas 7.2, 7.3 and 7.4, respectively, I I I z + er +1/2 z+1/2 π/2 r1/2 (v/e)er sin θ 2rz cos2z θ dθ er π/2 log v   Z−

z + er +1/2 z+1/2 =2rz er   1 ∞ 2z 1/2 r(θ π/2)2 (r, z)+ (r, z) 2 (r, z)+ cos θr e− − dθ . × I1 I2 − I3 2  Z−∞ 

94 Chapter 7. Lanczos’ Limit Formula

Now let r and apply Lemmas 7.2, 7.3 and 7.4 to get →∞ z 1 ∞ 2z 1/2 r(θ π/2)2 Γ(z +1/2) = 2 lim r cos θr e− − dθ . r 2 →∞ Z−∞ Finally, replace cos2z θ with its Fourier series (see Section 3.3)

∞ 2 Γ(z +1/2) cos2z θ = ′ H (z)cos(2kθ) √π Γ(z +1) k 0 X and integrate term by term using Lemma 7.5 to get

∞ z Γ(z +1/2) ′ k k2/r Γ(z +1/2)=2 limr ( 1) e− Hk(z) . r Γ(z +1) − →∞ 0 X Canceling the Γ(z +1/2) terms and moving Γ(z + 1) to the left hand side completes the proof.

7.3 Additional Remarks

In his original paper [14], Lanczos claims that the limit in Theorem 7.1 converges for all z away from the negative integers and defines the gamma function in this region. The proof given here, however, does not extend to the left hand plane. From his comments following the statement of the theorem, he seems to base the limit formula on the limiting behaviour of the individ- ual coefficients ak(r), not on the limiting behaviour of the integral (7.2). Specifically, the comparison appears to be

∞ z+1/2 (z+r+1/2) ′ Γ(z +1)=√2π (z + r +1/2) e− ak(r)Hk(z) Xk=0

z + er +1/2 z+1/2 ∞ πr a (er) =2rz ′ k H (z) er 2 eer k k=0 r   X

∞ z ′ k k2/r 2r ( 1) e− H (z) . ≈ − k 0 X 95 Chapter 7. Lanczos’ Limit Formula

This suggests that for large r,

πr ak(er) k k2/r ( 1) e− , 2 eer ∼ − r or, by rescaling r,

k r ek2/r 2e 1 Q(k,r)=( 1) e − (ak(r))− 1 . − rπr ∼ Plots of log Q(k,r) for r =10, 20 and 50 support this conjecture; refer to Figure 7.2, 7.3 and 7.4, taking note of the different vertical scales.

90

90 − 0 k 24 Figure 7.2: log Q(k, 10), k =0,...,24

96 Chapter 7. Lanczos’ Limit Formula

35

35 − 0 k 24 Figure 7.3: log Q(k, 20), k =0,...,24

2

2 − 0 k 24 Figure 7.4: log Q(k, 50), k =0,...,24

97 Chapter 8 Implementation & Error Discussion

In order to use the main formula (1.1) in practice to compute values of Γ(z + 1), the series (1.2) is truncated and an estimate of the tail of the series ǫr,n(z)= k∞=n+1 ak(r)Hk(z) is therefore required. The error function ǫr,n(z) is essentially the relative error, and in this chapter uniform bounds on thisP function are established for z in the right-half complex plane. The chapter begins with a brief discussion of the various notions of error which arise in approximation theory. Following the introduc- tion of some new notation and an important theorem, Lanczos’ own error estimates and those of Luke [17] are examined. The final sec- tion deals with numerical investigations motivated by the observation that the error function ǫr,n(z) is the tail of an absolutely and uniformly convergent series, and as such, possesses the desirable properties of an analytic function. In particular, the maximum modulus of the error function in the right half plane will be shown to occur on the imaginary axis. Furthermore, the value of this maximum can be easily estimated empirically with the mapping t it/(1 t) of the interval [0, 1) onto → − the positive imaginary axis. Finally, the limiting behaviour of ǫr,n(z) as z is examined which leads to error bounds much improved on those→∞ given by Lanczos in [14]. The principal results of this chapter are the proof that the maxi- mum of ǫ (z) in the right half plane occurs on the imaginary axis | r,n | (Theorem 8.1), and the optimal formulas resulting from the method of empirically bounding ǫr,n(z) given in Section 8.5.

98 Chapter 8. Implementation & Error Discussion 8.1 A Word or Two about Errors

Before we begin, we should clarify the various notions of “error” present in the literature. The definition and use of absolute error is a universal standard, and the distinction between absolute and relative error is fairly clear. The term “relative error” itself, however, is given slightly different treatment depending on the author. At the end of the day, these different treatments amount to essentially the same thing, but the subtle differences between them are worth noting and so are pointed out here.

8.1.1 Absolute and Relative Error

This discussion will be in the context of the gamma function. As such, let G(1 + z) denote an approximation to Γ(1 + z), and let ǫα denote the difference between the approximation and the actual value of the function: ǫ (z)=Γ(1+z) G(1 + z) . α − This is often termed the “absolute error”, even without taking the modulus of ǫα. The relative error is here denoted ǫρ(z), and it is defined according to the commonly accepted notion of (actual-estimate)/actual:

Γ(1 + z) G(1 + z) ǫ (z)= − ρ Γ(1 + z)

ǫ (z) = α . (8.1) Γ(1 + z)

From the definition of ǫρ(z), and assuming ǫρ(z) < 1, Γ(1+z) may be expressed | |

G(1 + z) Γ(1 + z)= (8.2) 1 ǫ (z) − ρ

= G(1 + z)[1 + ǫ (z)+ǫ (z)2 + ] (8.3) ρ ρ ···

G(1 + z)(1 + ǫ (z)) . (8.4) ≈ ρ

99 Chapter 8. Implementation & Error Discussion

It is common in the literature to encounter expressions of the type Γ(1 + z)=G(1 + z)(1 + ǫ(z)), where ǫ(z) is termed the relative error. This is not, strictly speaking, relative error in the sense of (8.1), but comparison with equations (8.3) and (8.4) shows that it is essentially the same (up to first order). One may ask why relative error is of concern in the first place, when it seems more natural to ask only that estimated quantities be within a prescribed accuracy of their true values. The answer is that relative error is a measure of error as a proportion of the true answer, so that nu- merically, it reports the number of reliable digits in our approximation. This is an especially important consideration when performing floating point calculations in which the maximum number of digits is fixed. To appreciate the distinction, consider an example: suppose two different approximations x1 = 123 and x2 =0.123 are computed, both with a relative error of ǫ =0.1. Then the actual errors are x ǫ /(1 ǫ ), ρ k ρ − ρ k =1, 2, which are approximately 14 and 0.014, respectively. This means that for both x1 and x2, the first non-zero digit is good while the second may be in question. By contrast, if x1 and x2 both have absolute error 0.1, then the estimate for x2 = 123 appears acceptable, while that for x2 =0.123 is clearly a poor one.

8.1.2 Lanczos’ Relative Error

The Lanczos notion of relative error is quite different from both (8.1) and (8.4). In his work, he writes

z+1/2 (z+r+1/2) Γ(z +1)=(z + r +1/2) e− √2π [Sr,n(z)+ǫr,n(z)] (8.5)

where Sr,n(z) is the series (1.2) truncated after a finite number of terms, and he calls ǫr,n(z) the relative error. It turns out that Sr,n(z) 1 in the right half plane, so that Lanczos’ notion is very close to (8.4).≈ The relationship between ǫr,n(z) and (8.1) is

ǫr,n(z) ǫρ = (z+1/2) z+r+1/2 1/2 . Γ(z +1)(z + r +1/2)− e (2π)− Spouge makes this same observation in [27] and shows that for Re(z) 0, the denominator is bounded below by ≥

1/2 (z+1/2) z+r+1/2 1/2 e Γ(z +1)(z + r +1/2)− e (2π)− , | |≥ π   100 Chapter 8. Implementation & Error Discussion where upon selecting r = z = 0 the bound in this inequality is sharp. Thus π 1/2 ǫ ǫ (z) , (8.6) | ρ|≤ e | r,n | . and since (π/e) =1.075, bounding  relative error in the Lanczos sense gives essentially the same bound for ǫ , the standard notion of relative p ρ error. For the purposes of this study z will be restricted to Re(z) 0 ≥ and as such the Lanczos notion of relative error will be used.

It should be pointed out, however, that with ǫr,n(z) something is lost if z is moved to the left of the imaginary axis. As we saw in Chapter 5, the formula (1.1) extends to the region Re(z) > r not − including the negative integers. Lanczos’ relative error ǫr,n(z) has poles at the negative integers in this case, and becomes unbounded. ǫρ(z), on the other hand, is analytic in this region, and it is therefore possible to give meaning to the relative error in the approximation near the poles.

8.1.3 Restriction to Re(z) ≥ 0

To conclude the introductory remarks about errors, the following com- mon practice specific to the gamma function is important. Recall the reflection formula (2.10) which permits the evaluation of gamma in the left half plane once its values in Re(z) 0 are known: ≥ πz Γ(1 + z)Γ(1 z)= . − sin πz Already this says that methods used to estimate Γ(1 + z) need only be valid on Re(z) 0. ≥ Now suppose Γ(1 + z) is computed with a relative error of ǫρ, that is, G(1 + z) Γ(1 + z)= . 1 ǫ − ρ Then by the reflection formula, πz 1 ǫ Γ(1 z)= − ρ − sin πz G(1 + z) πz 1 1 = sin πz G(1 + z) 1+ǫ + ǫ2 + ρ ρ ··· πz 1 1 .  ≈ sin πz G(1 + z) 1+ǫρ

101 Chapter 8. Implementation & Error Discussion

In other words, to compute Γ(1 z) to a relative error of ǫ , it is − − ρ sufficient to compute Γ(1 + z) to a relative error ofǫ ρ, and vice versa. Thus when using a particular method to compute Γ(1+z), it is sufficient to be able to bound relative error for Re(z) 0. ≥

8.2 Some Notation and a Theorem

This section lists notation which will be used throughout the remainder of this study, and concludes with the proof of an important theorem. Some of the functions noted here have been introduced previously, but are repeated here for easy reference.

1. Recall the definition of Hk(z):

H0(z)=1,

and for k 1, ≥ Γ(z +1)Γ(z +1) H (z)= k Γ(z k +1)Γ(z + k +1) −

z (z k +1) = ··· − (z +1) (z + k) ···

Observe that Hk(z) is a meromorphic function with simple poles at z = 1,..., k and simple zeros at z =0,...,k 1. Also, − − − H (z) 1as z . k → | |→∞ 2. Write (1.1) as

z+1/2 (z+r+1/2) Γ(z +1)=√2π (z + r +1/2) e− [Sr,n(z)+ǫr,n(z)]

where n ′ Sr,n(z)= ak(r)Hk(z) Xk=0 and ∞ ǫr,n(z)= ak(r)Hk(z) . k=Xn+1

102 Chapter 8. Implementation & Error Discussion

3. Let

(z+1/2) z+r+1/2 1/2 Fr(z)=Γ(z +1)(z + r +1/2)− e (2π)− .

By Stirling’s formula, F (z) 1as z in any half plane r → | |→∞ Re(z) σ. ≥ Note that ǫ (z)=F (z) S (z), (8.7) r,n r − r,n and that n ′ lim ǫr,n(z)=1 ak(r) , z − | |→∞ Xk=0 again in any half plane Re(z) σ, in particular for z in the right half plane Re(z) 0. In view≥ of this last limit, the error at ≥ infinity is denoted

n ′ ǫ∞ =1 a (r) . r,n − k Xk=0 4. Let n η (θ)=f (θ) ′ a (r)cos(2kθ) , r,n E,r − k Xk=0 the error in the (n + 1)-term Fourier series approximation of f (θ), where f (θ) has the meaning of (3.7). Then η ( π/2) E,r E,r r,n − is the Fourier error at θ = π/2, which is, incidentally, equal to ǫ ( 1/2). − r,n − From equation (8.7) we state

Lemma 8.1. For r 0, ǫr,n(z) is analytic as a function of z in Re(z) > 1/2. ≥ − Proof of Lemma 8.1: In this region Re(z + r +1/2) > 0 so that F (z) is analytic there, as are the functions H (z), k 0, and hence by r k ≥ equation (8.7), so is ǫr,n(z).

The following lemma is a consequence of the maximum modulus principle:

103 Chapter 8. Implementation & Error Discussion

Lemma 8.2. Suppose f is analytic in the right half plane Ω= Re(z) { ≥ σ and has the property } lim f(z) = C< . (8.8) z | | ∞ | z|→∞Ω ∈

Let B = supz Ω f(z) . Then B = supRe( z)=σ f(z) . ∈ | | | | Proof of Lemma 8.2: Since f is analytic on Ω, by (8.8) it is bounded so B exists, and we have C B. Now there are two possibilities: ≤

(i) If B = C, then B = limt f(σ + it) ; otherwise →∞ | | (ii) B>C. For this second case, for any compact K Ω, denote by M the maximum of f on K, and consider the⊂ sequence of K | | closed right-half semi-disks Ω ∞ centered at the origin, each { j}j=1 Ωj having radius j and diameter on the line Re(z)=σ. By the maximum modulus principle,

MΩj = M∂Ωj ,

and M∂Ωj increases monotonically to B. Write the boundary of Ωj as the union of two closed segments

∂Ω = I A , j j ∪ j

where Ij is the diameter and Aj the semicircular arc of ∂Ωj . Now

lim M∂Ω = B, j j →∞ so that lim max MI ,MA = B, j j j →∞ { } but lim MA = C

104 Chapter 8. Implementation & Error Discussion

Theorem 8.1. For r 0 and Re(z) 0, the supremum of ǫ (z) in ≥ ≥ | r,n | this region occurs on the line z = it, possibly at z = i . ∞ Proof of Theorem 8.1: Recall that

n ′ lim ǫr,n(z)=1 ak(r) . z − | |→∞ Xk=0

ǫr,n(z) is analytic by Lemma 8.1; now apply Lemma 8.2.

Theorem 8.1 is significant since it reduces the problem of bounding ǫ (z) in the right half plane to that of bounding it on the imaginary | r,n | axis.

8.3 Lanczos’ Error Estimates

The following passage taken from [14] is the only commentary Lanczos makes concerning errors in the approximating formula:

A good check on the accuracy of the truncated Fourier series is provided by evaluating the approximate value of f (θ)1 at θ = π/2, that is by forming the alternate sum r − 1 π er ρ0 ρ1 + ρ2 ρ3 + = fr = . 2 − − ··· − 2 √2   We know from the theory of the Fourier series that the max- imum local error (after reaching the asymptotic stage) can be expected near to the point of singularity. Let this error be η. Then a simple estimation shows that the influence of this error on the integral transform (16) (for values of z which stay within the right complex half plane), cannot be greater than (π/2)η. Thus we can give a definite error bound for the approximation obtained.

1In his paper, Lanczos uses γ instead of r to denote the free parameter ap- pearing in the formula. The variable r is used here to avoid confusion with Euler’s constant.

105 Chapter 8. Implementation & Error Discussion

The “integral transform (16)” referred to here is the integral in (3.6):

+π/2 2z cos (θ)fr(θ) dθ , π/2 Z− and Lanczos’ comments relate the error in truncating the series in (1.1) th after the n term, ǫr,n(z), to the error ηr,n(θ)inthe(n+1)-term Fourier series approximation of fE,r(θ). Based apparently on this observation, he gives uniform error bounds for Re(z) 0 as listed in Table 8.1. ≥ n r ǫ (z) < | r,n | 1 1 0.001 1 1.5 0.00024 5 2 2 5.1 10− × 6 3 2 1.5 10− × 6 3 3 1.4 10− × 8 4 4 5 10− × 10 6 5 2 10− × Table 8.1: Lanczos’ uniform error bounds

The steps connecting Lanczos’ observation about ηr,n(θ) to the uni- form error bounds in the table elude me, and it is unclear how he makes the leap from one to the other. One of his error bounds does appear incorrect, although this may simply be a matter of round-off. For r =4 8 and n = 4, he gives ǫ (z) < 5 10− . It is a simple matter to compute | 4,4 | × directly

4 a0(4) lim ǫ4,4(it) =1 ak(4) t | | − 2 − →∞ k=1 . 8 X =5.3 10− . ×

His assertion about maximum errors in Fourier approximation oc- curring “near to the point of singularity” is questionable as well, if not incorrect altogether. It seems to rely on some sort of Gibbs effect prin- ciple, and would be accurate if fE,r(θ) had a finite jump discontinuity at θ = π/2. In this case, however, f (θ) is continuous at the endpoints − E,r

106 Chapter 8. Implementation & Error Discussion

n r θr,n 1 1 π/2 − 1 1.5 0 2 2 π/2 − 3 2 0.72 ≈− 3 3 π/2 − 4 4 0 6 5 π/2 −

Table 8.2: Location of maximum of ηr,n(θ)

n r ǫr,n∞ | | 4 1 1 8.0 10− × 4 1 1.5 2.2 10− × 5 2 2 5.0 10− × 7 3 2 9.1 10− × 6 3 3 1.1 10− × 8 4 4 5.3 10− × 10 6 5 1.9 10− × Table 8.3: Errors at infinity

and has an infinite jump discontinuity in one of its higher derivatives (its 2r + 1 derivative to be precise). Numerical checks show that ⌊ ⌋ Lanczos’ assertion only holds in four of the seven cases noted. Specif- ically, letting θ denote the least value of θ in [ π/2,π/2] where the r,n − maximum of ηr,n(θ) occurs, we find (empirically) the values listed in Ta- ble 8.2. Indeed, it is not difficult to construct examples in which ηr,n(θ) is zero at θ = π/2. Take for example n =1andr =1.500773 . − ··· In this case the maximum of ηr,n(θ) is approximately 0.00024 and it occurs at θ =0. | | One may surmise that Lanczos’ bounds are, for each choice of r and

n, simply the error at infinity, ǫr,n∞ . A little calculation shows this is close, but not the case in all instances; see Table 8.3. The apparent coincidence is likely due to the fact that for many choices of r, the maximum of ǫr,n(z) does occur as z . This is not the case in general though,| as will| soon be seen.| |→∞

107 Chapter 8. Implementation & Error Discussion

Despite the lack of explanation, Lanczos’ uniform error bounds are all correct, except for the slight difference in the r = n = 4 case as noted. Empirical checks show that his bounds are not tight, though there is little room for improvement.

8.4 Luke’s Error Estimates

Except for verbatim quotes of Lanczos’ own estimates [7] [21], the only other work in this direction to be found in the literature is that of Luke in [17, p.31]. There the author makes observations similar to Lanczos’ concerning the maximum of ηr,n(θ) near singularities off E,r(θ), and he uses this notion to bound ǫr,n(z) for σ = Re(z ) > 0. Luke’s bound is reproduced here. From the derivation in Section 3,

∞ ǫr,n(z)= ak(r)Hk(z) k=Xn+1 ∞ π/2 1 Γ(z +1) 2z = ak(r) cos θ cos 2kθdθ √π Γ(z +1/2) π/2 k=Xn+1 Z− π/2 1 Γ(z +1) 2z = cos θηr,n(θ) dθ √π Γ(z +1/2) π/2 Z−

Thus, assuming η (θ) is maximized at θ = π/2, | r,n | − π/2 1 Γ(z +1) 2σ ǫr,n(z) cos θ ηr,n( π/2) dθ | |≤√π Γ(z +1/2) π/2 | − | Z−

1 η ( π/2)Γ( z +1) Γ(σ +1)Γ(σ +1/2) = r,n − √π √π Γ(z +1/2) Γ(σ +1)Γ(σ +1)

η ( π/2)Γ(z +1) Γ(σ +1/2) = r,n − . Γ(z +1/2) Γ(σ +1)

Unfortunately, this argument breaks down when one considers that η ( π/2) has zeros as a function of r, as was pointed out in the r,n − discussion of the Lanczos’ error bounds. Otherwise, we would find

108 Chapter 8. Implementation & Error Discussion ourselves in the most agreeable situation of having a closed form formula for Γ(z+1) on the right half plane. Furthermore, this error bound is not uniform since it grows without bound as z along lines parallel to the imaginary axis. | |→∞ This subtle role of r on the error bounds motivates a closer exami- nation of ǫr,n(z) as a function of r.

8.5 Numerical Investigations & the Zeros ∞ of ǫr,n

When terminating the series (1.2) at a finite number of terms, other authors [7] [27] suggest an optimal strategy of choosing the truncation order n based on the value of the parameter r. The guiding principle in this approach seems to be that large r values produce small relative errors. However, this approach does not take full advantage of many of the nice properties of the error as a complex analytic function. Instead, approach the problem the other way around: for a given truncation or- der n, what value of r minimizes the uniform error bound? This section presents the results of a series of numerical investigations undertaken to shed some light on the the dependence of the relative error as a function of r.

8.5.1 The Motivating Idea

The idea to examine ǫr,n(z) as a function of r stems from the following line of reasoning: by Theorem 8.1, for a fixed r and n, the maximum MΩ of ǫr,n(z) in the right half plane occurs on the imaginary axis, possibly| at z =| i . In fact, by the Schwartz reflection principle, one need only consider± ∞ the positive imaginary axis. Using Stirling’s series as a guide, if possible, select r = r so that the corresponding error at ∗ infinity, ǫr∞∗,n, is zero. This forces the location of the maximum onto a bounded segment of the imaginary axis, hopefully close to the origin. This gives two possibilities (for this r = r ): ∗

109 Chapter 8. Implementation & Error Discussion case (i): MΩ =0

This case is impossible, for otherwise the result would be a closed form expression

√ z+1/2 (z+r∗+1/2) Γ(z +1)= 2π (z + r +1/2) e− Sr∗,n(z) ∗ which could be continued analytically to the slit plane C ( , r \ −∞ − ∗ − 1/2), but which would remain bounded near (n +1), (n +2),..., contrary to the unboundedness of Γ at the negative− integers.−

case (ii): MΩ > 0

In this case the maximum of ǫr∗,n(z) occurs on a bounded segment of the imaginary axis; the question| remains:| how to locate it? Experi-

mentally, for each n =0,...,10, zeros r were found and ǫr∗,n(z) on ∗ | | the segment [0, 2in] was examined. In each case the error function was found to have a single local maximum on this set. Could there be other local maxima further up the imaginary axis? The difficulty is that

ǫr∗,n(z) in the form (8.7) is a complicated function, and maximizing it on| the positive| imaginary axis using analytical methods is not easy. The problem is partially overcome with the following observation: under the transformation z = it/(1 t), 0 t<1, which maps the − ≤ unit interval onto the positive imaginary axis, the rational functions Hk(z) take the form

k 1 − z(t) j H (z(t)) = − k z(t)+j +1 j=0 Y

k 1 − it/(1 t) j = − − it/(1 t)+j +1 j=0 Y −

k 1 − t(i + j) j = − . t(i j 1)+ j +1 j=0 Y − −

The Hk(z(t)) expressions in this last form are numerically stable and readily computable for 0 t<1. The upshot of this observation is that ≤ 110 Chapter 8. Implementation & Error Discussion

under the assumption that the first few terms of series ǫr,n(z) contain the bulk of the error, which turned out to be the case in practice, the error can be easily estimated as

M

ǫr∗,n(z(t)) ak(r )Hk(z(t)) ≈ ∗ k=Xn+1

for M not too large. The problem of bounding ǫr∗,n(z) in the right half | M| plane reduces to that of estimating the maximum of ak(r )Hk(z(t)) k=n+1 ∗ for t [0, 1). ∈ P With this strategy, the existence of zeros of ǫr,n∞ is no longer an issue; for any r 0, simply examine the finite series approximation of ǫ (z(t)) ,0 ≥ t<1. It turned out in practice, however, that for | r,n | ≤ each n examined, setting r to be the largest zero of ǫr,n∞ produced the smallest uniform error bound for ǫ (z(t)) . | r,n |

∞ 8.5.2 Zeros of ǫr,n

The question remains, for n fixed, does ǫr,n∞ have zeros as a function of r? The answer was found to be yes in all cases examined. Refer to Fig- 1/5 ure 8.1 for plots of [ǫr,n∞ ] , n =0, 1, 2, 3, showing the location of zeros for the first few cases.2 The plots of Figure 8.1 motivated an extensive numerical investigation resulting in empirical data on the number, the

smallest and the largest zeros of ǫr,n∞ n =0,...,60. The results of this investigation are listed in Tables C.1 and C.2 of Appendix C. From

these tables, ǫr,n∞ appears to have about 2n zeros, and the largest zero appears to be about size n. Beyond these superficial observations, there is no more obvious trend in the data.

8.5.3 Improved Lanczos Formula

As an example of how these observations can be applied to achieve improved error bounds, consider the case n = 6 which is the last case for which Lanczos gives an explicit formula and error bounds in [14].

2The functions ǫ decrease rapidly with n, yet grow very quickly once r n, r,n∞ ≈ and so to show the plots on a single set of axes the fifth roots of these functions are plotted.

111 Chapter 8. Implementation & Error Discussion

1

∞ 1/5 [ǫr,1]

∞ 1/5 [ǫr,3]

r 5

∞ 1/5 [ǫr,2]

∞ 1/5 [ǫr,0]

1 −

1/5 Figure 8.1: ǫ∞ , n =0, 1, 2, 3, 1/2

That is,

6 z+1/2 (z+r+1/2) ′ Γ(z+1) = √2π (z+r+1/2) e− ak(r)Hk(z)+ǫr,6(z) . " # Xk=0 With the choice of r = 5, Lanczos gives a uniform error bound of 10 ǫ (z) < 2 10− . | r,6 | × Twelve zeros of ǫr,∞6 were found; call these r0,r1,...,r11. For each of these zeros, using the estimation techniques of Section 8.5.1, the maximum M of ǫ (it/(1 t)) was estimated along with its loca- rj ,6 rj ,6 − tion on the imaginary axis using first fifteen terms of ǫ (it/(1 t)) . rj ,6 −

112 Chapter 8. Implementation & Error Discussion

. Table 8.4 summarizes the results. Notice that the largest zero, r = 12 6.779506 yields the least maximum error of 2.72 10− , nearly 1/ 100 of Lanczos’ estimate. ×

j rj t/(1 t) Mrj ,6 − 4 0 0.117620 0.565599 4.71 10− − × 6 1 0.684391 1.525502 2.75 10− × 8 2 1.450013 2.388058 8.88 10− × 9 3 2.182290 3.172714 6.78 10− × 10 4 2.883225 3.887447 9.30 10− × 10 5 3.553321 4.538907 1.99 10− × 11 6 4.191832 5.133674 6.07 10− × 11 7 4.796781 5.678871 2.49 10− × 11 8 5.364813 6.183352 1.30 10− × 12 9 5.891184 6.660957 8.02 10− × 12 10 6.372580 7.137483 5.29 10− × 12 11 6.779506 7.883760 2.72 10− ×

Table 8.4: Approximate Zeros of ǫr,∞6

Plots of log ǫ (it/(1 t)) for j =0, 1,...,11 are shown in Fig- rj ,6 − ure 8.2. Observe that the maximum of the curve associated with the largest zero r11 gives the smallest maximum error of approximately exp ( 26.6). − To get an idea of how the maximum error along the imaginary axis varies with r , refer to Figure 8.3 in which log ǫ (it/(1 t)) is plotted | r,4 − | for 0

3For graphing purposes the t range was truncated slightly before t = 1, and so the vertical asymptotes associated with the ends of the troughs are not present in the plot.

113 Chapter 8. Implementation & Error Discussion

0 t 1

7 r0 −

r1

r2

r3

21 −

r11

35 −

Figure 8.2: log ǫ (it/(1 t)) ,0

8.5.4 Optimal Formulas

In practice, for each value of n examined, the largest zero of ǫr,n∞ was found to produce the smallest maximum error (among all zeros), and bounds much improved on Lanczos’ estimates. Tables C.1 and C.2 of

Appendix C lists, for n =0,...,60, the largest zero of ǫr,n∞ , denoted r(n), the corresponding estimates Mr(n),n,5 and Mr(n),n,15 of the maxi- mum of ǫ (it/(1 t)) using five and then fifteen terms of the sum, r(n),n − respectively, and finally, the location of the maximum of ǫ (it) on r(n),n the imaginary axis.4. From this data it appears that five terms of the

series ǫ (it/(1 t)) suffice to estimate the maximum error in all r(n),n − 4 Of particular interest is the n = 1 case. In Lanczos’ original paper [14] he remarks:

Particularly remarkable is the approximation of only two terms

114 Chapter 8. Implementation & Error Discussion

6 −

22 − 0

0 t

1 r 5

Figure 8.3: log ǫ (it/(1 t)) ,0

(γ =1.5):

z+1/2 (z+2) 1.084635 z!=(z + 2) e− √2π 0.999779 + , z +1   which is correct up to a relative error of 2.4 10 4 everywhere · − in the right complex half plane.

Note that we use r to denote what Lanczos called γ to avoid confusion with Euler’s constant. It turns out that for n = 1, r =1.5 is coincidentally very close to 1.489193 , the largest zero of ǫ . ··· r,∞1

115 Chapter 8. Implementation & Error Discussion the coefficients as in equation (6.14) yields the approximation

e z + r(10)+ 1/2 z+1/2 10 d Γ(z +1) 2 d + k , ≈ π e 0 z + k r " k=1 #   X where the coefficients dk are as given in Table 8.5.

k dk 5 0 +2.48574089138753565546 10− × 1 +1.05142378581721974210 100 × 2 3.45687097222016235469 100 − × 3 +4.51227709466894823700 100 × 4 2.98285225323576655721 100 − × 5 +1.05639711577126713077 100 × 1 6 1.95428773191645869583 10− − × 2 7 +1.70970543404441224307 10− × 4 8 5.71926117404305781283 10− − × 6 9 +4.63399473359905636708 10− × 9 10 2.71994908488607703910 10− − × Table 8.5: Sample coefficients, n = 10, r =10.900511

8.6 Additional Remarks

Although the results of Section 8.5 are empirical in nature, the resulting formulas and corresponding error bounds seem promising, and lead to many unanswered questions. In particular,

(i) For each n 0, how many zeros does ǫr,n∞ have? What is the largest zero?≥

(ii) For fixed n, why does the largest zero of ǫr,n∞ seem to give rise to the smallest uniform bound on ǫ (z) ? | r,n | (iii) For fixed n and r, is it possible to analytically determine the maximum of ǫ (it/(1 t)) for t [0, 1)? | r,n − | ∈ (iv) Perhaps most importantly, given ǫ>0, what is the best choice of r and n to estimate Γ with a relative error of at most ǫ?

116 Chapter 8. Implementation & Error Discussion

It was observed early in the investigation that, not only does ǫr,n∞ have zeros as a function of r, but so too do the individual ak(r). This is not surprising, since

∞ ǫ∞ = a (r) a (r) , r,n k ≈ n+1 k=Xn+1 assuming the coefficients are rapidly decreasing. However, the relation-

ship between ǫr,n∞ and an+1(r) is eye opening; refer to Figures 8.4 and 1/7 1/7 8.5 for plots of [ǫr,∞6] and [a7(r)] , respectively. Both functions are then plotted in Figure 8.6 and the plots are virtually indistinguishable. 0.5

∞ 1/7 [ǫr,6]

5 r

0.5 −

1/7 Figure 8.4: [ǫ∞ ] , 0.2

Numerical checks show that the zeros of ǫr,n∞ and an+1(r) nearly co- incide in the cases examined. Furthermore, at r(n) equal the largest

zero of ǫr,n∞ , an+1(r(n)) appears to be a very good estimate for the max- imum of ǫ (it/(1 t)) on [0, 1). This observation seems in-keeping | r,n − | with the rule of thumb for asymptotic series with rapidly decreasing terms: the error is about the size of the first term omitted. Oddly, though, this is not the situation here: the second coefficient omitted is almost exactly the same size as the first, but of opposite sign. These observations are summarized in Table 8.6 where for each n =0,...,12,

117 Chapter 8. Implementation & Error Discussion

0.5

1/7 [a7(r)]

5 r

0.5 −

Figure 8.5: [a (r)]1/7, 0.2

0.5

5 r

0.5 −

1/7 1/7 Figure 8.6: [ǫ∞ ] and [a (r)] , 0.2

listed are r(n), the estimated uniform error bound Mr(n),n,15, and the first two terms omitted from the series, an+1(r(n)) and an+2(r(n)).

118 Chapter 8. Implementation & Error Discussion

n r(n) Mr(n),n,15 an+1(r(n)) an+2(r(n)) 3 3 3 0 0.319264 5.5 10− +5.4 10− 7.7 10− × 4 × 4 − × 4 1 1.489194 1.0 10− 1.0 10− +1.1 10− × 7 − × 7 × 7 2 2.603209 6.3 10− +5.3 10− 3.4 10− × 8 × 8 − × 8 3 3.655180 8.5 10− +8.4 10− 9.3 10− × 9 × 9 − × 9 4 4.340882 4.3 10− +4.2 10− 4.6 10− × 10 × 10 − × 10 5 5.581000 1.2 10− 1.2 10− +1.2 10− × 12 − × 12 × 12 6 6.779506 2.7 10− +2.7 10− 2.5 10− × 14 × 14 − × 14 7 7.879012 3.9 10− +3.6 10− 4.7 10− × 15 × 15 − × 15 8 8.406094 6.9 10− +6.9 10− 7.1 10− × 16 × 16 − × 16 9 9.656578 2.1 10− 2.0 10− +2.0 10− × 18 − × 18 × 18 10 10.900511 6.1 10− +6.1 10− 5.9 10− × 19 × 19 − × 20 11 12.066012 1.1 10− 1.1 10− +9.1 10− × 21 − × 21 × 21 12 13.144565 5.2 10− 5.1 10− +5.6 10− × − × ×

Table 8.6: Comparison of Mr(n),n and an+1(r(n))

The data in Table 8.6 would lead one to conjecture that

M a (r(n)) , r(n),n ≈| n+1 |

which, if true, provides a much simpler method for bounding ǫr(n),n(z) in the right-half plane. | |

119 Chapter 9 Comparison of the Methods

In this chapter we revisit the computation of Γ(1 + z) from Chapter 2 for the purpose of comparing Lanczos’ method against those of Stirling and Spouge. For each of these methods Γ(20 + 17i) is computed with a 32 relative error ǫρ < 10− , and then formulas for Γ(1+ z) are given for | | 32 each with a uniform error bound of 10− in the entire right-half plane Re(z) 0. ≥

9.1 Stirling’s Series

For this section recall the notation of Section 2.5: let

∞ B (x) E (z)= 2n dx , N,n 2n(z + N + x)2n Z0

denote the integral error term of equation (2.11), and denote by UN,n(z) the upper bound on EN,n(z) given by Theorem 2.3:

1 2n+2 B U (z)= 2n+2 . N,n cos (θ/2) (2n + 2)(2n +1)(z + N)2n+1  

−32 9.1.1 Γ(20 + 17i) with |ǫρ| < 10

Since z =19+17i is fixed, for convenience write EN,n = EN,n(19+17i) and UN,n = UN,n(19 + 17i).

From equation (8.2), EN,n is related to the relative error ǫρ via 1 eEN,n = , 1 ǫ − ρ 120 Chapter 9. Comparison of the Methods from which E ǫ =1 e− N,n . ρ − 32 EN,n 32 We want ǫρ < 10− which means 1 e− < 10− , which is guaranteed| if| | − |

32 33 E U < 10− /e 3.6 10− . | N,n|≤| N,n| ≈ × The pairs (N,n) which achieve this bound are listed in Table 9.1.

N n U < | N,n| 18 10 3.5 1033 × 10 11 2.9 1033 × 4 12 3.3 1033 × 0 13 2.6 1033 × Table 9.1: Upper bound on E (19+ 17i) in Stirling Series | N,n |

Selecting (N,n)=(4, 12), equation (2.11) yields

4 log Γ(20 + 17i) (z + k) " k=1 # Y 1 (19+ 17i +4+1/2)log(19 + 17i +4) (19 + 17i +4)+ log2π ≈ − 2 12 B + 2j , 2j(2j 1)(19 + 17i +4)2j 1 j=1 − X −

from which . Γ(20 + 17i) = 6.6530978807100357093202320786706 1013 − × + i 1.3813486137818296429873066956513 1014 . ×

Comparing this value against a high precision value produced by Maple, 34 we find a relative error of approximately 8.5 10− . × . 1 The Bernoulli numbers in the sum range in size from B2 =1.7 10− . 4 × to B24 =8.7 10 . The corresponding terms of the sum range in size ×3 32 from 2.9 10− to 5.0 10− . × × 121 Chapter 9. Comparison of the Methods

−32 9.1.2 Γ(1 + z) with |ǫρ| < 10 Uniformly

The goal this time is a formula for Γ(1 + z) with relative error ǫρ 32 | | bounded uniformly by 10− in the right-half plane. From the analysis in Section 2.5.2, UN,n(z) is maximized at z = 0, and N must be at least 1 for otherwise| U | (z) becomes unbounded as z 0+ along | N,n | → the real axis. By the same argument as in the previous section, again 33 in this case the bound UN,n(0) < 3.6 10− is sufficient to ensure 32 | | × ǫ < 10− . Computing U (0) for pairs (N,n) which achieve this | ρ| | N,n | bound results in Table 9.2. Selecting (N,n)=(17, 17), for example, we

N n UN,n(0) < | | 33 19 15 3.5 10− × 33 18 16 1.4 10− × 34 17 17 9.4 10− × 34 16 18 9.7 10− × 33 15 19 1.7 10− × 33 14 21 1.1 10− × 33 13 23 2.4 10− × 33 12 28 2.2 10− × Table 9.2: Upper bound on E (0) in Stirling Series | N,n |

thus obtain the following formula

17 log Γ(1 + z) (z + k) " # kY=1 1 (z +17+1/2)log(z + 17) (z +17)+ log2π ≈ − 2 17 B + 2j . 2j(2j 1)(z + 17)2j 1 j=1 − X −

In this case, the Bernoulli numbers in the sum range in size from . 1 . 11 B2 =1.7 10− to B34 =4.3 10 , while the corresponding terms of × × 3 33 the sum with z = 0 range in size from 4.9 10− to 9.5 10− . × ×

122 Chapter 9. Comparison of the Methods 9.2 Spouge’s Method

Before we begin, note the simplification of equation (2.17) given by the cancellation of the √2π exp( a) term which occurs in the leading fac- 1/2 − tor, and (2π)− exp(a) which occurs in each of the coefficients (2.18). Spouge’s formula may then be stated

N z+1/2 z a dk(a) Γ(z +1)=(z + a) e− √2πe− + + ǫ(z) (9.1) " z + k # Xk=1 where N = a 1, and ⌈ ⌉− k 1 ( 1) − k 1/2 k d (a)= − ( k + a) − e− . (9.2) k (k 1)! − − Under this simplification, the relative error in Spouge’s formula remains the same: √a 1 ǫ (a, z) < . | S | (2π)a+1/2 Re(z + a)

−32 9.2.1 Γ(20 + 17i) with |ǫρ| < 10

32 For ǫ < 10− we require | ρ|

√a 1 32 < 10− . (2π)a+1/2 Re(19 + 17i + a) The left hand side of this expression is eventually decreasing as a func- 32 tion of a, and drops below 10− between a = 38 anda = 39. Thus N = 38, and computing the coefficients using (9.2) results in Table 9.3. Inserting these values in equation (9.1) we find to 32 digits . Γ(20 + 17i) = 6.6530978807100357093202320786706 1013 − × + i 1.3813486137818296429873066956513 1014 . ×

In this instance, comparing this value against a high precision value 44 produced by Maple, the relative error is approximately 2.6 10− , which is much more than necessary. Through experimentation the× value a = 29 is found give the desired accuracy, and the series can thus be reduced by 10 terms.

123 Chapter 9. Comparison of the Methods

k dk(39) k dk(39) 0 +2.8947105233858572256681259383826 10−17 20 1.4612043596445044389340540663592 10−1 × − × 1 +2.2677611785616408448051623649413 100 21 +1.6856896402284750130501640213058 10−2 × × 2 3.0458858426261684740752182066857 101 22 1.5553541637142526870805344933539 10−3 − × − × 3 +1.9357212181425501030368331204744 102 23 +1.1302120506210549847428847358464 10−4 × × 4 7.7429949716371535150533416191734 102 24 6.3472060001627477262571023780708 10−6 − × − × 5 +2.1876179361012802304828398825556 103 25 +2.6919634338361067149994936318051 10−7 × × 6 4.6438537277548560417623360405775 103 26 8.3801786194339100406682820681103 10−9 − × − × 7 +7.6927388480783573540015702664876 103 27 +1.8481319798192137441154507903452 10−10 × × 8 1.0195917484892786070501293142239 104 28 2.7610263895691596705265848094462 10−12 − × − × 9 +1.0999167217153749462567889811423 104 29 +2.6382697777056113806964677703858 10−14 × × 10 9.7740178567227019446568421903035 103 30 1.4954804884394724082929843529081 10−16 − × − × 11 +7.2136820304845623606047714747868 103 31 +4.5441806633655985113201441255734 10−19 × × 12 4.4462490659018128337839056551451 103 32 6.4289947451722952263534424159053 10−22 − × − × 13 +2.2961572174783000519663098692718 103 33 +3.4516439287785093504202451110646 10−25 × × 14 9.9491746363493229520431441706026 102 34 5.1380351805226988204329822384216 10−29 − × − × 15 +3.6160749560761185688455782354331 102 35 +1.2606607461787976943234811185446 10−33 × × 16 1.1004495488313215123003718194264 102 36 1.9452281496812994762288072286241 10−39 − × − × 17 +2.7947852816195578994204731195154 101 37 +2.2292761113182594463394149297371 10−47 × × 18 5.8947917688963354031891858182660 100 38 2.2807244297698558308437038776471 10−60 − × − × 19 +1.0259323949497584239156793246602 100 × Table 9.3: Coefficients of Spouge’s series, a =39

−32 9.2.2 Γ(1 + z) with |ǫρ| < 10 Uniformly

In the case of Spouge’s method with a uniform bound the procedure is essentially the same. The bound on the relative error is greatest when 32 Re(z)=0,so for ǫ < 10− we require | ρ|

√a 1 32 < 10− . (2π)a+1/2 a

Again this is satisfied for a between 38 and 39, so N = 38 and the coefficients in the uniform case are those of Table 9.3.

124 Chapter 9. Comparison of the Methods 9.3 Lanczos’ Method

In the Lanczos case there is only one situation to consider since the error bounds developed in Chapter 8 give only uniform error bounds. For this method we examine pairs (n, r(n)), where r(n) is the largest zero of

ǫr,n∞ , and determine the least n which yields the prescribed error bound. 32 For ǫρ < 10− we find using Table C.1 that n = 21, r =22.618910 | | 34 gives the empirical bound ǫ (it/(1 t)) 2 10− for t [0, 1). | r,n − |≤ × ∈ Thus, by equation (8.6),

1/2 π 34 ǫ 2 10− | ρ|≤ e ×   34 < 2.2 10− . ×

Using the formulation (6.14), we find

e z + r(21)+ 1/2 z+1/2 21 d Γ(z +1)=2 d + k π e 0 z + k r " k=1 #   X where the coefficients dk are given in Table 9.4. Evaluating this expression at z =19+17i we find to 32 digits . Γ(20 + 17i) = 6.6530978807100357093202320786706 1013 − × + i 1.3813486137818296429873066956513 1014 . ×

42 The relative error in this calculation is less than 1.5 10− . ×

9.4 Discussion

All three methods considered here have their benefits and shortfalls, and the question of which is best is not a clearcut one. Several factors must be considered, in particular:

1. The computational cost of the method;

2. Whether the series coefficients are available in precomputed form;

125 Chapter 9. Comparison of the Methods

k dk 10 0 +2.0240434640140357514731512432760 10− × 1 +1.5333183020199267370932516012553 100 × 2 1.1640274608858812982567477805332 101 − × 3 +4.0053698000222503376927701573076 101 × 4 8.2667863469173479039227422723581 101 − × 5 +1.1414465885256804336106748692495 102 × 6 1.1135645608449754488425056563075 102 − × 7 +7.9037451549298877731413453151252 101 × 8 4.1415428804507353801947558814560 101 − × 9 +1.6094742170165161102085734210327 101 × 10 4.6223809979028638614212851576524 100 − × 1 11 +9.7030884294357827423006360746167 10− × 1 12 1.4607332380456449418243363858893 10− − × 2 13 +1.5330325530769204955496334450658 10− × 3 14 1.0773862404547660506042948153734 10− − × 5 15 +4.7911128916072940196391032755132 10− × 6 16 1.2437781042887028450811158692678 10− − × 8 17 +1.6751019107496606112103160490729 10− × 11 18 9.7674656970897286097939311684868 10− − × 13 19 +1.8326577220560509759575892664132 10− × 17 20 6.4508377189118502115673823719605 10− − × 21 21 +1.3382662604773700632782310392171 10− × Table 9.4: Coefficients of Lanczos’ series, r =22.618910

3. The precision of the available hardware and software; and 4. Whether a uniform or point-wise error bound is required. All three methods considered here have essentially the same leading factor but differ in the terms of their respective series. Assuming for the moment that the constant terms of the series have been precomputed, the computational cost of the series terms then serves as a measure of the efficiency of each method. Stirling’s series has the additional product term which must also be considered in the cost. For the evaluation of Γ(1 + z) with a uniformly bounded error, the 32 Lanczos method appears to be the clear winner. In the case ǫ < 10− | ρ| considered here, 21 divisions and 21 additions were required in the

126 Chapter 9. Comparison of the Methods sum. By contrast, Stirling’s series required 16 powers, divisions and additions in the series, and a further 16 multiplications in the product term. Spouge’s method requires 38 additions and divisions. For evaluation at a single value of z, especially if z is large, Stir- | | ling’s series is most efficient due to the error term which decreases like (2n+1) z+N − with increasing z . Spouge’s error decreases with increas- | | | | 1 ing z , but only like Re(z + a) − . The Lanczos error also decrease to | | | | zero as z , by virtue of the choice of r as the largest zero of ǫr,n∞ , but the| rate|→∞ has not been quantified, though experimentally it appears to be slow. The situation changes, however, if the constant terms in the series must be computed first. In this case, the easiest coefficients to evaluate are those of Spouge’s series as given by equation (9.2). Simple recursion formulas for the calculation of the Bernoulli numbers in Stirling’s series are known, see [28, p.6], which puts Stirling’s series in second place. The coefficients of Lanczos’ series are the most labour intensive to calculate. In the examples presented here the focus was relative error, and we have tacitly assumed infinite floating point precision, an unrealis- tic assumption in practice. In reality, the floating point precision of the hardware and software used may introduce round-off or overflow errors, and this becomes a serious concern in gamma function calcu- lations. To prevent overflow error in Spouge’s and Lanczos’ methods, one should first compute log Γ(1 + z) as in Stirling’s series, and then take the exponential of the result. As was already noted in Chapter 6, generous decimal precision is required in the calculation of coefficients in the Lanczos method since the relatively small coefficients are the result of adding many larger terms of alternating sign. The matrix methods of Section 6.7 help to lessen this problem. In Stirling’s series one must pay attention to the rapidly increasing Bernoulli numbers and select the parameters n and N accordingly. As was noted in Section 2.5.2, it is possible to 34 achieve a relative error of order 10− in the calculation of Γ(7 + 13i) using (N,n)=(0, 38), but the largest Bernoulli number required will be of order 1050. Roundoff can also be a problem in the summation of the series themselves, even with accurately computed coefficients. For example, the coefficients in Table 9.3 span 63 orders of magnitude, and many significant digits of some individual terms will be lost in a 32 digit environment.

127 Chapter 10 Consequences of Lanczos’ Paper

There are several consequences to the techniques and ideas used in Lanczos’ paper which extend beyond the computation of the gamma function. This chapter illustrates some of these extensions and men- tions areas worthy of further study. We first see how Lanczos’ derivation of (1.1) is a special case of a much more general process which defines a transform between square summable functions on [ π/2,π/2] and analytic functions on half planes. − This can be used to express certain functions as series similar to (1.1). Some less than obvious combinatorial identities are then stated as con- sequences of the Lanczos Limit Formula. Finally, an improvement to Stirling’s formula is noted based on the existence of zeros of the error function ǫr,∞0.

10.1 The Lanczos Transform

In his original paper, Lanczos refers to equation (3.6) as an integral transform, which is here termed a “Lanczos Transform”. That is, (z+1/2) in (3.6), Γ(z +1/2)(z +r+1/2)− exp (z + r +1/2)√2 is the Lanc- zos Transform of fE,r(θ). The transform is worthy of special attention as the techniques used to compute it generalize easily from those used in the gamma function case. Suppose F (z) is defined for Re(z) 0as ≥ π/2 F (z)= cos2z θg(θ) dθ π/2 Z− 128 Chapter 10. Consequences of Lanczos’ Paper where g(θ) L2[ π/2,π/2] is even. Note that g is very general, the ∈ − only requirement being that it be square summable with respect to Lebesgue measure. Then the Fourier coefficients

2 π/2 ak = g(θ)cos(2kθ) dθ . π π/2 Z− are defined, and we can associate with g its Fourier series

∞ g(θ) ′ a cos (2kθ) . ∼ k Xk=0 The symbol is used since the series converges to g in L2[ π/2,π/2], though∼ not necessarily pointwise. Nonetheless, since cos2z θ −L2[ π/2,π/2], ∈ − it follows from Parseval’s theorem and identity (3.9) of Lemma 3.2 that

π/2 F (z)= cos2z θg(θ) dθ π/2 Z−

Γ(z +1/2) ∞ = √π ′ a H (z) . (10.1) Γ(z +1) k k Xk=0

Each of the functions H (z) is analytic for Re(z) > 1/4. Let K k − be a compact subset of this region. Taking r =1/4 in the proof of 1/2 δ Theorem 5.1 shows that Hk(z)=O k− − on K for some δ>0. By the Schwarz inequality,  2 ∞ ∞ ∞ 2 1 ak Hk(z) C ak 1+2δ | || |! ≤ | | ! k ! kX=N kX=N kX=N

on K for some constant C which does not depend on N. The right hand side of this inequality can be made as small as desired by choosing N sufficiently large. Thus the series in (10.1) converges absolutely and uniformly on K, and since K was arbitrary, (10.1) defines F (z)asan analytic function on Re(z) > 1/4. − If in addition g(k)(θ) is continuous with g(k)( π/2) = g(k)(π/2), − m k =0,...,m, m 1, then the Fourier coefficients a = O (k− ). For ≥ k 129 Chapter 10. Consequences of Lanczos’ Paper an arbitrary compact K C 1, 2,... , again from the proof of ⊂ \{− −2σ 1 } Theorem 5.1 we have Hk(z)=O (k− − )onK. Therefore, provided Re( 2z m 1) < 1, the series in (10.1) will converge absolutely and− uniformly− − on K, and− thus defines an analytic function in the region

z C Re(z) > m/2andz = 1, 2, 3,... . { ∈ | − 6 − − − } Since the Γ(z+1/2)/Γ(z+1) factor of (10.1) cancels the poles at the neg- ative integers but introduces simple poles at z = 1/2, 3/2, 5/2,..., the conclusion is that equation (10.1) defines F (z−) as an− analytic− func- tion on the half plane Re(z) > m/2 except for z = 1/2, 3/2, 5/2,.... − − − − Furthermore, if F (z) is approximated by truncating the series in (10.1) th after the n term, the resulting error ǫr,n(z)= k∞=n+1 akHk(z) has the property that in the half plane Ω = Re(z) 0, ≥ P

∞ lim ǫr,n(z)= ak z | z|→∞Ω k=n+1 ∈ X

n = g(0) a , − k Xk=0

a constant. Invoking Lemma 8.2, the maximum of ǫ (z) in Ω occurs | r,n | on the line Re(z) = 0, and the maxima can be located and estimated by examining the first few terms of series ǫ (it/(1 t)) ,0 t<1. | r,n − | ≤ As in the gamma function case, the coefficients can be found in several ways. If F (z) is known on the non negative integers, the Horner type method of Section 6.2, and the Lanczos method of Sec- tion 6.1 carry over word for word, with the Horner method probably the more practical. If g(θ) is easy to compute, the finite Fourier se- ries described in Section 6.4.1 may prove more efficient. The Lanczos method is repeated here. From the definition of Chebyshev polynomi-

130 Chapter 10. Consequences of Lanczos’ Paper

als, Tk(cos θ)=cos(kθ). Thus

2 π/2 ak = g(θ)cos(2kθ) dθ π π/2 Z−

2 π/2 k = g(θ) C cos2j θdθ π 2j,2k π/2 j=0 Z− X

2 k π/2 = C cos2j θg(θ) dθ π 2j,2k j=0 π/2 X Z−

2 k = C F (j) . π 2j,2k j=0 X

To go in the other direction, suppose the function F (z) is given analytic on a domain including the non-negative real axis. Compute the coefficients 2 k a = C F (j) k π 2j,2k j=0 X and form the formal sum

∞ ′ g(θ)= ak cos (2kθ) . Xk=0 2 2 If this series is in L [ π/2,π/2] , that is, if ∞ a < , then it − k=0 k ∞ defines g(θ) as the inverse transform of F (z). P

An Example

The following example is found in [13, p.45]. The Bessel function of the first kind of order z not necessarily an integer can be expressed

z π/2 1 (x/2) 2z Jz(x)= cos θ cos (x sin θ) dθ . √π Γ(z +1/2) π/2 Z− 131 Chapter 10. Consequences of Lanczos’ Paper

Letting z F (z,x)=√πJz(x)Γ(z +1/2)(x/2)− , we see that F (z,x) is the Lanczos transform of cos (x sin θ). Hence

Γ(z +1/2) ∞ F (z,x)=√π ′ a (x)H (z) Γ(z +1) k k Xk=0 so that (x/2)z ∞ J (x)= ′ a (x)H (z) . z Γ(z +1) k k Xk=0 The coefficients ak(x) are given by

2 k a (x)= C F (j, x) k π 2j,2k j=0 X

k 2 j = C J (x)Γ(j +1/2)(x/2)− . √π 2j,2k j j=0 X

On the other hand, with the transformation φ = θ π/2, the Fourier coefficients become −

2 π/2 ak(x)= cos (x sin θ)cos(2kθ) dθ π π/2 Z−

2 π = cos (x sin(φ + π/2))cos(2k(φ + π/2)) dφ π Z0

2 π =( 1)k cos (x cos φ)cos(2kφ) dφ − π Z0

=2J2k(x) .

This shows how the Bessel function of even integer order 2k can be expressed in terms of Bessel functions of integer order less than or

132 Chapter 10. Consequences of Lanczos’ Paper equal to k:

k 1 j J (x)= C J (x)Γ(j +1/2)(x/2)− . 2k √π 2j,2k j j=0 X More importantly,

2(x/2)z ∞ J (x)= J (x)H (z) . z Γ(z +1) 2k k Xk=0 It is interesting in this case to examine what the properties of g(θ)= cos (x sin θ) say about the rate of convergence of the series. In this (k) (k) case, g ( π/2) = g (π/2), for all k 0, so that for fixed x, ak(x)= − n ≥ 2J (x)=O (k− ) for any n 0ask . Furthermore, again for 2k ≥ →∞ fixed x, Jz(x) is entire as a function of z.

10.2 A Combinatorial Identity

The following non-trivial identities are consequences of the Lanczos Limit Formula 7.1: Lemma 10.1. Suppose n 1 is an integer. Then ≥ (i) 1 n n!n! + ( 1)k =0 2 − (n k)!(n + k)! Xk=1 − (ii) n k2n 1 ( 1)n+k = − (n k)!(n + k)! 2 Xk=1 − Proof of Lemma 10.1: From 7.1,

∞ z 1 k k2/r Γ(z + 1) = 2 lim r + ( 1) e− Hk(z) . r →∞ "2 − # Xk=1 Setting z = n terminates the series giving

n n 1 k k2/r n!n! n! = 2 lim r + ( 1) e− . r →∞ "2 − (n k)!(n + k)!# Xk=1 − 133 Chapter 10. Consequences of Lanczos’ Paper

Since rn while n! remains constant, it follows that the term in →∞ square brackets must tend to zero as r . This gives(i) . →∞ For (ii), again setting z = n terminates the series which may be written 1 n k k2/r n!n! 2 + k=1( 1) e− (n k)!(n+k)! n! = 2 lim − − . r r n →∞ P − Applying L’Hˆopital’s rule n times then gives

n k k2/r n!n! 2 H k=1( 1) e− (n k)!(n+k)! k n! = 2 lim − − r nr n+1 →∞ P − n k− k2/r n!n! 4 H k=1( 1) e− (n k)!(n+k)! k = 2 lim − − r n n r n+2 →∞ P ( 1) − . − . n k k2/r n!n! 2n H k=1( 1) e− (n k)!(n+k)! k = 2 lim − − r ( 1)nn! →∞ P − n n! =2 ( 1)k+n k2n − (n k)!(n + k)! Xk=1 − which yields (ii) upon canceling the n! terms and moving the constant 2 to the left hand side.

10.3 Variations on Stirling’s Formula

For large real z>0, Stirling’s formula (2.12) is often expressed

z z+1/2 1/2 θ/(12z) Γ(z +1)=e− z (2π) e (10.2) for some 0 <θ<1, with resulting relative error exp (θ/(12z)) 1 − ≈ θ/(12z) which decreases with increasing z. However, without some manipulation, the formula is not very effective for small z. Spouge in [27] derives the more visually pleasing approximation

z+1/2 (z+1/2) Γ(z +1) (z +1/2) e− √2π (10.3) ≈ with bounded relative error 1 log2 1 ǫ(z) < , √2πe π σ +1/2

134 Chapter 10. Consequences of Lanczos’ Paper which is at most 0.107 at σ = Re(z ) = 0. As he notes, (10.3) is not only simpler, but more accurate than Stirling’s formula (10.2). In this section a formula similar in form to both (10.2) and (10.3) is found as a result of the previous analysis of the relative error in Section 8.5.4, and a generalization of the formula is noted. For this section the variable a := r +1/2 is introduced to simplify the resulting formulas. The work in Section 8.5.4 furnishes an improvement to (10.2), albeit with the introduction of a slightly complicated constant. Letting r(0) denote the largest zero of ǫr,∞0, and setting a = r(0)+1/2, we find

(z+1/2) (z+a) a0(r(0)) Γ(z +1)=(z + a) e− √2π + ǫ (z) 2 r(0),0  

(z+1/2) (z+a) (z + a) e− √2π (10.4) ≈

since ǫr∞(0),0 = 0 implies a0(r(0))/2 = 1. This approximation is valid in the entire right half plane Re(z) 0, is asymptotic to Γ(z +1) as z in this region, and has an empirically≥ determined relative error | |→∞ ǫ (z) < 0.006. | r(0),0 | . The constant a =0.819264 appears complicated, but it turns out that the solutions of ǫr,n∞ = 0 can be found explicitly in terms of Lambert W functions in the n = 0 case, as will now be shown.

Lemma 10.2. Let r(0) be the largest zero of ǫr,∞0, and a = r(0)+1/2. Then a = W ( 1/π)/2. − − Proof of Lemma 10.2: Recall that a er+1/2 0 = 2 2π(r +1/2) p ea = . √2πa

135 Chapter 10. Consequences of Lanczos’ Paper

The real zeros of ǫ∞ are the solutions of 1 a /2=0,so r,0 − 0 ea 1= √2πa

2πa = e2a

2a 1 2ae− = . − −π

That is, 2a = W ( 1/π) whose only real roots are − − a = W ( 1/π)/2 − 0 − . =0.276914

and

a = W 1( 1/π)/2 − − − . =0.819264 .

The value of a = W 1( 1/π)/2 makes (10.4) exact at z =0, − − − and (10.4) is exact at infinity, regardless of the value of a. It is natural to ask if, given z, can a value for a be found such that (10.4) is again exact? In other words, can a function a(z) be defined on some subset of C such that on this set

(z+1/2) (z+a(z)) Γ(z +1)=(z + a(z)) e− √2π ?

Recalling the definition of Fr(z) from Section 8.2

(z+1/2) z+r+1/2 1/2 Fr(z)=Γ(z +1)(z + r +1/2)− e (2π)− , for fixed z 0 real, this is equivalent to asking if F (z) 1=0has ≥ r − solutions. The answer is yes. The following property of Fr(z) will be needed (see [27]):

136 Chapter 10. Consequences of Lanczos’ Paper

Lemma 10.3. F (z) strictly increases to 1 as z , and F (0) = 0 →∞ 0 e/π . p

From this result follows Lemma 10.4. Let z>0 be fixed. Then F (z) 1=0has solutions as r − a function of r .

Proof of Lemma 10.4: First, note that F (z) is continuous for (r, z) r ∈ ( 1/2, ) [0, ). Secondly, observe that − ∞ × ∞

lim Fr(z) 1 = lim Fr(z) 1= . r 1/2 − r − ∞ →− →∞ Thirdly, by Lemma 10.3, F (z) 1 0asz , so thatF (z) 1 < 0. 0 − ↑ →∞ 0 − Thus for z>0 fixed, Fr(z) has at least two zeros as a function of r.

An explicit formula for a(z) can be found with the help of the Lam- bert W function. Suppose that z is real and positive. Then

(z+1/2) (z+a(z)) Γ(z +1)=(z + a(z)) e− √2π,

so that Γ(z +1) (z+1/2) (z+a(z)) =(z + a(z)) e− . √2π Raising both side to the power 1/(z+1/2) and then multiplying through by 1/(z +1/2) gives − 1/(z+1/2) 1 Γ(z +1) z + a(z) z+a(z) − = e− z+1/2 z +1/2 √2π − z +1/2   whence

z + a(z) 1 Γ(z +1) 1/(z+1/2) = Wk − − z +1/2 z +1/2 √2π   ! and

1 Γ(z +1) 1/(z+1/2) a(z)= z (z +1/2) Wk − . (10.5) − − z +1/2 √2π   ! 137 Chapter 10. Consequences of Lanczos’ Paper

For real z the branches W 1 and W0 are real, yielding two solutions − which are here denoted a( 1,z)anda(0,z). Unfortunately equation (10.5) is not of much practical use− computationally without some additional approximation of Γ itself, and the question of whether these equations gives rise to more efficient Γ approximation schemes was not studied further. Equation (10.5) does, however, give a picture of what a( 1,z) and a(0,z) look like, thanks to the Lambert W evaluation routines− of Maple 8. See Figure 10.1 for plots of these functions over the scaled real line z/(1 z), 0 z<1. It is interesting to observe how little these function− appear≤ to vary over the entire real line, in particular a( 1,z) which is approximately 0.82 at z = 0 and decreases to about 0.79− as z . →∞

1

a( 1,z/(1 z)) 1 −1 W−1 − − − 2 ( π )

1 −1 a(0,z/(1 z)) W0 − − 2 ( π )

0 0 z 1

z z Figure 10.1: Path of a(0, 1 z ), a( 1, 1 z ), 0 z<1 − − − ≤

138 Chapter 11 Conclusion and Future Work

From the work done here it is clear that Lanczos’ formula merits se- rious consideration as a viable alternative to Stirling’s series for the efficient computation of the classical gamma function. Furthermore, the generalized idea of the Lanczos transform described in Chapter 10 holds some promise as an approximation method for a larger class of functions. There are, however, several unresolved issues and areas in need of further investigation. This concluding chapter comments on a number of unsettled questions, and conjecture answers to some of these. Specifically: With respect to Lanczos’ paper itself:

1. What is the precise asymptotic bound on the coefficients ak(r)of the main series S (z)ask ? r →∞

2. Can the convergence of Sr(z) be extended from Re(z) > r to Re(z) > r 1/2 as Lanczos claims? − − − 3. How can the proof of the Lanczos Limit Formula (7.1) be extended to Re(z) < 0?

With respect to the error bounding methods of Chapter 8:

1. Is there an analytical method to bound the relative error function ǫ (it/(1 t)) for 0 t<1, and hence ǫ (z) uniformly in | r,n − | ≤ | r,n | the right-half plane? More simply, in the n = 0 case, is there an analytic bound for ǫ (it) = F (it) 1 ? | r,0 | | r − | 2. What is the precise relationship between the largest zero of the relative error at infinity, ǫ∞ , and the maximum of ǫ (it/(1 t)) r,n | r,n − | on 0 t<1? ≤ 139 Chapter 11. Conclusion and Future Work

3. How many zeros does ǫr,n∞ have? How are they distributed? What is the largest one? The same questions apply to the individual coefficients ak(r).

Finally, and perhaps most importantly, with respect to a deterministic algorithm:

1. Is there a deterministic algorithm which, given z and ǫ>0, pre- scribes n and r so that Γ(z + 1) is computed with relative error at most ǫ?

2. What is the relationship between r, n and the location of the Lanczos shelf? How can the Lanczos shelf be used to best select r as a function of n to minimize the relative error?

11.1 Outstanding Questions Related to Lanc- zos’ Paper

Lanczos does not comment on the precise rate of decay of the coeffi- cients ak(r) of the main series Sr(z). He does, however, make state- ments about the rate and region of convergence of the series, both con- sequences of the decay rate. The analysis of Chapter 4 determined 2r that the coefficients a (r)=O (k− )ask . Lanczos’ state- k →∞ ments suggest, and numerical evidence supports, the slightly faster rate 2r 1 ak(r)=O (k− − ). Closely related to this problem is whether convergence of the series can be extended from the region Re(z) > r found here to Re(z) > − 2r 1 r 1/2 as claimed by Lanczos. If in fact a (r)=O (k− − )ask , − − k →∞ the proof of Theorem 5.1 would yield Lanczos’ bound. Lanczos’ claim of convergence on the larger region seems so matter of fact that it appears based on a simple principle, yet it is not clear what that is. The analytic properties of the function represented by Sr(z), namely

z 1/2 z+r+1/2 1/2 Fr(z)=Γ(z +1)(z + r +1/2)− − e (2π)− ,

suggests that in a manner similar to the Landau-Pringsheim Theo- rem [1, p.237] for Dirichlet series, the abscissa of convergence can be extended left until the first singularity (which is not a pole) at z = r 1/2 is encountered. Perhaps a similar principle is at play − − 140 Chapter 11. Conclusion and Future Work

here. In the end, the asymptotic behaviour of the ak(r) and consequent region of convergence of Sr(z) is a minor problem since, for computa- tional purposes, only convergence on Re(z) 0 is required, and this is guaranteed provided r 0. ≥ ≥ Also of more theoretical interest than practical is Lanczos’ state- ment of the limit formula of Chapter 7. The proof there established the validity of the formula in the right-half plane Re(z) 0, while ac- ≥ cording to Lanczos the formula is valid for all z C away from the negative integers. His claim appears to be based∈ on the asymptotic behaviour of the coefficients a (r)asr . Indeed, convergence of k →∞ the series Sr(z) extends further and further left in the complex plane as r increases, but just how

∞ z+1/2 (z+r+1/2) ′ lim √2π (z + r +1/2) e− ak(r)Hk(z) r →∞ Xk=0 ∞ z ′ k k2/r = 2 lim r ( 1) e− Hk(z) r →∞ − Xk=0

directly is not entirely clear.

11.2 Outstanding Questions Related to Er- ror Bounds

The main shortcoming of the Lanczos gamma approximation is the lack of simple analytical error bounds on the resulting estimates. Instead, for each non-negative integer n and r 0, the properties of ǫ (z)asan ≥ r,n analytic function of z on Re(z) 0 furnish simple empirical (uniform) bounds which hold up when tested≥ numerically. Nonetheless, to develop an effective algorithm, one would like an a priori bound on ǫr,n(z)asa function of its three parameters. From the numerical evidence presented in Chapter 8 it is clear that given n one should select r carefully in order to optimize the uniform error bound. In all cases examined, setting r equal the largest zero of

ǫr,n∞ results in uniform error bounds much improved on Lanczos’ own estimates. Why is this so? It is not clear why this choice of r should have such a dramatic effect on the uniform bound.

141 Chapter 11. Conclusion and Future Work

The nature of ǫr,n(z) as a function of r with z fixed (finite or infinite) is not well understood, except in the simple n = 0 case of Section 10.3. There we saw it is possible in the case of real positive z to select r which makes ǫr,n(z) = 0, and consequently the approximation to Γ(z +1) becomes exact. Empirical evidence suggests that this is true for values of n greater than zero as well. Refer to Figure 11.1 for a plot of ǫr,2(z), 0.5 1/2 and n 0 a fixed integer, if r(z) − ≥

0.4

0

0.4 − 0 0

z r 3 3

Figure 11.1: ǫ (z), 0.5

is defined to be a zero of ǫr,n(z), equation (10.5) and Figure 11.1 lead one to conjecture that r(z) is a multivalued complex analytic function

with number of branches equal to the number of zeros of ǫr,n∞ . The data from Tables C.1 and C.2 suggests that neither the number

nor the distribution of ǫr,n∞ zeros follows a simple law. Even more per- plexing is the striking similarity between the functions ǫr,n∞ and an+1(r) as illustrated in Figures 8.4, 8.5 and 8.6. This same behaviour was

142 Chapter 11. Conclusion and Future Work found in all cases examined.

11.3 Conjectures on a Deterministic Algo- rithm

In this section a deterministic algorithm is proposed for calculating the gamma function using the truncated Lanczos formula. Here, a deterministic algorithm is one which, given z with Re(z) 0andǫ>0 as input, prescribes optimal n and r and computes Γ(1+z)≥ with relative error at most ǫ. As noted, the Lanczos method lacks a simple functional relationship between the relative error ǫr,n(z) and the input parameters n, r and z. Consequently, a deterministic algorithm is out of reach. Even if the z parameter is removed from the requirement and we content ourselves with a uniform error bound, the problem is still difficult. In the uniform case, however, the empirical evidence strongly sug- gests a simple deterministic algorithm. This evidence is the data of Tables C.1 and C.2 of Appendix C, and the Lanczos shelf phenomenon illustrated in Figures 1.5, 1.6 and 1.7 of Chapter 1. The similarity be- tween Spouge’s and Lanczos’ methods noted in Section 2.6 would lead one to guess that the error estimates ought to be similar as well. In Spouge’s method, calculating Γ(1+z) with uniform relative error ǫ>0 requires O ( log ǫ) terms of the sum, as given by the bound (2.19). In the Lanczos− case, a plot of pairs (n, log M ) from the tables of − r(n),n Appendix C shows a near perfect linear relationship; see Figure 11.2. A least squares fit of this data yields

n 2 0.3logM . ≈− − r(n),n Thus given ǫ>0, one should choose n = 2 0.3logǫ . The corre- ⌈− − ⌉ sponding r should then be chosen to be the largest zero of ǫr,n∞ , which is about size n. This choice of r n is consistent with shelf behaviour demonstrated in Figures 1.5, 1.6≈ and 1.7. In each case, the transition in decay rate of the ak(r) occurs at the shelf where r is approximately equal to n.

143 Chapter 11. Conclusion and Future Work

210

log M − r(n),n,15 6.8+3.3n

0 0 n 60 Figure 11.2: Linear fit of (n, log M ), n =0,...,60 − r(n),n

144 Bibliography

[1] T. Apostol. Introduction to Analytic Number Theory. Springer, New York, 1998.

[2] E. Artin. The Gamma Function. Holt, Rinehard and Winston, New York, 1964.

[3] J.P. Boyd. Chebyshev and Fourier Spectral Methods. Dover Pub- lications, Inc., New York, 2000.

[4] F. Cajori. A History of Mathematical Notations. The Open Court Publishing Company, Chicago, 1929.

[5] R. M. Corless, G. H. Gonnet, D. E. G. Hare, D. J. Jeffrey, and D. E. Knuth. On the Lambert W function. Adv. Comput. Math., 5(4):329–359, 1996.

[6] P. J. Davis. Leonhard Euler’s integral: A historical profile of the gamma function. The American Mathematical Monthly, 66:849– 869, 1959.

[7] Serge Dubuc. An approximation of the gamma function. J. Math. Anal. Appl., 146(2):461–468, 1990.

[8] H.M. Edwards. Riemann’s Zeta Function. Academic Press, 1974.

[9] Paul Godfrey. A note on the computation of the conver- gent lanczos complex gamma approximation. Web published at http://my.fit.edu/~gabdo/paulbio.html, 2001.

[10] D. Gronau. Why is the gamma function so as it is? TEACHING MATHEMATICS AND COMPUTER SCIENCE, 1:43–53, 2003.

[11] C. Lanczos. Trigonometric interpolation of empirical and analyt- ical functions. Journal of Mathematics and Physics, 17:123–199, 1938.

[12] C. Lanczos. Applied Analysis. Prentice Hall, New Jersey, 1956.

[13] C. Lanczos. Linear Differential Operators. D. Van Nostrand Com- pany, Ltd., New York, 1961.

145 Bibliography

[14] C. Lanczos. A precision approximation of the gamma function. J. Soc. Indust. Appl. Math. Ser. B Numer. Anal., 1:86–96, 1964.

[15] Cornelius Lanczos. Collected published papers with commentaries. Vol. I–VI. North Carolina State University, College of Physical and Mathematical Sciences, Raleigh, NC, 1998. With a preface by William R. Davis, a foreword by George Marx and a biograph- ical essay by Barbara Gellai, Translated by J´ozsef Illy, Laurent Choquet, Don Ridgeway and Judith Konts´ag Mesk´o.

[16] S. Lang. Complex Analysis, Third Edition. Spring-Verlag, New York, 1993.

[17] Y. Luke. The Special Functions and Their Approximations, Vol- ume 1. Academic Press, New York, 1969.

[18] J.C. Mason and D.C. Handscomb. Chebyshev Polynomials. Chap- man & Hall/CRC, Boca Raton, USA, 2003.

[19] P. Mikusinski and D. Taylor. An Introduction to Multivariable Analysis from Vector to Manifold. Birkh¨auser, Boston, USA, 2002.

[20] Edward W. Ng. A comparison of computational methods and algorithms for the complex gamma function. ACM Trans. Math. Software, 1(1):56–70, 1975.

[21] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling. Numerical Recipes in C, Second Edition. Cambridge University Press, Cambridge, UK, 1992.

[22] T.J. Rivlin. Chebyshev Polynomials from Approximation Theory to Algebra and Number Theory. John Wiley & Sons, Inc., New York, 1990.

[23] W. Rudin. Principles of Mathematical Analysis. McGraw-Hill, Inc., New York, 1976.

[24] W. Rudin. Real and Complex Analysis. McGraw-Hill, Inc., New York, 1987.

[25] L. Schwartz. Mathematics for the Physical Sciences. Hermann/Addison-Wesley, Reading, Mass, 1966.

146 Bibliography

[26] Robert Spira. Calculation of the gamma function by Stirling’s formula. Math. Comp., 25:317–322, 1971.

[27] John L. Spouge. Computation of the gamma, digamma, and trigamma functions. SIAM J. Numer. Anal., 31(3):931–944, 1994.

[28] Nico M. Temme. Special Functions, An Introduction to the Classi- cal Functions of Mathematical Physics. John Wiley & Sons, Inc., New York, 1996.

[29] S. C. van Veen. Review of a precision approximation of the gamma function. Mathematical Reviews 31 #390, 1966.

[30] E.T. Whittaker and G.N. Watson. A Course of Modern Analy- sis, Fourth Edition. Cambridge University Press, Cambridge, UK, 1965.

147 Appendix A Preliminary Steps of Lanczos Derivation

Reproduced here is the circuitous sequence of steps Lanczos’ uses to arrive at (3.4) beginning with (3.1.1). From z+1 ∞ z αt Γ(z +1)=α t e− dt , Re(α) > 0 , Z0 make the substitution α =1+ρz , where ρ>0. This gives

z+1 ∞ ρt z t Γ(z +1)=(1+ρz) (te− ) e− dt . Z0 z Next introduce the factor (eρ)−

z+1 z ∞ 1 ρt z t Γ(z +1)=(1+ρz) (eρ)− (ρte − ) e dt , Z0 1 ρt and make the replacement v = e − to get

e z+1 z 1/ρ z 1/ρ 1 Γ(z +1)=(1/ρ + z) e− − [v(1 log v)] v − dv . − Z0 Finally, let r =1/ρ 1 to arrive at − e z+1 (z+r+1) z r (z + r +1) e− [v(1 log v)] v dv , − Z0 which is equation (3.4).

148 Appendix B A Primer on Chebyshev Polynomials

The Chebyshev polynomials are a class of orthogonal polynomials (with respect to a certain inner product) which are very effective for approx- imation purposes. The literature on Chebyshev polynomials is vast, as is the multitude of identities and relationships concerning these objects. Stated here are the properties required in this work. First, it should be noted there are several kinds of Chebyshev poly- nomials, appropriately named Chebyshev polynomial of the first kind, of the second kind, etc. The first two kinds are denoted Tn(x) and U (x) ; we will be concerned only with this first kind,{ which} is the { n } only polynomial solution for integer n of the differential equation

d2y dy (1 x2) x + n2y =0. − dx2 − dx

The defining relationship for the T (x) is { n }

Tn(x)=cos(nθ) wherex =cosθ,

and where x ranges from 1to1asθ ranges from π to 0. The resulting − graph of Tn(x) oscillates between 1 to 1 and looks like a distorted − n 1 version of cos (nθ) . The leading coefficient of Tn(x)is2− and the function is even or odd according as n is even or odd. The first few Chebyshev polynomials of the first kind are:

T0(x)=1

T1(x)=x

149 Appendix B. A Primer on Chebyshev Polynomials

T (x)=2x2 1 2 − T (x)=4x3 3 x 3 − T (x)=8x4 8 x2 +1 4 − T (x)=16x5 20 x3 +5x. 5 −

The family Tn(x) n∞=0 is orthogonal with respect to the inner prod- uct { } 1 dx f,g = f(x)g(x) (B.1) 2 h i 1 √1 x Z− − and forms a basis for [ 1, 1] with norm induced by the inner product. L2 − Further, if f(x) is differentiable on [ 1, 1], (one sided differentiable at the end points), then it is of bounded− variation and may be written

c (r) ∞ f(x)= 0 + c (r)T (x) 2 n n n=1 X

where convergence of the series is uniform. The coefficients cn(r) are given by 2 1 dx cn(r)= f(x)Tn(x) . (B.2) 2 π 1 √1 x Z− −

As an operational detail, take note that the family Tn(x) n∞=0 is not an orthonormal set, but only orthogonal. The proper{ normalization} is

1 2 ∞ T , T (x) , √π 0 π n ( r )n=1 which must be taken into account for manipulations in the Hilbert space setting. The link between Chebyshev and Fourier series is the transformation x cos θ. This transforms f(x) into an even function of θ which can → then be written as a Fourier cosine series. As noted, there are many identities involving Chebyshev polynomi- als which follow from their interpretation as trigonometric functions. The important ones for our purposes are:

T (√1 x2)=( 1)nT (x) (B.3) 2n − − 2n

150 Appendix B. A Primer on Chebyshev Polynomials and the trigonometric form

T (sin θ)=( 1)n cos (2nθ) . (B.4) 2n −

Finally, the following important property of Tn(x) should be noted: Of all monic polynomials of degree n on [ 1, 1], the one with the least n 1− n 1 absolute deviation from zero is Tn(x)/2 − . In this context,T n(x)/2 − is the best approximation to the zero function on [ 1, 1] by a monic polynomial of degree n. − Refer to [17], [18] and [22] for proofs and a thorough treatment of Chebyshev polynomials.

151 Appendix C Empirical Error Data

Tables C.1 and C.2 summarize the results of numerical investigations carried out on the relative error functions ǫr,n(z) andǫ r,n∞ . For each n =0,...,60, the number of zeros of ǫr,n∞ were counted, and the largest and smallest zeros of were found to six decimals using a simple variation of the bisection method. These statistics are listed in the first four columns of the tables. The last three columns of each table summarize data on the esti- mated maximum of ǫ (it), 0 t< based on the theory of Sec- r,n ≤ ∞ tion 8.5. For r equal the largest zero of ǫr,n∞ , the maximum of

∞ ǫr,n(it) = ak(r)Hk(it) | | k=n+1 X

was estimated using the first 5 and then 15 terms of the sum. These columns are labeled Mr(n),n,5 and Mr(n),n,15, respectively. In addition, n+15 the location of the maximum of n+1 ak(r)Hk(it) was determined; this data is in the last column labeled tmax. P

152 Appendix C. Empirical Error Data

No. Smallest Largest n Zeros Zero Zero r(n) Mr(n),n,5 Mr(n),n,15 tmax 3 3 0 2 .223086 .319264 5.9 10− 5.5 10− .88 − × 4 × 4 1 4 .173495 1.489194 1.0 10− 1.0 10− 2.13 − × 7 × 7 2 6 .151082 2.603209 6.4 10− 6.3 10− 4.27 − × 8 × 8 3 8 .137917 3.655180 8.5 10− 8.5 10− 4.05 − × 9 × 9 4 8 .129067 4.340882 4.3 10− 4.3 10− 5.05 − × 10 × 10 5 10 .122605 5.581000 1.2 10− 1.2 10− 6.34 − × 12 × 12 6 12 .117620 6.779506 2.7 10− 2.7 10− 7.88 − × 14 × 14 7 14 .113619 7.879012 3.9 10− 3.9 10− 6.72 − × 15 × 15 8 14 .110313 8.406094 6.9 10− 6.9 10− 9.23 − × 16 × 16 9 16 .107519 9.656578 2.1 10− 2.1 10− 10.51 − × 18 × 18 10 18 .105114 10.900511 6.1 10− 6.1 10− 11.83 − × 19 × 19 11 20 .103013 12.066012 1.1 10− 1.1 10− 14.30 − × 21 × 21 12 22 .101157 13.144565 5.2 10− 5.2 10− 12.38 − × 22 × 22 13 22 .099499 13.726821 4.0 10− 4.0 10− 14.69 − × 23 × 23 14 24 .098005 14.977863 1.2 10− 1.2 10− 15.98 − × 25 × 25 15 26 .096650 16.209805 3.6 10− 3.6 10− 17.45 − × 27 × 27 16 28 .095412 17.345444 3.1 10− 3.1 10− 23.47 − × 28 × 28 17 30 .094275 18.399283 5.0 10− 5.0 10− 18.11 − × 29 × 29 18 30 .093226 19.048512 2.5 10− 2.5 10− 20.16 − × 31 × 31 19 32 .092252 20.298892 7.8 10− 7.8 10− 21.45 − × 32 × 32 20 34 .091346 21.508926 2.1 10− 2.1 10− 23.40 − × 34 × 34 21 36 .090499 22.618910 1.8 10− 1.8 10− 17.14 − × 35 × 35 22 36 .089704 23.118012 5.2 10− 5.2 10− 24.34 − × 36 × 36 23 38 .088958 24.370498 1.7 10− 1.7 10− 25.62 − × 38 × 38 24 40 .088253 25.617904 5.2 10− 5.2 10− 26.97 − × 39 × 39 25 42 .087588 26.798597 1.1 10− 1.1 10− 30.13 − × 41 × 41 26 44 .086957 27.886311 3.6 10− 3.6 10− 24.97 − × 42 × 42 27 44 .086358 28.440357 3.5 10− 3.5 10− 29.80 − × 43 × 43 28 46 .085789 29.692534 1.1 10− 1.1 10− 31.09 − × 45 × 45 29 48 .085246 30.931341 3.4 10− 3.4 10− 32.63 − × 47 × 47 30 50 .084727 32.080670 4.4 10− 4.4 10− 39.41 − × × Table C.1: Error Data, n =0,...,30

153 Appendix C. Empirical Error Data

No. Smallest Largest n Zeros Zero Zero r(n) Mr(n),n,5 Mr(n),n,15 tmax 48 48 31 52 .084232 33.145772 4.2 10− 4.2 10− 31.63 − × 49 × 49 32 52 .083757 33.762726 2.4 10− 2.4 10− 35.27 − × 51 × 51 33 54 .083302 35.014250 7.7 10− 7.7 10− 36.57 − × 52 × 52 34 56 .082865 36.235367 2.2 10− 2.2 10− 38.65 − × 55 × 55 35 58 .082445 37.356480 7.5 10− 7.5 10− 34.71 − × 55 × 55 36 60 .082041 38.385241 3.8 10− 3.8 10− 38.30 − × 56 × 56 37 60 .081651 39.085095 1.7 10− 1.7 10− 40.74 − × 58 × 58 38 62 .081275 40.334630 5.3 10− 5.3 10− 42.09 − × 59 × 59 39 64 .080912 41.529155 1.3 10− 1.3 10− 45.44 − × 61 × 61 40 66 .080562 42.626437 2.7 10− 2.7 10− 36.11 − × 62 × 62 41 66 .080223 43.154830 3.6 10− 3.6 10− 44.92 − × 63 × 63 42 68 .079894 44.407411 1.2 10− 1.2 10− 46.21 − × 65 × 65 43 70 .079576 45.651117 3.7 10− 3.7 10− 47.74 − × 67 × 67 44 72 .079268 46.814382 6.2 10− 6.2 10− 54.32 − × 68 × 68 45 74 .078969 47.889652 3.8 10− 3.8 10− 44.46 − × 69 × 69 46 74 .078679 48.477371 2.6 10− 2.6 10− 50.39 − × 71 × 71 47 76 .078396 49.729491 8.2 10− 8.2 10− 51.68 − × 72 × 72 48 78 .078122 50.959691 2.5 10− 2.5 10− 53.73 − × 74 × 74 49 80 .077855 52.092791 1.7 10− 1.7 10− 71.81 − × 75 × 75 50 82 .077596 53.141340 3.8 10− 3.8 10− 51.74 − × 76 × 76 51 82 .077343 53.799879 1.8 10− 1.8 10− 55.85 − × 78 × 78 52 84 .077096 55.050733 5.8 10− 5.8 10− 57.19 − × 79 × 79 53 86 .076856 56.257932 1.5 10− 1.5 10− 60.47 − × 81 × 81 54 88 .076622 57.365268 1.8 10− 1.8 10− 44.65 − × 82 × 82 55 88 .076393 57.869538 4.0 10− 4.0 10− 60.03 − × 83 × 83 56 90 .076170 59.122331 1.3 10− 1.3 10− 61.32 − × 85 × 85 57 92 .075952 60.369399 4.1 10− 4.1 10− 62.81 − × 87 × 87 58 94 .075739 61.546699 8.5 10− 8.5 10− 68.92 − × 88 × 88 59 96 .075531 62.631604 3.3 10− 3.3 10− 56.29 − × 89 × 89 60 96 .075327 63.192152 2.9 10− 2.9 10− 65.50 − × × Table C.2: Error Data, n =31,...,60

154