From what I understand, there s some sort of computer calculating pi

In summary, mathematicians use various methods to calculate pi, including infinite series and formulas such as the Leibniz formula and Machin-like formulas. These methods involve adding up an infinite amount of numbers to get more accurate values. Programs like pifast and the pi demo program for apfloat use highly optimized extended precision math and utilize the Chudnovsky formula. While these methods may not have practical applications in physics, they can be used to generate subsets of pi or e for random numbers.
  • #1
LastTimelord
32
0
... and for a long time, I took this for granted, but now I'm starting to wonder how it is doing this. From my knowledge, the only way one could calculate pi is to measure the diameter and radius of a circle, and find the ratio, but to calculate an irrational decimal as thoroughly as we have would require an unrealistically accurate measurement. There may be some sort of equation that can be used to calculate pi, but I have no idea what it is.

So, how are mathematicians managing to calculate pi?
 
Mathematics news on Phys.org
  • #2
You mean arclength right?

Other ways to calculate pi is to use infinite series that we know converge to pi. One example, though not the best, is the arctan(1) series. Also called leibniz series.

Edit: You may understand this provided you have taken at least calculus 2 or learned it prior.
 
  • #3
But from what I understand, pi is needed in order to calculate arctan... I may be wrong. I really don't know much about this.
 
  • #4
Not quite.

There are lots of nice formulas for calculating pi, most of them fall under the category of infinite series, meaning there are ways to represent pi as the sum of an infinite amount of numbers (with each successive number being added becoming smaller so it approaches pi as the amount of numbers in the series you add up goes to infinity - something mathematicians call convergence).

This is one of many ways to calculate pi:
http://en.wikipedia.org/wiki/Leibniz_formula_for_π
(This is actually not a very efficient method, but it looks nice :)

All a computer does is, using formulas like these, add up millions and billions of fractions to get more and more accurate values.
 
  • #5
I like
[tex]\frac{1}{\pi}=\frac{2\sqrt{2}}{9801} \sum_{n=0}^\infty \frac{(4n)!}{(n!)^4} \cdot \frac{1103+26390n}{396^{4n}}[/tex]

but there are many ways see
http://mathworld.wolfram.com/PiFormulas.html
http://www.numberworld.org/misc_runs/pi-5t/details.html
http://en.wikipedia.org/wiki/Pi
http://en.wikipedia.org/wiki/Machin-like_formula
http://mathworld.wolfram.com/Machin-LikeFormulas.html

for Arctan use a series for Arctan and
pi/4=Actan(1) along with a Machin-like formula such as
Arctan(1)=4Arctan(1/5)-Arctan(1/239)
to speed things up
 
  • #6
Special mention goes to the BBP formula, which allows one to calculate the nth hexadecimal digit of ∏ without calculating the first (n-1)th digits.
 
  • #7
lurflurf said:
Arctan(1)=4Arctan(1/5)-Arctan(1/239)
Note arctan(1) = π/4

another formula, note that dividing by (1/8)^2 can be done with a right shift of 6 bits:

arctan(1) = 6 arctan(1/8) + 2 arctan(1/57) + arctan(1/239)

a bunch of arctan formulas here:

http://www.jjj.de/arctan/arctanpage.html

Programs like pifast:

pifast.html

and the pi demo program for apfloat:

http://apfloat.org

use highly optimized extended precision math and normally use the Chudnovsky formula mentioned on the wiki page linked to above (other methods are offered as options). Since division is relatively slow. it's my understanding that the denominator is generated by multiplication into a huge number then only a single division is done, usually by inverting the denominator and multiplying.

All of this is way beyond anything practical in terms of physics, other than sub-sets of a large value for pi or e could be used for random numbers.
 
Last edited:

1. How is pi calculated by a computer?

A computer uses a variety of algorithms and formulas to calculate pi, such as the Gregory-Leibniz series or the Chudnovsky algorithm. These methods involve continuously refining the value of pi by adding more terms to the equation.

2. Can a computer calculate pi accurately?

Yes, a computer can calculate pi to an extremely high level of accuracy. In fact, the current world record for calculating pi is over 31 trillion digits, achieved by a team using a computer cluster.

3. What is the significance of calculating pi?

Pi is a mathematical constant that represents the ratio of a circle's circumference to its diameter. It is used in a wide range of mathematical and scientific calculations, and its value has been studied and approximated for centuries.

4. How long does it take for a computer to calculate pi?

The time it takes for a computer to calculate pi depends on the method being used and the desired level of accuracy. Some algorithms can calculate pi quickly, while others may take longer to converge to the correct value.

5. Can a computer ever calculate pi exactly?

No, a computer can only approximate pi to a certain number of digits. This is because pi is an irrational number, meaning it has an infinite number of digits after the decimal point and cannot be expressed as a fraction.

Similar threads

Replies
2
Views
829
  • General Math
Replies
6
Views
2K
Replies
9
Views
1K
  • General Math
Replies
14
Views
2K
Replies
8
Views
4K
Replies
6
Views
1K
Replies
8
Views
883
Replies
1
Views
1K
Replies
1
Views
1K
Replies
11
Views
3K
Back
Top