  We report analytical equations for the derivatives of spin dynamics
simulations with respect to pulse sequence and spin system parameters. The
methods described are significantly faster, more accurate and more reliable
than the finite difference approximations typically employed. The resulting
derivatives may be used in fitting, optimization, performance evaluation and
stability analysis of spin dynamics simulations and experiments.
  Keywords: NMR, EPR, simulation, analytical derivatives, optimal control, spin
chemistry, radical pair.
