#
# gamma-func.txt, 21 May 11

!msgpostfix \n

3.625609908221908  | gamma(1/4)
2.678938534707748  | gamma(1/3)
#                  | gamma(1/2) == pi^(1/2)
1.354117939426400  | gamma(2/3)
1.225416702465178  | gamma(3/4)
-4.90166680986071  | gamma(-1/4)
-4.06235381827920  | gamma(-1/3)
-3.54490770181103  | gamma(-1/2)
-4.01840780206162  | gamma(-2/3)
-4.83414654429588  | gamma(-3/4)

!msgpostfix Calculate 1/gamma(z) for |z| <= 2, error <= 10^-8\n
!need all
 0.5772156649015329
-0.6558780715202538
-0.420026350340952e-1
 0.1665386113822915
-0.421977345555443e-1
-0.96219715278770e-2
 0.72189432466630e-2
-0.11651675918591e-2
-0.2152416741149e-3
 0.1280502823882e-3
-0.201348547807e-4
-0.12504934821e-5
 0.11330272320e-5
-0.2056338417e-6
 0.61160950e-8
 0.50020075e-8
-0.11812746e-8
 0.1043427e-9
 0.77823e-11
-0.36968e-11
 0.51000e-12
-0.206e-13
-0.14e-14

!msgpostfix Gamma function polynomial approximation (error < 5e-5) from Abramowitz and Stegun 6.1.35\n

!need all
-0.57486 46
 0.95123 63
-0.69985 88
 0.42455 49
-0.10106 78


!fuzz 0.0000001

!msgpostfix Gamma function polynomial approximation (error < 3e-7) from Abramowitz and Stegun 6.1.36\n

!need all
-0.57719 1652
 0.98820 5891
-0.89705 6937
 0.91820 6857
-0.75670 4078
 0.48219 9394
-0.19352 7818
 0.03586 8343


!fuzz 0.00000001

!msgpostfix Gamma function evaluated using Stirling's approximation (x > 33)\n

!need all
 7.87311395793093628397E-4
-2.29549961613378126380E-4
-2.68132617805781232825E-3
 3.47222221605458667310E-3
 8.33333333333482257126E-2


!msgpostfix Gamma function evaluated using Stirling's approximation (divide, Abramowitz and Stegun 6.1.37)\n

!need all
12.0
288.0
139.0
51840.0
571.0
2488320.0
#163879
#209018880
#5246819
#75246796800
#534703536
#902961561600

!msgpostfix Log(Gamma function) evaluated using Stirling's approximation (multiple, Abramowitz and Stegun 6.1.41)\n

!need all
 8.33333333333333333333333e-2
-2.77777777777777777777778e-3
 7.93650793650793650793650e-4
-5.95238095238095238095238e-4


!msgpostfix Log(Gamma function) evaluated using Stirling's approximation (Zhang & Jin)\n

!need all
 8.333333333333333e-2
-2.777777777777778e-3
 7.936507936507936e-4
-5.952380952380952e-4
 8.417508417508418e-04
-1.917526917526918e-03
 6.410256410256410e-03
-2.955065359477124e-02
 1.796443723688307e-01
-1.39243221690590e+00


!msgpostfix Log(Gamma function) evaluated using Stirling's approximation (divide, Abramowitz and Stegun 6.1.41)\n

!need all
12.0
360.0
1260.0
1680.0


!msgpostfix Gamma function polynomial approximation (Cephes 64-bit library)\n

!need all
  1.60119522476751861407E-4
  1.19135147006586384913E-3
  1.04213797561761569935E-2
  4.76367800457137231464E-2
  2.07448227648435975150E-1
  4.94214826801497100753E-1
  9.99999999999999996796E-1

-2.31581873324120129819E-5
 5.39605580493303397842E-4
-4.45641913851797240494E-3
 1.18139785222060435552E-2
 3.58236398605498653373E-2
-2.34591795718243348568E-1
 7.14304917030273074085E-2
 1.00000000000000000320E0


!fuzz 0.000001

!msgpostfix Log(gamma function), Numerical recipes in C: 1988\n

!need all
 76.18009173
-86.50532033
 24.01409822
- 1.231739516
  0.120858003e-2
- 0.536382e-5

  2.50662827465

# ALNGAM computes the logarithm of the Gamma function.
#    Algorithm AS 245:
#    A Robust and Reliable Algorithm for the Logarithm of the Gamma Function,
#    Applied Statistics,
#    Volume 38, Number 2, 1989, pages 397-402.

!fuzz 0.0000001

!msgpostfix Log(gamma function), Applied statistics algorithm 245\n

!need all
-  2.66685511495E+00
- 24.4387534237E+00
- 21.9698958928E+00
  11.1667541262E+00
   3.13060547623E+00
   0.607771387771E+00
  11.9400905721E+00
  31.4690115749E+00
  15.2346874070E+00

- 78.3359299449E+00
-142.046296688E+00
 137.519416416E+00
  78.6994924154E+00
   4.16438922228E+00
  47.0668766060E+00
 313.399215894E+00
 263.505074721E+00
  43.3400022514E+00

-  2.12159572323E+05
   2.30661510616E+05
   2.74647644705E+04
-  4.02621119975E+04
-  2.29660729780E+03
-  1.16328495004E+05
-  1.46025937511E+05
-  2.42357409629E+04
-  5.70691009324E+02

   0.279195317918525E+00
   0.4917317610505968E+00
   0.0692910599291889E+00
   3.350343815022304E+00
   6.012459259764103E+00


# Calculates the natural logarithm of GAMMA ( X ) for positive X.
#   William Cody, Kenneth Hillstrom,
#   Chebyshev Approximations for the Natural Logarithm of the Gamma Function,
#   Mathematics of Computation, Volume 21, Number 98, April 1967, pages 198-203.
#
#    Kenneth Hillstrom,
#    ANL/AMD Program ANLC366S, DGAMMA/DLGAMA, May 1969.
#
#    John Hart, Ward Cheney, Charles Lawson, Hans Maehly, 
#    Charles Mesztenyi, John Rice, Henry Thacher, Christoph Witzgall,
#    Computer Approximations, Wiley, 1968,
#

!msgpostfix Log(gamma function(x)) for positive x, via Chebyshev approximation\n

!need all
-1.910444077728E-03
 8.4171387781295E-04
-5.952379913043012E-04
 7.93650793500350248E-04
-2.777777777777681622553E-03
 8.333333333333333331554247E-02
 5.7083835261E-03

 4.945235359296727046734888E+00
 2.018112620856775083915565E+02
 2.290838373831346393026739E+03
 1.131967205903380828685045E+04
 2.855724635671635335736389E+04
 3.848496228443793359990269E+04
 2.637748787624195437963534E+04
 7.225813979700288197698961E+03

 4.974607845568932035012064E+00
 5.424138599891070494101986E+02
 1.550693864978364947665077E+04
 1.847932904445632425417223E+05
 1.088204769468828767498470E+06
 3.338152967987029735917223E+06
 5.106661678927352456275255E+06
 3.074109054850539556250927E+06

 1.474502166059939948905062E+04
 2.426813369486704502836312E+06
 1.214755574045093227939592E+08
 2.663432449630976949898078E+09
 2.940378956634553899906876E+10
 1.702665737765398868392998E+11
 4.926125793377430887588120E+11
 5.606251856223951465078242E+11

 6.748212550303777196073036E+01
 1.113332393857199323513008E+03
 7.738757056935398733233834E+03
 2.763987074403340708898585E+04
 5.499310206226157329794414E+04
 6.161122180066002127833352E+04
 3.635127591501940507276287E+04
 8.785536302431013170870835E+03

 1.830328399370592604055942E+02
 7.765049321445005871323047E+03
 1.331903827966074194402448E+05
 1.136705821321969608938755E+06
 5.267964117437946917577538E+06
 1.346701454311101692290052E+07
 1.782736530353274213975932E+07
 9.533095591844353613395747E+06

 2.690530175870899333379843E+03
 6.393885654300092398984238E+05
 4.135599930241388052042842E+07
 1.120872109616147941376570E+09
 1.488613728678813811542398E+10
 1.016803586272438228077304E+11
 3.417476345507377132798597E+11
 4.463158187419713286462081E+11

#    Christian Lanczos,
#    A precision approximation of the gamma function,
#    SIAM Journal on Numerical Analysis, B,
#    Volume 1, 1964, pages 86-96.

!msgpostfix Compute Log(Gamma(X)) using a Lanczos approximation\n

!need all
    0.9999999999995183E+00
  676.5203681218835E+00
-1259.139216722289E+00
  771.3234287757674E+00
- 176.6150291498386E+00
   12.50734324009056E+00
-   0.1385710331296526E+00
    0.9934937113930748E-05
    0.1659470187408462E-06

# The Cephes Math Library tables are very long and not listed here..
# The positive domain is partitioned into numerous segments for approximation.
# For x > 10,
# log gamma(x) = (x - 0.5) log(x) - x + log sqrt(2 pi) + 1/x R(1/x^2)
# Near the minimum at x = x0 = 1.46... the approximation is
# log gamma(x0 + z) = log gamma(x0) + z^2 P(z)/Q(z)
# for small z.
# Elsewhere between 0 and 10,
# log gamma(n + z) = log gamma(n) + z P(z)/Q(z)
# for various selected n and small z.

!fuzz 0.0000001

!msgpostfix Lanczos Gamma Function approximation - coefficients\n

!need all
  1.000000000190015
 76.18009172947146
-86.50532032941677
 24.01409824083091
- 1.231739572450155
  0.1208650973866179E-2
- 0.5395239384953E-5

