2

In Physics it's common to write matrices in vector components to simplify notation. This commonly occures with the pauli vector $\vec\sigma = \begin{pmatrix}\sigma_1 & \sigma_2 & \sigma_3\end{pmatrix}^\mathrm{T}$

Then the scalar product $\vec \sigma \cdot \vec p$ with any vector p would be $\sigma_1 p_1 + \sigma_2 p_2 + \sigma_3 p_3$.

How would I implement such a product in Mathematica? Sure, I could use something like

paulivector = Table[PauliMatrix[k],{k,1,3}];
vector = {p1,p2,p3};

Sum[paulivector[[k]].vector[[k]],{k,1,3}];

But this doesn't seem to be the Mathematica way. I tried

Inner[Times,paulivector,vector]
Inner[Dot,paulivector,vector]

which resulted in:

Inner::incom: Length 2 of dimension 3 in {{{0,1},{1,0}},{{0,-I},{I,0}},{{1,0},{0,-1}}} is incommensurate with length 3 of dimension 1 in {px,py,pz}.

Is there a built-in function that I can use for this case?

Related (but 8-9 years old): A matrix-vector cross product

infinitezero
  • 1,419
  • 8
  • 18

1 Answers1

7
σ = Array[PauliMatrix, 3]
(*    {{{0, 1}, {1, 0}},
       {{0, -I}, {I, 0}},
       {{1, 0}, {0, -1}}}    *)

p = {x, y, z};

p . σ
(*    {{z, x - I y},
       {x + I y, -z}}    *)
Roman
  • 47,322
  • 2
  • 55
  • 121