Why ReplaceAll does not work in this situation?
id = {{1, 0}, {0, 1}};
sx = {{0, 1}, {1, 0}};
sy = {{0, -I}, {I, 0}};
sz = {{1, 0}, {0, -1}};
s = {id, sx, sy, sz};
p[t_] := {p0[t], p1[t], p2[t],
p3[t]};
In[1]:=
Sum[p[1][[i]]*s[[i]].sx.s[[i]], {i, 1, 4}] /. p[1] -> {1, 0, 0, 0}
Out[1]= {{0,
p0[1] + p1[1] - p2[1] - p3[1]}, {p0[1] + p1[1] - p2[1] - p3[1], 0}}
The output is right, only the replacement of the terms in vector p[t] does not take place.