Upload
trinhtuong
View
219
Download
0
Embed Size (px)
Citation preview
Chebychev interpolations of the Gamma andPolygamma Functions and their analytical
propertiesKarl Dieter Reinartz
May 11, 2016
in memoriamCornelius Lanczos[5] 1893-1974 1
address:
Email: [email protected]
Kieferndorfer Weg 30, D-91315 Höchstadt, GERMANY
keywords:Gamma function, Sterling formula, Bernoulli numbers, Chebychev approximations, Chebyshevpolynomials, Shifted Chebyshev polynomials, Invers Gamma function, Psi (Digamma) func-tion, Harmonic function, Polygamma functions, Summation/Differentiation/Multiplication ofChebyshev approximations.
Contents1 Introduction 2
2 Chebyshev Interpolations of the Γ Function 32.1 The Γ−1 Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.2 The LnΓ Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 The Chebyshev Interpolation of the Psi (Digamma) Function 73.1 Summation of the Harmonic Series . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4 Interpolating further Polygamma Functions 74.1 Summation of the higher Harmonic Series . . . . . . . . . . . . . . . . . . . . . . 8
5 Relations of the Shifted Chebychev Polynomials 85.1 Chebychev approximation of smooth functions . . . . . . . . . . . . . . . . . . . 8
5.1.1 Numerical determination of the a∗r-coefficients . . . . . . . . . . . . . . . . 91 http://www.youtube.com/watch?v=avSHHi9QCjAhttp://www.youtube.com/watch?v=PO6xtSxB5Vg
1
arX
iv:1
605.
0277
6v1
[m
ath.
CA
] 2
May
201
6
5.1.2 Summation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95.1.3 Differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95.1.4 Multiplication of two Chebyshev approximations . . . . . . . . . . . . . . 9
1 IntroductionThe Gamma Function derived by Leonhard Euler (1729) is the generalization of discrete facto-rials:
z! = Γ (z + 1) =∫ ∞
0tz−1e−tdt, <z > 0 (1)
The numerical evaluation is not easy. Whittaker+Watson [9] and Temme [8] give a good dis-cussion of the Γ Function and several basic properties.In contrast to that Lanczos [4] developed approximations with a restricted precision by usingChebyshev polynomials in the range [-1..+1] (instead of shifted polynomials which will be usedexclusively in this paper). Chebychev polynomials were introduced into numerical analysis es-pecially by Lanczos [5]in the US since 1935 and by Clenshaw [2] in GB since 1960.–
The next formula is due to James Stirling (1730)
ln Γ (z) ∼ ln(√
2π zz− 12 e−z
)+∞∑
n=1
B2 n
2n (2n− 1) z2 n−1 (2)
The B2 n are the Bernoulli numbers with a poor behaviour:
16 , −
130 ,
142 , −
130 ,
566 ,
6912730 ,
76 , −
3617510 ,
43867798 , −174611
330 ,854513
138 ,−2363640912730 ,
85531036 , −23749461029
870 ,8615841276005
14322 ,7709321041217
510 ,2577687858367
6 , ...(3)
They decrease at the beginning only slowly and then grow with (2n)!. The complete terms inthe infinite sum eq. (2) depend on n and z and grow nevertheless, especially if z is small:
112 · z , −
1360 · z3 ,
11260 · z5 , −
11680 · z7 ,
11188 · z9 , −
691360360 · z11 ,
1156 · z13 , −
3617122400 · z15 ,
43867244188 · z17 ,−
174611125400 · z19 ,
776835796 · z21 , −
2363640911506960 · z23 ,
657931300 · z25 , −
339278014793960 · z27 ,
17231682552012492028 · z29 , −7709321041217
505920 · z31 ,151628697551
396 · z33 , −263152715530534773732418179400 · z35 , ...
(4)
The summation has to stop before the terms begin to grow unrestricted. There is anoptimal position depending on z where summation has to end. This problem is discussed insome detail in[3]2 .A further disadvantage is the low convergence of the admitted terms. In fig. 1 the problemis described in some detail depending on z: fig. 1a shows the maximal number of convergentterms, fig. 1b shows the maximal achievable accuracy in decimal digits.
2...page 467
2
(a) summation limit (b) correct decimal digits
Figure 1: restricted summation and limited precision
2 Chebyshev Interpolations of the Γ FunctionThe Chebyshev polynomials were derived by the Russian Mathematician P. L. Chebyshev (1821-1894) [6]. Among all normalized power polynomials of same degree they have the smallestdeviation from zero in a predefined intervall. Most of their beautiful properties are describedby Snyder [7] and Clenshaw [2] showing many applications to transcendental functions anddifferential equations.The approximation of the Γ Function is represented by
(z − 1)! ' Γ (z) =√
2π zz− 12 e−z ∗
∞0
∑′
a∗rT∗r(1z
) , 1 ≤ z ≤ ∞ (5)
Figure 2 contains 53 Chebyshev coefficients of the Γ-function for an accuracy of 30 decimaldigits in the whole range 1 ≤ z ≤ ∞. Using two coefficients the corresponding powerseries is:
Γ (z) =√
2π · zz− 12 · e−z ∗ [0.999935 + 0.0845506
z] (6)
the maximal relativ error(Figure 3a) is less than 8 ∗ 10−4. U̇sing eleven coefficients for thecorresponding powerseries
Γ (z) =√
2π · zz− 12 · e−z
∗ [0.99999999998 + 0.083333337647z
+ 0.0034720552506z2 − 0.0026788696285
z3
+ 0.00024711193390z4 + 0.00084986066787
z5 − 0.000035855790507z6 − 0.00068599470338
z7
+ 0.00067284352663z8 − 0.00029536102066
z9 + 0.000052647439438z10 ]
(7)
the maximal relativ error(Figure 3b) is less than 2 ∗ 10−11.
3
Chebychev coefficients Γ-function 30 digits
r��∗
r��∗
0+
2.084415923538053
986642658837738
27
-0.00000
00000000000000258766
77518
1+
0.042275268921800
684221304767803
28
+13204101565
2+
0.000005905456639
988647088023171
29
-44391
12769
3-
0.000056497110599
516283178411341
30
+9809
16518
4+
498744212957611
89474
09608
31
-341
34737
5-
103374677775244721
80884
32
-1009
72407
6-
781102997549159904
98736
33
+647
50292
7+
144985544478368664
72503
34
-262
83259
8-
9488746041409554
86866
35
+76
43533
9-
2450853231349408
76160
36
-12
31005
10
+1004170216329377
96250
37
-271738
11
-183302677934966
77815
38
+346373
12
+8672187799785
76352
39
-185684
13
+6796834696249
25584
40
+71428
14
-2882507538880
29128
41
-19923
15
+644507902393
11432
42
+2625
16
-58446607773
01642
43
+1262
17
-21917993063
35859
44
-1269
18
+13605116999
80453
45
+677
19
-42079
61997
50644
46
-269
20
+7708
93543
63348
47
+80
21
+633052293838
48
-12
22
-728
17978
66527
49
-4
23
+352
29384
07205
50
+5
24
-106
54216
31145
51
-3
25
+193634717582
52
+1
26
+92269
52412
Figure 2: Chebyshev coefficients Γ-function 30 digits
2.1 The Γ−1 FunctionFigure 4 contains 53 Chebyshev coefficients of the Γ−1-function for an accuracy of 30 decimaldigits in the whole range 1 ≤ z ≤ ∞.
1(z − 1)! ' Γ−1 (z) = 1√
2πz
12−z ez ∗
∞0
∑′
b∗rT∗r(1z
) , 1 ≤ z ≤ ∞ (8)
4
(a) relative error using only 2 coefficients (b) relative error using 11 coefficients
Figure 3: overall convergence
With four coefficients the powerseries expansion is:
Γ−1 (z) = 1√2π
z12−z ez ∗ [1.000006− 0.08354413
z+ 0.004512425
z2 + 0.001168239z3 ] (9)
The maximal relativ error (Figure 5) is less than 7 ∗ 10−6.In contrast to that in the famous Handbook of Mathematical Functions [1] 3 the series expansionfor Γ−1 is completely wrong.
2.2 The LnΓ FunctionThe approximation is represented by
ln[(z − 1)!] ' ln Γ (z) = ln(√
2π zz− 12 e−z
)+∞0
∑′
c∗rT∗r(1z
) , 1 ≤ z ≤ ∞ (10)
Figure 6 contains the Chebyshev coefficients with a precision of 30 decimal digits for the wholerange of 1 ≤ z ≤ ∞. Using only the first two coefficients and building the power series form
ln Γ (z) = ln√
2π +(z − 1
2
)ln (z)− z + 0.91932 + 0.081160
z(11)
the maximum absolute error (Figure 7a) is less than 5 ∗ 10−4. Using five coefficients
ln Γ (z) = ln√
2π +(z − 1
2
)ln z − z
+ 0.918935 + 0.0833326z
+ 0.000037082z2 − 0.00305155
z3 + 0.000743418z4
(12)
the maximum absolute error (Figure 7b) is less than 2 ∗ 10−7.
3...page 256
5
Chebyshev
coefficientsࢣି-function,
30
digits
r∗
r∗
0+
1.92058
34762
54948
20024
18291
34328
27
+0.0000000000
0000000002
4557198296
1-
0.03896
82376
24892
01214
15331
82954
28
-1
3344512573
2+
0.00078
30980
24559
58872
29636
11440
29
+4658360719
3+
0.00003
65074
79093
94718
63219
85541
30
-1086926183
4-
63995
52363
25099
03462
62930
31
+68916332
5+
2508
67644
41246
12497
57714
32
+93445505
6+
664
29088
71454
74619
02130
33
-64545386
7-
164
72719
66800
61015
61714
34
+27090508
8+
15
22654
0329235267
51875
35
-8155332
9+
178294
7678020568
75297
36
+1439319
10
-1
02239
7351375719
08376
37
+2
10256
11
+21131
54880
28419
64665
38
-3
35833
12
-1579
76630
19572
63953
39
+1
87421
13
-589
22900
53182
13064
40
-74017
14
+294
26575
02392
08743
41
+21359
15
-71
44837
50686
73310
42
-3194
16
+8
04021
40306
78725
43
-1095
17
+1
79571
80338
19450
44
+1242
18
-1
35094
39033
25037
45
-684
19
+44531
0400416213
46
+278
20
-8839
2150224802
47
-85
21
+244
9200580535
48
+15
22
+681
0693615141
49
+4
23
-356
9702427690
50
-5
24
+113
1165397918
51
+3
25
-22
2017658614
52
-1
26
-11809
99223
Figure 4: Chebyshev coefficients Γ−1-function 30 digits
6
Figure 5: Γ−1-function error analysis
3 The Chebyshev Interpolation of the Psi (Digamma) FunctionThis function is the first derivative of the LnΓ Function:
ψ(0)(z) = ψ(z) = ln′ Γ (z) = Γ′(z)Γ(z) = ln z − 1
2z +∞0
∑′
c∗rT∗′r (1z
) , 1 ≤ z ≤ ∞ (13)
After differentiating the sum using eq. (23) and eq. (24) , − 12z = −1
4 ∗ (T ∗0 (1z ) + T ∗1 (1
z )) has tobe added. The final result is
ψ(0)(z) = ψ(z) = Γ′(z)Γ(z) = ln z +
∞0
∑′
α∗(0)rT∗r(1z
) , 1 ≤ z ≤ ∞ (14)
3.1 Summation of the Harmonic Series−ψ(0)(1) = γ = 0.57721 56649 01532 86061 is Euler’s constant.
ψ(0)(n+ 1) − ψ(0)(1) = Hn = 1 + 12 + 1
3 + ...+ 1n , n ∈ N
defines and computes the n-th harmonic number Hn.
4 Interpolating further Polygamma FunctionsDifferentiating the result of eq. (14) as before one gets
ψ(1)(z) = ψ′(z) = 1
z+∞0
∑′
α∗(0)rT∗′r (1z
) , 1 ≤ z ≤ ∞ (15)
7
Finally 1z = 1
2 ∗ (T ∗0 (1z ) + T ∗1 (1
z )) has to be added yielding
ψ(1)(z) =∞0
∑′
α∗(1)rT∗r(1z
) , 1 ≤ z ≤ ∞ (16)
The higher Polygamma Functions can be approximated applying the two step differentiation re-peatedly without additional correction. Each next generated function looses about two decimaldigits in precision.
4.1 Summation of the higher Harmonic SeriesThe general relation is:
(−1)m+1
m! ψ(m)(z) =∑∞
k= 01
(z + k)m+1 = 1zm+1 + 1
(z + 1)m+1 + 1(z + 2)m+1 + ... (17)
and especially for z=n integer
(−1)m+1
m! [ψ(m)(1)− ψ(m)(n)] = 11m+1 + 1
2m+1 + 13m+1 + ... + 1
(n− 1)m+1 (18)
and further specialized with m=1
ψ(1)(1)− ψ(1)(n) = 112 + 1
22 + 132 + ... + 1
(n− 1)2 (19)
5 Relations of the Shifted Chebychev PolynomialsThe Shifted Chebyshev polynomials are defined by
T ∗r (θ) = cos(rθ) − 1 ≤ cos θ ≤ +1 −1 ≤ T ∗r ≤ +12z − 1 = cos θ 0 ≤ z ≤ +1
They are power polynomials in z. Their highest coefficient 2r−1 is used for normalization.Chebyshev proved [6] that among all normalized power polynomials of same degree (or less)they have the smallest deviation from zero in the range 0 ≤ z ≤ +1. That makes them uniquefor optimal interpolation in the declared region. The ranges may be adapted by linear or evennonlinear transformations.The polynomials for the intervall 0 ≤ z ≤ +1 are called the shifted polynomials. They areused here exclusively. Explicit expressions for the first few shifted Chebyshev polynomials are:T ∗0 (z) = 1, T ∗1 (z) = 2z − 1, T ∗2 (z) = 8z2 − 8z + 1, T ∗3 (z) = 32z3 − 48z2 + 18z − 1, ...
Inversion gives:1 = T ∗0 (z), 2z = T ∗0 (z) + T ∗1 (z), 8z2 = 3T ∗0 (z) + 4T ∗1 (z) + T ∗2 (z),32z3 = 10T ∗0 (z) + 15T ∗1 (z) + 6T ∗2 (z) + T ∗3 (z),...
5.1 Chebychev approximation of smooth functions
f(z) =n
0
∑′
a∗rT∗r(z) = 1
2a∗0 + a∗1T
∗1(z) + a∗2T
∗2(z) + a∗3T
∗3(z) + ... (20)
8
5.1.1 Numerical determination of the a∗r-coefficients
For the given function f(z) the a∗r can be determined by
a∗r =m
j=0
∑′′
f(cos2( jπ2m)) cos(rjπm
) (21)
′′ means: terms with j=0 and j=m must be halfed and m should be chosen sufficiently largefor a good approximation.
5.1.2 Summation
1. substituting the T ∗-polynomials by their powerseries representations and thereafter ap-plying the Horner Scheme or
2. it is better to use the coefficients directly: starting with a sufficiently large index n andapplying recursion:
b∗r = (2 ∗ z − 1) ∗ b∗r+1 − b∗r+2 + a∗r , b∗n+1 = b∗n+2 = 0 , r = n, n− 1, ..., 0 (22)
f(z) = 12(b∗0 − b∗2)
5.1.3 Differentiation
1. In order to get f ′(z) =n−10
∑′
a∗′
r T∗r(z) from eq. (20) one starts with a sufficiently large
index r=na∗
′r−1 = a∗
′r+1 + 4 r a∗r , a∗
′n = 0, a∗
′n+1 = 0 (23)
and applies the recursion till r=1.
2. Differentiation (chainrule) of
f(x) =n
0
∑′
a∗rT∗r(x)with x = 1
z results in
f′(z) = − 1
z2 ∗n−10
∑′
a∗′
r T∗r(1z
)
In addition to the former derivation step each coefficient of the derived form has to bemultiplied by
− 1z2 = −(3
8T∗0 (1z
) + 12T∗1 (1z
) + 18T∗2 (1z
)) (24)
applying the multiplication rule of the next subsection.
5.1.4 Multiplication of two Chebyshev approximations
The relation
T ∗m(z) ∗ T ∗n(z) = 12 ∗ [T ∗m+n(z) + T ∗|m−n|(z)] (25)
9
is used for multiplying two polynomials eq. (20). The resulting polynomial has m+n+1 coef-ficients and may be further reduced in length with a minor loss in accuracy.
References[1] Abramowitz, Milton (Hrsg.) ; Stegun, Irene A. (Hrsg.): Handbook of Mathematical Func-
tions with Formulas, Graphs, and Mathematical Tables. U.S. Government Printing Office,Washington, D.C., 1964 (National Bureau of Standards Applied Mathematics Series 55). –xiv+1046 S. – Corrections appeared in later printings up to the 10th Printing, December,1972. Reproductions by other publishers, in whole or in part, have been available since 1965.
[2] Clenshaw, C. W.: Chebyshev Series for Mathematical Functions. London : Her Majesty’sStationery Office, 1962 (National Physical Laboratory Mathematical Tables, Vol. 5. Depart-ment of Scientific and Industrial Research). – iv+36 S.
[3] Graham, Ronald L. ; Knuth, Donald E. ; Patashnik, Oren: Concrete Mathematics:A Foundation for Computer Science. 2nd. Reading, MA : Addison-Wesley PublishingCompany, 1994. – xiv+657 S. – ISBN 0–201–55802–5
[4] Lanczos, Cornelius: A Precision Approximation of the Gamma Function. (1964)
[5] Lanczos, Cornelius ; Bennett, Dr. Albert A. (Hrsg.): Applied Analysis. Prentice Hall,Inc., 1972 (PRENTICE-HALL MATHEMATICS SERIES)
[6] Natanson, Isidor P.: Konstruktive Funktionentheorie. Akademie-Verlag Berlin, 1955
[7] Snyder, Martin A.: Chebyshev Methods in Numerical Approximation. PRENTICE-HALL,INC., 1966 (Series in Automatic Computation)
[8] Temme, Nico M.: Special Functions: An Introduction to the Classical Functions of Math-ematical Physics. New York : John Wiley & Sons Inc., 1996. – xiv+374 S. – ISBN0–471–11313–1
[9] Whittaker, E. T. ; Watson, G. N.: A Course of Modern Analysis. 4th. CambridgeUniversity Press, 1927. – Reprinted in 1996. Table errata: Math. Comp. v. 36 (1981), no.153, p. 319.
10
Chebyshev coefficients LnΓ-function 30 digits
r��∗
r��∗
0+
0.081859815904678
13286
7937908794
27
-0.00000
00000000000000252444
70512
1+
0.040579741747366
64225
7034689356
28
+13281492164
2-
0.000404907931144
69879
9131629808
29
-4549724058
3-
0.000048897289375
19193
1988707281
30
+1033696592
4+
58079
53583619250489236122
31
-51294655
5-
1263
98282718429693139424
32
-97313164
6-
734
49134703220165685808
33
+64680725
7+
155
71158549445243897676
34
-26693664
8-
123059452195
28798
08979
35
+7899455
9-
21416116407
73544
01689
36
-1334338
10
+10169697689
38973
88713
37
-241499
11
-19745
33328
7229064398
38
+341305
12
+1215
14210
5272646241
39
-186612
13
+637
30023
8999434772
40
+72733
14
-291
75788
3116352078
41
-20640
15
+67
976604799256568
42
+2907
16
-69258621512
51366
43
+1180
17
-20012646187
92255
44
-1256
18
+13575674519
07062
45
+681
19
-4332938804
96534
46
-274
20
+827125257
24804
47
+82
21
-878351279129
48
-14
22
-705
7211991064
49
-4
23
+354
8912249033
50
+5
24
-109
8579810742
51
-3
25
+207734840963
52
+1
26
+5275541308
Figure 6: Chebyshev coefficients lnΓ-function 30 digits
11
(a) absolute error using only 2 coefficients (b) absolute error using 5 coefficients
Figure 7: overall convergence
Chebyshev coefficients � (� )function 20 digitsr � (� ) �
∗ r � (� ) �∗
0 + 0.44099 88884 92856 94691 15 + 0.00000 00000 00227 981951 + 0.21108 63054 00967 91864 16 - 120 049562 - 0.00912 29231 52255 54182 17 + 32 345303 + 0.00031 04394 40358 50795 18 - 4 605264 + 0.00001 52324 36589 43642 19 - 544355 - 46008 36953 34872 20 + 626346 + 4298 51491 37346 21 - 243777 + 206 19925 15161 22 + 59928 - 156 70624 26952 23 - 6509 + 30 03990 64500 24 - 25810 - 1 94358 59626 25 + 19911 - 72747 46204 26 - 7812 + 31603 48530 27 + 2013 - 6567 37755 28 - 314 + 483 18059 29 - 1
Figure 8: The ψ(0)-approximation 20 digits
12
Chebyshev coefficients � (� )-function 20 digitsr � (� )�
∗ r � (� )�∗
0 - 0.65708 14986 14027 69733 16 - 0.00000 00000 00272 965211 - 0.43109 98074 89671 50892 17 + 78 981692 - 0.09873 66335 87060 00171 18 + 53 570733 + 0.00356 42792 12194 74453 19 - 17 100434 - 0.00025 87473 59549 76014 20 + 3 264925 + 31711 69149 43256 21 - 34796 + 31208 83744 00715 22 + 278557 - 6189 17377 99128 23 + 140098 + 468 49699 44897 24 - 43379 + 87 01863 21026 25 + 82010 - 40 20193 46760 26 - 2111 + 7 75739 90580 27 - 10012 - 47235 75596 28 + 5213 - 25200 70786 29 - 1814 + 11506 14546 30 + 415 - 2679 83664
Figure 9: The ψ(1)-function 20 digits
13