1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. Oct 23, 2012 #1
    ... 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?
  2. jcsd
  3. Oct 23, 2012 #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.
  4. Oct 23, 2012 #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.
  5. Oct 23, 2012 #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:
    (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.
  6. Oct 23, 2012 #5


    User Avatar
    Homework Helper

    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

    for Arctan use a series for Arctan and
    pi/4=Actan(1) along with a Machin-like formula such as
    to speed things up
  7. Oct 23, 2012 #6


    User Avatar
    Science Advisor

    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.
  8. Oct 23, 2012 #7


    User Avatar
    Homework Helper

    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:


    Programs like pifast:


    and the pi demo program for apfloat:


    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: Oct 23, 2012
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook