3
$\begingroup$

The title basically. A typical example is the co-ordinates of a particle, and I want to introduce time dependence to define it's trajectory. For example, if I have cartco = {x,y,z}, I want to automate the defining of cartcofn[t] = {x[t],y[t],z[t]}. I can use Table command to make a loop over the list as I am doing for the moment, but is there an inbuilt function, like can Thread be somehow used?

$\endgroup$
2
  • 2
    $\begingroup$ Welcome to MMA SE! here's one way: c = {x, y, z}; cf[t_] = (#[t] &) /@ c Does that get you what you're looking for? $\endgroup$
    – thorimur
    May 14, 2021 at 1:16
  • $\begingroup$ yeah works. Thank you. Making the name of the name of function the dummy variable to replace, nice trick. $\endgroup$
    – duality
    May 14, 2021 at 2:03

1 Answer 1

8
$\begingroup$
cartco = {x, y, z};
Through[cartco[t]]

{x[t], y[t], z[t]}

$\endgroup$
1
  • $\begingroup$ thank you. This works nicely as well. $\endgroup$
    – duality
    May 15, 2021 at 13:23

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.