# Do I have the right formula for the Composite Simpson's 3/8 Rule?

Let $n$ be the number of segments, which is a multiple of 3. And let $h$ be the width of each of these segments, where $h=\dfrac{(b-a)}{n}$.

So the formula I have is that the integral $I$ for a function $f(x)$ on an interval [$a$,$b$] is:

$$I = \frac{3h}{8} \left[ f(x_0) + 3 \sum_{i=1,4,7,\dots}^{n-2}f(x_i) + \ 3 \sum_{i=2,5,8,\dots}^{n-1}f(x_i) + 2\sum_{i=3,6,9,\dots}^{n-3}f(x_i) + f(x_n) \right]$$

Also where $x_0 = a$ and $x_n = b$.

I was wondering if, this is the right formula for the composite simpson's 3/8 rule?

## 1 Answer

The formula of the Composite Simpson's 3/8 Rule is $$\int_a^b{f(x) dx} \approx \frac{3h}{8} \left[ f(x_0) + 3 \sum_{i=1}^{m}{\left(f(x_{3i-2})+f(x_{3i-1})\right)} + \ 2 \sum_{i=1}^{m-1}f(x_{3i}) + f(x_{3m}) \right]$$ where $$h=\frac{b-a}{3m},$$ and for $i=0,1,2,\cdots,3m$ $$x_i=a+ih.$$

Example. • Which is nothing else than the formula in the question, but with a better handling of the indeces. – crixstox Jun 6 '14 at 14:36