### Search

 Search WWW Search DelphiForFun.org

As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.

Support DFF - Shop

If you shop at Amazon anyway,  consider using this link.

We receive a few cents from each purchase.  Thanks

### Support DFF - Donate

If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa® Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

(Hint: If you can wait, current year calendars are usually on sale in January.)

### Contact

 Search DelphiForFun.org only

### Problem Description

Archimedes made significant contribution to mathematics when he developed an iterative method for calculating the value of   Pi with greater precision than then existed.  This program satisfies my curiosity about how he did it.

### Background & Techniques

Here is an illustrated description of Archimedes' method for estimating Pi developed a couple of hundred years BC. Starting with super-scribed and inscribed hexagons for a given circle, he calculated the perimeters and used the ratio of each perimeter to the diameter of the given circle as an estimate of Pi. Since the circumscribed perimeter will be larger than the circumference of the circle, the derived estimate of Pi will be too large. Similarly the inscribed perimeter will be too small and produce a low estimate. As the number of sides increases, the two estimates converge towards Pi.

Archimedes started with what was probably the largest number of sides for which he knew the actual ratio of the side lengths to the diameter, a hexagon. He then cleverly derived the ratios for 12 sided regular polygons and
epeated the same logic for 24, 48, and 96 sided polygons. Most current explanations of Archimedes procedure, cheat and use trigonometry but here we'll do it the way Archimedes did it using only algebra and geometry. The English translation of Proposition 3 in "The Measure of a Circle" used here is from "The Works of Archimedes" translated from Greek by T.L. Heath and published in 1897. A free download is available from the link below.

After 4 iterations, Archimedes determined that the true value of Pi was greater than 3 10/70 and less that 3 10/71. Decimal terminology had not yet been developed so he used rational fraction estimates for irrational values, starting with estimates for the square root of 3, but making sure that the error introduced only made his estimate worse than if he could have used the true value. Pretty smart fellow!

In the tabs above, I'll try to describe the "clever" part in getting from the known perimeter of the hexagon to the perimeter of the 12 sided polygon. Actually, he only needed to concentrate on the length of one side and what happens to side lengths if we bisect N sides to create a polygon with 2N sides. The technique for interior and exterior side lengths both use Euclid's Angle Bisector Theorem: "The angle bisector any angle in a triangle divides the opposite side in the same ratio as the sides adjacent to the angle." It is from Euclid's Book VI, Proposition 3 and, as heath did, we'll refer to it as EUCL VI.3 in the following explanations. Archimedes tended to omit intermediate steps and explanations in his proofs. Heath added some explanatory text in his translation and I added a bit more where the rational was not clear to a jack-leg "mathematician" such as myself :>).

Each click of the "Next Polygon" button will show the next doubling of the original 6 sided circumscribed and inscribed polygons here. Two additional pages will describe the logic used to derive the interior and exterior side lengths.

##### Circumscribed Detail

On this page, I'll follow Archimedes' derivation of the Pi estimate for circumscribed polygons.  Heath placed his explanations in [ ] brackets which I have tried to retain. I've added more explanation for the parts that weren't as obvious to me as they must have been to Archimedes and Heath.

For the exterior hexagon, he considers the triangle formed by connecting point O, the circle's center to point A, the point of tangency of a side, to point C, the end of that side. He knows that angle AOC is 1/3 of a right angle (30 degrees to us). He also knows that, for such a triangle (which we commonly call a 30-60-90 triangle),

Archimedes then says:

(1) the ratio of OA:AC [= sqrt(3):1] >265:152 and
(2) the OC:AC ratio i[= 2:1] = 306:153.

Me: From this we can derive an estimate of Pi as the perimeter divided by the diameter (twice the length of OA ) or 12*AC/(2*OA) = 6*(AC/OA)=6*1/sqrt(3)=3.464 or, for Archimedes since decimal notation did not yet exist, six times the ratio of the radius to the semi-perimeter = 6*265/153. We'll use this same concept to track the values for the rest of the exercise.

Archimedes:  First, draw OD bisecting the angle AOC and meeting AC in D.

Me: Draw line OD bisecting angle AOC at point D {so that now AD represents half the length of one side of a 12 sided polygon.

Archimedes:
Now CO:OA=CD:DA [By EUCL VI.3]
So that [(CO+OA):OA = CA:DA or]
(CO+OA):CA = OA:DA

Me: I had to step through it this way:

CO/OA=CD:DA
CO/OA+1 = CD/DA +1
==> CO/OA+OA/OA = CD/DA + DA/DA
==> (CO+OA)/OA = (CD+DA)/DA
==> [(CO+OA)/OA = CA/DA]
Multiply both sides of the above by OA/CA to get
==> (CO+OA):CA = OA:DA

Archmedes: Therefore [by (1) and (2)] OD/DA > 571/153 (3)

Me: The estimate for Pi, for the 12 sided polygon, if A. had bothered to record it, is

Archimedes:
> 349350/23409,

So that OD/DA > 591 1/8 / 153 (4)

Me: We now have a ratio for the triangle AOD which we can bisect again, giving Archimedes' point E for the 24 sided polygon and giving an OA/AE ratio of 1162.125/153 and a Pi estimate of 24*153/1162.125=3.160.

Similarly Archimedes uses AOE to calculate AOF for the 48 sided case, he gets 2334 1/4 : 153 and we can calculate Pi < 153*48/2334.25 = 3.1462.

An finally, from AOG, the 96 side case, he gets 4673 1/2 : 153 and Pi < 153*96/4673.5 = 3.1428 which he expresses as 3 1/7.

##### Inscribed Detail

Calculating Pi estimates for the inscribed polygons seemed trickier than for circumscribed. Again, I'll expand the Archimedes proof to add my explanations of things which may not be obvious to us mere mortals.

Archimedes: Let AB be the diameter of a circle and let AC meeting the circle at C make the angle CAB equal to one third of a right angle. Join BC.

Then AC:CB [sqrt(3):1)] < 1351 :780.

Me: This time the estimate of sqrt(3) is less than the true value so we can be sure that it does not make the estimate, which will always be low, closer than the rest of the mathematics indicate.

We can make our first estimate of Pi from the known ratios From the given triangle; we know that the ratio of the diameter (AB) to one side of the hexagon (CB) is 1/2 or so our initial (low) estimate of the value of Pi is 6/2 or 3.00.

Archimedes: First let AD bisect the angle BAC and meet BC in d and the circle in D. Join BD.

Then angle BAD = angle dAC = angle dBD and the angles at D and C are both right angles.

It follows that the triangles ADB [ACd], and BDd are similar.

Me: BAD = dAC by construction . Angles at D and C are right angles because they are angles inscribed in a semicircle which are always right angles. (Search Web for "angle inscribed semicircle" for many proofs). The vertical angles at d are equal. So angle dAC = 180-90-Cda = 180-90-DdB = DBd, The three triangles are simlar all have the same three angle values so are similar by definition.

Archimedes:

Therefore AD : DB = BD : Dd [=AC : Cd] =AB : Bd [Eucl. VI.3] = AB + AC : Bd + Cd = AB + AC : BC or BA + AC : BC = AD : DB

Me: It might be obvious to geometers, but it wasn't clear to me that if AC:Cd=AB:Bd then it also true that AC:Cd = (AB+AC):(Cd+Bd). Here's my proof:

AC/Cd=AB/Bd = some constant, k. Then AC= k*Cd and AB = k*Bd. Adding these equations, we get AC+AB=k*Cd+k*Bd, so AC+AB= k*(Cd+Bd) and (AC+AB)/(Cd+Bd)=k. ===> (AC+AB) : (Cd+Bd) = k = AC:Cd

Archimedes: But AC:CB < 1351:750 from above while BA:BC = 2:1 = 1550:780

Therefore AD:DB < 2911 : 780 (1) [Hence sqr(AB):sqr(BD) < sqr(2911) + sqr(780) : sqr(780) < 9082321:608400] Thus AB:BD < 3013 3/4: 780 (2)

Me: This is enough to give us our estimate for the 12 sided incribed polygons. Because AB is the hypotenuse of right triangle ABD, AB:DB less than the calculated value 3013 3/4:780 and Pi > 12* (780/3013.75) = 3.1057

Now the hard thinking is done and with the help of a calculator or computer, even most of the work is done. Archimedes bisects DAB with AE to get the 24 sided ratios. AB:BE < 1838 9/11: 240 (4) giving the 24 sided case estimate: Pi > 24*(240/1838.818) = 3.1325. Similarly

48 side case: AB:BF < 1009 1/6: 66 and Pi > 48*66/1009.167 = 3.1392 and

96 side case: AB:BG < 2017 1/6: 66 and Pi > 96*66/2017.167 - 3.1410