#mathematic #calculus # [[Epistemic status]] #shower-thought #to-digest # Related > [!TODO] Related > [[Mathematical paradoxes]] [[velocity Verlet - Leapfrog Integration - Wikipedia]] [[Do calculus]] [[Lambda calculus]] # TODO > [!TODO] TODO # Integration $\int_{a}^{b}f(x)dx \approx \texttt{trapezoid}(f, a, b, n)$ ```jupyter def trapezoidal(f, a, b, n): h = float(b-a)/n result = 0.5*f(a) + 0.5*f(b) for i in range(1, n): result += f(a + i*h) result *= h return result from math import exp v = lambda t: 3*(t**2)*exp(t**3) n = 4 numerical = trapezoidal(v, 0, 1, n) numerical ```