# Averaging integrals¶

escape.core.average.gamma(name, variable_obj x, mean, sigma)

Gamma distribution functor of the following form: $$1/\theta\exp((k-1)\log(t)-x/\theta-\log(\Gamma(k)))$$, where $$\theta=\sigma^2x_0$$, $$k=x_0/\theta$$, $$t=x/\theta$$.

Parameters
x: variable_obj

Variable object

mean: variable_obj, parameter_obj or numeric

Mean value

sigma: functor_obj, parameter_obj or numeric

Sigma defines width of the distribution function

Returns

object of type functor_obj

escape.core.average.schulz(name, variable_obj x, mean, sigma)

Schulz-Zimm distribution functor of the following form: $$t/x\exp((k-1)\log(t)-t-\log(\Gamma(k)))$$, where $$k=1/\sigma^2$$, $$t=kx/x_0$$.

Parameters
x: variable_obj

Variable object

mean: variable_obj, parameter_obj or numeric

Mean value

sigma: functor_obj, parameter_obj or numeric

Sigma defines width of the distribution function

Returns

object of type functor_obj

escape.core.average.lognorm(name, variable_obj x, mean, sigma)

Lognorm distribution functor of the following form: $$\exp(\log^2(x/x_0)/(2\sigma^2))/(\sqrt(2\pi)\sigma x)$$,

Parameters
x: variable_obj

Variable object

mean: variable_obj, parameter_obj or numeric

Mean value

sigma: functor_obj, parameter_obj or numeric

Sigma defines width of the distribution function

Returns

object of type functor_obj

escape.core.average.normal(name, variable_obj x, mean, fwhm)

Normal distribution functor of the following form: $$1/(\sqrt(2\pi)\sigma)\exp(-(x-x_0)^2/(2\sigma^2))$$,

Parameters
x: variable_obj

Variable object

mean: variable_obj, parameter_obj or numeric

Mean value

sigma: functor_obj, parameter_obj or numeric

Sigma defines width of the distribution function

Returns

object of type functor_obj

escape.core.average.uniform(name, variable_obj x, mean, fwhm)

Uniform distribution functor. $$G(x; x_0, \sigma) = 1.0 / w$$,

for $$x_0-w/2<=x<=x_0+w/2$$

Parameters
x: variable_obj

Variable object

mean: variable_obj, parameter_obj or numeric

Mean value

fwhm: functor_obj, parameter_obj or numeric

Full width at the half maximum

Returns

object of type functor_obj

escape.core.average.triangular(name, variable_obj x, mean, fwhm)

Triangular distribution functor. $$G(x; x_0, \sigma) = 2 (x - a) / (b - a) / (x_0 - a)$$, for $$a<=x<=x_0$$ $$G(x; x_0, \sigma) = 2 (b - x) / (b - a) / (b - x_0)$$, for $$x_0<=x<=b$$, where $$a=x_0-\sigma$$ and $$b=x_0+\sigma$$

Parameters
x: variable_obj

Variable object

mean: variable_obj, parameter_obj or numeric

Mean value

fwhm: functor_obj, parameter_obj or numeric

Full width at the half maximum

Returns

object of type functor_obj

escape.core.average.average(funf, fung, x, x0, a, b, int storage_size=7, epsabs=None, epsrel=None, maxiter=None)

Returns functor which calculates a result of averaging integral of type $$F(x_0)=\int_a^b f(x)G(x, x_0)dx$$, where $$x_0$$ - is a variable or parameter which correspond to the mean value, $$G(x, x_0)$$ - distribution function of two variables or parameters $$x$$ and $$x_0$$. $$x$$ and $$x_0$$ can be variables or parameters.

If integration is performed over parameters, the integration limits ‘a’ and ‘b’ are expected to have parameter type. If integration is over variables then ‘a’ and ‘b’ should be functors of variable ‘x0’. Numeric integration limits are also supported in both cases.

Parameters
funf: functor_obj with variable or parameter ‘x’

averaged functor

fung: functor_obj with variables or parameters, ‘x’ and ‘x_0’

distribution functor

x: variable or independent parameter

integration variable

x0: variable or independent parameter

mean value of distribution function

a: functor_obj or parameter_obj
• lower integration limit

b: functor_obj or parameter_obj
• upper integration limit

storage_size - integer

number of points of Gauss-Kronrod quadratures method. Supported values are [7, 15, 21, 31, 51, 61]

epsabs: float value or None

absolute tolerance of integration result, used only for adaptive integration. If set to None, Default value of 1e-5 is used

epsrel: float value or None

relative tolerance of integration result, used only for adaptive integration. If set to None, Default value of 0 is used’

maxiter: positive integer value or None

maximum number of iterations of adaptive integration. If set to None or zero adaptive integration is not used.

Returns

object of type functor_obj

escape.core.average.average_gamma(funf, sigma, x, x0, int storage_size=7, epsabs=None, epsrel=None, maxiter=None, int numstd=5)

Returns functor which calculates a result of averaging of function F(x) with Gamma distribution function.

Parameters
funf: functor_obj with variable or parameter ‘x’

averaged functor

sigma: functor_obj with variable ‘x_0’, parameter or numeric

parameter of distribution function

x: variable or independent parameter

integration variable

x0: variable or independent parameter

mean value of distribution function

storage_size - integer

number of points of Gauss-Kronrod quadratures method. Supported values are [7, 15, 21, 31, 51, 61]

epsabs: float value or None

absolute tolerance of integration result, used only for adaptive integration. If set to None, Default value of 1e-5 is used

epsrel: float value or None

relative tolerance of integration result, used only for adaptive integration. If set to None, Default value of 0 is used

maxiter: positive integer value or None

maximum number of iterations of adaptive integration. If set to None or zero adaptive integration is not used.

numstd: integer

number of standard deviation points, used to calculate integration limits

Returns

object of type functor_obj

escape.core.average.average_schulz(funf, sigma, x, x0, int storage_size=7, epsabs=None, epsrel=None, maxiter=None, int numstd=5)

Returns functor which calculates a result of averaging of function F(x) with Schulz distribution function.

Parameters
funf: functor_obj with variable or parameter ‘x’

averaged functor

sigma: functor_obj with variable ‘x_0’, parameter or numeric

parameter of distribution function

x: variable or independent parameter

integration variable

x0: variable or independent parameter

mean value of distribution function

storage_size - integer

number of points of Gauss-Kronrod quadratures method. Supported values are [7, 15, 21, 31, 51, 61]

epsabs: float value or None

absolute tolerance of integration result, used only for adaptive integration. If set to None, Default value of 1e-5 is used

epsrel: float value or None

relative tolerance of integration result, used only for adaptive integration. If set to None, Default value of 0 is used

maxiter: positive integer value or None

maximum number of iterations of adaptive integration. If set to None or zero adaptive integration is not used.

numstd: integer

number of standard deviation points, used to calculate integration limits

Returns

object of type functor_obj

escape.core.average.average_lognorm(funf, sigma, x, x0, int storage_size=7, epsabs=None, epsrel=None, maxiter=None, int numstd=5)

Returns functor which calculates a result of averaging of function F(x) with Lognorm distribution function.

Parameters
funf: functor_obj with variable or parameter ‘x’

averaged functor

sigma: functor_obj with variable ‘x_0’, parameter or numeric

parameter of distribution function

x: variable or independent parameter

integration variable

x0: variable or independent parameter

mean value of distribution function

storage_size - integer

number of points of Gauss-Kronrod quadratures method. Supported values are [7, 15, 21, 31, 51, 61]

epsabs: float value or None

absolute tolerance of integration result, used only for adaptive integration. If set to None, Default value of 1e-5 is used

epsrel: float value or None

relative tolerance of integration result, used only for adaptive integration. If set to None, Default value of 0 is used

maxiter: positive integer value or None

maximum number of iterations of adaptive integration. If set to None or zero adaptive integration is not used.

numstd: integer

number of standard deviation points, used to calculate integration limits

Returns

object of type functor_obj

escape.core.average.average_normal(funf, fwhm, x, x0, int storage_size=7, epsabs=None, epsrel=None, maxiter=None, int numstd=5)

Returns functor which calculates a result of averaging of function F(x) with normal distribution function.

Parameters
funf: functor_obj with variable or parameter ‘x’

averaged functor

sigma: functor_obj with variable ‘x_0’, parameter or numeric

parameter of distribution function

x: variable or independent parameter

integration variable

x0: variable or independent parameter

mean value of distribution function

storage_size - integer

number of points of Gauss-Kronrod quadratures method. Supported values are [7, 15, 21, 31, 51, 61]

epsabs: float value or None

absolute tolerance of integration result, used only for adaptive integration. If set to None, Default value of 1e-5 is used

epsrel: float value or None

relative tolerance of integration result, used only for adaptive integration. If set to None, Default value of 0 is used

maxiter: positive integer value or None

maximum number of iterations of adaptive integration. If set to None or zero adaptive integration is not used.

numstd: integer

number of standard deviation points, used to calculate integration limits

Returns

object of type functor_obj

escape.core.average.average_uniform(funf, fwhm, x, x0, int storage_size=7, epsabs=None, epsrel=None, maxiter=None)

Returns functor which calculates a result of averaging of function F(x) with uniform distribution function.

Parameters
funf: functor_obj with variable or parameter ‘x’

averaged functor

sigma: functor_obj with variable ‘x_0’, parameter or numeric

parameter of distribution function

x: variable or independent parameter

integration variable

x0: variable or independent parameter

mean value of distribution function

storage_size - integer

number of points of Gauss-Kronrod quadratures method. Supported values are [7, 15, 21, 31, 51, 61]

epsabs: float value or None

absolute tolerance of integration result, used only for adaptive integration. If set to None, Default value of 1e-5 is used

epsrel: float value or None

relative tolerance of integration result, used only for adaptive integration. If set to None, Default value of 0 is used

maxiter: positive integer value or None

maximum number of iterations of adaptive integration. If set to None or zero adaptive integration is not used.

numstd: integer

number of standard deviation points, used to calculate integration limits

Returns

object of type functor_obj

escape.core.average.average_triangular(funf, fwhm, x, x0, int storage_size=7, epsabs=None, epsrel=None, maxiter=None)

Returns functor which calculates a result of averaging of function F(x) with triangular distribution function.

Parameters
funf: functor_obj with variable or parameter ‘x’

averaged functor

sigma: functor_obj with variable ‘x_0’, parameter or numeric

parameter of distribution function

x: variable or independent parameter

integration variable

x0: variable or independent parameter

mean value of distribution function

storage_size - integer

number of points of Gauss-Kronrod quadratures method. Supported values are [7, 15, 21, 31, 51, 61]

epsabs: float value or None

absolute tolerance of integration result, used only for adaptive integration. If set to None, Default value of 1e-5 is used

epsrel: float value or None

relative tolerance of integration result, used only for adaptive integration. If set to None, Default value of 0 is used

maxiter: positive integer value or None

maximum number of iterations of adaptive integration. If set to None or zero adaptive integration is not used.

numstd: integer

number of standard deviation points, used to calculate integration limits

Returns

object of type functor_obj