An illustration of Riemann sums

Choose a function, method, and partition size to compute and visualize the corresponding numerical integration approximation. The midpoint sum allows you the opportunity to "skew" the rectangles, illustrating the relationship with the trapezoidal sum.

Skew rectangle Approximation $\approx$ Error $\approx$
$f(x)=x^2+x/2+1/3$ $f(x)=\sin(x)$ $f(x)=\sin(\pi \, x^2)$ $f(x)=e^{-x^2}$

In principle, computing these kinds of sums is easy on a computer. Here's a little Python code to estimate $$\int_0^2 \sin(\pi x^2) dx.$$