def diff(expr, var, count=1, assignments=()): from pymbolic import var as sym if isinstance(var, str): var = sym(var) return eval_expr_with_setup(assignments, sym("diff")(expr, var, count))