Using a power series to approximate $\int_0^{.3} \frac{x^2}{1+x^7}dx$ to six decimal places

calculussolution-verification

Use a power series to approximate $\int_0^{.3} \frac{x^2}{1+x^7}dx$ to six decimal places

$\int_0^{.3} \frac{x^2}{1+x^7}dx$

Lets get this ready to substitute in a power series

$=\int_0^{.3} x^2 \frac{1}{1-(-x^7)}dx$

Lets substitute in a power series

$=\int_0^{.3} x^2 \sum_{n=0}^\infty (-1)^nx^{7n}dx$

Lets multiply in the $x^2$ term

$=\int_0^{.3} \sum_{n=0}^\infty (-1)^nx^{7n+2}dx$

Lets move the integral past the infinite sum

$=\sum_{n=0}^\infty \int_0^{.3} (-1)^nx^{7n+2}dx$

Now we integrate

$=\sum_{n=0}^\infty [(-1)^nx^{7n+3}\frac{1}{7n+3}]|_0^.3dx$

Now we evalute this, notice one of our points we evaluate at is $0$ so that whole term will be zero and thus we get:

$=\sum_{n=0}^\infty (-1)^n(.3)^{7n+3}\frac{1}{7n+3}$

This is an alternating series where $b_n = \frac{(.3)^{7n+3}}{7n+3}$

We can see that:

i) $b_{n+1} \leq b_n$

ii) $\lim_{n \rightarrow \infty} b_n = 0$

Thus we can use the alternating series estimation test.

Note that the second term of the sequences corresponds to when $n=1$

So we have:

$|R_1| \leq b_2 = \frac{(.3)^{14+3}}{14+3}=\frac{(.3)^{17}}{17} \cong 7.70(10^{-11})$

Wow… So the remainder after 2 terms is VERY small, and so we only need to add the first two terms together to get the series accurate up to 6 decimal places!! Note that adding up to $2$ terms means adding up when $n=0$ and $n=1$

$\sum_{n=0}^1 (-1)^n(.3)^{7n+3}\frac{1}{7n+3} = \frac{.3^3}{3} – \frac{3^{10}}{10} \cong .008999$

Best Answer

Too long for comments.

This is a very interesting problem almost if you are coding; not knowing in advance how many terms have to be added for a given accuracy, at the level of each summation, you need an IF test and this is an expensive operation in terms of computer resources.

Mabing the problem mode general, consider that you want to compute $$I=\int_0^t \frac {x^a}{1+x^b}\,dx \qquad \text{with}\qquad a\geq 0\qquad \text{and}\qquad b\geq 1$$ for an absolute error $\leq 10^{-k}$.

As you properly did, using the binomial expansion, we have $$\frac {x^a}{1+x^b}=\sum_{n=0}^\infty (-1)^n x^{a+n b}$$ Writing the result as $$I=\sum_{n=0}^p (-1)^n \frac{t^{a+b n+1}}{a+b n+1}+\sum_{n=p+1}^\infty (-1)^n \frac{t^{a+b n+1}}{a+b n+1}$$ since it is an alternatic series, we look for $p$ such that $$R_p=\frac{t^{a+b (p+1)+1}}{a+b(p+1)+1} \leq 10^{-k}$$ There is an explicit solution which is $$a+b (p+1)+1=-\frac{W\left(-10^k \log (t)\right)}{\log (t)}\implies p=\cdots$$ where $W(.)$ is Lambert function.

Applied to your problem $a=2$, $b=7$, $k=6$ and $t=\frac 3{10}$ , this gives

$$7p+10=\frac{W\left(10^6 \log \left(\frac{10}{3}\right)\right)}{\log \left(\frac{10}{3}\right)}\approx 9.59664 \implies p=-0.058 \quad (!!)$$

So, as you properly showed, a single term should be sufficient. Effectively $$R_1=\frac{\left(\frac{3}{10}\right)^{17}}{17}\approx 7.60 \times 10^{-11}\ll 10^{-6}$$

But, changing the problem to $k=60$ would give $$7p+10=\frac{W\left(10^{60} \log \left(\frac{10}{3}\right)\right)}{\log \left(\frac{10}{3}\right)}\approx 110.839 \implies p=14.4056 $$ So $\lceil p\rceil=15$. Ckecking $$R_{14}=3.13\times 10^{-59} >10^{-60} \quad \text{and}\quad R_{15}=6.43\times 10^{-62}< 10^{-60}$$

In the linked page, you will find simple formulae for the approximation of $W(x)$ when $x$ is large.