Computation of Hypergeometric Functions
Total Page:16
File Type:pdf, Size:1020Kb
Computation of Hypergeometric Functions by John Pearson Worcester College Dissertation submitted in partial fulfilment of the requirements for the degree of Master of Science in Mathematical Modelling and Scientific Computing University of Oxford 4 September 2009 Abstract We seek accurate, fast and reliable computations of the confluent and Gauss hyper- geometric functions 1F1(a; b; z) and 2F1(a; b; c; z) for different parameter regimes within the complex plane for the parameters a and b for 1F1 and a, b and c for 2F1, as well as different regimes for the complex variable z in both cases. In order to achieve this, we implement a number of methods and algorithms using ideas such as Taylor and asymptotic series com- putations, quadrature, numerical solution of differential equations, recurrence relations, and others. These methods are used to evaluate 1F1 for all z 2 C and 2F1 for jzj < 1. For 2F1, we also apply transformation formulae to generate approximations for all z 2 C. We discuss the results of numerical experiments carried out on the most effective methods and use these results to determine the best methods for each parameter and variable regime investigated. We find that, for both the confluent and Gauss hypergeometric functions, there is no simple answer to the problem of their computation, and different methods are optimal for different parameter regimes. Our conclusions regarding the best methods for computation of these functions involve techniques from a wide range of areas in scientific computing, which are discussed in this dissertation. We have also prepared MATLAB code that takes account of these conclusions. Acknowledgements I would like to offer special thanks to my project supervisors at the University of Oxford, Mason Porter and Sheehan Olver, for their invaluable help and support during the last few months. I would also like to thank the Numerical Algorithms Group, in particular David Sayers and Mick Pont, for providing the topic for this project, for supplying me with a copy of the NAG Toolbox, and for their assistance throughout. Thanks go to the National Institute of Standards and Technology, and in particular to Dan Lozier and Frank Olver, for kindly providing me with an advance copy of the new book, `NIST Digital Library of Mathematical Functions', a preliminary version of which is now hosted at http://dlmf.nist.gov/, which has given me many ideas about special functions and their computation. I am also grateful to Andy Wathen for giving me his thoughts on this dissertation. Further, I would like to thank the Engineering and Physical Sciences Research Council and the Numerical Algorithms Group for the provision of funding which has enabled me to take this course. Finally, I would like to express my gratitude to those who have taught and supervised me this year and throughout my time at Oxford, to my family for their continued support, and to my friends for making this year a very enjoyable one. Contents 1 Introduction 1 2 Background on hypergeometric functions 2 2.1 Relevant properties of hypergeometric functions . 2 2.2 Motivation for the computation of hypergeometric functions . 4 3 Computation of the confluent hypergeometric function 1F1(a; b; z) 6 3.1 Properties of 1F1(a; b; z) ............................. 7 3.2 Taylor series . 9 3.3 Writing the confluent hypergeometric function as a single fraction . 12 3.4 Buchholz polynomials . 14 3.5 Asymptotic series . 17 3.6 Quadrature methods . 19 3.7 Solving the confluent hypergeometric differential equation . 21 3.8 Recurrence relations . 24 3.9 Summary and analysis of results . 27 4 Computation of the Gauss hypergeometric function 2F1(a; b; c; z) 29 4.1 Properties of 2F1 ................................. 29 4.2 Taylor series . 31 4.3 Writing the Gauss hypergeometric function as a single fraction . 34 4.4 Quadrature methods . 35 4.5 Solving the hypergeometric differential equation . 37 4.6 Transformation formulae . 41 4.7 Analytic continuation formulae for z near e±iπ=3 . 43 4.8 Recurrence relations . 45 4.9 Summary and analysis of results . 49 5 Conclusions, Discussion and Future Considerations 50 A Transformation formulae for 2F1(a; b; c; z) when b − a 2 Z or c − a − b 2 Z 53 B List of test cases used for 1F1(a; b; z) 58 C List of test cases used for 2F1(a; b; c; z) 60 D Methods of testing the robustness of code selected 62 E Numerical results for 1F1(a; b; z) 66 F Numerical results for 2F1(a; b; c; z) 72 G Other methods considered for evaluating 1F1(a; b; z) 76 G.1 Series in terms of beta random variables . 76 G.2 Expansion in terms of incomplete gamma functions . 77 G.3 Asymptotic expansion for large jbj and jzj ................... 78 G.4 Hyperasymptotic expansions . 80 G.5 Other quadrature methods . 82 G.6 Other differential equation methods . 87 G.7 Pad´eapproximants and rational approximation . 89 G.8 Other expansions for 1F1(a; b; z)......................... 92 G.9 Multiplication formula . 93 H Other methods considered for evaluating 2F1(a; b; c; z) 94 H.1 Other quadrature methods . 94 H.2 Other differential equation methods . 96 H.3 Pad´eapproximants and rational approximation . 97 H.4 Chebyshev expansion for 2F1(a; b; c; z)...................... 98 I Evaluation of 0F1(; a; z) and other special functions required for this project 99 J Some examples of hypergeometric functions from practical applications 104 K List of code written for this project 109 Bibliography 113 1 Introduction The computation of the hypergeometric function pFq, a special function encountered in a variety of applications, is frequently sought. However, aside from the most basic hyper- geometric functions, this is an extremely difficult task in practice. The reason for this is that the non-trivial structure of the series that defines the function creates many numerical issues such as cancellation and round-off error, which become especially significant for cer- tain ranges of the parameters and the variable. This results in many methods of numerical computation being ineffective for all but the simplest parameter and variable ranges. We focus in this dissertation on computing the two most commonly used hypergeomet- ric functions, the confluent hypergeometric function 1F1(a; b; z) and the Gauss hypergeo- metric function 2F1(a; b; c; z), which both suffer from these problems. The program which will be used to compute these functions will be MATLAB, which employs double precision arithmetic, so it is especially important for effective methods to be found to overcome the numerical issues involved. The goal of this project is to carry out a comprehensive survey of methods for computing 1F1 and 2F1, and to determine how to choose appropriate methods for different parameter and variable ranges, resulting in reliable and fast computation for as large a range of the parameters (a, b for 1F1 and a, b, c for 2F1) and variable z as possible. The algorithms used are required to be accurate, fast and robust for specific parameter and variable regions for which they have been selected. In this dissertation, we will test a large variety of approaches, such as a range of se- ries methods, ways of numerically solving the differential equations that the hypergeometric functions satisfy and quadrature methods, as well as employing recurrence relations to at- tempt to use computations of relatively simple cases to obtain computations for extreme parameter cases. We will also test asymptotic series for 1F1. For 2F1, we also explore the use of transformation formulae and expansions for special parameter cases. We aim to combine techniques that work for specific parameter regimes in order to compile a package of methods that is effective for as large a part of the complex plane for each parameter and variable as possible. 1 This dissertation will explain the more successful methods tested for each function, with details of other methods implemented or analysed discussed in Appendices G and H. Details will be given of the background to these methods, how they were implemented, and the results obtained from test cases taken from a wide range of examples in the complex plane. An explanation will be provided as to why the methods might be successful, and a conclusion reached as to which methods should be used in what part of the complex plane. The conclusions will be based partly on the review of the author(s) who proposed the method and partly on results and observations from our implementation of them. 2 Background on hypergeometric functions In this section, we will introduce properties of the generalized hypergeometric function that will be exploited in this project. The motivation for computing hypergeometric functions will be discussed, with details given of some of the practical applications of these functions (with further examples given in Appendix J). We will also discuss the numerical issues that make the problem of their computation a difficult one. 2.1 Relevant properties of hypergeometric functions The hypergeometric function pFq is defined in [37] as follows for a1; :::; ap; b1; :::; bq; z 2 C: 1 j X (a1)j:::(ap)j z F (a ; :::; a ; b ; :::; b ; z) = ; (2.1) p q 1 p 1 q (b ) :::(b ) j! j=0 1 j q j where, for some parameter µ, the Pochhammer symbol (µ)j is defined as (µ)0 = 1; (µ)j = µ(µ + 1):::(µ + j − 1); j = 1; 2; ::: : For the remainder of this dissertation, the values of aj; bj; z will be complex unless other- wise specified. However, the hypergeometric function is not defined if any bj; j = 1; :::; q are real and equal to a non-positive integer, and there are numerical issues in its computation if one or more values of bj are close to a non-positive integer.