Integral, Derivatives, Machine Learning, Python, Numerical Approximation.
integral(f, a : float, b : float) -> float: xs = np.linspace(a, b, 10_000) area_under_curve = 0 for i in range(len(xs)-1): delta_x = xs[i+1] - xs[i] f_x = f(xs[i]) area_under_curve += f_x * delta_x return area_under_curve Example To test our integral function, we can try to take the interval of x^2