Approximate $e^{x}\cos(x)$ Using Taylor polynomial $P_{2}(x)$

numerical methodstaylor expansion

This is a problem in "Numerical Anaylysis" by R.Burden and J.D.Faires. I am trying to approximate $f(0.5)$ for $f(x)=e^{x}\cos(x)$ using Taylor polynomial $P_{2}(x)$ about $x_{0}=0$ (It is possible since $f\in C^{\infty}(\mathbb{R}),$ the set of all functions that have derivatives of all orders on $\mathbb{R}$). Because $P_{2}(x)=x+1$ and remainder term $R_{2}(x)=-\frac{1}{3}x^{3}e^{\xi(x)}(\cos\xi(x)+\sin\xi(x))$, $P_{2}(0.5)=1.5$ and $R_{2}(0.5)=-\frac{1}{24}e^{\xi(x)}(\cos\xi(x)+\sin\xi(x))$ and $f(0.5)=P_{2}(0.5)+R_{2}(0.5)$ by Taylor's theorem, I conclude that
$$
\vert1.5-f(0.5)\vert=\frac{1}{24}e^{\xi(x)}(\cos\xi(x)+\sin\xi(x))
$$

and because $\xi(x)$ is between $0.5$ and $0$ and $\vert\sin(x)+\cos(x)\vert$ is at most $2$, we have:
$$
\vert1.5-f(0.5)\vert\leq\frac{2}{24}e^{0.5}\approx0.1373934392
$$

But evaluating $\vert1.5-f(0.5)\vert$ gives the approximate value of $0.1486584924$. Also, the book gives $\vert1.5-f(0.5)\vert\leq0.0932$ as an upper bound. Am I wrong in my calculations? How should I make sense of the book's answer when $\vert1.5-f(0.5)\vert\approx0.1486584924$?

Best Answer

The actual difference is $|1.5-f(0.5)| \approx 0.053$... Your upper bound is valid but that does not mean that a sharper bound cannot be found. The absolute error is given by

$$ \left|\frac{x^3 e^{\xi}}{3}\cdot (\sin \xi +\cos \xi )\right|\leq \frac{2.23733}{24}\approx 0.093222 $$

Related Question