#!/usr/bin/env python # coding: utf-8 # In[ ]: import sympy as sm import sympy.physics.mechanics as me me.init_vprinting() # In[ ]: theta, beta, alpha, l = me.dynamicsymbols('theta, beta, alpha, l') A, B, C, D = sm.symbols('A, B, C, D', cls=me.ReferenceFrame) # In[ ]: B.orient_axis(A, theta, A.z) C.orient_axis(B, beta, -B.x) D.orient_axis(C, alpha, C.z) # In[ ]: r = l*D.x r # In[ ]: r.express(C) # In[ ]: r.express(B) # In[ ]: r.express(A) # In[ ]: r.dot(C.x).diff(alpha) # In[ ]: r.dot(C.y).diff(alpha) # In[ ]: r_alpha_C = r.dot(C.x).diff(alpha)*C.x + r.dot(C.y).diff(alpha)*C.y r_alpha_C # In[ ]: r.diff(alpha, C).express(C).simplify() # In[ ]: theta, beta, alpha, l # In[ ]: t = me.dynamicsymbols._t # In[ ]: theta.diff(t) # In[ ]: r # In[ ]: r.diff(t, D) # In[ ]: r.diff(t, A).simplify() # In[ ]: r.dt(A) # In[ ]: r.dt(D) # In[ ]: q = t*A.y q # In[ ]: q.dt(A).dt(B) # In[ ]: q.dt(B).dt(A)