#NEWLINE# def _solve_as_rational( f , symbol , domain ) : #NEWLINE# #INDENT# ' solve rational functions' #NEWLINE# f = together ( f , deep = True ) #NEWLINE# ( g , h ) = fraction ( f ) #NEWLINE# if ( not h . has ( symbol ) ) : #NEWLINE# #INDENT# return _solve_as_poly ( g , symbol , symbol ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# valid_solns = _solveset ( g , symbol , domain ) #NEWLINE# invalid_solns = _solveset ( h , symbol , domain ) #NEWLINE# return ( valid_solns - invalid_solns )