My main question is how to assign values to symbolic arrays, in an efficient way. The code below is a simplified version of what I am trying to do and the output I get. Note that because I am using subscripts to generate my symbolic entries the output below is hard to follow, but in Mathematica it looks ok (so I also copy the output in LaTex for convenience)
I first generate a vector with generic symbolic entries:
ClearAll["Global`*"]
fMat = Array[Subscript[f, ##] &, {1, 2}]
{{Subscript[f, 1, 1], Subscript[f, 1, 2]}}
which actually looks like $\{\{f_{1,1}, f_{1,2}\}\}$
using LaTex. In my actual code I have a big matrix and that's why I am using subscripts. With this I can get symbolic results, like for instance
YMat = fMat.Transpose[fMat]
{{!(*SubsuperscriptBox[(f), (1, 1), (2)] + *SubsuperscriptBox[(f), (1, 2), (2)])}}
which looks like $\{\{f_{1,1}^2+f_{1,2}^2 \}\}$
All good so far. Now say I want to evaluate this for some specific values of my symbolic entries. So I try to assign values
Array[Subscript[f, ##] &, {1, 2}] = {2, 4}
will not work, giving a
`"Tag Array in Array[Subscript[f, ##1]&,{1,2}] is Protected."
message, while
{Subscript[f, 1, 1], Subscript[f, 1, 2]} = {2, 4}
works, in the sense that if I then type
YMat
{{20}}
However, I do not want to assign the values this way, because with a big matrix is a lot of code. I would like to do it in a compact way but I don't know how to do it. Also, as an aside, when I assign the values Mathematica will remember them the next time I evaluate the notebook, even with
ClearAll["Global`*"]
which is annoying because everything is numeric rather than symbolic. Any suggestion would be great!