# How can we define lots of variables

I am new to Mathematica and some things I do not understand. Right now I need to write an algorithm which takes a polynomial in many variables, I denote it by $p_{i,j}$, and then I want to apply a differential operator on it. Something like $\sum_{i,j,k,l}p_{i+k-2,j+l}\partial p_{i,j}\partial p_{k,l}$ where $\partial p_{i,j}$ means differentiate the polynomial with respect to $p_{i,j}$. The first problem I am encountering right now is how to define a polynomial in these variables. I used Symbolize in Mathematica to define variables with subscript. The problem I have, how to go through this sum in the differential operator? I can't just put i and j in the subscript and then use a for loop. I want something like a list L which stores these variables and then if I want to differentiate with respect to $p_{i,j}$, I tell Mathematica to differentiate with respect to L[i,j].

I don't know how to do this and couldn't find something using Google.

• It would be useful if you could include the code that you have so far. In addition, giving an example with the desired output would also be useful. Please edit your post to include these. Commented Oct 27, 2016 at 20:08

vars = Table[Subscript[p, i, j], {i, 1, 10}, {j, 1, 10}]

• similarly vars = Array[p, {10, 10}]; D[p[1, 2]^2, vars[[1, 2]]] Commented Oct 27, 2016 at 20:45
• @Badshah, for example, using Map: #^2& /@vars will make your squaring of all table elements. Commented Oct 28, 2016 at 8:27