I have the following term which I would like to express correctly in Mathematica:
$$ \prod_{j=1,j\neq i}^m(\rho_i-\rho_j) $$
Can you please help?
I have the following term which I would like to express correctly in Mathematica:
$$ \prod_{j=1,j\neq i}^m(\rho_i-\rho_j) $$
Can you please help?
Long form:
Product[(ρ[i] - ρ[j]), {i, 1, m}, {j, i + 1, m}] Product[(ρ[i] - ρ[j]), {i, 1, m}, {j, 1, i - 1}]
By observing that each factor occurs twice (up to sign):
Product[ - (ρ[i] - ρ[j])^2, {i, 1, m}, {j, i + 1, m}]
By counting the signs:
(-1)^(m (m - 1)/2) Product[(ρ[i] - ρ[j])^2, {i, 1, m}, {j, i + 1, m}]
Perhaps
ClearAll[ prod]
prod[m_, i_] := Product[ρ[i] - ρ[j], {j, DeleteCases[Range[m], i]}]
prod[5, 2]
(-ρ[1] + ρ[2]) (ρ[2] - ρ[3]) (ρ[2] - ρ[4]) (ρ[2] - ρ[5])