Computation of matrix gamma function

  • João R. Cardoso
  • Amir Sadeghi


Matrix functions have a major role in science and engineering. One of the fundamental matrix functions, which is particularly important due to its connections with certain matrix differential equations and other special matrix functions, is the matrix gamma function. This research article focus on the numerical computation of this function. Well-known techniques for the scalar gamma function, such as Lanczos, Spouge and Stirling approximations, are extended to the matrix case. This extension raises many challenging issues and several strategies used in the computation of matrix functions, like Schur decomposition and block Parlett recurrences, need to be incorporated to make the methods more effective. We also propose a fourth technique based on the reciprocal gamma function that is shown to be competitive with the other three methods in terms of accuracy, with the advantage of being rich in matrix multiplications. Strengths and weaknesses of the proposed methods are illustrated with a set of numerical examples. Bounds for truncation errors and other bounds related with the matrix gamma function will be discussed as well.


Gamma matrix function Lanczos method Spouge method Stirling approximation Reciprocal gamma function Schur decomposition Block Parlett recurrence 

Mathematics Subject Classification

65F30 65F60 33B15 



We would like to thank the anonymous reviewers for their helpful suggestions and comments. The work of the first author was supported by ISR-University of Coimbra (project UID/EEA/00048/2013) funded by “Fundação para a Ciência e a Tecnologia” (FCT). The work of the corresponding author is supported by Robat Karim branch, Islamic Azad University, Tehran, Iran.


  1. 1.
    Abramowitz, M., Stegun, I.: Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. Dover, New York (1970)zbMATHGoogle Scholar
  2. 2.
    Al-Mohy, A.H., Higham, N.J.: Computing the Fréchet derivative of the matrix exponential, with an application to condition number estimation. SIAM J. Matrix Anal. Appl. 30(4), 1639–1657 (2009)CrossRefzbMATHGoogle Scholar
  3. 3.
    Al-Mohy, A.H., Higham, N.J.: Improved inverse scaling and squaring algorithms for the matrix logarithm. SIAM J. Sci. Comput. 34(4), C153–C169 (2012)MathSciNetCrossRefzbMATHGoogle Scholar
  4. 4.
    Al-Mohy, A.H., Higham, N.J., Relton, S.D.: Computing the Fréchet derivative of the matrix logarithm and estimating the condition number. SIAM J. Sci. Comput. 35(4), C394–C410 (2013)CrossRefzbMATHGoogle Scholar
  5. 5.
    Askey, R., Roy, R.: Gamma function. In: Olver, F., Lozier, D., Boisvert, R., Clark, C. (eds.) NIST Handbook of Mathematical Functions. Cambridge University Press, Cambridge (2010)Google Scholar
  6. 6.
    Barradas, I., Cohen, J.E.: Iterated exponentiation, matrix–matrix exponentiation, and entropy. J. Math. Anal. Appl. 183, 76–88 (1994)MathSciNetCrossRefzbMATHGoogle Scholar
  7. 7.
    Borwein, J.M., Corless, R.M.: Gamma and factorial in the Monthly. Am. Math. Mon. 125(5), 400–424 (2018)MathSciNetCrossRefzbMATHGoogle Scholar
  8. 8.
    Bourguet, L.: Sur les intégrales Eulériennes et quelques autres fonctions uniformes. Acta Mathematica 2, 261–295 (1883)MathSciNetCrossRefzbMATHGoogle Scholar
  9. 9.
    Braumann, C.A., Cortés, J.C., Jódar, L., Villafuerte, L.: On the random gamma function: theory and computing. J. Comput. Appl. Math. 335, 142–155 (2018)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Cardoso, J.R., Sadeghi, A.: On the conditioning of the matrix–matrix exponentiation. Numer. Algorithms 79(2), 457–477 (2018)MathSciNetCrossRefzbMATHGoogle Scholar
  11. 11.
    Char, B.: On Stieltjes’ continued fraction for the gamma function. Math. Comput. 34(150), 547–551 (1980)MathSciNetzbMATHGoogle Scholar
  12. 12.
    Cortés, J.C., Jódar, L., Solís, F.J., Ku-Carrillo, R.: Infinite matrix products and the representation of the matrix gamma function. Abstract and Applied Analysis, vol. 2015, Article ID 564287. (2015)
  13. 13.
    Davies, P.A., Higham, N.J.: A Schur–Parlett algorithm for computing matrix functions. SIAM J. Matrix Anal. Appl. 25(2), 464–485 (2003)MathSciNetCrossRefzbMATHGoogle Scholar
  14. 14.
    Davis, P.J.: Leonhard Euler’s integral: a historical profile of the gamma function. Am. Math. Mon. 66, 849–869 (1959)MathSciNetzbMATHGoogle Scholar
  15. 15.
    Edwards, H.M.: Riemanns Zeta Function. Academic Press, Cambridge (1974)Google Scholar
  16. 16.
    Fekih-Ahmed, L.: On the power series expansion of the reciprocal gamma function, HAL archives. (2014). Accessed 16 Mar 2018
  17. 17.
    Gautschi, W.: A computational procedure for incomplete gamma functions. ACM Trans. Math. Softw. 5(4), 466–481 (1979)CrossRefzbMATHGoogle Scholar
  18. 18.
    Gautschi, W.: The incomplete gamma function since Tricomi. Atti Convegni Lincei 147, 203–237 (1998)MathSciNetzbMATHGoogle Scholar
  19. 19.
    Gautschi, W.: A note on the recursive calculation of incomplete gamma functions. ACM Trans. Math. Softw. 25(1), 101–107 (1999)MathSciNetCrossRefzbMATHGoogle Scholar
  20. 20.
    Godfrey, P.: Lanczos implementation of the gamma function. (See also Accessed 16 Mar 2018
  21. 21.
    Golub, G.H., Van Loan, C.F.: Matrix Computations, 4th edn. Johns Hopkins University Press, Baltimore (2013)zbMATHGoogle Scholar
  22. 22.
    Graham, R., Knuth, D., Patashnik, O.: Concrete Mathematics, 2nd edn. Addison-Wesley, Boston (1994)zbMATHGoogle Scholar
  23. 23.
    Hale, N., Higham, N.J., Trefethen, L.: Computing \(A^{\alpha }\), \(\log (A)\), and related matrix functions by contour integrals. SIAM J. Numer. Anal. 46, 2505–2523 (2008)MathSciNetCrossRefzbMATHGoogle Scholar
  24. 24.
    Higham, N.J.: Functions of Matrices: Theory and Computation. Society for Industrial and Applied Mathematics, Philadelphia (2008)CrossRefzbMATHGoogle Scholar
  25. 25.
    Higham, N.J.: The Matrix Function Toolbox. Accessed 8 Feb 2018
  26. 26.
    Horn, R.A., Johnson, C.R.: Topics in Matrix Analysis, Paperback Edition. Cambridge University Press, Cambridge (1994)zbMATHGoogle Scholar
  27. 27.
    Horn, R.A., Johnson, C.R.: Matrix Analysis, 2nd edn. Cambridge University Press, Cambridge (2013)zbMATHGoogle Scholar
  28. 28.
    Jódar, L., Cortés, J.C.: On the hypergeometric matrix function. J. Comput. Appl. Math. 99, 205–217 (1998)MathSciNetCrossRefzbMATHGoogle Scholar
  29. 29.
    Jódar, L., Cortés, J.C.: Some properties of gamma and beta functions. Appl. Math. Lett. 11(1), 89–93 (1998)MathSciNetCrossRefzbMATHGoogle Scholar
  30. 30.
    Lanczos, C.: A precision approximation of the gamma function. J. Soc. Ind. Appl. Math. Ser. B Numer. Anal. 1, 86–96 (1964)MathSciNetCrossRefzbMATHGoogle Scholar
  31. 31.
    Luke, Y.: The Special Functions and Their Approximations, vol. 1. Academic Press, New York (1969)zbMATHGoogle Scholar
  32. 32.
    Mathias, R.: Approximation of matrix-valued functions. SIAM J. Matrix Anal. Appl. 14, 1061–1063 (1993)MathSciNetCrossRefzbMATHGoogle Scholar
  33. 33.
    Parlett, B.N.: A recurrence among the elements of functions of triangular matrices. Linear Algebra Appl. 14, 117–121 (1976)MathSciNetCrossRefzbMATHGoogle Scholar
  34. 34.
    Paterson, M.S., Stockmeyer, L.J.: On the number of nonscalar multiplications necessary to evaluate polynomials. SIAM J. Comput. 2(1), 60–66 (1973)MathSciNetCrossRefzbMATHGoogle Scholar
  35. 35.
    Pugh, G.R.: An analysis of the Lanczos gamma approximation. Ph.D. thesis, University of British Columbia (2004)Google Scholar
  36. 36.
    Sastre, J., Jódar, L.: Asymptotics of the modified Bessel and incomplete gamma matrix functions. Appl. Math. Lett. 16(6), 815–820 (2003)MathSciNetCrossRefzbMATHGoogle Scholar
  37. 37.
    Schmelzer, T., Trefethen, L.N.: Computing the gamma function using contour integrals and rational approximations. SIAM J. Numer. Anal. 45, 558–571 (2007)MathSciNetCrossRefzbMATHGoogle Scholar
  38. 38.
    Smith, D.: Algorithm 814: fortran 90 software for floating-point multiple precision arithmetic, gamma and related functions. ACM Trans. Math. Softw. 27(4), 377–387 (2001)CrossRefzbMATHGoogle Scholar
  39. 39.
    Spira, R.: Calculation of the gamma function by Stirling’s formula. Math. Comput. 25(114), 317–322 (1971)MathSciNetzbMATHGoogle Scholar
  40. 40.
    Spouge, J.: Computation of the gamma, digamma, and trigamma functions. SIAM J. Numer. Anal. 31(3), 931–944 (1994)MathSciNetCrossRefzbMATHGoogle Scholar
  41. 41.
    Temme, N.: Special Functions: An Introduction to the Classical Functions of Mathematical Physics. Wiley, New York (1996)CrossRefzbMATHGoogle Scholar
  42. 42.
    Trefethen, L.N., Weideman, J., Schmelzer, T.: Talbot quadratures and rational approximations. BIT Numer. Math. 46, 653–670 (2006)MathSciNetCrossRefzbMATHGoogle Scholar
  43. 43.
    Van Loan, C.: The sensitivity of the matrix exponential. SIAM J. Numer. Anal. 14(6), 971–981 (1977)MathSciNetCrossRefzbMATHGoogle Scholar
  44. 44.
    Winitzki, S.: Computing the incomplete gamma function to arbitrary precision. In: Kumar, V., et al. (eds.) Lectures Notes on Computer Science, vol. 2667, pp. 790–798 (2003)Google Scholar
  45. 45.
    Wrench, J.W.: Concerning two series for the gamma function. Math. Comput. 22, 617–626 (1968)MathSciNetCrossRefzbMATHGoogle Scholar
  46. 46.
    Wrench, J.W.: Erratum: concerning two series for the gamma function. Math. Comput. 27, 681–682 (1973)MathSciNetCrossRefGoogle Scholar

Copyright information

© Springer Nature B.V. 2019

Authors and Affiliations

  1. 1.Coimbra Polytechnic – ISECCoimbraPortugal
  2. 2.Institute of Systems and RoboticsUniversity of Coimbra, Pólo IICoimbraPortugal
  3. 3.Department of Mathematics, Robat Karim BranchIslamic Azad UniversityTehranIran

Personalised recommendations