# When to use which “closed” Newton Cotes rule?

Given a set of datapoints, I was thinking about when to use which (closed) Newton-Cotes formula?

I developed a decision tree which would go like this:

1. Are the given datapoints equally spaced? No --> Composite trapezoidal rule
2. Yes! Is the number of split-intervals multiple of 4? (ex. 4,8,12,16,..) Yes! ---> Composite Boole's Rule
3. No! Is the number of split-intervals multiple of 3? (ex. 3,9,12,15,..) Yes! ---> Composite Simpson's 3/8
4. No! Is the number of split-intervals even? (ex. 2,4,6,8,10,..) Yes! ---> Composite Simpson's 1/8
5. No! Use composite trapezoidal!

Is it right? If not please correct me. And it would be really helpful, if someone could provide me with the formulas of the composite Simpson's 1/8 and composite Simpson's 3/8, as I am not sure I have the right ones.

And last question: for 3 split-intervals, is it better to use composite trapezoidal rule or 1 simpson's 3/8 rule?

• Studying the error terms for the Newton-Cotes-formulas, you easily see that usually the $3/8$-rule is far better than composite trapeziodal rule. Basically, I would agree to your check-list, but this might be a subjective matter. – Peter Jul 13 '18 at 20:01
• In the case of equally spaced nodes : If the number of nodes is odd and at least $3$, you can choose the composite $3$-point-simpson-rule, which is a good choice , but not necessarily the best choice. For seven nodes for example, the composite $4$-point-simpson-rule is better. If the number is even and at least $4$, you can (when you have more than $4$ nodes) combine the $3$-point rule and the $4$-point rule (which only applies for the first $4$ nodes, for example). This gives you a reasonable choice, but to find the optimal choice, is harder. – Peter Jul 13 '18 at 20:49
Assuming that you are restricted to Newton-Cotes, if your data points aren't equally spaced, all you've got is the trapezoidal rule, crappy though it is. There are better things you can attempt, but my guess is that they aren't allowed for you at this point. Cases $2$ and $4$ could be consolidated to the plan to use $n$ steps of Romberg's rule if the number of split-intervals is a multiple of $2^n$. Simpson's $1/3$ rule is the result of one step of Romberg's rule and Boole's rule is two steps. Romberg's rule is easier to remember than Boole's rule in that you just take $4^n$ times the result obtained at step $n-1$ for the current interval width minus $1$ times the result obtained at step $n-1$ for double the current width and divide by $4^n-1$ to get the step $n$ result. Step $0$ is the trapezoidal rule. Romberg's rule gives you some kind of idea about how accurate your results are because they should start agreeing with each other as the steps progress. Also it gets high-order results without the error explosion that occurs if you try to do the same via Newton-Cotes.
If the split-intervals are equally spaced but there is an odd number of them, the normal thing to do is to apply Simpson's $3/8$ rule to the first $3$ split-intervals and then apply Simpson's composite $1/3$ rule to the rest of them. This way you don't have to fall back on the horrible trapezoidal rule just because the number of split-intervals is odd