5
$\begingroup$

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?

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

2 Answers 2

6
$\begingroup$

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}]
$\endgroup$
3
  • $\begingroup$ Thank you so much. You mean without the ^2 cous its not in the question, but it helped. $\endgroup$
    – Y.L
    Commented Jun 2, 2019 at 20:51
  • $\begingroup$ 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. $\endgroup$
    – Roman
    Commented Jun 2, 2019 at 20:59
  • $\begingroup$ @Roman Huh, I completely forgot about the sign. Thanks for pointing this out! $\endgroup$ Commented Jun 2, 2019 at 21:01
0
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.