A Life of Pi: Memories From a Data Scientist
Today iVEDiX is celebrating pi-day. As a Vedic, I grasp the occasion to tell a personal life-story related to pi.
Probably no symbol in mathematics has evoked much mystery, romanticism and human interest as the number pi. Denoted by the Greek letter: π, this is the simplest mathematical constant that the universe has bequeathed to us. It simply represents the ratio of the circumference of a circle to its diameter, which is approximately 3.14159… It is unknown why this ratio works universally for circles of all size, from the smallest to the largest, and why pi equals this very specific no-ending number.
Not so coincidentally, March 14th is also Albert Einstein’s birthday. The reason of being pi-day is because the ratio 3/14 is the closest calendrical approximation we have to the decimal expansion of pi. However, that is probably the sole connection between this great scientist and the number pi. Of course, some Einstein’s equations show the symbol pi but it is just a “happy accident”, as Einstein once put it himself, showing no particular interest to this mathematical constant.
Pi is not just in Einstein’s theory of gravity but is everywhere in the world of science and technology. No wonder then if pi is even genuinely present in the iVEDiX Glass code, from the label placement algorithm to the packed bubble chart visualization among other areas.
Intriguingly, pi looks like a stamped signature of the universe we just have to admit without having the faculty to grasp the comprehension of its value and its root. This failure has been viewed an unacceptable state of affair by many thinkers. This is likely the reason why so many Mathematicians have been endeavoring the computation of pi since the beginning of the civilizations, hoping desperately to unveil its mysterious root.
Actually, one does not have to be a Mathematician to be fascinated by pi. I am a humble example of those many amateurs that succumbed to the attraction of pi. I guess it came off from the middle school time when I was exposed for the first time to the computation of a circle circumference. Since then I have been intrigued by pi and, more particularly, by its never-ending decimals. Later, I had been made aware of pi not being algebraic and that its value can, if not computed, only be approximated by algorithms. That renewed my interest for pi and my quest for a computation algorithm.
When I was 18 years old I have been given my first “computer”, what it was called a pocket computer back in the 70’s. I still remember trying to convince my parents to buy one for me. Actually, due to the high expense of such a “toy” these days, my dad was skeptical with spending so much money for a “futile thing”, and I had to “raise” money from my grand-parents. Finally, during the spring of 1978, I received a box from the postal office with that mythic TI 57 calculator inside it. What a fantastic advent it was for me! Sure, I was blessed to have access to the IBM 370 mainframe of the high school (that literally required an entire 1000 square feet room to host it). But what a pleasure to possess its own computer at home without the need anymore to be in the long weekly waiting list to compile a program!
The advent of this computer actually changed totally my life for the following months. I was spending most of my recreation time, to write code and elaborate some algorithms even at the detriment of my school work. And, of course, my ultimate quest was this unsurmountable-like challenge of computing pi. No doubt, it was at that time one of the most challenging algorithms for a tiny computer such as a TI 57.
And to better measure how big the challenge was, just think that a TI 57 offers only 49 program steps and 8 memory registers. All this represents a very limited 48 bytes of memory (no need here for multiplicative prefixes such as kilo or megabytes!) to be allocated between program “steps” and storage registers. No “human” programming language such as BASIC or C was existing, the only programming capabilities were similar to a primitive macro assembler. And to add to the pain, the TI-57 lacked non-volatile memory, so any programs entered were lost when the calculator was switched off or the battery ran out.
I was almost demoralized of being ever able to compute pi until I read a monthly specialized pocket computer magazine in which a contest was initiated for rewarding the most efficient pi computation algorithm running on a TI 57. This motivated me again and I committed myself to face this challenge. It took a few weeks for me to nurture a computation method (based on the arc tangent series) that, importantly, could be implemented with the limited memory available. Finally, I ended up with an exactly 49 step program that was able to spill out, almost one by one, each decimal of pi. After a few days of testing the correctness of the algorithm on the very first decimals of pi, I decided it was ready to attempt the ultimate run. I then powered on the TI 57, entered manually the program, and left the calculator running for almost 48 hours… At that point I got the first 15 decimals. Keeping running longer the program would not have gone anywhere because the memory was already exhausted and, even if I had more of it, it would have taken something like a week of computation to get just one additional decimal. I considered nonetheless the program as successful. I was so proud of the outcome that I carefully wrote down the 49 steps of the program and sent it to the magazine.
A few months later, the magazine released the name of the three winners. The top winner was a Belgian guy that had nurtured a program able to compute more than 30 decimals. Unbelievable! This outcome was so impressive to me, I wouldn’t even imagine that it was possible with such a tiny computer. Never underestimate the smartest brains! I am still regretting today not having ever seen the program or just the computation method.
Anyway, I got my (small) revenge a decade later while I was working with C++ on a Spark II Workstation, which allowed me to approach hundreds of thousand decimals within a few hours of execution… What a progress within a decade!
Not only had the desktop computers made giant step towards larger memory and higher speed but I had also time to improve a lot the convergence rate (order of complexity) of the algorithm, derived from my own-built formula:
π=44.arctan (1/21) +36.arctan (4/137) – 4.arctan(263163/368026834)
Note however that accomplishment is very insignificant today. Trillions of decimals can be computed today by using some of the revolutionary Ramanujan’s infinite series converging incredibly fast to pi.