An ag(e)ing hacker, Luca Saiu's blog
20140722 00:10 (last update: 20150123 22:59) Luca Saiu
It’s 22/7 again.
Last year on π Approximation Day I published a simple Forth program based on an intuitive geometrical idea: see Happy pi approximation day 2013 (https://blog.ageinghacker.net/posts/13). I’ve been thinking about what to do in 2014 for some time, without finding anything as nice from the programming point of view. Sure, you can find series and continued fractions converging to π, even rapidly; these methods work, but the corresponding programs are trivial to code and don’t provide any insight.
So I chose another route: a practical experiment to approximate π by cutting and weighing metal. The result turned out much better than I thought.
The underlying mathematical idea is the same as last year: computing the ratio of the area of a square with the area of its inscribed disk.
First of all, the area of any flat shape is equal to its weight scaled by a constant factor, assuming a uniform density of the material; and weight can be measured directly.
Let any radius r be given; then the area of the disk is πr², and since the corresponding square has side 2r its area will be (2r)² or 4r². The ratio of the square and the disk areas (or weights: the two density factors cancel one another) is then πr²/4r² = π/4.
My initial idea was to directly follow this idea: cut a square out of a flat sheet of some material, and weigh it; then make the square into a disk by removing excess material, and weigh it again.
Even before trying I understood that I needed some heavy material; a sheet of paper, even if it’s easy to cut with precision, won’t be heavy enough to weigh reliably on a scale. After considering cardboard soaked in water I decided to use metal from cigar boxes.
Moreover I decided to cut a square into a quarter disk having two adjacent square sides as its edges, instead of an inscribed disk; that simplifies the cutting operation and makes the resulting shape larger and heavier:
This boils down to, like in last year’s problem, computing the ratio of the weights of one quarter disk (Figure 1.1, right) and one quarter of the square the disk is inscribed in (Figure 1.1, left); the ratio will approximate π/4.
After saving metal cigar boxes for a while I went out and bought a small kitchen scale, and two pairs of scissors: the first, partly visible in Figure 1.2, is heavyweight, to roughly cut flat surfaces out of boxes; the second, lighter, to shape them with precision. I also used a compass, pencils, quad paper and a plastic ruler.
A cigar box (Figure 1.2) is made of two separate metal sheets, probably aluminum, easy to distinguish because by their different plate and paint jobs. The experiment does not require them to have the same density.
The French health warnings and the yellow seal on the bottom are paperbased stickers, which in theory might slightly influence the weight; also notice that they cover different ratios of the top and bottom box halves.
For each box half I peeled all stickers off and cut it into a surface larger than an 80x80mm square, which is the largest size I can reliably obtain:
The most precise way I found to mark precisely a metal sheet is to lay a piece of quad paper over it as a reference, and mark all square vertices (16x16quads on my 5mm quad paper) by punching holes through it with the compass spike; the notebook below the metal sheet serves as padding. Vertex holes are useful as a reference to draw a quarter circle directly on the metal by aid of the compass (opened as wide as a square side), and then to draw the four square sides.
Following pencil markings I used the smaller scissors to cut out a square like the one in the left part of Figure 1.1. I also tried to weigh it, but the result was disappointing.
My cheap kitchen scale can only measure to a resolution of 1g, which is too coarse for an object weighing about 10g. In order to get a reasonable estimate with the same scale I had to first make more squares as indicated above, and then weigh them together in one stack.
I also weighed each square separately, just to measure variance.
Only after weighing my squares I could cut them into quarter disks, again to weigh them as a single stack. It was important not to botch the cutting at that point, because the number of squares had to be the same as the number of quarter disks; assuming that the top and bottom cigar box materials may have different densities I also needed to maintain the same top:bottom ratio.
Again I also weighed each quarter disk separately to have a dispersion indicator.
I ended up with 15 top and 15 bottom squares, then turned into 15 top and 15 bottom quarter disks.
For each weighing I took the median of three measurements. Since my scale
doesn’t show gram fractions and we’re eventually looking for a rational
approximation of π anyway, I used integers to record weights and exact
fractions for averages. Guile (http://www.gnu.org/software/guile) comes
in handy also for this kind of quick occasional computation on rationals; when
needed it’s always easy to explicitly call exact>inexact
to convert an
exact rational into a floatingpoint number.
When writing repeating decimal expansions I enclose the repetend in parentheses; for example 2/3 = 0.(6).
Top square weight distribution:
Weight  # 

10g  9 
9g  6 
Bottom square weight distribution:
Weight  # 

10g  11 
9g  4 
Before starting the experiment I anticipated that I’d get normal weight distributions in the typical bell shape, but the situation turns out to be even simpler. It would be interesting to repeat the experiment with a more precise scale.
Square weights:
Description  #  Total weight  Average weight (fractional)  Average weight (expansion) 

top squares  15  141g  47/5 g  9.4g 
bottom squares  15  142g  142/15 g  9.4(6)g 
all squares  30  284g  142/15 g  9.4(6)g 
Indeed the average square weight is between 9 and 10 grams.
Top quarter disk weight distribution:
Weight  # 

8g  9 
7g  6 
Bottom quarter disk weight distribution:
Weight  # 

8g  10 
7g  5 
Quarter disk weights:
Description  #  Total weight  Average weight (fractional)  Average weight (expansion) 

top quarter disks  15  110g  22/3 g  7.(3)g 
bottom quarter disks  15  112g  112/15 g  7.4(6)g 
all quarter disks  30  223g  223/30 g  7.4(3)g 
The same considerations apply.
In order to approximate π I have to multiply by 4 the ratio of a quarter disk and a square weight. In Scheme:
(define (approximate quarterdiskarea squarearea) (* 4 (/ quarterdiskarea squarearea)))
By definition, if p is an approximation of π, the relative error of p is (pπ)/π. In Scheme:
(define pi (acos 1)) ;; Assumed to be precise enough. (define (relativeerror p) (abs (/ ( p pi) pi)))
π approximation  #  Fractional  Expansion  Relative error 

top only  15  440/141  3.1205673759  0.00669 
bottom only  15  224/71  3.1549295775  0.00425 
both  30  223/71  3.1408450704  0.00024 
exact      3.1415926535  0 
With 30 samples I got nearly four decimal digits of π correct, which is much better than I was expecting from my crude method.
The approximation I found is 223/71. According to https://en.wikipedia.org/wiki/Chronology_of_computation_of_%CF%80 it was known to Archimedes.
As suggested by Alfred (http://chapters.gnu.org/~ams), somebody with access to a lathe could definitely obtain a better result by cutting a square prism into a cylinder. The process would be less laborintensive as well.
Smoking is very bad for you — nearly as much as innumeracy.
If you want to help me to eradicate this horrible social plague bearing a destructive effect on human life then please devise and publish your own interesting musings on π Approximation Day and on other occasions, using accessible mathematics.
— Luca Saiu, 20140722 00:10 (last update: 20150123 22:59)
Tags: english, experiment, gnu, guile, hacking, pi, science 
Next post  Previous post 
You might want to go to
the
main blog index
(feeds for every post:
Atom 1.0,
RSS 2.0)
or to my web site
https://ageinghacker.net
.
Luca Saiu 
The opinions I express here are my own and do not
necessarily reflect the beliefs or policies of my
employer or for that matter of anyone else. In case you
felt that the public statement of my thoughts threatened
your warm sense of security and your emotional stability
feel free to leave at any time.
You might be interested in my web site

Copyright © 2009, 20112014, 2017, 2018, 20212023 Luca Saiu
Verbatim copying and redistribution of this entire page are permitted
in any medium without royalties, provided this notice is preserved.
This page was generated by trivialblog.
trivialblog is
free software,
available under the
GNU GPL.
Tag icon copyright information is available
in this file.