# Approximating the value of an integral to six decimal places using a power series

The problem is to use a power series to evaluate the integral to six decimal places. The upper limit of integration is one and the lower limit of integration is zero.

To start the problem I factored $x$ out and focused on $\arctan(3x)$. I knew that by taking the derivative I could get this equation in the form $\frac{1}{1-r}$. After I put it in that form I integrated and solved for $c$. I then put $x$ back into the equation and integrated.

Is this effective method for solving this problem? I determined that the 19th term would give me an answer to the sixth decimal place is this correct?

You method is good. Although, I think at the beginning you lost some exponents that were supposed to be even; an $x^{2n}$ that became $x^n$. As a consequence some of the coefficients and exponents are not right.

I would have probably computed the primitive $$g(x)=\frac{1}{18}((9x^2 + 1)\arctan(3 x) - 3 x)$$

And then spend all the effort of approximation on the evaluating $g(0.1)$. Fortunately, $g(0)=0$.

The Taylor series of $$\arctan(3x)=\sum_{n=0}^{\infty}(-1)^n3^{2n+1}\frac{x^{2n+1}}{2n+1}$$ is alternating for $x>0$. That means that we even have good control on the error after truncation. The error is bounded by the absolute value of the next term after the truncation evaluated at $0.1$.

If you impose that $(0.3)^{2n+1}/(2n+1)<10^{-7}$, that ensures that at least the error of approximating $\arctan(0.1)$ is going to be small enough.

After geometryfan's answer, writing $$\arctan(3x)=\sum_{n=0}^{p-1}(-1)^n\frac{(3x)^{2n+1}}{2n+1}$$ you search $p$ such that, for a given value of $x$ $$\frac{(3x)^{2p+1}}{2p+1} \leq \epsilon$$ For simplicity, let $3x=a$ and $2p+1=k$.
The solution of $a^k=\epsilon\,k$ is given in terms of Lambert function $$k=-\frac{W\left(-\frac{\log (a)}{\epsilon }\right)}{\log (a)}$$
Since the argument is large, you can approximate the value of $W(z)$ using the expansion given in the linked page $$W(z)=L_1-L_2+\frac{L_2}{L_1}+\frac{L_2(-2+L_2)}{2L_1^2}+\cdots$$ where $L_1=\log(z)$ and $L_2=\log(L_1)$.
Applied to the case of $a=0.3$, this would give $$\left( \begin{array}{ccc} \epsilon & k & p \\ 10^{- 1} & 1.54727 & 1 \\ 10^{- 2} & 2.93722 & 1 \\ 10^{- 3} & 4.49314 & 2 \\ 10^{- 4} & 6.14396 & 3 \\ 10^{- 5} & 7.85188 & 4 \\ 10^{- 6} & 9.59722 & 5 \\ 10^{- 7} & 11.3688 & 6 \\ 10^{- 8}& 13.1596 & 7 \\ 10^{- 9} & 14.9652 & 7 \\ 10^{- 10} & 16.7825 & 8 \\ 10^{- 11} & 18.6091 & 9 \\ 10^{- 12} & 20.4435 & 10 \\ 10^{- 13} & 22.2844 & 11 \\ 10^{- 14} & 24.1307 & 12 \\ 10^{- 15} & 25.9818 & 13 \end{array} \right)$$ Checking for $p=13$, we have $\frac {0.3^{27}}{27} \approx 2.82 \times 10^{-16} < 10^{-15}$ while $\frac {0.3^{25}}{25} \approx 3.39 \times 10^{-15} > 10^{-15}$.