Archimedes´ algorithm for the calculation of π

The simulation demonstrates the calculation of the unit circle circumference with the algorithm invented by Archimedes (287 − 221 BC). A regular polygon is inscribed to the circle, a second one is circumscribed. The circumference of the polygons can be calculated on basis of the Pythagoras theorem of rectangular triangles. The rest of the algorithm consists in drawing second roots, an art well known at that time.

The present simulation starts with squares (order n = 2, corners N = 2n = 4). A switch n+1 increases the order in steps of 1 from n = 2 to n = 12 .

The graph on the right shows the base construction of the first approximation step from square to octagon is drawn. Utilizing this drawing, it is easy to derive the formula for the inscribed polygon of the next higher order. You find the code on the page Initialization/Approximations of the EJS model to this simulation. For the 12th order (4096 corners) it is (with Math.sqrt = √ )

s = Math.sqrt(2.0-Math.sqrt(2.0+Math.sqrt(2.0+Math.sqrt(2.0

+Math.sqrt(2.0+Math.sqrt(2.0+Math.sqrt(2.0

+Math.sqrt(2.0+Math.sqrt(2.0+Math.sqrt(2.0+Math.sqrt(2.0)))))))))))

With increasing number of corners both polygons approach the circle quite quickly, and hence each other, too. Already the 32-polygons are difficult to distinguish visually.

The Reset button restores n = 2.

At the top of the windows 3 number fields show the circumference of the inscribed polygon (blue), the value (2π) of the unit circle (black), and the circumference of the circumscribed polygon (red). For n = 12 (N = 4096) they differ in the 6th decimal .

Knowing the triangle sides, it is easy to calculate the area of the triangles and as limit the area of the circle (πr2), with π for the unit circle.