Evaluate by polynomial expansion the following integral with an error less than 0.000001 My work till now:
$\int_0^{0.2} \frac{1}{1+x^5} dx=\int_0^{0.2}(1+x^5)^{-1} dx$
$(1+x)^n=1+nx+ \frac{n(n-1)x^2}{2}...$
$\int_0^{0.2} \bigl( 1+(-1)x^5+ \frac{(-1)(-2)x^{10}}{2}- \frac{1(-2)(-3)x^{15}}{3!}+...\bigr)dx$
Now, I could integrate the above series but how can I find the result within that error?
Any tip/help is appreciated. Thanks!
 A: I think that the approximation works well: since
$$1+x^{15}=(1+x^5)(1-x^5+x^{10})$$
it follows that for any $x\in [0,1]$
$$\frac{1}{1+x^5}=1-x^5+x^{10}-\frac{x^{15}}{1+x^5}.$$
Hence
$$\begin{align}
\left|\int_{0}^{0.2}\frac{1}{1+x^5}\,dx-\int_{0}^{0.2}(1-x^5+x^{10})\,dx\right|&\leq\int_{0}^{0.2} \frac{x^{15}}{1+x^5}\,dx\\
&\leq \int_{0}^{0.2} x^{15}\,dx=\frac{(0.2)^{16}}{16}<10^{-12}.
\end{align}$$
Note that
$$\int_{0}^{0.2}\frac{1}{1+x^5}\,dx
\approx 0.199989335194742$$
and
$$\int_{0}^{0.2}(1-x^5+x^{10})\,dx\approx 0.1999893351951515.$$
P.S. Actually for an error less that $0.000001=10^{-6}$ you may consider less terms:
$$\frac{1}{1+x^5}=1-x^5+\frac{x^{10}}{1+x^5}.$$
A: By the alternating series error estimate, if $x \geq 0$ then $\frac{1}{1+x^5}$ is between $\sum_{n=0}^N (-1)^n (x^5)^n$ and $\sum_{n=0}^{N+1} (-1)^n (x^5)^n$ for any nonnegative integer $N$. Therefore the error in approximating $\int_0^{0.2} \frac{1}{1+x^5} dx$ by $\int_0^{0.2} \sum_{n=0}^N (-1)^n (x^5)^n dx$ is no more than $\int_0^{0.2} x^{5(N+1)} dx = \frac{0.2^{5N+5}}{5N+5}$.
Of course this method doesn't work when the geometric series isn't alternating, in that situation you are better off with $\frac{1}{1-x}=\sum_{n=0}^N x^n + \frac{x^{N+1}}{1-x}$ which doesn't care about the sign of $x$.
A: Just for your curiosity
It could be interesting to consider the general problem of
$$I_n=\int_0^{\frac 1n} \frac {dx}{1+x^n}=\sum_{k=0}^p  \frac{(-1)^k}{(k n+1)\, n^{(kn+1)}}+\sum_{k=p+1}^\infty  \frac{(-1)^k}{(k n+1)\, n^{(kn+1)}}$$ and you want to know (without systematic testing) the value of $p$ such that
$$R_p= \frac{1}{((p+1) n+1)\, n^{((p+1)n+1)}} \leq \epsilon\implies ((p+1) n+1)\, n^{((p+1)n+1)}\geq \frac 1 \epsilon$$
The solution is given is terms of Lambert function
$$p_*=\frac{W\left(\frac{\log (n)}{\epsilon }\right)}{n \log (n)}-\frac{1}{n}-1$$ and, as usual, you will need to use $p=\lceil p_* \rceil$.
For you specific case $n=5$ and $\epsilon=10^{-6}$, this would give $p_*=0.269019$ so $p=1$. Checking
$$R_1=\frac{1}{537109375}=1.86\times 10^{-9} \implies OK$$
Suppose now that we want $\epsilon=10^{-100}$, this would give $p_*=26.7995$ so $p=27$. Checking
$$R_{26}=6.41\times 10^{-98}  > 10^{-100} \qquad \text{while} \qquad R_{27}=1.98\times 10^{-101}  < 10^{-100} $$
If you cannot use Lambert function, since its argument is large, you can easily approximate its value using the expansion given in the linked page
$$W(t)\approx L_1-L_2+\frac{L_2}{L_1}+\frac{L_2(L_2-2)}{2L_1^2}+\frac{L_2(2L_2^2-9L_2+6)}{6L_1^3}+\cdots$$ where $L_1=\log(t)$ and $L_2=\log(L_1)$ .
