# How to define a symbollic matrix with variables and numbers

Newbie here. I want to define a (user-defined)function to return symmetric matrices, as I need to define quite a few tensors. I am able to do this using strings. But I need the matrix entries to be variables and not strings.

I have this function now.

matF[fn_, size_] := Module[{mat},
mat = Table[ToString[fn]<>ToString[j]<>ToString[i],{i, 1,size},{j,1,i}];
MapThread[Join, {mat, Rest /@ Flatten[mat, {{2}, {1}}]}]];
A = matF[A, 3];


which returns the following matrix:

Is there a way to accomplish something similar, where the entries are variables and not strings? Any help is much appreciated!!

• So instead of "A11" you want A11? You can use ToExpression but A[1,1] will be more convenient. – Kuba Feb 20 '18 at 9:08
• You could use Symbol["A" <> "11"] – José Antonio Díaz Navas Feb 20 '18 at 14:11
• How about: Array[a, {3, 3}] this defines a 3 by 3 array of variables. – bill s Feb 20 '18 at 15:01
• Table[Subscript[A, i, j], {i, 3}, {j, 3}] // MatrixForm with subscript – user49047 Oct 10 '18 at 9:08