I was reading through my professor's notes on Trapezoid and Simpson's rule in Numerical Integration and I was wondering if I get the intuition right.
Given a function $f$ and an interval $[a,b]$ these rules are guidelines on how you will split the initial interval $[a,b]$ into smaller intervals say $S_1,S_2...S_N$ where $S_1 =[a,x_i]$ and $S_N =[x_j,b]$.
Depending on the rule you know that each of these intervals contains a standard amount of points.
Let's take as an example a Simpson's interval which will contain 3 points.
Given the fact that we have 3 points we can :
- Approximate $f$ using a 2nd degree polynomial $P_2$ on $S_i$
- By integrating $P_2$ on $S_i$ we get $A_i$ which is an approximation of integrating $f$ on $S_i$
- Repeat steps (1) and (2) for each $S_j$ and calculate each $A_j$
- Finally add all $A_j$ and you get an approximation of integrating $f$ on $[a,b]$
I emphasize standard as in reality each $S_i$ contains infinitely many points and I understand that step (1) does not have to be repeated from scratch. The only thing you actually have to do is calculate the forward differences.
Is my process of thinking here right?
Yes, you are right. The trapezium rule approximates $f(x)$ by a linear function (straight line) between $(x_i, f(x_i))$ and $(x_{i+1}, f(x_{i+1}))$. Simpson's rule (also known as Simpson's 1/3 rule) approximates $f(x)$ by a quadratic function (parabola) between $(x_i, f(x_i))$ and $(x_{i+1}, f(x_{i+1}))$; to fit the quadratic it uses one extra evaluation of $f$ in each interval, at its midpoint $x=\frac{x_i+x_{i+1}} 2$.
The trapezium rule and Simpson's rule are both examples of a family of numerical integration methods called closed Newton-Cotes formulas. The next method in the family is Simpson's 3/8 rule which approximates $f$ by a cubic function in each interval.
Newton-Cotes formulas are especially easy to apply since the function being integrated is evaluated at regular intervals across the range of integration. Other numerical integration methods, such as Gaussian quadrature, use interval sizes that vary.