Thoughts about Pi
Pi is a geometric constant whose value is 3.1415... It's been calculated to a trillion decimal places, but I won't use them all. You can hear some of them at pi.ytmnd.com.
Forth uses rational arithmetic with its */ operator - as opposed to floating-point. A convenient approximation to pi is 355/113, which is 3.141592... The numerator and denominator are small enough for a 16-bit computer. You can define multiplying by this ratio as
Conceptually, think of pi as 3, a simple approximation good to 5%. And here I'll use d to represent diameter - of a circle or a circumscribed square.
Here are some useful geometric comparisons, new to me:
- Circumference of a circle - d pi
In Forth that would be d 355 113 */ or d pi
Notice that 4d is the circumference of a square. The circumference of a circle is roughly 3/4 of that.
- Area of a circle - d2pi/4
That's 3/4 the area of a square.
- Area of a sphere - d2pi
That's 4 times the area of the circle.
And 1/2 the area of a cube.
- Volume of a sphere - d3pi/6
That's 1/2 the volume of a cube.
- I speculate that the surface of a 4-dimensional hypersphere is d3pi
They can be summarized as: circle is 3/4 square, sphere is 1/2 cube.
Notice that comparing circles with squares is nicely done in terms of diameter. Radius is only useful for drawing; diameter is what you observe. For instance, the moon's diameter is 30 minutes of arc or 2 minutes of time; its radius is not interesting.