<s> """<STR_LIT>""" <EOL> from __future__ import division <EOL> from sympy import solve , symbols <EOL> from sympy . physics . mechanics import ReferenceFrame , Point <EOL> from sympy . physics . mechanics import cross , dot <EOL> def subdict ( d , keylist ) : <EOL> return dict ( ( k , d [ k ] ) for k in keylist ) <EOL> alpha = <NUM_LIT:10> <EOL> beta = symbols ( '<STR_LIT>' , real = True ) <EOL> b1 , b2 , b3 = symbols ( '<STR_LIT>' , real = True ) <EOL> p1 , p2 , p3 = symbols ( '<STR_LIT>' , real = True ) <EOL> N = ReferenceFrame ( '<STR_LIT:N>' ) <EOL> pO = Point ( '<STR_LIT:O>' ) <EOL> pS = pO . locatenew ( '<STR_LIT:S>' , <NUM_LIT:10> * N . x + <NUM_LIT:5> * N . z ) <EOL> pR = pO . locatenew ( '<STR_LIT:R>' , <NUM_LIT:10> * N . x + <NUM_LIT:12> * N . y ) <EOL> pQ = pO . locatenew ( '<STR_LIT>' , <NUM_LIT:12> * N . y + <NUM_LIT:10> * N . z ) <EOL> pP = pO . locatenew ( '<STR_LIT:P>' , <NUM_LIT:4> * N . x + <NUM_LIT:7> * N . z ) <EOL> A = alpha * pQ . pos_from ( pP ) . normalize ( ) <EOL> B = alpha * pS . pos_from ( pR ) . normalize ( ) <EOL> R = A + B <EOL> M = cross ( pP . pos_from ( pO ) , A ) + cross ( pR . pos_from ( pO ) , B ) <EOL> Ms = dot ( R , M ) * R / dot ( R , R ) <EOL> ps = cross ( R , M ) / dot ( R , R ) <EOL> A_prime = beta * pP . pos_from ( pO ) . normalize ( ) <EOL> B_prime = b1 * N . x + b2 * N . y + b3 * N . z <EOL> pB_prime = pO . locatenew ( "<STR_LIT>" , p1 * N . x + p2 * N . y + p3 * N . z ) <EOL> M_prime = cross ( pB_prime . pos_from ( pO ) , B_prime ) <EOL> eqs = [ dot ( R - A_prime - B_prime , n ) for n in N ] <EOL> eqs += [ dot ( M - M_prime , n ) for n in N ] <EOL> eqs . append ( dot ( pB_prime . pos_from ( pO ) , B_prime ) ) <EOL> soln = solve ( eqs , [ beta , b1 , b2 , b3 , p1 , p2 , p3 ] , dict = True ) [ <NUM_LIT:0> ] <EOL> print ( "<STR_LIT>" . format ( A_prime . subs ( subdict ( soln , [ beta ] ) ) ) ) <EOL> print ( "<STR_LIT>" . format ( soln [ beta ] . n ( ) ) ) <EOL> print ( "<STR_LIT>" . format ( B_prime . subs ( subdict ( soln , [ b1 , b2 , b3 ] ) ) ) ) <EOL> print ( "<STR_LIT>" . format ( B_prime . subs ( subdict ( soln , <EOL> [ b1 , b2 , b3 ] ) ) . magnitude ( ) . n ( ) ) ) <EOL> print ( "<STR_LIT>" . format ( pB_prime . pos_from ( pO ) . subs ( subdict ( soln , <EOL> [ p1 , p2 , p3 ] ) ) ) ) <EOL> print ( "<STR_LIT>" . format ( pB_prime . pos_from ( pO ) . subs ( <EOL> subdict ( soln , [ p1 , p2 , p3 ] ) ) . magnitude ( ) . n ( ) ) ) </s>
