SOCR ≫ TCIU Website ≫ TCIU GitHub ≫

Earlier in Chapter 4 we discussed the Laplace Transform, \(\mathcal{L}\), mapping spatio-temporal signals into 2D manifolds called spacekime surfaces. The Laplace transformation is a linear operator that maps complex-valued functions of a positive real variable (e.g., time, \(t \in\mathbb{R}^+\)) to complex valued functions defined over the complex plane, \(\kappa\in\mathbb{C}\)

\[{\mathcal {L}}(f)(\kappa)=\hat{f}(\kappa)\equiv F(\kappa)=\int_{0}^{\infty} {f(t)e^{-\kappa t} dt}.\]

1 Theoretical Fundamentals and Geometric Properties

The Laplace transform is a special case of the more general integral transform defined for a specific kernel \(K(\cdot,\cdot)\):

\[(Tf)(z)=\int_{t_{1}}^{t_{2}}f(t)\,K(t,z) dt.\]

Under certain cases, the Meijer-G function turns out to be an effective symbolic computation strategy to compute integrals of the form: \(\int_0^{\infty}f(x)dx\). It also has really important theoretical connections to the theory of complex numbers and mathematical (integral) transformations. It is an important function class that is closed with respect to many integral transformations (e.g., Fourier, Laplace transforms) and presents many flexibility to metamodeling and enhancing model interpretability. Specifically, this prior work shows the general utilization of the Meijer-G function [1]:

\[\text{Polynomials Approximants (Taylor series)} \subset \text{Algebraic Approximants (Padé)} \subset \text{Analytic Functions (Meijer-G)}\]

Let’s explore a few of these aspects.

The Meijer-G function is defined as follows: \[\begin{equation} \begin{split} G_{p,q}^{m,n}(a_1,...a_p;b_1,b_2,...b_q|z)\equiv G_{p,q}^{m,n}\left(\begin{array}{c} a_p\\ b_q \end{array}\bigg| z\right)\equiv G_{p,q}^{m,n}\left(\begin{array}{c} \overbrace{a_1,...,a_n}^{\text{n component}};\overbrace{a_{n+1},...,a_{p}}^{\text{p-n component}}\\ \underbrace{b_1,...,b_m}_{\text{m component}};\underbrace{b_{m+1},...,b_{q}}_{\text{q-m component}} \end{array}\bigg| z\right)=\\\frac{1}{2\pi i}\int_{C}\frac{\Gamma(b_1-s)...\Gamma(b_m-s)\Gamma(1-a_1+s)...\Gamma(1-a_n+s)}{\Gamma(1-b_{m+1}+s)...\Gamma(1-b_q+s)\Gamma(a_{n+1}-s)...\Gamma(a_{p}-s)}z^sds. \end{split} \end{equation}\]

A key aspect of the Meijer-G function is its relation to the Laplace transform.

The Laplace transform for Meijer-G function of \(x^2\) type is \[\begin{equation} \int_0^{\infty} e^{-s\cdot x}G_{p,q}^{m,n}\left(\begin{array}{c} a_p\\ b_q \end{array}\bigg| wx^2\right)dx = \frac{1}{\sqrt{\pi}s}G_{p+2,q}^{m,n+2}\left(\begin{array}{c} 0,\frac{1}{2},a_p\\ b_q \end{array}\bigg| \frac{4w}{s^2}\right) \label{eq1}\tag{1} \end{equation}\] More explicitly, it is

\[\frac{1}{\sqrt{\pi}s}G_{p+2,q}^{m,n+2}\left(\begin{array}{c} \overbrace{\overbrace{0,\frac{1}{2},a_1,....,a_n}^{n+2\ components};a_{n+1},....a_{p}}^{p+2\ components} \\ b_q \end{array} \bigg| \frac{4w}{s^2}\right).\]

The cosine family of base functions belong to the general Meijer-G family:

\[\begin{equation} \cos(x) = \sqrt{\pi}G_{0,2}^{1,0}\left(\begin{array}{c} ;\\ 0;\frac{1}{2} \end{array}\bigg| \frac{x^2}{4}\right). \end{equation}\]

We can directly derive this from the definition by expanding the right hand side as follows.

\[\begin{equation} \begin{split} RHS &= \sqrt{\pi} (-\frac{1}{2\pi i})\int_{C}\frac{\prod_{j=1}^m\Gamma(b_j-s)\prod_{j=1}^n\Gamma(1-a_j+s)}{\prod_{j=m+1}^q\Gamma(1-b_{j}+s)\prod_{j=n+1}^q\Gamma(a_j-s)}z^sds\bigg|_{z=\frac{x^2}{4}}\\ &=\sqrt{\pi}(-\frac{1}{2\pi i})\int_C \frac{\Gamma(-s)}{\Gamma(1-\frac{1}{2}+s)}z^sds\bigg|_{z=\frac{x^2}{4}}=\sqrt{\pi}(-\frac{1}{2\pi i}) \underbrace{2\pi i\sum_{k=0}^{\infty}res_{k}}_{\text{residue theorem}} \end{split} \end{equation}\]

The gamma function \(\Gamma(z)\) has poles \(0,-1,-2,....\), and \(\frac{1}{\Gamma(z)}\) is entire since the gamma function has no zeros. Using the fact that only the poles from the numerator results in residues which contributes to the integration, and \(\text{res}_{z=n}\Gamma(-z)=\frac{(-1)^{n+1}}{n!}\) (the rest are scalar factors), we have \[\begin{equation} \begin{split} RHS &= \sqrt{\pi}(-\frac{1}{2\pi i})2\pi i\sum_{k=0}^{\infty}\frac{(-1)^{k+1}}{k!}\frac{1}{\Gamma(\frac{1}{2}+k)}(\frac{x^2}{4})^k=-\sum_{k=0}^{\infty}\frac{(-1)^{k+1}}{k!}x^{2k}\\&=\sum_{k=0}^{\infty}\frac{(-1)^{k}}{k!}x^{2k}=\cos(x) \end{split} \end{equation}\] where we have used the fact that \(\frac{k!\Gamma(\frac{1}{2}+k)4^k}{\sqrt{\pi}}=(2k)!\). Since \(k!2^k=2\cdot 4\cdot 6\cdots 2k\) and \(\frac{\Gamma(\frac{1}{2}+k)2^k}{\sqrt{\pi}}=1\cdot 3\cdot 5...\cdot (2k-1).\)

Schematically, the red contour of integration, \(\gamma\), can be extended to positive infinity on the right and the only contributions to the contour integral of \(\Gamma(-z)\) are the poles \(0,1,2,\cdots \in \mathbb{R}\).

2 The Laplace transform as a Meijer-G function

We will demonstrate the representations of the Laplace transform of the trigonometric (cosine) basis and Bessel base functions, which are commonly used to expand most “nice” functions.

The cosine base functions can be represented via the general Meijer-G function as follows.

\(\cos(x) = \sqrt{\pi}G_{0,2}^{1,0}\left(\begin{array}{c} ;\\ 0;\frac{1}{2} \end{array}\bigg| \frac{x^2}{4}\right)\).

As the general form of Meijer-G function is closed under Laplace transform (Equ 1), we have:

\[\begin{equation} \mathcal{L}(\cos(wx))(s)=\frac{s}{w^2+s^2} \end{equation}\]

\[\begin{equation} \begin{split} \mathcal{L}(\cos(wx))(s) &= \frac{1}{\sqrt{\pi}s}\sqrt{\pi}G_{2,2}^{1,2}\left(\begin{array}{c} 0,\frac{1}{2};\\ 0;\frac{1}{2} \end{array}\bigg| \frac{4w'}{s^2}\right)\bigg|_{w'=\frac{w^2}{4}}\\ &=\frac{1}{s}\left(\frac{1}{1+x}\right)\bigg|_{x=\frac{w^2}{s^2}}=\frac{1}{s}\cdot \frac{1}{1+\frac{w^2}{s^2}}=\frac{s}{w^2+s^2} \end{split} \end{equation}\]

\[\begin{equation} {}_2^1F(\frac{1+n}{2},\frac{2+n}{2},1+n,x)=\frac{2^n(1-\sqrt{1-x})^n}{\sqrt{1-x}x^n}, \forall n\in \mathbb{Z} \end{equation}\]

The Bessel J function belong to the general Meijer-G family with \(J_n(at) = G_{0,2}^{1,0}\left(\begin{array}{c} ;\\ \frac{n}{2};-\frac{n}{2} \end{array}\bigg|\frac{a^2t^2}{4}\right), -\frac{\pi}{2}\le arg(x)\equiv at \leq \frac{\pi}{2}\).

Using the general form of Meijer-G function being closed under Laplace transform (Equ 1) \[\begin{equation} \mathcal{L}(J_n(at))(s)=\frac{(-s+\sqrt{a^2+s^2})^n}{a^n\sqrt{s^2+a^2}} \end{equation}\]

Applying Equation (1), we use \(\mathcal{L}{J_n(at)}(s)=G_{2,2}^{1,2}\left(\begin{array}{c} 0,\frac{1}{2};\\ \frac{n}{2};-\frac{n}{2} \end{array}\bigg|\frac{a^2t^2}{s^2}\right)\) by referring to mathematica or we may refer to the special case for Meijer-G tabularized at wolfram website, \[\begin{equation} \begin{split} LHS&=\frac{1}{\sqrt{\pi}s}\cdot 2^{-n}\sqrt{\pi}(\frac{a^2}{s^2})^{n/2}{}_2^1F(\frac{1+n}{2},\frac{2+n}{2},1+n,-\frac{a^2}{s^2})\\&=2^{-n}s^{-1-n}a^n\frac{2^n(1-\sqrt{1-x})^n}{\sqrt{1-x}x^n}\bigg|_{x=-\frac{a^2}{s^2}}\\&=s^{n-1}\frac{1}{a^n}\frac{(-1+\sqrt{1+\frac{a^2}{s^2}})^n}{\sqrt{1+\frac{a^2}{s^2}}}=\frac{(-s+\sqrt{a^2+s^2})^n}{a^n\sqrt{s^2+a^2}} \end{split} \end{equation}\] where we made use the previous lemma.

3 Case studies with example animations

Let’s explore several animation examples showcasing the parallels between raw and Laplace-transformed signals by expanding (continuing) the domain of the original signal (\(\mathbb{R}^+\)) into the complex plane (\(\mathbb{C}\)) using the Meijer-G functions.

3.1 The cosine base function

The following Mathematica code illustrates the solution for the original case on the left.

gg[w_, x_] = Sqrt[Pi]*MeijerG[{{}, {}}, {{0}, {1/2}}, (w*x)^2/4]

MeijerGcos[var1_, viewops : OptionsPattern[]] := 
 Module[{plot, cosinepara}, 
  plot = Plot3D[Re[gg[var1, a + b*I]], {a, -10, 10}, {b, -2, 2}, 
    PlotRange -> Automatic, Mesh -> None, PlotPoints -> 500, 
    ColorFunction -> Function[{x, y, z}, Hue[Arg[gg[var1, x + I y]]]], 
    ColorFunctionScaling -> False, Axes -> True, 
    AxesStyle -> Arrowheads[0.01]];
  cosinepara = 
   ParametricPlot3D[{t, 0, Cos[var1*t]}, {t, -10, 10}, 
    PlotStyle -> {Black, Thickness[0.005]}, AxesLabel -> {x, y, z}];
  Show[cosinepara, plot, Axes -> True, 
   AxesLabel -> {Style["Time Ordered Signal - Classical t", Bold, 12],
      Style["Continued axis - y", Bold, 10], 
     Style["Real value", Bold, 16]}, 
   PlotRange -> {{-10, 10}, {-2, 2}, {-2, 2}}, Evaluate[viewops]]]
ani = Table[MeijerGcos[c], {c, 1, 5, 0.3}];
anifb = Join[ani, Reverse[ani]];
Export["C:\\Users\\user\\project\\cosinefb_test.gif", anifb, 
       "DisplayDurations" -> 0.2, 
       "AnimationReptitions" -> 20, 
       "AnimationDirection" -> ForwardBackward, ImageSize -> 800];

The corresponding Mathematica code for the transformed case on the right is below.

gtrans[w_, s_] = 1/s*MeijerG[{{0, 1/2}, {}}, {{0}, {1/2}}, w^2/(s^2)]

ani2 = Table[
   Plot3D[Abs[gtrans[c, a + b*I]], {a, -5, 5}, {b, -5, 5}, 
    PlotRange -> Automatic, Mesh -> None, PlotPoints -> 500, 
    PlotLabel -> Style["The Transformed Domain", Bold, 20], 
    AxesLabel -> {Style["Transformed x", Bold, 12], 
      Style["Transformed y", Bold, 12], Style["Intensity", Bold, 12]},
     ColorFunction -> 
     Function[{x, y, z}, Hue[Arg[gtrans[c, x + I y]]]], 
    ColorFunctionScaling -> False, Axes -> True, 
    AxesStyle -> Arrowheads[0.01]], {c, 1, 5, 0.3}];
ani2fb = Join[ani2, Reverse[ani2]];
Export["C:\\Users\\meijertransformed_domain1_forback.gif", ani2fb, 
  "DisplayDurations" -> 0.2, "AnimationReptitions" -> 20, 
  "AnimationDirection" -> ForwardBackward, ImageSize -> 800];

More succinctly, the left-to-right side correspondence (the left graph corresponds to the left equation and the right graph corresponds to the right equation) is shown below.

\[\cos(wx)=\sqrt{\pi}G_{0,2}^{1,0}\left(\begin{array}{c} ;\\ 0;\frac{1}{2} \end{array}\bigg| \frac{(wx)^2}{4}\right)\Bigg|_{Im(\cdot)=y=0} \Longleftrightarrow \begin{equation} \begin{split} \mathcal{L}(\cos(wx))(s) &= \frac{1}{\sqrt{\pi}s}\sqrt{\pi}G_{2,2}^{1,2}\left(\begin{array}{c} 0,\frac{1}{2};\\ 0;\frac{1}{2} \end{array}\bigg| \frac{4w'}{s^2}\right)\bigg|_{w'=\frac{w^2}{4}}\\ &=\frac{s}{w^2+s^2} \end{split} \end{equation}.\]

The time-ordered signal (event, i.e., the black curve - in this case \(\cos(wx)\)) is anchored on the xz plane, and the y-axis is a “continuation” for the signal to be defined on the complex plane. The perceived evolution is the changing value for w. Furthermore, the evaluated signal is complex-valued, and the z-axis resembles the real value so that it coincides with the original time-ordered signal, and the coloring resembles the phase where the (real part, phase information) is sufficient to resemble the whole functional landscape.

3.2 The Bessel J base function

The Bessel function example is similar compared to the previous cosine function example animation, but uses an appropriate Meijer-G function corresponding to the Bessel basis.

The general plot set up functionality for the Bessel J function of the first kind, a fixed \(n=1\), and varying scenarios is shown below.

# The original Domain
gb[n_, a_, t_] = MeijerG[{{}, {}}, {{n/2}, {-n/2}}, (a*t)^2/4]
MeijerGbessel[var1_, var2_, viewops : OptionsPattern[]] := 
 Module[{plot, besselpara}, 
  plot = Plot3D[Re[gb[var1, var2, a + b*I]], {a, 0, 10}, {b, -2, 2}, 
    PlotRange -> Automatic, Mesh -> None, PlotPoints -> 500, 
    ColorFunction -> 
     Function[{x, y, z}, Hue[Arg[gb[var1, var2, x + I y]]]], 
    ColorFunctionScaling -> False, Axes -> True, 
    AxesStyle -> Arrowheads[0.01]];
  besselpara = 
   ParametricPlot3D[{t, 0, BesselJ[var1, var2*t]}, {t, 0, 10}, 
    PlotStyle -> {Black, Thickness[0.01]}, AxesLabel -> {x, y, z}];
  Show[besselpara, plot, Axes -> True, 
   PlotLabel -> Style["The Original Domain", Bold, 30], 
   AxesLabel -> {Style["Time Ordered Signal - Classical t", Bold, 24],
      Style["Continued axis - y", Bold, 16], 
     Style["Real value", Bold, 20]}, 
   PlotRange -> {{0, 10}, {-2, 2}, {-2, 2}}, Evaluate[viewops]]]

Here are the specific Mathematica instructions to create the animations.

# The original domain
anib = Table[MeijerGbessel[1, c], {c, 1, 6, 1}];
anibfb = Join[anib, Reverse[anib]];
Export["C:\\Users\\user\\project\\meijerg_besselfb.gif", anibfb, "DisplayDurations" -> 0.2, 
  "AnimationReptitions" -> 20, 
  "AnimationDirection" -> ForwardBackward, ImageSize -> 800];
# The transformed domain
gbtrans[n_, a_, s_] = (-s + Sqrt[a^2 + s^2])^n/(a^n*Sqrt[s^2 + a^2])
anitb = Table[
   Plot3D[Abs[gbtrans[1, c, a + b*I]], {a, -5, 5}, {b, -5, 5}, 
    PlotRange -> {{-5, 5}, {-5, 5}, {-5, 5}}, Mesh -> None, 
    PlotPoints -> 500, 
    PlotLabel -> Style["The Transformed Domain", Bold, 30], 
    AxesLabel -> {Style["Transformed x", Bold, 20], 
      Style["Transformed y", Bold, 20], Style["Intensity", Bold, 20]},
     ColorFunction -> 
     Function[{x, y, z}, Hue[Arg[gbtrans[1, c, x + I y]]]], 
    ColorFunctionScaling -> False, Axes -> True, 
    AxesStyle -> Arrowheads[0.01]], {c, 1, 6, 1}];
anitbfb = Join[anitb, Reverse[anitb]];
Export["C:\\Users\\user\\project\\meijerbesseltransformed_forback.gif", anitbfb, 
  "DisplayDurations" -> 0.2, "AnimationReptitions" -> 20, 
  "AnimationDirection" -> ForwardBackward, ImageSize -> 800];

Here is the direct correspondence between the Bessel \(\left (J_n(at)\right )\) and the Meijer \(\left (G_{1,2}^{2,2}(\cdot | \cdot)\right )\) functions.

\[J_n(at) = G_{0,2}^{1,0}\left(\begin{array}{c} ;\\ \frac{n}{2};-\frac{n}{2} \end{array}\bigg|\frac{a^2t^2}{4}\right)\Bigg|_{Im(\cdot)=y=0}, \frac{-\pi}{2}\le argx\leq \frac{\pi}{2} \Longleftrightarrow \mathcal{L}{J_n(at)}(s)=G_{1,2}^{2,2}\left(\begin{array}{c} 0,\frac{1}{2};\\ \frac{n}{2};-\frac{n}{2} \end{array}\bigg|\frac{a^2t^2}{s^2}\right)\]

Specifically, for \(n=1\),

\[J_1(at) = G_{0,2}^{1,0}\left(\begin{array}{c} ;\\ \frac{1}{2};-\frac{1}{2} \end{array}\bigg|\frac{a^2t^2}{4}\right)\Bigg|_{Im(\cdot)=y=0}, \frac{-\pi}{2}\le arg(x)\equiv at \leq \frac{\pi}{2} \Longleftrightarrow \mathcal{L}{J_1(at)}(s)=G_{1,2}^{2,2}\left(\begin{array}{c} 0,\frac{1}{2};\\ \frac{1}{2};-\frac{1}{2} \end{array}\bigg|\frac{a^2t^2}{s^2}\right)\]

Here is an example using a fixed \(a=1\) and varying \(n\) arguments.

# The original domain
ani2b = Table[MeijerGbessel[c, 1], {c, 1, 6, 1}];
ani2bfb = Join[ani2b, Reverse[ani2b]];
Export["C:\\Users\\user\\project\\besselaltfb.gif", ani2bfb, 
       "DisplayDurations" -> 0.2, 
       "AnimationReptitions" -> 20,
       "AnimationDirection" -> ForwardBackward, ImageSize -> 800];
# The transformed domain
anitb = Table[
   Plot3D[Abs[gbtrans[c, 1, a + b*I]], {a, -5, 5}, {b, -5, 5}, 
    PlotRange -> {{-5, 5}, {-5, 5}, {-5, 5}}, Mesh -> None, 
    PlotPoints -> 500, 
    PlotLabel -> Style["The Transformed Domain", Bold, 30], 
    AxesLabel -> {Style["Transformed x", Bold, 20], 
      Style["Transformed y", Bold, 20], Style["Intensity", Bold, 20]},
     ColorFunction -> 
     Function[{x, y, z}, Hue[Arg[gbtrans[c, 1, x + I y]]]], 
    ColorFunctionScaling -> False, Axes -> True, 
    AxesStyle -> Arrowheads[0.01]], {c, 1, 6, 1}];
anitbfb = Join[anitb, Reverse[anitb]];
Export["C:\\Users\\user\\project\\meijerbesseltransformedvaryn_forback.gif", anitbfb, 
  "DisplayDurations" -> 0.2, "AnimationReptitions" -> 20, 
  "AnimationDirection" -> ForwardBackward, ImageSize -> 800];

The correspondence here is

\[J_n(t) = G_{0,2}^{1,0}\left(\begin{array}{c} ;\\ \frac{n}{2};-\frac{n}{2} \end{array}\bigg|\frac{t^2}{4}\right)\Bigg|_{Im(\cdot)=y=0}, \frac{-\pi}{2}\le arg(x)\equiv t \leq \frac{\pi}{2} \Longleftrightarrow \mathcal{L}{J_n(t)}(s)=G_{1,2}^{2,2}\left(\begin{array}{c} 0,\frac{1}{2};\\ \frac{n}{2};-\frac{n}{2} \end{array}\bigg|\frac{t^2}{s^2}\right)\]

4 Python implementation

We can use the python-implementation in the symbolic computing package sympy to demonstrate the symbolic and numerical computisng of the Meijer-G function.

# install.packages("reticulate")
library(reticulate)
library(plotly)
# specify the path of the Python version that you want to use
#py_path = "C:/Users/Dinov/Anaconda3/"  # manual
py_path = Sys.which("python3")       # automated
# use_python(py_path, required = T)
Sys.setenv(RETICULATE_PYTHON = "C:/Users/Dinov/Anaconda3/")
sys <- import("sys", convert = TRUE)

Here is an example passing Meijer-G function parameters as four separate vectors.

from sympy.functions import meijerg
from sympy.abc import x, a
from sympy.core.containers import Tuple
from sympy import pprint  # pretty print
import mpmath             # Meijer-G function
# import sympy
import math 

# Symbolic Meijer-G function representaiton
pprint(meijerg((1, 2), (a, 4), (5,), [], x), use_unicode=False)

# Retrieval of the Meijer-G function parameters
# Vectors of length zero and one also have to be passed as iterables. 
# The parameters need not be constants, but if they depend on the argument,
# then not much implemented functionality should be expected.
# All the subvectors of parameters are available:
##  __1, 2 /1, 2  a, 4 |  \
## /__     |           | x|
## \_|4, 1 \ 5         |  /
g = meijerg([1], [2], [3], [4], x)

print("Meijer-G Function form: ")
## Meijer-G Function form:
pprint(g, use_unicode=False)
##  __1, 1 /1  2 |  \
## /__     |     | x|
## \_|2, 2 \3  4 |  /
print("Meijer-G Function argument: an: ")
## Meijer-G Function argument: an:
pprint(g.an, use_unicode=False)
## (1,)
print("Meijer-G Function argument: ap: ")
## Meijer-G Function argument: ap:
pprint(g.ap, use_unicode=False)
## (1, 2)
print("Meijer-G Function argument: aother: ")
## Meijer-G Function argument: aother:
pprint(g.aother, use_unicode=False)
## (2,)
print("Meijer-G Function argument: bm: ")
## Meijer-G Function argument: bm:
pprint(g.bm, use_unicode=False)
## (3,)
print("Meijer-G Function argument: bq: ")
## Meijer-G Function argument: bq:
pprint(g.bq, use_unicode=False)
## (3, 4)
print("Meijer-G Function argument: bother: ")
## Meijer-G Function argument: bother:
pprint(g.bother, use_unicode=False)

# Meijer-G function generalizes many other named functions.
# We can use 'expand_func' or 'hyperexpand' to rewrite the
# Meijer-G function as other special functions, e.g., 
## (4,)
from sympy import expand_func, S
from sympy.simplify.hyperexpand import hyperexpand

print("Let's expand a couple of Meijer-G Functions:\n")
## Let's expand a couple of Meijer-G Functions:
print("Exponential function <== ==> Meijer-G([[],[]], [[0],[]], -x): ")
## Exponential function <== ==> Meijer-G([[],[]], [[0],[]], -x):
expand_func(meijerg([[],[]], [[0],[]], -x))              # exp(x)
## exp(x)
print("Trigonometric (sine) function <== ==> Meijer-G([[],[]], [[S(1)/2],[0]], (x/2)**2)): ")
## Trigonometric (sine) function <== ==> Meijer-G([[],[]], [[S(1)/2],[0]], (x/2)**2)):
hyperexpand(meijerg([[],[]], [[S(1)/2],[0]], (x/2)**2))  # sin(x)/sqrt(pi)

# Numerical Meijer-G function evaluation
## Set parameters as 4 separate vectors
#####     mpmath.meijerg([[], [-1/(k-1)], [0, 0], []], -p/k2)
## Set parameters as a tensor, i.e., as two nested vectors
#####     meijerg([(1, 2), (3, 4)], ([5], Tuple()), x)
## sin(x)/sqrt(pi)
p = 1
k = 0.1
k2 = 2

a1 = 0
a2 = 0

b1 = 0
b2 = 0.5

meijerGFunctionValue = mpmath.meijerg([[],[]], [[b1],[b2]], (p/2)**2)
cosineFunctionValue = (math.cos(p)/math.sqrt(math.pi))
# print(mpmath.meijerg([[], [-1/(k-1)], [0, 0], []], -p/k2))
print("Meijer-G Function value: ", meijerGFunctionValue, " <== ? ==> Cosine function value: ", cosineFunctionValue)

# See other examples here:
# http://lidavidm.github.io/sympy/_modules/sympy/functions/special/hyper.html
## Meijer-G Function value:  0.304832932937638  <== ? ==> Cosine function value:  0.30483293293763825
# import the necessary python packages and sub-packages
import sympy
import math 
import mpmath
from sympy import pprint

p = 1
k = 0.1
k2 = 2
print("Evaluating the Meijer-G Function (Complex number): ", sympy.functions.special.hyper.meijerg([], [-1/(k-1)], [0, 0], [], -p/k2).evalf())

# print(mpmath.meijerg([[], [-1/(k-1)], [0, 0], []], -p/k2))
## Evaluating the Meijer-G Function (Complex number):  -0.777317343722903 - 3.11039165942594*I
print("Meijer-G Function value: ", mpmath.meijerg([[],[]], [[0],[0.5]], (1/2)**2), " <== ? ==> Cosine function value: ", (math.cos(1)/math.sqrt(math.pi)))
## Meijer-G Function value:  0.304832932937638  <== ? ==> Cosine function value:  0.30483293293763825

5 References

[1] Alaa, Ahmed M. and van der Schaar, Mihaela. (2019) “Demystifying black-box models with symbolic metamodels.” Advances in Neural Information Processing Systems (NeurIPS 2019), 32(6036).

[2] Beals, Richard, and Jacek Szmigielski. “Meijer-G-functions: a gentle introduction.” Notices of the AMS 60.7 (2013): 866-872.

[3] Olver, F.W.J., Lozier, D.W., Boisvert, R.F., Clark, C.W. (2010) NIST Handbook of Mathematical Functions, ISBN 9780521192255, Cambridge University Press.

[4] Coelho, C. A., & Arnold, B. C. (2019). Finite form representations for Meijer-G and fox H functions. Cham, Switzerland: Springer International Publishing.

[5] Dinov, ID and Velev, MV. (2021) Data Science: Time Complexity, Inferential Uncertainty, and Spacekime Analytics, De Gruyter, STEM Series, ISBN 978-3-11-069780-3, DOI 10.1515/9783110697827.

SOCR Resource Visitor number Web Analytics SOCR Email