Integrals#

dispersionrelations.integrals.integrate_gl(function: callable, a: float, b: float, order: int = 100, split_n: int = 3)[source]#

Gauss–Legendre integration.

Parameters:
  • function (callable) – A complex function of a single variable.

  • a (float, complex) – Lower boundary of the integral.

  • b (float, complex) – Upper boundary of the integral.

  • order (int) – Quadrature order.

  • split_n (int) – Number of subintervals of the same length \([a,x], [x,y], ... [z,b]\).

Returns:

I – Integral \(I = \int_a^b f(x) \mathrm{d}x\).

Return type:

float, complex

dispersionrelations.integrals.residue(function: callable, z0: complex, radius: float = 0.01, order: int = 100, split_n: int = 3)[source]#

Residue of a complex function.

Parameters:
  • function (callable) – Complex function of a single variable.

  • z0 (complex) – Complex point to compute the residue at.

  • radius (float) – Radius of the circular integral around \(z_0\).

  • order (int) – Quadrature order.

  • split_n (int) – Number of sections of the circle.

Returns:

r – Residue, computed via \(r = \frac{1}{2\pi i}\oint_{\mathcal{C}_{z_0}} f(z) \mathrm{d}z\).

Return type:

complex

Examples

>>> from dispersionrelations import integrals
>>> print(integrals.residue(lambda z: 13/(z-2-2j), z0=2+2j))
np.complex128(13.000000000000007+4.3193350746692004e-15j)
class dispersionrelations.integrals.SimplePoleMonomial(n: float)[source]#

Bases: object

Cauchy integral of a shifted monomial

Parameters:

n (float) – Power of the shifted monomial (can be an integer or a half-integer).

Raises:

NotImplementedError – Any input n other than an integer or a half-integer triggers an error.

__call__(s, s0, a, b)[source]#

Definite integral

\[\mathcal{I}_{n}(s,s_0;a,b) = \int_a^b \frac{(x-s_0)^n \, \mathrm{d}x}{x-s}.\]
Parameters:
  • s (float) – Location of the Cauchy singularity.

  • s0 (float) – Shift of the monomial in the integrand.

  • a (float) – Lower integration boundary.

  • b (float) – Upper integration boundary.

Notes

Several special cases are defined separately,

Case 1. \(n = 0\),

\[\mathcal{I}_{0}(s, s_0; a, b) = \log(x-s) \bigg|_a^b \, .\]

Case 2. \(n\) is a positive integer,

\[\mathcal{I}_{n \in \mathbb{Z}^+}(s, s_0; a, b) = (s-s_0)^n \left( \mathcal{I}_{0}(s, s_0; a, b) + \sum_{k=1}^{n} \frac{1}{k}\frac{(x-s_0)^{k}}{(s-s_0)^{k}} \bigg|_a^b \right) \, .\]

Case 3. \(n = -\bar{n}\) is a negative integer,

\[\mathcal{I}_{-\bar{n}}(s, s_0; a, b) = (s-s_0)^{-\bar{n}} \left( \log\left(\frac{x-s}{x-s_0}\right) + \sum_{k=1}^{\bar{n}-1} \frac{1}{k} \frac{(s-s_0)^{k}}{(x-s_0)^{k}} \right)\bigg|_{a}^{b} \, .\]

Case 4. \(n=\frac{m}{2}\) is a positive half-integer,

\[\mathcal{I}_{m/2}(s, s_0; a, b) = \sqrt{s-s_0}^{m} \left( \log\left(\frac{\sqrt{s-s_0}-\sqrt{x-s_0}}{\sqrt{s-s_0}+\sqrt{x-s_0}}\right) + \sum_{k=1}^{(m+1)/2} \frac{2}{2k-1} \frac{\sqrt{x-s_0}^{2k-1}}{\sqrt{s-s_0}^{2k-1}} \right)\bigg|_a^b \, .\]

Case 5. \(n=-\frac{\bar{m}}{2}\) is a negative half-integer,

\[\mathcal{I}_{-\bar{m}/2}(s, s_0; a, b) \frac{1}{\sqrt{s-s_0}^{\bar{m}}} \left( \log\left(\frac{\sqrt{s-s_0}-\sqrt{x-s_0}}{\sqrt{s-s_0}+\sqrt{x-s_0}}\right) + \sum_{k=1}^{(\bar{m}-1)/2} \frac{2}{2k-1} \frac{\sqrt{s-s_0}^{2k-1}}{\sqrt{x-s_0}^{2k-1}} \right)\bigg|_a^b \, .\]
class dispersionrelations.integrals.DispersionIntegralRHC(integrand: callable, threshold: float, infinity: float = 1000000.0, integration_split_points: list[float] = [2, 5, 10, 50, 100], integration_order: int = 100, subtraction_point: float = 0, subtraction_constants: list[float] = [0])[source]#

Bases: object

Dispersion integral along the right-hand cut.

Parameters:
  • integrand (callable) – Integrand along the RHC.

  • threshold (float) – Lower boundary of the integral.

  • infinity (float, optional) – Upper boundary of the integral in the units of threshold.

  • integration_split_points (array_like, optional) – Integration split points in the units of threshold.

  • integration_order (int, optional) – Gauss–Legendre quadrature order.

  • subtraction_point (float, optional) – Point \(s_0\) of subtraction. Needs to be below the threshold.

  • subtraction_constants (array_like, optional) – Array of \(f_i\) subtraction constants. Defines subtraction level \(n\).

Notes

The integral is defined as

\[F(s) = \sum_{i=0}^{n-1}f_i (s-s_0)^i + \frac{(s-s_0)^n}{\pi}\int_{s_{thr}}^{\infty}\frac{f(x) \, dx}{(x-s_0)^n(x-s-i\epsilon)},\]

where \(s_0\) is the subtraction point, \(f_i\) are the subtraction constants, \(n\) is the subtraction level, and \(f\) is the integrand.

__call__(s)[source]#
Parameters:

s (array_like) – Four-momentum squared of the propagating particle.

Returns:

F – The same shape as input s.

Return type:

array_like

class dispersionrelations.integrals.OmnesFunction(integrand: callable, threshold: float, infinity: float = 1000000.0, integration_split_points: list[float] = [2, 5, 10, 50, 100], integration_order: int = 100, subtraction_point: float = 0, subtraction_constants: list[float] = [0])[source]#

Bases: DispersionIntegralRHC

Omnès–Muskhelishvili solution [12].

Parameters:
  • integrand (callable) – Integrand along the RHC.

  • threshold (float) – Lower boundary of the integral.

  • infinity (float, optional) – Upper boundary of the integral in the units of threshold.

  • integration_split_points (array_like, optional) – Integration split points in the units of threshold.

  • integration_order (int, optional) – Gauss–Legendre quadrature order.

  • subtraction_point (float, optional) – Point \(s_0\) of subtraction.

  • subtraction_constants (array_like, optional) – Array of \(f_i\) subtraction constants. Defines subtraction level \(n\).

Notes

The function is defined as

\[\Omega(s) = \exp\left(\sum_{i=0}^{n-1}f_i (s-s_0)^i + \frac{(s-s_0)^n}{\pi}\int_{s_{thr}}^{\infty}\frac{\delta(x) \, dx}{(x-s_0)^n(x-s-i\epsilon)}\right),\]

where \(s_0\) is the subtraction point, \(f_i\) are the subtraction constants for \(\log\Omega\), \(n\) is the subtraction level, and \(\delta\) is the input phase, passed as integrand.

__call__(s)[source]#
Parameters:

s (array_like) – Four-momentum squared of the propagating particle.

Returns:

Ω – The same shape as input s.

Return type:

array_like