#NEWLINE# def test_aux( ) : #NEWLINE# #INDENT# ( q1 , q2 , q3 , u1 , u2 , u3 ) = dynamicsymbols ( 'q1 q2 q3 u1 u2 u3' ) #NEWLINE# ( q1d , q2d , q3d , u1d , u2d , u3d ) = dynamicsymbols ( 'q1 q2 q3 u1 u2 u3' , 1 ) #NEWLINE# ( u4 , u5 , f1 , f2 ) = dynamicsymbols ( 'u4, u5, f1, f2' ) #NEWLINE# ( u4d , u5d ) = dynamicsymbols ( 'u4, u5' , 1 ) #NEWLINE# ( r , m , g ) = symbols ( 'r m g' ) #NEWLINE# N = ReferenceFrame ( 'N' ) #NEWLINE# Y = N . orientnew ( 'Y' , 'Axis' , [ q1 , N . z ] ) #NEWLINE# L = Y . orientnew ( 'L' , 'Axis' , [ q2 , Y . x ] ) #NEWLINE# R = L . orientnew ( 'R' , 'Axis' , [ q3 , L . y ] ) #NEWLINE# w_R_N_qd = R . ang_vel_in ( N ) #NEWLINE# R . set_ang_vel ( N , ( ( ( u1 * L . x ) + ( u2 * L . y ) ) + ( u3 * L . z ) ) ) #NEWLINE# C = Point ( 'C' ) #NEWLINE# C . set_vel ( N , ( ( u4 * L . x ) + ( u5 * ( Y . z ^ L . x ) ) ) ) #NEWLINE# Dmc = C . locatenew ( 'Dmc' , ( r * L . z ) ) #NEWLINE# Dmc . v2pt_theory ( C , N , R ) #NEWLINE# Dmc . a2pt_theory ( C , N , R ) #NEWLINE# I = inertia ( L , ( ( m / 4 ) * ( r ** 2 ) ) , ( ( m / 2 ) * ( r ** 2 ) ) , ( ( m / 4 ) * ( r ** 2 ) ) ) #NEWLINE# kd = [ dot ( ( R . ang_vel_in ( N ) - w_R_N_qd ) , uv ) for uv in L ] #NEWLINE# ForceList = [ ( Dmc , ( ( ( - m ) * g ) * Y . z ) ) , ( C , ( ( f1 * L . x ) + ( f2 * ( Y . z ^ L . x ) ) ) ) ] #NEWLINE# BodyD = RigidBody ( 'BodyD' , Dmc , R , m , ( I , Dmc ) ) #NEWLINE# BodyList = [ BodyD ] #NEWLINE# KM = KanesMethod ( N , q_ind = [ q1 , q2 , q3 ] , u_ind = [ u1 , u2 , u3 , u4 , u5 ] , kd_eqs = kd ) #NEWLINE# with warnings . catch_warnings ( ) : #NEWLINE# #INDENT# warnings . filterwarnings ( 'ignore' , category = SymPyDeprecationWarning ) #NEWLINE# ( fr , frstar ) = KM . kanes_equations ( ForceList , BodyList ) #NEWLINE# #UNINDENT# fr = fr . subs ( { #NEWLINE# #INDENT# u4d : 0 , #NEWLINE# u5d : 0 , #NEWLINE# #UNINDENT# } ) . subs ( { #NEWLINE# #INDENT# u4 : 0 , #NEWLINE# u5 : 0 , #NEWLINE# #UNINDENT# } ) #NEWLINE# frstar = frstar . subs ( { #NEWLINE# #INDENT# u4d : 0 , #NEWLINE# u5d : 0 , #NEWLINE# #UNINDENT# } ) . subs ( { #NEWLINE# #INDENT# u4 : 0 , #NEWLINE# u5 : 0 , #NEWLINE# #UNINDENT# } ) #NEWLINE# KM2 = KanesMethod ( N , q_ind = [ q1 , q2 , q3 ] , u_ind = [ u1 , u2 , u3 ] , kd_eqs = kd , u_auxiliary = [ u4 , u5 ] ) #NEWLINE# with warnings . catch_warnings ( ) : #NEWLINE# #INDENT# warnings . filterwarnings ( 'ignore' , category = SymPyDeprecationWarning ) #NEWLINE# ( fr2 , frstar2 ) = KM2 . kanes_equations ( ForceList , BodyList ) #NEWLINE# #UNINDENT# fr2 = fr2 . subs ( { #NEWLINE# #INDENT# u4d : 0 , #NEWLINE# u5d : 0 , #NEWLINE# #UNINDENT# } ) . subs ( { #NEWLINE# #INDENT# u4 : 0 , #NEWLINE# u5 : 0 , #NEWLINE# #UNINDENT# } ) #NEWLINE# frstar2 = frstar2 . subs ( { #NEWLINE# #INDENT# u4d : 0 , #NEWLINE# u5d : 0 , #NEWLINE# #UNINDENT# } ) . subs ( { #NEWLINE# #INDENT# u4 : 0 , #NEWLINE# u5 : 0 , #NEWLINE# #UNINDENT# } ) #NEWLINE# frstar . simplify ( ) #NEWLINE# frstar2 . simplify ( ) #NEWLINE# assert ( ( fr - fr2 ) . expand ( ) == Matrix ( [ 0 , 0 , 0 , 0 , 0 ] ) ) #NEWLINE# assert ( ( frstar - frstar2 ) . expand ( ) == Matrix ( [ 0 , 0 , 0 , 0 , 0 ] ) )