Solution (source code)

= Solution

For $a<b$, the one-panel <trapezoidal rule> is
$$
\boxed{\int_a^b f(x)\,dx\ \approx\ T(f):=\frac{b-a}{2}\bigl(f(a)+f(b)\bigr).}
$$
It integrates the <linear interpolation> between the two endpoint samples. Indeed the <affine function>
$$
\ell(x)=\frac{b-x}{b-a}f(a)+\frac{x-a}{b-a}f(b)
$$
has <definite integral> $T(f)$. The two <quadrature nodes> are $a,b$ and both <quadrature weights> are $(b-a)/2$.