Trapezoidal endpoint correction for a right Riemann sum (source code)

= Trapezoidal endpoint correction for a right Riemann sum
{title2=$R_N-T_N=\tfrac h2(f(b)-f(a))$}

On a uniform partition of $[a,b]$ with width $h$, the right <Riemann sum> and the <composite trapezoidal rule> have equal weights at every interior mesh point. They differ only by adding half a final-endpoint weight and removing half an initial-endpoint weight. This proves the displayed identity. For continuous $f$, both converge to its <definite integral>; their finite endpoint correction need not be confused with the smaller trapezoidal discretization error for a smooth integrand.