Pterodattilo logo

Pterodattilo

 
  HOME  

Calculating PI

PI logo

Introduction

The first attempts to calculate PI dated back to Greeks and exploit the following inequalities:

inscribed circuscribed polygon inequality

where pn and Pn are perimeters of inscribed and circumscribed n side polygons respectively, while C is the circumference of a circle of radius r.
It lead to knowledge of PI with about 35 digits.

Then PI calculations adopted techniques independent from circle, with the introduction of calculus and analytical geometry (17th century) first, and of series (late 17th century) then.

Research on further PI digits went on reaching > 100 digits.

In 1761, the mathematician Lambert (1728-1777) proved that  PI is an irrational number.
In 1882, Lindenman proved that PI is a transcendental number

With the introduction of computers PI could be calculated up to million of digits and another result was achieved: up to now, digits composing PI appear randomly distributed.
Johann Heinrich Lambert (1728-1777)
Johann Heinrich Lambert (1728-1777)


Ferdinand von Lindemann (1852-1939)
Ferdinand von Lindemann (1852-1939)

John Machin (1680-1751)
John Machin (1680-1751)


 


References

PI on Wikipedia

Calculating PI, with computer or pencil

John Machin on Wikipedia

Milan Milanovic interesting page on PI and Machin Formula

Archimede's constant p


Machin formula

This method uses a series expansion as in 17th century mathematicians attempts but exploits the obvious advantages of having a computer.

Let's start writing the series expansion of arctg:
arctg(x) series expansion

but since
arctg(1) is PI/4

we have:
pi as the result of a series

The biggest defect of this series expansion is that it converges very slowly, to get 3 digits one must calculate up to k > 2000.
To speed up calculations you can notice that the arctg series expansion converges rapidly if |x| < 1.
Thus we arrive to the Machin formula:
Machin Formula

which is expanded into series as follows:
PI by series expansion of Machin Formula

to speed up calculation is better to use powers of form k+1 which are directly calculated from previous iterations. This can be achieved by multiplication of the two elements being subtracted by 5 / 5 and 239 / 239. This leads to
PI by series expansion of Machin Formula (fast)

When to stop

How far should we go calculating the series to reach n figures in PI calculations?
The idea is that if we want PI with a precision of n figures, then we must ensure that the kth element of the sum must not alter the PI digit n places to the right of the comma.
Thus, since the kth element of the sum is:
kth element of the series

it is straightforward to understand that the most significant addendum is the first.
Thus we can write our condition as
When to stop calculating PI

and since the left term is always less than 100 we arrive at the following
When to stop calculating PI: last element to calculate

(logarithm is base 10).