#NEWLINE# @ staticmethod #NEWLINE# @ cacheit #NEWLINE# def taylor_term( n , x , * previous_terms ) : #NEWLINE# #INDENT# if ( ( n < 0 ) or ( ( n % 2 ) == 0 ) ) : #NEWLINE# #INDENT# return S . Zero #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# x = sympify ( x ) #NEWLINE# k = floor ( ( ( n - 1 ) / S ( 2 ) ) ) #NEWLINE# if ( len ( previous_terms ) > 2 ) : #NEWLINE# #INDENT# return ( ( ( previous_terms [ ( - 2 ) ] * ( x ** 2 ) ) * ( n - 2 ) ) / ( n * k ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( ( 2 * ( x ** n ) ) / ( ( n * factorial ( k ) ) * sqrt ( S . Pi ) ) )