Calculating error for $\pi$ in an expansion

138 Views Asked by At

I have the following equation: $\quad\pi = 4\arctan(1/2) + 4\arctan(1/3).$

I want to calculate how many terms of the expansion ($n$) I have to calculate in order for the error to be less than $10^{-10}$.

I have an idea for the method to be used:

Taking the power series of $\arctan(x)$ and using the remainder integral of the form $$R_n \;=\; \int\frac{{(-1)^n t^{2n}}}{1+t^2}\,dt.$$

So I want the sum of the two remainders from the expansion of each $\arctan(x)$ to be $<$ $\frac{10^{-10}}{4}$.

$$\int_0^{1/2}\frac{{(-1)^n t^{2n}}}{1+t^2}\,dt \;+\; \int_0^{1/3}\frac{{(-1)^n t^{2n}}}{1+t^2}\,dt\;<\; \frac{10^{-10}}{4}.$$

Now to solve this, I can't do without making approximations since $t^{2n} > \frac{{(-1)^n t^{2n}}}{1+t^2}$ on my intervals; I approximate using this, getting $$\int_0^{1/2}t^{2n}\,dt \;+\; \int_0^{1/3}t^{2n}\,dt.$$

Evaluating, I get $$\frac{(1/2)^{2n+1}}{2n+1} + \frac{(1/3)^{2n+1}}{2n+1} < \frac{10^{-10}}{4}.$$

I have no idea how to solve this. Would I make another approximation? Or is my method completely wrong to start with.

Edit: After making some huge approximations i.e. getting rid of the $2n+1$'s on the denominator and setting $1/3$ to be $1/2$, I got that $2n+1 =36.$ However, I am not sure whether this is correct.

2

There are 2 best solutions below

2
On BEST ANSWER

As the Taylor expansion of $\arctan=\sum _{n=1}^{\infty } \frac{(-1)^{n+1} x^{2 n-1}}{2 n-1}$ is an alternating series, the error is less than the abs value of the first term neglected, that is equivalent to find an $n$ such that $$\frac{4 \left(\frac{1}{2}\right)^{2 n-1}}{2 n-1}+\frac{4 \left(\frac{1}{3}\right)^{2 n-1}}{2 n-1}=\frac{1}{10^{10}}$$ Using Mathematica I got an approximated value of $n=16$. Indeed $$4 \sum _{n=1}^{16} \frac{(-1)^{n+1} \left(\frac{1}{2}\right)^{2 n-1}}{2 n-1}+4 \sum _{n=1}^{16} \frac{(-1)^{n+1} \left(\frac{1}{3}\right)^{2 n-1}}{2 n-1}\approx 3.14159 265357$$ While $\pi\approx 3.14159265358$.

Error is $1.14\times10^{-11}<10^{-10}$

0
On

Making the problem more general, you want to find $n$ such that $$R_n=\frac{4 \left(\frac{1}{2}\right)^{2 n-1}}{2 n-1}+\frac{4 \left(\frac{1}{3}\right)^{2 n-1}}{2 n-1}\leq{10^{-k}}$$ $$\frac{8 \left(\frac{1}{3}\right)^{2 n-1}}{2 n-1} < R_n <\frac{8 \left(\frac{1}{2}\right)^{2 n-1}}{2 n-1}$$ So, let us try to find the solution for $$\frac{8\, x^{2 n-1}}{2 n-1}\leq{10^{-k}}\implies2n-1 \geq 8 \,x^{2 n-1}\, 10^k$$ The only explicit solution is $$n=\frac{1}{2} \left(1-\frac{W\left(-8\, 10^k \log (x)\right)}{\log (x)}\right)$$ where $W(.)$ is Lambert function.

For your case $(k=10)$ : with $x=\frac 12$, it gives, as a real, $n=16.1267$ and for $x=\frac 13$, it gives $n=10.5598$. In fact, using algebra, the exact value would be $15.6491$