If I have an expression in terms of multiplications of (pairs of) variables, e.g. $x_1$ ... $x_N$ such that the expression I want to manipulate is of the form
$A_{1,1}x_1^2+A_{1,2}x_1x_2+\ldots + A_{N,N-1}x_{N-1}x_N+A_{N,N}x_N^2$
What is the easiest way to implement the custom replacement rules
$x_ix_j\to C_{i,j}$
which can't be achieved with simple algebraic replacements for the individual $x_i$ (For instance $x_ix_j$ might represent the product of two random variables such that the replacement rules effect an expectation and thus give a correlation, i.e. $x_i^2\to \mathbb{E}[x_i^2]=\rho_i$ whilst $x_ix_j\to\mathbb{E}[x_ix_j]=0$, for example)?
Practically, I might have $x_1,\ldots,x_4$, say, but very large expressions that make manual substitution tedious.
PowerSymmetricPolynomial
,AugmentedSymmetricPolynomial
,SymmetricPolynomial
, andMomentConvert
. $\endgroup$