def solvify(f, symbol, domain):
 solution_set = solveset(f, symbol, domain)
 result = None
 if (solution_set is S.EmptySet):
  result = []
 elif isinstance(solution_set, ConditionSet):
  raise NotImplementedError('solveset is unable to solve this equation.')
 elif isinstance(solution_set, FiniteSet):
  result = list(solution_set)
 else:
  period = periodicity(f, symbol)
  if (period is not None):
   solutions = S.EmptySet
   if isinstance(solution_set, ImageSet):
    iter_solutions = (solution_set,)
   elif isinstance(solution_set, Union):
    if all((isinstance(i, ImageSet) for i in solution_set.args)):
     iter_solutions = solution_set.args
   for solution in iter_solutions:
    solutions += solution.intersect(Interval(0, period, False, True))
   if isinstance(solutions, FiniteSet):
    result = list(solutions)
  else:
   solution = solution_set.intersect(domain)
   if isinstance(solution, FiniteSet):
    result += solution
 return result

def solvify ( f , symbol , domain ) : solution_set = solveset ( f , symbol , domain ) result = None if ( solution_set is S . EmptySet ) : result = [ ] elif isinstance ( solution_set , ConditionSet ) : raise NotImplementedError ( 'solveset is unable to solve this equation.' ) elif isinstance ( solution_set , FiniteSet ) : result = list ( solution_set ) else : period = periodicity ( f , symbol ) if ( period is not None ) : solutions = S . EmptySet if isinstance ( solution_set , ImageSet ) : iter_solutions = ( solution_set , ) elif isinstance ( solution_set , Union ) : if all ( ( isinstance ( i , ImageSet ) for i in solution_set . args ) ) : iter_solutions = solution_set . args for solution in iter_solutions : solutions += solution . intersect ( Interval ( 0 , period , False , True ) ) if isinstance ( solutions , FiniteSet ) : result = list ( solutions ) else : solution = solution_set . intersect ( domain ) if isinstance ( solution , FiniteSet ) : result += solution return result
solves an equation using solveset and returns the solution in accordance with the solve output api .