Approximating an integral with taylor polynomials.

power seriessequences-and-seriestaylor expansion

I am asked to approximate $\displaystyle\int_{-1/2}^{1/2}\cosh(x^2)dx$ with an error less than $\frac{1}{1000}$. I know so far that $\displaystyle\cosh(x) = \displaystyle\sum_{i=0}^{\infty} \dfrac{i^{2n}}{2n!}x^{2n}$ and I can approximate values of $\cosh(x)$ with an error as small as I want to. I know that to approximate the integral I must integrate the series I found but I don't really know at what point I should stop it.

Best Answer

Here is a way to bound $M$. First note that$$\cosh x^2=\sum_{n=0}^{\infty}{x^{4n}\over 2n!}$$therefore$$I=\int_{-1\over 2}^{1\over 2}\cosh x^2dx=2\int_{0}^{1\over 2}\cosh x^2dx=2\int_{0}^{1\over 2}\sum_{n=0}^{\infty}{x^{4n}\over 2n!}dx=2\sum_{n=0}^{\infty}{\left({1\over 2}\right)^{4n+1}\over 2n!(4n+1)}$$if we approximate the integral up to $M$ terms we have:$$\hat I=2\sum_{n=0}^{M}{\left({1\over 2}\right)^{4n+1}\over 2n!(4n+1)}$$therefore the approximation error would become:$$|I-\hat I|=2\sum_{n=M+1}^{\infty}{\left({1\over 2}\right)^{4n+1}\over 2n!(4n+1)}<\sum_{n=M+1}^{\infty}\left({1\over 2}\right)^{4n}={1\over 15}\left({1\over 16}\right)^{M}$$if we wish to have the error below $0.001$ we should have:$${1\over 15}\left({1\over 16}\right)^{M}<0.001$$or equivalently $$M=2$$

Related Question