Inner Products and Matrix Multiplication

In quantum-mechanical matrix notation, the inner product and the action of operators on state vectors are implemented as matrix multiplication. The standard Dot product in Mathematica does not properly handle the inner product of vectors whose components are operators, because it tries to contract the last index of the first argument with the first index of the second argument.
The AtomicDensityMatrix package provides the function MatrixMultiply that takes into account the meaning of various tensor structures employed by the package when combining them. The package defines CenterDot to be equivalent to MatrixMultiply. CenterDot can be entered as ..
MatrixMultiply[a,b] or abinner or outer product of spherical tensors, cartesian tensors, and operators
TensorNorm[expr]norm of expr

Matrix multiplication.

This loads the package.
In[1]:=
Click for copyable input
Matrix multiplication of a bra vector (covariant spherical tensor) with a ket vector (contravariant spherical tensor). The result is a scalar.
In[2]:=
Click for copyable input
Out[2]=
Matrix multiplication in the reverse order produces an operator (the outer product).
In[3]:=
Click for copyable input
Out[3]//MatrixForm=
Matrix multiplication contracts an operator with a bra to its left, or a ket to its right.
In[4]:=
Click for copyable input
Out[4]//MatrixForm=
Matrix multiplication is applied to each tensor of a tensor decomposition. With default option SumRanks->True the values obtained for each tensor rank are totaled.
Decomposition decomposes an operator into polarization moments.
In[5]:=
Click for copyable input
Out[5]=
The sum of the inner products of each rank tensor with itself is equal to the square of the trace of the original operator.
In[6]:=
Click for copyable input
Out[6]=
With SumRanks->False, the inner products are not totaled.
In[7]:=
Click for copyable input
Out[7]=
The matrix product of two Cartesian vectors is just the inner product.
In[8]:=
Click for copyable input
Out[8]=
A matrix product involving a scalar reduces to simple multiplication.
In[9]:=
Click for copyable input
Out[9]//MatrixForm=
Multiplication of two contravariant or two covariant tensors is not allowed.
In[10]:=
Click for copyable input
Out[10]=
Neither is multiplication on the wrong side of an operator.
In[11]:=
Click for copyable input
Out[11]=
Or multiplication of a spherical with a Cartesian tensor.
In[12]:=
Click for copyable input
Out[12]=
Matrix multiplication is recursively applied to tensor structures.
The covariant spherical tensor components of the angular momentum operator for a j=1 state.
In[13]:=
Click for copyable input
Out[13]//MatrixForm=
When the inner product of the J operator and its dual are taken, the components are combined using matrix multiplication. The result is, as we expect, j(j+1) times the identity operator.
In[14]:=
Click for copyable input
Out[14]//MatrixForm=
This also works for the Cartesian components of the vector. Here are the Cartesian components of the angular-momentum operator.
In[15]:=
Click for copyable input
Out[15]=
And the inner product with itself.
In[16]:=
Click for copyable input
Out[16]//MatrixForm=
The norm of a tensor is the square root of the inner product of the tensor with its dual tensor. Cartesian vectors are equal to their dual, while the dual of a covariant spherical tensor is the contravariant tensor, and vice versa.
A Cartesian vector and its norm.
In[17]:=
Click for copyable input
Out[17]=
The corresponding spherical tensor and its norm.
In[18]:=
Click for copyable input
Out[18]=
In[19]:=
Click for copyable input
Out[19]=
Clean up the symbols.
In[20]:=
Click for copyable input