Estimate $\int_{-1}^{0}\sin(e^x)dx$ with error less than $\frac1{5000}$. Let $f(x)=\sin (e^x)$ then the taylor polynomial of degree 2 at $x=0$ is $P_2(x)=\sin 1+(\cos1)x+\frac12(\cos1-\sin1)x^2$. I want to estimate $\int_{-1}^{0}\sin(e^x)dx$, using $P_2(x)$, with error less than $\frac1{5000}$.
If $\left | f(x)-P_2(x) \right |\leq \frac1{5000}$, then $P_2(x)-\frac1{5000}\leq f(x)\leq P_2(x)+\frac1{5000}$ and thus $\int_{-1}^{0}P_2(x)dx-\frac1{5000}\leq \int_{-1}^{0}f(x)dx\leq \int_{-1}^{0}P_2(x)dx+\frac1{5000}$. Hence it is enough to show that $\left | f(x)-P_2(x) \right |\leq \frac1{5000}$.
How can I show this?
 A: If you look at |f(x)-P_2(x)| at $x=-1$ the error is very high. That is because of the change in the $e^x$. You are better off expanding at $x=-1/2$. This does not quite get you the error you want. However, if you keep 3 terms of the taylor series, you get the error bound you want.
Your best bet is to break up the interval [-1,0] into two halfs and use different expansion centered at the middle of each interval.
For your reference here is the expansion at $x=-1/2$:
$$\sin \left({e^{-1/2}}\right)+\cos \left(e^{-1/2}\right)\,{e^{-1/2}}\,\left(x+{{1}\over{2}}\right)\\+{{
 \left(\cos \left({e^{-1/2}}\right)\,\sqrt{e}-\sin \left(
 {e^{-1/2}}\right)\right)\,\left(x+{{1}\over{2}}\right)^2
 }\over{2\,e}}+\cdots $$
A: You could probably be better if you first transform the integral using $u=e^x$, then
$$\int_{-1}^0\sin(e^x)\,dx=\int_{1/e}^1\frac{\sin u}{u} du.$$
And then using something like
$$1-\tfrac16 u^2\le \frac{\sin(u)}{u}\le 1-\tfrac16 u^2+\frac1{120}u^4.$$
However, this is not the required precision. Are you sure that there is no trapezoidal summation involved?
