# Math Help - Different ways of calculating pi

1. ## Different ways of calculating pi

Hi!

I would like to know some different ways of getting an approximation of pi. It can be everything from the simplest methods to the more complex ones where you can calculate thousands or maybe millions or billions of decimals in not too long time. So, maybe different persons can post different ways of calculating pi? I would like to have a formula where you can continue your calculations to get more decimals of pi, without having to do it all from the beginning because you started your calculations with too bad accuracy.

So, I can start with one that is probably one of the simplest possible:

Set $Z = 1$, and $h$ to be $\text{a very small number}$. Set $n = 0$.
While $imag(Z) > 0$ or $real(Z) > 0$, multiply $Z$ by $1 + i \cdot h$ and add $1$ to $n$.
Then multiply $n$ by $h$ to get an approximation of $\pi$. If you want to make it more exactly you can remove $imag(Z)/real(Z)$ from the aproximation.

The value $1 + i \cdot h$ has the argument $h$, approximately, so everytime you multiply $Z$ by $1 + i \cdot h$ you add almost $h$ to the argument of $Z$. When $imag(Z) \leq 0$ and $real(Z) < 0$, the argument of $Z$ is $\geq \pi$. Since $n$ keeps track of how many times you have multiplied $Z$, you can get the approximate argument of $Z$ by multiplying $n$ and $h$. And that little extra angle $Z$ has gone over the x-axis can be approximated by dividing $imag(Z)$ by $real(Z)$, since the angle is so small.

2. $\frac{\pi^2}{6}=1+\frac{1}{2^2}+\frac{1}{3^2}+...$
The limit of this series.

This is mine 34th Post!!!

3. Originally Posted by ThePerfectHacker
$\frac{\pi^2}{6}=1+\frac{1}{2^2}+\frac{1}{3^2}+...$
The limit of this series.

This is mine 34th Post!!!
How did you come up with that equation?

Oh, and then there is a similar one to that just I posted (but not as simple):

Set $x = -e$
While $imag(x) > h$ (where $h$ is a really smal number) or $real(x) < 0$, set $x = \sqrt{x}$.
Then set $x = x - 1$.
Calculate $\frac{imag(x)}{real(x)}$ to get $\pi$. If you want to make it more exactly, remove $\frac{imag(x)\ + \ \displaystyle{\frac{imag(x)^3}{real(x)^2}}}{2}\ =\ \frac{imag(x)\cdot(1 + \pi^2)}{2}$ from the result.

You can see it as if $x = e^{a\cdot (1\ +\ i\cdot\pi)}$. From the beginning $a = 1$. But for every time you set $x = \sqrt{x}$, $a$ is halved. When $a$ is small enough ( $imag(x) \leq h$ and $real(x) \geq 0$), $x$ is almost 1, and the derivative of $x$ ...

I'm so tired I think I will continue later... (^O^)

4. Originally Posted by TriKri
How did you come up with that equation?
Euler gave an informal demonstration of this.
Also he was able to find a formula for all even ones,
$1+\frac{1}{2^4}+\frac{1}{3^4}+...=\frac{\pi^4}{22}$
For 6,8,10,....

The standard why of showing this is through a Fourier series.

5. > The standard why of showing this is through a Fourier series.

Hm, wonder how you show it.

Anyway, I have read that there is some iterative formulas where you can start with a value of $\pi$ and iterate to get a succesive better value, no matter what value of $\pi$ you got currently. I have heard of formulas that doubles the number of decimals in each iteration. Does it sound familiar? Does anyone know of such a formula? Can someone derivate any of them?

6. Originally Posted by TriKri
> The standard why of showing this is through a Fourier series.

Hm, wonder how you show it.
The process is long but here is the idea.
The function $f(x)=x^2$ on $[-\pi,\pi]$ is turned into a periodic function of period $2\pi$ that is, $f(x+2\pi)=f(x)$.
Now by the Fourier (Dirichlet) convergence theorem this function is almost everywhere continous thus it has a Fourier series. After you get that series some manipulations give you the elegant result.

Anyway, I have read that there is some iterative formulas where you can start with a value of $\pi$ and iterate to get a succesive better value, no matter what value of $\pi$ you got currently. I have heard of formulas that doubles the number of decimals in each iteration. Does it sound familiar? Does anyone know of such a formula? Can someone derivate any of them?
A useful way to compute values is through the Newton-Raphson method. Especially easy when we have polynomial functions. But the problem is that $\pi$ is transendental over $\mathbb{Q}$.
Those what you are saying might not be possible.
-----
Here is an infinite series developed by Ramanjuan.
It has a collasol rate of convergence,
$\frac{1}{\pi} = \frac{\sqrt{8}}{9801}\sum_{n=0}^{\infty} \frac{(4n)!}{(n!)^4} \cdot \frac{1103+26390n}{396^{4n}}$
It certainly is not the nicest looking formula.
But the the most effective.
If you have a computer language, program this and see the results.

7. Originally Posted by ThePerfectHacker
Here is an infinite series developed by Ramanjuan.
It has a collasol rate of convergence,
$\frac{1}{\pi} = \frac{\sqrt{8}}{9801}\sum_{n=0}^{\infty} \frac{(4n)!}{(n!)^4} \cdot \frac{1103+26390n}{396^{4n}}$
It certainly is not the nicest looking formula.
But the the most effective.
If you have a computer language, program this and see the results.
What amazes me is that I hear that the amount of accurate decimal places grows exponentially per term

8. Originally Posted by ThePerfectHacker
The process is long but here is the idea.
The function $f(x)=x^2$ on $[-\pi,\pi]$ is turned into a periodic function of period $2\pi$ that is, $f(x+2\pi)=f(x)$.
Now by the Fourier (Dirichlet) convergence theorem this function is almost everywhere continous thus it has a Fourier series. After you get that series some manipulations give you the elegant result.

A useful way to compute values is through the Newton-Raphson method. Especially easy when we have polynomial functions. But the problem is that $\pi$ is transendental over $\mathbb{Q}$.
Those what you are saying might not be possible.
-----
Here is an infinite series developed by Ramanjuan.
It has a collasol rate of convergence,
$\frac{1}{\pi} = \frac{\sqrt{8}}{9801}\sum_{n=0}^{\infty} \frac{(4n)!}{(n!)^4} \cdot \frac{1103+26390n}{396^{4n}}$
It certainly is not the nicest looking formula.
But the the most effective.
If you have a computer language, program this and see the results.
Neato! Just the first term gives 6 decimal places. I'm impressed.

-Dan

9. Originally Posted by topsquark
Neato! Just the first term gives 6 decimal places. I'm impressed.

-Dan
Do not thank me, thank Ramanjuan.. His is one of the people from history I would like to meet.

10. Originally Posted by ThePerfectHacker
Here is an infinite series developed by Ramanjuan.
It has a collasol rate of convergence,
$\frac{1}{\pi} = \frac{\sqrt{8}}{9801}\sum_{n=0}^{\infty} \frac{(4n)!}{(n!)^4} \cdot \frac{1103+26390n}{396^{4n}}$
It certainly is not the nicest looking formula.
But the the most effective.
If you have a computer language, program this and see the results.
Wow, that must be some kind of super-duper formula! Exponentially growing number of correct decimals, that's something.

I have heard there was some guy in the 18:th or 19:th century or something like that who calculated over 700 decimals of pi by hand. Unfortunately for him and for everybody who used the more than 700 decimals daily, 20:th century computers has showed a misscalculation in his approximation after only (only? ) 200 decimals or so. Who was that man?

11. Originally Posted by TriKri
Wow, that must be some kind of super-duper formula! Exponentially growing number of correct decimals, that's something.

I have heard there was some guy in the 18:th or 19:th century or something like that who calculated over 700 decimals of pi by hand. Unfortunately for him and for everybody who used the more than 700 decimals daily, 20:th century computers has showed a misscalculation in his approximation after only (only? ) 200 decimals or so. Who was that man?
19th Century Vienesse mathemation used the classical arctangent formula and through and with aid of a calculating prodigy (Johann Martin Zacharais Dase) in those days those types of people were treated like computers, calculated 200 decimals places in less than 2 months.

12. From Science News 20th May 1995 (I remember reading this note in Nature at the time)
(By the way Bob Matthews is the guy who proved that in any universe with physical
constants compatible with intelligent (carbon based?) lifeforms, Buttered Toast like objects
falling from a worktop at a height suitable for such lifeforms would fall butter(-oid) side
down)

Spying pi in the sky

In the April 20 NATURE, Robert A.J. Matthews of the applied mathematics and computer science department at the University of Aston in Birmingham, England, describes how to use the distribution of bright stars across the night sky to deduce a surprisingly accurate value of pi, the ratio of the circumference of a circle to its diameter.

“My aim was to extract something mathematically interesting from something we’re all familiar with,” Matthews says.

This result follows from an application of certain theorems in number theory. These hold that, given any pair of whole numbers chosen from a large, random collection of numbers, the probability that the two numbers have no common factor other than 1 is 6/¹2 (about 0.61). For example, in a set of numbers including 8, 9, and 27, 9 and 27 have the common factor 3, whereas 8 and 27, as well as 8 and 9, have no common factor apart from 1. It’s possible to calculate the value of pi by determining what proportion of pairs of whole numbers selected from a large, random sample has no common factors.

As the source of random numbers for his “celestial” estimate of pi, Matthews used the angular separation between the positions of pairs of the 100 brightest stars. He checked a million pairs of these numbers for factors and obtained a value of 3.12772 for pi, which is within 0.5 percent of the actual value of 3.14159…. “The ancient Greeks used to believe that numbers lie at the root of all things,” Matthews notes. “I guess this result tends to support that idea.”

And here is the original:

Pi in the sky

Nature 374 681-682 1995

Over the years, people have pointed out that it's possible to get a pretty accurate value of the famous constant Pi ( = 3.14159....) from studying the dimensions of the Great Pyramid. Its base measures 230.35 metres, while its slanting face angle is 51.867 degrees, leading to an apex height of 146.71 metres, and thus a ratio of base to height of 1.5701, which is within 99.96 per cent of the true value of Pi/2. Some have even gone so far as to claim that this proves that aliens helped the great Egyptian engineer/architect Imhotep erect the pyramids. More likely, the presence of Pi in the design is really just a figment of the surveying techniques used, which may well have featured wheeled devices whose circumference is of course simply Pi times the wheel's diameter. In this paper, I show that it is possible to extract a similarly accurate value of Pi from a rather more "cosmic" source: the scattering of the brightest stars in the night sky.

Analytical number theory shows that if any two numbers are plucked at random from a large collection, the probability that two random numbers have no common factors apart from 1 is 6/(Pi)^2. Thus, by taking a large collection of random numbers and checking each pair for common factors, it is possible to estimate Pi. For a "cosmic" source of random numbers, I took the scattering of the 100 brightest stars in the night sky, worked out the angular separation of each star from every other star, and used this to create a collection of one million pairs of random numbers. By using the famous Euclidean algorithm for finding greatest common divisors, I then counted up the number of these pairs that had no common factor, and set the proportion equal to 6/(Pi)^2. The result leads to a value for Pi of 3.12772 - within 99.56 per cent of the true value. All of which shows, I guess, that whacky New Age ideas about mystical numbers and the cosmos aren't as whacky as they sound.

At the time this was published I was a bit perturbed by Bob's reuse of
the same stellar positions to generate a larger sample than possible if
each position is used once. However I simulated the procedure and it
IIRC did give better estimates than what I expected. Perhaps there is
a paper in justifying this reuse of points

RonL

Needles to say I like this approach as it is an example of what I call
Mad Science, which is also exemplified by Watson and Cricks work
on the structure of DNA.

me to science as a child, and is now under threat from what might
be called scientific political correctness, which holds that dull and boring
systematic carefully planned science (as exemplified by Jim Watson's
portrayal of Rosalind Franklin in the Double Helix) is correct science and
Mad Science is an aberration to be killed off.

13. Remembering Bob Matthews' method of estimating pi has reminded
me of the Buffon needle method. Reference can be found here

RonL

14. Originally Posted by CaptainBlack
Buffon needle method.
I have a question on this. When I first saw this I found it really interesting that $\pi$ appears in the probability (I believe that you have to think of the full area of the needle, which forms a circle, and hence $\pi$). But I was told it does not converge very fast. If randomly done on a computer it shall take a few thousand experiments to get a few decimal points. Your approach for calculating $\pi$ is more elegant but I win this competition because mine is more efficient.

15. That random number thing is interesting, cause I don't understand how $\pi$ can be in this kind of discrete probability, if I may say so. I guess that two randomly chosen positive numbers a and b both in the interval $[1, \infty)$ has this chance of not sharing any prime factor: $\prod_{p\text{ prime}} 1 - \frac{1}{p^2}$ because the chance is $\frac{1}{p}$ for a to be divisible by p and hence have prime factor p, and the same is for b. For both a and b to have prime factor p the chance is $\frac{1}{p^2}$. For a and b to not share prime factor p the chance is $1 - \frac{1}{p^2}$. And for a and b to not share any of the primes as a prime factor the chance is $\prod_{p\text{ prime}} 1 - \frac{1}{p^2}$. Though I have no idea how to connect that formula with $\pi$.

Page 1 of 3 123 Last