Description
Let $p(x)$ be a polynomial of degree $n$ and rational coefficients.
I'm interested in computing numerically the exact value of the integral $I$, which is also rational
$$I = \int_{a}^{b} p(x) \ dx$$
Usually the numerical integral is computed by the sum of weights $w_i$ and function values at nodes $x_i$
$$\tilde{I} = \sum_{i=1}^{m} w_i \cdot p(x_i)$$
The exact integral can be obtained by
- Newton-cotes formula with $m = 1+2\left\lfloor \dfrac{n}{2}\right\rfloor$ evaluation nodes
- Gauss-legendre quadrature with $m = \left\lceil \dfrac{n+1}{2}\right\rceil$ nodes.
Clearly gauss-legendre uses less points than newton-cotes due to the fact Newton-cotes keeps the nodes fixed at equal distance and find the best weights, while gauss-legendre find the best nodes and weights.
But the problem with gauss-legendre is the fact its nodes are irrational, impossible to represent them in computer, while rational values can.
Then I asked myself if there's a numerical method such we allow the nodes $x_{i}$ to move (different from newton-cotes) while keeping $x_i$ and $w_{i}$ in rationals (different from gauss-legendre). But unfortunatelly I have no clue how to start it
Question
- Is there some numerical method that uses $m \le 2\left\lfloor \dfrac{n}{2}\right\rfloor$ rational nodes and returns the exact value of $I$ ?
An equivalent question is:
- Given constant $m$, what is the maximum degree $n$ such $I$ is equal to $\tilde{I}$?
Notes
Note 1: I don't know the values of the coefficients $c_i$ of $p(x)$ to compute
$$I = \sum_{i=0}^{n} c_{i} \cdot \dfrac{b^{i+1}-a^{i-1}}{i+1}$$
Finding these coefficients means evaluating $p(x)$ at $(n+1)$ nodes, which would be the same as newton-cotes
Note 2: Assume my computer has infinite integer precision and can represent any rational.
Note 3: For many the approximation of the gauss-legendre irrationals by float
are enough, but trying to transform these irrationals into rationals (in computer) may lead to error.