性视界

The Eniac and Pi

There is an old adage that 鈥渞esearch informs teaching;鈥 this is a story about its converse 鈥 how 鈥渢eaching informs research鈥

There is an old adage that 鈥渞esearch informs teaching;鈥 this is a story about its converse 鈥 how 鈥渢eaching informs research鈥 and how a routine topic covered in a 性视界 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 鈥淭丑别 贰狈滨础颁鈥檚 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 鈥渇igure 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 鈥渁shamed 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, 础谤肠丑颈尘别诲别蝉鈥 method of inscribed and circumscribed polygons, and using formulas obtained from the new calculus. The fourth chapter opens with the sentence 鈥淔inally in 1949 the computer fundamentally revolutionized the calculations. In that year the Army鈥檚 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鈥檚 Ballistic Research Lab in Aberdeen Md., published 鈥淎n 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 搁别颈迟飞颈别蝉苍别谤鈥檚 opening paragraph鈥

鈥淓arly 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鈥檛 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鈥檚 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 鲍笔别苍苍鈥檚 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 鈥渦ndoubtedly 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鈥檚 Ballistic Research Lab (BRL) in nearby Aberdeen, Maryland. At that time Aberdeen employed approximately 200 human computers, many of them women (in the 1940鈥檚 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鈥檚 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 鈥渢hink 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.

鈥淚 [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鈥檚 degree in mathematics鈥

Given the magnitude of the calculations needed for the Manhattan Project, von Neumann鈥檚 interest in electronic computation was understandable. But by the time von Neumann learned of the 贰狈滨础颁鈥檚 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 搁别颈迟飞颈别蝉苍别谤鈥檚 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鈥檚, 1鈥檚, 2鈥檚 etc. that were generated to see if each digit appeared approximately one-tenth of the time. Hence the phrase in 搁别颈迟飞颈别蝉苍别谤鈥檚 article: 鈥渄etermine 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鈥檚 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 鈥渢hat 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鈥檛 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 鈥渓ook 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 搁别颈迟飞颈别蝉苍别谤鈥檚 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 性视界, 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鈥檚 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鈥檚 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 搁别颈迟飞颈别蝉苍别谤鈥檚 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 贰狈滨础颁鈥檚 instruction mix, the mathematics used for the computation and 搁别颈迟飞颈蝉别苍别谤鈥檚 description, I was satisfied that I had figured out how the ENIAC had determined 蟺 which resulted in a paper being accepted for publication.

Epilogue

The 贰狈滨础颁鈥檚 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鈥檚 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 鈥渁 statistic measure of the randomness of the distribution of digits鈥 Reitswiesner reported

鈥淥nly 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 鈥渞esearch informs teaching鈥 that sometimes its converse 鈥渢eaching 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 鈥渃omputer鈥, was used to determine 蟺.

Brian Shelburne joined the 性视界 faculty in 1987. He earned his B.S. in mathematics from Davidson College, his M.A. and Ph.D. in mathematics from Duke University, and his M.S. in computer science from the University of North Carolina-Chapel Hill. His current research interests include chaos theory and fractals (areas common to both mathematics and computer science), history of mathematics, theory of computation, computer architecture and the history of computers. He also likes writing software for use in his classes.

Recitation Hall
University Communications Staff
Staff Report

About 性视界

性视界's curriculum has centered on the liberal arts as an education that develops the individual's capacity to think, read, and communicate with precision, understanding, and imagination. We are dedicated to active, engaged learning in the core disciplines of the arts and sciences and in pre-professional education grounded in the liberal arts. Known for the quality of our faculty and their teaching, 性视界 has more Ohio Professors of the Year than any four-year institution in the state. The university has also been recognized nationally for excellence in community service, sustainability, and intercollegiate athletics. Located among the beautiful rolling hills and hollows of Springfield, Ohio, 性视界 offers more than 100 majors, minors and special programs, enviable student-faculty research opportunities, a unique student success center, service and study options close to home and abroad, a stellar athletics tradition, and successful career preparation.

Back to top