See my following example:
In[10]:= Array[a, 4, 0] . Array[PauliMatrix, 4, 0]
Out[10]= {{a[0] + a[3], a[1] - I a[2]}, {a[1] + I a[2], a[0] - a[3]}}
In[13]:= Array[PauliMatrix, 4, 0] . Array[a, 4, 0]
During evaluation of In[13]:= Dot::dotsh: Tensors {{{1,0},{0,1}},{{0,1},{1,0}},{{0,-I},{I,0}},{{1,0},{0,-1}}} and {a[0],a[1],a[2],a[3]} have incompatible shapes.
Out[13]= {{{1, 0}, {0, 1}}, {{0, 1}, {1, 0}}, {{0, -I}, {I, 0}}, {{1,
0}, {0, -1}}} . {a[0], a[1], a[2], a[3]}
How can I fix the second method above?
Regards, Zhao