How to denote matrix elements succinctly? [closed]

Is there a more elegant way of dealing with the following subscripting?

Do[threetest =
MatrixRank[{{threepoints[[i]][[2]][[1]] -
threepoints[[i]][[1]][[1]],
threepoints[[i]][[2]][[2]] - threepoints[[i]][[1]][[2]]},
{threepoints[[i]][[3]][[1]] - threepoints[[i]][[1]][[1]],
threepoints[[i]][[3]][[2]] - threepoints[[i]][[1]][[2]]}}];
If[threetest < 2, Break[], 1], {i, Binomial[n, 3]}]


closed as off-topic by Roman, Henrik Schumacher, m_goldberg, happy fish, Alex TrounevApr 27 at 12:25

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Roman, Henrik Schumacher, m_goldberg, happy fish, Alex Trounev
If this question can be reworded to fit the rules in the help center, please edit the question.

• If the last dimension of threePoints is two, then you might try something like MatrixRank[threepoints[[i, 2 ;; 3]] - threepoints[[i, 1]]]. – WReach Apr 26 at 18:29

If threepoints is defined with any kind of regularity, then threepoints[[i]][[2]][[1]] is the same as threepoints[[i,2,1]]. See the documentation of Part.

Further, you can do vector processing with ;;, along the lines of

Do[threetest =
MatrixRank[{threepoints[[i, 2, 1 ;; 2]] - threepoints[[i, 1, 1 ;; 2]],
threepoints[[i, 3, 1 ;; 2]] - threepoints[[i, 1, 1 ;; 2]]}];
If[threetest < 2, Break[], 1],
{i, Binomial[n, 3]}]


If the third coordinate of threetest has only two slots (that is, if Dimensions[threetest] returns {something,something,2}), then the above can also be written as

Do[threetest =
MatrixRank[{threepoints[[i, 2]] - threepoints[[i, 1]],
threepoints[[i, 3]] - threepoints[[i, 1]]}];
If[threetest < 2, Break[], 1],
{i, Binomial[n, 3]}]


The other thing I do is to use the stylized brackets in all of my MMA code. Stackexchange mangles it, so have to use a picture to demonstrate: