Solution (source code)

= Solution

The <Heisenberg equation of motion> and the <spin commutation relations> give, componentwise,
$$
\frac{dS_i}{dt}=\frac{i}{\hbar}[-\gamma B_jS_j,S_i]
=-\gamma\epsilon_{ijk}B_jS_k.
$$
Thus $\boxed{d\mathbf S/dt=\gamma\mathbf S\times\mathbf B}$. For constant <magnetic field> this is <Larmor precession>: the component along $\mathbf B$ is conserved and the transverse components rotate. In particular, for $\mathbf B=B\widehat{\mathbf z}$,
$$
S_x(t)=S_x(0)\cos\gamma Bt+S_y(0)\sin\gamma Bt,\quad
S_y(t)=S_y(0)\cos\gamma Bt-S_x(0)\sin\gamma Bt,\quad S_z(t)=S_z(0).
$$
The signed <angular velocity> is $-\gamma\mathbf B$; the positive precession rate is $|\gamma B|$.