0

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

Marion
  • 429
  • 3
  • 8

2 Answers2

2

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)) *)
xslittlegrass
  • 27,549
  • 9
  • 97
  • 186
  • 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 08 '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 08 '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 08 '16 at 17:01
  • I get 1 instead of 1/(x+y). – xslittlegrass May 08 '16 at 17:03
  • Without changing the "boundaries". I.e. I do not want to demand that the product stops at $a-1,b-1$ because in the formula I see (and I do not understand why) it is explicitly written as the product up to $a,b$ although the values $a,b$ are excluded. Basically, I will make a slight alteration to the product in my question so you see what I exactly have. Now, the product is properly written. – Marion May 08 '16 at 17:06
  • 1
    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 08 '16 at 17:10
1
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]

Mathematica graphics

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

Mathematica graphics

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

Mathematica graphics

kglr
  • 394,356
  • 18
  • 477
  • 896