API

Main Functions

MeijerG.meijergFunction
meijerg(a, b, m, n, z)
meijerg(a_left, a_right, b_left, b_right, z)

Compute the Meijer G-function with automatic reduction to simpler functions and robust handling of confluent poles.

Overview

This is the primary public API and recommended entry point. It implements a hierarchical polyalgorithm strategy:

  1. Special-case reduction: Recognizes patterns (exponential, trigonometric, Bessel, incomplete gamma, etc.) and reduces to elementary or special functions
  2. Parameter validation: Checks for valid parameter pairings (skipped for special reductions)
  3. Confluence assessment: Quantifies proximity to confluent poles (integer-separated parameters)
  4. Method selection (in order):
    • If confluence risk is low (< 0.5): Try Slater residue expansion (fast, accurate)
    • Otherwise or if Slater fails: Try adaptive perturbation regularization (robust for confluent poles)
      • Adaptively converges to user tolerance without numerical integration
      • Preserves full precision without BigFloat slowdowns
    • If perturbation fails: Emergency contour methods (rare in practice)

Arguments

  • a, b: complete upper and lower parameter collections (tuple/vector form)
  • m, n: Meijer G indices with 0 <= m <= length(b) and 0 <= n <= length(a)
  • z: evaluation point (any Julia number type: Float64, BigFloat, Complex, etc.)

Alternative signature

The split-parameter form meijerg(a_left, a_right, b_left, b_right, z) is equivalent to meijerg((a_left..., a_right...), (b_left..., b_right...), length(b_left), length(a_left), z). This convention follows the standard notation where n = |a_left| and m = |b_left|.

Returns

The computed G-function value, with return type matching the promoted input types. Supports arbitrary precision via BigFloat and complex arguments.

Examples

# Exponential: G_{0,1}^{1,0}(z | - ; 0) = exp(-z)
meijerg((), (), (0,), (), -0.5)  # ≈ exp(0.5)

# Sine: √π · G_{0,2}^{1,0}(z | - ; 1/2, 0) = sin(2√z)
sqrt(pi) * meijerg((), (), (0.5,), (0,), 0.1^2/4)

# Generic input: uses robust confluence-aware polyalgorithm
meijerg((0.3, 0.8), (0.2, 1.1), 1, 1, 0.7)

See Also

  • meijerg_slater: Pure Slater residue expansion (power users, no reductions or perturbation; unsafe for confluent poles)
  • meijerg_contour: Direct Mellin-Barnes integration (power users only; use explicit contour_case= to select method)
source

Formatter Macro

For producing human- and tool-readable representations of Meijer G-functions (plaintext, LaTeX, and Mathematica), use the @formatter macro. The macro takes a meijerg(...) call and returns a 3-tuple (plaintext, latex, mathematica).

Example:

plain, latex, math = @formatter meijerg((1,2), (3,4), 1, 1, 5)

You can also optionally pass a verbose value to disable the automatic printing.

Example:

plain, latex, math = @formatter meijerg((1,2), (3,4), 1, 1, 5) verbose=false
MeijerG.@formatterMacro
@formatter expr
@formatter expr verbose=false

Apply the @formatter macro to a meijerg function call to automatically format its output.

Arguments

  • expr: A meijerg function call with its arguments.
  • verbose: (Optional, default true) Pass false to suppress printed output.

Returns

A tuple (plaintext_str, latex_str, mathematica_str) containing the Plaintext, LaTeX, and Mathematica representations of the Meijer G-function.

Examples

@formatter meijerg((1, 2), (3, 4), 1, 1, 5)
source
MeijerG.meijerg_to_latex_and_mathFunction
meijerg_to_latex_and_math(args...; verbose=true)

Convert Meijer G-function syntax to LaTeX and Mathematica string formats.

Arguments

  • args: Either complete or split parameter forms of the Meijer G-function.
  • verbose: (Optional) If true (default), prints the representations. Set to false to suppress output.

Returns

A tuple (plaintext_str, latex_str, mathematica_str) containing the Plaintext, LaTeX, and Mathematica representations.

source

Pure Slater Evaluation

MeijerG.meijerg_slaterFunction
meijerg_slater(a, b, m, n, z)
meijerg_slater(a_left, a_right, b_left, b_right, z)

Compute the Meijer G-function using Slater's residue expansions (DLMF §16.17).

This is the pure Slater evaluator for advanced users who want direct residue-based computation without automatic reduction to special functions or perturbation handling for confluent poles.

Overview

The Meijer G-function is defined via a Mellin–Barnes contour integral whose residues yield finite sums of generalized hypergeometric functions (pFq). This implementation:

  • Uses the lower expansion (Slater, DLMF 16.17.2) for p < q or p = q, |z| ≤ 1
  • Uses the upper expansion (Slater, DLMF 16.17.3) for p > q or p = q, |z| > 1
  • Promotes internally to BigFloat near |z| = 1 for balanced cases to improve accuracy
  • Supports arbitrary-precision arithmetic via BigFloat and complex numbers
  • Does NOT apply reductions to special functions
  • Does NOT use parameter perturbation for confluent poles

Arguments

  • a, b: complete upper and lower parameter collections (tuple or vector)
    • p = length(a) are the total upper parameters
    • q = length(b) are the total lower parameters
  • m (0 ≤ m ≤ q): number of active lower parameters (contributing residues)
  • n (0 ≤ n ≤ p): number of active upper parameters
  • z: evaluation point (Float64, BigFloat, Complex variants, nonzero)

Split-parameter form

meijerg_slater(a_left, a_right, b_left, b_right, z) is equivalent to

meijerg_slater((a_left..., a_right...), (b_left..., b_right...),
               length(b_left), length(a_left), z)

This follows the standard indexing convention where active top parameters come first, active bottom parameters come first, etc.

See Also

  • meijerg: Main public API with special-case reductions and confluent-pole handling
source

Contour Evaluation

MeijerG.meijerg_contourFunction
meijerg_contour(a, b, m, n, z; kwargs...)
meijerg_contour(a_left, a_right, b_left, b_right, z; kwargs...)

Evaluate the Meijer G-function by direct numerical integration of the Mellin-Barnes contour.

Warning: This is a low-level API intended for power users and validation workflows. For normal use, call meijerg() instead, which uses adaptive perturbation for confluent cases and deploys contour integration only as an emergency fallback.

This method numerically integrates the defining contour integral using explicit DLMF contour families (DLMF 16.17):

  • Case (i): vertical Barnes contour s = σ + i t (robust when strip exists)
  • Case (ii): loop contour around lower poles of Γ(b_j - s) (DLMF Case ii)
  • Case (iii): loop contour around upper poles of Γ(1 - a_j + s) (DLMF Case iii)

By default (contour_case = :auto), case selection follows pole geometry:

  • If a separating vertical strip exists: Case (i)
  • Otherwise: Case (ii) for lower mode or Case (iii) for upper mode

Keyword arguments

  • rtol: relative tolerance for quadrature and truncation refinement
  • atol: absolute tolerance for quadrature and truncation refinement
  • contour_case: one of :auto, :i, :ii, :iii
  • sigma: real part of the Barnes contour; if omitted, a default value inside the admissible strip is chosen
  • initial_halfwidth: initial truncation half-width in the t variable
  • max_truncation_steps: maximum number of half-width doublings used to resolve the infinite tails
  • allow_regularization_fallback: (Optional, default: false) if true, falls back to perturbative regularization if contour integration fails

Notes

  • Real negative z must be passed explicitly as complex (z + 0im) to select the desired branch.
source

Calling Conventions

meijerg, meijerg_slater, and meijerg_contour support two calling styles:

Full-parameter form

result = meijerg(a, b, m, n, z)

where a and b are tuples or vectors of parameters.

Split-parameter form

result = meijerg(a_left, a_right, b_left, b_right, z)

Equivalent to meijerg((a_left..., a_right...), (b_left..., b_right...), length(b_left), length(a_left), z)