# A Wolfram Notebook Playing with Machin-Like Formulas

This notebook explores a class of interesting identities for the famous mathematical constant π (i.e. ...) involving the arctangent/cotangent functions. Such identities are attractive in their own right, have an interesting history and also continue to hold new surprises. Here, we use the Wolfram Language to explore some well-known classical properties of such identities, as well as to compute and explore a whole family of very recently discovered beautiful identities of this type.

π3.14159

## Machin and Machin-Like Formulas

Machin and Machin-Like Formulas

Machin’s formula is a particular identity for π as a sum of integer multiples of arccotangents having integer arguments:

π

4

-1

cot

-1

cot

This formula was discovered by John Machin in 1706 and used by him to compute π to 100 decimal places. Clearly, Machin’s formula can also be expressed instead using arctangents as:

π

4

-1

tan

1

5

-1

tan

1

239

Both of these identities are readily verified by the Wolfram Language, as can be seen by :

clickinginthecode,thenholdingandpressingtorunit

In[1]:=

4ArcCot[5]-ArcCot[239],4ArcTan-ArcTan

π

4

π

4

1

5

1

239

Out[1]=

{True,True}

## Generalized Machin-Like Formulas

Generalized Machin-Like Formulas

Given the existence of Machin’s formula, it is natural to ask if other such formulas exist. In fact, there turn out to be exactly four two-term identities of this shape in which the multipliers of the arctangents are nonzero integers and the arguments of the arctangents are inverse positive integers. The most famous of these is the following identity:

In[2]:=

π

4

1

2

1

3

Out[2]=

True

... which was discovered by Euler.

Further generalizing to arbitrary numbers of terms and allowing the arguments and coefficients to be rational—as opposed to just integers—gives so-called Machin-like formulas, and allowing argument numerators and/or denominators to be mixed quadratic surds gives a further extension that could be termed “generalized Machin-like formulas.” Many (generalized) Machin-like formulas exist; here is a selection from Wolfram|Alpha:

In[3]:=

WolframAlpha["Machin-like formulas",IncludePods"NamedMathematicalFormulas",AppearanceElements{"Pods"},InputAssumptions{"*C.Machin%21-like+formulas-_*MathematicalFunctionIdentityPropertyClass-"}]

Out[3]=

## Discovering Machin-Like Formulas

Discovering Machin-Like Formulas

“Discovering” Machin-like formulas can be automated, either by rewriting arctangents or purely numerically. The following small piece of code uses the function FindIntegerNullVector to find such formulas for unit fractions:

Here are some examples of its output:

## New Discoveries

New Discoveries

To begin, let’s implement some of the new identities from the preprint. If we define the functions c and γ from page 3:

... π/4 may then be expressed as:

... for every natural number k by means of nested radical expressions that resemble Vieta’s 1593 expression for π. For example:

Note that the inverses of the arguments to the arctangent functions form an increasing sequence:

Following equation 4 from the preprint, we define:

For example:

The Lehmer measure of a (generalized) Machin-like identity gives the efficiency of the formula for calculating π, and is given by the sum of the (base 10) logarithms of arccotangent denominators:

The Lehmer measure of the previous best Machin-like formula is about 1.51:

However, the Lehmer measure of our new identities can be made much smaller:

Here is a log plot of the size of the argument of the first arctangent, which decreases exponentially with increasing k:

This means that for large k, the first term is an excellent approximation of π/4:

For the following computations, symbolic expressions will be generated that cannot be numerically distinguished from 0 using the default setting in the Wolfram Language. As a result, we increase the maximum number of extra digits of precision to be used internally to resolve such expressions:

... approximates π/4 to more than 300 digits:

In fact, just retaining the linear term in the series approximation of the arctangent function:

... in the above expression gives a rational number:

... having more than 300 correct digits for π/4:

Here is a table of the size of the denominators of the two arctangent functions. The first one is always an integer. To avoid large rational numbers, we show the numerical value of the second denominator:

Here is a plot of the quality of the rational approximation versus the best approximation for a given denominator: