Online since 1998

Happy Pi Day – A Developer’s Perspective

Pi Day - 3.14Today is March 14, 2015. It’s a day that has mathematicians abuzz. In the United States style of writing dates, today is also know as 3/14/15. If you forget about that whole Y2K thing, the date is very similar to the first few digits of Pi. That’s 3.1415. For the extra fanatical, 9:26 AM (or even PM) adds a few digits to the end. However, there are lots of nonterminating decimals in the universe. What’s so special about Pi?

The most dramatic explanation of Pi that I’ve seen was from an episode of Person of Interest. In Season 2, episode 11, Computer Programmer (and Hacker) Harold Finch disguises himself as a math teacher. He responds to the question, “What good is any of this for, and when would we ever use it?”

Let me show you. Pi, the ratio of the circumference of a circle to its diameter, and this is just the beginning; it keeps on going, forever, without ever repeating. Which means that contained within this string of decimals, is every single other number. Your birthdate, combination to your locker, your social security number, it’s all in there, somewhere. And if you convert these decimals into letters, you would have every word that ever existed in every possible combination; the first syllable you spoke as a baby, the name of your latest crush, your entire life story from beginning to end, everything we ever say or do; all of the world’s infinite possibilities rest within this one simple circle. Now what you do with that information; what it’s good for, well that would be up to you.

The episode is aptly named 2πr (iTunes: which is also the formula for calculating the circumference circle.

I like to think of Person of Interest as more of a documentary, rather than just TV show, but even I have to admit that quote is a bit dramatic. Back in my high school days, I felt much like the students in the show. I didn’t see a practical use for Pi. I was losing interest in math in general. But today, I feel differently. While I’m not going to use Pi to search for my life story, it is pretty handy for game development.

To make a game believable, it often helps to mimic the real world. While game physics don’t have to be exactly like reality, using Pi is a great way to start. Imagine a spaceship flying through an asteroid field. What happens if the spaceship collides with an asteroid? How much damage should occur? If the asteroids are all random sizes, but circular / spherical, using Pi can create a challenging difficulty. For smaller asteroids, the damage is not that significant, but a collision with a larger asteroid could mean instant death.

The reverse also works. As the player charges up the spaceship’s main gun, the spherical projectiles fired could be larger. The larger the projectile, the more massive the damage – and more massive the energy drain. Pi becomes just another tool in your digital tool belt. Stencyl even has a dedicated block for Pi. While I admit that I don’t often use Pi in my projects, when I do it feels extra satisfying. The trick in making Pi useful is in understand the Pi related formulas.

  • 2πr = Circumference of a circle
  • πr² = Area of a circle
  • 4πr² = Surface Area of a sphere
  • (4/3)πr³ = Volume of a sphere

Perhaps that’s why there’s such a fuss over Pi Day. Circles and spheres play an important role in STEM professions. We live in a logical universe. Pi helps us to understand the rules. It’s beautiful to think that such complexity – and yet simplicity – can be found with Pi.

I think the apprehension towards Pi day is in how to celebrate it. Do you eat a lot of pie? Do you sit and calculate complex formulas? Do you catch up on Person of Interest episodes? The answer doesn’t seem that clear to me. I’m glad the day exists though. Making math more personal, and perhaps even more entertaining, is what is needed for people – not just students – to expand their knowledge.

Leave a Reply

Featured Book

A Book About Hype Cover
Learn how to create apps, books, games and websites with A Book About Hype.