#NEWLINE# @ classmethod #NEWLINE# def eval( cls , arg ) : #NEWLINE# #INDENT# if arg . could_extract_minus_sign ( ) : #NEWLINE# #INDENT# if cls . _is_even : #NEWLINE# #INDENT# return cls ( ( - arg ) ) #NEWLINE# #UNINDENT# if cls . _is_odd : #NEWLINE# #INDENT# return ( - cls ( ( - arg ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# pi_coeff = _pi_coeff ( arg ) #NEWLINE# if ( ( pi_coeff is not None ) and ( not ( 2 * pi_coeff ) . is_integer ) and pi_coeff . is_Rational ) : #NEWLINE# #INDENT# q = pi_coeff . q #NEWLINE# p = ( pi_coeff . p % ( 2 * q ) ) #NEWLINE# if ( p > q ) : #NEWLINE# #INDENT# narg = ( ( pi_coeff - 1 ) * S . Pi ) #NEWLINE# return ( - cls ( narg ) ) #NEWLINE# #UNINDENT# if ( ( 2 * p ) > q ) : #NEWLINE# #INDENT# narg = ( ( 1 - pi_coeff ) * S . Pi ) #NEWLINE# if cls . _is_odd : #NEWLINE# #INDENT# return cls ( narg ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if cls . _is_even : #NEWLINE# #INDENT# return ( - cls ( narg ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# t = cls . _reciprocal_of . eval ( arg ) #NEWLINE# if ( hasattr ( arg , 'inverse' ) and ( arg . inverse ( ) == cls ) ) : #NEWLINE# #INDENT# return arg . args [ 0 ] #NEWLINE# #UNINDENT# return ( ( 1 / t ) if ( t != None ) else t )