def _discretize_adaptive(fun, a, b, tol=0.005, n=5):