def evaluator(variables, functions, math_expr, case_sensitive=False):
 if (math_expr.strip() == ''):
  return float('nan')
 math_interpreter = ParseAugmenter(math_expr, case_sensitive)
 math_interpreter.parse_algebra()
 (all_variables, all_functions) = add_defaults(variables, functions, case_sensitive)
 math_interpreter.check_variables(all_variables, all_functions)
 if case_sensitive:
  casify = (lambda x: x)
 else:
  casify = (lambda x: x.lower())
 evaluate_actions = {'number': eval_number, 'variable': (lambda x: all_variables[casify(x[0])]), 'function': (lambda x: all_functions[casify(x[0])](x[1])), 'atom': eval_atom, 'power': eval_power, 'parallel': eval_parallel, 'product': eval_product, 'sum': eval_sum}
 return math_interpreter.reduce_tree(evaluate_actions)

def evaluator ( variables , functions , math_expr , case_sensitive = False ) : if ( math_expr . strip ( ) == '' ) : return float ( 'nan' ) math_interpreter = ParseAugmenter ( math_expr , case_sensitive ) math_interpreter . parse_algebra ( ) ( all_variables , all_functions ) = add_defaults ( variables , functions , case_sensitive ) math_interpreter . check_variables ( all_variables , all_functions ) if case_sensitive : casify = ( lambda x : x ) else : casify = ( lambda x : x . lower ( ) ) evaluate_actions = { 'number' : eval_number , 'variable' : ( lambda x : all_variables [ casify ( x [ 0 ] ) ] ) , 'function' : ( lambda x : all_functions [ casify ( x [ 0 ] ) ] ( x [ 1 ] ) ) , 'atom' : eval_atom , 'power' : eval_power , 'parallel' : eval_parallel , 'product' : eval_product , 'sum' : eval_sum } return math_interpreter . reduce_tree ( evaluate_actions )
evaluate an expression; that is .