SymParam

The SymParam module is provides functions for symbolically computing instantiations of the Trinity of Covariation.

Warning

Sometimes the evalf() function should be used to complete the calculation to a floating point value. This will often depend on the functions being integrated and how SymPy attempts to handle them.

conaction.symparam.circular_correlation(F, var, a, b)

Symbolically computes the multilinear circular correlation coefficient on a collection of functions over a given interval by integrating over a shared parameter.

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

  • var (SymPy Symbol) – Independent parameter for integration.

  • a (Undefined.) – Lower bound of integration.

  • b (Undefined.) – Upper bound of integration.

Returns:

result – Definite multilinear circular correlation.

Return type:

SymPy expression.

References

Examples

>>> x = sympy.Symbol('x')
>>> F = [x ** (i+1) for i in range(2)]
>>> circular_correlation(F, x, 0, 100).evalf()
-0.e-1
conaction.symparam.covariance(F, var, a, b)

Symbolically computes the multilinear covariance of a collection of functions over a given interval by integrating over a shared parameter.

Parameters:
  • F (array-like[SymPy expressions]) – Sequence of functions to compute covariance upon.

  • var (SymPy Symbol) – Independent parameter for integration.

  • a (Undefined.) – Lower bound of integration.

  • b (Undefined.) – Upper bound of integration.

Returns:

result – Definite multilinear covariance.

Return type:

SymPy expression.

References

Examples

>>> x = sympy.Symbol('x')
>>> F = [x ** (i+1) for i in range(2)]
>>> covariance(F, x, 0, 1)
0.0833333333333333
conaction.symparam.mean(f, t, a, b)

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

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

  • t (sympy.core.symbol.Symbol.) – Independent parameter for integration.

  • a (Undefined.) – Lower bound of integration.

  • b (Undefined.) – Upper bound of integration.

Returns:

result – Definite mean of function over given interval.

Return type:

SymPy expression.

Examples

>>> x = sympy.Symbol('x')
>>> mean(x ** 2, x, -2, 2)
1.33333333333333
conaction.symparam.misiak_correlation(fx, fy, F, var, a, b)

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

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

  • fy (SymPy expression.) – A function.

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

  • var (SymPy Symbol) – Independent parameter for integration.

  • a (Undefined.) – Lower bound of integration.

  • b (Undefined.) – Upper bound of integration.

Returns:

result – Definite misiak correlation.

Return type:

SymPy expression.

References

Examples

>>> x = sympy.Symbol('x')
>>> fx = sympy.sqrt(x)
>>> fy = sympy.sin(x)
>>> F = [x, x**2]
>>> misiak_correlation(fx, fy, F, x, 1, 2).evalf()
-0.999698940593851
conaction.symparam.nightingale_correlation(F, var, a, b, p)

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

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

  • var (SymPy Symbol) – Independent parameter for integration.

  • a (Undefined.) – Lower bound of integration.

  • b (Undefined.) – Upper bound of integration.

Returns:

result – Definite Nightingale’s correlation.

Return type:

SymPy expression.

References

Examples

>>> x = sympy.Symbol('x')
>>> F = [x ** (i+1) for i in range(2)]
>>> nightingale_correlation(F, x, 0, 100, 1).evalf()
0.970246182902770
conaction.symparam.nightingale_covariance(F, var, a, b, p)

Symbolically computes the Nightingale covariance of a collection of functions over a given interval by integrating over a shared parameter.

Parameters:
  • F (array-like[SymPy expressions]) – Sequence of functions to compute Nightingale covariance upon.

  • var (SymPy Symbol) – Independent parameter for integration.

  • a (Undefined.) – Lower bound of integration.

  • b (Undefined.) – Upper bound of integration.

Returns:

result – Definite Nightingale covariance.

Return type:

SymPy expression.

References

Examples

>>> x = sympy.Symbol('x')
>>> F = [x ** (i+1) for i in range(2)]
>>> nightingale_covariance(F, x, 0, 1, 2)
0.115010926557059
conaction.symparam.nightingale_deviation(f, var, a, b, p=2)

Symbolically computes the definite integral representing the Nightingale deviation of order p of a function using uniform probability measure.

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

  • var (sympy.core.symbol.Symbol.) – Independent parameter for integration.

  • a (Undefined.) – Lower bound of integration.

  • b (Undefined.) – Upper bound of integration.

Returns:

result – Definite Nightingale deviation of order p of function over given interval.

Return type:

SymPy expression.

Examples

>>> x = sympy.Symbol('x')
>>> nightingale_deviation(x ** 2, x, 0, 1, 1).evalf()
0.256600174703415
conaction.symparam.partial_agnesian(F, var, order)

Computes the partial Agnesian of a given order with respect to a given variable.

Parameters:
  • F (array-like[SymPy expressions]) – Operand functions of a given variable.

  • var (SymPy Symbol) – Independent parameter for differentiation/integration.

  • order (int) – Order of the partial Agnesian.

Return type:

SymPy expression.

Examples

>>> t = sympy.Symbol('t')
>>> F = [t**i for i in range(1,4)]
>>> partial_agnesian(F, t, 2)
0
conaction.symparam.partial_multiagnesian(F, Vars, order)
Computes the partial multiagnesian

of a given order with respect to a given collection of variables.

Parameters:
  • F (array-like[SymPy expressions]) – Operand functions of a given variable.

  • Vars (array-like[SymPy Symbols]) – Independent parameters for differentiation/integration.

  • order (int) – Order of the partial multiagnesian.

Return type:

SymPy expression.

Examples

>>> t1, t2 = sympy.var('t1 t2')
>>> F = [(t1+i)**(t2+i) for i in range(1,4)]
>>> partial_multiagnesian(F, [t1, t2], 0)
(t1 + 1)**(2*t2 + 2)*(t1 + 2)**(2*t2 + 4)*(t1 + 3)**(2*t2 + 6)
conaction.symparam.pearson_correlation(F, var, a, b)

Symbolically computes the multilinear Pearson’s product-moment correlation coefficient on a collection of functions over a given interval by integrating over a shared parameter.

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

  • var (SymPy Symbol) – Independent parameter for integration.

  • a (Undefined.) – Lower bound of integration.

  • b (Undefined.) – Upper bound of integration.

Returns:

result – Definite multilinear Pearson’s correlation.

Return type:

SymPy expression.

References

Examples

>>> x = sympy.Symbol('x')
>>> F = [x ** (i+1) for i in range(3)]
>>> pearson_correlation(F, x, 0, 100).evalf()
0.398761062646958
conaction.symparam.reflective_correlation(F, var, a, b)

Symbolically computes the multilinear reflective correlation coefficient on a collection of functions over a given interval by integrating over a shared parameter.

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

  • var (SymPy Symbol) – Independent parameter for integration.

  • a (Undefined.) – Lower bound of integration.

  • b (Undefined.) – Upper bound of integration.

Returns:

result – Definite multilinear reflective correlation.

Return type:

SymPy expression.

References

Examples

>>> x = sympy.Symbol('x')
>>> F = [x ** (i+1) for i in range(2)]
>>> reflective_correlation(F, x, 0, 100).evalf()
0.968245836551854
conaction.symparam.signum_correlation(F, var, a, b)

Signum correlation coefficient.

Symbolically computes the multilinear signum correlation coefficient on a collection of functions over a given interval by integrating over a shared parameter.

This function estimates

\[R_{\text{sign}} \left[ X_1, \cdots, X_n \right] = \frac{\mathbb{E} \left[ \prod_{j=1}^{n} \text{sign} \left( X_j - \mathbb{E}[X_j] \right) \right]}{\prod_{j=1}^{n} \sqrt[n]{\mathbb{E}\left[ |\text{sign} \left( X_j - \mathbb{E}[X_j] \right)|^n \right]}}\]
Parameters:
  • F (array-like[SymPy expressions]) – Sequence of functions to compute correlation coefficient upon.

  • var (SymPy Symbol) – Independent parameter for integration.

  • a (Undefined.) – Lower bound of integration.

  • b (Undefined.) – Upper bound of integration.

Returns:

result – Definite multilinear sigum correlation.

Return type:

SymPy expression.

References

Examples

>>> x = sympy.Symbol('x')
>>> F = [x ** (i+1) for i in range(2)]
>>> signum_correlation(F, x, 0, 1).evalf()
0.8
conaction.symparam.standard_deviation(f, t, a, b)

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

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

  • t (sympy.core.symbol.Symbol.) – Independent parameter for integration.

  • a (Undefined.) – Lower bound of integration.

  • b (Undefined.) – Upper bound of integration.

Returns:

result – Definite standard deviation of function over given interval.

Return type:

SymPy expression.

Examples

>>> x = sympy.Symbol('x')
>>> standard_deviation(x**2, x, 0, 1)
0.298142396999972
conaction.symparam.taylor_correlation(F, var, a, b)

Taylor’s multi-way correlation coefficient.

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[SymPy expressions]) – Sequence of functions to compute correlation coefficient upon.

  • var (SymPy Symbol) – Independent parameter for integration.

  • a (Undefined.) – Lower bound of integration.

  • b (Undefined.) – Upper bound of integration.

Returns:

result – Definite Taylor correlation.

Return type:

SymPy expression.

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

>>> x = sympy.Symbol('x')
>>> F = [x**(i+1) for i in range(3)]
>>> taylor_correlation(F, x, 0, 1)
0.957378751630761
conaction.symparam.trencevski_malceski_correlation(Fx, Fy, var, a, b)

Generalized n-inner product correlation coefficient.

Computes a correlation coefficient based on Trencevski and Melceski 2006.

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

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

  • var (SymPy Symbol) – Independent parameter for integration.

  • a (Undefined.) – Lower bound of integration.

  • b (Undefined.) – Upper bound of integration.

Returns:

result – Definite Trencevski and Melceski correlation.

Return type:

SymPy expression.

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

References

Examples

>>> x = sympy.Symbol('x')
>>> Fx = [x**(i+1) for i in range(3)]
>>> Fy = [sympy.sin(x**(i+1)) for i in range(3)]
>>> trencevski_malceski_correlation(Fx, Fy, x, 0, 1)
0.994375897094607
conaction.symparam.wang_zheng_correlation(F, var, a, b)

Correlation coefficient due to Wang & Zheng 2014.

This correlation coefficient is equivalent to

\[R_{wz} \triangleq 1 - \det (R_{n \times n})\]

where \(R_{n \times n}\) is the correlation matrix computed on a collection of n variables. In other words, this correlation coefficient is the complement of the determinant of the correlation matrix.

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

  • var (SymPy Symbol) – Independent parameter for integration.

  • a (Undefined.) – Lower bound of integration.

  • b (Undefined.) – Upper bound of integration.

Returns:

result – Definite Wang Zheng correlation.

Return type:

SymPy expression.

Notes

The complement of this statistic is the unsigned incorrelation coefficient.

References

Examples

>>> x = sympy.Symbol('x')
>>> F = [x**(i+1) for i in range(3)]
>>> wang_zheng_correlation(F, x, 0, 1)
0.999722222222222