replace function arguments with a list element by element

I have a list of numerical functions (interpolation functions) that I'd like to get the values of each one at different points. For example: the functions are {y1[t],y2[t]} and the points are {t1, t2}; I'd like to get the result {y1[t1], y2[t2]}.

I used Diagonal to get the answer:

Diagonal[{y1[t],y2[t]}/. t-> {t1,t2}]

I am wondering if there is a better way to avoid unnecessary replacements.

In:= MapThread[#[#2] &, {{y1, y2}, {t1, t2}}]
Out= {y1[t1], y2[t2]}
• If you don't mind using deprecated/undocumented functions, you could do MapThread[Compose, {{y1, y2}, {t1, t2}}] instead. Aug 28 '17 at 16:10
• And {y1,y2} can be obtained as {y1[t], y2[t]}[[All, 0]] using the OP's input. Or Head /@ {y1[t], y2[t]}. Aug 28 '17 at 16:28
• Thank you. Both methods work great. I ended up using Mapthread with Compose. Aug 28 '17 at 16:31

MapThread is probably your best shot, and in particular this version most closely mirrors your original approach, which did not require extracting the heads or pure-function versions of the $y_i$:

MapThread[#1 /. t -> #2 &, {{y1[t], y2[t]}, {t1, t2}}]

You could do this directly using Thread:

Thread[f[{y1[t], y2[t]}, {t1, t2}]] /. f -> (#1 /. t -> #2 &)

By defining an auxially variable $t_i=\{t_1,t_2\}$, you could also do this using MapIndexed:

ti = {t1, t2};
MapIndexed[#1 /. t -> ti[[First@#2]] &, {y1[t], y2[t]}]
• Thank you. very nice application of MapIndexed. Aug 28 '17 at 17:15