# Inequality programming involving sum compositions

$$n=3$$, $$m=3$$, $$B$$ - identity matrix $$3 \times 3$$

Trying to implement it in Mathematica, but can't figure out how to program the second term. The result is an error.

Clear["Derivative"]
ClearAll["Global`*"]

n = 3
m = 3
B = IdentityMatrix[3]

Sum[x[i] f[i], {i, 1, n}] +
Sum[x[i], {i, 1, n}] Sum[B[[i, j]] u[i], {j, 1, m}] -
1/T Log[\[Alpha]/\[Beta]] Sum[x[i]^2, {i, 1, n}]
• You can not write Sum[B[[i, j]] u[i], {j, 1, m}]where i is undefined. Apr 16 at 17:03
• @DanielHuber Sum[x[i] Sum[B[[i, j]] u[i], {j, 1, m}], {i, 1, n}] I tried this construction, but it seems to me that it is not correct.
– dtn
Apr 16 at 17:06
• @DanielHuber And no, I could be wrong, but it seems the last edit is correct?
– dtn
Apr 16 at 17:35
• No, I think the i in B[[i,j]] u[i] should indeed be bound by the same summation that the sum over x[i] is. Sum[x[i] Sum[B[[i, j]] u[i], {j, 1, m}], {i, 1, n}] should be correct. Apr 16 at 18:06
• Also, what exactly is the error you're getting? Apr 16 at 18:07