Drexel dragonThe Math ForumDonate to the Math Forum

Ask Dr. Math - Questions and Answers from our Archives
_____________________________________________
Associated Topics || Dr. Math Home || Search Dr. Math
_____________________________________________

Program to Calculate Pi


Date: 05/23/97 at 01:57:47
From: Toby Kirklin
Subject: The Formula for Pi

I am trying to write a program on my TI-83 calculator that would 
calculate the infinite digits of Pi, while displaying them on-screen.
But I need to know the formula to calculate these digits. Would you or 
any of your colleagues happen to know this? 

Thank you for your time,
   Toby Kirklin


Date: 05/23/97 at 14:20:39
From: Doctor Spunk
Subject: Re: The Formula for Pi

Toby,

Because pi is irrational, you will never actually get very far in 
calculating it with a TI-83. The machines that they use are huge 
supercomputers. 

One formula that has been proven is this:

          oo 
        -----
        \        6
         )      ---  =   (pi)^2. 
        /       n^2
        ------

        n= 1

By running a loop program on the calculator, you will see that this 
does actually converge to Pi^2. So, instead of displaying the values 
calculated, take the square root of the number that you have right 
before it is displayed.

One word of caution! I do not have a TI 83, I am using an 82. I assume 
that they are similar in a few ways. If you know that what I am 
telling you will not work on an 83, try to find someone who knows. 

It might look something like this.

1 stored as X.    0 stored as C.      Label 1.       6/x^2 stored as B

B+C stored as C.  Display (root C).   X+1 stored as X.     Goto 1.

Unfortunately this converges very slowly. Even after 1000 iterations, 
it only has the number 3.14 in place.   However, if you have enough 
patience, it will come out to pi.


Another way to calculate pi is the following.

   2 x 4 x 4 x 6 x 6 x 8 x 8 x 10 x 10 x 12 x 12  .....    pi
   ------------------------------------------------        --
   3 x 3 x 5 x 7 x 7 x 9 x 9 x 11 x 11 x 13 x 13  ......    4
 

Writing a program for this was a bit confusing.

(>> equals stored as) 

2>>x.    3>>c.   1>>a.    Label 1.    x/c >>d.   d*a >>a.   Display 4a

x-c >>e   if e = -1. then    goto 2.    Else goto 3.  End.

Label 3.  c+2 >>c.  Goto 1.

Label 2.  x+2 >>x.  Goto 1.

This converges to pi. It takes a while also, but just think -- all 
those mathematicians over the years never saw what pi was equal to!

There are other formulas, some of which use inverse tangents and other 
weird ways of calculations. There are also plenty of Web pages on the 
internet that are especially devoted to pi.  Check the bottom of our 
"Pi" page (look in the table of contents of the Dr. Math FAQ):

  http://mathforum.org/dr.math/faq/   

You'll also find links there to questions about the irrationality of 
pi, and the number of digits known so far.

-Doctor Spunk,  The Math Forum
 Check out our web site!  http://mathforum.org/dr.math/   
    
Associated Topics:
High School Calculators, Computers
High School Sequences, Series

Search the Dr. Math Library:


Find items containing (put spaces between keywords):
 
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

_____________________________________
Math Forum Home || Math Library || Quick Reference || Math Forum Search
_____________________________________

Ask Dr. MathTM
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/