In
mathematics
Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented in modern mathematics ...
, Machin-like formulae are a popular technique for computing
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.
Machin-like formulas have the form
where
is a positive integer,
are signed non-zero
integer
An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign (−1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
s, and
and
are positive integers such that
.
These formulas are used in conjunction with the
Taylor series
In mathematics, the Taylor series or Taylor expansion of a function is an infinite sum of terms that are expressed in terms of the function's derivatives at a single point. For most common functions, the function and the sum of its Taylor serie ...
expansion for
arctangent:
Derivation
The
angle addition formula for arctangent asserts that
if
All of the Machin-like formulas can be derived by repeated application of equation . As an example, we show the derivation of Machin's original formula one has:
and consequently
Therefore also
and so finally
An insightful way to visualize equation is to picture what happens when two complex numbers are multiplied together:
:
::
The angle associated with a complex number
is given by:
:
Thus, in equation , the angle associated with the product is:
:
Note that this is the same expression as occurs in equation . Thus equation can be interpreted as saying that multiplying two complex numbers means adding their associated angles (see
multiplication of complex numbers).
The expression:
:
is the angle associated with:
:
Equation can be re-written as:
:
Here
is an arbitrary constant that accounts for the difference in magnitude between the vectors on the two sides of the equation. The magnitudes can be ignored, only the angles are significant.
Using complex numbers
Other formulas may be generated using complex numbers. For example, the angle of a complex number
is given by
and, when one multiplies complex numbers, one adds their angles. If
then
is 45 degrees or
radians. This means that if the real part and complex part are equal then the arctangent will equal
. 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. An example is
and
. If we multiply these out we will get
. Therefore,
.
If you want to use complex numbers to show that
you first must know that when multiplying angles you put the complex number to the power of the number that you are multiplying by. So
and since the real part and imaginary part are equal then,
Lehmer's measure
One of the most important parameters that characterize computational efficiency of a Machin-like formula is the Lehmer's measure, defined as
:
.
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. Nowadays at
the smallest known Lehmer's measure is
due to H. Chien-Lih (1997), whose Machin-like formula is shown
below. It is very common in the Machin-like formulas when all
numerator
A fraction (from la, fractus, "broken") represents a part of a whole or, more generally, any number of equal parts. When spoken in everyday English, a fraction describes how many parts of a certain size there are, for example, one-half, eight ...
s
Two-term formulas
In the special case where the numerator
, there are exactly four solutions having only two terms.
These are
Euler
Leonhard Euler ( , ; 15 April 170718 September 1783) was a Swiss mathematician, physicist, astronomer, geographer, logician and engineer who founded the studies of graph theory and topology and made pioneering and influential discoveries in ma ...
's:
:
Hermann's:
:
Hutton's (or Vega's
[):
:
and Machin's:
: .
In the general case, where the value of a numerator is not restricted, there are infinitely many other solutions. For example:
:
or
]
Example
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 of
the following calculation within the complex numbers
:
More terms
The 2002 record for digits of , 1,241,100,000,000, was obtained by Yasumasa Kanada
was a Japanese computer scientist most known for his numerous world records over the past three decades for calculating digits of . He set the record 11 of the past 21 times.
Kanada was a professor in the Department of Information Science at ...
of Tokyo University
, abbreviated as or UTokyo, is a public research university located in Bunkyō, Tokyo, Japan. Established in 1877, the university was the first Imperial University and is currently a Top Type university of the Top Global University Project by ...
. The calculation was performed on a 64-node Hitachi
() is a Japanese multinational corporation, multinational Conglomerate (company), conglomerate corporation headquartered in Chiyoda, Tokyo, Japan. It is the parent company of the Hitachi Group (''Hitachi Gurūpu'') and had formed part of the Ni ...
supercomputer
A supercomputer is a computer with a high level of performance as compared to a general-purpose computer. The performance of a supercomputer is commonly measured in floating-point operations per second ( FLOPS) instead of million instructions ...
with 1 terabyte of main memory, performing 2 trillion operations per second. The following two equations were both used:
:
: Kikuo Takano
was a Japanese poet and mathematician. He was born on Sado Island in 1927. He graduated from Utsunomiya Agricultural College in 1948.
He began to write poems from the day after Japan had ended its role in World War II. Being inspired from surrea ...
(1982).
:
: F. C. M. Störmer (1896).
Two equations are used so that one can check they both give the same result; it is helpful if the equations reuse some but not all of the arctangents because those need only be computed once - note the reuse of 57 and 239 above.
Machin-like formulas for can be constructed by finding a set of numbers where the prime factorisations of together use no more distinct primes than the number of elements in the set, and then using either linear algebra or the LLL basis-reduction algorithm to construct linear combinations of arctangents of reciprocals of integer denominator
A fraction (from la, fractus, "broken") represents a part of a whole or, more generally, any number of equal parts. When spoken in everyday English, a fraction describes how many parts of a certain size there are, for example, one-half, eight ...
s . For example, for the Størmer formula above, we have
:
:
:
:
so four terms using between them only the primes 2, 5, 13 and 61.
In 1993 Jörg Uwe Arndt found the 11-term formula:
:
using the set of 11 primes
Another formula where 10 of the -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. They are constructed by looking for numbers where is divisible only by primes less than 102.
The most efficient currently known Machin-like formula for computing is:
:
:(Hwang Chien-Lih, 1997)
where the set of primes is
A further refinement is to use "Todd's Process", as described in;[ this leads to results such as
:
:(Hwang Chien-Lih, 2003)
where the large prime 834312889110521 divides the of the last two indices.]
M. Wetherfield found 2004
:
More methods
There are further methods to derive Machin-like formulas for with reciprocals of integers. One is given by the following formula:[https://arxiv.org/pdf/2108.07718.pdf (2021)]
:
where
:
and recursively
:
and
:
and recursively
:
E.g., for and we get:
:
This is verified by the following MuPAD code:
z:=(10+I)^8*(84-I)*(21342-I)*(991268848-I)*(193018008592515208050-I)\
*(197967899896401851763240424238758988350338-I)\
*(117573868168175352930277752844194126767991915008537018836932014293678271636885792397-I):
Re(z)-Im(z)
0
meaning
:
Efficiency
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.
Let be the number of digits to which is to be calculated.
Let be the number of terms in the Taylor series
In mathematics, the Taylor series or Taylor expansion of a function is an infinite sum of terms that are expressed in terms of the function's derivatives at a single point. For most common functions, the function and the sum of its Taylor serie ...
(see equation ).
Let be the amount of time spent on each digit (for each term in the Taylor series).
The Taylor series will converge when:
:
Thus:
:
For the first term in the Taylor series, all digits must be processed. 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. Thus the total is given by:
:
The run time is given by:
:
Combining equations, the run time is given by:
:
Where is a constant that combines all of the other constants. Since this is a relative metric, the value of can be ignored.
The total time, across all the terms of equation , is given by:
:
cannot be modelled accurately without detailed knowledge of the specific software. Regardless, we present one possible model.
The software spends most of its time evaluating the Taylor series from equation . 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. Depending on the software used, this may be a very good approximation or it may be a poor one.
The unit of time is defined such that one step of the pseudo code corresponds to one unit. To execute the loop, in its entirety, requires four units of time. is defined to be four.
Note, however, that if is equal to one, then step one can be skipped. The loop only takes three units of time. is defined to be three.
As an example, consider the equation:
The following table shows the estimated time for each of the terms:
The total time is 0.75467 + 0.54780 + 0.60274 = 1.9052
Compare this with equation . The following table shows the estimated time for each of the terms:
The total time is 1.1191 + 0.8672 = 1.9863
The conclusion, based on this particular model, is that equation is slightly faster than equation , regardless of the fact that equation has more terms. This result is typical of the general trend. The dominant factor is the ratio between and . In order to achieve a high ratio, it is necessary to add additional terms. Often, there is a net savings in time.
References
External links
* {{MathWorld, urlname=Machin-LikeFormulas, title=Machin-like formulas
The constant π
at MathPages
Pi algorithms