I have a 3D rotation matrix as such:
R = sp.Matrix([
[ sp.cos(q1 + q2), -sp.sin(q1 + q2), 0],
[-sp.sin(q1 + q2), sp.cos(q1 + q2), 0],
[ 0, 0, 1]
])
Where q1 and q2, are angles. One of them, q2(t) is a function of time, it changes. How can I tell that to sympy?
I would like to differentiate that matrix over time but I do not know how to do that.
Thats how I declared everything:
q1, q2, t = sp.symbols('q1 q2 t', real=True)
R = sp.Matrix([
[ sp.cos(q1 + q2), -sp.sin(q1 + q2), 0],
[-sp.sin(q1 + q2), sp.cos(q1 + q2), 0],
[ 0, 0, 1]
])
sp.diff(R, t)
Thats the output I get from sp.diff(R, t)
:
I calculated a differential from R (by t) by hand and therefore I would like to get something like this in SymPy: