#### Archived

This topic is now archived and is closed to further replies.

# Calculating PI

This topic is 5398 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I was experimenting a little in calculus the other day, and I came up with:

pi = 4*∫01sqrt(1-x2)dx

I didn't check it, but I'd imagine it's right.

Hmmm, that means that atan(1) = ∫01sqrt(1-x2)dx

[EDIT] pi in this font doesn't really look like pi ( π )

______________________________________________________________
The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ
MySite
______________________________________________________________

[edited by - Thunder_Hawk on February 29, 2004 1:40:59 PM]

##### Share on other sites
Theres an article on msdn by Chris Sells on multithreading using C#. The sample program for the article can calculate pi to any given number of digits.
I haven''t looked at the source code because i am trying to do it first. The algorithm calculates 9 digits of pi at a time on a secondary thread which then updates a progressbar.

##### Share on other sites
Wow, people here are really uneducated about our second favorite constant pi (we like e the most, and if you don''t know what it is or why, then don''t ask). Off the top of my head, pi = 3.1415926535897932384626433... and can be found using various inverse trigonometric functions, although atan is probably the best because it''s intrisic to the FPU. The FPU also has a load-pi instruction, as well as others for other important constants. Pi is defined as M_PI in math.h if you need it for programming in C(++). ToohrVyk''s original post mentioned several ways of calculating it analytically, although zeta(2), the sum he described, converges VERY slowly. The method Shadowdancer gave was given by Ramanujan, and probably isn''t accurate enough for use in programming.

If you want analytic ways to obtain pi, look into the Dirichlet beta, eta and lambda functions. beta(1) = pi / 4 is probably the best one to go with although I do not know speed of convergence. Also look for the algorithm that is quartically convergent on pi.

##### Share on other sites
quote:
Original post by Thunder_Hawk
I was experimenting a little in calculus the other day, and I came up with:

π = 4*∫01sqrt(1-x2)dx

I didn''t check it, but I''d imagine it''s right.

Hmmm, that means that atan(1) = ∫01sqrt(1-x2)dx

I think you might have forgetten a 1 / there because the integeral of 1 / sqrt(1 - x ^ 2) is arctan of x if I remember correctly.

##### Share on other sites
quote:
Original post by vEEcEE
I''ve seen people use atan(1)*4 for PI

Except for the fact it''s really darn slow and innacurate (you have to do math at extremely high precision and with billions of terms to get a few digits)

Excellent reference: http://www.cygnus-software.com/misc/pidigits.htm

##### Share on other sites
Bailey-Borwein-Plouffe forumla is my favorite...only gives you hex digits though.

Google for spigot algorithms for pi.

##### Share on other sites
Wow!!! Thats alot of info.

Thank you very much.

##### Share on other sites
quote:
Original post by Puzzler183
I think you might have forgetten a 1 / there because the integeral of 1 / sqrt(1 - x ^ 2) is arctan of x if I remember correctly.

Yes, you remembered correctly

##### Share on other sites
If you use degrees with your trigonometry functions (sine,...) you can do this:

Pi = n * sin(180/n)

the higher n is, the more exacter Pi will be calculated

QB 4 EVER

[edited by - akOOma on February 29, 2004 2:51:39 PM]

##### Share on other sites
atan(1)*4=3.14159265......

There is another algorithm I found once it lets you calculate pi to the 70,000 digit I forget whats it called though >.<

[edited by - DevLiquidKnight on February 29, 2004 2:08:06 PM]

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633702
• Total Posts
3013448
×