I'm aware that we can make a list of elements:

x = Table[Symbol["x" <> ToString@i], {i, n}];

This returns x = {x1,x2,x3} when n = 3. What I want is to be able to turn each of these variables x1,x2,x3 into functions of t (e.g. I want y = {x1[t],x2[t],x3[t]}).

Any ideas would be appreciated.

  • 2
    $\begingroup$ Look up Through: Through @ x[t] $\endgroup$ – Carl Woll Mar 7 '18 at 16:19
  • $\begingroup$ Thanks. Worked perfectly. $\endgroup$ – Gregory Mar 7 '18 at 16:47

Indexed variables are usually much easier to work with.

Format[x[n_Integer]] := Subscript[x, n]

Format[a[n_Integer]] := Subscript[a, n]

X[t_, n : _Integer?Positive : 3] := Array[x[#][t] &, n]

Using default value for n


enter image description here

Specifying a value for n

X[t, 5]

enter image description here

X[t, 5].Array[a, 5]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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