Approximating $\pi$ to $6$ decimal places using Taylor polynomials plural

calculusreal-analysistaylor expansion

So I was thinking about this question and I came up with the question below.

Use the fact that $4\tan^{-1}(\frac{1}{5}) – \tan^{-1}(\frac{1}{239})= \frac\pi4$ and Taylor polynomials to approximate $\pi$ to $6$ decimals of accuracy. Include error estimates.

Here's my work.

The given equality is equivalent to $16\tan^{-1}(\dfrac{1}{5})-4\tan^{-1}(\dfrac{1}{239})=\pi.$ Also, we have that $|\pi -(16P_{n,0}(\dfrac{1}{5})-4P_{n,0}(\dfrac{1}{239}))|\leq |16\tan^{-1}(\dfrac{1}{5})-16P_{n,0}(\dfrac{1}{5})|+|4\tan^{-1}(\dfrac{1}{239})-4P_{n,0}(\dfrac{1}{239})|.$

We consider the errors separately. Let $f(x) = \tan^{-1}(x)$. Then by Taylor's Theorem, $16|\tan^{-1}(1/5)-P_{n,0}(1/5)|\leq \dfrac{16\cdot\displaystyle\max_{0\leq z \leq 1/5}\{|f^{(n+1)}(z)|\}}{(n+1)!}(1/5-0)^{n+1}.$ We want this error to be smaller than $5\cdot 10^{-7}.$ We can compute the Taylor series for $\tan^{-1} x$ centred at $x=0$ as follows: $\dfrac{d}{dx}\tan^{-1} (x) = \dfrac{1}{1+x^2} = \displaystyle\sum_{i=0}^\infty (-1)^i x^{2i}.$ Hence $\tan^{-1} (x) = \displaystyle\int \dfrac{d}{dx} \tan^{-1} (x)dx = \displaystyle\sum_{i=0}^\infty (-1)^i\dfrac{x^{2i+1}}{2i+1}.$

Hence the error can be simplified to $16\cdot\dfrac{(1/5)^{2n+3}}{2n+3}.$ The smallest possible value for which this is less than $5\cdot 10^{-7}$ is $n=4,$ in which case the error is smaller than $3\cdot 10^{-8}.$

We know proceed with the other value $4|\tan^{-1}(\dfrac{1}{239})-P_{n,0}(\dfrac{1}{239})| \leq 4\cdot\dfrac{(1/239)^{2n+3}}{2n+3}.$ The smallest value of $n$ for which this error is smaller than $5\cdot 10^{-7}$ is $1.$ So for this problem, the minimum value of $n$ for which the sum of both errors is less than $5\cdot 10^{-7}$ is $4.$

Hence, the desired approximation is $16P_{4,0}(\dfrac{1}{5}) – 4P_{4,0}(\dfrac{1}{239})\\
=16(0.2-\frac{0.2^3}{3}+\frac{0.2^5}{5} – \frac{0.2^7}{7}+\frac{0.2^9}{9}) – 4(\frac{1}{239}-\frac{1}{239^3}\cdot\frac{1}{3}+\frac{1}{239^5}\cdot\frac{1}{5}-\frac{1}{239^7}\cdot\frac{1}{7}+\frac{1}{239^9}\cdot\frac{1}{9})\approx 3.141593.$

Best Answer

Do as you mention and center the Taylor series at $0$. Look at it once with $x=1/5$, and again with $x=1/239$, and combine the two results. When you look at it with $x=1/5$, you may need to look at a higher degree Taylor polynomial to get six decimal places of accuracy than you do when you look at it with $x=1/239$. In that sense, you will be looking at Taylor polyonomials plural.