NumParam

This submodule contains functions for the numerical integration of parametric objects (e.g. curves and surfaces). It is built on top of NumPy and SciPy for efficient numerical integration over multiple bounds. Additionally, some functions use Pathos to parallelize the processing of expressions involving separate integration steps.

conaction.numparam.circular_correlation(F, I, *args, **kwargs)

Numerically computes the definite integral representing the multilinear circular correlation of a collection of unctions using uniform probability measure. The circular correlation coefficient here has been generalized to allow more than two variables.

Parameters:
  • F (array-like[function].) – Functions to be integrated.

  • I (array-like) – Integration bounds.

Returns:

result – Definite integral.

Return type:

float

Examples

>>> F = [lambda x,y: x+y for i in range(2)]
>>> I = [(0,1)]*2
>>> circular_correlation(F, I)
1.0

Warning

The length and order of I must correspond to the variables in F.

conaction.numparam.covariance(F, I, *args, **kwargs)

Numerically computes the definite integral representing the multilinear covariance value of a function using uniform probability measure. The covariance here is generalized to include mixed-centered product moments.

Parameters:
  • F (array-like[function].) – Functions to be integrated.

  • I (array-like) – Integration bounds.

Returns:

result – Definite integral.

Return type:

float

Examples

>>> F = [lambda x,y: x+y for i in range(2)]
>>> I = [(0,1)]*2
>>> covariance(F, I)
0.16666666666666666

Warning

The length and order of I must correspond to the variables in F.

conaction.numparam.mean(f, I, *args, **kwargs)

Numerically computes the definite integral representing the mean value of a function using uniform probability measure.

Parameters:
  • f (function.) – Function to be integrated.

  • I (array-like) – Integration bounds.

Returns:

result – Definite integral.

Return type:

float

Examples

>>> F = lambda x,y: x+y
>>> I = [(0,1)]*2
>>> mean(F, I)
1.0

Warning

The length and order of I must correspond to the variables in f.

conaction.numparam.misiak_correlation(fx, fy, F, I, *args, **kwargs)

Numerically computes the Misiak correlation coefficient on a collection of functions over a given interval by integrating over a shared parameter.

Parameters:
  • fx (function.) – A function.

  • fy (function.) – A function.

  • F (array-like[functions]) – Sequence of functions to compute correlation coefficient upon.

  • I (array-like) – Integration bounds.

Returns:

result – Definite misiak correlation.

Return type:

SymPy expression.

References

Examples

>>> f1 = lambda x: np.exp(x)
>>> f2 = lambda x: np.sin(x) + np.exp(x)
>>> F = [lambda x: x**2, lambda x: np.cos(x)+x**3 ]
>>> I = [(0, np.pi)]
>>> misiak_correlation(f1, f2, F, I)
0.7383533743159028
conaction.numparam.nightingale_correlation(F, I, *args, **kwargs)

Numerically computes the definite integral representing the multilinear Pearson product-moment value of a function using uniform probability measure. The Pearson’s product-moment correlation coefficient here has been generalized to allow more than two variables.

Parameters:
  • F (array-like[function].) – Functions to be integrated.

  • I (array-like) – Integration bounds.

Returns:

result – Definite integral.

Return type:

float

Examples

>>> F = [lambda x,y: x+y for i in range(2)]
>>> I = [(0,1)]*2
>>> pearson_correlation(F, I)
1.0

Warning

The length and order of I must correspond to the variables in F.

conaction.numparam.nightingale_covariance(F, I, p=1, *args, **kwargs)

Numerically computes the definite integral representing the Nightingale covariance value of a function using uniform probability measure.

Parameters:
  • F (array-like[function].) – Functions to be integrated.

  • I (array-like) – Integration bounds.

Returns:

result – Definite integral.

Return type:

float

Examples

>>> F = [lambda x: x for i in range(2)]
>>> I = [(0,1)]
>>> nightingale_covariance(F, I)
0.08333333333333333

Warning

The length and order of I must correspond to the variables in F.

conaction.numparam.nightingale_deviation(f, I, p=2, *args, **kwargs)

Numerically computes the definite integral representing the Minkowski deviation value of a function using uniform probability measure. The Minkowski deviation of order 2 is t he standard deviation.

Parameters:
  • f (function.) – Function to be integrated.

  • I (array-like) – Integration bounds.

Returns:

result – Definite integral.

Return type:

float

Examples

>>> F = lambda x,y: x+y
>>> I = [(0,1)]*2
>>> nightingale_deviation(F, I)
0.408248290463863

Warning

The length and order of I must correspond to the variables in f.

Warning

A sufficiently large input value for p can result numerical issues such as arithmetic underflow underflow.

conaction.numparam.partial_agnesian(F, I=[(0, 1)], order=1, steps=50, *args, **kwargs)

Computes the partial Agnesian of a given order with respect to a given variable. :param F: Operand functions of a given variable. :type F: array-like[function] :param I: Integration bounds. :type I: array-like :param order: Order of the partial Agnesian. :type order: int

Return type:

float

Examples

>>> F = [lambda x : x, lambda x: x]
>>> I = [(0, 2)]
>>> partial_agnesian(F, I, order=-2)
16.0
conaction.numparam.pearson_correlation(F, I, *args, **kwargs)

Numerically computes the definite integral representing the multilinear Pearson product-moment value of a function using uniform probability measure. The Pearson’s product-moment correlation coefficient here has been generalized to allow more than two variables.

Parameters:
  • F (array-like[function].) – Functions to be integrated.

  • I (array-like) – Integration bounds.

Returns:

result – Definite integral.

Return type:

float

Examples

>>> F = [lambda x,y: x+y for i in range(2)]
>>> I = [(0,1)]*2
>>> pearson_correlation(F, I)
1.0

Warning

The length and order of I must correspond to the variables in F.

conaction.numparam.product_moment(F, I, *args, **kwargs)

Numerically computes the definite integral representing the mixed uncentered product moment value of a collection of functions using uniform probability measure.

Parameters:
  • F (array-like[function].) – Functions to be integrated.

  • I (array-like) – Integration bounds.

Returns:

result – Definite integral.

Return type:

float

Examples

>>> F = [lambda x,y: x+y for i in range(2)]
>>> I = [(0,1)]*2
>>> product_moment(F, I)
1.1666666666666665

Warning

The length and order of I must correspond to the variables in F.

conaction.numparam.reflective_correlation(F, I, *args, **kwargs)

Numerically computes the definite integral representing the multilinear reflective correlation value of a collection of functions using uniform probability measure. The reflective correlation coefficient here has been generalized to allow more than two variables.

Parameters:
  • F (array-like[function].) – Functions to be integrated.

  • I (array-like) – Integration bounds.

Returns:

result – Definite integral.

Return type:

float

Examples

>>> F = [lambda x,y: x+y for i in range(2)]
>>> I = [(0,1)]*2
>>> reflective_correlation(F, I)
1.0

Warning

The length and order of I must correspond to the variables in F.

conaction.numparam.root_moment(f, I, p=2, *args, **kwargs)

Numerically computes the definite integral representing the root moment value of a function using uniform probability measure.

Parameters:
  • f (function.) – Function to be integrated.

  • I (array-like) – Integration bounds.

Returns:

result – Definite integral.

Return type:

float

Examples

>>> F = lambda x,y: x+y
>>> I = [(0,1)]*2
>>> root_moment(F, I)
1.0801234497346432

Warning

The length and order of I must correspond to the variables in f.

Warning

A sufficiently large input value for p can result numerical issues such as arithmetic underflow underflow.

conaction.numparam.signum_correlation(F, I, *args, **kwargs)

Numerically computes the definite integral representing the multilinear circular correlation of a collection of unctions using uniform probability measure. The circular correlation coefficient here has been generalized to allow more than two variables.

Parameters:
  • F (array-like[function].) – Functions to be integrated.

  • I (array-like) – Integration bounds.

Returns:

result – Definite integral.

Return type:

float

Examples

>>> F = [lambda x,y: x+y for i in range(2)]
>>> I = [(0,1)]*2
>>> signum_correlation(F, I)
1.0

Warning

The length and order of I must correspond to the variables in F.

conaction.numparam.standard_deviation(f, I, *args, **kwargs)

Numerically computes the definite integral representing the standard deviation value of a function using uniform probability measure.

Parameters:
  • f (function.) – Function to be integrated.

  • I (array-like) – Integration bounds.

Returns:

result – Detinite integral.

Return type:

float

Examples

>>> F = lambda x,y: x+y
>>> I = [(0,1)]*2
>>> nightingale_deviation(F, I)
0.408248290463863

Warning

The length and order of I must correspond to the variables in f.

Warning

A sufficiently large input value for p can result numerical issues such as arithmetic underflow underflow.

conaction.numparam.taylor_correlation(F, I, *args, **kwargs)

Numerically computes Taylor’s multi-way correlation coefficient for a given collcetion of functions using definite integration.

Taylor 2020 defines this function to be

\[\frac{1}{\sqrt{d}} \sqrt{\frac{1}{d-1} \sum_{i}^{d} ( \lambda_i - \bar{\lambda})^2 }\]

where \(d\) is the number of variables, \(\lambda_1, \cdots, \lambda_d\) are the eigenvalues of the correlation matrix for a given set of variables, and \(\bar{\lambda}\) is the mean of those eigenvalues.

Parameters:
  • F (array-like[function].) – Functions to be integrated.

  • I (array-like) – Integration bounds.

Returns:

result – Definite integral.

Return type:

float

Notes

Taylor’s multi-way correlation coefficient is a rescaling of the Bessel-corrected standard deviation of the eigenvalues of the correlation matrix of the set of variables.

References

Examples

>>> F = [lambda x: x**(i+1) for i in range(3)]
>>> I = [(0,1)]
>>> taylor_correlation(F, I)
1.0
conaction.numparam.trencevski_malceski_correlation(Fx, Fy, I, *args, **kwargs)

Generalized n-inner product correlation coefficient. Computes a correlation coefficient based on Trencevski and Melceski 2006.

Parameters:
  • Fx (array-like[function]) – Sequence of functions to compute correlation coefficient upon.

  • Fy (array-like[function]) – Sequence of functions to compute correlation coefficient upon.

  • I (array-like) – Integration bounds.

Returns:

result – Definite Trencevski and Melceski correlation.

Return type:

float

:raises ValueError : Fx and Fy must have the same length:

References

Examples

>>> Fx = [lambda x : x**4, lambda x: x / 3]
>>> Fy = [lambda x: np.exp(x), lambda x: x ** 3]
>>> I = [(0, 2)]
>>> trencevski_malceski_correlation(Fx, Fy, I)
0.7071067811865445