# Conditions on a product

I want to impose specific conditions on a product I am trying to take. I found this previous question asked here but when I use this I get zero. My expression is $$\prod_{(i,j)=(-a+1,-b+1)}^{(a,b)}\frac{1}{ix+jy}$$ with the condition that $(i,j) \neq \{(0,0),(a,b) \}$. How could I ask Mathematica to calculate this for me (e.g. for some specific values of $a,b$)?

• You don't have i,j dependence in the term, would this expression simply equals to (1/(a x+b y))^(2a+2b-4)? – xslittlegrass May 8 '16 at 16:43
• Sorry, typo! Fixing it now!!!! – Marion May 8 '16 at 16:44
• You can use If[] or Piecewise[] within Product[]. – J. M.'s discontentment May 8 '16 at 16:55

You can define a function to take care the special case. For example:

f[0, 0] = 1;
f[i_, j_] := 1/(i x + j y)

With[{a = 2, b = 2}, Product[f[i, j], {i, -a + 1, a - 1}, {j, -b + 1, b - 1}]]
(* 1/(x^2 (-x - y) (x - y) y^2 (-x + y) (x + y)) *)

• Hi, thanks. Ok, that takes care one of the conditions so I can do the same for the other I guess. By the way, I did not know such a thing is possible. – Marion May 8 '16 at 16:56
• Since the other conditions are at the end points so they can be excluded by setting the range to from -a+1 to a-1 and from -b+1 to b-1. – xslittlegrass May 8 '16 at 16:59
• Yes, but then I am not sure if the case $a=1,b=1$ makes sense. If I use what you write then I get $1/(xy)$ while I should have an empty product since both $a,b$ cannot take the values $0,1$. – Marion May 8 '16 at 17:01
• I get 1 instead of 1/(x+y). – xslittlegrass May 8 '16 at 17:03
• I don't see why that's necessary but if you don't want to change the boundary then you can do the same thing for the other boundary, by defining the special cases. – xslittlegrass May 8 '16 at 17:10
pF = Product[If[MatchQ[{i, j}, {0, 0} | {#2, #3}], 1, #],
{i, -#2 + 1, #2}, {j, -#3 + 1, #3}] &;

pF[1/(i x + j y), 1, 1] pF[1/(i x + j y), 2, 2] pF[1/(i x + j y), 3, 2] 