Hey, i have 3 different numbers o1, o2 and o3. Now I shall solve ojok - okoj ,j,k =1,2,3 under the condition j < k. Of course i could type in the three different equations, but is there a more elegant way to do it with just one command? I tried :
Table[o[j].o[k]-o[k].o[j] , {j,1,3} , {k,1,3}, j<k]
but they just say “iterator {j < k} does not have approciate bounds”. Has anyone an idea how to solve this?
Will this do?
Table[ If[j<k, o[j].o[k] - o[k].o[j]], {j, 1, 3}, {k, 1, 3}] /. Null -> Sequence[] // Flatten
which gives you
{o[1].o[2] - o[2].o[1], o[1].o[3] - o[3].o[1], o[2].o[3] - o[3].o[2]}
Or a slightly simpler version
Table[If[j<k, o[j].o[k] - o[k].o[j], {}], {j, 1, 3}, {k, 1, 3}] // Flatten
Yep, thanks
In[6]:= Table[o[j].o[k] - o[k].o[j], {k, 2, 3}, {j, 1, k - 1}]
Out[6]= {{o[1].o[2] - o[2].o[1]}, {o[1].o[3] - o[3].o[1], o[2].o[3] - o[3].o[2]}}