November 06, 2008

π = 3.14159…

π is wrong! (PDF) argues that π should have been defined as 6.28319… (2π). Some think it should be 0.785398… (π/4) and others argue that changing π would be "disrespectful" and "outright wrong".

So who's right?

Originally, π came into use as a sort of greek acronym. Early mathematicians working on the properties of circles and spheres frequently had to write 'perimeter', 'diameter', and 'radius'. If we were recreating mathematics from scratch today, we would shorten these to p, d, and r, but since early mathematics was done in greek, they shortened περιμετρος (perimetros), διαμετρος (diametros), and the latin ραδιυς (radius) to π (pi), δ (delta), and ρ (rho).

π/δ = 3.14159…
π/ρ = 6.28319…

So why did π eventually come to mean the ratio of the perimeter and diameter of a circle?
circle perimeter = 3.14159… × diameter
= 6.28319… × radius
circle area = 0.78540… × diameter2
= 3.14159… × radius2
sphere area = 3.14159… × diameter2
= 12.5664… × radius2
sphere volume = 0.52360… × diameter3
= 4.18879… × radius3
3.14159… appears in three equations, and no other constant appears twice. 3.14159… was the natural candidate for a constant because it let mathematicians write shorter equations.1 The symbol π was chosen as a mnemonic for π/δ (perimeter over diameter).

The conservative view that π is by now so deeply entrenched in mathematics that it would be folly to attempt to change it has some merit. But there's no reason why we can't explore the notion of defining another constant for convenience's sake. π is wrong! takes this approach in suggesting a new symbol for 2π (a three-legged version of π, or 'pii'). This is a bit awkward, since there is no such symbol in current character sets.

The argument that π/4 is more fundamental than π, because it is both the ratio of a square's area to a circle's area and the ratio of a square's perimeter to a circle's perimeter seems to be both misleading (Why is a square's side equated to a circle's diameter? Why a square instead of, say, a regular hexagon or an equilateral triangle?) and useless, since a special symbol for π/4 would only shorten the equation for a circle's area at the expense of all other equations.

The argument that there should be a special symbol for 2π at first glance is equally pointless. However, a great deal of practical mathematics deals with angles, and the angles are all expressed in radians because using them greatly simplifies a large number of equations. A full circle is 2π radians, and this fact appears in a huge number of equations. For example, Euler's famous identity e + 1 = 0 is a special case of eix = cos(x) + i sin(x). π only appears there as an angle (180°) which happens to simplify the rest of the equation quite nicely.2 Substituting 0, π/2, 3π/2 or 2π leads to equally simple equations, e.g. ei2π = 1.

Personally, I have found it useful to define a constant equal to 2π in programs involving geometry, especially programs involving graphics, in which rotations expressed as fractions of a full circle are significantly easier to think about than fractions of 2π. I usually call the constant τ (tau), as a mnemonic for 'two-pi'. (E.g., in Java, where PI is predefined, create a constant TAU = 2 * PI.)

[1] 'Brevity is Power' is a principle programming languages inherited from mathematics.

[2] Discussing why eix is a rotation in the complex number plane will have to wait for another day.

November 01, 2008

ACM Programming Contest

Live scoreboard for the East-Central North America region.

Final Standings (Carnegie Mellon is strong this year)

The Problems and Solutions (Nobody solved problem A. Can you?)