Given $n \in \mathbb{N}$, I want to determine the value obtained by approximating the integral
$$ \int_{0}^{2n} x^{2n+1}\cos(2{\pi}x) dx $$
using the closed Newton-Côtes formula of $2n + 1$ points.
In other words, I want to find a closed formula for:
$$\int_{0}^{2n} P_{2n}(x) dx$$
where $P_{2n}(x)$ is the Lagrange interpolating polynomial of $f(x) = x^{2n+1}\cos(2{\pi}x)$ through the $2n + 1$ points $\{0, 1, ..., 2n\}$, which has degree less than or equal to $2n$.
For $n = 1, ..., 6$, the values of the integrals are:
$$4, \frac{2048}{3}, 209952, \frac{536870912}{5}, \frac{250000000000}{3}$$
but I don't see a pattern.
Note: I initially considered the problem for $f(x) = x^{2n}\cos(2{\pi}x)$. Since in this case, there are $2n + 1$ points and $f(k) = k^{2n}$ for $k = 1, ..., 2n$, the Lagrange interpolating polynomial of $f(x)$ (which is unique) must be $x^{2n}$, as it has degree less than or equal to $2n$. Then the value of the integral is trivial to compute ($\frac{(2n)^{2n+1}}{2n+1}$).
I don't know if this helps, but $$x^{2n+1}-\prod_{k=0}^{2n}(x-k)=x^{2n+1}-(x)_{2n+1}$$ Is a polynomial of degree $2n$ that goes through all the $2n+1$ points, where $(x)_{2n+1}$ is the falling factorial. The first few integrals:
EDIT: Are you trying to form some sort of inductive hypothesis like $$A_n=\frac{2^{2n-1}(n-1)^{2n}}n$$ EDIT: The situation is so much simpler than this. If we make the substitutions $y=2n-x$ and $j=2n-k$ then $$\begin{align}\int_0^{2n}\prod_{k=0}^{2n}(x-k)dx&=\int_{2n}^0\prod_{k=0}^{2n}(2n-y-k)(-dy)\\ &=\int_0^{2n}\prod_{k=0}^{2n}(2n-y-k)(dy)\\ &=\int_0^{2n}\prod_{j=0}^{2n}(2n-y-2n+j)(dy)\\ &=(-1)^{2n+1}\int_0^{2n}\prod_{j=0}^{2n}(y-j)(dy)\\ &=-\int_0^{2n}\prod_{k=0}^{2n}(x-k)dx\\ &=0\end{align}$$ Because only zero is its own additive inverse. The $2n+1$-point Newton-Cotes formula also says this integral is $0$ because the integrand is zero at all the sample points. Thus the $2n+1$-point Newton-Cotes formula is exact for all polynomials of degree $2n+1$ because it's exact for all polynomials of degree $2n$ by construction and the difference between and degree $2n+1$ polynomial and some degree $2n$ polynomial is a multiple of $\prod_{k=0}^{2n}(x-k)$, which the $2n+1$-point Newton-Cotes formula evaluates exactly. That's an old theorem.
Thus if $f(x_k)=x_k^{2n+1}$ then a polynomial of degree $2n+1$ that goes through all $2n+1$ points is $f(x)=x^{2n+1}$ and because the $2n+1$-point Newton-Cotes formula integrates this exactly, it spits out $$\int_0^{2n}x^{2n+1}dx=\frac{(2n)^{2n+2}}{2n+2}=A_{n+1}$$ which is the same as our numerical results.