# How to write down a product with omitted terms?

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)$$

• The question is unclearly formulated. Is it a product by $j$ or by $i,j$? – user64494 Jun 3 at 6:36

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}]

• Thank you so much. You mean without the ^2 cous its not in the question, but it helped. – Y.L Jun 2 at 20:51
• Yes the square is in the question: every term occurs twice (with opposite signs). There should be a $(-1)^{m(m-1)/2}$ factor too, to account for these signs. – Roman Jun 2 at 20:59
• @Roman Huh, I completely forgot about the sign. Thanks for pointing this out! – Henrik Schumacher Jun 2 at 21:01

Perhaps

ClearAll[ prod]
prod[m_, i_] := Product[ρ[i] - ρ[j], {j, DeleteCases[Range[m], i]}]

prod[5, 2]


(-ρ + ρ) (ρ - ρ) (ρ - ρ) (ρ - ρ)