ticalc.org
Basics Archives Community Services Programming
Hardware Help About Search Your Account
   Home :: Archives :: News :: Feature: Calculating Pi

Feature: Calculating Pi
Posted by Nick on 14 March 2000, 03:57 GMT

I hope everyone is having a very happy Pi Day! In case you don't know, today (March 14) is Pi Day. In honor of this, this week's feature will be in homage of our favorite irrational number. Andy Selle has written us a feature regarding pi and its origins.

Check out the updated version instead. It is available in PDF or HTML


Calculating pi: an explorative tour

Andrew Selle (aselle@ticalc.org)


Abstract:

A look at calculating pi with a TI graphing calculator. This article goes through a variety of methods for finding the ever closer decimal approximation of our favorite trancendental number.



Introduction

pi is a very interesting number. We are first introduced to it early in our grade-schooling as a component of the formulas A=pi*r^2and C=2*pi*r. It seems odd to us that we need to use this number. Where did it come from? How did we ever figure it out? These our questions that I hope to address and perhaps answer. However, the major point of this article is to explore methods of calculating pi using a Texas Instruments graphing calculator (and perhaps a few computers).


History

The history of pi is a long one. The first significant advancement in the understanding of pi was the Ancient Greeks. They came up with the concept of inscribing a polygon inside a circle. As you added more sides to the polygon, the polygon became closer and closer to a circle. By taking the ratio between the polygon's area to the circle's area, you could find pi Thus, the first method of calculating pi was born.
During the middle ages, time for calculating pi was not readily available. Even when it was, the polygon inscribing method was very slow and painstaking. It was eventually discovered that an infinite series approximating arctan was a good means to calculate pi. Once the computer was invented, pi was quickly calculated to many places.

This history is in no way complete, but it covers the major ideas.


Math

Obviously, a lot of math is involved in calculating pi. I will derive all my mathematics as completely as possible, but don't be afraid to skip the derivations if you are not interested. I will highlight the important results found to make this easy.

Monte Carlo Method

Derivation

One of my favorite methods, and one of the simplest to understand is the Monte Carlo method. I first ran into this method when I was learning BASIC for my Apple II. One sets up a square that is 2 by 2. One then inscribes a circle inside the square. Random points are then plotted repeatedly. For each point we add one to the variable n, and if the point is within the circle we add one to the variable i. Then to calculate we simply put together what we know. area(circle)=pi*r^2,areasquare = 4. Now, we can setup the proportion 4/pi=i/n. Thus, pi=(4i)/n

Implementation

This program can be easily implemented in 8x TI-BASIC as:

:0 --> N0 --> D
:While 1
:rand*2-1 --> X
:rand*2-1 --> Y
:If sqrt(x^2+y^2)=< 1
:N+1 --> N
:End
:D+1 --> D
:Disp (N/D*4)
:End

Bibliography

1) Dara Hazeghi: Dara's Pi Page http://www.geocities.com/EnchantedForest/5815/,
Accessed 3/4/2000
2) JOC/EFR: Pi Through the Ages http://www-groups.dcs.st-and.ac.uk/


If you don't yet know how to celebrate Pi Day, here's a few tips:

  • Watch the movie Pi. It was written rather recently, and it's a bit artsy, but I love it. I'm planning on watching it with friends during the evening.
  • Serve pie to your classes, or if you don't have enough pie, have it for dinner!
  • Be psychotic like me and memorize sixty digits of pi. :)

Best wishes to you during this Pi Day season.

 


The comments below are written by ticalc.org visitors. Their views are not necessarily those of ticalc.org, and ticalc.org takes no responsibility for their content.


Re: Feature: Calculating Pi
Ray Kremer
(Web Page)

pi*r^2 nothing. Everybody knows pies are round.

     18 March 2000, 07:43 GMT

Re: Feature: Calculating Pi
Paul Schippnick  Account Info
(Web Page)

Of minor interest maybe. But pi is found in the Bible. There are two references. One is easy to find it is 1 Kings 7:23. 22/7 is one approximation for pi, use it to find the verse by remember 1 kings and adding the 1 of 1 kings to 22 for the verse and chapter is of course 7. The common interpetation for pi in the verse is 3. But if you consider the width 10 cubits and the width brim of the basin to be one hand span (verse 26) which is 1/6th cubit and that the 30 cubits circumference would not be the outside of the basin but the inside measurement. You get 30/(10-2/6) for an aproximation of pi 3.1. Of course Bible critics don't want to accept this as a valid interpetation of the text.

     20 March 2000, 20:55 GMT
1  2  3  4  5  6  7  

You can change the number of comments per page in Account Preferences.

  Copyright © 1996-2012, the ticalc.org project. All rights reserved. | Contact Us | Disclaimer