There are a bunch of different methods. One simple one is the Madhava-Liebniz formula, which is:
pi/4 = 1 – 1/3 + 1/5 – 1/7 + … and so on, alternating adding and subtracting with the denominator going up by 2. Each additional number in the sequence gets you closer to pi. You can write a computer program to continue this sequence for a very very long time and get very very close to pi.
However, because pi is irrational, it will only ever just an approximation. But a very very close one.
e is even easier. The definition of e is lim(1+1/n)^n as n->infinity. So just plug in the biggest number you can for n.
There are formulas for these numbers. Typically you decide how many decimal places you want, add a few for precision since some rounding will occur near the end, and run the formula.
The formula involves repeating some steps over and over again, and each time the number gets closer and closer to the right number. When you reach the point that adjustments don’t even show up with the number of decimal points you want, you’re done.
The formula for e is adding up 1 / n! (n factorial) for n starting at 0 and going up to infinity. Each time n goes up, the amount to be added is a smaller number, so you just stop when you have enough decimal points for your needs. The proof of the formula involves calculus, and the fact that e^x is its own derivative.
Keep in mind calculated and defined are two different things.
Let’s take pi, for example. It is defined as the ratio between the circumference of a circle and its diameter. That’s enough to properly define that number. Then showing is is irrational is a bit more complex, but not really related to your question.
And then, calculating the successive digits of pi is a whole other subject. It is not necessary to compute any of those digits to have pi be properly defined. Which is good, because since irrational numbers have infinite digits, we generally couldn’t define them by listing all of those. We do not know all the digits of pi.
As for how we can find digits of pi, the most common method is to use a sum that converges towards pi. Converting sums are nice formulas that add a lot of smaller and smaller numbers, getting closer and closer to their limit value. For example, 1 + 1/2 + 1/4 + 1/8 + … converges toward 2. If you can find a sequence like that and prove that it converges toward pi, then finding digits of pi becomes as simple as just making those additions. The further you go in the addition, the more precise you get.
So the tricky part is to prove that a given sum does converges toward pi. But we do have a few of those. And then to get good computers to compute that to a crazy high precision.
Comments
https://www.reddit.com/r/askscience/comments/b1gvtk/how_are_the_digits_of_pi_actually_calculated/
There are a bunch of different methods. One simple one is the Madhava-Liebniz formula, which is:
pi/4 = 1 – 1/3 + 1/5 – 1/7 + … and so on, alternating adding and subtracting with the denominator going up by 2. Each additional number in the sequence gets you closer to pi. You can write a computer program to continue this sequence for a very very long time and get very very close to pi.
However, because pi is irrational, it will only ever just an approximation. But a very very close one.
e is even easier. The definition of e is lim(1+1/n)^n as n->infinity. So just plug in the biggest number you can for n.
There are formulas for these numbers. Typically you decide how many decimal places you want, add a few for precision since some rounding will occur near the end, and run the formula.
The formula involves repeating some steps over and over again, and each time the number gets closer and closer to the right number. When you reach the point that adjustments don’t even show up with the number of decimal points you want, you’re done.
The formula for
e
is adding up1 / n!
(n factorial) for n starting at 0 and going up to infinity. Each time n goes up, the amount to be added is a smaller number, so you just stop when you have enough decimal points for your needs. The proof of the formula involves calculus, and the fact that e^x is its own derivative.Keep in mind calculated and defined are two different things.
Let’s take pi, for example. It is defined as the ratio between the circumference of a circle and its diameter. That’s enough to properly define that number. Then showing is is irrational is a bit more complex, but not really related to your question.
And then, calculating the successive digits of pi is a whole other subject. It is not necessary to compute any of those digits to have pi be properly defined. Which is good, because since irrational numbers have infinite digits, we generally couldn’t define them by listing all of those. We do not know all the digits of pi.
As for how we can find digits of pi, the most common method is to use a sum that converges towards pi. Converting sums are nice formulas that add a lot of smaller and smaller numbers, getting closer and closer to their limit value. For example, 1 + 1/2 + 1/4 + 1/8 + … converges toward 2. If you can find a sequence like that and prove that it converges toward pi, then finding digits of pi becomes as simple as just making those additions. The further you go in the addition, the more precise you get.
So the tricky part is to prove that a given sum does converges toward pi. But we do have a few of those. And then to get good computers to compute that to a crazy high precision.
The method is very similar to find digits of e.