MAPLE output for calculating Pi using the Machin Method of 16*arctan(1/5) - 4*arctan(1/239).

Note: This method is based on the Gregory-Leibniz method discussed in a separate worksheet (Calculating Pi by 4*arctan(1)), although this version should converge much faster because we are using smaller x's that are closer to the center of the interval of convergence for the arctan(x) Power Series.

We know that 4*arctan(1/5) - arctan(1/239) = Pi/4.

> 16*arctan(1/5) - 4*arctan(1/239); evalf(%);

16*arctan(1/5)-4*arctan(1/239)

3.141592653

So, we can get Pi by the Power Series for 16*arctan(1/5) - 4*arctan(1/239). (The derivation of the power series for arctan(x) is shown in the 4*arctan(1) worksheet).

The 4th order Taylor Series for the Machin Method looks like this:

> taylor(16*arctan(x), x=0, 5)-taylor(4*arctan(x), x=0, 5);

(series(16*x-16/3*x^3+O(x^5),x,5))-(series(4*x-4/3*...

Let's evaluate that at the proper x values (1/5 and 1/239, respectively):

> evalf(subs(x=1/5, mtaylor(16*arctan(x), x=0, 5)) - subs(x=1/239, mtaylor(4*arctan(x), x=0, 5)));

3.140597029

Here are some higher order evaluations:

> evalf(subs(x=1/5, mtaylor(16*arctan(x), x=0, 7)) - subs(x=1/239, mtaylor(4*arctan(x), x=0, 7)));

3.141621029

> evalf(subs(x=1/5, mtaylor(16*arctan(x), x=0, 9)) - subs(x=1/239, mtaylor(4*arctan(x), x=0, 9)));

3.141591772

Now, we can take a look at error also:

> evalf(subs(x=1/5, mtaylor(16*arctan(x), x=0, 11)) - subs(x=1/239, mtaylor(4*arctan(x), x=0, 11))); evalf(Pi-%);

3.141592682

-.28e-7

> evalf(subs(x=1/5, mtaylor(16*arctan(x), x=0, 13)) - subs(x=1/239, mtaylor(4*arctan(x), x=0, 13))); evalf(Pi-%);

3.141592653

.1e-8

> evalf(subs(x=1/5, mtaylor(16*arctan(x), x=0, 15)) - subs(x=1/239, mtaylor(4*arctan(x), x=0, 15))); evalf(Pi-%);

3.141592654

0.

Here, we see that using only the 14th order Taylor Series, we have Pi correct to 9 places (and this method ran very fast on MAPLE in terms of computation time, much quicker than any of the other methods tried previously).