'Returns the partial derivative of the vector with respect to a
variable in the provided reference frame.
Parameters
var : Symbol
What the partial derivative is taken with respect to.
frame : ReferenceFrame
The reference frame that the partial derivative is taken in.
var_in_dcm : boolean
If true, the differentiation algorithm assumes that the variable
may be present in any of the direction cosine matrices that relate
the frame to the frames of any component of the vector. But if it
is known that the variable is not present in the direction cosine
matrices, false can be set to skip full reexpression in the desired
frame.
Examples
>>> from sympy import Symbol
>>> from sympy.physics.vector import dynamicsymbols, ReferenceFrame
>>> from sympy.physics.vector import Vector
>>> Vector.simp = True
>>> t = Symbol(\'t\')
>>> q1 = dynamicsymbols(\'q1\')
>>> N = ReferenceFrame(\'N\')
>>> A = N.orientnew(\'A\', \'Axis\', [q1, N.y])
>>> A.x.diff(t, N)
- q1\'*A.z
>>> B = ReferenceFrame(\'B\')
>>> u1, u2 = dynamicsymbols(\'u1, u2\')
>>> v = u1 * A.x + u2 * B.y
>>> v.diff(u2, N, var_in_dcm=False)
B.y'

def diff(self, var, frame, var_in_dcm=True):

    from sympy.physics.vector.frame import _check_frame
    var = sympify(var)
    _check_frame(frame)
    inlist = []
    for vector_component in self.args:
        measure_number = vector_component[0]
        component_frame = vector_component[1]
        if (component_frame == frame):
            inlist += [(measure_number.diff(var), frame)]
        elif ((not var_in_dcm) or (frame.dcm(component_frame).diff(var) == zeros(3, 3))):
            inlist += [(measure_number.diff(var), component_frame)]
        else:
            reexp_vec_comp = Vector([vector_component]).express(frame)
            deriv = reexp_vec_comp.args[0][0].diff(var)
            inlist += Vector([(deriv, frame)]).express(component_frame).args
    return Vector(inlist)
