def ode_1st_homogeneous_coeff_best(eq, func, order, match):
 sol1 = ode_1st_homogeneous_coeff_subs_indep_div_dep(eq, func, order, match)
 sol2 = ode_1st_homogeneous_coeff_subs_dep_div_indep(eq, func, order, match)
 simplify = match.get('simplify', True)
 if simplify:
  constants = sol1.free_symbols.difference(eq.free_symbols)
  sol1 = odesimp(sol1, func, order, constants, '1st_homogeneous_coeff_subs_indep_div_dep')
  constants = sol2.free_symbols.difference(eq.free_symbols)
  sol2 = odesimp(sol2, func, order, constants, '1st_homogeneous_coeff_subs_dep_div_indep')
 return min([sol1, sol2], key=(lambda x: ode_sol_simplicity(x, func, trysolving=(not simplify))))

def ode_1st_homogeneous_coeff_best ( eq , func , order , match ) : sol1 = ode_1st_homogeneous_coeff_subs_indep_div_dep ( eq , func , order , match ) sol2 = ode_1st_homogeneous_coeff_subs_dep_div_indep ( eq , func , order , match ) simplify = match . get ( 'simplify' , True ) if simplify : constants = sol1 . free_symbols . difference ( eq . free_symbols ) sol1 = odesimp ( sol1 , func , order , constants , '1st_homogeneous_coeff_subs_indep_div_dep' ) constants = sol2 . free_symbols . difference ( eq . free_symbols ) sol2 = odesimp ( sol2 , func , order , constants , '1st_homogeneous_coeff_subs_dep_div_indep' ) return min ( [ sol1 , sol2 ] , key = ( lambda x : ode_sol_simplicity ( x , func , trysolving = ( not simplify ) ) ) )
returns the best solution to an ode from the two hints 1st_homogeneous_coeff_subs_dep_div_indep and 1st_homogeneous_coeff_subs_indep_div_dep .