def evaluate(expr,context = pc.global_context,cache = None,format = True): if context in __cached_evaluators: main = __cached_evaluators[context] else: main = pc.MultiEvaluator(recursive=True,split_binary=True) main.add_evaluator(context) main.add_evaluator(main_evaluator.main_evaluator) __cached_evaluators[context] = main if cache == None and __use_global_cache: cache = __cached_evaluators expr = main(expr,cache = cache) if format: expr = canonical_form.format_evaluator(expr,cache = cache) return expr
def expand(expr,**kwargs): return canonical_form.format_evaluator(expand_evaluator.expand_evaluator(expr,**kwargs),**kwargs)