0
$\begingroup$

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

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

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)) *)
$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Marion May 8 '16 at 16:56
  • $\begingroup$ 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. $\endgroup$ – xslittlegrass May 8 '16 at 16:59
  • $\begingroup$ 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$. $\endgroup$ – Marion May 8 '16 at 17:01
  • $\begingroup$ I get 1 instead of 1/(x+y). $\endgroup$ – xslittlegrass May 8 '16 at 17:03
  • 1
    $\begingroup$ 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. $\endgroup$ – xslittlegrass May 8 '16 at 17:10
1
$\begingroup$
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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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