Skip to content

functions

parsa roshanak edited this page Jul 4, 2025 · 1 revision

functions – Special Functions & Utilities

Overview

The functions module provides a collection of mathematical utilities and special functions commonly used in fractional calculus, numerical methods, and applied analysis. These include the Pochhammer symbol, the Beta function, and the Mittag-Leffler function, each implemented to support both symbolic and numerical workflows. All functions are compatible with NumPy arrays and can be directly imported for use in custom workflows.

Import example:

from differintP.functions import poch, Beta, MittagLeffler

Available Functions

poch – Pochhammer Symbol

Returns the Pochhammer symbol $(a)_n$, also known as the rising factorial. Supports real or complex $a$ and nonnegative real $n$. Handles integer and non-integer cases, and automatically applies analytic extensions as needed.

Definition: $(a)_n = a(a+1)\ldots(a+n-1) = \frac{\Gamma(a+n)}{\Gamma(a)}$

Function Signature:

poch(a, n)

Parameters:

  • a (float or complex): Base value.
  • n (float or int): Nonnegative integer or real exponent.

Returns:

  • result (float or complex): The computed Pochhammer symbol.

Notes:

  • Uses explicit product for integer $n$.
  • Falls back to the Gamma function for general real/complex arguments.
  • Special handling for negative or non-integer values, as detailed in MathWorks documentation.

Beta – Beta Function

Computes the Euler Beta function for arbitrary (real or complex) inputs, based on the definition involving the Gamma function:

Definition:

$$ \mathrm{Beta}(x, y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)} $$

Function Signature:

Beta(x, y)

Parameters:

  • x, y (int, float, np.ndarray, or complex): Arguments to the Beta function.

Returns:

  • result: The computed Beta function value, matching the type/shape of the inputs.

MittagLeffler – Mittag-Leffler Function

Computes the (generalized) Mittag-Leffler function $E_{a,b}(x)$, a crucial tool in fractional calculus. The function tries to detect and use special cases for efficiency, but falls back to a direct series expansion otherwise.

Definition:

$$ E_{a,b}(x) = \sum_{k=0}^\infty \frac{x^k}{\Gamma(a k + b)} $$

Function Signature:

MittagLeffler(a, b, x, num_terms=50, ignore_special_cases=False)

Parameters:

  • a (float): First parameter of the function.
  • b (float): Second parameter.
  • x (np.ndarray or float): Values to evaluate at.
  • num_terms (int, optional): Number of series terms to use if no special case applies. Default is 50.
  • ignore_special_cases (bool, optional): If True, always uses the series expansion. Default is False.

Returns:

  • result (np.ndarray): Computed values of the Mittag-Leffler function.

Notes:

  • Special cases (e.g., E_{1,1}(x) = exp(x), E_{2,1}(x) = cosh(sqrt(x))) are handled automatically unless overridden.
  • For large num_terms, computation may be slow.

Example Usage

import numpy as np
from differintP.functions import poch, Beta, MittagLeffler

# Pochhammer symbol
val = poch(2.5, 4)  # returns (2.5)_4

# Beta function
B = Beta(1.5, 2.2)

# Mittag-Leffler function on an array
x = np.linspace(0, 2, 10)
ML = MittagLeffler(1.5, 1, x)

Notes

  • All functions are implemented with compatibility for real, complex, and vectorized (NumPy array) arguments.
  • Additional special functions may be added in future versions; see the Changelog for updates.

Clone this wiki locally