An ag(e)ing hacker, Luca Saiu's blog
2014-07-22 00:10 (last update: 2015-01-23 22:59) Luca Saiu

Happy pi Approximation Day 2014

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.

Introduction

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:

cut-square cut-quarter

Figure 1.1: Left: a metal square. Right: the same square cut into a quarter disk; two adjacent square sides have become quarter disk edges.

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.

Experimental protocol

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.

box-with-stickers box-open

Figure 1.2: Left: outside view of a cigar box, “bottom” and “top” parts. Right: inside view of the same box.

The French health warnings and the yellow seal on the bottom are paper-based 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:

box-peeled flat

Figure 1.3: Left: Bottom and top halves with stickers peeled away. Right: rough sheet cut from the top half (bottom sheet not shown).

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.

arc arc-and-square

Figure 1.4: Left: Metal sheet with square vertex holes punched in, and the quarter circle marked. Reference paper and compass are also visible. Right: The same metal sheet, with square sides marked. Ruler and pencil are also visible.

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.

weigh-one-top-square-10-grams weigh-15-top-squares-141-grams

Figure 1.5: Left: Weighing one square. Right: Weighing 15 (top) squares, for better precision. Not shown: Weighing all 30 squares (15 top plus 15 bottom) together.

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.

weigh-30-quarters

Figure 1.6: Weighing 30 quarter disks (15 top plus 15 bottom).

I ended up with 15 top and 15 bottom squares, then turned into 15 top and 15 bottom quarter disks.

Measurements

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 floating-point number.

When writing repeating decimal expansions I enclose the repetend in parentheses; for example 2/3 = 0.(6).

Square measurements

Top square weight distribution:

Weight#
10g9
9g6

Bottom square weight distribution:

Weight#
10g11
9g4

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 weightAverage weight (fractional)Average weight (expansion)
top squares15141g47/5 g9.4g
bottom squares15142g142/15 g9.4(6)g
all squares30284g142/15 g9.4(6)g

Indeed the average square weight is between 9 and 10 grams.

Quarter disk measurements

Top quarter disk weight distribution:

Weight#
8g9
7g6

Bottom quarter disk weight distribution:

Weight#
8g10
7g5

Quarter disk weights:

Description#Total weightAverage weight (fractional)Average weight (expansion)
top quarter disks15110g22/3 g7.(3)g
bottom quarter disks15112g112/15 g7.4(6)g
all quarter disks30223g223/30 g7.4(3)g

The same considerations apply.

Approximations of π

In order to approximate π I have to multiply by 4 the ratio of a quarter disk and a square weight. In Scheme:

(define (approximate quarter-disk-area
                     square-area)
  (* 4 (/ quarter-disk-area
          square-area)))

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 (relative-error p)
  (abs (/ (- p pi)
          pi)))
π approximation#FractionalExpansionRelative error
top only15440/1413.12056737590.00669
bottom only15224/713.15492957750.00425
both30223/713.14084507040.00024
exact--3.14159265350

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 labor-intensive as well.

Disclaimers

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, 2014-07-22 00:10 (last update: 2015-01-23 22:59)

Tags:
english, experiment, gnu, guile, hacking, pi, science

Next post Previous post

You might want to go to the main blog index (Atom feedfeeds for every post: Atom 1.0, RSS 2.0) or to my web site https://ageinghacker.net.

[my photo]
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.
The system does not support user comments and probably never will. Anyway you can contact me if you want to discuss some topic with me. I might update my posts if you provide interesting insights.

You might be interested in my web site https://ageinghacker.net.


Copyright © 2009, 2011-2014, 2017, 2018, 2021-2024 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.