There is an old adage that “research informs teaching;” this is a story about its converse – how “teaching informs research” and how a routine topic covered in a Wittenberg University mathematics course started me on a search to track down the story behind an overlooked milestone in the history of mathematics and computer science.
The course was Math 460: Senior Seminar, and the topic was the number π and how and why in 1949 the ENIAC, the first electronic computer, was used to compute π to over 2000 digits. The end result was a paper “The ENIAC’s 1949 Determination of π,” which was eventually accepted for publication.
Math 460: Senior Seminar for mathematics majors is a selective history of mathematics where we look at some the great theorems in mathematics the mathematicians who proved them. We use a text by William Dunham called Journey through Genius – The Great Theorem of Mathematics, which is a history of 12 famous theorems. One of the themes covered is the history of determining π – the ratio of the circumference of a circle to its diameter; that is getting a good approximation to a number that is irrational, meaning it cannot be expressed as a simple ratio of two integers. So why is the history of π interesting and how is it connected with the ENIAC?
The origins of π can be traced back to antiquity in early attempts to find a formula for the area of a circle. At this point π as a number did not “figure into the equation”. For example the Egyptian Rhind Papyrus which dates back to 1650 BCE gives the area of a circle as (8/9)2 times its diameter. No mention of π though a little algebra can establish that if this formula for area were correct then π would be approximately equal to 3.16049 which, all things considered, is pretty accurate.
The first person known to connect the number π to the area of a circle was Archimedes (278-212 BCE). Archimedes first proved that the area of a circle was equal to half the radius times its circumference which given that the circumference of a circle equals 2π times the radius, is equivalent to our modern formula Area = π r2 . Having proved that the area of a circle was connected to its circumference, he then estimated the circumference of a circle of radius 1 to be between 3 10/71 ≈ 3.140845 and 3 1/7 ≈ 3.142857, the latter figure being the familiar 22/7 approximation for π. This he did by carefully calculating the perimeters of inscribed and circumscribed 96 sided polygons fitted around a circle of radius 1. The method is not very efficient and was computationally complex. It reached its apogee when Ludolph van Ceulen (1540 – 1610) computed π out to 35 decimal digits using polygons having 262 sides, a herculean feat of calculation.
The Archimedean method for the determination of π prevailed for 1500 years until the 17th century when mathematicians began to discover (along with calculus) other formulas for calculating π. Isaac Newton used his newly discovered calculus to easily calculate π out to as many placed as he wanted – limited only by the tedium of calculation. (One of the topics covered in Math 460 is how Newton easily calculated π out to 16 digits remarking that he (Newton) was “ashamed to tell … how many places of figures I carried these computations, having no other business at the time”[Dunham].) The discovery of the calculus opened the flood gate for more efficient formulas for the determination of π so that by the mid-19th century William Shanks calculated π out to 607 digits (although it was later discovered that he made a mistake beginning at the 528th digit!). More on this later.
Thus the first three chapters in the history of computing pi: ancient estimates, Archimedes’ method of inscribed and circumscribed polygons, and using formulas obtained from the new calculus. The fourth chapter opens with the sentence “Finally in 1949 the computer fundamentally revolutionized the calculations. In that year the Army’s ENIAC computer found π out to 2037 places” [Dunham]. Since that date in 1949 computers have been used to compute the decimal expansion of π out to billions of decimal places. But the ENIAC was the first use of a computer used to tackle the millennia old problem of the determination of π. What is more amazing is that the ENIAC was not designed to perform this type of calculation. The story of why it was done, how it was done and what was subsequently learned was what I set out to discover.
In January 1950 George Reitwiesner, a mathematician working at the government’s Ballistic Research Lab in Aberdeen Md., published “An ENIAC Determination of π and e to more than 2000 decimal places” in Mathematical Tables and Other Aids to Computation (the number e is the base of the natural logarithm and like π an important constant). To quote Reitwiesner’s opening paragraph…
“Early in June, 1949, Professor John von Neumann expressed an interest in the possibility that the ENIAC might sometime be employed to determine the value of π and e to many decimal places with a view toward obtaining a statistical measure of the randomness of the distribution of the digits. … Further interest in the project on π was expressed in July by Dr. Nicholas Metropolis who offered suggestions about programming the calculation”.
In 1949 the ENIAC (Electronic Numerical Integrator and Computer) was the only computer in the United States. Strictly speaking it wasn’t a computer in the modern sense that we understand computers today. It was the result of a World War II project to build an electronic device to compute ballistic tables for the army. Started in 1943 at the Moore School of School of Engineering at the University of Pennsylvania (UPenn) in Philadelphia, it was completed in 1946 too late to help in the war effort. Subsequently it was moved to the army’s Ballistic Research Laboratory (BRL) in Aberdeen Maryland where it did useful work until turned off for the last time in October 1955.
Physically the ENIAC was a large U-shaped arrangement of 40 panels, each approximately 2 feet wide, 8 feet high and 3 feet deep containing altogether over 17,000 vacuum tubes (the official count is 17,468), big enough to fill a room. Twenty of the units were accumulators each able to store one 10 digit number plus its sign. Thus the entire internal storage of the ENIAC was 200 decimal digits. Programming the ENIAC was done by literally wiring the units together in their proper sequence. While this made the ENIAC very fast since all calculations were done at electronic speeds (the ENIAC could perform 5000 additions per second), programming by rewiring the ENIAC was very slow and time consuming. So slow in fact that soon after the ENIAC was moved to Aberdeen a method was devised to program the machine using two-digit order codes stored in its functions tables.
The principle architects of the ENIAC were John Mauchly, a physics professor from nearby Ursinus College who worked was working at UPenn’s Moore School of Engineering in Philadelphia during World War II and J. Presper Eckert, at that time a graduate student who was according to Herman Goldstine “undoubtedly the best electronics engineer in the Moore School”.
Herman Goldstine who had doctorate in mathematics from Chicago was an army officer assigned to the army’s Ballistic Research Lab (BRL) in nearby Aberdeen, Maryland. At that time Aberdeen employed approximately 200 human computers, many of them women (in the 1940’s a computer was a human who performed calculations) to compute ballistics tables needed by the military to properly aim and fire artillery. Goldstine, as the BRL liaison to the Moore School which was also involved in the ballistics table work, became acquainted with Mauchly and Eckert’s ENIAC proposal and helped pitch it to the army for funding. Goldstine is also important because he was the link between the ENIAC and John von Neumann, who proposed that the ENIAC be used to determine the value of π.
John von Neumann was one of the foremost mathematicians of the 20th century. Hungarian by birth he came to the United States in the early 1930s where he was one of the original faculty members at the Institute for Advanced Study in Princeton NJ, an early “think tank” dedicated to pure research. During World War II von Neumann was also a consultant for the super secret Manhattan Project which produced the atom bomb. How von Neumann became involved with the ENIAC and subsequently in computer science is told by Herman Goldstine in his book The Computer from Pascal to von Neumann.
“I [Goldstine] was waiting for a train to Pennsylvania on the railroad platform in Aberdeen when along came von Neumann. Prior to that time I had never met this great mathematician, but I knew very much about him of course and had heard him lecture on several occasions. It was therefore with considerable temerity that I approached this world-famous figure, introduced by self and started talking. Fortunately for me von Neumann was a warm, friendly person who did his best to make people feel relaxed in his presence. The conversation soon turned to my work. When it became clear to von Neumann that I was concerned with the development of an electronic computer capable of 333 multiplications per second, the whole atmosphere of our conversation changed from one of relaxed good humor to one more like the oral examination of the doctor’s degree in mathematics”
Given the magnitude of the calculations needed for the Manhattan Project, von Neumann’s interest in electronic computation was understandable. But by the time von Neumann learned of the ENIAC’s existence, its design had been fixed; it seems to have been understood by all that the ENIAC was a war-time project designed to do ballistic calculations at electronic speeds (though with the capability to perform other types of scientific calculations). However, the experience with the ENIAC led its designers plus von Neumann to consider a follow on project, the EDVAC (the Electronic Discrete Variable Automatic Computer) which unlike the ENIAC was a true modern computer in that both code and data were stored in its internal memory.
The ENIAC was finished in 1946 so it never contributed to the war effort for which it was designed. However, with the successful outcome of the Manhattan Project, the Cold War and the emphasis on thermonuclear weapon research there was still a pressing need for rapid scientific calculation. In fact the first test of the ENIAC which was performed in late 1945 early 1946 before its existence being made public in February 1946 was a super-secret calculation for Los Alamos Labs (where the Manhattan Project was based) presumably for a thermonuclear reaction (i.e. hydrogen bomb).
After its unveiling at the Moore School in Philadelphia the ENIAC was moved to the Ballistics Research Lab in Aberdeen Maryland. And while it was used for government work, there was an open policy that allowed the ENIAC to be used for pure research. It was during this time that the ENIAC was modified so it could be programmed using numerically-coded instructions entered into its function tables instead of having to laboriously re-wire the ENIAC to perform a calculation.
It was also in the late 1940s that scientists and mathematics (like von Neumann and Metropolis who was also mentioned in Reitwiesner’s article) became interested in what came to be called Monte Carlo methods to model complex systems (like nuclear chain reactions). Monte Carlo methods required the generation of random numbers (like the rolling of dice). This led to an exploration of how a computer could be programmed to generate random numbers or, to be more exact pseudo-random numbers, sequences of numbers that looked random. Since π was an irrational number it was known that any decimal expansion of π would look random but how random would the digits be? One simple test would be to count the number of 0’s, 1’s, 2’s etc. that were generated to see if each digit appeared approximately one-tenth of the time. Hence the phrase in Reitwiesner’s article: “determine the value of π and e to many decimal places with a view toward obtaining a statistical measure of the randomness of the distribution of the digits.”
Another possible reason for counting the digits of π might be traced back to the 19th century when the mathematician Augustus De Morgan (1806 – 71), noticed a smaller number of appearances of the digit 7 in Shanks’ 607 digit determination of π; subsequently a mistake was found in Shanks’ calculation beginning at the 528th digit. Finally von Neumann was a mathematician and given a mathematician’s fascination with numbers, questions about the distribution of the digits of π could now be investigated using the new computing technology.
Thus the stage was set in 1949 for von Neumann to suggest to George Reitwiesner “that the ENIAC might sometime be employed to determine the value of π and e to many decimal places with a view toward obtaining a statistical measure of the randomness of the distribution of the digits.”
This is where I got interested in the question because the ENIAC being a primitive computer (though in its time it was cutting-edge) really wasn’t designed to perform a calculation that required dividing by numbers up to 2000 digits long. To understand the magnitude of the problem facing Reitswiesner and his team, one needs to understand the architecture of the ENIAC. The 40 panels of the ENIAC made up 30 separate units: twenty of these were accumulators each capable of storing a 10 digit decimal number plus sign – making the total storage of the ENIAC 200 decimal digits. Addition and subtraction was done by transmitting the contents of one accumulator (or its negative) to a second. More complex operations like multiplication and division made used of the addition and subtraction capabilities of the accumulators. For example the division unit orchestrated the addition and subtraction capabilities of four accumulators to perform division. Multiplication was faster since ENIAC had circuitry to compute the partial product of a ten digit numbers by a single digit (e.g. ) but then had to rely on the addition capabilities of accumulators to shift and add to obtain the final product. Input and output was provided by an IBM card reader and card punch. Finally there were three functions tables, units that could store numbers which the ENIAC could “look up” and use (much like the way a human would look up values in a table) and various control and timing units. Programming was done by serially wiring the various units together so that the completion of one step in a program electronically triggered the next. Once wired, the ENIAC ran fast but wiring the ENIAC was tedious and complex complicated by the fact that the ENIAC only had 20 accumulators to work with. This worked well for computing ballistic tables where 10 digits of precision sufficed and the same programming (wiring) using different initial parameters could be used again and again. However, given the constraints of the ENIAC, how could it be programmed to perform a very high precision calculation that required numbers 2000 digits in length, ten times its total internal storage?
Reitwisener used a well-known mathematical formula (mentioned in his article) to determine π. Using this formula, programming a modern computer to determine π out to 2000+ digits is a straight-forward task but the ENIAC was not a modern computer. However there are computational constraints common to both the modern computer and the ENIAC so programming a modern computer to determine π gave insight on how it had to be done on the ENIAC. But how was the ENIAC programmed? By 1949 the ENIAC was no longer programmed by being hard-wired; it was now programmed by numeric codes in its function tables. (It should be noted here that if the ENIAC could only be programmed by being hard-wired, the determination of π would probably have never taken place since it would have taken took too long to re-wire the ENIAC. As it was Reitwiesner’s work was extra-curricular in that the calculation for π was done over the Labor Day week-end in 1949.)
Thanks to the library staff at Wittenberg, I was able to locate a copy (dated September 28, 1948) of the order code used to program that ENIAC. However, knowing the ENIAC order code was not enough. There were questions about the details of how certain operations were actually done on the ENIAC. A visit to the archives at the University of Pennsylvania in Philadelphia allowed me to examine some of the original ENIAC documentation which gave me a better understanding of how division was done on the ENIAC (which differs from the way it’s done on a modern computer). Armed with all this information I then wrote a program (on a modern computer) that simulated the ENIAC and programmed the simulator to perform what must have been the way the ENIAC determined pi. This is reverse engineering: you have the input and output of a black box, you have the pieces that make up the black box, now you have to assemble the pieces so that the black box takes the input and produces the output. It’s like solving a jig-saw puzzle. The result was a program that simulated how the ENIAC must have determined the digits of π. Best of all the calculation seemed to conform to Reitwiesner’s description of his calculation as given in his 1950 article. (For the record, the heavy lifting for the determination of π was the calculation of two auxiliary values: inverse tangent of 1/5 and inverse tangent of 1/239 which when combined properly yielded π/4). So while the details of the original computation for π may have differed, given the constraints imposed by the architecture of the ENIAC, the ENIAC’s instruction mix, the mathematics used for the computation and Reitwisener’s description, I was satisfied that I had figured out how the ENIAC had determined π which resulted in a paper being accepted for publication.
The ENIAC’s record 2000+ digits of π stood for five years finally surpassed in 1954 by a 3000+ digit determination that was done on the by the new IBM-built Naval Ordnance Research Computer (NORC) with a computation that took 13 minutes (the ENIAC took 70 hours mainly because a lot of the intermediate results had to be punched out and then read back in on punch cards). By the end of the 1950’s records of 10,000+ digits were achieved and in 1961 Shanks and Wrench computed 100,000 digits on an IBM 7090 after 8 hours of run time. The currently record announced in October 2011 is 10 trillion digits (10,000,000,000,000).
Recalling that one reason for understand the determination of e and π was to obtain “a statistic measure of the randomness of the distribution of digits” Reitswiesner reported
“Only the following minor observation is offered at this time concerning the randomness of the distribution of digits … a preliminary investigation has indicated that the digits of e deviate significantly from randomness (in the sense of staying closer to their values than a random sequence of this length normally would) while for π no significant deviations have so far been detected”
Aside: What Reitswiesner was saying about e was that the digits conformed a little too closely to the expected ratio of each digit appearing approximately one tenth of the time; given randomness you would expect some more variation. No such problem was found for π.
I began this article with the observation that while we often cite the phrase “research informs teaching” that sometimes its converse “teaching informs research” is also true. A simple question raised in passing in a math class can be the start of a journey of discovery. Today computers and computing technology are ubiquitous. Sixty years ago the first use of the new computer technology to address a millennia old problem was little noted but important. What I uncovered was the fascinating story of how and why the ENIAC, the first electronic “computer”, was used to determine π.