In Part I of this essay, I talked about Pi’s value and its irrationality. Does that also make Pi Day valuable and irrational?1 How about learning more than the 15 digits needed by NASA? Is that worthless but rational? In any case, highly intelligent people are drawn to spend immense amounts of time memorizing digits of Pi, just as they are drawn to memorizing endless chess openings. Think of the celebrated 55-Digit Pi March, by Coach Tom and his teenage computers, or how Bruce Dan (see Wikipedia) recited 144 digits of Pi at a frat party.2 Or think of the many mathematicians over the ages who have devoted time to computing Pi to more and more digits. Even before calculus was invented, Van Ceulen got up to 35 digits in 1610 (see Peter Borwein, “The Amazing Number Pi” [2000]).
As we talked about last week, Pi is irrational, so there is no end to computations. No end, that is, unless you think out of the box, which here means out of the plane (the flat surface on which you draw your circle). There are circumstances in which Pi is indeed a rational number, with a finite number of decimal places. In fact, sometimes Pi equals exactly 3.
To see this recall that I had my students go home and try to measure Pi using a string and a ruler, as I described last week. They naturally assumed I meant for them to draw their circles on a flat surface. But suppose they didn’t. Suppose they drew their circles on the couch, or on a garbage can?
In class, I told Jonathan to go get a ball from the Resource Room. Then I drew a circle on the ball with a marker. The definition of “circle” when drawn on a sphere is the same as always: pick a center (the North Pole will do) and go equal distances on the ball’s surface.3 (Don’t cheat by cutting corners or digging tunnels.) There are lots of diametes of circles you could draw, but let’s think of drawing a circle around the middle, the equator.
Next I asked if Pi would be bigger or smaller than 3.14 if the circle was drawn on a sphere. “Smaller”, Lyndon said, because the diameter number D in Pi = C/D is bigger if you have to go all the way around the curve of the sphere than if you could cut straight across, through the center of the earth.
The next question was whether our equatorial Pi_e would be bigger than 2, or less. I drew a picture, a good first step in solving any problem (see Polya’s famous book, How To Solve It). I can’t draw a good sphere, so I drew a line with a semicircle above it. The line is the flat-circle diameter D through the center of the earth. The semicircle is the unknown we're trying to find, is the ball-circle diameter D_e going through the North Pole.
I only drew the thick blue line and semicircle first, not all the green and red in Figure 4, and not the letter labels either. Our question was how long the semicircle is compared to the flat line. Let’s label the circumference at the equator as C. Then, what is the ratio of the circumference to the curved diameter, the semicircle D_e? I asked them to eyeball it and write their estimates on lapboards. 1.1, 2.0, 2.5, 3.0, 2.5. Reasonable guesses, but mostly too big. I asked how to find it more accurately. "Use string" was the good scientific answer, from Emma. I said they could do better mathematically, with no more information than they had already.
They were stumped. I said I'd give them a couple of minutes. I should have had them discuss it together too. The key is that we DO know the length of D_e in terms of the two other lengths we know, C and D. The length D_e is the length of the semicircle, half of the area of a circle around the ball, so D_e = .5C! For the flat circle, Pi_f = C/D. For our equatorial circle, the circumference is the same, C. The diameter, though, is thesemicircle going through the north pole. Thus, Pi_e = C/ (.5C) and we find that Pi_e = 2.4
Pi_e = 2 is the smallest value of Pi we can get on the sphere, and we got it by using the biggest circle that you can draw on a sphere, the equator. Consider the Polar Circle in Figure 5, which would have diameter d_2 if you could cut through the globe. I’ve magnified it in the little picture on the right. The spherical diameter from a_2 to b_2 is still bigger than the diamter d_2, but not by much. Thus, the Pi_2 we’d calculate for circle 2 would be close to 3.14. In fact, the closer we got to the North Pole, the closer spherical Pi would get to 3.14159. . . If we had an infinitesimally small circle at the North Pole, Pi would take the same value as for a flat circle. Locally, a sphere is flat, which is why it’s natural to think of the Earth as being flat.
How do we get Pi = 3? Since we have Pi_e = 2 for the equatorial circle, and Pi = 3.14 near the North Pole, we’d have Pi = 3 somewhere in between. Thus, choosing the correct circle, Pi = 3. Or, another way to get it would be by keeping the circle the same size as d_0, but blowing up the sphere so it has less curvature— sort of sliding the circle north.5
You can think about other drawing shapes on other objects besides flat paper and spheres. Salvador Dali famously drew them on a box, draped from a tree, and on a piece of cloth.
Consider the clock on the box. Suppose we smooth it out so it’s a neat circle instead of being wrinkled. What is the value of Pi?
Well, the circumference is no different than if the watch was flat on the top of the box. Bending the circle over the edge doesn’t change the shape. How about the diameter? Oddly enough, that doesn’t change either. Where the hands meet is the center, and the distance to any edge point is the same as if the watch were flat. So the Dali-Pi is our old friend 3.14159. . .
Notice that we can lay the watch flat on Dali’s box, with a bend. That’s crucial. You couldn’t do that on a sphere. In fact, you can’t do that just anywhere on a box. You can go over long edges like Dali did, but you can’t paste a circle onto a corner of the box. There, we could draw a circle, as we did on the sphere, by picking a center— the corner itself, for example— and then finding the points equally distant from it. But the value of Pi would depend on the exact point. If I want to finish this while it’s still Pi Day, though, I’d better not go down that rabbit hole. I will note, however, that on the sphere it doesn’t matter where your center is, even though it does depend on the size of your circle. That’s because a sphere has constant curvature. On an ellipsoid or a box it does matter what point you pick for the center.
Let’s return to flat space, also called Euclidean space. (Did you know you were just doing Non-Euclidean geometry?) But let’s use equations now. Here’s one by Leibniz, who got it with the help of calculus, which he invented simultaneously with Newton.
I won’t try to explain why Leibniz’s formula is true, since that requires calculus, I think (is there any other way, readers?). It also requires trigonometry, which my 7th graders haven’t had yet. But you should be able to see the pattern. I’ll use it later in a computer program that demonstrates it gets close to Pi, though that’s not a proof it gets all the way.6
In class, I gave my students a three-page handout with lots of Pi formulas, most of them too advanced for 7th graders to understand. I asked them to pick one each for me to try to explain. Three students picked Euler’s formula and two picked the Normal density formula. Here is Euler’s formula:
Euler’s formula is written in symbols my 7th graders do learn. It’s not that hard to understand, it just needs slow thinking. Suppose k = 4. Then k! means 4x3x2x1, which equals 24. The big Sigma means sum, and it means we add the formula that comes right after it for every k from 1 to infinity. So this formula isn’t as bad as it looks.
My students also picked the formula derived from the Normal probability density, the bell-shaped curve. The formula is:
This formula is harder to explain, because it’s a calculus formula and uses the special number e (from Euler), an irrational number that equals about 2.7. The fancy symbol is an integral sign, which is a continuous version of the Sigma summation sign in Euler’s formula. Euler summed his fraction for k = 1, 2, 3, . . . The integral here sums up for all values of x start from -infinity up to +infinity including all fractions in between and even including the irrational numbers between the fractions. It doesn’t add up to infinity because, like the 1/k fractions in Euler’s formula, the exponent here gets smaller and smaller and because the dx part means we give infinitesimal weight to each of the infinite number of values of x that we’re summing over. If that seems profound or confusing, well, that’s what a calculus course would explain to you. But you can just think of it as sort of a sum.
The Normal density is the equation to the right of the integral sign, which shows the chance you get each value of x. Since you have to get some value of x, when you sum them all you get a total of 100% probability, 1. Then you can back out Pi and get the Pi equation a couple of paragraphs above.
The normal density can be graphed as in the German diagram below if we also put in a parameter to make the midde number 100 instead of 0, and set the variance (the spread) equal to 15. The area under the bell curve equals 1, as in the integral above, because the probabilities of all possible values of x add up to 1.
I use this example because it’s one I’m often having to recalculate to figure out which IQ’s are which percentiles of the population. For example, 2.2% of people have IQ greater than 130.
Why should the formula for the Bell Curve also be a formula for Pi? It’s a testament to God’s glory. The reason involves trigonometry, wave formulas, and something called the Fourier transform, which I never got round to learning.
Let’s leave formulas now and go to something much less intellectually taxing: computer coding. Below is a Python program that calculates Pi. The program asks the user to tell it how many microseconds of computer time to use (the more you use, the better the estimate of Pi, roughly speaking, or maybe even exactly. Then it prints out two estimates of Pi for you, one using Leibniz’s formula and one using Euler’s. If you delete some of the pound signs (#), which “comment out” some of the lines, the program will also show its work along the way—its estimates or how much computer time it’s used so far.
#March 18, 2024. A pi estimator
# Eric Rasmusen, erasmuse61@gmail.com, Python 3
import time
import math
print(f"How many microseconds do you want the computer to use for each estimate? (e.g. 10, 20000)?")
microseconds = input()
microseconds = int(microseconds)
print("###################################### ")
print(f"The first method uses Leibniz's formula. ")
start = time.time()
pi = 4
for item in range(1,10000000000):
if item % 2 == 1: #This means if the remainder from item/2 is 1.
pi = pi - 4/(2*item+1)
else: #If the remainder is NOT 1, then item is even.
pi = pi + 4/(2*item+1)
end = time.time()
elapsed = 100000*(end-start)#To measure in microseconds
# print(f"Computer time used was {elapsed:0.2f} microseconds.")
if elapsed >microseconds:
break
# print(f"Item is {item} and pi is {pi:0.2f}")
print(f"Pi = {pi:0.15f} using Leibniz.")
print(f"CPU time: { elapsed:0.2f} microseconds.")
print("###################################### ")
print(f"The second method is Euler's series. ")
start = time.time()
pi = -3
for item in range(1,100000000000):
pi = pi + item*2**item*(math.factorial(item))**2/math.factorial(2*item)
# print(f"Iteration {item}: pi is {pi:0.2f}.")
end = time.time()
elapsed = 100000*(end-start)#To measure in microseconds
# print(f"Computer time used was {elapsed:0.2f} microseconds.")
if elapsed > microseconds:
break
print(f"Pi = {pi:0.15f} using Euler.")
print(f"CPU time: {elapsed:0.2f} microseconds.")
print("###################################### ")
print(f"That is all.")
print("###################################### ")
#I erased the normal distirbution method by accident.
#It was fun, but I did need to do an approx of an integral
#Maybe for fun I will try it later.
The output looks like this:
How many microseconds do you want the computer to use for each estimate? (e.g. 10, 20000)?
16
######################################
The first method uses Leibniz's formula.
Pi = 3.146243791226152 using Leibniz.
CPU time: 16.09 microseconds.
######################################
The second method is Euler's series.
Pi = 3.141592653471791 using Euler.
CPU time: 16.12 microseconds.
######################################
That is all.
######################################
As you see, Euler’s formula ges more correct digits using the same amount of time (it “converges faster”).
If you’d like to try the program out, go to Codabrainy.com’s free Python page. Find the box for writing your code in, and clear it out by deleting everything there. Then paste in the program in the first grey box above. Click the sideways triangle at the top to run the program, and you will see the output in the window to the right of the code input window. The program does have a problem, though. It isn’t set to print more than about 16 digits of Pi. Later maybe I’ll find how Python can be made to calculate and print with more digits.
That is all.
How interesting that “value'“ and ‘irrational” have so many different meaning! (so many values?) Even “irrational values” has a couple.
In my fraternity back in the 1960s we probably had the world champion memorizer of Pi digits, Bruce Dan. He had memorized over 500 digits; alas there was no official record back then.
But 30-odd years later we had a reprise at my home where we all pledged X dollars to our pre-DEI Alma Mater for each digit he could still do, which turned out to be about 144. This event was memorialized here, with the actual recitation of digits starting at about 9:45.
[personal communication, 2024]
The technical definitions of “ball” and “sphere” are that a ball is a sphere plus the sphere’s interior, and a sphere is a ball’s surface. Better: a ball is all points that are distance M or less from a center point; a sphere is all points exactly distance M from a center point.
Professor Connell would object. When we were at dinner at Uncle Wang’s Alley, he said that Pi should be defined as “C/D on a flat plane surface,” in which case we get the value 3.1415. . . We can also get the Pi formulas in terms of sums like Leibniz’s that way, because the way to get to the sums is by trig using ordinary, flat, sines and cosines. But I want to teach my student that Pi = C/D, and applying it to lots of kinds of surfaces makes that point very nicely. I hope our wives didn’t mind that dinner discussion too much. We didn’t get violent or anything.
The Quora article, “There is a sphere with a circle drawn on it. . . .“ addresses the question of when Pi = 3.
Luke Pritchett drew Figure 8 and tells us that C = 2π (.5D) sin(θ), where D is the flat diameter. Suppose we set D = 1. Then the circumference at the equator is about 3.14, and the diameter through the north pole is about 1.57. What is C when Pi_spherical = 3? We solve C = 2*3.14* (.5)*sin (.52) = 3.14 * .5 = 1.57. Then, since C/D_np = 3, we find that the diameter through the North Pole is about .52. The diameter in a tunnel through the earth there is such that 1.57/D_me = 3.14, so that diameter is .5.
This is the Euler’s solution to “The Basel Problem”. I should talk about it too, in an update, as well as fixing all the subscripts to look nice.
I liked that you gave the 7th graders a sheet of mysteriously complicated looking formulas, instead of just including ones they would understand. It gives them a sense of how much further they could go with math if they wanted to. That sort of pedagogical move should have a name.
Ill have to remember those till next February.