# Calculating Pi

1. Mar 20, 2005

### KMCB1234

In what way can i calculate PI and output the result to the screen ?
I heard from my friedn that MC method is good but is there any other ways to do that ? also, how many decimal digits am I able to output the result ?
Thank you in advance

-KMCB1234

2. Mar 21, 2005

### Tom McCurdy

Well for what purpose are you trying to calculate pi and what screen are you displaying it on??

3. Mar 21, 2005

### Tom McCurdy

If you are trying to write something to test the speed of computer or machine... or if you just want a basic way of calculating pi
i might suggest

since
$$arctan(1)=\frac{\pi}{4} = 1 - \frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\frac{1}{9}$$...
just multiply by 4 and have your program run a loop
$$\pi= 4-\frac{4}{3}+\frac{4}{5}-\frac{4}{7}+\frac{4}{9}$$...

4. Mar 21, 2005

### Tom McCurdy

Example code for TI-83

Pgrm Pi
Clrhome
4>p
3>n
0>s
lbl AA
Disp "Pi",p
If s=0
then
p-(4/n)>p
1>s
n+2>n
goto AA
End
If s=1
then
p+(4/n)>p
0>s
n+2>n
End
Goto AA

Last edited: Mar 21, 2005
5. Mar 21, 2005

### Tom McCurdy

That should work I haven't tested it I just wrote it... I wrote a similar program a long time ago and I think I did something similar. This isn't the quickest way to calculate pi but its a good one if you want to see digits slowly change into pi.