Im attempting to numerically evaluate $\int\limits_{-1}^1 \cos^2(x) dx$.
I know the exact answer ahead of time: $1 + \cos(1)\sin(1)\approx 1.4546487134\ldots$.
Im doing this in Microsoft Excel, to experiment with my Excel skills and my implementation of integration functions and various numeric approximations. Regular cell stuff, not macros. Namely, Im using both midpoint Riemann rectangles to evaluate the integral, and Im also using Gaussian Quadrature to evaluate the integral.
Ive computed all up to the $n=25$ Riemann sum and the $n=5$ Gaussian Quadrature.
With each, Im then running them through a Richardson's Extrapolation (up to the 5th degree) to accelerate the convergence of the integral approximates.
Applying Richardsons extrapolation on a sequence to accelerate its convergence Ive known about for a while, but applying this method to a sequence representing an ever-converging integral is called Romberg Integration. I came across this method in a Washington University video lecture on youtube a few days ago, and it was specifically referenced with Gaussian Quadratures, so Im thinking this should work.
The Gaussian Quadrature by itself converges exceptionally well to the correct answer (For $n=5$ I get 5 decimal places). The midpoint Riemann sum is slow and inexact, obviously. By itself I only get 1 decimal place for $n=25$. But even the Riemann sum converges very well after applying Richardsons extrapolation: I get 7 decimal places with the 5th Richardson applied to the last six of my midpoint Riemann sums.
But the kicker. I apply Richardson to my only 5 Gaussian Quadrature evaluations and the inexactness blows up. I lose the accuracy I previously had. My approximate drops to 1.13 or so.
My question: Is this simply a case of ugly early behavior, and with higher degree Gaussian Quadratures and deeper Richardson Extrapolations I would recover my accuracy? Or is something more fundamental going on here? If so, why would the University professor condone the use of Richardson Extrapolations on Gaussian Quadratures? If not, what restrictions on using either Gaussian Quadatures or Richardsons Extrapolations, either by themselves or in conjunction, am I missing here that are giving rise to my failure in this instance? Or is this a failure of Excel?