For an $n$ point Gaussian quadrature, one can show that it has degree of precision $2n – 1$ meaning it will exactly integrate polynomials of that degree or lower. Is it always true that a quadrature with a higher degree of precision will give better results for the integration of a non-polynomial function?
[Math] Degree of Precision Effect on Quadrature Accuracy
integrationnumerical methods
Best Answer
The answer to "is it always true" is always "no", especially in numerical methods. The issue is in how closely the integrand resembles a polynomial function. If the integrand is analytic in a large neighborhood of the interval of integration, then Gaussian quadrature converges extremely fast. But for integrals like $\int_{-1}^1\sqrt{1-x^4}\,dx$ or worse yet, $\int_{-1}^1 1/\sqrt{1-x^4}\,dx$, where the behavior is markedly non-polynomial, high degree of the method does not pay off. One is better off using a lower degree method on smaller subintervals. This is same story as with Legendre polynomial vs. polynomial splines.
For a technical treatment, see Is Gauss Quadrature Better than Clenshaw-Curtis? by Lloyd N. Trefethen.
For an example where Gaussian quadrature loses to the left endpoint rule, see this post.