Hi, i have to implement a sum of a function of a squared modulus of a vector and the sum runs from null vector to a certain vector. We are in a discretized space so that the vector components can take only integer values. I first constructed a list of all possible vectors with components (for simplicity) from -1 to +1, in this way:
a = Table[{i, j, k}, {i, -1, 1}, {j, -1, 1}, {k, -1, 1}]
b = Flatten[a, 2]
Now I have to implement the sum. I would construct an index that runs from 1 to the number of vectors in b, for any value of this index take the corresponding vector, calculate the squared modulus of that vector and evaluate the function on that value. Then sum all the values obtained. But I don't know how to construct such a cycle. Can you help me please?