# Composite Open Newton-Cotes

I have a set of points $x_i=\left(i-\frac{1}{2}\right)\Delta x$, for $i=1,...,N$ and the value of a function $f(x)=f(x_i)=f_i$ evaluated at the points $x_i$.

I would like to numerically integrate $f$ from $0$ to $N\Delta x$, i.e.,

$$\int_0^{N\Delta x}{f(x)dx}$$

Since my points $x_i$ are not endpoints, I can't use the trapezoidal rule, Simpsons rule etc. I tried to use the midpoint rule:

$$\int_0^{N\Delta x}{f(x)dx}\approx \Delta x\cdot\sum_{i=1}^{N}{f(x_i)}$$

However, the error in the midpoint rule is too big. I would like a better numerical method for the open interval I have, but I am struggling with the open Newton-Cotes formulas given, because the step size of this formulas does not match with what I have. Any suggestions to how should I begin to approach it?

Simpson's Rule would become $$\int_{-\frac32}^{\frac32}f(x)dx\approx\frac98f(-1)+\frac34f(0)+\frac98f(1)$$ I may post better results when I get off of work.
EDIT: Home again, so here goes: $$f(0)=\int_{-\frac12}^{\frac12}f(x)dx-\frac{1}{24}f^{(2)}(\xi)$$ $$f\left(-\frac12\right)+f\left(-\frac12\right)=\int_{-1}^{1}f(x)dx-\frac{1}{12}f^{(2)}(\xi)$$ $$\frac98f(-1)+\frac34f(0)+\frac98f(1)=\int_{-\frac32}^{\frac32}f(x)dx-\frac{21}{640}f^{(4)}(\xi)$$ $$\frac{13}{12}f\left(-\frac32\right)+\frac{11}{12}f\left(-\frac12\right)+\frac{11}{12}f\left(\frac12\right)+\frac{13}{12}f\left(\frac32\right)=\int_{-2}^{2}f(x)dx-\frac{103}{1440}f^{(4)}(\xi)$$ $$\frac{1375}{1152}f(-2)+\frac{125}{288}f(-1)+\frac{335}{192}f(0)+\frac{125}{288}f(1)+\frac{1375}{1152}f(2)=\int_{-\frac52}^{\frac52}f(x)dx-\frac{5575}{193536}f^{(6)}(\xi)$$ $$\frac{741}{640}f\left(-\frac52\right)+\frac{417}{640}f\left(-\frac32\right)+\frac{381}{320}f\left(-\frac12\right)+\frac{381}{320}f\left(\frac12\right)+\frac{417}{640}f\left(\frac32\right)+\frac{741}{640}f\left(\frac52\right)=\int_{-3}^{3}f(x)dx-\frac{1111}{17920}f^{(6)}(\xi)$$ You can get these formulas by just solving $N$ equations in $N$ unknowns for them to be exact for polynomials of degree up to $N-1$. If the number of intervals is not divisible by $3$ one or two copies of the $4$ point formula could be used so as to match the number of intervals much like the usage of Simpson's $3/8$ rule along with his $1/3$ rule when the number of intervals is odd.
I didn't show the $7$ point formula because it has some negative weights, indicating an error-magnifying formula. If you want higher-order formulas you might be better off using formulas that use least-squares fits to the data with less than the highest-order possible polynomial. Due to the lateness of the hour I haven't derived any of these.
• I named it after Simpson because it uses the value at 3 equally-spaced points and has error $O(h^4)$. But note that it uses the values of $f(x)$ at the midpoints of the intervals $\left[-\frac32,-\frac12\right]$, $\left[-\frac2,\frac12\right]$, and $\left[\frac12,-\frac32\right]$, just as required. I will post some more formulas with error terms assumed proportional to the first constant derivative of the lowest order polynomial for which they are not exact. – user5713492 Dec 19 '17 at 7:04
• Since the formulas are interpolatory by construction the $n$-point formula is exact for polynomials of degree $n-1$ and also of degree $n$ if $n$ is odd due to their symmetry. It can be shown that $\text{error}\le Cf^{(m)}(\xi)$ if $m$ is the first degree for which the formula isn't exact. I have assumed that $\text{error}=Cf^{(m)}(\xi)$ even though I have constructed an example where this isn't true. But on the assumption I just plugged in $f(x)=x^m$ and found the value of $C$. – user5713492 Feb 17 '18 at 0:11