# Modifying Array elements with two indices

I have arrays defined as

xvar = Array[x, {n + 3, m + 3}, {{-2, n}, {-2, m}}]
yvar = Array[y, {n + 3, m + 3}, {{-2, n}, {-2, m}}]


whose values are determined by solving some system of equations. One of this equation should be condition on some elements of this array, whose one of the indices should bigger than zero e.g. I want all x[i,j], where j>0, but irrespective of value of i, to be zero.

Edit 1: Second part of the problem: I am having a problem with implementation of two simultaneous conditions. x_[i_, j_] /; i == 0 && j > 1 -> 0 does not work, nor x_[i_, j_] /; {i == 0 && j > 1} -> 0 , x_[i_, j_] /; {i == 0, j > 1} -> 0

Edit 2: x[i_, 0] /; i > 1 -> 0 - this works but the general question still stands for example i>0 and j>0

• You might want to ask the "second part" as a new question instead, and add a link to this one. Oct 27 '17 at 11:53

   xvar = Array[x, {n + 3, m + 3}, {{-2, n}, {-2, m}}] /.

output: $$\left( \begin{array}{ccccc} x(-2,-2) & x(-2,-1) & x(-2,0) & 0 & 0 \\ x(-1,-2) & x(-1,-1) & x(-1,0) & 0 & 0 \\ x(0,-2) & x(0,-1) & x(0,0) & 0 & 0 \\ x(1,-2) & x(1,-1) & x(1,0) & 0 & 0 \\ x(2,-2) & x(2,-1) & x(2,0) & 0 & 0 \\ x(3,-2) & x(3,-1) & x(3,0) & 0 & 0 \\ \end{array} \right)$$