special_functions package

Submodules

special_functions.besselh module

special_functions.besselh.py_besselh(nu, k, z, n=0)

Wrapper for besselh().

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • k (int) – Can be 1 or 2 and sets the type of Hankel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

special_functions.besseli module

special_functions.besseli.py_besseli(nu, z, n=0)

Wrapper for besseli().

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

special_functions.besselj module

special_functions.besselj.py_besselj(nu, z, n=0)

Wrapper for besselj().

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

special_functions.besselk module

special_functions.besselk.py_besselk(nu, z, n=0)

Wrapper for besselk().

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

special_functions.bessely module

special_functions.bessely.py_bessely(nu, z, n=0)

Wrapper for bessely().

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

special_functions.cbesselh module

special_functions.cbesselh.py_cbesselh(nu, k, z, n=0)

Wrapper for cbesselh().

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • k (int) – Can be 1 or 2 and sets the type of Hankel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

special_functions.cbesseli module

special_functions.cbesseli.py_cbesseli(nu, z, n=0)

Wrapper for cbesseli().

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

special_functions.cbesselj module

special_functions.cbesselj.py_cbesselj(nu, z, n=0)

Wrapper for cbesselj().

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

special_functions.cbesselk module

special_functions.cbesselk.py_cbesselk(nu, z, n=0)

Wrapper for cbesselk().

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

special_functions.cbessely module

special_functions.cbessely.py_cbessely(nu, z, n=0)

Wrapper for cbessely().

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

special_functions.cython_wrappers module

special_functions.cython_wrappers.besselh(nu, k, z, n=0)

Computes Bessel function or its derivative, \(\partial H^{(1)}_{\nu}(z) / \partial z\) and \(\partial H^{(2)}_{\nu}(z) / \partial z\).

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • k (int) – Can be 1 or 2 and sets the type of Hankel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

Example:

The two example computes Bessel function \(H^{(k)}_{\nu}(z)\) and its first and second derivatives for \(k = 1, 2\). Note, this function uses the global lock interpreter (gil).

The example below demonstrates real argument and \(k = 1\). Note that the output variables are compelx, despite the input z is real.

>>> # import module in a *.py file
>>> from special_functions import besselh

>>> nu = 2.5
>>> k = 1
>>> z = 2.0

>>> d0h = besselh(nu, k, z)       # no derivative
>>> d1h = besselh(nu, k, z, 1)    # 1st derivative
>>> d2h = besselh(nu, k, z, 2)    # 2nd derivative

The example below demonstrates complex argument and \(k = 2\).

>>> nu = 2.5
>>> k = 2
>>> z = 2.0+1.0j

>>> d0h = besselh(nu, k, z)       # no derivative
>>> d1h = besselh(nu, k, z, 1)    # 1st derivative
>>> d2h = besselh(nu, k, z, 2)    # 2nd derivative
special_functions.cython_wrappers.besseli(nu, z, n=0)

Computes Bessel function or its derivative, \(\partial I_{\nu}(z) / \partial z\).

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

Example:

The two example computes Bessel function \(I_{\nu}(z)\) and its first and second derivatives. Note, this function uses the global lock interpreter (gil).

The example below demonstrates real argument.

>>> # import module in a *.py file
>>> from special_functions import besseli

>>> nu = 2.5
>>> z = 2.0

>>> d0i = besseli(nu, z)       # no derivative
>>> d1i = besseli(nu, z, 1)    # 1st derivative
>>> d2i = besseli(nu, z, 2)    # 2nd derivative

The example below demonstrates complex argument.

>>> nu = 2.5
>>> z = 2.0+1.0j

>>> d0i = besseli(nu, z)       # no derivative
>>> d1i = besseli(nu, z, 1)    # 1st derivative
>>> d2i = besseli(nu, z, 2)    # 2nd derivative
special_functions.cython_wrappers.besselj(nu, z, n=0)

Computes Bessel function or its derivative, \(\partial J_{\nu}(z) / \partial z\).

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

Example:

The two example computes Bessel function \(J_{\nu}(z)\) and its first and second derivatives. Note, this function uses the global lock interpreter (gil).

The example below demonstrates real argument.

>>> # import module in a *.py file
>>> from special_functions import besselj

>>> nu = 2.5
>>> z = 2.0

>>> d0j = besselj(nu, z)       # no derivative
>>> d1j = besselj(nu, z, 1)    # 1st derivative
>>> d2j = besselj(nu, z, 2)    # 2nd derivative

The example below demonstrates complex argument.

>>> nu = 2.5
>>> z = 2.0+1.0j

>>> d0j = besselj(nu, z)       # no derivative
>>> d1j = besselj(nu, z, 1)    # 1st derivative
>>> d2j = besselj(nu, z, 2)    # 2nd derivative
special_functions.cython_wrappers.besselk(nu, z, n=0)

Computes Bessel function or its derivative, \(\partial K_{\nu}(z) / \partial z\).

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

Example:

The two example computes Bessel function \(K_{\nu}(z)\) and its first and second derivatives. Note, this function uses the global lock interpreter (gil).

The example below demonstrates real argument.

>>> # import module in a *.py file
>>> from special_functions import besselk

>>> nu = 2.5
>>> z = 2.0

>>> d0k = besselk(nu, z)       # no derivative
>>> d1k = besselk(nu, z, 1)    # 1st derivative
>>> d2k = besselk(nu, z, 2)    # 2nd derivative

The example below demonstrates complex argument.

>>> nu = 2.5
>>> z = 2.0+1.0j

>>> d0k = bessely(nu, k)       # no derivative
>>> d1k = bessely(nu, k, 1)    # 1st derivative
>>> d2k = bessely(nu, k, 2)    # 2nd derivative
special_functions.cython_wrappers.bessely(nu, z, n=0)

Computes Bessel function or its derivative, \(\partial Y_{\nu}(z) / \partial z\).

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

Example:

The two example computes Bessel function \(Y_{\nu}(z)\) and its first and second derivatives. Note, this function uses the global lock interpreter (gil).

The example below demonstrates real argument.

>>> # import module in a *.py file
>>> from special_functions import bessely

>>> nu = 2.5
>>> z = 2.0

>>> d0y = bessely(nu, z)       # no derivative
>>> d1y = bessely(nu, z, 1)    # 1st derivative
>>> d2y = bessely(nu, z, 2)    # 2nd derivative

The example below demonstrates complex argument.

>>> nu = 2.5
>>> z = 2.0+1.0j

>>> d0y = bessely(nu, z)       # no derivative
>>> d1y = bessely(nu, z, 1)    # 1st derivative
>>> d2y = bessely(nu, z, 2)    # 2nd derivative
special_functions.cython_wrappers.lngamma(x)

Computes the natural logarithm of Gamma function. This function is a wrapper for gamma function in cephes library.

Parameters:

x (double) – Input argument of function.

Returns:

Value of the function.

Return type:

double

Example:

This example computes \(\ln \Gamma(x)\) for real argument. Note, this function uses python’s global lock interpreter (gil).

>>> # cimport module in a *.py file
>>> from special_functions import lngamma

>>> x = 2.0
>>> y = lngamma(x)

See also

  • lngamma(): cython wrapper to this function.

special_functions.lngamma module

special_functions.lngamma.py_lngamma(x)

Python wrapper for lngamma() function.

Module contents

special_functions.besselh(nu, k, z, n=0)

Computes Bessel function or its derivative, \(\partial H^{(1)}_{\nu}(z) / \partial z\) and \(\partial H^{(2)}_{\nu}(z) / \partial z\).

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • k (int) – Can be 1 or 2 and sets the type of Hankel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

Example:

The two example computes Bessel function \(H^{(k)}_{\nu}(z)\) and its first and second derivatives for \(k = 1, 2\). Note, this function uses the global lock interpreter (gil).

The example below demonstrates real argument and \(k = 1\). Note that the output variables are compelx, despite the input z is real.

>>> # import module in a *.py file
>>> from special_functions import besselh

>>> nu = 2.5
>>> k = 1
>>> z = 2.0

>>> d0h = besselh(nu, k, z)       # no derivative
>>> d1h = besselh(nu, k, z, 1)    # 1st derivative
>>> d2h = besselh(nu, k, z, 2)    # 2nd derivative

The example below demonstrates complex argument and \(k = 2\).

>>> nu = 2.5
>>> k = 2
>>> z = 2.0+1.0j

>>> d0h = besselh(nu, k, z)       # no derivative
>>> d1h = besselh(nu, k, z, 1)    # 1st derivative
>>> d2h = besselh(nu, k, z, 2)    # 2nd derivative
special_functions.besseli(nu, z, n=0)

Computes Bessel function or its derivative, \(\partial I_{\nu}(z) / \partial z\).

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

Example:

The two example computes Bessel function \(I_{\nu}(z)\) and its first and second derivatives. Note, this function uses the global lock interpreter (gil).

The example below demonstrates real argument.

>>> # import module in a *.py file
>>> from special_functions import besseli

>>> nu = 2.5
>>> z = 2.0

>>> d0i = besseli(nu, z)       # no derivative
>>> d1i = besseli(nu, z, 1)    # 1st derivative
>>> d2i = besseli(nu, z, 2)    # 2nd derivative

The example below demonstrates complex argument.

>>> nu = 2.5
>>> z = 2.0+1.0j

>>> d0i = besseli(nu, z)       # no derivative
>>> d1i = besseli(nu, z, 1)    # 1st derivative
>>> d2i = besseli(nu, z, 2)    # 2nd derivative
special_functions.besselj(nu, z, n=0)

Computes Bessel function or its derivative, \(\partial J_{\nu}(z) / \partial z\).

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

Example:

The two example computes Bessel function \(J_{\nu}(z)\) and its first and second derivatives. Note, this function uses the global lock interpreter (gil).

The example below demonstrates real argument.

>>> # import module in a *.py file
>>> from special_functions import besselj

>>> nu = 2.5
>>> z = 2.0

>>> d0j = besselj(nu, z)       # no derivative
>>> d1j = besselj(nu, z, 1)    # 1st derivative
>>> d2j = besselj(nu, z, 2)    # 2nd derivative

The example below demonstrates complex argument.

>>> nu = 2.5
>>> z = 2.0+1.0j

>>> d0j = besselj(nu, z)       # no derivative
>>> d1j = besselj(nu, z, 1)    # 1st derivative
>>> d2j = besselj(nu, z, 2)    # 2nd derivative
special_functions.besselk(nu, z, n=0)

Computes Bessel function or its derivative, \(\partial K_{\nu}(z) / \partial z\).

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

Example:

The two example computes Bessel function \(K_{\nu}(z)\) and its first and second derivatives. Note, this function uses the global lock interpreter (gil).

The example below demonstrates real argument.

>>> # import module in a *.py file
>>> from special_functions import besselk

>>> nu = 2.5
>>> z = 2.0

>>> d0k = besselk(nu, z)       # no derivative
>>> d1k = besselk(nu, z, 1)    # 1st derivative
>>> d2k = besselk(nu, z, 2)    # 2nd derivative

The example below demonstrates complex argument.

>>> nu = 2.5
>>> z = 2.0+1.0j

>>> d0k = bessely(nu, k)       # no derivative
>>> d1k = bessely(nu, k, 1)    # 1st derivative
>>> d2k = bessely(nu, k, 2)    # 2nd derivative
special_functions.bessely(nu, z, n=0)

Computes Bessel function or its derivative, \(\partial Y_{\nu}(z) / \partial z\).

Parameters:
  • nu (double) – Parameter \(\nu\) of Bessel function.

  • z (double or double complex) – Input argument of function.

  • n (int) – Order of the derivative of function. Zero means no derivative.

Returns:

Value of Bessel function.

Return type:

double or double complex

Example:

The two example computes Bessel function \(Y_{\nu}(z)\) and its first and second derivatives. Note, this function uses the global lock interpreter (gil).

The example below demonstrates real argument.

>>> # import module in a *.py file
>>> from special_functions import bessely

>>> nu = 2.5
>>> z = 2.0

>>> d0y = bessely(nu, z)       # no derivative
>>> d1y = bessely(nu, z, 1)    # 1st derivative
>>> d2y = bessely(nu, z, 2)    # 2nd derivative

The example below demonstrates complex argument.

>>> nu = 2.5
>>> z = 2.0+1.0j

>>> d0y = bessely(nu, z)       # no derivative
>>> d1y = bessely(nu, z, 1)    # 1st derivative
>>> d2y = bessely(nu, z, 2)    # 2nd derivative
special_functions.lngamma(x)

Computes the natural logarithm of Gamma function. This function is a wrapper for gamma function in cephes library.

Parameters:

x (double) – Input argument of function.

Returns:

Value of the function.

Return type:

double

Example:

This example computes \(\ln \Gamma(x)\) for real argument. Note, this function uses python’s global lock interpreter (gil).

>>> # cimport module in a *.py file
>>> from special_functions import lngamma

>>> x = 2.0
>>> y = lngamma(x)

See also

  • lngamma(): cython wrapper to this function.