qspec logo qspec logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2026 Patrick Müller. All rights reserved.

qspec. rotation_matrix  (  alpha ,  dr  )[source]

The matrix of a rotation by the angle $\alpha$ about the axis $\hat{n}$ (Rodrigues' rotation formula)

$$ R = \cos(\alpha)\mathbb{1} + \sin(\alpha)[\hat{n}]_\times + (1 - \cos(\alpha))\hat{n}\hat{n}^T, $$

where $[\hat{n}]_\times$ is the cross-product matrix of $\hat{n}$.

Parameters:
alphaarray_like

The angle $\alpha$ of the rotation (rad).

drscalar_nd

The vector to rotate about. Does not have to be normalized.

Returns:
Rndarray

The rotation matrix $R$.