Continuous Distribution Measures (Moments & Cumulants)

This module provides functions to compute moments and cumulants from continuous probability distribution functions.

moment_generating_function(generating_function, symbols, symbols_in_result)

Computes the moment generating function of a probability distribution. It is defined as:

\[F[f(\mathbf{x})](\mathbf{t}) = \int e^{<\mathbf{x}, \mathbf{t}>} f(x)\; dx\]
Parameters
  • generating_function – sympy expression

  • symbols – a sequence of symbols forming the vector x

  • symbols_in_result – a sequence forming the vector t

Returns

an expression that depends now on symbols_in_result (symbols have been integrated out)

Return type

transformation result F

Note

This function uses sympys symbolic integration mechanism, which may not work or take a large amount of time for some functions. Therefore this routine does some transformations/simplifications on the function first, which are taylored to expressions of the form exp(polynomial) i.e. Maxwellian distributions, so that these kinds of functions can be integrated quickly.

cumulant_generating_function(func, symbols, symbols_in_result)

Computes cumulant generating func, which is the logarithm of the moment generating func. For parameter description see moment_generating_function().

continuous_moment(func, moment, symbols=None)

Computes moment of given function.

Parameters
  • func – function to compute moments of

  • moment – tuple or polynomial describing the moment

  • symbols – if moment is given as polynomial, pass the moment symbols, i.e. the dof of the polynomial

continuous_cumulant(func, moment, symbols=None)

Computes cumulant of continuous function.

for parameter description see continuous_moment()