# How does mathematica numerically evaluate the Meijer G-function?

The Meijer G-function is defined as a contour integral in the complex plane. Mathematica is able to numerically evaluate such a function quickly and accurately. How does she do that?

• Internal numerical algorithms that are not likely to be publicly viewable, is my understanding. Aug 3 at 9:23
• According to NIST, there seem to be some fortran libraries that calculate the Meijer G-function, see for example dlmf.nist.gov/16.27 , so if I could venture a guess, probably Mathematica uses either a wrapper around that or some similar implementation. The actual details are of course not publicly available. Aug 3 at 9:31
• Actually, by googling I found something and added it as an answer. I will update it if I find anything more. Aug 3 at 9:37

Contrary to the comments, alot of the implementation is actually viewable. The evaluation seems to be a bit convoluted. First there a a whole lot of definitions for special cases which then get converted into other forms. A lot of Bessel Functions, Pochhammer, SinIntegrals and Elliptic functions. If this does not match, it gets into the gereral evaluation which seems to consist of alot of Hypergeometric functions and finding of poles (residuals of some kind maybe?) But it seems extremely complex for various pathways of possible parameters.

If you want to read it yourself, type:

<<"GeneralUtilities"
GeneralUtilitiesPrintDefinitions@MeijerG


Hope this helps.

According to this old draft by Folkmar Bornemann, the implementation of Meijer G-function is a bit complicated and it happens in various stages. The article mentions a comment by Daniel Lichtblau on July 27, 2003:

I'll be discussing aspects of MeijerG issues at ACA next week. It is basically a lookup that converts various functions to MeijerG, then figures out the integral of a product of 2 MeijerG's via Slater convolution.

Furthermore, the Notes on Internal Implementation say the following:

Many other definite integrals are done using Marichev-- Adamchik Mellin transform methods. The results are often initially expressed in terms of Meijer G functions, which are converted into hypergeometric functions using Slater's Theorem and then simplified.

So in a nutshell, when one asks for the value of a Meijer G-function, this is converted to hypergeometric functions and then evaluated using the latter. The attached article also contains some mathematical details, that an interested reader may enjoy.

• Many thanks for this answer! I looked up the references you mentioned, but it was not super helpful. I suppose that mathematica is just very good at summing the corresponding series. Aug 3 at 10:53