• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Post your method of calculating pi.

notfred

Lifer
I wrote a little script to calculate pi based on the series (-1)^(n+1) * (1/(2n-1)).
It does the first million iterations, and is fairly accurate, I get: 3.14159165358977

here's the script:
#!/usr/bin/perl -w
$pi = 0;
for($n = 1; $n <= 1000000; $n++){
$pi += (-1)**($n+1) * (1/(2 * $n - 1));
}
$pi *= 4;
print "$pi\n";

I'm sure there are more effecient ways than that, and there are those calcultors on line that can jsut keep spitting out pi to as many places as you like.

Anyone got any good pi computations?
 
Originally posted by: Tyler
is fairly accurate

um, is that like fairly pregnant?

isn't a number either pi or not?

how can it only be "fairly" accurate, it either calculates pi or it doesn't?

😕
 
Originally posted by: Tyler
I wrote a little script to calculate pi based on the series (-1)^(n+1) * (1/2n-1).
It does the first million iterations, and is fairly accurate, I get: 3.14159165358977

Shouldn't it be 3.1415926535....?

 
Ingredients
- 6 cups thinly sliced apples
- 3/4 cup white sugar
- 1 tablespoon butter
- 1 teaspoon ground cinnamon
- 1 pastry for a 9 inch single crust pie

Directions
- Prepare your pastry for a two crust pie. Wipe, quarter, core, peel, and slice apples; measure to 6 cups.
- Combine sugar and cinnamon. The amount of sugar used depends on how tart your apples are.
- Arrange apples in layers in pastry lined pie plate. Sprinkle each layer with sugar and cinnamon. Dot top layer with small pieces of butter or margarine. Cover with top crust.
- Place on lowest rack in oven preheated to 450 degrees F (230 degrees C). Bake for 10 minutes, then reduce oven temperature to 350 degrees F (175 degrees C). Bake for 30 to 35 minutes longer. Serve warm or cold.

That's how I calculate pie.

- M4H
 
Originally posted by: edro13
I hit the PI key on my TI-89 and it does a farely good job of calculating it 😀

I did that in high school. I've never had to use it since then, so i don't calculate Pi
 
Originally posted by: FoBoT
Originally posted by: Tyler
is fairly accurate

um, is that like fairly pregnant?

isn't a number either pi or not?

how can it only be "fairly" accurate, it either calculates pi or it doesn't?

😕

Unless you've got an infinite amount of time, all you can do is approximate Pi. I always go for 22/7.
 
Originally posted by: FoBoT
Originally posted by: Tyler
is fairly accurate

um, is that like fairly pregnant?

isn't a number either pi or not?

how can it only be "fairly" accurate, it either calculates pi or it doesn't?

😕

It's an infinite series. The farther out I go, the closer I get to pi. You don't expect me to do an infinite number of calculations, do you? I did 1 million, which, IMO, is fairly accurate.

-w enables warnings.
 
Originally posted by: FoBoT
Originally posted by: Tyler
is fairly accurate

um, is that like fairly pregnant?

isn't a number either pi or not?

how can it only be "fairly" accurate, it either calculates pi or it doesn't?

😕


The number "pi" can never be completely accruate since it doesn't end...as far as anyone's found. Therefore you're always using a "fairly" accurate representation of it.

amish
 
I actually did a paper on methods of calculating pi (was assigned in a calculus class).

I don't recall the specifics of the generally accepted standard (at least at that time), but it got complex VERY quickly. After only three iterations it became too complicated to easily fit on one page, & to obtain any decent level of accuracy you had to do it 30+ times.

For my purposes SuperPi works great.

😀

Viper GTS
 
Originally posted by: Tyler
Originally posted by: FoBoT
Originally posted by: Tyler
is fairly accurate

um, is that like fairly pregnant?

isn't a number either pi or not?

how can it only be "fairly" accurate, it either calculates pi or it doesn't?

😕

It's an infinite series. The farther out I go, the closer I get to pi. You don't expect me to do an infinite number of calculations, do you? I did 1 million, which, IMO, is fairly accurate.

-w enables warnings.


oh, you mean it is accurate as far as you have gone, ok , i get it
i thought you meant some early digits might be off, nevermind
 
You can use:

PI = 24 arctan(1/8) + 8 arctan(1/57) + 4 arctan(1/239)

where arctan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...

This will converge much faster.
 
Back
Top