Computational Re-expression of Simpson's Rule

3 July 2014

Simpson’s rule is given (in my textbook) as such:

abf(x)S(n),2n\int_{a}^{b}f(x)\approx \text{S}(n),2|n S(n)=[f(x0)+4f(x1)+2f(x2)+4f(x3)++2f(xn2)+4f(xn1)+f(xn)]Δx3\text{S}(n)=\left[ f(x_0) + 4f(x_1) + 2f(x_2) + 4f(x_3) + \dots + 2f(x_{n-2}) + 4f(x_{n-1}) + f(x_n) \right ]\frac{\Delta x}{3} Δx=ban,xk=a+kΔx,kZ\Delta x=\frac{b-a}{n},x_k=a+k\Delta x,k\in \mathbb{Z}

It becomes difficult to express this in a way that a computer algebra system can assist you when the definition is given in this format. By re-expressing the definition with two summations, however, this becomes much easier to gain computational assistance.

S(n)=[f(x0)+4k=1n2f(x2k1)+2k=1n21f(x2k)+f(xn)]Δx3\text{S}(n)=\left[ f(x_0) + 4\sum_{k=1}^{\frac{n}{2}} f(x_{2k-1}) + 2\sum_{k=1}^{\frac{n}{2}-1} f(x_{2k}) + f(x_n) \right ]\frac{\Delta x}{3}

Why my textbook doesn’t see fit to explain this is quite beyond my understanding. It illustrates a clever use of summations and expressions in subscripts to achieve “all the odd elements” and “all the even elements,” which is a fundamental tool that will enhance a student’s abilities in the future.