I have an assignment to finding the result of the integration of some points given in the closed interval $[0,1.2]$ with the method of Trapezoidal Rule, Simpson 1/3 and Simpson 3/8 rule. The problem on the given points is the step size is not uniform. The given points are :
| $x$ | $f(x)$ |
|---|---|
| $0$ | $1$ |
| $0.2$ | $1.491824698$ |
| $0.4$ | $2.225540928$ |
| $0.5$ | $2.718281828$ |
| $0.6$ | $3.320116923$ |
| $0.7$ | $4.055199967$ |
| $1$ | $7.389056099$ |
| $1.1$ | $9.025013499$ |
| $1.2$ | $11.02317638$ |
Firstly my approach is to use Trapezoidal rule in the sub-interval with the same step size, which is $[0,0.4];[0.4,0.7];[1,1.2]$. And then I sum up all the value and get $3.361908926$. Is this the right approach? How about the Simpson method? I cant use the 1/3 rule because the amount of data in the given sub-interval is not even, that's also the problem with 3/8rule. How do I proceed?
The methods you mention are based in interpolation, i.e. you compute the integral of an interpolating polynomial. Even though the formulas for those quadrature rules are presented for equally spaced points, you can always compute the adequate interpolating polynomials and respective integrals.
In the case of the trapezoidal method, it is even simpler: the composite trapezoidal method corresponds to the application of the simple method to each sub-interval and so, if you have $a=x_0< x_1 < \cdots < x_n=b$, then $$ \int_a^b f(x) dx = \sum_{i=0}^{n-1} \int_{x_i}^{x_{i+1}} f(x) dx=\sum_{i=0}^{n-1}\frac{x_{i+1}-x_i}{2}\cdot (f(x_i)+f(x_{i+1})) = 5.07855 $$
For Simpson, you can use the usual formula in the intervals with $$ x = 0, 0.2, 0.4; \quad x = 0.4, 0.5, 0.6; \quad x=1, 1.1, 1.2 $$
And then add an estimate for the integral in $[0.6, 1]$, given by $$ \int_{0.6}^1f(x) dx \approx \int_{0.6}^1 p_2(x) dx = \int_{0.6}^1 9.40506 x^2-4.87575 x+2.85974 dx =2.04151$$