I have an expression that consists of a large sum of variables of powers like:
X^(2p) X^2 + X^2 X^(2p) + X1^(1+p) X^(1+p) ...
Now I would like to replace
While I can use the list index as a variable I cannot use the exponent as variable. For example, I cannot use
expr /. X[k_]^(l_) -> sigma^l (l-1)!!
Instead I have to list all options manually:
expr /. X[k_]^2 X[l_]^(2p) -> sigma^(2+2p) (2p-1)!! /. X[k_]^(p+1) X[l_]^(p+1) -> sigma^(2+2p) p!! p!!
Why is this and how can I implement this?