#NEWLINE# def _minpoly_sin( ex , x ) : #NEWLINE# #INDENT# '\n    Returns the minimal polynomial of ``sin(ex)``\n    see http://mathworld.wolfram.com/TrigonometryAngles.html\n    ' #NEWLINE# ( c , a ) = ex . args [ 0 ] . as_coeff_Mul ( ) #NEWLINE# if ( a is pi ) : #NEWLINE# #INDENT# if c . is_rational : #NEWLINE# #INDENT# n = c . q #NEWLINE# q = sympify ( n ) #NEWLINE# if q . is_prime : #NEWLINE# #INDENT# a = dup_chebyshevt ( n , ZZ ) #NEWLINE# return Add ( * [ ( ( x ** ( ( n - i ) - 1 ) ) * a [ i ] ) for i in range ( n ) ] ) #NEWLINE# #UNINDENT# if ( c . p == 1 ) : #NEWLINE# #INDENT# if ( q == 9 ) : #NEWLINE# #INDENT# return ( ( ( ( 64 * ( x ** 6 ) ) - ( 96 * ( x ** 4 ) ) ) + ( 36 * ( x ** 2 ) ) ) - 3 ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( n % 2 ) == 1 ) : #NEWLINE# #INDENT# a = dup_chebyshevt ( n , ZZ ) #NEWLINE# a = [ ( ( factors ** ( n - i ) ) * a [ i ] ) for i in range ( ( n + 1 ) ) ] #NEWLINE# r = Add ( * a ) #NEWLINE# ( _ , factors ) = factor_list ( r ) #NEWLINE# res = _choose_factor ( factors , x , ex ) #NEWLINE# return res #NEWLINE# #UNINDENT# expr = ( ( ( 1 - cos ( ( ( 2 * c ) * pi ) ) ) / 2 ) ** S . Half ) #NEWLINE# res = _minpoly_compose ( expr , x , QQ ) #NEWLINE# return res #NEWLINE# #UNINDENT# #UNINDENT# raise NotAlgebraic ( ( "%s doesn't seem to be an algebraic element" % ex ) )