= Solution
A <Newton-Cotes quadrature> integrates a <Lagrange interpolation polynomial> at equally spaced <quadrature nodes>. For the <Newton-Cotes closed quadrature>, the endpoints are included: write $x_j=a+jh$, $h=(b-a)/n$, and use
$$
\int_a^bf(x)\,dx\ \approx\ \int_a^bp_n(x)\,dx
=\sum_{j=0}^n W_jf(x_j),\qquad W_j=\int_a^b\ell_j(x)\,dx.
$$
These <quadrature weights> depend on the <quadrature nodes>, not on the sampled <function>. Open <Newton-Cotes quadrature> uses equally spaced interior <quadrature nodes> instead.
For <Simpson's rule>, use $n=2$ and set $x=a+ht$, so $0\leq t\leq2$. The <Lagrange cardinal polynomials> become
$$
L_0(t)=\frac{(t-1)(t-2)}2,\qquad L_1(t)=t(2-t),\qquad L_2(t)=\frac{t(t-1)}2.
$$
Integrating these <quadratic polynomials> gives $1/3$, $4/3$, $1/3$, respectively. The change of variable contributes $h$, so
$$
\boxed{\int_a^bf(x)\,dx\ \approx\ \frac h3\bigl[f(a)+4f(a+h)+f(b)\bigr]
=\frac{b-a}{6}\left[f(a)+4f\!\left(\frac{a+b}{2}\right)+f(b)\right].}
$$
Its <degree of precision of a quadrature rule> is three: it integrates every <quadratic polynomial> by construction, and also the cubic nodal <polynomial> $(x-a)(x-a-h)(x-b)$, whose <integral> vanishes by odd symmetry about $a+h$. Any <cubic polynomial> differs from its <quadratic polynomial> <interpolant> by a constant multiple of this nodal <polynomial>.
Back to article page