Numerical integration error

46 Views Asked by At

I am a bit puzzled by one of my textbook tasks. I should determine the integral error $$ \int_{0}^{3} | f(t)-p_{n}(t) | d t $$ for $n=10,50,100$ using a numerical method. Where $$f(t) = \exp(-t)\cos(4\pi t)$$ And $p_n(t)$ is the lagrange interpolation polynomial of order max $n$.

However i can't seem to get a result that seems plausible. I tried the following. Determine $f(t)-p_{n}(t)$ from the following

$$ f(x)-p(x)=\frac{1}{(n+1) !} f^{(n+1)}\left(\xi_{x}\right) \prod_{i=0}^{n}\left(x-x_{i}\right) $$

And then integrate the right hand side.. This an error of something like $10^{10}$ when integrating using the quad method, which seems highly unlikely. Is there a simpler trick that i am missing, or where could i have gone wrong?