You guys make it all too hard. Use a table!
Example 1:
Find an approximation for the area under the curve y = log3x from x=4 to x=8 using 5 function values (4 strips).
x f(x) W P
4 1.2619 1 1.2619
5 1.4650 4 5.8599
6 1.6309 2 3.2619
7 1.7712 4 7.0850
8 1.8928 1 1.8928
----------
Sum = 19.3615
.: Area = 1/3 x h x Sum
= 1/3 x 1 x 19.3615
= 6.4538
Abbreviations:
x = value of x
f(x) = corresponding function value
W = "weighting", always goes 1, 4, 2, 4, 2, 4, ..., 1
P = "product" = f(x) x W
Then the area is just 1/3 x h x Sum, where h is the difference in the values of x.
BTW, Trapezoidal rule can be done the same way except that the weightings go 1, 2, 2, 2, 2, ..., 1 and the Area = 1/2 x h x Sum.
Easy ... and tidy!