<s> """<STR_LIT>""" <EOL> from __future__ import division <EOL> from sympy . physics . mechanics import ReferenceFrame , Point <EOL> from sympy . physics . mechanics import cross , dot <EOL> from sympy import integrate , simplify , symbols , integrate <EOL> from sympy import sin , cos , pi <EOL> def calc_inertia_vec ( rho , p , n_a , N , iv ) : <EOL> integrand = rho * cross ( p , cross ( n_a , p ) ) <EOL> return sum ( simplify ( integrate ( dot ( integrand , n ) , iv ) ) * n <EOL> for n in N ) <EOL> a , b , L , l , m , h = symbols ( '<STR_LIT>' , real = True , nonnegative = True ) <EOL> theta = symbols ( '<STR_LIT>' , real = True ) <EOL> h_theta_val = { h : b * l / L , theta : <NUM_LIT:2> * pi * l / L } <EOL> density = m / L <EOL> N = ReferenceFrame ( '<STR_LIT:N>' ) <EOL> pO = Point ( '<STR_LIT:O>' ) <EOL> pP = pO . locatenew ( '<STR_LIT:P>' , h * N . x + a * cos ( theta ) * N . y + a * sin ( theta ) * N . z ) <EOL> I_1 = calc_inertia_vec ( density , pP . pos_from ( pO ) . subs ( h_theta_val ) , <EOL> N . x , N , ( l , <NUM_LIT:0> , L ) ) <EOL> I_2 = calc_inertia_vec ( density , pP . pos_from ( pO ) . subs ( h_theta_val ) , <EOL> N . y , N , ( l , <NUM_LIT:0> , L ) ) <EOL> print ( '<STR_LIT>' . format ( I_1 ) ) <EOL> print ( '<STR_LIT>' . format ( I_2 ) ) </s>
