0

I use the table function to create a 3x3 matrix in index notation. I assume that I can access the element in first row and first column using A[[1,1]] but instead I need to use A[[1,1,1]]. How can I define a 3x3 matrix so that I can access each element by using A[[rowNum,colNum]] notation? Please see code below:

ClearAll["Global`*"]
A = Table[Subscript[a, i, j], {i, 1, 3}, {j, 1, 3}] // MatrixForm
A[[1, 1]]
A[[1, 1, 1]]

Thanks

Kuba
  • 136,707
  • 13
  • 279
  • 740
PatStarks
  • 33
  • 2
  • Linked topic should answer all your doubts, let me know if that is not the case. – Kuba Jun 09 '17 at 10:33
  • sorry I don't see how I can access the element using A[[rowNum,colNum]]. Why do I need to use A[[1,rowNum,colNum]]? – PatStarks Jun 09 '17 at 10:46
  • Have you read the answer in linked topic? – Kuba Jun 09 '17 at 10:50
  • Yes I did. My goal is to use the table function to generate the matrix and not write the matrix term by term. See code below – PatStarks Jun 09 '17 at 11:01
  • ClearAll["Global`*"] A = Table[Subscript[a, i, j], {i, 1, 3}, {j, 1, 3}] // MatrixForm A[[1, 1]] A = {{Subscript[a, 1, 1], Subscript[a, 1, 2], Subscript[a, 1, 3]}, {Subscript[a, 2, 1], Subscript[a, 2, 2], Subscript[a, 2, 3]}, {Subscript[a, 3, 1], Subscript[a, 3, 2], Subscript[a, 3, 3]}} // MatrixForm A[[1, 1]] – PatStarks Jun 09 '17 at 11:01
  • 1
    Please take a look at the second code line in the answer from linked thread. I don't see how I can add anything new. – Kuba Jun 09 '17 at 11:03
  • Why not to consider performing your computations without the MatrixForm formatting then visualising the result with it (as suggested in the duplicate answer) ? – Valacar Jun 09 '17 at 14:30

0 Answers0