In mathematics, Machin-like formulas are a popular technique for computing π (the ratio of the circumference to the diameter of a circle) to a large number of digits.
They are generalizations of John Machin's formula from 1706: which he used to compute π to 100 decimal places.
All of the Machin-like formulas can be derived by repeated application of equation 3.
is an arbitrary constant that accounts for the difference in magnitude between the vectors on the two sides of the equation.
Since the arctangent of one has a very slow convergence rate if we find two complex numbers that when multiplied will result in the same real and imaginary part we will have a Machin-like formula.
One of the most important parameters that characterize computational efficiency of a Machin-like formula is the Lehmer's measure, defined as[4][5] In order to obtain the Lehmer's measure as small as possible, it is necessary to decrease the ratio of positive integers
in the arctangent arguments and to minimize the number of the terms in the Machin-like formula.
[7][8] All four were found by John Machin in 1705–1706, but only one of them became widely known when it was published in William Jones's book Synopsis Palmariorum Matheseos, so the other three are often attributed to other mathematicians.
For example: or The adjacent diagram demonstrates the relationship between the arctangents and their areas.
From the diagram, we have the following: a relation which can also be found by means ofthe following calculation within the complex numbers The 2002 record for digits of π, 1,241,100,000,000, was obtained by Yasumasa Kanada of Tokyo University.
Machin-like formulas for π can be constructed by finding a set of
For example, in the Størmer formula above, we have so four expressions whose factors are powers of only the four primes 2, 5, 13 and 61.
In 1993 Jörg Uwe Arndt[12] found the 11-term formula: using the set of 11 primes
-arguments are the same as above has been discovered by Hwang Chien-Lih (黃見利) (2004), so it is easier to check they both give the same result: You will note that these formulas reuse all the same arctangents after the first one.
The most efficient currently known Machin-like formula for computing π is: where the set of primes is
A further refinement is to use "Todd's Process", as described in;[5] this leads to results such as where the large prime 834312889110521 divides the
M. Wetherfield found 2004 In Pi Day 2024, Matt Parker along with 400 volunteers used the following formula to hand calculate
we get: This is verified by the following MuPAD code: meaning For large computations of π, the binary splitting algorithm can be used to compute the arctangents much, much more quickly than by adding the terms in the Taylor series naively one at a time.
In practical implementations such as y-cruncher, there is a relatively large constant overhead per term plus a time proportional to
, and a point of diminishing returns appears beyond three or four arctangent terms in the sum; this is why the supercomputer calculation above used only a four-term version.
It is not the goal of this section to estimate the actual run time of any given algorithm.
Instead, the intention is merely to devise a relative metric by which two algorithms can be compared against each other.
be the amount of time spent on each digit (for each term in the Taylor series).
In the last term of the Taylor series, however, there's only one digit remaining to be processed.
In all of the intervening terms, the number of digits to be processed can be approximated by linear interpolation.
cannot be modelled accurately without detailed knowledge of the specific software.
The software spends most of its time evaluating the Taylor series from equation 2.
The primary loop can be summarized in the following pseudo code: In this particular model, it is assumed that each of these steps takes approximately the same amount of time.
To execute the loop, in its entirety, requires four units of time.
In order to achieve a high ratio, it is necessary to add additional terms.