Integration and differentiation of an approximation to a function - order of approximation For my research I am working with approximations to functions which I then integrate or differentiate and I am wondering how this affects the order of approximation.
Consider as a minimal example the case of $e^x$ for which integration and differentiation doesn't change anything. Now if I would approximate this function with a second order taylor series I get:
$$e^x\approx 1+x+\frac{x^2}{2}+O(x^3) \tag{1}$$
If I were to integrate this function I get:
$$ \int 1+x+\frac{x^2}{2}+O(x^3) dx = C+x+\frac{x^2}{2}+\frac{x^3}{6}+O(x^{?4?}) \tag{2}$$
I wrote $O^{?4?}$ because that is what my question is about: do I indeed get a higher order approximation when I do this integration or is it appropriate to cut-off the solution to the integral at $O(x^3)$, thus removing the $\frac{x^3}{6}$ term?
And what about differentiation? In that case I seem to lose an order of accuracy, is that indeed the case?
 A: Suppose that $f(x)$ has a Taylor series expansion about $x=0$ with a radius
of convergence $r>0$. For convenience we set $f(0)=1$.
We write
$$
f(x)=1+xf^{(1)}(0)+\frac{x^{2}}{2}f^{(2)}(0)+\mathcal{O}%
(x^{3})=1+xf^{(1)}(0)+\frac{x^{2}}{2}f^{(2)}(0)+g(x),
$$
where, in a neighbourhood of $0$,
$$
|x^{-3}g(x)|<c.
$$
Then, for the primitive $F(x)$,
$$
F(x)-F(0)=\int_{0}^{x}dyf(y)=x\int_{0}^{1}duf(xu),
$$
where
$$
f(xu)=1+xuf^{(1)}(0)+\frac{(xu)^{2}}{2}f^{(2)}(0)+g(xu).
$$
Then
\begin{eqnarray*}
\int_{0}^{1}duf(xu) &=&1+\frac{1}{2}xf^{(1)}(0)+\frac{x^{2}}{6}%
f^{(2)}(0)+\int_{0}^{1}dug(xu) \\
&=&1+\frac{1}{2}xf^{(1)}(0)+\frac{x^{2}}{6}f^{(2)}(0)+\int_{0}^{1}du(xu)^{3}%
\frac{g(xu)}{(xu)^{3}} \\
&=&1+\frac{1}{2}xf^{(1)}(0)+\frac{x^{2}}{6}f^{(2)}(0)+x^{3}%
\int_{0}^{1}duu^{3}\frac{g(xu)}{(xu)^{3}} \\
\left\vert \int_{0}^{1}duu^{3}\frac{g(xu)}{(xu)^{3}}\right\vert  &\leqslant
&c\int_{0}^{1}duu^{3}=\frac{1}{4}c,
\end{eqnarray*}
so
\begin{eqnarray*}
F(x)-F(0) &=&x\{1+\frac{1}{2}xf^{(1)}(0)+\frac{x^{2}}{6}f^{(2)}(0)+x^{3}%
\int_{0}^{1}duu^{3}\frac{g(xu)}{(xu)^{3}}\} \\
&=&x+\frac{1}{2}f^{(1)}(0)x^{2}+\frac{1}{6}f^{(2)}(0)x^{3}+x^{4}%
\int_{0}^{1}duu^{3}\frac{g(xu)}{(xu)^{3}} \\
&=&x+\frac{1}{2}f^{(1)}(0)x^{2}+\frac{1}{6}f^{(2)}(0)x^{3}+\mathcal{O}%
(x^{4}).
\end{eqnarray*}
For the derivative
\begin{eqnarray*}
\partial _{x}f(x) &=&\partial _{x}\{1+xf^{(1)}(0)+\frac{x^{2}}{2}%
f^{(2)}(0)+g(x)\} \\
&=&f^{(1)}(0)+xf^{(2)}(0)+\partial _{x}g(x).
\end{eqnarray*}
Now, according to l'Hôpital's rule,
$$
\lim_{x\rightarrow 0}\frac{g(x)}{x^{3}}=\lim_{x\rightarrow 0}\frac{\partial
_{x}g(x)}{3x^{2}},
$$
so
$$
\partial _{x}g(x)=\mathcal{O}(x^{2})
$$
A: This is indeed a very interesting question about the use of truncated series for integration and differentiation.
Taking you example of $e^x$, if we write $$f(x) =1+x+\frac{x^2}{2}+O\left(x^3\right)$$ from a formal point of view (at least, in my opinion), the derivative should write $$f'(x) =1+x+O\left(x^2\right)$$ and the antiderivative should write $$\int f(x) dx=C+x+\frac{x^2}{2}+\frac{x^3}{6}+O\left(x^4\right)$$
