Thank You that worked. However is the way of declaring local variables correct ?
I am also creating a matrix
matx = Table[x[i, j], {i, Length[v]}, {j, Length[p]}]
I want one equation for each of its row and append it to the constraints list. e.g.
x[i, j] + x[i, j+1]+.... +x[i, Length[p]] == K[[i]] ? i
I have a list of equations
eqs = {}
I can create the inner loop like
C[vecx_] := Plux @@ vecx == 42
C[matx[[[1]]]
However how to run the outer loop ? and also how to pass the iterator i while iterating over the outer loop ?
In[14]:= Apply[C, matx]
Out[14]= C[{x[1, 1], x[1, 2]}, {x[2, 1], x[2, 2]}, {x[3, 1], x[3, 2]}, {x[4, 1], x[4, 2]}]
Applying C over matx is not working
I need something like
loop eq in C @@ matx
Append[eqs, eq]
end loop
I have tried
Do[
Print[ac],
Append[eqs, ac], {
ac,
C @@@ matx
}
]
But that did not work with error
Do::itform: "Argument Append[eqs,assignmentc] at position 2 does not
have the correct form for an iterator"