import sympy as sm
sm.init_printing()
theta, alpha = sm.symbols('theta, alpha')
B_C_A = sm.Matrix([[sm.cos(theta), sm.sin(theta), 0],
[-sm.sin(theta), sm.cos(theta), 0],
[0, 0, 1]])
B_C_A
C_C_B = sm.Matrix([[1, 0, 0],
[0, sm.cos(alpha), sm.sin(alpha)],
[0, -sm.sin(alpha), sm.cos(alpha)]])
C_C_B
C_C_A = C_C_B * B_C_A
C_C_A
import sympy.physics.mechanics as me
A = me.ReferenceFrame('A')
B = me.ReferenceFrame('B')
C = me.ReferenceFrame('C')
B.orient_axis(A, theta, A.z)
A.x
A.y
A.z
B.dcm(A)
C.orient_axis(B, alpha, B.x)
C.dcm(B)
C.dcm(A)
A = me.ReferenceFrame('A')
C = me.ReferenceFrame('C')
psi, theta, phi = sm.symbols('psi, theta, varphi')
C.orient_body_fixed(A, (psi, theta, phi), 'ZXZ')
C.dcm(A)