[PYTHON] Why did Archimedes approximate pi: √3 by 265/153?

Introduction

It is said that Archimedes used 265/153 as an approximate value of √3 when calculating the approximate value of pi. [Wikipedia: History of Pi](https://ja.wikipedia.org/wiki/%E5%86%86%E5%91%A8%E7%8E%87%E3%81%AE%E6%AD % B4% E5% 8F% B2) I don't know why I used 265/153 now, but I tried to find out the necessity by examining how much 265/153 can approximate √3.

How to find √3 ≒ 265/153

Archimedes is believed to have calculated √3 step by step using the following inequality. Calculation of pi by Archimedes (2000)

a±\frac{b}{2a±1} < \sqrt{a^2+b} < a±\frac{b}{2a}\\

If you first put $ \ sqrt {3} = \ sqrt {2 ^ 2-1} $ and calculate, you will get the following.

\frac{5}{3} < \sqrt{3} < \frac{7}{4}\qquad①\\

Then pay the denominator 3 on the left side

5 <\sqrt{27} < \frac{21}{4} \\

As, if you put $ \ sqrt {27} = \ sqrt {5 ^ 2 + 2} $ and apply it to the inequality at the beginning, you will get 19/11, which is closer to $ \ sqrt {3} $ than 5/3. can do. (As the upper limit, 26/15, which is also closer than 7/4, is obtained.)

\frac{19}{11} <\sqrt{3} < \frac{26}{15}\qquad② \\

Furthermore, pay the denominator on the right side to make $ \ sqrt {15 ^ 2 × 3} = \ sqrt {26 ^ 2-1} $, and by performing the same calculation, it is closer than 19/11 as shown below 265 / You get 153.

\frac{265}{153} <\sqrt{3} < \frac{1351}{780}\qquad③\\

Meaning of finding √3 step by step

The story goes a little sideways, but the following questions arise about how to ask for ①②③ in stages. Question 1. Reasons to ask step by step Question 2. Will it approach √3 by seeking it in stages?

Regarding Question 1, since only the denominator on the right or left side and $ \ sqrt {3} $ are used at the stage of finding ①②③, it seems that there is no point in finding it step by step. Regarding Question 2, since the number to be multiplied by √3 in the middle is large at the stage of ①②③, by increasing $ n $ with $ \ sqrt {n ^ 2 × 3} \ quad $, $ \ bigl (a ± \ frac {b} {2a ± 1} \ bigr) ÷ n \ quad $ $ \ bigl (a ± \ frac {b} {2a} \ bigr) ÷ n \ quad is $$ \ sqrt It seems that it is approaching {3} $.

If you actually draw $ \ bigl (a ± \ frac {b} {2a ± 1} \ bigr) ÷ n $ by changing it to $ n = 1,2,3, \ cdots, 1000 $, then $ \ sqrt {3 It looks like it will converge to} $. (The code that drew the figure is included in the supplement) キャプチャ.JPG

How close 265/153 is to √3

This is the main subject. I tried to find out how close 265/153 is to $ \ sqrt {3} $ as follows (it is a brute force). (1) While increasing the denominator to $ 1,2,3, \ cdots, 100000 $ (2) Find an integer smaller than the denominator × $ \ sqrt {3} $ for the numerator (find a rational number smaller than $ \ sqrt {3} $) (3) Compare the 10 digits including the decimal point of the numerator ÷ denominator with the 10 digits including the decimal point of $ \ sqrt {3} $. (4) Find the lowest common denominator and numerator with long matching digits

python


import math
def numberDigits(n):
    r3 = str(int(math.sqrt(3)*10**10))
    a3 = str(int(n*10**10))
    for k in range(11):
        if r3[k] == a3[k]: continue
        else: break
    return k

python


N = 100000
T = [0 for n in range(11)]

for n in range(2,N):
    h = int(n*math.sqrt(3))
    k = numberDigits(h/n)
    if T[k] == 0: T[k] = n

python


for n in T:
    if n > 1:
        h = int(n*math.sqrt(3))
        k = numberDigits(h/n)
        print(str(h) + "/" + str(n) + " : " + str(k))

The above execution result is as follows. キャプチャ2.JPG

at the end

For Archimedes, I think that 265/153 has a certain degree of accuracy (5 digits) and is a moderately large number for calculating pi. When actually calculating the pi, there is a square calculation (see: Archimedean and pi), and from the point of view of the amount of calculation I imagine that it was a moderate size.

Supplement

python


import math
def r3n(a, b, n):
    return [n, (a-b/(2*a-1))/n, (a-b/(2*a))/n]
def r3p(a, b, n):
    return [n, (a+b/(2*a+1))/n, (a+b/(2*a))/n]
N = 1000
T = []
for n in range(1, N):
    a = int(math.sqrt(3*n**2))
    if (3*n**2 - a**2) > ((a+1)**2 - 3*n**2):
        a = a+1
        b = a**2 - 3*n**2
        T.append(r3n(a, b, n)) 
    else:
        b = 3*n**2 - a**2
        T.append(r3n(a, b, n))

python


R3 = []
for n in range(1, N):
    R3.append([n, math.sqrt(3)])

python


import pandas as pd
df = pd.DataFrame(data=T, columns=['number', 'lower', 'upper'])
df2 = pd.DataFrame(data=R3, columns=['number', 'value'])
plt.figure(figsize=(16,4))
plt.plot(df['number'], df['lower'], color = 'green')
plt.plot(df2['number'], df2['value'], color = 'red')
plt.show()

Recommended Posts

Why did Archimedes approximate pi: √3 by 265/153?
About approximate fractions of pi