3
$\begingroup$

I would creat a symmetric matrix, but how can I set the boundary in Subscript?

Array[Subscript[a, #1, #2] &, {3, 3}] // MatrixForm

$a_{ij} = a_{ji}$, $j$ is not equal to $i$.

$\endgroup$
1

1 Answer 1

4
$\begingroup$
Array[Subscript[a, ## & @@ Sort[{##}]] &, {5, 5}] //  MatrixForm // TeXForm

$\left( \begin{array}{ccccc} a_{1,1} & a_{1,2} & a_{1,3} & a_{1,4} & a_{1,5} \\ a_{1,2} & a_{2,2} & a_{2,3} & a_{2,4} & a_{2,5} \\ a_{1,3} & a_{2,3} & a_{3,3} & a_{3,4} & a_{3,5} \\ a_{1,4} & a_{2,4} & a_{3,4} & a_{4,4} & a_{4,5} \\ a_{1,5} & a_{2,5} & a_{3,5} & a_{4,5} & a_{5,5} \\ \end{array} \right)$

You can also use

 Array[Subscript[a, Min @ ##, Max @ ##] &, {5, 5}]
$\endgroup$
4
  • $\begingroup$ thanks a lot! how can I get the voigt notation from second order tensor in a efficient way in Mathematica? $\endgroup$
    – ABCDEMMM
    Commented Jul 19, 2018 at 21:19
  • $\begingroup$ @ABCDEMMM, i am afraid i don't know off the top of my head; that sounds like good new question. $\endgroup$
    – kglr
    Commented Jul 19, 2018 at 21:25
  • $\begingroup$ I am also afraid that I will I get negative note if i ask such a question.... $\endgroup$
    – ABCDEMMM
    Commented Jul 19, 2018 at 21:27
  • $\begingroup$ @ABCDEMMM, i happen to think that it is a good question. With a small example and a link (say, to wikipedia) it is likely to be received very well on this site. $\endgroup$
    – kglr
    Commented Jul 19, 2018 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.