Creating a rotation matrix in NumPy

One way to create the two dimensional rotation matrix, $$ \mathbf{R} = \left(\begin{array}{rr}\cos\theta & -\sin\theta\\ \sin\theta & \cos\theta \end{array}\right) $$ which rotates points in the $xy$ plane anti-clockwise through $\theta=30^\circ$ about the origin:

In [x]: theta = np.radians(30)
In [x]: c, s = np.cos(theta), np.sin(theta)
In [x]: R = np.matrix('{} {}; {} {}'.format(c, -s, s, c))
In [x]: print(R)
[[ 0.8660254 -0.5      ]
 [ 0.5        0.8660254]]

Of course, in this case it would be easier to simply pass a list of lists directly:

In [x]: R = np.matrix([[c, -s], [s, c]])