'The direction cosine matrix between frames.
This gives the DCM between this frame and the otherframe.
The format is N.xyz = N.dcm(B) * B.xyz
A SymPy Matrix is returned.
Parameters
otherframe : ReferenceFrame
The otherframe which the DCM is generated to.
Examples
>>> from sympy.physics.vector import ReferenceFrame, Vector
>>> from sympy import symbols
>>> q1 = symbols(\'q1\')
>>> N = ReferenceFrame(\'N\')
>>> A = N.orientnew(\'A\', \'Axis\', [q1, N.x])
>>> N.dcm(A)
Matrix([
[1,       0,        0],
[0, cos(q1), -sin(q1)],
[0, sin(q1),  cos(q1)]])'

def dcm(self, otherframe):

    _check_frame(otherframe)
    if (otherframe in self._dcm_cache):
        return self._dcm_cache[otherframe]
    flist = self._dict_list(otherframe, 0)
    outdcm = eye(3)
    for i in range((len(flist) - 1)):
        outdcm = (outdcm * flist[i]._dcm_dict[flist[(i + 1)]])
    self._dcm_cache[otherframe] = outdcm
    otherframe._dcm_cache[self] = outdcm.T
    return outdcm
