Quick python script to calculate Pi as Archimedes did it manually
The constant ratio between the circumference and diameter of every circle in this universe
By approximation, starting with a hexagon (6 sides) within a circle
Assuming the hexagon having side length of 1
Circumference of hexagon = 1 * 6 = 6
Diamater of hexagon/circle = 1 * 2 = 2
Hence ratio π > 6/2 = 3. (why greater? as hexagon hasn't completely covered the whole area in the circle)
Note : The 12 sided polygon covers more area of the circumference and hence Pi gets more accurate as we keep increasing the number of sides of the polygon
We need to calculate the line segment DE to get closer to the circumference of the circle
Naming the FD line segment can be called as S
Naming MN line segment as d
Using pythagoras, we get length of d to be
But what we need is the length of a
Finally now X can be described as
N - Number of Sides = 6
S - Length of Side = 1
New S (which is X basically) = = 0.52
New length of side when polygon sides are doubled
Perimeter = 6
N = 12
S = 0.52 (From previous calculation)
and rest values follow the same above approach
import math
N = float(6)
S = float(1)
#Iterating uptil N is 96 sides
for i in range(2,7):
d = math.sqrt(1 - pow(S/2,2))
a = 1 - d
NewS = math.sqrt(pow(a,2) + pow(S/2,2))
Perimeter = float(N * S)
Pi = Perimeter/2
print(Pi)
S = NewS
N = N*2.0
The results we get are as follows
3.0
3.10582854123
3.13262861328
3.13935020305
3.14103195089