# Matrix of functions

I want to create a matrix of functions. As explained in this question, I can create a matrix of variables:

labels = {"A", "B", "C"};
M = Table[Symbol["f" <> i <> j], {i, labels}, {j, labels}];
M // MatrixForm


But I want to create a matrix with functions fAA[t] etc. The motivation is that I am generating a matrix of differential equations that I will solve with DSolve. I tried the following simple modification but it does not work

M = Table[Symbol["f" <> i <> j <> "[t]"], {i, labels}, {j, labels}];

• Table[Symbol["f" <> i <> j][t], {i, labels}, {j, labels}] ? – andre314 Aug 13 at 13:33
• Oh yeah. I think that does the job. Will post if there are any issues. Thanks! – Tom Aug 13 at 13:35

Recommend that you consider using an indexed variable.

labels = {"A", "B", "C"};


If f[x, y] is distinct from f[y, x]

ClearAll[f]

Format[f[x_, y_]] := Subscript[f, ToString[x] <> ToString[y]]

(m = Outer[f[##][t] &, labels, labels]) // MatrixForm


If f[x, y] is equal to f[y, x]

ClearAll[f]

Format[f[x_, y_]] := Subscript[f, ToString[x] <> ToString[y]]

(m = Outer[(f @@ Sort[{##}])[t] &, labels, labels]) // MatrixForm


• Why do you recommend indexed versus not indexed? For some reason I thought we recommended against indexes with subscripts? Regardless, lovely code!! – CA Trevillian Aug 21 at 3:59
• @CATrevillian - subscripts/superscripts can case problems with some functions/commands. Rather than try to remember which ones, I always use indexed variables and format as desired. – Bob Hanlon Aug 21 at 19:08